[FREETYPE]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 26 May 2010 10:40:15 +0000 (10:40 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 26 May 2010 10:40:15 +0000 (10:40 +0000)
Patch by Jerome Gardou: Update freetype to 2.3.9
The FT_MulFix patch is not neccessary anymore, the 1BPP -> 8BPP conversion patch will be applied again right after this.
See issue #4537 for more details.

svn path=/trunk/; revision=47360

363 files changed:
reactos/lib/3rdparty/freetype/ChangeLog
reactos/lib/3rdparty/freetype/ChangeLog.21
reactos/lib/3rdparty/freetype/ChangeLog.22
reactos/lib/3rdparty/freetype/Jamfile
reactos/lib/3rdparty/freetype/README
reactos/lib/3rdparty/freetype/README.git [new file with mode: 0644]
reactos/lib/3rdparty/freetype/autogen.sh
reactos/lib/3rdparty/freetype/configure
reactos/lib/3rdparty/freetype/devel/ftoption.h
reactos/lib/3rdparty/freetype/freetype.def
reactos/lib/3rdparty/freetype/freetype.rbuild
reactos/lib/3rdparty/freetype/include/freetype/config/ftconfig.h
reactos/lib/3rdparty/freetype/include/freetype/config/ftheader.h
reactos/lib/3rdparty/freetype/include/freetype/config/ftmodule.h
reactos/lib/3rdparty/freetype/include/freetype/config/ftoption.h
reactos/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h
reactos/lib/3rdparty/freetype/include/freetype/freetype.h
reactos/lib/3rdparty/freetype/include/freetype/ftadvanc.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/include/freetype/ftbbox.h
reactos/lib/3rdparty/freetype/include/freetype/ftbdf.h
reactos/lib/3rdparty/freetype/include/freetype/ftbitmap.h
reactos/lib/3rdparty/freetype/include/freetype/ftcache.h
reactos/lib/3rdparty/freetype/include/freetype/ftchapters.h
reactos/lib/3rdparty/freetype/include/freetype/ftcid.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/include/freetype/ftgasp.h
reactos/lib/3rdparty/freetype/include/freetype/ftglyph.h
reactos/lib/3rdparty/freetype/include/freetype/ftgxval.h
reactos/lib/3rdparty/freetype/include/freetype/ftgzip.h
reactos/lib/3rdparty/freetype/include/freetype/ftimage.h
reactos/lib/3rdparty/freetype/include/freetype/ftincrem.h
reactos/lib/3rdparty/freetype/include/freetype/ftlcdfil.h
reactos/lib/3rdparty/freetype/include/freetype/ftlist.h
reactos/lib/3rdparty/freetype/include/freetype/ftlzw.h
reactos/lib/3rdparty/freetype/include/freetype/ftmac.h
reactos/lib/3rdparty/freetype/include/freetype/ftmm.h
reactos/lib/3rdparty/freetype/include/freetype/ftmodapi.h
reactos/lib/3rdparty/freetype/include/freetype/ftotval.h
reactos/lib/3rdparty/freetype/include/freetype/ftoutln.h
reactos/lib/3rdparty/freetype/include/freetype/ftpfr.h
reactos/lib/3rdparty/freetype/include/freetype/ftrender.h
reactos/lib/3rdparty/freetype/include/freetype/ftsizes.h
reactos/lib/3rdparty/freetype/include/freetype/ftsnames.h
reactos/lib/3rdparty/freetype/include/freetype/ftstroke.h
reactos/lib/3rdparty/freetype/include/freetype/ftsynth.h
reactos/lib/3rdparty/freetype/include/freetype/ftsystem.h
reactos/lib/3rdparty/freetype/include/freetype/fttypes.h
reactos/lib/3rdparty/freetype/include/freetype/ftwinfnt.h
reactos/lib/3rdparty/freetype/include/freetype/ftxf86.h
reactos/lib/3rdparty/freetype/include/freetype/internal/autohint.h
reactos/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h
reactos/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h
reactos/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h
reactos/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h
reactos/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h
reactos/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h
reactos/lib/3rdparty/freetype/include/freetype/internal/ftpic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h
reactos/lib/3rdparty/freetype/include/freetype/internal/ftserv.h
reactos/lib/3rdparty/freetype/include/freetype/internal/fttrace.h
reactos/lib/3rdparty/freetype/include/freetype/internal/internal.h
reactos/lib/3rdparty/freetype/include/freetype/internal/psaux.h
reactos/lib/3rdparty/freetype/include/freetype/internal/pshints.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h
reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h
reactos/lib/3rdparty/freetype/include/freetype/internal/sfnt.h
reactos/lib/3rdparty/freetype/include/freetype/internal/t1types.h
reactos/lib/3rdparty/freetype/include/freetype/internal/tttypes.h
reactos/lib/3rdparty/freetype/include/freetype/t1tables.h
reactos/lib/3rdparty/freetype/include/freetype/ttnameid.h
reactos/lib/3rdparty/freetype/include/freetype/tttables.h
reactos/lib/3rdparty/freetype/include/freetype/tttags.h
reactos/lib/3rdparty/freetype/modules.cfg
reactos/lib/3rdparty/freetype/src/autofit/Jamfile
reactos/lib/3rdparty/freetype/src/autofit/afcjk.c
reactos/lib/3rdparty/freetype/src/autofit/afcjk.h
reactos/lib/3rdparty/freetype/src/autofit/afdummy.c
reactos/lib/3rdparty/freetype/src/autofit/afdummy.h
reactos/lib/3rdparty/freetype/src/autofit/afglobal.c
reactos/lib/3rdparty/freetype/src/autofit/afglobal.h
reactos/lib/3rdparty/freetype/src/autofit/afhints.c
reactos/lib/3rdparty/freetype/src/autofit/afhints.h
reactos/lib/3rdparty/freetype/src/autofit/afindic.c
reactos/lib/3rdparty/freetype/src/autofit/afindic.h
reactos/lib/3rdparty/freetype/src/autofit/aflatin.c
reactos/lib/3rdparty/freetype/src/autofit/aflatin.h
reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c
reactos/lib/3rdparty/freetype/src/autofit/aflatin2.h
reactos/lib/3rdparty/freetype/src/autofit/afloader.c
reactos/lib/3rdparty/freetype/src/autofit/afmodule.c
reactos/lib/3rdparty/freetype/src/autofit/afmodule.h
reactos/lib/3rdparty/freetype/src/autofit/afpic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/autofit/afpic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/autofit/aftypes.h
reactos/lib/3rdparty/freetype/src/autofit/afwarp.c
reactos/lib/3rdparty/freetype/src/autofit/autofit.c
reactos/lib/3rdparty/freetype/src/autofit/module.mk
reactos/lib/3rdparty/freetype/src/base/Jamfile
reactos/lib/3rdparty/freetype/src/base/basepic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/base/basepic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/base/ftadvanc.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/base/ftbase.c
reactos/lib/3rdparty/freetype/src/base/ftbase.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/base/ftbbox.c
reactos/lib/3rdparty/freetype/src/base/ftbitmap.c
reactos/lib/3rdparty/freetype/src/base/ftcalc.c
reactos/lib/3rdparty/freetype/src/base/ftcid.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/base/ftdbgmem.c
reactos/lib/3rdparty/freetype/src/base/ftdebug.c
reactos/lib/3rdparty/freetype/src/base/ftfstype.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/base/ftgloadr.c
reactos/lib/3rdparty/freetype/src/base/ftglyph.c
reactos/lib/3rdparty/freetype/src/base/ftinit.c
reactos/lib/3rdparty/freetype/src/base/ftlcdfil.c
reactos/lib/3rdparty/freetype/src/base/ftmac.c
reactos/lib/3rdparty/freetype/src/base/ftmm.c
reactos/lib/3rdparty/freetype/src/base/ftobjs.c
reactos/lib/3rdparty/freetype/src/base/ftotval.c
reactos/lib/3rdparty/freetype/src/base/ftoutln.c
reactos/lib/3rdparty/freetype/src/base/ftpatent.c
reactos/lib/3rdparty/freetype/src/base/ftpfr.c
reactos/lib/3rdparty/freetype/src/base/ftpic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/base/ftrfork.c
reactos/lib/3rdparty/freetype/src/base/ftsnames.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/base/ftstream.c
reactos/lib/3rdparty/freetype/src/base/ftstroke.c
reactos/lib/3rdparty/freetype/src/base/ftsynth.c
reactos/lib/3rdparty/freetype/src/base/ftsystem.c
reactos/lib/3rdparty/freetype/src/base/fttrigon.c
reactos/lib/3rdparty/freetype/src/base/rules.mk
reactos/lib/3rdparty/freetype/src/bdf/bdf.h
reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c
reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.h
reactos/lib/3rdparty/freetype/src/bdf/bdflib.c
reactos/lib/3rdparty/freetype/src/bdf/module.mk
reactos/lib/3rdparty/freetype/src/bdf/rules.mk
reactos/lib/3rdparty/freetype/src/cache/ftcbasic.c
reactos/lib/3rdparty/freetype/src/cache/ftccache.c
reactos/lib/3rdparty/freetype/src/cache/ftccache.h
reactos/lib/3rdparty/freetype/src/cache/ftccback.h
reactos/lib/3rdparty/freetype/src/cache/ftccmap.c
reactos/lib/3rdparty/freetype/src/cache/ftcglyph.c
reactos/lib/3rdparty/freetype/src/cache/ftcglyph.h
reactos/lib/3rdparty/freetype/src/cache/ftcimage.c
reactos/lib/3rdparty/freetype/src/cache/ftcmanag.c
reactos/lib/3rdparty/freetype/src/cache/ftcmru.c
reactos/lib/3rdparty/freetype/src/cache/ftcmru.h
reactos/lib/3rdparty/freetype/src/cache/ftcsbits.c
reactos/lib/3rdparty/freetype/src/cache/rules.mk
reactos/lib/3rdparty/freetype/src/cff/Jamfile
reactos/lib/3rdparty/freetype/src/cff/cff.c
reactos/lib/3rdparty/freetype/src/cff/cffcmap.c
reactos/lib/3rdparty/freetype/src/cff/cffcmap.h
reactos/lib/3rdparty/freetype/src/cff/cffdrivr.c
reactos/lib/3rdparty/freetype/src/cff/cffdrivr.h
reactos/lib/3rdparty/freetype/src/cff/cffgload.c
reactos/lib/3rdparty/freetype/src/cff/cffgload.h
reactos/lib/3rdparty/freetype/src/cff/cffload.c
reactos/lib/3rdparty/freetype/src/cff/cffload.h
reactos/lib/3rdparty/freetype/src/cff/cffobjs.c
reactos/lib/3rdparty/freetype/src/cff/cffobjs.h
reactos/lib/3rdparty/freetype/src/cff/cffparse.c
reactos/lib/3rdparty/freetype/src/cff/cffparse.h
reactos/lib/3rdparty/freetype/src/cff/cffpic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/cff/cffpic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/cff/cfftypes.h
reactos/lib/3rdparty/freetype/src/cff/module.mk
reactos/lib/3rdparty/freetype/src/cid/cidgload.c
reactos/lib/3rdparty/freetype/src/cid/cidload.c
reactos/lib/3rdparty/freetype/src/cid/cidobjs.c
reactos/lib/3rdparty/freetype/src/cid/cidparse.c
reactos/lib/3rdparty/freetype/src/cid/cidriver.c
reactos/lib/3rdparty/freetype/src/cid/cidriver.h
reactos/lib/3rdparty/freetype/src/cid/cidtoken.h
reactos/lib/3rdparty/freetype/src/cid/module.mk
reactos/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h
reactos/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvjust.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvkern.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmod.h
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort.h
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvprop.c
reactos/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c
reactos/lib/3rdparty/freetype/src/gxvalid/module.mk
reactos/lib/3rdparty/freetype/src/gzip/adler32.c
reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c
reactos/lib/3rdparty/freetype/src/gzip/inftrees.c
reactos/lib/3rdparty/freetype/src/gzip/zconf.h
reactos/lib/3rdparty/freetype/src/gzip/zutil.c
reactos/lib/3rdparty/freetype/src/gzip/zutil.h
reactos/lib/3rdparty/freetype/src/lzw/ftlzw.c
reactos/lib/3rdparty/freetype/src/lzw/ftzopen.c
reactos/lib/3rdparty/freetype/src/lzw/ftzopen.h
reactos/lib/3rdparty/freetype/src/otvalid/Jamfile
reactos/lib/3rdparty/freetype/src/otvalid/module.mk
reactos/lib/3rdparty/freetype/src/otvalid/otvalid.c
reactos/lib/3rdparty/freetype/src/otvalid/otvalid.h
reactos/lib/3rdparty/freetype/src/otvalid/otvbase.c
reactos/lib/3rdparty/freetype/src/otvalid/otvcommn.c
reactos/lib/3rdparty/freetype/src/otvalid/otvcommn.h
reactos/lib/3rdparty/freetype/src/otvalid/otvgdef.c
reactos/lib/3rdparty/freetype/src/otvalid/otvgpos.c
reactos/lib/3rdparty/freetype/src/otvalid/otvgsub.c
reactos/lib/3rdparty/freetype/src/otvalid/otvjstf.c
reactos/lib/3rdparty/freetype/src/otvalid/otvmath.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/otvalid/otvmod.c
reactos/lib/3rdparty/freetype/src/otvalid/otvmod.h
reactos/lib/3rdparty/freetype/src/otvalid/rules.mk
reactos/lib/3rdparty/freetype/src/pcf/module.mk
reactos/lib/3rdparty/freetype/src/pcf/pcf.h
reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c
reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.h
reactos/lib/3rdparty/freetype/src/pcf/pcfread.c
reactos/lib/3rdparty/freetype/src/pcf/pcfutil.c
reactos/lib/3rdparty/freetype/src/pcf/pcfutil.h
reactos/lib/3rdparty/freetype/src/pcf/rules.mk
reactos/lib/3rdparty/freetype/src/pfr/module.mk
reactos/lib/3rdparty/freetype/src/pfr/pfrcmap.c
reactos/lib/3rdparty/freetype/src/pfr/pfrdrivr.c
reactos/lib/3rdparty/freetype/src/pfr/pfrdrivr.h
reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c
reactos/lib/3rdparty/freetype/src/pfr/pfrload.c
reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c
reactos/lib/3rdparty/freetype/src/pfr/pfrsbit.c
reactos/lib/3rdparty/freetype/src/pfr/pfrtypes.h
reactos/lib/3rdparty/freetype/src/psaux/afmparse.c
reactos/lib/3rdparty/freetype/src/psaux/afmparse.h
reactos/lib/3rdparty/freetype/src/psaux/module.mk
reactos/lib/3rdparty/freetype/src/psaux/psauxmod.h
reactos/lib/3rdparty/freetype/src/psaux/psconv.c
reactos/lib/3rdparty/freetype/src/psaux/psconv.h
reactos/lib/3rdparty/freetype/src/psaux/psobjs.c
reactos/lib/3rdparty/freetype/src/psaux/psobjs.h
reactos/lib/3rdparty/freetype/src/psaux/t1cmap.c
reactos/lib/3rdparty/freetype/src/psaux/t1decode.c
reactos/lib/3rdparty/freetype/src/pshinter/Jamfile
reactos/lib/3rdparty/freetype/src/pshinter/module.mk
reactos/lib/3rdparty/freetype/src/pshinter/pshalgo.c
reactos/lib/3rdparty/freetype/src/pshinter/pshalgo.h
reactos/lib/3rdparty/freetype/src/pshinter/pshinter.c
reactos/lib/3rdparty/freetype/src/pshinter/pshmod.c
reactos/lib/3rdparty/freetype/src/pshinter/pshmod.h
reactos/lib/3rdparty/freetype/src/pshinter/pshpic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/pshinter/pshpic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/pshinter/pshrec.c
reactos/lib/3rdparty/freetype/src/pshinter/pshrec.h
reactos/lib/3rdparty/freetype/src/psnames/Jamfile
reactos/lib/3rdparty/freetype/src/psnames/module.mk
reactos/lib/3rdparty/freetype/src/psnames/psmodule.c
reactos/lib/3rdparty/freetype/src/psnames/psmodule.h
reactos/lib/3rdparty/freetype/src/psnames/psnames.c
reactos/lib/3rdparty/freetype/src/psnames/pspic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/psnames/pspic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/psnames/pstables.h
reactos/lib/3rdparty/freetype/src/raster/Jamfile
reactos/lib/3rdparty/freetype/src/raster/ftmisc.h
reactos/lib/3rdparty/freetype/src/raster/ftraster.c
reactos/lib/3rdparty/freetype/src/raster/ftrend1.c
reactos/lib/3rdparty/freetype/src/raster/ftrend1.h
reactos/lib/3rdparty/freetype/src/raster/module.mk
reactos/lib/3rdparty/freetype/src/raster/raster.c
reactos/lib/3rdparty/freetype/src/raster/rastpic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/raster/rastpic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/raster/rules.mk
reactos/lib/3rdparty/freetype/src/sfnt/Jamfile
reactos/lib/3rdparty/freetype/src/sfnt/module.mk
reactos/lib/3rdparty/freetype/src/sfnt/rules.mk
reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c
reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.h
reactos/lib/3rdparty/freetype/src/sfnt/sfnt.c
reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c
reactos/lib/3rdparty/freetype/src/sfnt/ttbdf.c
reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c
reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.h
reactos/lib/3rdparty/freetype/src/sfnt/ttcmapc.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/sfnt/ttkern.c
reactos/lib/3rdparty/freetype/src/sfnt/ttload.c
reactos/lib/3rdparty/freetype/src/sfnt/ttmtx.c
reactos/lib/3rdparty/freetype/src/sfnt/ttpost.c
reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c
reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.h
reactos/lib/3rdparty/freetype/src/sfnt/ttsbit0.c
reactos/lib/3rdparty/freetype/src/smooth/Jamfile
reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c
reactos/lib/3rdparty/freetype/src/smooth/ftgrays.h
reactos/lib/3rdparty/freetype/src/smooth/ftsmooth.c
reactos/lib/3rdparty/freetype/src/smooth/ftsmooth.h
reactos/lib/3rdparty/freetype/src/smooth/ftspic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/smooth/ftspic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/smooth/module.mk
reactos/lib/3rdparty/freetype/src/smooth/smooth.c
reactos/lib/3rdparty/freetype/src/tools/apinames.c
reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py
reactos/lib/3rdparty/freetype/src/tools/docmaker/docbeauty.py
reactos/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py
reactos/lib/3rdparty/freetype/src/tools/docmaker/formatter.py
reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py
reactos/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py
reactos/lib/3rdparty/freetype/src/tools/docmaker/utils.py
reactos/lib/3rdparty/freetype/src/tools/ftrandom/ftrandom.c
reactos/lib/3rdparty/freetype/src/tools/glnames.py
reactos/lib/3rdparty/freetype/src/tools/test_afm.c
reactos/lib/3rdparty/freetype/src/truetype/Jamfile
reactos/lib/3rdparty/freetype/src/truetype/module.mk
reactos/lib/3rdparty/freetype/src/truetype/truetype.c
reactos/lib/3rdparty/freetype/src/truetype/ttdriver.c
reactos/lib/3rdparty/freetype/src/truetype/ttdriver.h
reactos/lib/3rdparty/freetype/src/truetype/ttgload.c
reactos/lib/3rdparty/freetype/src/truetype/ttgload.h
reactos/lib/3rdparty/freetype/src/truetype/ttgxvar.c
reactos/lib/3rdparty/freetype/src/truetype/ttgxvar.h
reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c
reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c
reactos/lib/3rdparty/freetype/src/truetype/ttobjs.h
reactos/lib/3rdparty/freetype/src/truetype/ttpic.c [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/truetype/ttpic.h [new file with mode: 0644]
reactos/lib/3rdparty/freetype/src/truetype/ttpload.c
reactos/lib/3rdparty/freetype/src/type1/module.mk
reactos/lib/3rdparty/freetype/src/type1/t1afm.c
reactos/lib/3rdparty/freetype/src/type1/t1driver.c
reactos/lib/3rdparty/freetype/src/type1/t1driver.h
reactos/lib/3rdparty/freetype/src/type1/t1gload.c
reactos/lib/3rdparty/freetype/src/type1/t1gload.h
reactos/lib/3rdparty/freetype/src/type1/t1load.c
reactos/lib/3rdparty/freetype/src/type1/t1objs.c
reactos/lib/3rdparty/freetype/src/type1/t1parse.c
reactos/lib/3rdparty/freetype/src/type1/t1parse.h
reactos/lib/3rdparty/freetype/src/type1/t1tokens.h
reactos/lib/3rdparty/freetype/src/type42/module.mk
reactos/lib/3rdparty/freetype/src/type42/rules.mk
reactos/lib/3rdparty/freetype/src/type42/t42drivr.c
reactos/lib/3rdparty/freetype/src/type42/t42drivr.h
reactos/lib/3rdparty/freetype/src/type42/t42objs.c
reactos/lib/3rdparty/freetype/src/type42/t42parse.c
reactos/lib/3rdparty/freetype/src/type42/t42types.h
reactos/lib/3rdparty/freetype/src/winfonts/module.mk
reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c
reactos/lib/3rdparty/freetype/src/winfonts/winfnt.h

index cd5a4df..0407890 100644 (file)
+2009-10-10  Werner Lemberg  <wl@gnu.org>
+
+       * Version 2.3.11 released.
+       ==========================
+
+
+       Tag sources with `VER-2-3-11'.
+
+       * docs/VERSION.DLL: Update documentation and bump version number to
+       2.3.11.
+
+       * README, Jamfile (RefDoc), builds/win32/visualc/index.html,
+       builds/win32/visualc/freetype.dsp,
+       builds/win32/visualc/freetype.vcproj,
+       builds/win32/visualce/index.html,
+       builds/win32/visualce/freetype.dsp,
+       builds/win32/visualce/freetype.vcproj: s/2.3.10/2.3.11/, s/2310/2311/.
+
+       * include/freetype/freetype.h (FREETYPE_PATCH): Set to 11.
+
+       * builds/unix/configure.raw (version_info): Set to 9:22:3.
+
+2009-10-10  Werner Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES, docs/release: Updated.
+
+2009-10-10  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/pcf/pcfread.c (pcf_get_properties): Fix a bug in the nprops
+       truncation.  Reported by Martin von Gagern and Peter Volkov.
+       https://bugs.gentoo.org/288357 and https://bugs.gentoo.org/288256
+
+2009-10-06  Werner Lemberg  <wl@gnu.org>
+
+       * Version 2.3.10 released.
+       ==========================
+
+
+       Tag sources with `VER-2-3-10'.
+
+       * builds/toplevel.mk (major, minor, patch): Fix regexp to allow more
+       than a single digit.
+       (dist): We now use git.
+
+       * docs/VERSION.DLL: Update documentation and bump version number to
+       2.3.10.
+
+       * README, Jamfile (RefDoc), builds/win32/visualc/index.html,
+       builds/win32/visualc/freetype.dsp,
+       builds/win32/visualc/freetype.vcproj,
+       builds/win32/visualce/index.html,
+       builds/win32/visualce/freetype.dsp,
+       builds/win32/visualce/freetype.vcproj: s/2.3.9/2.3.10/, s/239/2310/.
+
+       * include/freetype/freetype.h (FREETYPE_PATCH): Set to 10.
+
+       * builds/unix/configure.raw (version_info): Set to 9:21:3.
+
+2009-10-06  Werner Lemberg  <wl@gnu.org>
+
+       Fix `make multi'.
+
+       * src/cache/ftccache.c, src/cache/ftcsbits.c (FT_COMPONENT): Define.
+
+       * src/sfnt/sfdriver.c: Include FT_INTERNAL_DEBUG_H.
+
+2009-09-27  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       [cache] Fix Savannah bug #27441, clean up Redhat bugzilla #513582.
+       Tricky casts in FTC_{CACHE,GCACHE,MRULIST}_LOOKUP_CMP() are removed. 
+       Now these functions should be called with FTC_Node or FTC_MruNode
+       variable, and the caller should cast them to appropriate pointers to
+       concrete data.  These tricky casts can GCC-4.4 optimizer (-O2)
+       confused and the crashing binaries are generated.
+
+       * src/cache/ftcmru.h (FTC_MRULIST_LOOKUP_CMP): Drop tricky cast. 
+       Now the 4th argument `node' of this function should be typed as
+       FTC_MruNode.
+
+       * src/cache/ftcglyph.h (FTC_GCACHE_LOOKUP_CMP): For inline
+       implementation, new temporal variable FTC_MruNode `_mrunode' to take
+       the pointer from FTC_MRULIST_LOOKUP_CMP().  For non-inline
+       implementation, tricky cast is dropped.
+
+       * src/cache/ftcmanag.c (FTC_SIZE_NODE): New macro casting
+       to FTC_SizeNode.
+       (FTC_Manager_LookupSize): Replace FTC_SizeNode `node' by FTC_MruNode
+       `mrunode', and FTC_SIZE_NODE() is inserted.
+       (FTC_FACE_NODE): New macro casting to FTC_FaceNode.
+       (FTC_Manager_LookupFace) Replace FTC_FaceNode `node' by FTC_MruNode
+       `mrunode', and FTC_FACE_NODE() is inserted.
+
+       * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Change the type of
+       `node' from FTC_INode to FTC_Node.  Extra casting macro FTC_NODE()
+       is dropped.
+       (FTC_ImageCache_LookupScaler): Ditto.
+       (FTC_SBitCache_Lookup): Change the type of `node' from FTC_SNode to
+       FTC_Node.  Extra casting macro FTC_NODE() is dropped.  FTC_SNODE()
+       is inserted.
+       (FTC_SBitCache_LookupScaler): Ditto.
+
+       * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Change the type of
+       `node' from FTC_CMapNode to FTC_Node.  Extra casting macro
+       FTC_NODE() is dropped, FTC_CMAP_NODE() is inserted.
+
+2009-09-25  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       [cache, psaux, type1] Fix for multi build.
+       In multi build, some cpp functions are left as unresolved symbols.
+
+       * src/cache/ftcbasic.c: Include FT_INTERNAL_DEBUG_H for FT_TRACE1().
+
+       * src/psaux/t1decode.c: Include FT_INTERNAL_CALC_H for
+       FIXED_TO_INT().
+       * src/type1/t1gload.c: Ditto.
+       * src/type1/t1objs.c: Ditto.
+
+2009-09-25  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       [autofit] Fix for multi build.
+
+       * src/autofit/afmodule.h: Include FT_INTERNAL_OBJECTS_H to use
+       FT_DECLARE_MODULE() macro in multi build.
+
+       * src/autofit/aflatin.c: Include <ft2build.h> to handle
+       FT_ADVANCES_H correctly in multi build.
+
+2009-09-24  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       [cache] Check the face filled by FTC_Manager_LookupFace().
+
+       * src/cache/ftcbasic.c (ftc_basic_family_get_count): Return
+       immediately if FTC_Manager_LookupFace() fills face by NULL.  Such
+       case can occur when the code is optimized by GCC-4.2.x.
+
+2009-09-23  Werner Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES: Updated.
+
+2009-09-12  Werner Lemberg  <wl@gnu.org>
+
+       [raster] Fix 5-levels grayscale output.
+       This was broken since version 2.3.0.
+
+       * src/raster/ftraster.c (count_table): Use pre-2.3.0 values (which
+       were then computed dynamically).
+       (Vertical_Gray_Sweep_Step): Updated.
+
+       (ft_black_render): Initialize `worker->gray_lines' (problem found by
+       valgrind).
+
+       (FT_RASTER_OPTION_ANTI_ALIASING, DEBUG_RASTER): Dont' #undef, just
+       comment out.
+
+2009-09-12  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Improve configure.raw for cross build.
+
+       * builds/unix/configure.raw: Remove temporal files created by the
+       suffix checking for CC_BUILD.  Set XX_ANSIFLAGS and XX_CFLAGS when
+       cross compiler is GCC.  AC_PROG_CC checks whether the cross compiler
+       is GCC, its result is stored in GCC.
+
+2009-09-12  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       [BDF] Modify hash API to take size_t value instead of void *.
+
+       The hash API in BDF driver is designed to be generic, it takes
+       void * typed data.  But BDF driver always gives an unsigned long
+       integer (the index to a property).  To reduce non-essential
+       casts from unsigned long to void* and from void* to unsigned
+       long, the hash API is changed to take size_t integer.
+       The issue of incompatible cast between unsigned long and void*
+       on LLP64 platform is reported by NightStrike from MinGW-Win64
+       project.  See
+       http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html
+
+       * src/bdf/bdf.h: The type of hashnode->data is changed from
+       void* to size_t.
+
+       * src/bdf/bdflib.c (hash_insert): Get size_t data, instead of
+       void* data.
+       (bdf_create_property): Get the name length of new property by
+       size_t variable, with a cut-off at FT_ULONG_MAX.
+       (_bdf_set_default_spacing): Get the name length of the face by
+       size_t variable, with a cut-off at 256.
+       (bdf_get_property): Get the property id by size_t variable to
+       reduce the casts between 32-bit prop ID & hashnode->data during
+       simple copying.
+       (_bdf_add_property): Ditto.
+       (_bdf_parse_start): Calculate the index to the property array
+       by size_t variable.
+       (bdf_get_font_property): Drop a cast to unsigned long.
+
+2009-09-10  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       [Win64] Improve the computation of random seed from stack address.
+
+       On LLP64 platform, the conversion from pointer to FT_Fixed need
+       to drop higher 32-bit.  Explict casts are required. Reported by
+       NightStrike from MinGW-w64 project.  See
+       http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html
+
+       * src/cff/cffgload.c: Convert the pointers to FT_Fixed explicitly.
+
+       * src/psaux/t1decode.c: Ditto.
+
+
+2009-09-03  Werner Lemberg  <wl@gnu.org>
+
+       [raster] Improvements for stand-alone mode.
+
+       * src/raster/rules.mk: Don't handle ftmisc.h.  It is needed for
+       stand-alone mode only.
+
+       * src/raster/ftmisc.h (FT_MemoryRec , FT_Alloc_Func, FT_Free_Func,
+       FT_Realloc_Func): Copy declarations from ftsystem.h.
+
+2009-09-02  Bram Tassyns  <bramt@enfocus.be>
+
+       Improve vertical metrics calculation (Savannah bug #27364).
+
+       The calculation of `vertBearingX' is not defined in the OTF font
+       spec so FreeType does a `best effort' attempt.  However, this value
+       is defined in the PDF and PostScript specs, and that algorithm is
+       better than the one FreeType currently uses:
+
+         FreeType: Use the middle of the bounding box as the X coordinate
+                   of the vertical origin.
+
+         Adobe PDF spec: Use the middle of the horizontal advance vector as
+                         the X coordinate of the vertical origin.
+
+       FreeType's algorithm goes wrong if you have a really small glyph
+       (like the full-width, circle-like dot at the end of the sentence, as
+       used in CJK scripts) with large bearings.  With the FreeType
+       algorithm this dot gets centered on the baseline; with the PDF
+       algorithm it gets the correct location (in the top right).  Note
+       that this is a serious issue, it's like printing the dot at the end
+       of a Roman sentence at the center of the textline instead of on the
+       baseline like it should. So i believe the PDF spec's algorithm
+       should be used in FreeType as well.
+
+       The `vertBearingY' value for such small glyphs is also very strange
+       if no `vmtx' information is present, since the height of the bbox is
+       not representable for the height of the glyph visually (the
+       whitespace up to the baseline is part of the glyph).  The fix also
+       includes some code for a better estimate of `vertBearingY'.
+
+       * src/base/ftobjs.c (ft_synthesize_vertical_metrics): `vertBearingX'
+       is now calculated as described by the Adobe PDF Spec.  Estimate for
+       `vertBearingY' now works better for small glyphs completely above or
+       below the baseline into account.
+
+       * src/cff/cffgload.c (cff_slot_load): `vertBearingX' is now
+       calculated as described by the Adobe PDF Spec.  Vertical metrics
+       information was always ignored when FT_CONFIG_OPTION_OLD_INTERNALS
+       was not defined.
+
+       * src/truetype/ttgload.c (compute_glyph_metrics): `vertBearingX' is
+       now calculated as described by the Adobe PDF Spec.
+
+2009-09-01  John Tytgat  <John.Tytgat@esko.com>
+
+       Fix custom cmap for empty Type 1 font (Savannah bug #27294).
+
+       * include/freetype/internal/t1types.h (T1_EncodingRecRec_): Update
+       comment to reflect revised code_last meaning.
+       * src/type1/t1load.c (T1_Open_Face), src/type42/t42objs.c
+       (T42_Open_Face): Assign max_char as highest character code + 1 and
+       use this for T1_EncodingRecRec_::code_last.
+       * src/psaux/t1cmap.c (t1_cmap_custom_init): Follow revised
+       T1_EncodingRecRec_::code_last meaning.
+
+2009-08-25  Werner Lemberg  <wl@gnu.org>
+
+       Fix rendering of horizontally compressed CFFs.
+       Bug reported by Ivan Nincic <inincic@pdftron.com>.
+
+       * src/cff/cffgload.c (cff_slot_load): Thinko: Check `xx' element of
+       `font_matrix' also.
+
+       * docs/CHANGES: Updated.
+
+2009-08-03  suyu0925@gmail.com
+
+       Don't call `ft_fseek' every time when executing `ft_fread'.
+
+       * src/base/ftstream.c (FT_Stream_Seek), src/base/ftsystem.c
+       (ft_ansi_stream_io): Implement it.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Cast a charcode to 32-bit in cmap format 14 parser.
+       
+       * src/sfnt/ttcmap.c (tt_cmap14_char_var_index,
+       tt_cmap14_char_var_isdefault, tt_cmap14_char_variants,
+       tt_cmap14_variant_chars): Correct mismatches from
+       FT_CMap_CharVarIndexFunc prototype, FT_ULong arguments
+       are replaced by FT_UInt32 arguments.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Cast a charcode to 32-bit in cmap format 12 parser.
+
+       * src/sfnt/ttcmap.c (tt_cmap12_char_next):
+       Insert explicit cast from FT_UFast to FT_UInt32
+       for return value.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       psaux: Fix a few casts to FT_Int32 value.
+
+       * src/psaux/t1decode.c (t1_decoder_parse_charstrings):
+       Fix a few casts setting `value' from FT_Long to FT_Int32,
+       because `value' is typed as FT_Int32 since 2009-06-22.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Fix a data type mismatching with its source.
+
+       * src/sfnt/ttcmap.c (tt_cmap13_char_next): Fix the
+       type of `gindex' from FT_ULong to FT_UInt because
+       it is set by FT_UInt tt_cmap13_char_map_binary() or
+       TT_CMap13->cur_gindex.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Extend a few local variables to load 32-bit values.
+
+       * src/sfnt/ttkern.c (tt_face_load_kern): Extend `count'
+       and `kern' to load 32-bit values.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pfr: Extend `num_aux' to take 32-bit value.
+
+       * src/pfr/pfrload.c (pfr_phy_font_load): Extend
+       `num_aux' to load 32-bit value.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pcf: Truncate FT_ULong `nprops' to fit to int PCF_Face->nprops.
+
+       * src/pcf/pcfread.c (pcf_get_properties): Load `nprops'
+       as FT_ULong value from PCF file, but truncate it as
+       int to fit PCF_Face->nprops.  The number of truncated
+       properties is shown in the trace message.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gxvalid: Extend a few local variables to reduce the casts.
+
+       * src/gxvalid/gxvmorx.c (gxv_morx_subtables_validate):
+       Extend `type' and `rest' to take FT_ULong values.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gxvalid: Extend `settingTable' to take 32-bit offset.
+
+       * src/gxvalid/gxvfeat.c (gxv_feat_name_validate):
+       Extend `settingTable' to take 32-bit offset.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       autofit: Cast FT_Long glyph_count to compare with FT_UInt GID.
+
+       * src/autofit/afglobal.c (af_face_globals_is_digit,
+       af_face_globals_compute_script_coverage): Cast FT_Long
+       globals->glyph_count to FT_ULong, to compare with FT_UInt
+       gindex.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       smooth: Exclude 16-bit system in invalid pitch/height check.
+
+       * src/smooth/ftsmooth.c (ft_smooth_render_generic):
+       pitch and height are typed as FT_UInt but checked to fit
+       16-bit range, to avoid the overflows.  On 16-bit system,
+       this checking inserts a conditional that never occurs.
+
+2009-07-03  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cff: Type large constants > 0x7FFF as long for 16-bit systems.
+
+       * src/cff/cffload.c (cff_charset_load): Type large
+       constants > 0x7FFF as long, because normal constants
+       are typed signed integer that is less than 0x8000 on
+       16-bit systems.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       base: Remove an unused variable.
+
+       * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Remove an
+       unused variable `library'.  glyph->library is used.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cache: Check higher bits in flags for non ILP32 systems.
+
+       4 public functions ought to take FT_ULong flags, but take
+       FT_UInt flags. To keep binary compatibility, we drop higher
+       bits on non ILP32 platforms,
+               ILP64 systems: No drop occurs.
+               LP64 systems: Higher bits are not used.
+               16-bit systems: Drop can occur.
+       See
+       http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html
+       These functions will be refined to take FT_ULong flags in
+       next bump with incompatible API change.
+
+       * src/cache/ftcbasic.c (FTC_ImageCache_Lookup):
+       Check `flags' in `type', the 2nd argument.
+       (FTC_SBitCache_Lookup): Ditto.
+       (FTC_ImageCache_LookupScaler): Check `load_flags',
+       the 3rd argument.
+       (FTC_SBitCache_LookupScaler): Ditto.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Ignore invalid GIDs in glyph name lookup.
+
+       * include/freetype/internal/fttrace.h:
+       New trace module for sfdriver.c is added.
+
+       * src/sfnt/sfdriver.c (sfnt_get_name_index):
+       Restrict glyph name lookup to FT_UInt GID.
+       Genuine TrueType can hold 16-bit glyphs.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pcf: Fix a comparison between FT_Long and FT_ULong.
+
+       * src/pcf/pcfread.c (pcf_get_bitmaps): Return an error
+       if PCF_Face->nemetrics is negative.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gxvalid: Guarantee `nFeatureFlags' size up to 32-bit.
+
+       * src/gxvalid/gxvmort.c (gxv_mort_featurearray_validate):
+       Extend the 3rd argument `nFeatureFlags' to FT_ULong.
+       * src/gxvalid/gxvmort.h: Ditto.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Insert explicit cast for LP64 system.
+
+       * src/sfnt/ttkern.c (tt_face_load_kern): Insert
+       cast from unsigned long to FT_UInt32.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gxvalid: Guarantee `just' table size upto 32-bit.
+
+       * src/gxvalid/gxvjust.c (gxv_just_validate):
+       The type of `offset' is changed from FT_UInt to
+       FT_Offset, for 16-bit platforms.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gxvalid: Guarantee `trak' table size upto 32-bit.
+
+       * src/gxvalid/gxvtrak.c (gxv_trak_validate):
+       The type of `offset' is changed from FT_UInt to
+       FT_Offset, for 16-bit platforms.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       type1: Fix a data type mismatching with its source.
+
+       * include/freetype/internal/t1types.h: The type of
+       T1_Face->buildchar is matched with T1_Decorder->top.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pfr: Fix a data type mismatching with its source.
+
+       * src/pfr/pfrtypes.h: The type of PFR_KernItem->offset
+       is extended from FT_UInt32 to FT_Offset, because it is
+       calculated with the pointer difference, in
+       pfr_extra_item_load_kerning_pairs().
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pfr: Fix a data type mismatching with its source.
+
+       * src/pfr/pfrtypes.h: The type of PFR_PhysFont->chars_offset
+       is extended from FT_UInt32 to FT_Offset, because it is
+       calculated with the pointer difference in pfr_phy_font_load().
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pfr: Fix a data type mismatching with its source.
+
+       * src/pfr/pfrtypes.h: The type of PFR_PhyFont->bct_offset
+       is extended from FT_UInt32 to FT_Long, because it is
+       loaded by FT_STREAM_POS() in pfr_phy_font_load().
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       smooth: Improve the format in debug message.
+
+       * src/smooth/ftgrays.c (gray_dump_cells): Improve the
+       format specifications to dump variables.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Fix a data type mismatching with its source.
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): The type of
+       local `flags' is matched with FT_Face->face_flags.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       psaux: Fix a data type mismatching with its source.
+
+       * include/freetype/internal/psaux.h: The type of
+       T1_DecorderRec.buildchar is matched with
+       T1_DecorderRec.top.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Extend TrueType GX packed deltas to FT_Offset.
+
+       * src/truetype/ttgxvar.c (ft_var_readpackeddeltas):
+       The type of 2nd argument `delta_cnt' is changed from
+       FT_Int to FT_Offset, because its source can be cvt
+       table size calculated from stream position.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Extend mmvar_len to hold size_t values.
+
+       * src/truetype/ttgxvar.h: The type of
+       GX_BlendRec.mmvar_len is changed from FT_Int to
+       FT_Offset, because TT_Get_MM_Var() calculates it
+       by sizeof() results.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Check invalid function number in IDEF instruction.
+
+       * src/truetype/ttinterp.c (Ins_IDEF): Check
+       if the operand fits to 8-bit opcode limitation.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Check invalid function number in FDEF instruction.
+
+       * src/truetype/ttinterp.c (Ins_FDEF): Check
+       if the operand fits 16-bit function number.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Truncate the deltas of composite glyph at 16-bit values.
+
+       * src/truetype/ttgload.c (load_truetype_glyph):
+       Insert cast from FT_Long (deltas[i].{x,y}) to
+       FT_Int16 in the summation of deltas[] for composite
+       glyphs.  Because deltas[i] is typed as FT_Pos,
+       its component x, y are typed as FT_Long, but
+       their sources are always FT_Int16 when they are
+       loaded by ft_var_readpackeddeltas().  However,
+       the limitation about the summed deltas is unclear.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Truncate the instructions upto 16-bit per a glyph.
+
+       * src/truetype/ttgload.c (TT_Hint_Glyph): Truncate
+       the instructions upto 16-bit length per a glyph.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Cast the numerical operands to 32-bit for LP64 systems.
+
+       * src/truetype/ttinterp.c (Ins_SPHIX, INS_MIAP,
+       Ins_MIRP): Insert cast from long (args[], the
+       operands passed to TrueType operator) to FT_Int32
+       (the argument of TT_MulFix14()).
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Cast the project vector to 32-bit for LP64 system.
+
+       * src/truetype/ttinterp.c (Project, DualProject):
+       Insert casts from FT_Pos (the arguments `dx', `dy')
+       to FT_UInt32 (the argument to TT_DotFix14()).
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Cast the scaling params to 32-bit for LP64 system.
+
+       * src/truetype/ttgload.c (TT_Process_Composite_Component):
+       Insert casts from long (return value of FT_MulFix()) to
+       FT_Int32 (the argument to FT_SqrtFixed()).
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Cast a character code to FT_UInt32 for LP64 system.
+
+       * src/sfnt/ttcmap.c (tt_cmap14_char_map_nondef_binary,
+       tt_cmap14_variants, tt_cmap14_char_variants,
+       tt_cmap14_def_char_count, tt_cmap14_get_def_chars,
+       tt_cmap14_get_nondef_chars, tt_cmap14_variant_chars)
+       Insert casts when FT_UInt32 variable is loaded by
+       TT_NEXT_{UINT24|ULONG}.  Because most of them are
+       compared with FT_UInt32 values in public API, replacing
+       FT_UFast is not recommended.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Cast a character code to FT_UInt32 for LP64 system.
+
+       * src/sfnt/ttcmap.c (tt_cmap4_init, tt_cmap4_next):
+       Insert the casts from unsigned long constant to
+       FT_UInt32.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Extend TT_BDF->strings_size to FT_ULong for huge BDF.
+
+       * include/freetype/internal/tttypes.h: The type
+       of TT_BDF->string_size is extended from FT_UInt32
+       to FT_ULong, because BDF specification does not 
+       restrict the length of string.
+       * src/sfnt/ttbdf.c: The scratch variable `strings'
+       to load TT_BDF->string_size is matched with
+       TT_BDF->string_size.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       psaux: Handle the string length by FT_Offset variables.
+
+       * src/psaux/afmparse.c (afm_parser_next_key,
+       afm_tokenize, afm_parse_track_kern,
+       afm_parse_kern_pairs, afm_parse_kern_data,
+       afm_parser_skip_section, afm_parser_parse):
+       The length of key is handled by FT_Offset,
+       instead of FT_UInt.  Although the length of
+       PostScript strings or name object is 16-bit,
+       AFM_STREAM_KEY_LEN() calculates the length
+       from the pointer difference.
+
+       * src/psaux/afmparse.h (afm_parser_next_key):
+       Ditto.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pcf: Fix some data types mismatching with their sources.
+
+       * src/pcf/pcfread.c (pcf_get_bitmaps): The types
+       of `nbitmaps', `i', `sizebitmaps' are matched with
+       the type of area FT_Bitmap.pitch * FT_Bitmap.rows.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pcf: Handle the string length by size_t variables.
+
+       * src/pcf/pcfread.c (pcf_interpret_style): The types
+       of nn, len, lengths[4] are changed to size_t, because
+       they are loaded by (or compared with) ft_strlen().
+
+       * src/pcf/pcfutil.c (BitOrderInvert, TwoByteSwap,
+       FourByteSwap): The type of the 2nd argument `nbytes'
+       is changed to size_t, for similarity with ANSI C
+       string functions.
+
+       * src/pcf/pcfdrivr.c (PCF_Glyph_Load): The type of
+       `bytes' is changed to FT_Offset, because it is passed
+       to FT_ALLOC(), via ft_glyphslot_alloc_bitmap().  At
+       least, using unsigned type is better.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pcf: Fix some data types mismatching with their sources.
+
+       * src/pcf/pcfread.c (pcf_seek_to_table_type,
+       pcf_has_table_type): The type of 3rd argument
+       `ntables' is matched with PCF_Toc->count.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       otvalid: Truncate the glyph index to 16-bit.
+
+       * src/otvalid/otvalid.c (otv_validate): Checks
+       face->num_glyphs does not exceed 16-bit limit,
+       pass FT_UInt num_glyphs to backend functions
+       otv_{GPOS|GSUB|GDEF|JSTF|MATH}_validate().
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cache: Insert explict casts for LP64 systems.
+
+       * src/cache/ftcbasic.c (FTC_ImageCache_Lookup,
+       FTC_SBitCache_Lookup): The type of FTC_ImageType->width
+       is FT_Int, so the cast to unsigned larger type FT_ULong
+       is introduced for the comparisons with 0x10000L for
+       LP64 platform.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cache: Fix some data types mismatching with their sources.
+
+       * src/cache/ftccache.h: The type of return value
+       by FTC_Node_WeightFunc function is changed to
+       FT_Offset.  The type of FTC_CacheClass->cache_size
+       is changed to FT_Offset, too.
+
+       * src/cache/ftccback.h (ft_inode_weight,
+       ftc_snode_weight): Ditto.
+
+       * src/cache/ftccmap.c (ftc_cmap_node_weight): Ditto.
+
+       * src/cache/ftcimage.c (ftc_inode_weight,
+       FTC_INode_Weight): Ditto.
+
+       * src/cache/ftcsbits.c (ftc_snode_weight,
+       FTC_SNode_Weight): Ditto.
+
+       * src/cache/ftcmru.h: The type of
+       FTC_MruListClass->node_size is changed to FT_Offset,
+       because it is passed to FT_ALLOC() to specify the
+       size of buffer.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       XXX_cmap_encoding_char_next() return FT_UInt32 values.
+
+       * include/freetype/internal/services/svpscmap.h:
+       The size of the charcode value returned by
+       the function typed PS_Unicodes_CharNextFunc is
+       matched with its input charcode value.
+
+       * src/cff/cffmap.c (cff_cmap_encoding_char_next,
+       cff_cmap_unicode_char_next): Ditto.
+
+       * src/pfr/pfrmap.c (pfr_cmap_encoding_char_next):
+       Ditto.
+
+       * src/psaux/t1cmap.c (t1_cmap_std_char_next,
+       t1_cmap_custom_char_next, t1_cmap_unicode_char_next):
+       Ditto.
+
+       * src/psnames/psmodule.c (ps_unicodes_char_next):
+       Ditto.
+
+       * src/winfonts/winfnt.c (fnt_cmap_char_next):
+       Ditto.
+
+       * src/sfnt/ttcmap.c (tt_cmap0_char_next,
+       tt_cmap2_char_next, tt_cmap4_char_next,
+       tt_cmap6_char_next, tt_cmap10_char_next,
+       tt_cmap12_char_next, tt_cmap13_char_next): Ditto.
+       (tt_cmap14_char_variants): Handle base unicode
+       codepoint by FT_UInt32 variable to avoid overflow
+       on 16-bit platforms.
+       (tt_cmap14_ensure): The type of `num_results' is
+       extend to FT_UInt32, to cover unsigned 32-bit
+       `numVarSelectorRecords' in cmap14 table header.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       truetype: Extend TT_Face->num_locations for broken TTFs.
+
+       * include/freetype/internal/tttypes.h:
+       TT_Face->num_locations are extended from FT_UInt
+       to FT_ULong, to stand with broken huge loca table.
+       Some people insists there are broken TTF including
+       the glyphs over 16-bit limitation, in PRC market.
+       * src/truetype/ttpload.c (tt_face_load_loca):
+       Remove unrequired 16-bit truncation for FT_UInt
+       TT_Face->num_locations.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       smooth: Fix some data types mismatching with their sources.
+
+       * src/smooth/ftgrays.c: The type of `TCoord' is
+       matched to `TPos', because they are mixed in
+       gray_set_cell().  The type of TCell->x is extended
+       to `TPos', because gray_find_cell() sets it by
+       TWorker.ex.  The type of TCell->cover is extended
+       to `TCoord', because gray_render_scanline() adds
+       TCoord value to it.  The type of TWork.cover is matched
+       with TCell->cover.  The types of
+       TWork.{max_cells,num_cells} are changed to FT_PtrDist,
+       because they are calculated from the memory addresses.
+       The type of TWork.ycount is changed to TPos, because
+       it is calculated from TPos variables.
+       (gray_find_cell): The type of `x' is matched with
+       its initial value ras.ex.
+       (gray_render_scanline): The types of `mod', `lift'
+       and `rem' are changed to TCoord, because their values
+       are set with explicit casts to TCoord.  When ras.area
+       is updated by the differential values including
+       `delta', they are explicitly casted to TArea, because
+       the type of `delta' is not TArea but TCoord.
+       (gray_render_line): The type of `mod' is extended
+       from int to TCoord, because (TCoord)dy is added to mod.
+       (gray_hline): The argument `acount' is extended to
+       TCoord, to match with the parameters in the callers.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cff: Fix some data types mismatching with their sources.
+
+       * src/cff/cffobjs.c (cff_face_init): The type of
+       `scaling' is matched with the scaling parameter
+       in FT_Matrix_Multiply_Scaled() and
+       FT_Vector_Transform_Scaled().
+
+       * src/cff/cffparse.c (cff_parse_real): The type of
+       `power_ten', `scaling', `exponent_add',
+       `integer_length', `fraction_length',
+       `new_fraction_length' and `shift' are matched with
+       the type of `exponent' to avoid unexpected truncation.
+       (cff_parse_fixed_scaled): The type of `scaling' is
+       matched with the `scaling' argument to
+       cff_parse_real().
+       (cff_parse_fixed_dynamic): Ditto.
+       (cff_parse_font_matrix): The type of `scaling' is
+       matched with the `scaling' argument to
+       cff_parse_dynamic().
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       autofit: Fix some data types mismatching with their sources.
+
+       * src/autofit/afglobal.c: Correct the type of
+       AF_FaceGlobalsRec.glyph_count to match with
+       FT_Face->num_glyphs.
+       (af_face_globals_compute_script_coverage):
+       Insert explicit cast to compare
+       FT_Long AF_FaceGlobalsRec.glyph_count versus
+       FT_UInt gindex.  The type of `nn' is changed
+       to scan glyph index upto AF_FaceGlobalsRec.glyph_count.
+       (af_face_globals_get_metrics): The type of `script_max'
+       is changed to cover size_t value.  Insert explicit cast
+       to compare FT_Long AF_FaceGlobalsRec.glyph_count versus
+       FT_UInt gindex.
+
+       * src/autofit/afhints.c (af_axis_hints_new_segment):
+       Insert explicit cast to calculate `big_max' from
+       integer and size_t values.
+       (af_axis_hints_new_edge): Ditto.
+
+       * src/autofit/aflatin.c (af_latin_metrics_init_blues):
+       The type of `best_y' is matched to FT_Vector.y.
+       (af_latin_compute_stem_width): The type of `delta' is
+       matched to `dist' and `org_dist'.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       autofit: Count the size of the memory object by ptrdiff_t.
+
+       * src/autofit/afcjk.c (af_cjk_hint_edges): The
+       number of edges `n_edges' should be counted by
+       FT_PtrDist variable instead of FT_Int.
+
+       * src/autofit/aflatin.c (af_latin_hint_edges):
+       Ditto.
+
+       * src/autofit/aftypes.h: In AF_ScriptClassRec,
+       the size of metric `script_metrics_size' should
+       be counted by FT_Offset variable instead of FT_UInt.
+
+       * src/autofit/afhints.c
+       (af_glyph_hints_align_strong_points): The cursors
+       for the edges `min', `max', `mid' in the memory
+       buffer should be typed FT_PtrDist.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       autofit: Fix for unused variable `first'.
+
+       * src/autofit/afhints.c (af_glyph_hints_reload): Insert
+       FT_UNUSED() to hide the unused variable warning.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Improve bitmap size or pixel variables for 16-bit systems.
+
+       * include/freetype/config/ftstdlib.h: Introduce
+       FT_INT_MIN, to use in signed integer overflow in
+       16-bit and 64-bit platforms.
+       
+       * include/freetype/internal/fttrace.h: Add a tracer
+       to ftsynth.c.
+       
+       * src/base/ftbitmap.c (FT_Bitmap_Embolden): Check
+       invalid strength causing integer overflow on 16-bit
+       platform.
+       
+       * src/base/ftcalc.c (ft_corner_orientation): Change
+       the internal calculation from FT_Int to FT_Long, to
+       avoid an overflow on 16-bit platforms.  The caller of
+       this function should use only the sign of result,
+       so the cast to FT_Int is acceptable.
+       
+       * src/base/ftsynth.c: Introduce a tracer for synth module.
+       (FT_GlyphSlot_Embolden): Check invalid strength causing
+       integer overflow on 16-bit platform.
+       
+       * src/bdf/bdfdrivr.c (BDF_Face_Init): The glyph index
+       in FT2 API is typed as FT_UInt, although BDF driver
+       can handle unsigned long glyph index internally.  To
+       avoid integer overflow on 16-bit platform, too large
+       glyph index should be excluded.
+       (BDF_Glyph_Load): The glyph pitch in FT2 is typed as
+       FT_UInt, although BDF driver can handle unsigned long
+       glyph pitch internally.  To avoid integer overflow on
+       16-bit platform, too large glyph pitch should not be
+       returned.
+       
+       * src/pfr/pfrsbit.c (pfr_slot_load_bitmap): The glyph
+       pitch in FT2 is typed as FT_UInt, although PFR font
+       format can include huge bitmap glyph with 24-bit pitch
+       (however, a glyph spends 16.7 pixel, it's not realistic).
+       To avoid integer overflow on 16-bit platform, huge
+       bitmap glyph should be excluded.
+       
+       * src/smooth/ftgrays.c (gray_hline): As FT_Span.x is
+       truncated to fit its type (16-bit short), FT_Span.y
+       should be truncated to fit its type (FT_Int).
+       
+       * src/cff/cffdrivr.c (cff_get_ros): CFF specification
+       defines the supplement in ROS as a real number.
+       Truncate it to fit public FT2 API.
+       
+       * src/cff/cffparse.c (cff_parse_cid_ros): Warn the
+       supplement if it is truncated or rounded in cff_get_ros().
+       
+       * src/cff/cfftypes.h: Change the type of internal variable
+       `supplement' from FT_Long to FT_ULong to fit the signedness
+       to the type in public API.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       psaux: Prevent invalid arguments to afm_parser_read_vals().
+
+       * src/psaux/afmparse.c (afm_parser_read_vals): Change
+       the type of `n' to prevent negative number how many
+       arguments should be parsed.
+
+       * src/psaux/afmparse.h (afm_parser_read_vals): Ditto.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       base: Prevent some overflows on LP64 systems.
+
+       * src/base/ftadvance.c (FT_Get_Advances): Cast the
+       unsigned long constant FT_LOAD_ADVANCE_ONLY to FT_UInt32
+       for LP64 platforms.
+
+       * src/base/ftcalc.c (FT_Sqrt32): All internal variables
+       are changed to FT_UInt32 from FT_ULong.
+       (FT_MulDiv): Insert casts to FT_Int32 for LP64 platforms.
+       This function is designed for 32-bit integer, although
+       their arguments and return value are FT_Long.
+
+       * src/base/ftobjs.c (FT_Get_Char_Index): Check `charcode'
+       is within unsigned 32-bit integer for LP64 platforms.
+       (FT_Face_GetCharVariantIndex): Check `charcode' and
+       `variantSelector' are within 32-bit integer for LP64
+       platforms.
+       (FT_Face_GetCharsOfVariant): Check `variantSelector' is
+       within unsigned 32-bit integer for LP64 platforms.
+
+       * src/base/fttrigon.c (ft_trig_downscale): The FT_Fixed
+       variable `val' and unsigned long constant FT_TRIG_SCALE
+       are casted to FT_UInt32, when calculates FT_UInt32.
+       (FT_Vector_Rotate): The long constant 1L is casted to
+       FT_Int32 to calculate FT_Int32 `half'.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cff: Cast the long variables to 32-bit for LP64 systems.
+
+       * src/cff/cffdrivr.c (cff_get_advances): Insert
+       explicit cast to modify a 32-bit flag by unsigned
+       long constant.
+
+       * src/cff/cffobjs.c (cff_face_init): Ditto.
+
+       * src/cff/cffgload.c (cff_decoder_parse_charstrings):
+       Replace the casts to FT_Long by the casts to FT_Int32
+       for LP64 platforms.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pcf: Improve PCF_PropertyRec.value names on LP64 platforms.
+
+       * src/pcf/pcf.h: In PCF_PropertyRec.value, the member
+       `integer' is replaced by `l', `cardinal' is replaced
+       by `ul', to fix the difference between the name and
+       the types on LP64 platforms.
+
+       * src/pcf/pcfdrivr.c (pcf_get_bdf_property): Reflect
+       PCF_PropertyRec.value change, with appropriate casts
+       to FT_Int32/FT_UInt32.  Their destinations
+       BDF_PropertyRec.{integer|cardinal} are public and
+       explicitly defined as FT_Int32/FT_UInt32.
+
+       * src/pcf/pcfread.c (pcf_get_properties, pcf_load_font):
+       Reflect PCF_PropertyRec.value change.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       pcf: Fix some data types mismatching with their sources.
+
+       * src/pcf/pcfdrivr.c (pcf_cmap_char_index): The type of
+       `code' is matched to PCF_Encoding->enc.
+       (pcf_cmap_char_next): The type of `charcode' is matched
+       to PCF_Encoding->enc.  When *acharcode is set by charcode,
+       an overflow is checked and casted to unsigned 32-bit
+       integer.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       bdf: Improve bdf_property_t.value names for LP64 platforms.
+
+       * src/bdf/bdf.h: In bdf_property_t.value, the member
+       `int32' is replaced by `l', `card32' is replaced by
+       `ul', to fix the difference between the name and the
+       types on LP64 platforms.
+
+       * src/bdf/bdfdrivr.c (BDF_Face_Init): Reflect
+       bdf_property_t.value change.
+       (bdf_get_bdf_property): Reflect bdf_property_t.value
+       change, with appropriate casts to FT_Int32/FT_UInt32.
+       Their destinations BDF_PropertyRec.{integer|cardinal}
+       are public and explicitly defined as FT_Int32/FT_UInt32.
+
+       * src/bdf/bdflib.c (_bdf_add_property): Reflect
+       bdf_property_t.value change.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       bdf: Fix some data types mismatching with their sources.
+
+       * src/bdf/bdrdrivr.c (bdf_cmap_char_index): The type
+       of `code' is matched with BDF_encoding_el->enc.
+       (bdf_cmap_char_next): The type of `charcode' is
+       matched with BDF_encoding_el->enc.  When *acharcode
+       is set by charcode, an overflow is checked and
+       casted to unsigned 32-bit integer.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       autofit: Improve Unicode range definitions.
+
+       * src/autofit/aftypes.h (AF_UNIRANGE_REC): New macro
+       to declare a range by two unsigned 32-bit integer,
+       to avoid 64-bit range definition on LP64 platforms.
+
+       * src/autofit/aflatin.c (af_latin_uniranges): Ditto.
+
+       * src/autofit/aflatin2.c (af_latin2_uniranges): Ditto.
+
+       * src/autofit/afindic.c (af_indic_uniranges): Ditto.
+
+       * src/autofit/afcjk.c (af_cjk_uniranges): Declare
+       the ranges by AF_UNIRANGE_REC.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       smooth: Fix a data type mismatching with its source.
+
+       * src/smooth/ftgrays.c (gray_sweep): The type of
+       `area' is matched with the 3rd argument `area'
+       of gray_hline().
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       smooth: Fix a data type mismatching with its source.
+
+       * src/smooth/ftgrays.c (gray_render_line): The type
+       of `area' is matched with TWorker.area.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cache: Disable the legacy compatibility if 16-bit system.
+
+       * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Exclude
+       the legacy behaviour from 16-bit platform, because the
+       current hack cannot detect the caller uses this function
+       via legacy convension.
+       (FTC_SBitCache_Lookup): Ditto.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cache: Check 32-bit glyph index on 16-bit systems.
+
+       * src/cache/ftcbasic.c (ftc_basic_family_get_count):
+       Check overflow caused by the face including large
+       number of glyphs > 64k.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cache: Fix some data types mismatching with their sources.
+
+       * src/cache/ftccache.c (ftc_cache_resize): The types of
+       `p', `mask', `count' are matched with FTC_Cache->{p,mask}.
+       (FTC_Cache_Clear): The type of `old_index' is matched to
+       FTC_Cache->{p,mask}.
+
+       * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): The type
+       of `_idx' is matched with FTC_Cache->{p,mask}.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cache: Fix some data types mismatching with their sources.
+
+       * src/cache/ftcsbits.c (ftc_snode_load): The types
+       of `xadvance' and `yadvance' are matched with
+       FT_GlyphSlot->advance.{x|y}.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cache: Cast NULL to a required function type explicitly.
+
+       * src/cache/ftcmanag.c (FTC_Manager_RemoveFaceID):
+       Insert explicit cast from NULL to function type.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       fttypes.h: Cast FT_MAKE_TAG output to FT_Tag exlicitly.
+
+       * include/freetype/fttypes.h (FT_MAKE_TAG):
+       Cast the result to FT_Tag.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       psnames: Handle Unicode codepoints by FT_UInt32 variables.
+
+       * src/psnames/psmodule.c (BASE_GLYPH): Cast the result
+       to unsigned 32-bit integer for LP64 platform.
+       (ps_unicode_value): Return the value by unsigned 32-bit
+       integer instead of unsigned long.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       psaux: Use size_t variable to pass the buffer size.
+
+       * src/psaux/psaux.h (to_bytes): The type of `max_bytes'
+       (the argument to pass the buffer size) is changed to
+       size_t, to match with ANSI C string functions.
+
+       * src/psaux/psconv.h (PS_Conv_StringDecode,
+       PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Ditto.
+
+       * src/psaux/psconv.c (PS_Conv_StringDecode,
+       PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Ditto.
+
+       * src/psaux/psobjs.h (ps_parser_to_bytes): Ditto.
+
+       * src/psaux/psobjs.c (ps_parser_to_bytes): Ditto.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       type1: Use size_t variable to pass the string length.
+
+       * psaux.h: The type of `len' (the argument to pass
+       the buffer size to the function in AFM_ParserRec)
+       is changed to size_t, to match with ANSI C string
+       functions.
+
+       * t1afm.c (t1_get_index): Ditto.
+
+       * test_afm.c (dummy_get_index): Ditto.
+
+       * afmparse.c (afm_parser_read_vals): To call
+       AFM_ParserRec.get_index, the length of token
+       `len' is casted to size_t.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cid: Fix some data types mismatching with their sources.
+
+       * src/cid/cidparse.c (cid_parser_new): The types of
+       `read_len' and `stream_len' are matched to
+       FT_Stream->size.  Unrequired cast is removed.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cff: Fix for unused variable `rest'.
+
+       * src/cff/cffparse.c (cff_parse_real): Insert
+       FT_UNUSED() to hide the unused variable warning.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       cff: Fix some data types mismatching with their sources.
+
+       * src/cff/cffgload.c (cff_slot_load): The types of      
+       `top_upm' and `sub_upm' are matched with
+       CFF_FontRecDict->units_per_em.
+
+       * src/cff/cffobjs.c (cff_size_select): Ditto.
+       (cff_size_request): Ditto.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       bdf: Fix some data types mismatching with their sources.
+
+       * bdflib.c (_bdf_list_ensure): The type of `num_items'
+       is matched with _bdf_list_t.used.  Also the types of
+       `oldsize', `newsize', `bigsize' are matched too.
+       (_bdf_readstream): `cursor' is used as an offset to
+       the pointer, it should be typed as FT_Offset.  Also
+       the types of `bytes', `start', `end', `avail' are matched.
+
+       * bdfdrivr.c: The type of BDF_CMap->num_encodings is
+       matched with FT_CMap->clazz->size.
+       (bdf_cmap_char_index): The types of `min', `max', `mid'
+       are matched with BDF_CMap->num_encodings.  The type of
+       `result' is matched with encoding->glyph.
+       (bdf_cmap_char_next): Ditto, the type of `code' is
+       matched with BDF_encoding_el.enc.
+       (bdf_interpret_style): The type of `lengths' is changed
+       to size_t, to take the value by ft_strlen().  Also the
+       types of `len', `nn', `mm' are matched.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       sfnt: Count the size of the memory object by ptrdiff_t.
+
+       * src/sfnt/ttbdf.c (tt_face_find_bdf_prop): The type of
+       `peroperty_len' is changed from FT_UInt to FT_Offset,
+       to match with size_t, which is appropriate type for the
+       object in the memory buffer.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       lzw: Count the size of the memory object by ptrdiff_t.
+
+       * src/lzw/ftzopen.h: The types of FT_LzwState->{buf_total,
+       stack_size} are changed from FT_UInt to FT_Offset, to match
+       with size_t, which is appropriate type for the object in
+       the memory buffer.
+
+       * src/lzw/ftzopen.c (ft_lzwstate_stack_grow): The types of
+       `old_size' and `new_size' are changed from FT_UInt to
+       FT_Offset, to match with size_t, which is appropriate type
+       for the object in the memory buffer.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       otvalid: Count the table size on memory by ptrdiff_t.
+
+       * src/otvalid/otvgpos.c (otv_ValueRecord_validate):
+       Change the type of table size from FT_UInt to
+       FT_PtrDist because it is calculated by the memory
+       addresses.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       otvalid: Prevent an overflow by GPOS/GSUB 32b-bit offset.
+
+       * src/otvalid/otvgpos.c (otv_ExtensionPos_validate):
+       Extend ExtensionOffset from FT_UInt to FT_ULong, to
+       cover 32-bit offset on 16-bit platform.
+
+       * src/otvalid/otvgsub.c (otv_ExtensionSubst_validate):
+       Ditto.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       ftobjs.c: Prevent an overflow in glyph index handling.
+
+       * src/base/ftobjs.c (FT_Face_GetCharsOfVariant):
+       Improve the cast in comparison to avoid the truncation.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Improve the variable types in raccess_make_file_name().
+
+       * src/base/ftrfork.c (raccess_make_file_name):
+       Change the type of cursor variable `tmp' to const char*,
+       to prevent the unexpected modification of original pathname.
+       (raccess_make_file_name): Change the type of new_length
+       to size_t.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       ftpatent.c: Fix for unused variable `error'.
+
+       * src/base/ftpatent.c (_tt_check_patents_in_range):
+       Fix warning for unused variable `error'.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       type1: Check invalid string longer than PostScript limit.
+
+       * src/type1/t1afm.c (t1_get_index): Check invalid string
+       which exceeds the limit of PostScript string/name objects.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gzip: Use FT2 zcalloc() & zfree() in ftgzip.c by default.
+
+       * src/gzip/ftgzip.c (zcalloc, zcfree): Disable all
+       zcalloc() & zfree() by zlib in zutil.c, those in
+       ftgzip.c by FT2 are enabled by default.  To use 
+       zlib zcalloc() & zfree(), define USE_ZLIB_ZCALLOC.
+       See discussion:
+       http://lists.gnu.org/archive/html/freetype-devel/2009-02/msg00000.html
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gzip: Distinguish PureC from TurboC on MSDOS.
+
+       * src/gzip/zutil.c (zcalloc, zcfree): Enable only for
+       MSDOS platform.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gxvalid: Insert PureC pragma to allow unevaluated variables.
+
+       * builds/atari/ATARI.H: Insert PureC pragma not to
+       warn against set-but-unevaluated variable in gxvalid
+       module.
+
+2009-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       gxvalid: Pass the union by the pointer instead of the value.
+
+       * src/gxvalid/gxvcommn.h:
+         - Declare new type `GXV_LookupValueCPtr'.
+         - Update the type of the 2nd argument to pass GXV_LookupValueDesc
+           data to the function prototyped as GXV_Lookup_Value_Validate_Func,
+           from GXV_LookupValueDesc to GXV_LookupValueCPtr.
+         - Likewise for the function prototyped as
+           GXV_Lookup_Fmt4_Transit_Func.
+
+         - Declare new type `GXV_StateTable_GlyphOffsetCPtr'.
+         - Update the type of the 3rd argument to pass
+           GXV_StateTable_GlyphOffsetDesc data to the function prototyped
+           as GXV_StateTable_Entry_Validate_Func, from
+           GXV_StateTable_GlyphOffsetDesc to GXV_StateTable_GlyphOffsetCPtr.
+
+         - Declare new type `GXV_XStateTable_GlyphOffsetCPtr'.
+         - Update the type of the 3rd argument to pass
+           GXV_XStateTable_GlyphOffsetDesc data to the function prototyped
+           as GXV_XStateTable_Entry_Validate_Func,
+           from GXV_XStateTable_GlyphOffsetDesc
+           to GXV_XStateTable_GlyphOffsetCPtr.
+
+       * src/gxvalid/gxvcommn.c (gxv_LookupTable_fmt0_validate,
+       gxv_XClassTable_lookupval_validate,
+       gxv_XClassTable_lookupfmt4_transit):
+       Update from GXV_LookupValueDesc to GXV_LookupValueCPtr.
+       
+       * src/gxvalid/gxvbsln.c (gxv_bsln_LookupValue_validate,
+       gxv_bsln_LookupFmt4_transit): Ditto.
+       
+       * src/gxvalid/gxvjust.c
+       (gxv_just_pcTable_LookupValue_entry_validate,
+       gxv_just_classTable_entry_validate,
+       gxv_just_wdcTable_LookupValue_validate): Ditto.
+       
+       * src/gxvalid/gxvkern.c
+       (gxv_kern_subtable_fmt1_entry_validate): Ditto.
+       
+       * src/gxvalid/gxvlcar.c (gxv_lcar_LookupValue_validate,
+       gxv_lcar_LookupFmt4_transit): Ditto.
+       
+       * src/gxvalid/gxvopbd.c (gxv_opbd_LookupValue_validate,
+       gxv_opbd_LookupFmt4_transit): Ditto.
+       
+       * src/gxvalid/gxvprop.c (gxv_prop_LookupValue_validate,
+       gxv_prop_LookupFmt4_transit): Ditto.
+       
+       * src/gxvalid/gxvmort4.c
+       (gxv_mort_subtable_type4_lookupval_validate): Ditto.
+       
+       * src/gxvalid/gxvmort0.c
+       (gxv_mort_subtable_type0_entry_validate): Update
+       from GXV_StateTable_GlyphOffsetDesc
+       to GXV_StateTable_GlyphOffsetCPtr.
+       
+       * src/gxvalid/gxvmort1.c
+       (gxv_mort_subtable_type1_entry_validate): Ditto.
+       
+       * src/gxvalid/gxvmort2.c
+       (gxv_mort_subtable_type2_entry_validate): Ditto.
+       
+       * src/gxvalid/gxvmort5.c
+       (gxv_mort_subtable_type5_entry_validate): Ditto.
+       
+       * src/gxvalid/gxvmorx2.c
+       (gxv_morx_subtable_type2_entry_validate): Ditto.
+       
+       * src/gxvalid/gxvmorx5.c
+       (gxv_morx_subtable_type5_entry_validate): Ditto.
+       
+       * src/gxvalid/gxvmorx1.c
+       (gxv_morx_subtable_type1_entry_validate): Ditto.
+       (gxv_morx_subtable_type1_LookupValue_validate,
+       gxv_morx_subtable_type1_LookupFmt4_transit):
+       Update from GXV_LookupValueDesc to GXV_LookupValueCPtr.
+       
+       * src/gxvalid/gxvmorx0.c
+       (gxv_morx_subtable_type0_entry_validate): Update
+       from GXV_XStateTable_GlyphOffsetDesc
+       to GXV_XStateTable_GlyphOffsetCPtr.
+
+2009-07-29  Fabrice Bellet  <fabrice@bellet.info>
+
+       Fix Redhat bugzilla #513582 and Savannah bug #26849.
+
+       * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP) <FTC_INLINE>: Fix
+       aliasing bug.
+
+2009-07-19  Werner Lemberg  <wl@gnu.org>
+
+       Document recent library changes.
+
+       * docs/CHANGES: Do it.
+
+2009-07-17  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #23786.
+
+       * src/truetype/ttobjs.c (tt_size_init_bytecode): Don't reset x_ppem
+       and y_ppem.  Otherwise the `*_CVT_Stretched' functions in ttinterp.c
+       get never called.
+       An anonymous guy suggested this change on Savannah, and it seems to
+       be the right solution.
+
+2009-07-15  Werner Lemberg  <wl@gnu.org>
+
+       * docs/release: Updated.
+
+2009-07-15  Werner Lemberg  <wl@gnu.org>
+
+       README.CVS -> README.git
+
+       * README.CVS: Renamed to...
+       * README.git: This.
+       Updated.
+
+2009-07-15  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Borland C++ compiler patch proposed by Mirco Babin.
+       http://lists.gnu.org/archive/html/freetype/2009-07/msg00016.html.
+
+       * builds/exports.mk: Delete unused flags, CCexe_{CFLAGS,LDFLAGS}.
+       Fix APINAMES_C and APINAMES_EXE pathnames to reflect the platform
+       specific pathname syntax.
+       * builds/compiler/bcc.mk: Remove unused flag, CCexe_LDFLAGS.
+       Define TE = `-e' separately (bcc32 cannot specify the pathname of
+       binary executable by T = `-o').
+       Extend the large page size in linking freetype.lib.
+       Add extra CLEAN target to delete bcc specific temporary files.
+       * builds/compiler/bcc-dev.mk: Ditto.
+
+2009-07-14  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #27026.
+
+       * builds/win32/vc2005/freetype.sln: Use correct version number.
+
+2009-07-12  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Add a script to check the undefined and unused trace macros.
+
+       * src/tools/chktrcmp.py: A script to check trace_XXXX macros
+       that are used in C source but undefined in fttrace.h, or
+       defined in fttrace.h but unused in C sources.  See
+       http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html.
+       * docs/DEBUG: Mention on chktrcmp.py.
+       * docs/release: Ditto.
+
+2009-07-09  Werner Lemberg  <wl@gnu.org>
+
+       [ftraster] Make it compile again with -D_STANDALONE_.
+
+       * src/raster/ftraster.c [_STANDALONE_]: Define
+       FT_CONFIG_STANDARD_LIBRARY_H.
+       Include `string.h'.
+       Don't include `rastpic.h'.
+       Define FT_DEFINE_RASTER_FUNCS.
+
+2009-07-09  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       smooth: Check glyph size by width/height, instead of pitch/height.
+       Suggested by der Mouse <mouse@Rodents-Montreal.ORG>.
+
+       * src/smooth/ftsmooth.c (ft_smooth_render_generic): Improve
+       the check for too large glyph.  Replace the pair of `pitch' and
+       `height' by the pair of `width' and `height'.  `pitch' cannot
+       be greater than `height'.  The required is checking the product
+       `pitch' * `height' <= FT_ULONG_MAX, but we use cheap checks for 
+       the realistic case only.
+
+2009-07-09  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Register 2 missing trace components, t1afm and ttbdf.
+
+       * include/freetype/internal/fttrace.h: Add FT_TRACE_DEF( t1afm )
+       and FT_TRACE_DEF( ttbdf ).  See
+       http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html
+
+2009-07-09  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Register a trace component for ftgloadr.c.
+
+       * include/freetype/internal/fttrace.h: Add FT_TRACE_DEF( gloader ).
+       The macro `trace_gloader' was already used in the initial version
+       on 2002-02-24.
+
+2009-07-08  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Prevent the overflows by a glyph with too many points or contours.
+       The bug is reported by Boris Letocha <b.letocha@gmc.net>.  See
+       http://lists.gnu.org/archive/html/freetype-devel/2009-06/msg00031.html
+       http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00002.html  
+
+       * include/freetype/ftimage.h (FT_OUTLINE_CONTOURS_MAX,
+       FT_OUTLINE_POINTS_MAX): New macros to declare the maximum
+       values of FT_Outline.{n_contours,n_points}.
+       * src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Check the
+       total numbers of points and contours cause no overflows in
+       FT_Outline.{n_contours,n_points}.
+
+       * include/freetype/internal/ftgloadr.h (FT_GLYPHLOADER_CHECK_P,
+       FT_GLYPHLOADER_CHECK_C): Compare the numbers of points and
+       contours as unsigned long number, instead of signed int, to
+       prevent the overflows on 16-bit systems.
+
+2009-07-05  Bram Tassyns  <bramt@enfocus.be>
+
+       Improve compatibility to Acroread.
+       This fixes Savannah bug #26944.
+
+       * src/cff/cffload.c (cff_charset_compute_cids): For multiple GID to
+       single CID mappings, make the lowest value win.
+
+2009-06-28  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       ftpatent: Fix a bug by wrong usage of service->table_info().
+       http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html
+
+       * include/freetype/internal/services/svsfnt.h: Extend
+       FT_SFNT_TableInfoFunc() to take new argument to obtain the offset
+       to the specified table.
+       * src/sfnt/sfdriver.c (sfnt_table_info): Extend to return the
+       table-offset to the caller function.
+       * src/base/ftpatent.c (_tt_check_patents_in_table): Use new
+       service->table_info().
+       * src/base/ftobjs.c (FT_Sfnt_Table_Info): Synchronize to new
+       service->table_info().
+
+2009-06-28  Werner Lemberg  <wl@gnu.org>
+
+       [psaux, cff] Protect against nested `seac' calls.
+
+       * include/freetype/internal/psaux.h (T1_Decoder), src/cff/cffgload.h
+       (CFF_Decoder): Add `seac' boolean variable.
+
+       * src/cff/cffgload.c (cff_operator_seac), src/psaux/t1decode.c
+       (t1operator_seac): Use it.
+
+2009-06-28  Werner Lemberg  <wl@gnu.org>
+
+       Thinko.
+
+       * src/psaux/t1decode.c (t1operator_seac)
+       [FT_CONFIG_OPTION_INCREMENTAL]: Test for existence of incremental
+       interface.
+
+2009-06-28  Werner Lemberg  <wl@gnu.org>
+
+       * devel/ftoption.h [FT_CONFIG_OPTION_INCREMENTAL]: Define.
+
+2009-06-27  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Add tools to preprocess the source files for AtariST PureC.
+
+       * builds/atari/deflinejoiner.awk: New file to filter C source files
+       for broken C preprocessor of PureC compiler.
+
+       * builds/atari/gen-purec-patch.sh: New file to generate a patch set
+       for PureC, by using deflinejoiner.awk.
+
+2009-06-27  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Keep existing modules.cfg in the building tree.
+
+       * configure: If `configure' is executed outside of the source tree,
+       an existing `modules.cfg' file in the build directory should be
+       kept, not overwritten by the version in the source tree.
+
+2009-06-27  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Filter --srcdir= option before invoking builds/unix/configure.
+
+       * configure: If builds/unix/configure is invoked with --srcdir
+       option, the option should take `builds/unix' directory instead of
+       the top source directory.  Thus the configure script in the top
+       directory should modify the --srcdir= option if
+       `builds/unix/configure' is invoked.
+
+2009-06-27  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Improve configure.raw for cross-building on exe-suffixed systems.
+
+       * builds/unix/configure.raw: Fix a bug in sed script to extract
+       native suffix for binary executables, patch by Peter Breitenlohner. 
+       http://lists.gnu.org/archive/html/freetype-devel/2009-04/msg00036.html
+
+2009-06-26  Werner Lemberg  <wl@gnu.org>
+
+       [truetype] Remove TT_SubGlyphRec.
+
+       * src/truetype/ttobjs.h (TT_SubGlyphRec): Removed, unused.
+
+2009-06-26  Werner Lemberg  <wl@gnu.org>
+
+       * */*: For warning messages, replace FT_ERROR with FT_TRACE0.
+
+       FT_ERROR is now used only if a function produces a non-zero `error'
+       value.
+
+       Formatting, improving and harmonizing debug strings.
+
+2009-06-25  Werner Lemberg  <wl@gnu.org>
+
+       Provide version information better.
+
+       * src/base/ftinit.c (FT_Init_FreeType): Don't set version here
+       but...
+       * src/base/ftobjs.c (FT_New_Library): Here.
+
+2009-06-22  Werner Lemberg  <wl@gnu.org>
+
+       Use 16.16 format while parsing Type 1 charstrings.
+       This fixes Savannah bug #26867.
+
+       Previously, only integers have been used which can lead to serious
+       rounding errors.
+
+       However, fractional values are only used internally; after the
+       charstrings (of either Type 1 or 2) have been processed, the
+       resulting coordinates get rounded to integers currently -- before
+       applying scaling.  This should be fixed; at the same time a new load
+       flag should be introduced, to be used in combination with
+       FT_LOAD_NO_SCALE, which indicates that font units are returned in
+       16.16 format.  Similarly, the incremental interface should be
+       extended to allow fractional values for metrics.
+
+       * include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
+       field.
+       * include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
+       T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
+
+       * src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
+       (t1_build_add_point): Always convert fixed to integer.
+       * src/psaux/t1decode.c (t1_decoder_parse_charstrings):
+       Use 16.16 format everywhere (except for large integers followed by a
+       `div').
+       [CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
+       code uncoditionally.
+       Add support for random numbers and update remaining code
+       accordingly; this should work now.
+       (t1_operator_seac): Updated.
+       * src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
+       (ps_hints_t1stem3, t1_hints_stem): Updated.
+
+       * src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
+       (cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
+       (cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
+
+       * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
+       [FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
+       Updated.
+       * src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
+       * src/type1/t1objs.c (T1_Face_Init): Updated.
+
+2009-06-21  Werner Lemberg  <wl@gnu.org>
+
+       * src/pshinter/pshrec.c: Use PSH_Err_Ok.
+
+2009-06-21  Werner Lemberg  <wl@gnu.org>
+
+       Code beautification.
+
+       * src/type1/t1load.c (FT_INT_TO_FIXED): Removed.
+       Replace everywhere with INT_TO_FIXED.
+       (FT_FIXED_TO_INT): Move to ...
+       * include/freetype/internal/ftcalc.h (FIXED_TO_INT): Here.
+       Update all users.
+
+2009-06-20  Werner Lemberg  <wl@gnu.org>
+
+       Remove unused variables.
+
+       * include/freetype/internal/psaux.h (T1_BuilderRec),
+       src/cff/cffgload.h (CFF_Builder): Remove `last'.
+       Update all users.
+
+2009-06-20  Werner Lemberg  <wl@gnu.org>
+
+       [psaux] Check large integers while parsing charstrings.
+
+       * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Large
+       integers must be followed by a `div' operator.
+
+2009-06-20  Werner Lemberg  <wl@gnu.org>
+
+       [cff] Revert last change.
+
+       * src/cff/cffgload.c (cff_decoder_parse_charstrings): Do it.
+       Next time, don't confuse Type 2 charstring opcodes with TOP DICT
+       values...
+
+2009-06-20  Werner Lemberg  <wl@gnu.org>
+
+       * src/autofit/aflatin.c (af_latin_metrics_check_digits): Fix
+       compiler warning.
+
+2009-06-20  Werner Lemberg  <wl@gnu.org>
+
+       * builds/compiler/gcc.mk (CFLAGS): Use -O3, not -O6.
+
+2009-06-19  Werner Lemberg  <wl@gnu.org>
+
+       [cff] Fix handling of reserved byte 0xFF.
+
+       * src/cff/cffgload.c (cff_decoder_parse_charstrings): Abort if byte
+       0xFF is encountered.
+
+2009-06-19  Werner Lemberg  <wl@gnu.org>
+
+       Improve debug messages for Type1 charstrings.
+
+       * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Emit newlines
+       after instructions.
+       Prettify output.
+
+2009-06-19  Werner Lemberg  <wl@gnu.org>
+
+       More ftgray fixes for FT_STATIC_RASTER.
+       Problems reported by suyu@cooee.cn.
+
+       * src/smooth/ftgrays.c (gray_move_to, gray_raster_render): Use
+       RAS_VAR.
+
+2009-06-18  Werner Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES: Updated.
+
+2009-06-18  Werner Lemberg  <wl@gnu.org>
+
+       Fix B/W rasterization of subglyphs with different drop-out modes.
+
+       Normally, the SCANMODE instruction (if present) to set the drop-out
+       mode in a TrueType font is located in the `prep' table only and thus
+       valid for all glyphs.  However, there are fonts like `pala.ttf'
+       which additionally contain this instruction in the hinting code of
+       some glyphs (but not all).  As a result it can happen that a
+       composite glyph needs multiple drop-out modes for its subglyphs
+       since the rendering state gets reset for each subglyph.
+
+       FreeType collects the hinted outlines from all subglyphs, then it
+       sends the data to the rasterizer.  It also sends the drop-out mode
+       -- after hinting has been applied -- and here is the error: It sends
+       the drop-out mode of the last subglyph only; drop-out modes of all
+       other subglyphs are lost.
+
+       This patch fixes the problem; it adds a second, alternative
+       mechanism to pass the drop-out mode: For each contour, the
+       rasterizer now checks the first `tags' array element.  If bit 2 is
+       set, bits 5-7 contain the contour's drop-out mode, overriding the
+       global drop-out mode.
+
+       * include/freetype/ftimage.h (FT_CURVE_TAG_HAS_SCANMODE): New macro.
+
+       * src/truetype/ttgload.c (TT_Hint_Glyph): Store drop-out mode in
+       `tags[0]'.
+
+       * src/raster/ftraster.c (Flow_Up, Overshoot_Top, Overshoot_Bottom):
+       Use bits 3-5 instead of 0-2.
+       (New_Profile): Set the drop-out mode in the profile's `flags' field.
+       (Decompose_Curve): Check `tags[0]' and set `dropOutControl' if
+       necessary.
+       (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
+       Horizontal_Gray_Sweep_Drop, Draw_Sweep): Use the profile's drop-out
+       mode.
+
+2009-06-16  Werner Lemberg  <wl@gnu.org>
+
+       Improve scan conversion rules 4 and 6.
+
+       Two new constraints are introduced to better identify a `stub' -- a
+       concept which is only vaguely described in the OpenType
+       specification.  The old code was too rigorous and suppressed more
+       pixel than it should.
+
+         . The intersection of the two profiles with the scanline is less
+           than a half pixel.  Code related to this was already present in
+           the sources but has been commented out.
+
+         . The endpoint of the original contour forming a profile has a
+           distance (`overshoot') less than half a pixel to the scanline.
+
+       Note that the two additional conditions fix almost all differences
+       to the Windows rasterizer, but some problematic cases remain.
+
+       * src/raster/ftraster.c (Overshoot_Top, Overshoot_Bottom): New
+       macros for the `flags' field in the `TProfile' structure.
+       (IS_BOTTOM_OVERSHOOT, IS_TOP_OVERSHOOT): New macros.
+       (New_Profile, End_Profile): Pass overshoot flag as an argument and
+       set it accordingly.
+       Update callers.
+       (Vertical_Sweep_Drop, Horizontal_Sweep_Drop): Implement the two new
+       constraints.
+
+2009-06-11  Werner Lemberg  <wl@gnu.org>
+
+       Increase precision for B/W rasterizer.
+
+       * src/raster/ftraster.c (Set_High_Precision): Add two more bits to
+       the precision.  This corrects rendering of some small glyphs, for
+       example, glyph `xi' in verdana.ttf at 13 ppem.  Testing with ftbench
+       on my GNU/Linux box I don't see a performance degradation.
+
+2009-06-08  Michael Zucchi  <notzed@gmail.com>
+
+       Handle FT_STROKER_LINECAP_BUTT.
+       This fixes Savannah bug #26757.
+
+       * src/base/ftstroke.c (ft_stroker_cap): Implement it.
+
+2009-06-07  Harald Fernengel  <harry@kdevelop.org>
+
+       Fix some potential out-of-memory crashes.
+
+       * src/base/ftobjs.c (ft_glyphslot_done): Check `slot->internal'.
+       * src/base/ftstream.c (FT_Stream_ReleaseFrame): Check `stream'.
+       * src/truetype/ttinterp.c (TT_New_Context): Avoid double-free of
+       `exec' in case of failure.
+
+2009-06-07  Werner Lemberg  <wl@gnu.org>
+
+       Simplify math.
+       Suggested by Alexei Podtelezhnikov <apodtele@gmail.com>.
+
+       * src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
+       Horizontal_Gray_Sweep_Drop): Do it.
+
+2009-06-04  Werner Lemberg  <wl@gnu.org>
+
+       Preparation for fixing scan conversion rules 4 and 6.
+
+       * src/raster/ftraster.c (TFlow): Replace enumeration with...
+       (Flow_Up): This macro.
+       (TProfile): Replace `flow' member with `flags' bit field.
+       Update all affected code.
+
+2009-05-29  James Cloos  <cloos@jhcloos.com>
+
+       Enable autohinting for glyphs rotated by multiples of 90°.
+
+       * src/base/ftobjs.c (FT_Load_Glyph): Alter check for permitted
+       matrices to allow rotations by multiples of 90°, not only unrotated,
+       possibly slanted matrices.
+
+2009-05-28  Werner Lemberg  <wl@gnu.org>
+
+       Remove compiler warning.
+       Reported by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
+
+       * src/autofit/aflatin2.c (af_latin2_hint_edges): Move declaration of
+       `n_edges' into `#if' block.
+
+2009-05-28  Werner Lemberg  <wl@gnu.org>
+
+       Make compilation work with FT_CONFIG_OPTION_USE_ZLIB not defined.
+       Reported by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
+
+       * src/pcf/pcfdrivr.c (PCF_Face_Init) [!FT_CONFIG_OPTION_USE_ZLIB]:
+       Make it work.
+       Simplify #ifdef logic.
+
+2009-05-22  Werner Lemberg  <wl@gnu.org>
+
+       Improve b/w rasterizer.
+       Problem reported by Krzysztof Kotlenga <pocek@users.sf.net>.
+
+       * src/raster/raster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
+       Horizontal_Gray_Sweep_Drop): For smart drop-out mode, if
+       intersections are equally distant relative to next pixel center,
+       select the left pixel, not the right one.
+
+2009-05-19  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #26600.
+
+       * src/type42/t42parse.c (t42_load_keyword): Handle
+       T1_FIELD_LOCATION_FONT_EXTRA.
+
+2009-04-30  Werner Lemberg  <wl@gnu.org>
+
+       Document recent changes to ftview.
+
+       * docs/CHANGES: Do it.
+
+2009-04-27  Werner Lemberg  <wl@gnu.org>
+
+       autohinter: Don't change digit widths if all widths are the same.
+       This fixes FreeDesktop bug #21197.
+
+       * src/autofit/afglobal.c (AF_DIGIT): New macro.
+       (af_face_globals_compute_script_coverage): Mark ASCII digits in
+       `glyph_scripts' array.
+       (af_face_globals_get_metrics): Updated.
+       (af_face_globals_is_digit): New function.
+       * src/autofit/afglobal.h: Updated.
+       (AF_ScriptMetricsRec): Add `digits_have_same_width' flag.
+
+       * src/autofit/aflatin.c: Include FT_ADVANCES_H.
+       (af_latin_metrics_check_digits): New function.
+       (af_latin_metrics_init): Use it.
+       * src/autofit/aflatin.h: Updated.
+       * src/autofit/afcjk.c (af_cjk_metrics_init): Updated.
+
+       * src/autofit/aflatin2.c: Similar changes as with aflatin.c.
+
+       * src/autofit/afloader.c (af_loader_load_g): Test digit width.
+
+       * docs/CHANGES: Document it.
+
+2009-04-26  Werner Lemberg  <wl@gnu.org>
+
+       Make ftgrays compile with _STANDALONE_ and FT_STATIC_RASTER again.
+       Problems reported by suyu@cooee.cn.
+
+       * src/smooth/ftgrays.c (FT_DEFINE_OUTLINE_FUNCS,
+       FT_DEFINE_RASTER_FUNCS) [_STANDALONE_]: Define.
+       [!_STANDALONE_]: Include ftspic.h only here.
+       (ras): Define/declare after definition of `TWorker'.
+       Use `RAS_VAR_' where necessary.
+
+2009-04-21  Karl Berry  <karl@gnu.org>
+
+       Fix AC_CHECK_FT2.
+    
+       * builds/unix/freetype2.m4: Only check PATH for freetype-config if
+       we did not already find it from a prefix option.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Add #error to modules and files that do not support PIC yet.
+
+       When FT_CONFIG_OPTION_PIC is defined the following files will 
+       create #error:
+       * src/bdf/bdfdrivr.h
+       * src/cache/ftcmanag.c
+       * src/cid/cidriver.h
+       * src/gxvalid/gxvmod.h
+       * src/gzip/ftgzip.c
+       * src/lzw/ftlzw.c
+       * src/otvalid/otvmod.h
+       * src/pcf/pcfdrivr.h
+       * src/pfr/pfrdrivr.h
+       * src/psaux/psauxmod.h
+       * src/type1/t1driver.h
+       * src/type42/t42drivr.h
+       * src/winfonts/winfnt.h
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support in autofit module.
+
+       * include/freetype/internal/autohint.h add macros to init 
+       instances of FT_AutoHinter_ServiceRec.
+
+       * src/autofit/afmodule.h declare autofit_module_class 
+       using macros from ftmodapi.h, 
+       when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined 
+       af_autofitter_service and autofit_module_class structs 
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       And macros will be used from afpic.h in order to access them.
+
+       * src/autofit/aftypes.h add macros to init and declare
+       instances of AF_ScriptClassRec.
+
+       * src/autofit/afcjk.h declare af_cjk_script_class 
+       using macros from aftypes.h, 
+       when FT_CONFIG_OPTION_PIC is defined init function will be declared.
+       * src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined 
+       af_cjk_script_class struct will have function to init it instead of 
+       being allocated in the global scope.
+
+       * src/autofit/afdummy.h declare af_dummy_script_class 
+       using macros from aftypes.h, 
+       when FT_CONFIG_OPTION_PIC is defined init function will be declared.
+       * src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined 
+       af_dummy_script_class struct will have function to init it instead of 
+       being allocated in the global scope.
+
+       * src/autofit/afindic.h declare af_indic_script_class 
+       using macros from aftypes.h, 
+       when FT_CONFIG_OPTION_PIC is defined init function will be declared.
+       * src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined 
+       af_indic_script_class struct will have function to init it instead of 
+       being allocated in the global scope.
+
+       * src/autofit/aflatin.h declare af_latin_script_class 
+       using macros from aftypes.h, 
+       when FT_CONFIG_OPTION_PIC is defined init function will be declared.
+       * src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined 
+       af_latin_script_class struct will have function to init it instead of 
+       being allocated in the global scope.
+       Change af_latin_blue_chars to be PIC-compatible by being a two 
+       dimentional array rather than array of pointers.
+
+
+       * src/autofit/aflatin2.h declare af_latin2_script_class 
+       using macros from aftypes.h, 
+       when FT_CONFIG_OPTION_PIC is defined init function will be declared.
+       * src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined 
+       af_latin2_script_class struct will have function to init it instead of 
+       being allocated in the global scope.
+       Change af_latin2_blue_chars to be PIC-compatible by being a two 
+       dimentional array rather than array of pointers.
+
+       * src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined 
+       af_script_classes array initialization was moved to afpic.c and
+       is later refered using macros defeined in afpic.h.
+
+       New Files:
+       * src/autofit/afpic.h declare struct to hold PIC globals for autofit
+       module and macros to access them.
+       * src/autofit/afpic.c implement functions to allocate, destroy and 
+       initialize PIC globals for autofit module.
+
+       * src/autofit/autofit.c add new file to build: afpic.c.
+       * src/autofit/jamfile add new files to FT2_MULTI build: afpic.c.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support in pshinter module.
+
+       * include/freetype/internal/pshints.h add macros to init 
+       instances of PSHinter_Interface.
+
+       * src/pshinter/pshmod.h declare pshinter_module_class 
+       using macros from ftmodapi.h, 
+       when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/pshinter/pshmod.c when FT_CONFIG_OPTION_PIC is defined 
+       pshinter_interface and pshinter_module_class structs 
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       And macros will be used from pshpic.h in order to access them.
+
+       New Files:
+       * src/pshinter/pshpic.h declare struct to hold PIC globals for pshinter
+       module and macros to access them.
+       * src/pshinter/pshpic.c implement functions to allocate, destroy and 
+       initialize PIC globals for pshinter module.
+
+       * src/pshinter/pshinter.c add new file to build: pshpic.c.
+       * src/pshinter/jamfile add new files to FT2_MULTI build: pshpic.c.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support in psnames module.
+
+       * include/freetype/internal/services/svpscmap.h add macros to init 
+       instances of FT_Service_PsCMapsRec.
+
+       * src/psnames/psmodule.h declare psnames_module_class 
+       using macros from ftmodapi.h, 
+       when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/psnames/psmodule.c when FT_CONFIG_OPTION_PIC is defined 
+       pscmaps_interface and pscmaps_services structs 
+       and psnames_module_class array
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       And macros will be used from pspic.h in order to access them.
+
+       New Files:
+       * src/psnames/pspic.h declare struct to hold PIC globals for psnames
+       module and macros to access them.
+       * src/psnames/pspic.c implement functions to allocate, destroy and 
+       initialize PIC globals for psnames module.
+
+       * src/psnames/psnames.c add new file to build: pspic.c.
+       * src/psnames/jamfile add new files to FT2_MULTI build: pspic.c.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support in raster renderer.
+
+       * src/raster/ftrend1.h declare ft_raster1_renderer_class 
+       and ft_raster5_renderer_class 
+       using macros from ftrender.h, 
+       when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/smooth/ftrend1.c when FT_CONFIG_OPTION_PIC is defined 
+       ft_raster1_renderer_class and ft_raster5_renderer_class structs
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       Macros will be used from rastpic.h in order to access 
+       ft_standard_raster from the pic_container (allocated in ftraster.c).
+       In ft_raster1_render when PIC is enabled, the last letter of 
+       module_name is used to verfy the renderer class rather than the
+       class pointer.
+
+       * src/raster/ftraster.c when FT_CONFIG_OPTION_PIC is defined 
+       ft_standard_raster struct will have function to init it
+       instead of being allocated in the global scope.
+
+       New Files:
+       * src/raster/rastpic.h declare struct to hold PIC globals for raster
+       renderer and macros to access them.
+       * src/raster/rastpic.c implement functions to allocate, destroy and 
+       initialize PIC globals for raster renderer.
+
+       * src/raster/raster.c add new file to build: rastpic.c.
+       * src/raster/jamfile add new files to FT2_MULTI build: rastpic.c.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support in smooth renderer.
+
+       * src/smooth/ftsmooth.h declare ft_smooth_renderer_class, 
+       ft_smooth_lcd_renderer_class and ft_smooth_lcd_v_renderer_class 
+       using macros from ftrender.h, 
+       when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/smooth/ftsmooth.c when FT_CONFIG_OPTION_PIC is defined 
+       the following structs: 
+       ft_smooth_renderer_class, ft_smooth_lcd_renderer_class 
+       and ft_smooth_lcd_v_renderer_class 
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       And macros will be used from ftspic.h in order to access 
+       ft_grays_raster from the pic_container (allocated in ftgrays.c).
+
+       * src/smooth/ftgrays.h include FT_CONFIG_CONFIG_H
+       * src/smooth/ftgrays.c when FT_CONFIG_OPTION_PIC is NOT defined 
+       func_interface was moved from gray_convert_glyph_inner function 
+       to the global scope.
+       When FT_CONFIG_OPTION_PIC is defined 
+       func_interface and ft_grays_raster structs
+       will have functions to init them
+       instead of being allocated in the global scope.
+       And func_interface will be allocated on the stack of 
+       gray_convert_glyph_inner.
+
+       New Files:
+       * src/smooth/ftspic.h declare struct to hold PIC globals for smooth
+       renderer and macros to access them.
+       * src/smooth/ftspic.c implement functions to allocate, destroy and 
+       initialize PIC globals for smooth renderer.
+
+       * src/smooth/smooth.c add new file to build: ftspic.c.
+       * src/smooth/jamfile add new files to FT2_MULTI build: ftspic.c.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support in cff driver.
+
+       * include/freetype/internal/services/svcid.h add macros to init 
+       instances of FT_Service_CIDRec.
+       * include/freetype/internal/services/svpsinfo.h add macros to init 
+       instances of FT_Service_PsInfoRec.
+
+       * src/cff/cffcmap.h declare cff_cmap_encoding_class_rec
+       and cff_cmap_unicode_class_rec using macros from
+       ftobjs.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/cff/cffcmap.c when FT_CONFIG_OPTION_PIC is defined 
+       the following structs: 
+       cff_cmap_encoding_class_rec and cff_cmap_unicode_class_rec
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+
+       * src/cff/cffdrivr.h declare cff_driver_class using macros from
+       ftdriver.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/cff/cffdrivr.c when FT_CONFIG_OPTION_PIC is defined 
+       the following structs: 
+       cff_service_glyph_dict, cff_service_ps_info, cff_service_ps_name
+       cff_service_get_cmap_info, cff_service_cid_info, cff_driver_class, 
+       and cff_services array
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       And macros will be used from cffpic.h in order to access them
+       from the pic_container.
+       Use macros from cffpic.h in order to access the
+       structs allocated in cffcmap.c
+
+       * src/cff/cffobjs.c Use macros from cffpic.h in order to access the
+       structs allocated in cffcmap.c
+
+       * src/cff/parser.c when FT_CONFIG_OPTION_PIC is defined 
+       implement functions to create and destroy cff_field_handlers array 
+       instead of being allocated in the global scope.
+       And macros will be used from cffpic.h in order to access it
+       from the pic_container.
+
+       New Files:
+       * src/cff/cffpic.h declare struct to hold PIC globals for cff
+       driver and macros to access them.
+       * src/cff/cffpic.c implement functions to allocate, destroy and 
+       initialize PIC globals for cff driver.
+
+       * src/cff/cff.c add new file to build: cffpic.c.
+       * src/cff/jamfile add new files to FT2_MULTI build: cffpic.c.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support in sfnt driver.
+
+       * include/freetype/internal/services/svbdf.h add macros to init 
+       instances of FT_Service_BDFRec.
+       * include/freetype/internal/services/svgldict.h add macros to init 
+       instances of FT_Service_GlyphDictRec.
+       * include/freetype/internal/services/svpostnm.h add macros to init 
+       instances of FT_Service_PsFontNameRec.
+       * include/freetype/internal/services/svsfnt.h add macros to init 
+       instances of FT_Service_SFNT_TableRec.
+       * include/freetype/internal/services/svttcmap.h add macros to init 
+       instances of FT_Service_TTCMapsRec.
+       * include/freetype/internal/sfnt.h add macros to init 
+       instances of SFNT_Interface.
+
+       * src/sfnt/sfdriver.h declare sfnt_module_class using macros from
+       ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined 
+       the following structs: 
+       sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
+       tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface, 
+       sfnt_module_class, and sfnt_services array
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       And macros will be used from sfntpic.h in order to access them
+       from the pic_container.
+
+       * src/sfnt/ttcmap.h add macros to init 
+       instances of TT_CMap_ClassRec.
+       * src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined 
+       the following structs: 
+       tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
+       tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec, 
+       tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       And macros will be used from sfntpic.h in order to access them
+       from the pic_container.
+       The content of tt_cmap_classes is now described in the
+       new file 'ttcmapc.h'.
+
+       New Files:
+       * src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
+       driver and macros to access them.
+       * src/sfnt/sfntpic.c implement functions to allocate, destroy and 
+       initialize PIC globals for sfnt driver.
+       * src/sfnt/ttcmapc.h describing the content of 
+       tt_cmap_classes allocated in ttcmap.c
+
+       * src/sfnt/sfnt.c add new file to build: sfntpic.c.
+       * src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support in truetype driver.
+
+       * include/freetype/internal/services/svmm.h add macros to init 
+       instances of FT_Service_MultiMastersRec.
+       * include/freetype/internal/services/svttglyf.h add macros to init 
+       instances of FT_Service_TTGlyfRec.
+
+       * src/truetype/ttdriver.h declare tt_driver_class using macros from
+       ftdriver.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
+       functions will be declared.
+       * src/truetype/ttdriver.c when FT_CONFIG_OPTION_PIC is defined 
+       the following structs: 
+       tt_service_gx_multi_masters, tt_service_truetype_glyf, tt_driver_class
+       and tt_services array, 
+       will have functions to init or create and destroy them
+       instead of being allocated in the global scope.
+       And macros will be used from ttpic.h in order to access them
+       from the pic_container.
+       * src/truetype/ttobjs.c change trick_names array to be
+       PIC-compatible by being a two dimentional array rather than array 
+       of pointers.
+
+       New Files:
+       * src/truetype/ttpic.h declare struct to hold PIC globals for truetype
+       driver and macros to access them.
+       * src/truetype/ttpic.c implement functions to allocate, destroy and 
+       initialize PIC globals for truetype driver.
+
+       * src/truetype/truetype.c add new file to build: ttpic.c.
+       * src/truetype/jamfile add new files to FT2_MULTI build: ttpic.c.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Position Independent Code (PIC) support and infrastructure in base.
+
+       * include/freetype/config/ftoption.h add FT_CONFIG_OPTION_PIC
+       * include/freetype/internal/ftobjs.h Add pic_container member to 
+       FT_LibraryRec.
+       Add macros to declare and init instances of FT_CMap_ClassRec.
+       Add macros to init instances of FT_Outline_Funcs and FT_Raster_Funcs.
+       Add macros to declare, allocate and initialize modules 
+       (FT_Module_Class).
+       Add macros to declare, allocate and initialize renderers 
+       (FT_Renderer_Class).
+       Add macro to init instances of FT_Glyph_Class.
+       Add macros to declare, allocate and initialize drivers 
+       (FT_Driver_ClassRec).
+       * include/freetype/internal/ftpic.h new file to declare the 
+       FT_PIC_Container struct and the functions to allocate and detroy it.
+       * include/freetype/internal/ftserv.h add macros to allocate and 
+       destory arrays of FT_ServiceDescRec.
+       * include/freetype/internal/internal.h define macro to include 
+       ftpic.h.
+
+       New Files:
+       * src/base/ftpic.c implement functions to allocate and destory the 
+       global pic_container.
+       * src/base/basepic.h declare struct to hold PIC globals for base and 
+       macros to access them.
+       * src/base/basepic.c implement functions to allocate, destroy and 
+       initialize PIC globals for base.
+
+       * src/base/ftinit.c when FT_CONFIG_OPTION_PIC is defined implement 
+       functions that allocate and destroy ft_default_modules according to 
+       FT_CONFIG_MODULES_H in the pic_container instead of the global scope
+       and use macro from basepic.h to access it.
+       * src/base/ftobjs.c add calls to the functions that allocate and 
+       destroy the global pic_container when the library is created and 
+       destroyed.
+
+       * src/base/jamfile add new files to FT2_MULTI build: 
+       ftpic.c and basepic.c.
+       * src/base/ftbase.c add new files to build: 
+       ftpic.c and basepic.c.
+
+       * src/base/ftglyph.c when FT_CONFIG_OPTION_PIC is defined 
+       ft_bitmap_glyph_class and ft_outline_glyph_class will be allocated
+       in the pic_container instead of the global scope and use macros from
+       basepic.h to access them.
+       * src/base/ftbbox.c allocate bbox_interface stract on the stack 
+       instead of the global scope when FT_CONFIG_OPTION_PIC is defined.
+       * src/base/ftstroke.c access ft_outline_glyph_class allocated in
+       ftglyph.c via macros from basepic.h
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Preparing changes in cff parser later needed for PIC version.
+
+       * src/cff/cffload.c, src/cff/cffload.h, src/cff/cffobjs.c,
+       src/cff/cffparse.c, src/cff/cffparse.h: Add library pointer to 
+       'CFF_ParserRec' set by `cff_parser_init'.
+       Route library pointer from 'cff_face_init' to 'cff_subfont_load'
+       for `cff_parser_init'.
+
+       * src/cff/cffparse.c (CFF_Field_Handler): Move it to...
+       * src/cff/cffparse.h: This file, to be used by other C files.
+
+2009-04-05  Oran Agra  <oran@monfort.co.il>
+
+       Minor change in ftstroke.c.
+
+       * src/base/ftstroke.c (FT_StrokerRec): Replace `memory' member with
+       `library' needed for PIC version.
+       Update all callers.
+
+2009-04-04  Werner Lemberg  <wl@gnu.org>
+
+       ftnames.c -> ftsnames.c
+
+       * src/base/ftnames.c: Rename to...
+       * src/base/ftsnames.c: This.
+       * src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated.
+
+2009-04-04  Werner Lemberg  <wl@gnu.org>
+
+       Add support for cmap type 13.
+
+       * devel/ftoption.h, include/freetype/config/ftoption.h
+       (TT_CONFIG_CMAP_FORMAT_13): New macro.
+
+       * src/sfnt/ttcmap.c (TT_CMap13Rec, tt_cmap13_init,
+       tt_cmap13_validate, tt_cmap13_char_index, tt_cmap13_char_next,
+       tt_cmap13_get_info, tt_cmap13_char_map_def_binary,
+       tt_cmap14_class_rec): New functions and structures for cmap 13
+       support.
+       (tt_cmap_classes): Register tt_cmap13_class_rec.
+
+       * docs/CHANGES: Mention cmap 13 support.
+
+2009-04-01  Werner Lemberg  <wl@gnu.org>
+
+       Ignore empty contours in CFF glyphs.
+
+       Problem reported by Albert Astals Cid <aacid@kde.org>.
+
+       * src/cff/cffgload.c (cff_builder_close_contour): Synchronize with
+       t1_builder_close_contour.
+
+2009-03-21  Werner Lemberg  <wl@gnu.org>
+
+       Another redundant header inclusion.
+
+       * src/truetype/ttgxvar.c: Fix Ghostscript Coverity issue #4041.
+
+2009-03-21  Werner Lemberg  <wl@gnu.org>
+
+       Remove redundant header inclusions.
+
+       This covers many Ghostscript Coverity issues.
+
+       * src/*: Do it.
+
+2009-03-21  Werner Lemberg  <wl@gnu.org>
+
+       Fix Ghostscript Coverity issue #3904.
+
+       * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Protect against
+       invalid values of `runcnt'.
+
+2009-03-20  Werner Lemberg  <wl@gnu.org>
+
+       Fix `make multi' run.
+
+       * src/smooth/ftsmooth.h: Include FT_INTERNAL_DEBUG_H.
+
+2009-03-20  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #25923.
+
+       * src/cache/ftccmap.c (FTC_CMAP_HASH): Fix typo.
+
+2009-03-20  Werner Lemberg  <wl@gnu.org>
+
+       Protect against too large glyphs.
+
+       Problem reported by Tavis Ormandy <taviso@google.com>.
+
+       * src/smooth/ftsmooth.c (ft_smooth_render_generic): Don't allow
+       `pitch' or `height' to be larger than 0xFFFF.
+
+2009-03-20  Werner Lemberg  <wl@gnu.org>
+           Tavis Ormandy  <taviso@google.com>
+
+       Fix validation for various cmap table formats.
+
+       * src/sfnt/ttcmap.c (tt_cmap8_validate, tt_cmap10_validate,
+       tt_cmap12_validate): Check `length' correctly.
+       (tt_cmap_14_validate): Check `length' and `numMappings' correctly.
+
+2009-03-20  Werner Lemberg  <wl@gnu.org>
+
+       Protect against malformed compressed data.
+
+       * src/lzw/ftzopen.c (ft_lzwstate_io): Test whether `state->prefix' is
+       zero.
+
+2009-03-20  Werner Lemberg  <wl@gnu.org>
+
+       Protect against invalid SID values in CFFs.
+
+       Problem reported by Tavis Ormandy <taviso@google.com>.
+
+       * src/cff/cffload.c (cff_charset_load): Reject SID values larger
+       than 64999.
+
+2009-03-19  Vincent Richomme  <richom.v@free.fr>
+
+       Update WinCE Visual C project files.
+
+       * builds/wince/vc2005-ce/freetype.vcproj,
+       builds/wince/vc2008-ce/freetype.vcproj: Add missing base extension
+       files.
+
+2009-03-19  Werner Lemberg  <wl@gnu.org>
+
+       Remove unused Win32 code.
+
+       * builds/wince/ftdebug.c: Remove code guarded with `!_WIN32_WCE'.
+       Since Win32 is handled separately this is no longer needed.
+
+2009-03-19  Vincent Richomme  <richom.v@free.fr>
+
+       Make `gzip' module compile on WinCE.
+
+       * src/gzip/zconf.h [_WIN32_WCE]: Define NO_ERRNO_H.
+
+2009-03-19  Werner Lemberg  <wl@gnu.org>
+
+       Remove unused WinCE code.
+
+       * builds/win32/ftdebug.c: Remove code guarded with `_WIN32_WCE'.
+       Since WinCE is handled separately this is no longer needed.
+
+2009-03-16  Werner Lemberg  <wl@gnu.org>
+
+       docmaker: Don't ignore single-line code blocks.
+
+       * src/tools/docmaker/content.py (DocBlock::_init__): Fix change from
+       2009-01-31.
+
+2009-03-15  Steve Langasek  <steve.langasek@canonical.com>
+
+       Use __asm__ for declaring assembly instead of asm.
+
+       * builds/unix/ftconfig.in (FT_MulFix_arm): Use __asm__ instead of
+       asm on arm, fixing a build failure on armel with -pedantic.
+
+2009-03-14  Werner Lemberg  <wl@gnu.org>
+
+       Fix valgrind warning.
+
+       * src/sfnt/ttsbit0.c (tt_sbit_decoder_load_bit_aligned): Don't read
+       past the end of the frame.
+
+2009-03-12  Werner Lemberg  <wl@gnu.org>
+
+       * Version 2.3.9 released.
+       =========================
+
+
+       Tag sources with `VER-2-3-9'.
+
+2009-03-12  Werner Lemberg  <wl@gnu.org>
+
+       * builds/unix/freetype2.in: Move @FT2_EXTRA_LIBS@ to `Libs.private'.
+
+2009-03-12  Werner Lemberg  <wl@gnu.org>
+
+       Fix some FreeType Coverity issues as reported for Ghostscript.
+
+       * src/base/ftobjs.c (FT_New_Face, FT_New_Memory_Face): Initialize
+       `args.stream' (#3874, #3875).
+       (open_face_PS_from_sfnt_stream): Improve error management (#3786).
+       * src/base/ftmm.c (ft_face_get_mm_service): Fix check of `aservice'
+       (#3870).
+       * src/base/ftstroke.c (ft_stroke_border_get_counts): Remove dead
+       code (#3790).
+       * src/base/ftrfork.c (raccess_guess_apple_generic): Check error
+       value of `FT_Stream_Skip' (#3784).
+
+       * src/type1/t1gload.c (T1_Load_Glyph): Check `size' before accessing
+       it (#3872)
+
+       * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Check `face' before accessing
+       it (#3871).
+       * src/pcf/pcfread.c (pcf_get_metrics): Handle return value of
+       `pcf_get_metric' (#3789, #3782).
+       (pcf_get_properties): Use FT_STREAM_SKIP (#3783).
+
+       * src/cache/ftcmanag.c (FTC_Manager_RegisterCache): Fix check of
+       `acache' (#3797)
+
+       * src/cff/cffdrivr.c (cff_ps_get_font_info): Fix check of `cff'
+       (#3796).
+       * src/cff/cffgload.c (cff_decoder_prepare): Check `size' (#3795).
+       * src/cff/cffload.c (cff_index_get_pointers): Add comment (#3794).
+
+       * src/bdf/bdflib.c (_bdf_add_property): Check `fp->value.atom'
+       (#3793).
+       (_bdf_parse_start): Add comment (#3792).
+
+       * src/raster/ftraster.c (Finalize_Profile_Table): Check
+       `ras.fProfile' (#3791).
+
+       * src/sfnt/ttsbit.c (Load_SBit_Image): Use FT_STREAM_SKIP (#3785).
+
+       * src/gzip/ftgzip.c (ft_gzip_get_uncompressed_size): Properly ignore
+       seek error (#3781).
+
+2009-03-11  Michael Toftdal  <toftdal@gmail.com>
+
+       Extend CID service functions to handle CID-keyed CFFs as CID fonts.
+
+       * include/freetype/ftcid.h (FT_Get_CID_Is_Internally_CID_keyed,
+       FT_Get_CID_From_Glyph_Index): New functions.
+
+       * include/freetype/internal/services/svcid.h
+       (FT_CID_GetIsInternallyCIDKeyedFunc,
+       FT_CID_GetCIDFromGlyphIndexFunc): New function typedefs.
+       (CID Service): Use them.
+
+       * src/base/ftcid.c: Include FT_CID_H.
+       (FT_Get_CID_Is_Internally_CID_keyed, FT_Get_CID_From_Glyph_Index):
+       New functions.
+
+       * src/cff/cffdrivr.c (cff_get_is_cid, cff_get_cid_from_glyph_index):
+       New functions.
+       (cff_service_cid_info): Add them.
+       * src/cff/cffload.c (cff_font_load): Don't free `font->charset.sids'
+       -- it is needed for access as a CID-keyed font.  It gets deleted
+       later on.
+
+       * src/cid/cidriver.c (cid_get_is_cid, cid_get_cid_from_glyph_index):
+       New functions.
+       (cid_service_cid_info): Add them.
+
+       * docs/CHANGES: Updated.
+
+2009-03-11  Bram Tassyns  <bramt@enfocus.be>
+
+       Fix Savannah bug #25597.
+
+       * src/cff/cffparse.c (cff_parse_real): Don't allow fraction_length
+       to become larger than 9.
+
+2009-03-11  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #25814.
+
+       * builds/unix/freetype2.in: As suggested in the bug report, move
+       @LIBZ@ to `Libs.private'.
+
+2009-03-11  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #25781.
+       We now simply check for a valid `offset', no longer handling `delta
+       = 1' specially.
+
+       * src/sfnt/ttcmap.c (tt_cmap4_validate): Don't check `delta' for
+       last segment.
+       (tt_cmap4_set_range, tt_cmap4_char_map_linear,
+       tt_cmap4_char_map_binary): Check offset.
+
+2009-03-11  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/Jamfile: Fix handling of ftadvanc.c.
+       Reported by Oran Agra <oran@monfort.co.il>.
+
+2009-03-10  Vincent Richomme  <richom.v@free.fr>
+
+       Restructure Win32 and Wince compiler support.
+
+       * src/builds/win32: Remove files for WinCE.
+       Move VC 2005 support to a separate directory.
+       Add directory for VC 2008 support.
+
+       * src/builds/wince: New directory hierarchy for WinCE compilers
+       (VC 2005 and VC 2008).
+
+2009-03-09  Werner Lemberg  <wl@gnu.org>
+
+       More preparations for 2.3.9 release.
+
+       * docs/CHANGES: Updated.
+
+       * Jamfile, README: s/2.3.8/2.3.9/, s/238/239/.
+
+2009-03-09  Werner Lemberg  <wl@gnu.org>
+
+       * src/sfnt/rules.mk (SFNT_DRV_H): Add ttsbit0.c.
+
+2009-03-09  Alexey Kryukov  <anagnost@yandex.ru>
+
+       Fix handling of EBDT formats 8 and 9 (part 2).
+
+       This patch fixes the following problems in ttsbit0.c:
+
+       . Bitmaps for compound glyphs were never allocated.
+
+       . `SBitDecoder' refused to load metrics if some other metrics have
+         already been loaded.  This condition certainly makes no sense for
+         recursive calls, so I've just disabled it.  Another possibility
+         would be resetting `decoder->metrics_loaded' to false before
+         loading each composite component.  However, we must restore the
+         original metrics after finishing the recursion; otherwise we can
+         get a misaligned glyph.
+
+       . `tt_sbit_decoder_load_bit_aligned' incorrectly handled `x_pos',
+         causing some glyph components to be shifted too far to the right
+         (especially noticeable for small sizes).
+
+       Note that support for grayscale bitmaps (not necessarily compound) is
+       completely broken in ttsbit0.c.
+
+       * src/sfnt/tt_sbit_decoder_load_metrics: Always load metrics.
+       (tt_sbit_decoder_load_bit_aligned): Handle `x_pos' correctly in case
+       of `h == height'.
+       (tt_sbit_decoder_load_compound): Reset metrics after loading
+       components.
+       Allocate bitmap.
+
+2009-03-09  Werner Lemberg  <wl@gnu.org>
+
+       * builds/unix/configure.raw (version_info): Set to 9:20:3.
+
+2009-03-03  David Turner  <david@freetype.org>
+
+       Protect SFNT kerning table parser against malformed tables.
+
+       This closes Savannah BUG #25750.
+
+       * src/sfnt/ttkern.c (tt_face_load_kern, tt_face_get_kerning): Fix a
+       bug where a malformed table would be successfully loaded but later
+       crash the engine during parsing.
+
+2009-03-03  David Turner  <david@freetype.org>
+
+       Update documentation and bump version number to 2.3.9.
+
+       * include/freetype/freetype.h: Bump patch version to 9.
+       * docs/CHANGES: Document the ABI break in 2.3.8.
+       * docs/VERSION.DLL: Update version numbers table for 2.3.9.
+
+2009-03-03  David Turner  <david@freetype.org>
+
+       Remove ABI-breaking field in public PS_InfoFontRec definition.
+
+       Instead, we define a new internal PS_FontExtraRec structure to
+       hold the additional field, then place it in various internal
+       positions of the corresponding FT_Face derived objects.
+
+       * include/freetype/t1tables.h (PS_FontInfoRec): Remove the
+       `fs_type' field from the public structure.
+       * include/freetype/internal/psaux.h (T1_FieldLocation): New
+       enumeration `T1_FIELD_LOCATION_FONT_EXTRA'.
+       * include/freetype/internal/t1types.h (PS_FontExtraRec): New
+       structure.
+       (T1_FontRec, CID_FaceRec): Add it.
+
+       * src/cid/cidload.c (cid_load_keyword): Handle
+       T1_FIELD_LOCATION_FONT_EXTRA.
+       * src/cid/cidtoken.h, src/type1/t1tokens.h, src/type42/t42parse.c:
+       Adjust FT_STRUCTURE and T1CODE properly to handle `FSType'.
+       * src/type1/t1load.c (t1_load_keyword): Handle
+       T1_FIELD_LOCATION_FONT_EXTRA.
+
+       * include/freetype/internal/services/svpsinfo.h (PsInfo service):
+       Add `PS_GetFontExtraFunc' function typedef.
+
+       * src/base/ftfstype.c: Include FT_INTERNAL_SERVICE_H and
+       FT_SERVICE_POSTSCRIPT_INFO_H.
+       (FT_Get_FSType_Flags): Use POSTSCRIPT_INFO service.
+
+       * src/cff/cffdrivr.c (cff_service_ps_info): Updated.
+       * src/cid/cidriver.c (cid_ps_get_font_extra): New function.
+       (cid_service_ps_info): Updated.
+       * src/type1/t1driver.c (t1_ps_get_font_extra): New function.
+       (t1_service_ps_info): Updated.
+       * src/type42/t42drivr.c (t42_ps_get_font_extra): New function.
+       (t42_service_ps_info): Updated.
+
+2009-03-02  Alexey Kryukov  <anagnost@yandex.ru>
+
+       Fix handling of EBDT formats 8 and 9.
+
+       The main cycle in `blit_sbit' makes too many iterations: it actually
+       needs the count of lines in the source bitmap rather than in the
+       target image.
+
+       * src/sfnt/ttsbit.c (blit_sbit) [FT_CONFIG_OPTION_OLD_INTERNALS]:
+       Add parameter `source_height' and use it for main loop.
+       (Load_SBit_Single) [FT_CONFIG_OPTION_OLD_INTERNALS]: Updated.
+
+2009-02-23  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #25669.
+
+       * src/base/ftadvanc.h (FT_Get_Advances): Fix serious typo.
+
+       * src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): Fix
+       scaling factor for non-scalable fonts.
+
+       * src/cff/cffdrivr.c (cff_get_advances): Use correct advance width
+       value to prevent incorrect scaling.
+
+       * docs/CHANGES: Document it.
+
+2009-02-15  Matt Godbolt  <matt@godbolt.org>
+
+       Fix Savannah bug #25588.
+
+       * builds/unix/ftconfig.in (FT_MulFix_arm): Use correct syntax for
+       `orr' instruction.
+
+2009-02-11  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttobjs.c (tt_check_trickyness): Add `DFKaiShu'.
+       Reported by David Bevan <dbevan@emtex.com>.
+
+2009-02-09  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #25495.
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): Test for bitmap strikes before
+       setting metrics and bbox values.  This ensures that the check for a
+       font with neither a `glyf' table nor bitmap strikes can be performed
+       early enough to set metrics and bbox values too.
+
+2009-02-04  Werner Lemberg  <wl@gnu.org>
+
+       Fix Savannah bug #25480.
+
+       * builds/unix/freetype-config.in: For --ftversion, don't use $prefix
+       but $includedir.
+
+2009-01-31  Werner Lemberg  <wl@gnu.org>
+
+       Minor docmaker improvements.
+
+       * src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty
+       code blocks.
+
+2009-01-25  Werner Lemberg  <wl@gnu.org>
+
+       Fix SCANCTRL handling in TTFs.
+       Problem reported by Alexey Kryukov <anagnost@yandex.ru>.
+
+       * src/truetype/ttinterp.c (Ins_SCANCTRL): Fix threshold handling.
+
+2009-01-23  Werner Lemberg  <wl@gnu.org>
+
+       Move FT_Get_FSType_Flags to a separate file.
+       Problem reported by Mickey Gabel <mickey@monfort.co.il>.
+
+       * src/base/ftobjs.c (FT_Get_FSType_Flags): Move to...
+       * src/base/ftfstype.c: This new file.
+
+       * modules.cfg (BASE_EXTENSION): Add ftfstype.c.
+
+       * docs/INSTALL.ANY: Updated.
+
+       * builds/mac/*.txt, builds/amiga/*makefile*,
+       builds/win32/{visualc,visualce}/freetype.*, builds/symbian/*:
+       Updated.
+
+2009-01-22  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/ftsystem.c (FT_Stream_Open): Fix 2 error
+       messages ending without "\n".
+
+2009-01-22  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Fix Savannah bug #25347.
+
+       * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Rewind
+       the stream to the original position passed to this function,
+       when ft_lookup_PS_in_sfnt_stream() failed.
+       (Mac_Read_sfnt_Resource): Rewind the stream to the head of
+       sfnt resource body, when open_face_PS_from_sfnt_stream()
+       failed.
+
+2009-01-19  Michael Lotz  <mmlr@mlotz.ch>
+
+       Fix Savannah bug #25355.
+
+       * include/freetype/config/ftconfig.h (FT_MulFix_i386): Make
+       assembler code work with gcc 2.95.3 (as used by the Haiku project).
+       Add `cc' register to the clobber list.
+
+2009-01-18  Werner Lemberg  <wl@gnu.org>
+
+       Protect FT_Get_Next_Char.
+
+       * src/sfnt/ttcmap.c (tt_cmap4_set_range): Apply fix similar to
+       change from 2008-07-22.
+
+       Patch from Ronen Ghoshal <rghoshal@emtex.com>.
+
+2009-01-18  Werner Lemberg  <wl@gnu.org>
+
+       Implement FT_Get_Name_Index for SFNT driver.
+
+       * src/sfnt/sfdriver.c (sfnt_get_name_index): New function.
+       (sfnt_service_glyph_dict): Use it.
+
+       Problem reported by Truc Truong <tructv@necsv.com>.
+
+2009-01-18  Werner Lemberg  <wl@gnu.org>
+
+       * include/freetype/ftstroke.h (FT_Outline_GetInsideBorder): Fix
+       documentation.  Problem reported by Truc Truong <tructv@necsv.com>.
+
+       * docs/CHANGES: Updated.
+
+2009-01-14  Werner Lemberg  <wl@gnu.org>
+
+       * Version 2.3.8 released.
+       =========================
+
+
+       Tag sources with `VER-2-3-8'.
+
+       * docs/VERSION.DLL: Update documentation and bump version number to
+       2.3.8.
+
+       * README, Jamfile (RefDoc), builds/win32/visualc/index.html,
+       builds/win32/visualc/freetype.dsp,
+       builds/win32/visualc/freetype.vcproj,
+       builds/win32/visualce/index.html,
+       builds/win32/visualce/freetype.dsp,
+       builds/win32/visualce/freetype.vcproj: s/2.3.7/2.3.8/, s/237/238/.
+
+       * include/freetype/freetype.h (FREETYPE_PATCH): Set to 8.
+
+       * builds/unix/configure.raw (version_info): Set to 9:19:3.
+
+       * docs/release: Updated.
+
+2009-01-14  Werner Lemberg  <wl@gnu.org>
+
+       * builds/toplevel.mk (dist): Compress better.
+
+2009-01-13  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftobjs.c (FT_Get_FSType_Flags): Cast for compilation
+       with C++.
+
+2009-01-13  Werner Lemberg  <wl@gnu.org>
+
+       Don't use stdlib.h and friends directly.
+       Reported by Mickey Gabel <mickey@monfort.co.il>.
+
+       * src/base/ftdbgmem.c: s/<stdlib.h>/FT_CONFIG_STANDARD_LIBRARY_H/.
+
+       * src/gzip/ftgzip.c, src/lzw/ftlzw.c, src/raster/ftmisc.h:
+       s/<string.h>/FT_CONFIG_STANDARD_LIBRARY_H/.
+
+       * src/autofit/aftypes.h, src/autofit/afhints.c,
+       src/pshinter/pshalgo.c: s/<stdio.h>/FT_CONFIG_STANDARD_LIBRARY_H/
+
+       * src/lzw/ftlzw.c, src/base/ftdbgmem.c: Don't include stdio.h.
+
+2009-01-12  Werner Lemberg  <wl@gnu.org>
+
+       Avoid compiler warnings.
+
+       * */*: s/do ; while ( 0 )/do { } while ( 0 )/.
+       Reported by Sean McBride <sean@rogue-research.com>.
+
+2009-01-12  Werner Lemberg  <wl@gnu.org>
+
+       Fix stdlib dependencies.
+
+       Problem reported by Mickey Gabel <mickey@monfort.co.il>.
+
+       * include/freetype/config/ftstdlib.h (ft_exit): Removed.  Unused.
+
+       * src/autofit/afhints.c, src/base/ftlcdfil.c, src/smooth/ftsmooth.c:
+       s/memcpy/ft_memcpy/.
+       * src/psaux/t1decode.c: s/memset/ft_memset/, s/memcpy/ft_memcpy/.
+
+2009-01-11  Werner Lemberg  <wl@gnu.org>
+
+       * docs/formats.txt: Add link to PCF specification.
+
+       * include/freetype/ftbdf.h (FT_Get_BDF_Property): Improve
+       documentation.
+
+2009-01-09  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftadvanc.c (_ft_face_scale_advances, FT_Get_Advance,
+       FT_Get_Advances): Change the type of load_flags from FT_UInt32 to
+       FT_Int32, to match with the flags for FT_Load_Glyph().
+       * src/cff/cffdrivr.c (cff_get_advances): Ditto.
+       * src/truetype/ttdriver.c (tt_get_advances): Ditto.
+       * include/freetype/ftadvanc.h (FT_Get_Advance, FT_Get_Advances):
+       Ditto.
+       * include/freetype/internal/ftdriver.h (FT_Face_GetAdvancesFunc):
+       Ditto.
+
+2009-01-09  Daniel Zimmermann  <netzimme@aol.com>
+
+       * src/gxvalid/gxvmort.c (gxv_mort_feature_validate): Fix wrong
+       length check.  From Savannah patch #6682.
+
+2009-01-09  Werner Lemberg  <wl@gnu.org>
+
+       Fix problem with T1_FIELD_{NUM,FIXED}_TABLE2.
+
+       * src/psaux/psobjs.c (ps_parser_load_field_table): Don't handle
+       `count_offset' if it is zero (i.e., unused).  Otherwise, the first
+       element of the structure which holds the data is erroneously
+       modified.  Problem reported by Chi Nguyen <chint@necsv.com>.
+
+2009-01-09  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftadvanc.c (_ft_face_scale_advances, FT_Get_Advance,
+       FT_Get_Advances): Extend the type of load_flags from FT_UInt to
+       FT_UInt32, to pass 32-bit flags on 16bit platforms.
+       * src/cff/cffdrivr.c (cff_get_advances): Ditto.
+       * src/truetype/ttdriver.c (tt_get_advances): Ditto.
+       * include/freetype/ftadvanc.h (FT_Get_Advance, FT_Get_Advances):
+       Ditto.
+       * include/freetype/internal/ftdriver.h (FT_Face_GetAdvancesFunc):
+       Ditto.
+
+2009-01-09  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftobjs.c (FT_Done_Library): Issue an error message when
+       FT_Done_Face() cannot free all faces. If the list of the opened
+       faces includes broken face which FT_Done_Face() cannot free,
+       FT_Done_Library() retries FT_Done_Face() and it can fall into
+       an endless loop. See the discussion:
+       http://lists.gnu.org/archive/html/freetype-devel/2008-09/msg00047.html
+       http://lists.gnu.org/archive/html/freetype-devel/2008-10/msg00000.html
+
+2009-01-07  Werner Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES: Document new key `a' in ftdiff.
+
+2009-01-06  Werner Lemberg  <wl@gnu.org>
+
+       * autogen.sh: Don't use GNUisms while calling sed.  Problem reported
+       by Sean McBride.
+
+2009-01-06  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftbitmap.c (FT_Bitmap_Convert): Handle FT_PIXEL_MODE_LCD
+       and FT_PIXEL_MODE_LCD_V.  Problem reported by Chi Nguyen
+       <chint@necsv.com>.
+
+2009-01-06  Diego Pettenò  <flameeyes@gmail.com>
+
+       * builds/unix/configure.raw: Don't call AC_CANONICAL_BUILD and
+       AC_CANONICAL_TARGET and use $host_os only.  A nice explanation for
+       this change can be found at
+       http://blog.flameeyes.eu/s/canonical-target.
+
+       From Savannah patch #6712.
+
+2009-01-06  Sean McBride  <sean@rogue-research.com>
+
+       * src/base/ftdbgmem.c (_debug_mem_dummy): Make it static.
+
+       * src/base/ftmac.c: Remove some #undefs.
+
+2008-12-26  Werner Lemberg  <wl@gnu.org>
+
+       Set `face_index' field in FT_Face for all font formats.
+
+       * cff/cffobjs.c (cff_face_init), winfonts/winfnt.c (FNT_Face_Init),
+       sfnt/sfobjs.c (sfnt_init_face): Do it.
+
+       * docs/CHANGES: Document it.
+
+2008-12-22  Steve Grubb
+
+       * builds/unix/ftsystem.c (FT_Stream_Open): Reject zero-length files.
+       Patch from Savannah bug #25151.
+
+2008-12-21  Werner Lemberg  <wl@gnu.org>
+
+       * src/pfr/pfrdrivr.c, src/winfonts/winfnt.c, src/cache/ftcmanag.c,
+       src/smooth/ftgrays.c, src/base/ftobjc.s, src/sfobjs.c:
+       s/_Err_Bad_Argument/_Err_Invalid_Argument/.  The former is for
+       errors in the bytecode interpreter only.
+
+2008-12-21  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftpfr.c (FT_Get_PFR_Metrics): Protect against NULL
+       arguments.
+       Fix return value for non-PFR fonts.  Both problems reported by Chi
+       Nguyen <chint@necsv.com>.
+
+2008-12-21  anonymous
+
+       FT_USE_MODULE declares things as:
+
+         extern const FT_Module_Class
+
+       (or similar for C++).  However, the actual types of the variables
+       being declared are often different, e.g., FT_Driver_ClassRec or
+       FT_Renderer_Class.  (Some are, indeed, FT_Module_Class.)
+
+       This works with most C compilers (since those structs begin with an
+       FT_Module_Class struct), but technically it's undefined behavior.
+
+       To quote the ISO/IEC 9899:TC2 final committee draft, section 6.2.7
+       paragraph 2:
+
+         All declarations that refer to the same object or function shall
+         have compatible type; otherwise, the behavior is undefined.
+
+       (And they are not compatible types.)
+
+       Most C compilers don't reject (or even detect!) code which has this
+       issue, but the GCC LTO development branch compiler does.  (It
+       outputs the types of the objects while generating .o files, along
+       with a bunch of other information, then compares them when doing the
+       final link-time code generation pass.)
+
+       Patch from Savannah bug #25133.
+
+       * src/base/ftinit.c (FT_USE_MODULE): Include variable type.
+
+       * builds/amiga/include/freetype/config/ftmodule.h,
+       include/freetype/config/ftmodule.h, */module.mk: Updated to declare
+       pass correct types to FT_USE_MODULE.
+
+2008-12-21  Hongbo Ni  <hongbo@njstar.com>
+
+       * src/autofit/aflatin.c (af_latin_hint_edges),
+       src/autofit/aflatin2.c (af_latin2_hint_edges), src/autofit/afcjk.c
+       (af_cjk_hint_edges): Protect against division by zero.  This fixes
+       Savannah bug #25124.
+
+2008-12-18  Werner Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES: Updated.
+
+2008-12-18  Bevan, David  <dbevan@emtex.com>
+
+       Provide API for accessing embedding and subsetting restriction
+       information.
+
+       * include/freetype.h (FT_FSTYPE_INSTALLABLE_EMBEDDING,
+       FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING,
+       FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING, FT_FSTYPE_EDITABLE_EMBEDDING,
+       FT_FSTYPE_NO_SUBSETTING, FT_FSTYPE_BITMAP_EMBEDDING_ONLY): New
+       macros.
+       (FT_Get_FSType_Flags): New function declaration.
+
+       * src/base/ftobjs.c (FT_Get_FSType_Flags): New function.
+
+       * src/cid/cidtoken.h, src/type1/t1tokens.h, src/type42/t42parse.c
+       (t42_keywords): Handle `FSType'.
+
+       * include/freetype/t1tables.h (PS_FontInfoRec): Add `fs_type' field.
+
+2008-12-17  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Don't use internal
+       macros so that copying the source code into an application works
+       out of the box.
+
+2008-12-17  Werner Lemberg  <wl@gnu.org>
+
+       * include/freetype/ftsynth.h, src/base/ftsynth.c: Move
+       FT_GlyphSlot_Own_Bitmap to...
+       * include/freetype/ftbitmap.h, src/base/ftbitmap.c: These files.
+
+       * docs/CHANGES: Document it.
+
+2008-12-10  Werner Lemberg  <wl@gnu.org>
+
+       Generalize the concept of `tricky' fonts by introducing
+       FT_FACE_FLAG_TRICKY to indicate that the font format's hinting
+       engine is necessary for correct rendering.
+
+       At the same time, slightly modify the behaviour of tricky fonts:
+       FT_LOAD_NO_HINTING is now ignored.  To really force raw loading
+       of tricky fonts (without hinting), both FT_LOAD_NO_HINTING and
+       FT_LOAD_NO_AUTOHINT must be used.
+
+       Finally, tricky TrueType fonts always use the bytecode interpreter
+       even if the patented code is used.
+
+       * include/freetype/freetype.h (FT_FACE_FLAG_TRICKY, FT_IS_TRICKY):
+       New macros.
+
+       * src/truetype/ttdriver.c (Load_Glyph): Handle new load flags
+       semantics as described above.
+
+       * src/truetype/ttobjs.c (tt_check_trickyness): New function, using
+       code of ...
+       (tt_face_init): This function, now simplified and updated to new
+       semantics.
+
+       * src/base/ftobjs.c (FT_Load_Glyph): Don't use autohinter for tricky
+       fonts.
+
+       * docs/CHANGES: Document it.
+
+2008-12-09  Werner Lemberg  <wl@gnu.org>
+
+       Really fix Savannah bug #25010: An SFNT font with neither outlines
+       nor bitmaps can be considered as containing space `glyphs' only.
+
+       * src/truetype/ttpload.c (tt_face_load_loca): Handle the case where
+       a `glyf' table is missing.
+
+       * src/truetype/ttgload.c (load_truetype_glyph): Abort if we have no
+       `glyf' table but a non-zero `loca' entry.
+       (tt_loader_init): Handle missing `glyf' table.
+
+       * src/base/ftobjs.c (FT_Load_Glyph): Undo change 2008-12-05.
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): A font with neither outlines
+       nor bitmaps is scalable.
+
+2008-12-05  Werner Lemberg  <wl@nu.org>
+
+       * src/autofit/aflatin.c (af_latin_uniranges): Add more ranges.  This
+       fixes Savannah bug #21190 which also provides a basic patch.
+
+2008-12-05  Werner Lemberg  <wl@nu.org>
+
+       * include/freetype/freetype.h (FT_LOAD_ADVANCE_ONLY): Use value
+       0x100 instead of 0x10000; the latter value is already occupied by
+       FT_LOAD_TARGET_LIGHT.  Bug reported by James Cloos.
+
+
+       Handle SFNT with neither outlines nor bitmaps.  This fixes Savannah
+       bug #25010.
+
+       * src/base/ftobjs.c (FT_Load_Glyph): Reject fonts with neither
+       outlines nor bitmaps.
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): Don't return an error if there
+       is no table with glyphs.
+
+
+       * src/sfnt/ttload.c (tt_face_lookup_table): Improve debugging
+       message.
+
+2008-12-01  Werner Lemberg  <wl@gnu.org>
+
+       GDEF tables need `glyph_count' too for validation.  Problem reported
+       by Chi Nguyen <chint@necsv.com>.
+
+       * src/otvalid/otvgdef.c (otv_GDEF_validate), src/otvalid/otvalid.h
+       (otv_GDEF_validate), src/otvalid/otvmod.c (otv_validate): Pass
+       `glyph_count'.
+
+2008-11-29  Werner Lemberg  <wl@gnu.org>
+
+       * src/autofit/afcjk.c, src/base/ftoutln.c, src/base/ftrfork.c,
+       src/bdf/bdfdrivr.c, src/gxvalid/gxvmorx.c, src/otvalid/otvmath.c,
+       src/pcf/pcfdrivr.c, src/psnames/pstables.h, src/smooth/ftgrays.c,
+       src/tools/glnames.py, src/truetype/ttinterp.c, src/type1/t1load.c,
+       src/type42/t42objs.c, src/winfonts/winfnt.c: Fix compiler warnings
+       (Atari PureC).
+
+2008-11-29  James Cloos  <cloos@jhcloos.com>
+
+       * src/type/t1load.c (mm_axis_unmap): Revert previous patch and fix
+       it correctly by using FT_INT_TO_FIXED (FreeType expects 16.16 values
+       in the /BlendDesignMap space).
+
+2008-11-29  James Cloos  <cloos@jhcloos.com>
+
+       * src/type1/t1load.c (mm_axis_unmap): `blend_points' is FT_Fixed*,
+       whereas `design_points' is FT_Long*.  Therefore, return blend rather
+       than design points.
+
+2008-11-27  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffparse.c (cff_parse_real): Handle more than nine
+       significant digits correctly.  This fixes Savannah bug #24953.
+
+2008-11-25  Daniel Zimmermann  <netzimme@aol.com>
+
+       * src/base/ftstream.c (FT_Stream_ReadFields): Don't access stream
+       before the NULL check.  From Savannah patch #6681.
+
+2008-11-24  Werner Lemberg  <wl@gnu.org>
+
+       Fixes from the gnuwin32 port.
+
+       * src/base/ftlcdfil.c: s/EXPORT/EXPORT_DEF/.
+
+       * src/base/ftotval.c: Include FT_OPENTYPE_VALIDATE_H.
+
+       * src/psaux/psobjs.c (ps_table_add): Check `length'.
+
+2008-11-15  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttinterp.c (tt_default_graphics_state): The default
+       value for `scan_type' is zero, as confirmed by Greg Hitchcock from
+       Microsoft.  Problem reported by Michal Nowakowski
+       <miszka@limes.com.pl>.
+
+2008-11-12  Tor Andersson  <tor.andersson@gmail.com>
+
+       * src/cff/cffdrivr.c (cff_get_cmap_info): Initialize `format' field.
+       This fixes Savannah bug #24819.
+
+2008-11-08  Werner Lemberg  <wl@gnu.org>
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): Remove #if 0/#endif guards
+       since OpenType version 1.5 has been released.
+
+       * include/ttnameid.h (TT_NAME_ID_WWS_FAMILY,
+       TT_NAME_ID_WWS_SUBFAMILY): New macros for OpenType 1.5.
+       (TT_URC_COPTIC, TT_URC_VAI, TT_URC_NKO, TT_URC_BALINESE,
+       TT_URC_PHAGSPA, TT_URC_NON_PLANE_0, TT_URC_PHOENICIAN,
+       TT_URC_TAI_LE, TT_URC_NEW_TAI_LUE, TT_URC_BUGINESE,
+       TT_URC_GLAGOLITIC, TT_URC_YIJING, TT_URC_SYLOTI_NAGRI,
+       TT_URC_LINEAR_B, TT_URC_ANCIENT_GREEK_NUMBERS, TT_URC_UGARITIC,
+       TT_URC_OLD_PERSIAN, TT_URC_SHAVIAN, TT_URC_OSMANYA,
+       TT_URC_CYPRIOT_SYLLABARY, TT_URC_KHAROSHTHI, TT_URC_TAI_XUAN_JING,
+       TT_URC_CUNEIFORM, TT_URC_COUNTING_ROD_NUMERALS, TT_URC_SUNDANESE,
+       TT_URC_LEPCHA, TT_URC_OL_CHIKI, TT_URC_SAURASHTRA, TT_URC_KAYAH_LI,
+       TT_URC_REJANG, TT_URC_CHAM, TT_URC_ANCIENT_SYMBOLS,
+       TT_URC_PHAISTOS_DISC, TT_URC_OLD_ANATOLIAN, TT_URC_GAME_TILES): New
+       macros for OpenType 1.5.
+
+2008-11-08  Wenlin Institute  <wenlin@wenlin.com>
+
+       * src/base/ftobjs.c (ft_glyphslot_free_bitmap): Protect against
+       slot->internal == NULL.  Reported by Graham Asher.
+
+2008-11-08  Werner Lemberg  <wl@gnu.org>
+
+       * src/sfnt/sfobjs.c (tt_face_get_name): Modified to return an error
+       code so that memory allocation problems can be distinguished from
+       missing table entries.  Reported by Graham Asher.
+       (GET_NAME): New macro.
+       (sfnt_load_face): Use it.
+
+2008-11-05  Werner Lemberg  <wl@gnu.org>
+
+       * devel/ftoption.h, include/freetype/config/ftoption.h
+       [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Undefine
+       TT_CONFIG_OPTION_UNPATENTED_HINTING.  This fixes the return value of
+       `FT_Get_TrueType_Engine_Type' (and makes it work as documented).
+       Reported in bug #441638 of bugzilla.novell.com.
+
+       * docs/CHANGES: Document it.
+
+2008-11-03  Werner Lemberg  <wl@gnu.org>
+
+       * src/type1/t1load.c (parse_subrs): Use an endless loop.  There are
+       fonts (like HELVI.PFB version 003.001, used on OS/2) which define
+       some `subrs' elements more than once.  Problem reported by Peter
+       Weilbacher <mozilla@weilbacher.org>.
+
+2008-10-15  Graham Asher  <graham.asher@btinternet.com>
+
+       * src/sfnt/ttpost.c (tt_post_default_names): Add `const'.
+
+2008-10-15  David Turner  <david@freetype.org>
+
+       * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Disambiguate for
+       meddlesome compilers' warning against `for ( ...; ...; ...) ;'.
+
+2008-10-14  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffobjs.c (cff_face_init): Remove compiler warning.
+       Suggested by Bram Tassyns in Savannah patch #6651.
+
+2008-10-12  Graham Asher  <graham.asher@btinternet.com>
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): Fix computation of
+       `underline_position'.
+
+2008-10-12  Werner Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES: Updated.
+
+2008-10-09  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Fix Savannah bug #24468.
+
+       According to include/freetype/internal/ftobjs.h, the appropriate
+       type to interchange single character codepoint is FT_UInt32. It
+       should be distinguished from FT_UInt which can be 16bit integer.
+
+       * src/sfnt/ttcmap.c (tt_cmap4_char_map_linear): Change the type
+       of the second argument `pcharcode' from FT_UInt* to FT_UInt32*.
+       (tt_cmap4_char_map_binary): Ditto.
+       (tt_cmap14_get_nondef_chars): Change the type of return value
+       from FT_UInt* to FT_UInt32*.
+
+2008-10-08  John Tytgat  <John.Tytgat@esko.com>
+
+       Fix Savannah bug #24485.
+
+       * src/type1/t1load.c (parse_charstrings): Assure that we always have
+       a .notdef glyph.
+
+2008-10-05  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftmac.c: Include FT_TRUETYPE_TAGS_H for multi build.
+       * builds/mac/ftmac.c: Ditto.
+
+2008-10-05  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * include/freetype/tttags.h (TTAG_TYP1, TTAG_typ1): Fix definitions.
+       * src/base/ftobjs.c: Include FT_TRUETYPE_TAGS_H.
+
+2008-10-05  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/sfnt/sfobjs.c (sfnt_open_font): Allow `typ1' version tag in
+       the beginning of sfnt container.
+       * src/sfnt/ttload.c (check_table_dir): Return
+       `SFNT_Err_Table_Missing' when sfnt table directory structure is
+       correct but essential tables for TrueType fonts (`head', `bhed' or
+       `SING') are missing.  Other errors are returned by
+       SFNT_Err_Unknown_File_Format.
+
+       * src/base/ftobjs.c (FT_Open_Face): When TrueType driver returns
+       `FT_Err_Table_Missing', try `open_face_PS_from_sfnt_stream'.  It is
+       enabled only when old mac font support is configured.
+
+2008-10-04  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * include/freetype/tttags.h (TTAG_CID, TTAG_FOND, TTAG_LWFN,
+       TTAG_POST, TTAG_sfnt, TTAG_TYP1, TTAG_typ1): New tags to simplify
+       the repeated calculations of these values in ftobjs.c and ftmac.c.
+       * src/base/ftobjs.c: Replace all FT_MAKE_TAG by new tags.
+       * src/base/ftmac.c: Ditto.
+       * builds/mac/ftmac.c: Ditto.
+
+2008-10-04  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftobjs.c (ft_lookup_PS_in_sfnt_stream): Remove wrong
+       initialization of *is_sfnt_cid.
+
+2008-10-04  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Remove compiler
+       warnings.
+
+2008-10-04  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftobjs.c (ft_lookup_PS_in_sfnt): Replaced by...
+       (ft_lookup_PS_in_sfnt_stream): This.
+       (open_face_PS_from_sfnt_stream): New function.  It checks whether
+       the stream is sfnt-wrapped Type1 PS font or sfnt-wrapped CID-keyed
+       font, then try to open a face for given face_index.
+       (Mac_Read_sfnt_Resource): Replace the combination of
+       `ft_lookup_PS_in_sfnt' and `open_face_from_buffer' by
+       `open_face_PS_from_sfnt_stream'.
+       * src/base/ftmac.c (FT_New_Face_From_SFNT): Ditto.
+       * builds/mac/ftmac.c (FT_New_Face_From_SFNT): Ditto.
+       * src/base/ftbase.h: Remove `ft_lookup_PS_in_sfnt' and add
+       `open_face_PS_from_sfnt_stream'.
+
+2008-10-03  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftobjs.c (ft_lookup_PS_in_sfnt): Set *is_sfnt_cid to
+       FALSE if neither `CID ' nor `TYP1' is found in the sfnt container.
+
+2008-10-03  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * include/freetype/config/ftconfig.h: Define FT_MACINTOSH when SC or
+       MrC compiler of MPW is used.  These compilers do not define the
+       macro __APPLE__ by themselves.
+       * builds/unix/ftconfig.in: Ditto.
+       * builds/vms/ftconfig.h: Ditto.
+       * src/base/ftbase.c: Use FT_MACINTOSH instead of __APPLE__, to
+       include ftmac.c if FreeType 2 is built by MPW.
+       * src/base/ftobjs.c: Use FT_MACINTOSH instead of __APPLE__, to
+       enable shared functions for ftmac.c if FreeType 2 is built by MPW.
+
+       * builds/mac/ftmac.c: Include ftbase.h.
+       (memory_stream_close): Removed.
+       (new_memory_stream): Ditto.
+       (open_face_from_buffer): Removed.  Use the implementation in
+       ftobjs.c.
+       (ft_lookup_PS_in_sfnt): Ditto.
+
+       * builds/mac/FreeType.m68k_far.make.txt: Build ftmac.c as an
+       included part of ftbase.c, to share the functions in ftobjs.c.  The
+       rule compiling ftmac.c separately is removed and the rule copying
+       ftbase.c from src/base/ftbase.c to builds/mac/ftbase.c is added.
+       * builds/mac/FreeType.m68k_cfm.make.txt: Ditto.
+       * builds/mac/FreeType.ppc_classic.make.txt: Ditto.
+       * builds/mac/FreeType.ppc_carbon.make.txt: Ditto.
+
+2008-10-02  Bram Tassyns  <bramt@enfocus.be>
+
+       * src/cff/cffgload.c (cff_slot_load): Map CID 0 to GID 0.  This
+       fixes Savannah bug #24430.
+
+2008-10-02  Werner Lemberg  <wl@gnu.org>
+
+       * builds/freetype.mk (BASE_H): Rename to...
+       (INTERNAL_H): This.
+       (FREETYPE_H): Updated.
+       * src/base/rules.mk: (BASE_OBJ_S, OBJ_DIR/%.$O): Add BASE_H.
+       * src/bdf/rules.mk (BDF_DRV_H): Add bdferror.h.
+       * src/cache/rules.mk (CACHE_DRV_H): Add ftccache.h and ftcsbits.h.
+       * src/pcf/rules.mk (PCF_DRV_H): Add pcfread.h.
+       * src/raster/rules.mk (RASTER_DRV_H): Add ftmisc.h.
+       * src/type42/rules.mk (T42_DRV_H): Add t42types.h.
+
+2008-10-02  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftbase.h: New file to declare the private utility
+       functions shared by the sources of base modules.  Currently,
+       `ft_lookup_PS_in_sfnt' and `open_face_from_buffer' are declared to
+       share between ftobjs.c and ftmac.c.
+
+       * src/base/rule.mk: Add ftbase.h.
+
+       * src/base/ftobjs.c: Include ftbase.h.
+       (memory_stream_close): Build on any platform when old MacOS font
+       support is enabled.
+       (new_memory_stream): Ditto.
+       (open_face_from_buffer): Build on any platform when old MacOS font
+       support is enabled.  The counting of the face in a font file is
+       slightly different between Carbon-dependent parser and Carbon-free
+       parser.  They are merged with the platform-specific conditional.
+       (ft_lookup_PS_in_sfnt): Ditto.
+
+       * src/base/ftmac.c: Include ftbase.h.
+       (memory_stream_close): Removed.
+       (new_memory_stream): Ditto.
+       (open_face_from_buffer): Removed.  Use the implementation in
+       ftobjs.c.
+       (ft_lookup_PS_in_sfnt): Ditto.
+
+2008-10-02  Werner Lemberg  <wl@gnu.org>
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): `psnames_error' is only needed
+       if TT_CONFIG_OPTION_POSTSCRIPT_NAMES is defined.
+
+2008-10-01  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttobjs.c (tt_face_done), src/cff/cffobjs.c
+       (cff_face_done), src/pfr/pfrobjs.c (pfr_face_done),
+       src/pcf/pcfdrivr.c (PCF_Face_Done), src/cid/cidobjs.c
+       (cid_face_done), src/bdf/bdfdrivr. (BDF_Face_Done),
+       src/sfnt/sfobjs.c (sfnt_face_done): Protect against face == 0.
+       Reported by Graham Asher.
+
+2008-09-30  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/rules.mk: Add conditional source to BASE_SRC, for `make
+       multi' on Mac OS X.  If the macro $(ftmac_c) is defined,
+       $(BASE_DIR)/$(ftmac_c) is added to BASE_SRC.  In a normal build, the
+       lack of ftmac.c in BASE_SRC is not serious because ftbase.c includes
+       ftmac.c.
+       * builds/unix/unix-def.in: Add a macro definition of $(ftmac_c).
+       * builds/unix/configure.raw: Add procedure to set up appropriate
+       value of $(ftmac_c) with the consideration of the availability of
+       Carbon framework.
+
+2008-09-30  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/Jamfile: Add target for multi build by jam on Mac OS X.
+       * src/base/ftobjs.c (FT_New_Face): Fix the condition to include this
+       function for MPW building.  It is synchronized the condition to
+       include ftmac.c source into ftbase.c.
+
+2008-09-22  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffgload.c (CFF_Operator, cff_argument_counts,
+       cff_decoder_parse_charstrings): Handle (invalid)
+       `callothersubr' and `pop' instructions.
+
+2008-09-22  John Tytgat  <John.Tytgat@esko.com>
+
+       Fix Savannah bug #24307.
+
+       * include/freetype/internal/t1types.h (CID_FaceRec),
+       src/type42/t42types.h (T42_FaceRec): Comment out `afm_data'.
+
+2008-09-21  Werner Lemberg  <wl@gnu.org>
+
+       * src/smooth/ftgrays.c (gray_raster_render): Don't dereference
+       `target_map' if FT_RASTER_FLAG_DIRECT is set.  Problem reported by
+       Stephan T. Lavavej <stl@nuwen.net>.
+
+2008-09-21  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/otvalid/Jamfile: Add missing target `otvmath' for multi build
+       by jam.
+       * src/sfnt/Jamfile: Add missing target `ttmtx' for multi build by
+       jam.
+
+2008-09-20  Werner Lemberg  <wl@gnu.org>
+
+       * src/smooth/ftgrays.c (gray_find_cell): Fix threshold.  The values
+       passed to this function are already `normalized'.  Problem reported
+       by Stephan T. Lavavej <stl@nuwen.net>.
+
+       * docs/CHANGES: Document it.
+
+2008-09-20  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftoutln.c: Include FT_INTERNAL_DEBUG_H.
+       (FT_Outline_Decompose): Decorate with tracing messages.
+
+       * src/smooth/ftgrays.c [DEBUG_GRAYS]: Replace with
+       FT_DEBUG_LEVEL_TRACE.
+       [_STANDALONE_ && FT_DEBUG_LEVEL_TRACE]: Include stdio.h and
+       stdarg.h.
+
+       (FT_TRACE) [_STANDALONE_]: Remove.
+       (FT_Message) [_STANDALONE_ && FT_DEBUG_LEVEL_TRACE]: New function.
+       (FT_TRACE5, FT_TRACE7) [_STANDALONE_]: New macros.
+       (FT_ERROR) [_STANDALONE_]: Updated.
+
+       (gray_hline) [FT_DEBUG_LEVEL_TRACE]: Fix condition.
+       Use FT_TRACE7.
+       (gray_dump_cells): Make it `static void'.
+       (gray_convert_glyph): Use FT_TRACE7.
+
+       (FT_Outline_Decompose) [_STANDALONE_]: Synchronize with version in
+       ftoutln.c.
+
+       * src/base/ftadvanc.c (FT_Get_Advance, FT_Get_Advances): Use
+       FT_ERROR_BASE.
+
+       * docs/formats.txt: Updated.
+
+2008-09-19  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftmac.c: Import sfnt-wrapped Type1 and sfnt-wrapped
+       CID-keyed font support.
+       * builds/mac/ftmac.c: Ditto.
+
+2008-09-19  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Fix double free bug in
+       sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font support code.
+       `open_face_from_buffer' frees the passed buffer if it cannot open a
+       face from the buffer, so the caller must not free it.
+
+2008-09-19  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Add initial support
+       for sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font.
+       (ft_lookup_PS_in_sfnt): New function to look up `TYP1' or `CID '
+       table in sfnt table directory.  It is used before loading TrueType
+       font driver.
+
+       * docs/CHANGES: Add note about the current status of sfnt-wrapped
+       Type1 and sfnt-wrapped CID-keyed font support.
+
+2008-09-18  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftsystem.c (FT_Done_Memory): Use ft_sfree directly for
+       orthogonality (ft_free and ft_sfree could belong to different memory
+       pools).  This fixes Savannah bug #24297.
+
+2008-09-18  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/cff/cffobjs.c (cff_face_init): Use TTAG_OTTO defined
+       in ttags.h instead of numerical value 0x4F54544FL.
+
+2008-09-16  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffgload.h, src/cff/cffgload.c
+       (cff_decoder_set_width_only): Eliminate function call.
+
+2008-09-15  George Williams  <gww@silcom.com>
+
+       Fix Savannah bug #24179, reported by Bram Tassyns.
+
+       * src/type1/t1load.c (mm_axis_unmap, T1_Get_MM_Var): Fix computation
+       of default values.
+
+2008-09-15  Werner Lemberg  <wl@gnu.org>
+
+       * src/tools/glnames.py (main): Surround `ft_get_adobe_glyph_index'
+       and `ft_adobe_glyph_list' with FT_CONFIG_OPTION_ADOBE_GLYPH_LIST to
+       prevent unconditional definition.  This fixes Savannah bug #24241.
+
+       * src/psnames/pstables.h: Regenerated.
+
+2008-09-13  Werner Lemberg  <wl@gnu.org>
+
+       * autogen.sh, builds/unix/configure.raw,
+       include/freetype/config/ftconfig.h, builds/unix/ftconfig.in: Minor
+       beautifying.
+
+       * include/freetype/ftadvanc.h, include/freetype/ftgasp.h,
+       include/freetype/ftlcdfil.h: Protect against FreeType 1.
+       Some other minor fixes.
+
+       * devel/ftoption.h: Synchronize with
+       include/freetype/config/ftoption.h.
+
+2008-09-11  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftbase.c: Include ftadvanc.c.
+
+2008-09-11  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/ftconfig.in: Duplicate the cpp computation of
+       FT_SIZEOF_{INT|LONG} from include/freetype/config/ftconfig.h.
+       (FT_USE_AUTOCONF_SIZEOF_TYPES): New macro.  If defined, the cpp
+       computation is disabled and the statically configured sizes are
+       used.  This fixes Savannah bug #21250.
+
+       * builds/unix/configure.raw: Add the checks to compare the cpp
+       computation results of the bit length of int and long versus the
+       sizes detected by running `configure'.  If the results are
+       different, FT_USE_AUTOCONF_SIZEOF_TYPES is defined to prioritize the
+       results.
+       New option --{enable|disable}-biarch-config is added to define or
+       undefine FT_USE_AUTOCONF_SIZEOF_TYPES manually.
+
+2008-09-05  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/configure.raw: Clear FT2_EXTRA_LIBS when Carbon or
+       ApplicationService framework is missing.  Although this value is not
+       used in building of FreeType2, it is written in `freetype2.pc' and
+       `freetype-config'.
+
+2008-09-01  david turner  <david@freetype.org>
+
+       * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Accept a negative cmap
+       index to mean `use default cached FT_Face's charmap'.  This fixes
+       Savannah bug #22625.
+       * include/freetype/ftcache.h: Document it.
+
+
+       Make FT_MulFix an inlined function.  This is done to speed up
+       FreeType a little (on x86 3% when loading+hinting, 10% when
+       rendering, ARM savings are more important though).  Disable this by
+       undefining FT_CONFIG_OPTION_INLINE_MULFIX.
+
+       Use of assembler code can now be controlled with
+       FT_CONFIG_OPTION_NO_ASSEMBLER.
+
+       * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in
+       [!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MulFix_arm): New assembler
+       implementation.
+       [!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MulFix_i386): Assembler
+       implementation taken from `ftcalc.c'.
+       [!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MULFIX_ASSEMBLER): New macro
+       which is defined to the platform-specific assembler implementation
+       of FT_MulFix.
+       [FT_CONFIG_OPTION_INLINE_MULFIX && FT_MULFIX_ASSEMBLER]
+       (FT_MULFIX_INLINED): New macro.
+
+       * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_NO_ASSEMBLER,
+       FT_CONFIG_OPTION_INLINE_MULFIX): New macros.
+
+       * include/freetype/freetype.h: Updated to handle FT_MULFIX_INLINED.
+
+       * src/base/ftcalc.c: Updated to use FT_MULFIX_ASSEMBLER and
+       FT_MULFIX_INLINED.
+
+
+       Add a new header named FT_ADVANCES_H declaring some new APIs to
+       extract the advances of one or more glyphs without necessarily
+       loading their outlines.  Also provide `fast loaders' for the
+       TrueType, Type1, and CFF font drivers (more to come later).
+
+       * src/base/ftadvanc.c, include/freetype/ftadvanc.h: New files.
+
+       * include/freetype/config/ftheader.h (FT_ADVANCES_H): New macro.
+       * include/freetype/freetype.h (FT_LOAD_ADVANCE_ONLY): New macro.
+
+       * include/freetype/internal/ftdriver.h (FT_Face_GetAdvancesFunc):
+       `flags' and `advances' are now of type `FT_UInt' and `FT_Fixed',
+       respectively.
+
+       * src/base/Jamfile (_sources), src/base/rules.mk (BASE_SRC): Add
+       ftadvanc.c.
+
+       * src/cff/cffdrivr.c (cff_get_advances): New function.
+       (cff_driver_class): Register it.
+
+       * src/cff/cffgload.c (cff_decoder_set_width_only): New function.
+       (cff_decoder_parse_charstrings): Handle `width_only'.
+       (cff_slot_load): Handle FT_LOAD_ADVANCE_ONLY.
+
+       * src/cff/cffgload.h (cff_decoder): New element `width_only'.
+       (cff_decoder_set_width_only): New declaration.
+
+       * src/truetype/ttdriver.c (tt_get_advances): New function.
+       (tt_driver_class): Register it.
+
+       * src/truetype/ttgload.c (Get_HMetrics, Get_VMetrics): Renamed to...
+       (TT_Get_HMetrics, TT_Get_VMetrics): This.
+       Update callers.
+       * src/truetype/ttgload.h: Declare them.
+
+       * src/type1/t1gload.h, src/type1/t1gload.c (T1_Get_Advances): New
+       function.
+       * src/type1/t1driver.c (t1_driver_class): Register T1_Get_Advances.
+
+
+       Add checks for minimum version of the `autotools' stuff.
+
+       * autogen.sh: Implement it.
+       (get_major_version, get_minor_version, get_patch_version,
+       compare_to_minimum_version, check_tool_version): New auxiliary
+       functions.
+
+       * README.CVS: Document it.
+
+2008-08-29  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/sfnt/sfobjs.c (sfnt_open_font): Use TTAG_OTTO defined in
+       ttags.h instead of FT_MAKE_TAG( 'O', 'T', 'T', 'O' ).
+
+2008-08-28  Werner Lemberg  <wl@gnu.org>
+
+       * src/type1/t1load.c (parse_encoding): Protect against infinite
+       loop.  This fixes Savannah bug #24150 (where a patch has been posted
+       too).
+
+2008-08-23  Werner Lemberg  <wl@gnu.org>
+
+       * src/type/t1afm.c (compare_kern_pairs), src/pxaux/afmparse.c
+       (afm_compare_kern_pairs): Fix comparison.  This fixes Savannah bug
+       #24119.
+
+2008-08-19  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftobjs.c (FT_Stream_New): Initialize *astream always,
+       even if passed library or arguments are invalid.  This fixes a bug
+       that an uninitialized stream is freed when an invalid library handle
+       is passed.  Originally proposed by Mike Fabian, 2008/08/18 on
+       freetype-devel.
+       (FT_Open_Face): Ditto (stream).
+       (load_face_in_embedded_rfork): Ditto (stream2).
+
+2008-08-18  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftmac.c: Add a fallback to guess the availability of the
+       `ResourceIndex' type.  It is used when built without configure
+       (e.g., a build with Jam).
+       * builds/mac/ftmac.c: Ditto.
+       * builds/unix/configure.raw: Set HAVE_TYPE_RESOURCE_INDEX to 1 or 0
+       explicitly, even if `ResourceIndex' is unavailable.
+
+2008-08-18  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/configure.raw: In checking of Mac OS X features,
+       all-in-one header file `Carbon.h' is replaced by the minimum
+       header file `CoreServices.h', similar to current src/base/ftmac.c.
+
+2008-08-18  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/sfnt/ttcmap.c (tt_cmap2_validate): Skip the validation of
+       sub-header when its code_count is 0.  Many Japanese Dynalab fonts
+       include such an empty sub-header (code_count == 0, first_code == 0
+       delta == 0, but offset != 0) as the second sub-header in SJIS cmap.
+
+2008-08-04  Werner Lemberg  <wl@gnu.org>
+
+       * src/type1/t1tokens.h: Handle `ForceBold' keyword.  This fixes
+       Savannah bug #23995.
+
+       * src/cid/cidload.c (parse_expansion_factor): New callback function.
+       (cid_field_records): Use it for `ExpansionFactor'.
+       * src/cod/cidtoken.h: Handle `ForceBold' keyword.
+       Don't handle `ExpansionFactor'.
+
+2008-08-04  Bram Tassyns  <bramt@enfocus.be>
+
+       * src/cff/cffparse.c (cff_parse_fixed_scaled): Fix thinko which
+       resulted in incorrect scaling.  This fixes Savannah bug #23973.
+
+2008-08-04  Werner Lemberg  <wl@gnu.org>
+
+       Be more tolerant w.r.t. invalid entries in SFNT table directory.
+
+       * src/sfnt/ttload.c (check_table_dir): Ignore invalid entries and
+       adjust table count.
+       Add more trace messages.
+       (tt_face_load_font_dir): Updated.
+
+2008-07-30  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffgload.c (cff_decoder_parse_charstrings): No longer
+       assume that the first argument on the stack is the bottom-most
+       element.  Two reasons:
+
+         o According to people from Adobe it is missing in the Type 2
+           specification that pushing of additional, superfluous arguments
+           on the stack is prohibited.
+
+         o Acroread in general handles fonts differently, namely by popping
+           the number of arguments needed for a particular operand (as a PS
+           interpreter would do).  In case of buggy fonts this causes a
+           different interpretation which of the elements on the stack are
+           superfluous and which not.
+
+       Since there are CFF subfonts (embedded in PDFs) which rely on
+       Acroread's behaviour, FreeType now does the same.
+
+2008-07-27  Werner Lemberg  <wl@gnu.org>
+
+       Add extra mappings for `Tcommaaccent' and `tcommaaccent'.  This
+       fixes Savannah bug #23940.
+
+       * src/psnames/psmodule.c (WGL_EXTRA_LIST_SIZE): Rename to...
+       (EXTRA_GLYPH_LIST_SIZE): This.
+       Increase by 2.
+       (ft_wgl_extra_unicodes): Rename to...
+       (ft_extra_glyph_unicodes): This.
+       Add two code values.
+       (ft_wgl_extra_glyph_names): Rename to...
+       (ft_extra_glyph_names): This.
+       Add two glyphs.
+       (ft_wgl_extra_glyph_name_offsets): Rename to...
+       (ft_extra_glyph_name_offsets): This.
+       Add two offsets.
+
+       (ps_check_wgl_name, ps_check_wgl_unicode): Rename to...
+       (ps_check_extra_glyph_name, ps_check_extra_glyph_unicode): This.
+       Updated.
+       (ps_unicodes_init): Updated.
+
+2008-07-26  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffgload.c (cff_decoder_prepare,
+       cff_decoder_parse_charstrings): Improve debug output.
+
+2008-07-22  Martin McBride  <mmcbride@emtex.com>
+
+       * src/sfnt/ttcmap.c (tt_cmap4_validate, tt_cmap4_char_map_linear,
+       tt_cmap4_char_map_binary): Handle fonts which treat the last segment
+       specially.  According to the specification, such fonts would be
+       invalid but acroread accepts them.
+
+2008-07-16  Jon Foster  <Jon.Foster@cabot.co.uk>
+
+       * src/pfr/pfrdrivr.c (pfr_get_advance): Fix off-by-one error.
+
+       * src/base/ftcalc.c (FT_MulFix): Fix portability issue.
+
+       * src/sfnt/ttpost.c (MAC_NAME) [!FT_CONFIG_OPTION_POSTSCRIPT_NAMES]:
+       Fix compiler warning.
+
+2008-07-16  Werner Lemberg  <wl@gnu.org>
+
+       Handle CID-keyed fonts wrapped in an SFNT (with cmaps) correctly.
+
+       * src/cff/cffload.c (cff_font_load): Pass `pure_cff'.
+       Invert sids table only if `pure_cff' is set.
+       * src/cff/cffload.h: Udpated.
+
+       * src/cff/cffobjs.c (cff_face_init): Updated.
+       Set FT_FACE_FLAG_CID_KEYED only if pure_cff is set.
+
+       * docs/CHANGES: Updated.
+
+2008-07-09  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttpload.c (tt_face_load_loca): Handle buggy fonts
+       where num_locations < num_glyphs.  Problem reported by Ding Li.
+
+2008-07-05  Werner Lemberg  <wl@gnu.org>
+
+       Since FreeType uses `$(value ...)', we now need GNU make 3.80 or
+       newer.  This fixes Savannah bug #23648.
+
+       * configure: zsh doesn't like ${1+"$@"}.
+       Update needed GNU make version.
+       * builds/toplevel.mk: Check for `$(eval ...)'.
+       * docs/INSTALL.GNU, docs/INSTALL.CROSS, docs/INSTALL.UNIX: Document
+       it.
+
+2008-07-04  Werner Lemberg  <wl@gnu.org>
+
+       * src/raster/ftraster.c (Draw_Sweep): If span is smaller than one
+       pixel, only check for dropouts if neither start nor end point lies
+       on a pixel center.  This fixes Savannah bug #23762.
+
+2008-06-29  Werner Lemberg  <wl@gnu.org>
+
+       * Version 2.3.7 released.
+       =========================
+
+
+       Tag sources with `VER-2-3-7'.
+
+       * docs/CHANGES, docs/VERSION.DLL: Update documentation and bump
+       version number to 2.3.7.
+
+       * README, Jamfile (RefDoc), builds/win32/visualc/index.html,
+       builds/win32/visualc/freetype.dsp,
+       builds/win32/visualc/freetype.vcproj,
+       builds/win32/visualce/index.html,
+       builds/win32/visualce/freetype.dsp,
+       builds/win32/visualce/freetype.vcproj: s/2.3.6/2.3.7/, s/236/237/.
+
+       * include/freetype/freetype.h (FREETYPE_PATCH): Set to 7.
+
+       * builds/unix/configure.raw (version_info): Set to 9:18:3.
+
+       * docs/release: Updated.
+
+2008-06-28  Werner Lemberg  <wl@gnu.org>
+
+       * src/ftglyph.c (FT_Matrix_Multiply, FT_Matrix_Invert): Move to...
+       * src/ftcalc.c: Here.  This fixes Savannah bug #23729.
+
+2008-06-27  Werner Lemberg  <wl@gnu.org>
+
+       * src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
+       Horizontal_Gray_Sweep_Drop): Test for intersections which
+       degenerate to a single point can be ignored; this has been confirmed
+       by Greg Hitchcock from Microsoft.  (This was commented out code.)
+
+2008-06-26  Werner Lemberg  <wl@gnu.org>
+
+       Improve navigation in API reference.
+
+       * src/tools/docmaker/tohtml.py (html_header_3): Renamed to...
+       (html_header_6): This.
+       (html_header_3, html_header_3i, html_header_4, html_header_5,
+       html_header_5t): New strings.
+       (toc_footer_start, toc_footer_end): New strings.
+       (HtmlFormatter::html_header): Updated.
+       (HtmlFormatter::html_index_header, HtmlFormatter::html_toc_header):
+       New strings.
+       (HtmlFormatter::index_enter): Use `html_index_header'.
+       (HtmlFormatter::index_exit): Print `html_footer'.
+       (HtmlFormatter::toc_enter): Use `html_toc_header'.
+       (HtmlFormatter::toc_exit): Print proper footer.
+
+       Convert ~ to non-breakable space.
+
+       * src/tools/docmaker/tohtml.py (make_html_para): Implement it.
+       Update header files accordingly.
+
+2008-06-24  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/configure.raw: Check type `ResourceIndex' explicitly
+       and define HAVE_TYPE_RESOURCE_INDEX if it is defined.  Mac OS X 10.5
+       bundles 10.4u SDK with MAC_OS_X_VERSION_10_5 macro but without
+       ResourceIndex type definition.  The macro does not inform the type
+       availability.
+       * src/base/ftmac.c: More parentheses are inserted to clarify the
+       conditionals to disable legacy APIs in `10.5 and later' cases.  If
+       HAVE_TYPE_RESOURCE_INDEX is not defined, ResourceIndex is defined.
+
+2008-06-24  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttinterp.c (Ins_SCANTYPE): Don't check rendering
+       mode.
+
+       * src/raster/ftraster.c (Render_Glyph, Render_Gray_Glyph,
+       Draw_Sweep): No-dropout mode is value 2, not value 0.
+       (Draw_Sweep): Really skip dropout handling for no-dropout mode.
+
+2008-06-24  Werner Lemberg  <wl@gnu.org>
+
+       * src/psaux/psobjs.c (t1_builder_close_contour): Don't add contour
+       if it consists of one point only.  Based on a patch from Savannah
+       bug #23683 (from John Tytgat).
+
+2008-06-22  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttgload.c (TT_Load_Glyph): Protect bytecode stuff
+       with IS_HINTED.
+
+       * docs/CHANGES: Updated.
+
+2008-06-22  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/configure.raw: If CFLAGS has `-isysroot XXX' option
+       but LDFLAGS does not, import it to LDFLAGS.  The option is used to
+       specify non-default SDK on Mac OS X (e.g., universal binary SDK for
+       Mac OS X 10.4 on PowerPC platform).  Although Apple TechNote 2137
+       recommends to add the option only to CFLAGS, LDFLAGS should include
+       it because libfreetype.la is built with -no-undefined.  This fixes a
+       bug reported by Ryan Schmidt in MacPorts,
+       http://trac.macports.org/ticket/15331.
+
+2008-06-21  Werner Lemberg  <wl@gnu.org>
+
+       Enable access to the various dropout rules of the B&W rasterizer.
+       Pass dropout rules from the TT bytecode interpreter to the
+       rasterizer.
+
+       * include/freetype/ftimage.h (FT_OUTLINE_SMART_DROPOUTS,
+       FT_OUTLINE_EXCLUDE_STUBS): New flags for for FT_Outline.
+
+       * src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
+       Horizontal_Gray_Sweep_Drop): Use same mode numbers as given in the
+       OpenType specification.
+       Fix mode 4 computation.
+       (Render_Glyph, Render_Gray_Glyph): Handle new outline flags.
+
+       * src/truetype/ttgload.c (TT_Load_Glyph) Convert scan conversion
+       mode to FT_OUTLINE_XXX flags.
+
+       * src/truetype/ttinterp.c (Ins_SCANCTRL): Enable ppem check.
+
+2008-06-19  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffobjs.c (cff_face_init): Compute final
+       `dict->units_per_em' value before assigning it to
+       `cffface->units_per_EM'.  Otherwise, CFFs without subfonts are
+       scaled incorrectly if the font matrix is non-standard.  This fixes
+       Savannah bug #23630.
+
+       * docs/CHANGES: Updated.
+
+2008-06-19  Werner Lemberg  <wl@gnu.org>
+
+       * src/type/t1objs.c (T1_Face_Init): Slightly improve algorithm fix
+       from 2008-06-19.
+
+2008-06-18  Werner Lemberg  <wl@gnu.org>
+
+       * src/type/t1objs.c (T1_Face_Init): Fix change from 2008-03-21.
+       Reported by Peter Weilbacher <mozilla@weilbacher.org>.
+
+       * docs/CHANGES: Updated.
+
+2008-06-15  George Williams  <gww@silcom.com>
+
+       * src/otvalid/otvgpos.c (otv_MarkBasePos_validate): Set
+       `valid->extra2' to 1.  This is undocumented in the OpenType 1.5
+       specification.
+
+2008-06-15  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftcalc.c (FT_MulFix) <asm>: Protect registers correctly
+       from clobbering.  Patch from Savannah bug report #23556.
+
+       * docs/CHANGES: Document it.
+
+2008-06-10  Werner Lemberg  <wl@gnu.org>
+
+       * autogen.sh: Add option `--install' to libtoolize.
+
+2008-06-10  Werner Lemberg  <wl@gnu.org>
+
+       * Version 2.3.6 released.
+       =========================
+
+
+       Tag sources with `VER-2-3-6'.
+
+       * docs/CHANGES, docs/VERSION.DLL: Update documentation and bump
+       version number to 2.3.6.
+
+       * README, Jamfile (RefDoc), builds/win32/visualc/index.html,
+       builds/win32/visualc/freetype.dsp,
+       builds/win32/visualc/freetype.vcproj,
+       builds/win32/visualce/index.html,
+       builds/win32/visualce/freetype.dsp,
+       builds/win32/visualce/freetype.vcproj: s/2.3.5/2.3.6/, s/235/236/.
+
+       * include/freetype/freetype.h (FREETYPE_PATCH): Set to 6.
+
+       * builds/unix/configure.raw (version_info): Set to 9:17:3.
+
+
+       * include/freetype/internal/psaux.h (T1_BuilderRec): Remove `scale_x'
+       and `scale_y'.
+       * src/cff/cffgload.h (CFF_Builder): Remove `scale_x' and `scale_y'.
+
+
+       * src/cff/cffparse.c: Include FT_INTERNAL_DEBUG_H.
+       * src/cff/cffobjs.h: Include FT_INTERNAL_POSTSCRIPT_HINTS_H.
+
+2008-06-10  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftobjs.c (open_face): Check `clazz->init_face' and
+       `clazz->done_face'.
+
+2008-06-09  VaDiM  <s_sliva@rambler.ru>
+
+       Support debugging on WinCE.  From Savannah patch #6536; this fixes
+       bug #23497.
+
+       * builds/win32/ftdebug.c (OutputDebugStringEx): New function/macro
+       as a replacement for OutputDebugStringA (which WinCE doesn't have).
+       Update all callers.
+       (ft_debug_init) [_WIN32_CE]: WinCE apparently doesn't have
+       environment variables.
+
+2008-06-09  Werner Lemberg  <wl@gnu.org>
+
+       * README.CVS: Updated.
+
+       * builds/unix/configure.raw, builds/unix/freetype-config.in: Updated
+       for newer versions of autoconf and friends.
+
+2008-06-08  Werner Lemberg  <wl@gnu.org>
+
+       * src/type1/t1parse.h (T1_ParserRec): Make `base_len' and
+       `private_len' unsigned.
+
+       * src/type1/t1parse.c (read_pfb_tag): Make `asize' unsigned and read
+       it as such.
+       (T1_New_Parser, T1_Get_Private_Dict): Make `size' unsigned.
+
+
+       * src/base/ftstream.c (FT_Stream_Skip): Reject negative values.
+
+
+       * src/type1/t1load.c (parse_blend_design_positions): Check `n_axis'
+       for sane value.
+       Fix typo.
+
+
+       * src/psaux/psobjs.c (ps_table_add): Check `idx' correctly.
+
+
+       * src/truetype/ttinterp (Ins_SHC): Use BOUNDS() to check
+       `last_point'.
+
+
+       * src/sfnt/ttload.c (tt_face_load_max_profile): Limit
+       `maxTwilightPoints'.
+
+2008-06-06  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttinterp.c (Ins_IP): Handle case `org_dist == 0'
+       correctly.  This fixes glyphs `t' and `h' of Arial Narrow at 12ppem.
+
+2008-06-03  Werner Lemberg  <wl@gnu.org>
+
+       * include/freetype/ftcache.h (FTC_FaceID): Change type back to
+       FT_Pointer.  Reported by Ian Britten <britten@caris.com>.
+
+2008-06-02  Werner Lemberg  <wl@gnu.org>
+
+       Emit header info for defined FreeType objects in reference.
+
+       * src/tools/docmaker/content.py (re_header_macro): New regexp.
+       (ContentProcessor::__init__): Initialize new dictionary `headers'.
+       (DocBlock::__init__): Collect macro header definitions.
+
+       * src/tools/docmaker/tohtml.py (header_location_header,
+       header_location_footer): New strings.
+       (HtmlFormatter::__init__): Pass `headers' dictionary.
+       (HtmlFormatter::print_html_field): Don't emit paragraph tags.
+       (HtmlFormatter::print_html_field_list): Emit empty paragraph.
+       (HtmlFormatter::block_enter): Emit header info.
+
+2008-06-01  Werner Lemberg  <wl@gnu.org>
+
+       * include/freetype/config/ftheader.h (FT_UNPATENTED_HINTING_H,
+       FT_INCREMENTAL_H): Added.
+
+2008-05-28  Werner Lemberg  <wl@gnu.org>
+
+       * src/tools/docmaker/sources.py (SourceBlock::__init__): While
+       looking for markup tags, return immediately as soon a single one is
+       found.
+
+2008-05-28  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttinterp.c (Ins_MD): The MD instruction also uses
+       original, unscaled input values.  Confirmed by Greg Hitchcock from
+       Microsoft.
+
+2008-05-27  Werner Lemberg  <wl@gnu.org>
+
+       * src/tools/docmaker/tohtml.py (block_footer_start,
+       block_footer_middle): Beautify output.
+
+2008-05-25  Werner Lemberg  <wl@gnu.org>
+
+       * src/raster/ftraster.c (fc_black_render): Return 0 when we are
+       trying to render into a zero-width/height bitmap, not an error code.
+
+       * src/truetype/ttgload.c (load_truetype_glyph): Move initialization
+       of the graphics state for subglyphs to...
+       (TT_Hint_Glyph): This function.
+       Hinting instructions for a composite glyph apparently refer to the
+       just hinted subglyphs, not the unhinted, unscaled outline.  This
+       seems to fix Savannah bugs #20973 and (at least partially) #23310.
+
+2008-05-20  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftmac.c (FT_New_Face_From_Suitcase): Check if valid
+       `aface' is returned by FT_New_Face_From_FOND().  The patch was
+       proposed by an anonymous reporter of Savannah bug #23204.
+
+2008-05-18  Werner Lemberg  <wl@gnu.org>
+
+       * src/pshinter/pshalgo.c (ps_hints_apply): Reset scale values after
+       correction for pixel boundary.  Without this patch, the effect can
+       be cumulative under certain circumstances, making glyphs taller and
+       taller after each call.  This fixes Savannah bug #19976.
+
+2008-05-18  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftdebug.c (FT_Message, FT_Panic): Send output to stderr.
+       This fixes Savannah bug #23280.
+
+       * docs/CHANGES: Updated.
+
+2008-05-18  David Turner  <david@freetype.org>
+
+       * src/psnames/psmodule.c (ft_wgl_extra_unicodes,
+       ft_wgl_extra_glyph_names, ft_wgl_extra_glyph_name_offsets,
+       ps_check_wgl_name, ps_check_wgl_unicode): Use `static' to make
+       declarations non-global.
+
+       * src/type1/t1load.c: Add missing comment.
+
+2008-05-17  Sam Hocevar  <samh>
+
+       * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Handle zero-contour
+       glyphs correctly.  Patch from Savannah bug #23277.
+
+2008-05-16  Werner Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES: Updated.
+
+2008-05-16  Sergey Tolstov  <stolstov@esri.com>
+
+       Improve support for WGL4 encoded fonts.
+
+       * src/psnames/psmodule.c (WGL_EXTRA_LIST_SIZE): New macro.
+       (ft_wgl_extra_unicodes, ft_wgl_extra_glyph_names,
+       ft_wgl_extra_glyph_name_offsets): New arrays.
+       (ps_check_wgl_name, ps_check_wgl_unicode): New functions.
+       (ps_unicodes_init): Use them to add additional Unicode mappings.
+
+2008-05-15  Werner Lemberg  <wl@gnu.org>
+
+       * src/psaux/t1decode.c (t1_decoder_parse_charstrings)
+       <op_closepath>: `closepath' without a path is a no-op, not an error
+       (cf. the PS reference manual).
+
+       Reported by Martin McBride.
+
+2008-05-15  Werner Lemberg  <wl@gnu.org>
+
+       * builds/toplevel.mk (CONFIG_GUESS, CONFIG_SUB): Updated.
+
+2008-05-15  Werner Lemberg  <wl@gnu.org>
+
+       * src/type1/t1load.c (parse_subrs): Accept fonts with a subrs array
+       which contains a single but empty entry.  This is technically
+       invalid (since it must end with `return'), but...
+
+       Reported by Martin McBride.
+
+2008-05-14  Werner Lemberg  <wl@gnu.org>
+
+       Finish fix of scaling bug of CID-keyed CFF subfonts.
+
+       * include/freetype/internal/ftcalc.h, src/base/ftcalc.c
+       (FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled): New
+       functions.
+
+       * src/cff/cffobjs.h (CFF_Internal): New struct.  It is used to
+       provide global hinting data for both the top-font and all subfonts
+       (with proper scaling).
+
+       * src/cff/cffobjs.c (cff_make_private_dict): New function, using
+       code from `cff_size_init'.
+       (cff_size_init, cff_size_done, cff_size_select, cff_size_request):
+       Use CFF_Internal and handle subfonts.
+       (cff_face_init): Handle top-dict and subfont matrices correctly;
+       apply some heuristic in case of unlikely matrix concatenation
+       results.  This has been discussed with people from Adobe (thanks
+       goes mainly to David Lemon) who confirm that the CFF specs are fuzzy
+       and not correct.
+
+       * src/cff/cffgload.h (cff_decoder_prepare): Add `size' argument.
+
+       * src/cff/cffgload.c (cff_builder_init): Updated.
+       (cff_decoder_prepare): Handle hints globals for subfonts.
+       Update all callers.
+       (cff_slot_load): Handling scaling of subfonts properly.
+
+       * src/cff/cffparse.c (cff_parse_fixed_dynamic): New function.
+       (cff_parse_font_matrix): Use it.
+
+       * src/cff/cfftypes.h (CFF_FontDictRec): Make `units_per_em'
+       FT_ULong.
+
+       * docs/CHANGES: Document it.
+
+2008-05-13  Werner Lemberg  <wl@gnu.org>
+
+       * src/winfonts/winfnt.c (fnt_face_get_dll_font, FNT_Face_Init):
+       Handle case `face_index < 0'.
+       * docs/CHANGES: Document it.
+
+2008-05-04  Werner Lemberg  <wl@gnu.org>
+
+       First steps to fix the scaling bug of CID-keyed CFF subfonts,
+       reported by Ding Li on 2008/03/28 on freetype-devel.
+
+       * src/base/cff/cffparse.c (power_tens): New array.
+       (cff_parse_real): Rewritten to introduce a fourth parameter which
+       returns the `scaling' of the real number so that we have no
+       precision loss.  This is not used yet.
+       Update all callers.
+       (cff_parse_fixed_thousand): Replace with...
+       (cff_parse_fixed_scaled): This function.  Update all callers.
+
+2008-05-03  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftobjs.c (FT_Load_Glyph): Call the auto-hinter without
+       transformation since it recursively calls FT_Load_Glyph.  This fixes
+       Savannah bug #23143.
+
+2008-04-26  Werner Lemberg  <wl@gnu.org>
+
+       * include/freetype/internal/psaux.h (T1_BuilderRec): Mark `scale_x'
+       and `scale_y' as obsolete since they aren't used.
+       * src/psaux/psobjs.c (t1_builder_init): Updated.
+
+       * src/cff/cffgload.h (CFF_Builder): Mark `scale_x' and `scale_y' as
+       obsolete since they aren't used.
+       * src/cff/cffgload.c (cff_builder_init): Updated.
+
+2008-04-14  Werner Lemberg  <wl@gnu.org>
+
+       * src/pcf/pcfdrivr.c (PCF_Face_Init): Protect call to
+       `FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZ'.  From Savannah
+       bug #22909.
+
+2008-04-13  Werner Lemberg  <wl@gnu.org>
+
+       * src/psaux/psconv.c (PS_Conv_ToFixed): Increase precision if
+       integer part is zero.
+
+2008-04-01  Werner Lemberg  <wl@gnu.org>
+
+       Fix compilation with g++ 4.1 (with both `single' and `multi'
+       targets).
+
+       * src/base/ftobjs.c (FT_Open_Face): Don't define a variable in block
+       which is crossed by a `goto'.
+
+       * src/otvalid/otvalid.h (otv_MATH_validate): Add prototype.
+
+2008-03-31  Werner Lemberg  <wl@gnu.org>
+
+       Fix support for subsetted CID-keyed CFFs.
+
+       * include/freetype/freetype.h (FT_FACE_FLAG_CID_KEYED,
+       FT_IS_CID_KEYED): New macros.
+
+       * src/cff/cffobjs.c (cff_face_init): Set number of glyphs to the
+       maximum CID value in CID-keyed CFFs.
+       Handle FT_FACE_FLAG_CID_KEYED flag.
+
+       * docs/CHANGES: Document it.
+
+
+       Fix CFF font matrix calculation and improve precision.
+
+       * src/cff/cffparse.c (cff_parse_real): Increase precision if integer
+       part is zero.
+       (cff_parse_font_matrix): Simplify computation of `units_per_em';
+       this prevents overflow also.
+
+
+       Support FT_Get_CID_Registry_Ordering_Supplement for PS CID fonts.
+
+       * src/cid/cidriver.c: Include FT_SERVICE_CID_H.
+       (cid_get_ros): New function.
+       (cid_service_cid_info): New service structure.
+       (cid_services): Register it.
+
+2008-03-23  Werner Lemberg  <wl@gnu.org>
+
+       Adjustments for Visual C++ 8.0, as reported by Rainer Deyke.
+
+       * builds/compiler/visualc.mk (CFLAGS): Remove /W5.
+       (ANSIFLAGS): Add _CRT_SECURE_NO_DEPRECATE.
+
+2008-03-21  Laurence Darby  <ldarby>
+
+       * src/type1/t1objs.c (T1_Face_Init): Use `/Weight'.  Patch from
+       Savannah bug #22675.
+
+2008-03-13  Derek Clegg  <dclegg@apple.com>
+
+       * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix named style loop.
+       Patch from Savannah bug #22541.
+
+2008-03-03  Masatoshi Kimura  <VYV03354@nifty.ne.jp>
+
+       * src/sfnt/ttcmap.c (tt_cmap14_char_map_nondef_binary,
+       tt_cmap14_find_variant): Return correct value.
+       (tt_cmap14_variant_chars): Fix check for `di'.
+
+2008-02-29  Wermer Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES: Updated.
+
+2008-02-29  Wolf
+
+       Add build support for symbian platform.  From Savannah bug #22440.
+
+       * builds/symbian/*: New files.
+
+2008-02-21  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftmac.c (parse_fond): Fix a bug of PostScript font name
+       synthesis.  For any face of a specified FOND, always the name for
+       the first face was used.  Except of a FOND that refers multiple
+       Type1 font files, wrong synthesized font names are not used at all,
+       so this is an invisible bug.  A few limit checks are added too.
+
+       * builds/mac/ftmac.c: Ditto.
+
+2008-02-21  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/configure.raw: Split compiler option to link Carbon
+       frameworks to one option for CoreServices framework and another
+       option for ApplicationServices framework.  The split options can be
+       managed by GNU libtool to avoid unrequired duplication when FreeType
+       is linked with other applications.  Suggested by Daniel Macks,
+       Savannah bug #22366.
+
+2008-02-18  Victor Stinner  <victor.stinner@haypocalc.com>
+
+       * src/truetype/ttinterp.c (Ins_IUP): Check number of points.  Fix
+       from Savannah bug #22356.
+
+2008-02-17  Jonathan Blow  <jon@number-none.com>
+
+       * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
+       Check for valid callback pointers.
+
+2008-02-15  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftmac.c (FT_New_Face_From_SFNT): Check the sfnt resource
+       handle by its value instead of ResError(), fix provided by Deron
+       Kazmaier.  According to the Resource Manager Reference,
+       GetResource(), Get1Resource(), GetNamedResource(),
+       Get1NamedResource() and RGetResource() set noErr but return NULL
+       handle when they can not find the requested resource.  These
+       functions never return undefined values, so it is sufficient to
+       check if the handle is not NULL.
+
+       * builds/mac/ftmac.c (FT_New_Face_From_SFNT): Ditto.
+
+2008-02-14  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftbase.c: <ftmac.c> is replaced by "ftmac.c" as other
+       inclusion styles.  Now it always includes src/base/ftmac.c;
+       builds/mac/ftmac.c is never included in any configuration.
+
+       * builds/unix/configure.raw: Print warning if configure is executed
+       with options to specify Carbon functionalities explicitly.
+
+       * docs/INSTALL.MAC: Note that legacy builds/mac/ftmac.c is not
+       included automatically and manual replacement is required.
+
+2008-02-11  Werner Lemberg  <wl@gnu.org>
+
+       * builds/modules.mk (CLOSE_MODULE, REMOVE_MODULE), builds/detect.mk
+       (dos_setup), builds/freetype.mk (clean_project_dos,
+       distclean_project_dos): Don't use \ but $(SEP).  Reported by Duncan
+       Murdoch.
+
+2008-01-18  Sylvain Pasche  <sylvain.pasche@gmail.com>
+
+       * src/base/ftlcdfil.c (_ft_lcd_filter_legacy): Updated comment to
+       mention intra-pixel algorithm.
+
+       * include/freetype/freetype.h (FT_Render_Mode): Mention that
+       FT_Library_SetLcdFilter can be used to reduce fringes.
+
+2008-01-16  Werner Lemberg  <wl@gnu.org>
+
+       * src/raster/ftraster.c (ft_black_render): Check `outline' before
+       using it.  Reported by Allan Yang.
+
+2008-01-12  Werner Lemberg  <wl@gnu.org>
+
+       * src/raster/ftraster.c (FT_CONFIG_OPTION_5_GRAY_LEVELS): Remove.
+
+2008-01-12  Allan Yang, Jian Hua - SH  <Allan.Yang@fmc.fujitsu.com>
+
+       * src/raster/ftraster.c (ft_black_init)
+       [FT_RASTER_OPTION_ANTI_ALIASING]: Fix compilation.
+
+2008-01-10  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttgload.c (load_truetype_glyph): Handle the case
+       where the number of contours in a simple glyph is zero (and which
+       does contain an entry in the `glyf' table).  This fixes Savannah bug
+       #21990.
+
+2008-01-04  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Formatting suggested by Sean McBride.
+
+       * builds/mac/ftmac.c: Formatting (tab expanded).
+       * src/autofit/afindic.c: Ditto.
+       * src/base/ftcid.c: Ditto.
+       * src/base/ftmac.c: Ditto.
+
+2007-12-30  Werner Lemberg  <wl@gnu.org>
+
+       * src/smooth/ftgrays.c (gray_raster_render): Check `outline'
+       correctly.
+
+2007-12-21  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Improvement of POSIX resource-fork accessor to load unsorted
+       references in a resource.  In HelveLTMM (resource-fork PostScript
+       Type1 font bundled with Mac OS X since 10.3.x), the appearance order
+       of PFB chunks is not sorted; sorting the chunks by reference IDs is
+       required.
+
+       * include/freetype/internal/ftrfork.h (FT_RFork_Ref): New structure
+       type to store a pair of reference ID and offset to the chunk.
+
+       * src/base/ftrfork.c (ft_raccess_sort_ref_by_id): New function to
+       sort FT_RFork_Ref by their reference IDs.
+
+       (FT_Raccess_Get_DataOffsets): Returns an array of offsets that is
+       sorted by reference ID.
+
+2007-12-14  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffparse.c (cff_parse_real): Don't apply `power_ten'
+       division too early; otherwise the most significant digit(s) of the
+       final result are lost as the value is truncated to an integer.  This
+       fixes Savannah bug #21794 (where the patch has been posted too).
+
+2007-12-06  Fix  <4d876b82@gmail.com>
+
+       Pass options from one configure script to another as-is (not
+       expanded).  This is needed for options like
+       --includedir='${prefix}/include'.
+
+       * builds/unix/detect.mk, configure: Prevent argument expansion in
+       call to the (real) `configure' script.
+
+2007-12-06  Werner Lemberg  <wl@gnu.org>
+
+       * src/truetype/ttgload.c (load_truetype_glyph): Fix compilation if
+       TT_USE_BYTECODE_INTERPRETER isn't defined.
+
+2007-12-06  Werner Lemberg  <wl@gnu.org>
+
+       There exist CFFs which contain opcodes for the Type 1 operators
+       `hsbw' and `closepath' which are both invalid in Type 2 charstrings.
+       However, it doesn't harm to support them.
+
+       * src/cff/cffgload.c (CFF_Operator): Add `cff_op_hsbw' and
+       `cff_op_closepath.'
+       (cff_argument_counts): Ditto.
+
+       (cff_decoder_parse_charstrings): Handle Type 1 opcodes 9 (closepath)
+       and 13 (hsbw) which are invalid in Type 2 charstrings.
+
+2007-12-06  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftrfork.c (raccess_guess_darwin_newvfs): New function to
+       support new pathname syntax `..namedfork/rsrc' to access a resource
+       fork on Mac OS X.  The legacy syntax `/rsrc' does not work on
+       case-sensitive HFS+.
+       (raccess_guess_darwin_hfsplus): Fix a bug in the calculation of
+       buffer size to store a pathname.
+       * include/freetype/internal/ftrfork.h: Increment the number of
+       resource fork guessing rule.
+
+2007-12-06  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/configure.raw: Improve the compile tests to search
+       Carbon functions.
+       * builds/mac/ftmac.c: Import fixes for Carbon incompatibilities
+       proposed by Sean McBride from src/base/ftmac.c (see 2007-11-16).
+
+2007-12-06  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       The documents and comments for Mac OS X are improved by Sean
+       McBride.
+
+       * src/base/ftmac.c: Fix a comment.
+       * include/freetype/ftmac.h: Ditto.
+       * docs/INSTALL.MAC: Improve English and add comment on lowest
+       system version specified by MACOSX_DEPLOYMENT_TARGET.
+
+2007-12-04  Werner Lemberg  <wl@gnu.org>
+
+       * src/cff/cffload.c (cff_subfont_load): Don't use logical OR to
+       concatenate error codes.
+       * src/sfnt/ttsbit.c (Load_SBit_Range): Ditto.
+
+2007-12-04  Graham Asher  <graham.asher@btinternet.com>
+
+       * src/truetype/ttobjs.c (tt_face_init): Don't use logical OR to
+       concatenate error codes.
+
+2007-12-04  Sean McBride  <sean@rogue-research.com>
+
+       * src/pfr/pfrgload.c (pfr_glyph_load_compound): Remove compiler
+       warning.
+
+2007-11-20  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Fix MacOS legacy font support by Masatake Yamato on Mac OS X.  It is
+       not working since 2.3.5.  In FT_Open_New(), if FT_New_Stream()
+       cannot mmap() the specified file and cannot seek to head of the
+       specified file, it returns NULL stream and FT_Open_New() returns the
+       error immediately.  On MacOS, most legacy MacOS fonts fall into such
+       a scenario because their data forks are zero-sized and cannot be
+       sought.  To proceed to guessing of resource fork fonts, the
+       functions for legacy MacOS font must properly handle the NULL stream
+       returned by FT_New_Stream().
+
+       * src/base/ftobjs.c (IsMacBinary): Return error
+       FT_Err_Invalid_Stream_Operation immediately when NULL stream is
+       passed.
+       (FT_Open_Face): Even when FT_New_Stream() returns an error, proceed
+       to fallback.  Originally, legacy MacOS font is tested in the cases
+       of FT_Err_Invalid_Stream_Operation (occurs when data fork is empty)
+       or FT_Err_Unknown_File_Format (occurs when AppleSingle header or
+       .dfont header is combined).  Now the case of
+       FT_Err_Cannot_Open_Stream is included.
+
+       * src/base/ftrfork.c (FT_Raccess_Guess): When passed stream is NULL,
+       skip FT_Stream_Seek(), which seeks to the head of stream, and
+       proceed to unit testing of raccess_guess_XXX().  FT_Stream_Seek()
+       for a NULL stream causes a Bus error on Mac OS X.
+       (raccess_guess_apple_double): Return FT_Err_Cannot_Open_Stream
+       immediately if passed stream is NULL.
+       (raccess_guess_apple_single): Ditto.
+
+2007-11-16  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       Fix for Carbon incompatibilities since Mac OS X 10.5,
+       proposed by Sean McBride.
+
+       * doc/INSTALL.MAC: Comment on MACOSX_DEPLOYMENT_TARGET.
+
+       * include/freetype/ftmac.h: Deprecate FT_New_Face_From_FOND and
+       FT_GetFilePath_From_Mac_ATS_Name.  Since Mac OS X 10.5, calling
+       Carbon functions from a forked process is classified as unsafe
+       by Apple.  All Carbon-dependent functions should be deprecated.
+
+       * src/base/ftmac.c: Use essential header files
+       <CoreServices/CoreServices.h> and
+       <ApplicationServices/ApplicationServices.h> instead of
+       all-in-one header file <Carbon/Carbon.h>.
+
+       Include <sys/syslimits.h> and replace HFS_MAXPATHLEN by Apple
+       genuine macro PATH_MAX.
+
+       Add fallback macro for kATSOptionFlagsUnRestrictedScope which
+       is not found in Mac OS X 10.0.
+
+       Multi-character constants ('POST', 'sfnt' etc) are replaced by
+       64bit constants calculated by FT_MAKE_TAG() macro.
+
+       For the index in the segment of resource fork, new portable
+       type ResourceIndex is introduced for better compatibility.
+       This type is since Mac OS X 10.5, so it is defined as short
+       when built on older platforms.
+
+       (FT_ATSFontGetFileReference): If build target is only the systems
+       10.5 and newer, it calls Apple genuine ATSFontGetFileReference().
+
+       (FT_GetFile_From_Mac_ATS_Name): Return an error if system is 10.5
+       and newer or 64bit platform, because legacy type FSSpec type is
+       removed completely.
+
+       (FT_New_Face_From_FSSpec): Ditto.
+
+2007-11-01  Werner Lemberg  <wl@gnu.org>
+
+       * src/sfnt/sfobjs.c (sfnt_done_face): Check `sfnt' everywhere.  This
+       fixes Savannah bug #21485.
+
+2007-10-29  Daniel Svoboda  <dasvo@planeta@cz>
+
+       * src/winfonts/winfnt.c (FNT_Face_Init): Check first that the driver
+       can handle the font at all, then check `face_index'.  Otherwise, the
+       driver might return the wrong error code.  This fixes Savannah bug
+       #21468.
+
+2007-10-21  Werner Lemberg  <wl@gnu.org>
+
+       * src/sfnt/sfobjs.c (sfnt_load_face): Support bit 9 and prepare
+       support for bit 8 of the `fsSelection' field in the `OS/2' table.
+       MS is already using this; hopefully, this becomes part of OpenType
+       1.5.
+       Prepare also support for `name' IDs 21 (WWS_FAMILY) and 22
+       (WWS_SUBFAMILY).
+
+2007-10-20  Werner Lemberg  <wl@gnu.org>
+
+       * src/tools/docmaker/tohtml.py (html_header_2): Fix typo.
+       Add `td.left' element to CSS.
+       (toc_section_enter): Use it.
+
+2007-10-18  David Turner  <david@freetype.org>
+
+       * include/freetype/freetype.h, src/base/ftobjs.c: Rename API
+       functions related to cmap type 14 support to the
+       `FT_Object_ActionName' scheme:
+
+         FT_Get_Char_Variant_index     -> FT_Face_GetCharVariantIndex
+         FT_Get_Char_Variant_IsDefault -> FT_Face_GetCharVariantIsDefault
+         FT_Get_Variant_Selectors      -> FT_Face_GetVariantSelectors
+         FT_Get_Variants_Of_Char       -> FT_Face_GetVariantsOfChar
+         FT_Get_Chars_Of_Variant       -> FT_Face_GetCharsOfVariant
+
+       Update documentation accordingly.
+
+       * src/sfnt/ttcmap.c: Stronger cmap 14 validation.
+       Make the code a little more consistent with FreeType coding
+       conventions and modify the cmap14 functions that returned a newly
+       allocated array to use a persistent vector from the TT_CMap14 object
+       instead.
+
+       (TT_CMap14Rec): Provide array and auxiliary data for result.
+       (tt_cmap14_done, tt_cmap14_ensure): New functions.
+
+       (tt_cmap14_init, tt_cmap14_validate, tt_cmap14_char_map_def_binary,
+       tt_cmap14_char_map_nondef_binary, tt_cmap14_find_variant,
+       tt_cmap14_char_var_index, tt_cmap14_variants,
+       tt_cmap14_char_variants, tt_cmap14_def_char_count,
+       tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
+       tt_cmap14_variant_chars, tt_cmap14_class_rec): Updated and improved.
+
+2007-10-15  George Williams  <gww@silcom.com>
+
+       Add support for cmap type 14.
+
+       * devel/ftoption.h, include/freetype/config/ftoption.h
+       (TT_CONFIG_CMAP_FORMAT_14): New macro.
+
+       * include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
+       FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
+       FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
+       support function prototypes.
+       (FT_CMap_ClassRec): Add them.
+       Update all users.
+
+       * include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
+       macro.
+
+       * include/freetype/freetype.h (FT_Get_Char_Variant_Index,
+       FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
+       FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
+       functions.
+
+       * src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
+       function.
+       (FT_Set_Charmap): Disallow cmaps of type 14.
+       (FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
+       FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
+       FT_Get_Chars_Of_Variant): New API functions.
+
+       * src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
+
+       (TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
+       tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
+       tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
+       tt_cmap14_find_variant, tt_cmap14_char_var_index,
+       tt_cmap14_char_var_isdefault, tt_cmap14_variants,
+       tt_cmap14_char_variants, tt_cmap14_def_char_count,
+       tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
+       tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
+       structures for cmap 14 support.
+       (tt_cmap_classes): Register tt_cmap14_class_rec.
+       (tt_face_build_cmaps): One more error message.
+
+       * docs/CHANGES: Mention cmap 14 support.
+
+2007-10-01  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftobjs.c (find_unicode_charmap): If search for a UCS-4
+       charmap fails, do the loop again while searching a UCS-2 charmap.
+       This favours MS charmaps over Apple ones.
+
+2007-08-29  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftmac.c: Introduction of abstract `short' data types,
+       ResFileRefNum and ResID.  These types were introduced for Copland,
+       then backported to MPW.  The variables exchanged with FileManager
+       QuickDraw frameworks are redefined by these data types.  Patch was
+       proposed by Sean McBride.
+       * builds/mac/ftmac.c: Ditto.
+
+2007-08-18  Werner Lemberg  <wl@gnu.org>
+
+       * src/otvalid/otvcmmn.c (otv_x_y_ux_sy): Skip context glyphs.  Found
+       by Imran Yousaf.  Fixes Savannah bug #20773.
+
+       (otv_Lookup_validate): Correct handling of LookupType.  Found by
+       Imran Yousaf.  Fixes Savannah bug #20782.
+
+2007-08-17  George Williams  <gww@silcom.com>
+
+       * src/otvalid/otvgsub.c (otv_SingleSubst_validate): Fix handling of
+       SingleSubstFormat1.
+
+2007-08-11  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * builds/unix/configure.raw: Fix a bug which sets CC_BUILD by
+       ${build-gcc} (unchecked) instead of by ${build}-gcc (checked).
+       Found by Ryan Hill.
+
+2007-08-11  George Williams  <gww@silcom.com>
+
+       * src/otvalid/otvcommn.c, src/otvalid/otvcommn.h
+       (otv_Coverage_validate): Add fourth argument to pass an expected
+       count value.  Update all users.
+       Check glyph IDs.
+       (otv_ClassDef_validate): Check `StartGlyph'.
+
+       * src/otvalid/otvgsub.c (otv_SingleSubst_validate): More glyph ID
+       checks.
+
+       * src/otvalid/otvmath.c (otv_MathConstants_validate): There are only
+       56 constants.
+       (otv_GlyphAssembly_validate, otv_MathGlyphConstruction_validate):
+       Check glyph IDs.
+
+2007-08-08  Werner Lemberg  <wl@gnu.org>
+
+       * src/otvalid/otvbase.c, src/otvalid/otvcommn.c,
+       src/otvalid/otvgdef.c, src/otvalid/otvgpos.c, src/otvalid/otvgsub.c,
+       src/otvalid/otvjstf.c: s/FT_INVALID_DATA/FT_INVALID_FORMAT/ where
+       appropriate.  Reported by George.
+
+       * include/freetype/internal/fttrace.h: Define `trace_otvmath'.
+
+       * src/otvalid/rules.mk (OTV_DRV_SRC): Add otvmath.c.
+
+       * docs/CHANGES: Updated.
+
+2007-08-08  George Williams  <gww@silcom.com>
+
+       Add `MATH' validating support to otvalid module.
+
+       * include/freetype/tttags.h (TTAG_MATH): New macro.
+       * include/freetype/ftotval.h (FT_VALIDATE_MATH): New macro.
+       (FT_VALIDATE_OT): Updated.
+
+       * src/otvalid/otmath.c: New file.
+
+       * src/otvalid/otvalid.c: Include otvmath.c.
+       * src/otvalid/otvmod.c (otv_validate): Handle `MATH' table.
+
+2007-08-04  Werner Lemberg  <wl@gnu.org>
+
+       * builds/unix/configure.raw: Add call to AC_LIBTOOL_WIN32_DLL.
+       Fixes Savannah bug #20686.
+
+2007-08-03  Werner Lemberg  <wl@gnu.org>
+
+       * src/psnames/psmodule.c: Fix usage of
+       FT_CONFIG_OPTION_POSTSCRIPT_NAMES macro.  Reported by Graham Asher.
+
+2007-07-31  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+       * src/base/ftmac.c (open_face_from_buffer): The argument
+       `driver_name' is typed as `const char*' to match with the
+       callers in FT_New_Face_From_LWFN and FT_New_Face_From_SFNT.
+       This is same with open_face_from_buffer in src/base/ftobjs.c.
+       Found and fixed by Sean McBride.
+
+2007-07-28  Werner Lemberg  <wl@gnu.org>
+
+       * src/raster/ftraster.c (count_table): Make it conditional.
+       * src/base/ftobjs.c (FT_New_Library): Check FT_RENDER_POOL_SIZE with
+       a preprocessor statement.
+
+2007-07-27  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftoutln.c (FT_Outline_Translate): Check `outline' before
+       first usage.  From Savannah patch #6115.
+
+2007-07-16  Werner Lemberg  <wl@gnu.org>
+
+       * docs/CHANGES: Updated.
+
+2007-07-16  Derek Clegg  <dclegg@apple.com>
+
+       Add new service for getting the ROS from a CID font.
+
+       * include/freetype/config/ftheader.h (FT_CID_H): New macro.
+       * include/freetype/ftcid.h: New file.
+
+       * include/freetype/internal/ftserv.h (FT_SERVIVE_CID_H): New macro.
+       * include/freetype/internal/services/svcid.h: New file.
+
+       * src/base/ftcid.c: New file.
+
+       * src/cff/cffdrivr.c: Include FT_SERVICE_CID_H.
+       (cff_get_ros): New function.
+       (cff_service_cid_info): New service structure.
+       (cff_services): Register it.
+
+       * src/cff/cffload.c (cff_font_done): Free registry and ordering.
+
+       * src/cff/cfftypes.h (CFF_FontRec): Add `registry' and `ordering'.
+
+       * modules.cfg (BASE_EXTENSIONS): Add ftcid.c.
+
+2007-07-11  Derek Clegg  <dclegg@apple.com>
+
+       Add support for postscript name service to CFF driver.
+
+       * src/cff/cffdrivr.c: Include FT_SERVICE_POSTSCRIPT_NAME_H.
+       (cff_get_ps_name): New function.
+       (cff_service_ps_name): New service structure.
+       (cff_services): Register it.
+
+2007-07-07  Werner Lemberg  <wl@gnu.org>
+
+       * src/base/ftglyph.c (FT_Glyph_Copy): Fix initialization of
+       `target'.  Reported by Sean McBride.
+
+2007-07-06  Werner Lemberg  <wl@gnu.org>
+
+       * src/pfr/pfrcmap.c: Include pfrerror.h.
+
+       * src/autofit/afindic.c: Add some external declarations to pacify
+       `make multi' compilation.
+
+       * src/cid/cidgload.c (cid_load_glyph): Pacify compiler.
+
+       * src/cff/cffdrivr.c (cff_ps_get_font_info), src/cff/cffobjs.c
+       (cff_strcpy), include/freetype/internal/ftmemory.h (FT_MEM_STRDUP),
+       src/autofit/aflatin.c (af_latin_hints_compute_edges),
+       src/autofit/afcjk.c (af_cjk_hints_compute_edges), src/sfnt/ttmtx.c
+       (tt_face_get_metrics), src/base/ftobjs.c (open_face)
+       [FT_CONFIG_OPTION_INCREMENTAL]: Fix compilation with C++ compiler.
+
+       * docs/release: Mention test compilation targets.
+
+2007-07-04  Werner Lemberg  <wl@gnu.org>
+
+       * docs/PROBLEMS: Mention that some PS based fonts can't be
+       handled correctly by FreeType.
+
+       * src/truetype/ttgload.c (load_truetype_glyph): Always allow a
+       recursion depth of 1.  This was the maximum value in TrueType 1.0,
+       and some older fonts don't set this field correctly.
+
+       * src/gxvalid/gxvmort1.c
+       (gxv_mort_subtable_type1_substTable_validate): Fix tracing message.
+
+2007-07-03  Werner Lemberg  <wl@gnu.org>
+
+       * src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize
+       `round' to pacify compiler.
+
 2007-07-02  Werner Lemberg  <wl@gnu.org>
 
 
 2007-07-02  Werner Lemberg  <wl@gnu.org>
 
 
        * src/base/ftglyph.c (FT_Glyph_Copy): Always set second argument to
        zero in case of error.  This fixes Savannah bug #19689.
 
        * src/base/ftglyph.c (FT_Glyph_Copy): Always set second argument to
        zero in case of error.  This fixes Savannah bug #19689.
 
-2007-04-25  Boris Letocha <b.letocha@cz.gmc.net>
+2007-04-25  Boris Letocha  <b.letocha@cz.gmc.net>
 
        * src/truetype/ttobjs.c: Fix a typo that created a speed regression
        in the TrueType bytecode loader.
 
        * src/truetype/ttobjs.c: Fix a typo that created a speed regression
        in the TrueType bytecode loader.
 
        * src/base/ftmac.c: Specialized for Mac OS X only.
        * builds/unix/ftconfig.in: Fixed for ppc64 missing Carbon framework.
 
        * src/base/ftmac.c: Specialized for Mac OS X only.
        * builds/unix/ftconfig.in: Fixed for ppc64 missing Carbon framework.
-       * builds/unix/configure.raw: Ditto. When explicit switches for
+       * builds/unix/configure.raw: Ditto.  When explicit switches for
        FSSpec/FSRef/QuickDraw/ATS availability are given to configure,
        builds/mac/ftmac.c is used instead of default src/base/ftmac.c.
 
        FSSpec/FSRef/QuickDraw/ATS availability are given to configure,
        builds/mac/ftmac.c is used instead of default src/base/ftmac.c.
 
 
        Fix miscellaneous compiler warnings.
 
 
        Fix miscellaneous compiler warnings.
 
-       * freetype2/include/freetype/internal/ftobjs.h: Close comment with
-       `*/' to avoid `/* in comment' compiler warning.
+       * include/freetype/internal/ftobjs.h: Close comment with `*/' to
+       avoid `/* in comment' compiler warning.
 
 
-       * freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn cast
+       * src/base/ftdbgmem.c (ft_mem_table_get_source): Turn cast
        `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)' since on
        64-bit platforms void* is larger than FT_UInt32.
 
        `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)' since on
        64-bit platforms void* is larger than FT_UInt32.
 
-       * freetype2/src/base/ftobjs.c (t_validator_error): Cast away
+       * src/base/ftobjs.c (t_validator_error): Cast away
        volatileness of argument to ft_longjmp.  Spotted by Werner
        `Putzfrau' Lemberg.
 
        volatileness of argument to ft_longjmp.  Spotted by Werner
        `Putzfrau' Lemberg.
 
-       * freetype2/src/bdf/bdflib.c (bdf_load_font): Initialize local
+       * src/bdf/bdflib.c (bdf_load_font): Initialize local
        variable `lineno'.
 
        variable `lineno'.
 
-       * freetype2/src/gxvalid/gxvmod.c (classic_kern_validate): Mark local
-       variable `error' as volatile.
+       * src/gxvalid/gxvmod.c (classic_kern_validate): Mark local variable
+       `error' as volatile.
 
 2006-08-27  Werner Lemberg  <wl@gnu.org>
 
 
 2006-08-27  Werner Lemberg  <wl@gnu.org>
 
        about addresses of volatile objects passed as function arguments as
        non-volatile pointers.
 
        about addresses of volatile objects passed as function arguments as
        non-volatile pointers.
 
-       * freetype2/include/freetype/internal/ftvalid.h: Make FT_Validator
-       typedef a pointer to a volatile object.
+       * include/freetype/internal/ftvalid.h: Make FT_Validator typedef a
+       pointer to a volatile object.
 
 
-       * freetype2/src/gxvalid/gxvmod.c (gxv_load_table): Make function
-       argument `table' a pointer to a volatile object.
+       * src/gxvalid/gxvmod.c (gxv_load_table): Make function argument
+       `table' a pointer to a volatile object.
 
 
-       * freetype2/src/otvalid/otvmod.c (otv_load_table): Make function
-       argument `table' a pointer to a volatile object.
+       * src/otvalid/otvmod.c (otv_load_table): Make function argument
+       `table' a pointer to a volatile object.
 
 2006-08-18  Jens Claudius  <jens.claudius@yahoo.com>
 
 
 2006-08-18  Jens Claudius  <jens.claudius@yahoo.com>
 
-       * freetype2/src/gxvalid/gxvmod.c (GXV_TABLE_DECL): Mark local
-       variable `_sfnt' as volatile since it must keep its value across
-       a call to ft_setjmp.
+       * src/gxvalid/gxvmod.c (GXV_TABLE_DECL): Mark local variable `_sfnt'
+       as volatile since it must keep its value across a call to ft_setjmp.
        (gxv_validate): Same for local variables `memory' and `valid'.
        (classic_kern_validate): Same for local variables `memory',
        `ckern', and `valid'.
 
        (gxv_validate): Same for local variables `memory' and `valid'.
        (classic_kern_validate): Same for local variables `memory',
        `ckern', and `valid'.
 
-       * freetype2/src/otvalid/otvmod.c (otv_validate): Same for function
-       parameter `face' and local variables `base', `gdef', `gpos', `gsub',
-       `jstf', and 'valid'.
+       * src/otvalid/otvmod.c (otv_validate): Same for function parameter
+       `face' and local variables `base', `gdef', `gpos', `gsub', `jstf',
+       and 'valid'.
 
 
-       * freetype2/src/sfnt/ttcmap.c (tt_face_build_cmaps): Same for
-       local variable `cmap'.
+       * src/sfnt/ttcmap.c (tt_face_build_cmaps): Same for local variable
+       `cmap'.
 
 2006-08-16  David Turner  <david@freetype.org>
 
 
 2006-08-16  David Turner  <david@freetype.org>
 
        buggy by design.  Always return -1.
 
 
        buggy by design.  Always return -1.
 
 
-       Improvements to native TrueType hinting. This is a first try,
+       Improvements to native TrueType hinting.  This is a first try,
        controlled by the FIX_BYTECODE macro in src/truetype/ttinterp.c.
 
        * include/freetype/internal/ftgloadr.h (FT_GlyphLoadRec): Add member
        controlled by the FIX_BYTECODE macro in src/truetype/ttinterp.c.
 
        * include/freetype/internal/ftgloadr.h (FT_GlyphLoadRec): Add member
 
        `ft_validator_run' wrapping `setjmp' can cause a crash, as found by
        Jens:
 
        `ft_validator_run' wrapping `setjmp' can cause a crash, as found by
        Jens:
-       http://lists.nongnu.org/archive/html/freetype-devel/2006-08/msg00004.htm.
+       http://lists.gnu.org/archive/html/freetype-devel/2006-08/msg00004.htm.
 
 
-       * freetype2/src/otvalid/otvmod.c: Replace `ft_validator_run' by
-       `ft_setjmp'.  It reverts the change introduced on 2005-08-20.
+       * src/otvalid/otvmod.c: Replace `ft_validator_run' by `ft_setjmp'.
+       It reverts the change introduced on 2005-08-20.
 
 
-       * freetype2/src/gxvalid/gxvmod.c: Ditto.
+       * src/gxvalid/gxvmod.c: Ditto.
 
 2006-08-13  Jens Claudius  <jens.claudius@yahoo.com>
 
 
 2006-08-13  Jens Claudius  <jens.claudius@yahoo.com>
 
-       * freetype2/include/freetype/internal/psaux.h: (T1_TokenType): Add
+       * finclude/freetype/internal/psaux.h: (T1_TokenType): Add
        T1_TOKEN_TYPE_KEY.
        (T1_FieldRec): Add `dict'.
        (T1_FIELD_DICT_FONTDICT, T1_FIELD_DICT_PRIVATE): New macros.
        (T1_NEW_XXX, T1_FIELD_XXX): Update to take the dictionary where a PS
        keyword is expected as an additional argument.
 
        T1_TOKEN_TYPE_KEY.
        (T1_FieldRec): Add `dict'.
        (T1_FIELD_DICT_FONTDICT, T1_FIELD_DICT_PRIVATE): New macros.
        (T1_NEW_XXX, T1_FIELD_XXX): Update to take the dictionary where a PS
        keyword is expected as an additional argument.
 
-       * freetype2/src/cid/cidload.c: (cid_field_records): Adjust
-       invocations of T1_FIELD_XXX.
+       * src/cid/cidload.c: (cid_field_records): Adjust invocations of
+       T1_FIELD_XXX.
 
 
-       * freetype2/src/cid/cidtoken.h: Adjust invocations of T1_FIELD_XXX.
+       * src/cid/cidtoken.h: Adjust invocations of T1_FIELD_XXX.
 
 
-       * freetype2/src/psaux/psobjs.c: Add macro FT_COMPONENT for tracing.
+       * src/psaux/psobjs.c: Add macro FT_COMPONENT for tracing.
        (ps_parser_to_token): Report a PostScript key as T1_TOKEN_TYPE_KEY,
        not T1_TOKEN_TYPE_ANY.
        (ps_parser_load_field): Make sure a token that should be a string or
        name is really a string or name.
        Avoid memory leak if a keyword has been already encountered and its
        value is overwritten.
        (ps_parser_to_token): Report a PostScript key as T1_TOKEN_TYPE_KEY,
        not T1_TOKEN_TYPE_ANY.
        (ps_parser_load_field): Make sure a token that should be a string or
        name is really a string or name.
        Avoid memory leak if a keyword has been already encountered and its
        value is overwritten.
-       * freetype2/src/type1/t1load.c: (t1_keywords): Adjust invocations of
+       * src/type1/t1load.c: (t1_keywords): Adjust invocations of
        T1_FIELD_XXX.
        (parse_dict): Ignore keywords that occur in the wrong dictionary
        (e.g., in `Private' instead of `FontDict').
 
        T1_FIELD_XXX.
        (parse_dict): Ignore keywords that occur in the wrong dictionary
        (e.g., in `Private' instead of `FontDict').
 
-       * freetype2/src/type1/t1tokens.h: Adjust invocations of
-       T1_FIELD_XXX.
+       * src/type1/t1tokens.h: Adjust invocations of T1_FIELD_XXX.
 
 
-       * freetype2/src/type42/t42parse.c: (t42_keywords): Adjust
-       invocations of T1_FIELD_XXX.
+       * src/type42/t42parse.c: (t42_keywords): Adjust invocations of
+       T1_FIELD_XXX.
 
 2006-07-18  Jens Claudius  <jens.claudius@yahoo.com>
 
 
 2006-07-18  Jens Claudius  <jens.claudius@yahoo.com>
 
        Call the finisher for T1_Decoder in `cid_face_compute_max_advance'
        and `T1_Compute_Max_Advance'.
 
        Call the finisher for T1_Decoder in `cid_face_compute_max_advance'
        and `T1_Compute_Max_Advance'.
 
-       * freetype2/include/freetype/internal/psaux.h (T1_DecoderRec):
-       Remove field `face', add `len_buildchar'.
+       * include/freetype/internal/psaux.h (T1_DecoderRec): Remove field
+       `face', add `len_buildchar'.
 
 
-       * freetype2/include/freetype/internal/t1types.h (T1_FaceRec): Add
-       field `buildchar'.
+       * include/freetype/internal/t1types.h (T1_FaceRec): Add field
+       `buildchar'.
 
 
-       * freetype2/src/cid/cidgload.c (cid_face_compute_max_advance): Call
-       finisher for T1_Decoder.
+       * src/cid/cidgload.c (cid_face_compute_max_advance): Call finisher
+       for T1_Decoder.
        (cid_slot_load_glyph): Do not ignore failure when initializing the
        T1_Decoder.
 
        (cid_slot_load_glyph): Do not ignore failure when initializing the
        T1_Decoder.
 
-       * freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings):
-       Updated.
+       * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Updated.
        (t1_decoder_init): Remove initialization of fields `buildchar' and
        `len_buildchar'.
        (t1_decoder_done): Remove deallocation of field `buildchar'.
        (t1_decoder_init): Remove initialization of fields `buildchar' and
        `len_buildchar'.
        (t1_decoder_done): Remove deallocation of field `buildchar'.
        `len_buildchar'; make sure to call finisher for T1_Decoder even in
        case of error.
 
        `len_buildchar'; make sure to call finisher for T1_Decoder even in
        case of error.
 
-       * freetype2/src/type1/t1load.c (T1_Open_Face): Allocate new field
-       `buildchar' of T1_FaceRec.
+       * src/type1/t1load.c (T1_Open_Face): Allocate new field `buildchar'
+       of T1_FaceRec.
 
 
-       * freetype2/src/type1/t1objs.c (T1_Face_Done): Free new field
-       `buildchar' of T1_FaceRec.
+       * src/type1/t1objs.c (T1_Face_Done): Free new field `buildchar' of
+       T1_FaceRec.
 
 2006-07-14  Jens Claudius  <jens.claudius@yahoo.com>
 
 
 2006-07-14  Jens Claudius  <jens.claudius@yahoo.com>
 
-       * freetype2/include/freetype/internal/psaux.h: New macros
-       IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
-       IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
+       * include/freetype/internal/psaux.h: New macros IS_PS_NEWLINE,
+       IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
+       and IS_PS_BASE85 (from src/psaux/psconv.h).
        (T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
        T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
        (T1_DecoderRec): New fields `buildchar' and `face'.
        (IS_PS_TOKEN): New macro.
 
        (T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
        T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
        (T1_DecoderRec): New fields `buildchar' and `face'.
        (IS_PS_TOKEN): New macro.
 
-       * freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
-       fields `ndv_idx', `cdv_idx', and `len_buildchar'.
+       * include/freetype/internal/t1types.h (T1_FaceRec): New fields
+       `ndv_idx', `cdv_idx', and `len_buildchar'.
 
 
-       * freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
+       * include/freetype/t1tables.h (PS_BlendRec): New fields
        `default_design_vector' and `num_default_design_vector'.
 
        `default_design_vector' and `num_default_design_vector'.
 
-       * freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
-       IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
-       and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
+       * src/psaux/psconv.h: Move macros IS_PS_NEWLINE, IS_PS_SPACE,
+       IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT, and
+       IS_PS_BASE85 to include/freetype/internal/psaux.h.
 
 
-       * freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
-       `token' argument to be NULL if we want only to count the number of
-       tokens.
+       * src/psaux/psobjs.c (ps_parser_to_token_array): Allow `token'
+       argument to be NULL if we want only to count the number of tokens.
        (ps_tocoordarray): Allow `coords' argument to be NULL if we just
        want to skip the array.
        (ps_tofixedarray): Allow `values' argument to be NULL if we just
        want to skip the array.
 
        (ps_tocoordarray): Allow `coords' argument to be NULL if we just
        want to skip the array.
        (ps_tofixedarray): Allow `values' argument to be NULL if we just
        want to skip the array.
 
-       * freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
-       support for (partially commented out) othersubrs 19-25, 27, and 28.
+       * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add support
+       for (partially commented out) othersubrs 19-25, 27, and 28.
        (t1_decoder_init): Initialize new fields `face' and `buildchar'.
        (t1_decoder_done): Release new field `buildchar'.
 
        (t1_decoder_init): Initialize new fields `face' and `buildchar'.
        (t1_decoder_done): Release new field `buildchar'.
 
-       * freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
+       * src/type1/t1load.c (parse_buildchar, parse_private): New
        functions.
        (t1_keywords): Register them.
        (t1_allocate_blend): Updated.
        functions.
        (t1_keywords): Register them.
        (t1_allocate_blend): Updated.
        `len_buildchar'.
        Remove `keywords_flags'.
 
        `len_buildchar'.
        Remove `keywords_flags'.
 
-       * freetype2/src/type1/t1load.h (T1_LoaderRect): New field
+       * src/type1/t1load.h (T1_LoaderRect): New field
        `keywords_encountered'.
        (T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
 
        `keywords_encountered'.
        (T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
 
-       * freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
-       New entries for parsing /NDV, /CDV, and /DesignVector.
+       * src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]: New
+       entries for parsing /NDV, /CDV, and /DesignVector.
 
 2006-07-07  Werner Lemberg  <wl@gnu.org>
 
 
 2006-07-07  Werner Lemberg  <wl@gnu.org>
 
 2006-06-24  Eugeniy Meshcheryakov  <eugen@univ.kiev.ua>
 
        Fix two hinting bugs as reported in
 2006-06-24  Eugeniy Meshcheryakov  <eugen@univ.kiev.ua>
 
        Fix two hinting bugs as reported in
-       http://lists.nongnu.org/archive/html/freetype-devel/2006-06/msg00057.html.
+       http://lists.gnu.org/archive/html/freetype-devel/2006-06/msg00057.html.
 
        * include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add
        `first_point' member.
 
        * include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add
        `first_point' member.
 
 ----------------------------------------------------------------------------
 
 
 ----------------------------------------------------------------------------
 
-Copyright 2006, 2007 by
+Copyright 2006, 2007, 2008, 2009 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
index 3a1bcf0..d6371d1 100644 (file)
        (tt_driver_class): Updated.
 
        * src/truetype/ttgload.c (TT_Get_Metrics): Renamed to...
        (tt_driver_class): Updated.
 
        * src/truetype/ttgload.c (TT_Get_Metrics): Renamed to...
-       (tt_face_get_metrics): This. Provide version for FT_OPTIMIZE_MEMORY.
+       (tt_face_get_metrics): This.  Provide version for FT_OPTIMIZE_MEMORY.
        Update all callers.
        (Get_Advance_Widths): Replaced with...
        (Get_Advance_WidthPtr): This.  Provide version for
        Update all callers.
        (Get_Advance_Widths): Replaced with...
        (Get_Advance_WidthPtr): This.  Provide version for
 2004-11-16  Owen Taylor  <otaylor@redhat.com>
 
        * builds/unix/freetype-config.in: Suppress -L$libdir for
 2004-11-16  Owen Taylor  <otaylor@redhat.com>
 
        * builds/unix/freetype-config.in: Suppress -L$libdir for
-       /usr/lib64 as well as /usr/lib. (Reported by Dan Winship -
+       /usr/lib64 as well as /usr/lib.  (Reported by Dan Winship -
        https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=139199)
 
 2004-11-11  Werner Lemberg  <wl@gnu.org>
        https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=139199)
 
 2004-11-11  Werner Lemberg  <wl@gnu.org>
            - the image and sbit cache are now abstract classes, that
              can be extended much more easily by client applications
 
            - 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
+           - better performance in certain areas.  Further optimizations
              to come shortly anyway...
 
            - the FTC_CMapCache_Lookup function has changed its signature,
              to come shortly anyway...
 
            - the FTC_CMapCache_Lookup function has changed its signature,
 
 ----------------------------------------------------------------------------
 
 
 ----------------------------------------------------------------------------
 
-Copyright 2002, 2003, 2004, 2005, 2007 by
+Copyright 2002, 2003, 2004, 2005, 2007, 2008 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
index 22bf4f9..4144288 100644 (file)
        * src/base/ftmac.c (read_lwfn): Catch integer overflow.
        * src/base/ftrfork.c (raccess_guess_darwin_hfsplus): Ditto.
        * src/base/ftutil.c: Remove special code for FT_STRICT_ALIASING.
        * src/base/ftmac.c (read_lwfn): Catch integer overflow.
        * src/base/ftrfork.c (raccess_guess_darwin_hfsplus): Ditto.
        * src/base/ftutil.c: Remove special code for FT_STRICT_ALIASING.
-       (ft_mem_alloc. ft_mem_realloc, ft_mem_qrealloc): Rewrite.
+       (ft_mem_alloc, ft_mem_realloc, ft_mem_qrealloc): Rewrite.
 
 
        * include/freetype/ftstream.h (FT_FRAME_ENTER, FT_FRAME_EXIT,
 
 
        * include/freetype/ftstream.h (FT_FRAME_ENTER, FT_FRAME_EXIT,
 
 2005-09-19  David Somers  <dsomers@omz13.com>
 
 
 2005-09-19  David Somers  <dsomers@omz13.com>
 
-       * freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
+       * src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
        font to have no `head' table if tables `SING' and `META' are
        present; this is to support `SING Glyphlet'.
 
        font to have no `head' table if tables `SING' and `META' are
        present; this is to support `SING Glyphlet'.
 
 
          http://www.adobe.com/products/indesign/sing_gaiji.html
 
 
          http://www.adobe.com/products/indesign/sing_gaiji.html
 
-       * freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
-       macros for the OpenType tables `SING' and `META'.  These two tables
-       are used in SING Glyphlet Format fonts.
+       * include/freetype/ttags.h (TTAG_SING, TTAG_META): New macros for
+       the OpenType tables `SING' and `META'.  These two tables are used in
+       SING Glyphlet Format fonts.
 
 2005-09-09  Werner Lemberg  <wl@gnu.org>
 
 
 2005-09-09  Werner Lemberg  <wl@gnu.org>
 
          . loader->pp3.y and loader->pp4.y are in 26.6 format, not in font
            units.
          . As we use the glyph's cbox to calculate the top bearing now
          . loader->pp3.y and loader->pp4.y are in 26.6 format, not in font
            units.
          . As we use the glyph's cbox to calculate the top bearing now
-           there iss no need to adjust `top'.
+           there is no need to adjust `top'.
 
 2005-06-15  Werner Lemberg  <wl@gnu.org>
 
 
 2005-06-15  Werner Lemberg  <wl@gnu.org>
 
 
 ----------------------------------------------------------------------------
 
 
 ----------------------------------------------------------------------------
 
-Copyright 2005, 2006, 2007 by
+Copyright 2005, 2006, 2007, 2008 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
index ad1341e..ac327b8 100644 (file)
@@ -1,6 +1,6 @@
 # FreeType 2 top Jamfile.
 #
 # FreeType 2 top Jamfile.
 #
-# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 by
+# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -194,7 +194,7 @@ rule RefDoc
 
 actions RefDoc
 {
 
 actions RefDoc
 {
-  python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.3.5 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h
+  python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.3.11 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h
 }
 
 RefDoc  refdoc ;
 }
 
 RefDoc  refdoc ;
index 82d0003..f63c8fc 100644 (file)
@@ -9,8 +9,8 @@
   is called `libttf'.  They are *not* compatible!
 
 
   is called `libttf'.  They are *not* compatible!
 
 
-  FreeType 2.3.5
-  ==============
+  FreeType 2.3.11
+  ===============
 
   Please   read   the  docs/CHANGES   file,   it  contains   IMPORTANT
   INFORMATION.
 
   Please   read   the  docs/CHANGES   file,   it  contains   IMPORTANT
   INFORMATION.
@@ -26,9 +26,9 @@
 
   and download one of the following files.
 
 
   and download one of the following files.
 
-    freetype-doc-2.3.5.tar.bz2
-    freetype-doc-2.3.5.tar.gz
-    ftdoc235.zip
+    freetype-doc-2.3.11.tar.bz2
+    freetype-doc-2.3.11.tar.gz
+    ftdoc2311.zip
 
 
   Bugs
 
 
   Bugs
@@ -51,7 +51,7 @@
 
 ----------------------------------------------------------------------
 
 
 ----------------------------------------------------------------------
 
-Copyright 2006, 2007 by
+Copyright 2006, 2007, 2008, 2009 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/reactos/lib/3rdparty/freetype/README.git b/reactos/lib/3rdparty/freetype/README.git
new file mode 100644 (file)
index 0000000..bb36cf7
--- /dev/null
@@ -0,0 +1,46 @@
+The git  archive doesn't  contain pre-built configuration  scripts for\r
+UNIXish platforms.  To generate them say\r
+\r
+  sh autogen.sh\r
+\r
+which in turn depends on the following packages:\r
+\r
+  automake (1.10.1)\r
+  libtool (2.2.4)\r
+  autoconf (2.62)\r
+\r
+The versions given  in parentheses are known to  work.  Newer versions\r
+should work too, of course.   Note that autogen.sh also sets up proper\r
+file permissions for the `configure' and auxiliary scripts.\r
+\r
+The autogen.sh script  now checks the version of  above three packages\r
+whether they match the numbers  above.  Otherwise it will complain and\r
+suggest either upgrading or using  an environment variable to point to\r
+a more recent version of the required tool(s).\r
+\r
+Note that  `aclocal' is provided  by the `automake' package  on Linux,\r
+and that `libtoolize' is called `glibtoolize' on Darwin (OS X).\r
+\r
+\r
+For static builds which  don't use platform specific optimizations, no\r
+configure script is necessary at all; saying\r
+\r
+  make setup ansi\r
+  make\r
+\r
+should work on all platforms which have GNU make (or makepp).\r
+\r
+\r
+----------------------------------------------------------------------\r
+\r
+Copyright 2005, 2006, 2007, 2008, 2009 by\r
+David Turner, Robert Wilhelm, and Werner Lemberg.\r
+\r
+This  file is  part of  the FreeType  project, and  may only  be used,\r
+modified,  and distributed  under the  terms of  the  FreeType project\r
+license,  LICENSE.TXT.  By  continuing to  use, modify,  or distribute\r
+this file you  indicate that you have read  the license and understand\r
+and accept it fully.\r
+\r
+\r
+--- end of README.CVS ---\r
index d8fb5b2..16c335f 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
 #!/bin/sh
 
-# Copyright 2005, 2006, 2007 by
+# Copyright 2005, 2006, 2007, 2008, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -20,12 +20,120 @@ run ()
   fi
 }
 
   fi
 }
 
+get_major_version ()
+{
+  echo $1 | sed -e 's/\([0-9][0-9]*\)\..*/\1/g'
+}
+
+get_minor_version ()
+{
+  echo $1 | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'
+}
+
+get_patch_version ()
+{
+  # tricky: some version numbers don't include a patch
+  # separated with a point, but something like 1.4-p6
+  patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'`
+  if test "$patch" = "$1"; then
+    patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\-p\([0-9][0-9]*\).*/\1/g'`
+    # if there isn't any patch number, default to 0
+    if test "$patch" = "$1"; then
+      patch=0
+    fi
+  fi
+  echo $patch
+}
+
+# $1: version to check
+# $2: minimum version
+
+compare_to_minimum_version ()
+{
+  MAJOR1=`get_major_version $1`
+  MAJOR2=`get_major_version $2`
+  if test $MAJOR1 -lt $MAJOR2; then
+    echo 0
+    return
+  else 
+    if test $MAJOR1 -gt $MAJOR2; then
+      echo 1
+      return
+    fi
+  fi
+
+  MINOR1=`get_minor_version $1`
+  MINOR2=`get_minor_version $2`
+  if test $MINOR1 -lt $MINOR2; then
+    echo 0
+    return
+  else 
+    if test $MINOR1 -gt $MINOR2; then
+      echo 1
+      return
+    fi
+  fi
+
+  PATCH1=`get_patch_version $1`
+  PATCH2=`get_patch_version $2`
+  if test $PATCH1 -lt $PATCH2; then
+    echo 0
+  else
+    echo 1
+  fi
+}
+
+# check the version of a given tool against a minimum version number
+#
+# $1: tool path
+# $2: tool usual name (e.g. `aclocal')
+# $3: tool variable  (e.g. `ACLOCAL')
+# $4: minimum version to check against
+# $5: option field index used to extract the tool version from the
+#     output of --version
+
+check_tool_version ()
+{
+  field=$5
+  if test "$field"x = x; then
+    field=4  # default to 4 for all GNU autotools
+  fi
+  version=`$1 --version | head -1 | cut -d ' ' -f $field`
+  version_check=`compare_to_minimum_version $version $4`
+  if test "$version_check"x = 0x; then
+    echo "ERROR: Your version of the \`$2' tool is too old."
+    echo "       Minimum version $4 is required (yours is version $version)."
+    echo "       Please upgrade or use the $3 variable to point to a more recent one."
+    echo ""
+    exit 1
+  fi
+}
+
 if test ! -f ./builds/unix/configure.raw; then
   echo "You must be in the same directory as \`autogen.sh'."
   echo "Bootstrapping doesn't work if srcdir != builddir."
   exit 1
 fi
 
 if test ! -f ./builds/unix/configure.raw; then
   echo "You must be in the same directory as \`autogen.sh'."
   echo "Bootstrapping doesn't work if srcdir != builddir."
   exit 1
 fi
 
+# On MacOS X, the GNU libtool is named `glibtool'.
+HOSTOS=`uname`
+LIBTOOLIZE=libtoolize
+if test "$HOSTOS"x = Darwinx; then
+  LIBTOOLIZE=glibtoolize
+fi
+
+if test "$ACLOCAL"x = x; then
+  ACLOCAL=aclocal
+fi
+
+if test "$AUTOCONF"x = x; then
+  AUTOCONF=autoconf
+fi
+
+check_tool_version $ACLOCAL    aclocal    ACLOCAL    1.10.1
+check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
+check_tool_version $AUTOCONF   autoconf   AUTOCONF   2.62
+
 # This sets freetype_major, freetype_minor, and freetype_patch.
 eval `sed -nf version.sed include/freetype/freetype.h`
 
 # This sets freetype_major, freetype_minor, and freetype_patch.
 eval `sed -nf version.sed include/freetype/freetype.h`
 
@@ -38,17 +146,10 @@ cd builds/unix
 
 echo "generating \`configure.ac'"
 sed -e "s;@VERSION@;$freetype_major$freetype_minor$freetype_patch;" \
 
 echo "generating \`configure.ac'"
 sed -e "s;@VERSION@;$freetype_major$freetype_minor$freetype_patch;" \
-    < configure.raw > configure.ac
-
-# On MacOS X, the GNU libtool is named `glibtool'.
-HOSTOS=`uname`
-LIBTOOLIZE=libtoolize
-if test "$HOSTOS"x = Darwinx; then
-  LIBTOOLIZE=glibtoolize
-fi
+  < configure.raw > configure.ac
 
 run aclocal -I . --force
 
 run aclocal -I . --force
-run $LIBTOOLIZE --force --copy
+run $LIBTOOLIZE --force --copy --install
 run autoconf --force
 
 chmod +x mkinstalldirs
 run autoconf --force
 
 chmod +x mkinstalldirs
index f251ae4..2efa269 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
 #!/bin/sh
 #
-# Copyright 2002, 2003, 2004, 2005, 2006 by
+# Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -21,7 +21,7 @@ fi
 
 if test -z "`$GNUMAKE -v 2>/dev/null | grep GNU`"; then
   if test -z "`$GNUMAKE -v 2>/dev/null | grep makepp`"; then
 
 if test -z "`$GNUMAKE -v 2>/dev/null | grep GNU`"; then
   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 "GNU make (>= 3.80) 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 "Please try" >&2
     echo "  \`GNUMAKE=<GNU make command name> $0'." >&2
     echo "or >&2"
@@ -67,12 +67,25 @@ ft2_dir=`(dirname "$0") 2>/dev/null                         ||
 abs_curr_dir=`pwd`
 abs_ft2_dir=`cd "$ft2_dir" && pwd`
 
 abs_curr_dir=`pwd`
 abs_ft2_dir=`cd "$ft2_dir" && pwd`
 
+# `--srcdir=' option can override abs_ft2_dir
+
+if test $# -gt 0; then
+  for x in "$@"; do
+    case x"$x" in
+    x--srcdir=*)
+      abs_ft2_dir=`echo $x | sed 's/^--srcdir=//'` ;;
+    esac
+  done
+fi
+
 # build a dummy Makefile if we are not building in the source tree
 
 if test "$abs_curr_dir" != "$abs_ft2_dir"; then
   mkdir reference
 # build a dummy Makefile if we are not building in the source tree
 
 if test "$abs_curr_dir" != "$abs_ft2_dir"; then
   mkdir reference
-  echo "Copying \`modules.cfg'"
-  cp $abs_ft2_dir/modules.cfg $abs_curr_dir
+  if test ! -r $abs_curr_dir/modules.cfg; then
+    echo "Copying \`modules.cfg'"
+    cp $abs_ft2_dir/modules.cfg $abs_curr_dir
+  fi
   echo "Generating \`Makefile'"
   echo "TOP_DIR   := $abs_ft2_dir"               > Makefile
   echo "OBJ_DIR   := $abs_curr_dir"             >> Makefile
   echo "Generating \`Makefile'"
   echo "TOP_DIR   := $abs_ft2_dir"               > Makefile
   echo "OBJ_DIR   := $abs_curr_dir"             >> Makefile
@@ -92,9 +105,16 @@ fi
 # call make
 
 CFG=
 # call make
 
 CFG=
-for x in ${1+"$@"}; do
-  CFG="$CFG \"$x\""
-done
+# work around zsh bug which doesn't like `${1+"$@"}'
+case $# in
+0) ;;
+*) for x in "$@"; do
+     case x"$x" in
+     x--srcdir=* ) CFG="$CFG '$x'/builds/unix" ;;
+     *) CFG="$CFG '$x'" ;;
+     esac
+   done ;;
+esac
 CFG=$CFG $GNUMAKE setup unix
 
 # eof
 CFG=$CFG $GNUMAKE setup unix
 
 # eof
index 6cf1af2..d4fee59 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    User-selectable configuration macros (specification only).           */
 /*                                                                         */
 /*                                                                         */
 /*    User-selectable configuration macros (specification only).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -112,7 +112,28 @@ FT_BEGIN_HEADER
   /*         file `ftconfig.h' either statically or through the            */
   /*         `configure' script on supported platforms.                    */
   /*                                                                       */
   /*         file `ftconfig.h' either statically or through the            */
   /*         `configure' script on supported platforms.                    */
   /*                                                                       */
-#undef  FT_CONFIG_OPTION_FORCE_INT64
+#undef FT_CONFIG_OPTION_FORCE_INT64
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* If this macro is defined, do not try to use an assembler version of   */
+  /* performance-critical functions (e.g. FT_MulFix).  You should only do  */
+  /* that to verify that the assembler function works properly, or to      */
+  /* execute benchmark tests of the various implementations.               */
+/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* If this macro is defined, try to use an inlined assembler version of  */
+  /* the `FT_MulFix' function, which is a `hotspot' when loading and       */
+  /* hinting glyphs, and which should be executed as fast as possible.     */
+  /*                                                                       */
+  /* Note that if your compiler or CPU is not supported, this will default */
+  /* to the standard and portable implementation found in `ftcalc.c'.      */
+  /*                                                                       */
+#define FT_CONFIG_OPTION_INLINE_MULFIX
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -163,7 +184,7 @@ FT_BEGIN_HEADER
   /*   Do not #undef this macro here since the build system might define   */
   /*   it for certain configurations only.                                 */
   /*                                                                       */
   /*   Do not #undef this macro here since the build system might define   */
   /*   it for certain configurations only.                                 */
   /*                                                                       */
-/* #define  FT_CONFIG_OPTION_SYSTEM_ZLIB */
+/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -204,27 +225,27 @@ FT_BEGIN_HEADER
   /*   Do not #undef these macros here since the build system might define */
   /*   them for certain configurations only.                               */
   /*                                                                       */
   /*   Do not #undef these macros here since the build system might define */
   /*   them for certain configurations only.                               */
   /*                                                                       */
-/* #define  FT_EXPORT(x)       extern x */
-/* #define  FT_EXPORT_DEF(x)   x */
+/* #define FT_EXPORT(x)      extern x */
+/* #define FT_EXPORT_DEF(x)  x */
 
 
   /*************************************************************************/
   /*                                                                       */
   /* Glyph Postscript Names handling                                       */
   /*                                                                       */
 
 
   /*************************************************************************/
   /*                                                                       */
   /* Glyph Postscript Names handling                                       */
   /*                                                                       */
-  /*   By default, FreeType 2 is compiled with the `PSNames' module.  This */
+  /*   By default, FreeType 2 is compiled with the `psnames' module.  This */
   /*   module is in charge of converting a glyph name string into a        */
   /*   Unicode value, or return a Macintosh standard glyph name for the    */
   /*   use with the TrueType `post' table.                                 */
   /*                                                                       */
   /*   module is in charge of converting a glyph name string into a        */
   /*   Unicode value, or return a Macintosh standard glyph name for the    */
   /*   use with the TrueType `post' table.                                 */
   /*                                                                       */
-  /*   Undefine this macro if you do not want `PSNames' compiled in your   */
+  /*   Undefine this macro if you do not want `psnames' compiled in your   */
   /*   build of FreeType.  This has the following effects:                 */
   /*                                                                       */
   /*   - The TrueType driver will provide its own set of glyph names,      */
   /*     if you build it to support postscript names in the TrueType       */
   /*     `post' table.                                                     */
   /*                                                                       */
   /*   build of FreeType.  This has the following effects:                 */
   /*                                                                       */
   /*   - The TrueType driver will provide its own set of glyph names,      */
   /*     if you build it to support postscript names in the TrueType       */
   /*     `post' table.                                                     */
   /*                                                                       */
-  /*   - The Type 1 driver will not be able to synthetize a Unicode        */
+  /*   - The Type 1 driver will not be able to synthesize a Unicode        */
   /*     charmap out of the glyphs found in the fonts.                     */
   /*                                                                       */
   /*   You would normally undefine this configuration macro when building  */
   /*     charmap out of the glyphs found in the fonts.                     */
   /*                                                                       */
   /*   You would normally undefine this configuration macro when building  */
@@ -240,12 +261,12 @@ FT_BEGIN_HEADER
   /*   By default, FreeType 2 is built with the `PSNames' module compiled  */
   /*   in.  Among other things, the module is used to convert a glyph name */
   /*   into a Unicode value.  This is especially useful in order to        */
   /*   By default, FreeType 2 is built with the `PSNames' module compiled  */
   /*   in.  Among other things, the module is used to convert a glyph name */
   /*   into a Unicode value.  This is especially useful in order to        */
-  /*   synthetize on the fly a Unicode charmap from the CFF/Type 1 driver  */
+  /*   synthesize on the fly a Unicode charmap from the CFF/Type 1 driver  */
   /*   through a big table named the `Adobe Glyph List' (AGL).             */
   /*                                                                       */
   /*   Undefine this macro if you do not want the Adobe Glyph List         */
   /*   compiled in your `PSNames' module.  The Type 1 driver will not be   */
   /*   through a big table named the `Adobe Glyph List' (AGL).             */
   /*                                                                       */
   /*   Undefine this macro if you do not want the Adobe Glyph List         */
   /*   compiled in your `PSNames' module.  The Type 1 driver will not be   */
-  /*   able to synthetize a Unicode charmap out of the glyphs found in the */
+  /*   able to synthesize a Unicode charmap out of the glyphs found in the */
   /*   fonts.                                                              */
   /*                                                                       */
 #define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
   /*   fonts.                                                              */
   /*                                                                       */
 #define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
@@ -294,7 +315,7 @@ FT_BEGIN_HEADER
   /* This allows FreeType to be used with the PostScript language, using   */
   /* the GhostScript interpreter.                                          */
   /*                                                                       */
   /* This allows FreeType to be used with the PostScript language, using   */
   /* the GhostScript interpreter.                                          */
   /*                                                                       */
-/* #define FT_CONFIG_OPTION_INCREMENTAL */
+#define FT_CONFIG_OPTION_INCREMENTAL
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -418,7 +439,7 @@ FT_BEGIN_HEADER
   /* does not contain any glyph name though.                               */
   /*                                                                       */
   /* Accessing SFNT names is done through the functions declared in        */
   /* does not contain any glyph name though.                               */
   /*                                                                       */
   /* Accessing SFNT names is done through the functions declared in        */
-  /* `freetype/ftnames.h'.                                                 */
+  /* `freetype/ftsnames.h'.                                                */
   /*                                                                       */
 #define TT_CONFIG_OPTION_SFNT_NAMES
 
   /*                                                                       */
 #define TT_CONFIG_OPTION_SFNT_NAMES
 
@@ -436,6 +457,8 @@ FT_BEGIN_HEADER
 #define TT_CONFIG_CMAP_FORMAT_8
 #define TT_CONFIG_CMAP_FORMAT_10
 #define TT_CONFIG_CMAP_FORMAT_12
 #define TT_CONFIG_CMAP_FORMAT_8
 #define TT_CONFIG_CMAP_FORMAT_10
 #define TT_CONFIG_CMAP_FORMAT_12
+#define TT_CONFIG_CMAP_FORMAT_13
+#define TT_CONFIG_CMAP_FORMAT_14
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -466,9 +489,9 @@ FT_BEGIN_HEADER
   /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version  */
   /* of the TrueType bytecode interpreter is used that doesn't implement   */
   /* any of the patented opcodes and algorithms.  Note that the            */
   /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version  */
   /* of the TrueType bytecode interpreter is used that doesn't implement   */
   /* any of the patented opcodes and algorithms.  Note that the            */
-  /* the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you     */
-  /* define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; with other words,       */
-  /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                */
+  /* TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you define  */
+  /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, either define  */
+  /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                              */
   /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time.    */
   /*                                                                       */
   /* This macro is only useful for a small number of font files (mostly    */
   /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time.    */
   /*                                                                       */
   /* This macro is only useful for a small number of font files (mostly    */
@@ -624,11 +647,11 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
-  /* Compile autofit module with CJK script support.                       */
+  /* Compile autofit module with CJK (Chinese, Japanese, Korean) script    */
+  /* support.                                                              */
   /*                                                                       */
 #define AF_CONFIG_OPTION_CJK
 
   /*                                                                       */
 #define AF_CONFIG_OPTION_CJK
 
-
   /*************************************************************************/
   /*                                                                       */
   /* Compile autofit module with Indic script support.                     */
   /*************************************************************************/
   /*                                                                       */
   /* Compile autofit module with Indic script support.                     */
@@ -648,15 +671,16 @@ FT_BEGIN_HEADER
    * is recommended to disable the macro since it reduces the library's code
    * size and activates a few memory-saving optimizations as well.
    */
    * is recommended to disable the macro since it reduces the library's code
    * size and activates a few memory-saving optimizations as well.
    */
-#undef FT_CONFIG_OPTION_OLD_INTERNALS
+/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
   /*
 
 
   /*
-   * This variable is defined if either unpatented or native TrueType
+   * This macro is defined if either unpatented or native TrueType
    * hinting is requested by the definitions above.
    */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 #define  TT_USE_BYTECODE_INTERPRETER
    * hinting is requested by the definitions above.
    */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 #define  TT_USE_BYTECODE_INTERPRETER
+#undef   TT_CONFIG_OPTION_UNPATENTED_HINTING
 #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
 #define  TT_USE_BYTECODE_INTERPRETER
 #endif
 #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
 #define  TT_USE_BYTECODE_INTERPRETER
 #endif
index e6896e6..1f5895f 100644 (file)
@@ -40,13 +40,19 @@ EXPORTS
   FT_Face_CheckTrueTypePatents
   FT_Face_SetUnpatentedHinting
   FT_FloorFix
   FT_Face_CheckTrueTypePatents
   FT_Face_SetUnpatentedHinting
   FT_FloorFix
+  FT_Get_Advance
+  FT_Get_Advances
   FT_Get_BDF_Charset_ID
   FT_Get_BDF_Property
   FT_Get_CMap_Format
   FT_Get_CMap_Language_ID
   FT_Get_Char_Index
   FT_Get_Charmap_Index
   FT_Get_BDF_Charset_ID
   FT_Get_BDF_Property
   FT_Get_CMap_Format
   FT_Get_CMap_Language_ID
   FT_Get_Char_Index
   FT_Get_Charmap_Index
+  FT_Get_CID_From_Glyph_Index
+  FT_Get_CID_Is_Internally_CID_keyed
+  FT_Get_CID_Registry_Ordering_Supplement
   FT_Get_First_Char
   FT_Get_First_Char
+  FT_Get_FSType_Flags
   FT_Get_Glyph
   FT_Get_Glyph_Name
   FT_Get_Kerning
   FT_Get_Glyph
   FT_Get_Glyph_Name
   FT_Get_Kerning
index bf7709e..25fbc60 100644 (file)
        </if>
        <directory name="src">
                <directory name="base">
        </if>
        <directory name="src">
                <directory name="base">
-                       <file>ftsystem.c</file>
-                       <file>ftinit.c</file>
-                       <file>ftdebug.c</file>
-                       <file>_ftbase_ros.c</file>
+                       <file>ftbase.c</file>
                        <file>ftbbox.c</file>
                        <file>ftbbox.c</file>
-                       <file>ftglyph.c</file>
                        <file>ftbdf.c</file>
                        <file>ftbitmap.c</file>
                        <file>ftbdf.c</file>
                        <file>ftbitmap.c</file>
+                       <file>ftdebug.c</file>
+                       <file>ftgasp.c</file>
+                       <file>ftglyph.c</file>
                        <file>ftgxval.c</file>
                        <file>ftgxval.c</file>
+                       <file>ftinit.c</file>
+                       <file>ftlcdfil.c</file>
                        <file>ftmm.c</file>
                        <file>ftotval.c</file>
                        <file>ftpatent.c</file>
                        <file>ftpfr.c</file>
                        <file>ftstroke.c</file>
                        <file>ftsynth.c</file>
                        <file>ftmm.c</file>
                        <file>ftotval.c</file>
                        <file>ftpatent.c</file>
                        <file>ftpfr.c</file>
                        <file>ftstroke.c</file>
                        <file>ftsynth.c</file>
+                       <file>ftsystem.c</file>
                        <file>fttype1.c</file>
                        <file>ftwinfnt.c</file>
                        <file>fttype1.c</file>
                        <file>ftwinfnt.c</file>
+                       <file>ftxf86.c</file>
                </directory>
                <directory name="autofit">
                        <file>autofit.c</file>
                </directory>
                <directory name="autofit">
                        <file>autofit.c</file>
index 1547f5a..3c0b8b1 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    ANSI-specific configuration file (specification only).               */
 /*                                                                         */
 /*                                                                         */
 /*    ANSI-specific configuration file (specification only).               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -43,6 +43,7 @@
 #include FT_CONFIG_OPTIONS_H
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
 #include FT_CONFIG_OPTIONS_H
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
+
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
 
@@ -134,18 +135,78 @@ FT_BEGIN_HEADER
 #else
 #define FT_MACINTOSH 1
 #endif
 #else
 #define FT_MACINTOSH 1
 #endif
+
+#elif defined( __SC__ ) || defined( __MRC__ )
+  /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
 #endif
 
 
   /*************************************************************************/
   /*                                                                       */
 #endif
 
 
   /*************************************************************************/
   /*                                                                       */
-  /* IntN types                                                            */
+  /* <Section>                                                             */
+  /*    basic_types                                                        */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    FT_Int16                                                           */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A typedef for a 16bit signed integer type.                         */
+  /*                                                                       */
+  typedef signed short  FT_Int16;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    FT_UInt16                                                          */
   /*                                                                       */
   /*                                                                       */
-  /*   Used to guarantee the size of some specific integers.               */
+  /* <Description>                                                         */
+  /*    A typedef for a 16bit unsigned integer type.                       */
   /*                                                                       */
   /*                                                                       */
-  typedef signed short    FT_Int16;
   typedef unsigned short  FT_UInt16;
 
   typedef unsigned short  FT_UInt16;
 
+  /* */
+
+
+  /* this #if 0 ... #endif clause is for documentation purposes */
+#if 0
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    FT_Int32                                                           */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A typedef for a 32bit signed integer type.  The size depends on    */
+  /*    the configuration.                                                 */
+  /*                                                                       */
+  typedef signed XXX  FT_Int32;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    FT_UInt32                                                          */
+  /*                                                                       */
+  /*    A typedef for a 32bit unsigned integer type.  The size depends on  */
+  /*    the configuration.                                                 */
+  /*                                                                       */
+  typedef unsigned XXX  FT_UInt32;
+
+  /* */
+
+#endif
+
 #if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
 
   typedef signed int      FT_Int32;
 #if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
 
   typedef signed int      FT_Int32;
@@ -160,6 +221,7 @@ FT_BEGIN_HEADER
 #error "no 32bit type found -- please check your configuration files"
 #endif
 
 #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 >= (32 / FT_CHAR_BIT)
 
   /* look up an integer type that is at least 32 bits */
 #if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
 
@@ -215,17 +277,12 @@ FT_BEGIN_HEADER
 #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
 
 
 #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
-
-
   /*************************************************************************/
   /*                                                                       */
   /* A 64-bit data type will create compilation problems if you compile    */
   /*************************************************************************/
   /*                                                                       */
   /* 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.        */
+  /* in strict ANSI mode.  To avoid them, we disable its use if __STDC__   */
+  /* is defined.  You can however ignore this rule by defining the         */
+  /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro.                     */
   /*                                                                       */
 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
 
   /*                                                                       */
 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
 
@@ -240,6 +297,86 @@ FT_BEGIN_HEADER
 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
 
 
 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
 
 
+#define FT_BEGIN_STMNT  do {
+#define FT_END_STMNT    } while ( 0 )
+#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
+
+
+#ifndef  FT_CONFIG_OPTION_NO_ASSEMBLER
+  /* Provide assembler fragments for performance-critical functions. */
+  /* These must be defined `static __inline__' with GCC.             */
+
+#ifdef __GNUC__
+
+#if defined( __arm__ ) && !defined( __thumb__ )
+#define FT_MULFIX_ASSEMBLER  FT_MulFix_arm
+
+  /* documentation is in freetype.h */
+
+  static __inline__ FT_Int32
+  FT_MulFix_arm( FT_Int32  a,
+                 FT_Int32  b )
+  {
+    register FT_Int32  t, t2;
+
+
+    asm __volatile__ (
+      "smull  %1, %2, %4, %3\n\t"   /* (lo=%1,hi=%2) = a*b */
+      "mov    %0, %2, asr #31\n\t"  /* %0  = (hi >> 31) */
+      "add    %0, %0, #0x8000\n\t"  /* %0 += 0x8000 */
+      "adds   %1, %1, %0\n\t"       /* %1 += %0 */
+      "adc    %2, %2, #0\n\t"       /* %2 += carry */
+      "mov    %0, %1, lsr #16\n\t"  /* %0  = %1 >> 16 */
+      "orr    %0, %2, lsl #16\n\t"  /* %0 |= %2 << 16 */
+      : "=r"(a), "=&r"(t2), "=&r"(t)
+      : "r"(a), "r"(b) );
+    return a;
+  }
+
+#endif /* __arm__ && !__thumb__ */
+
+#if defined( i386 )
+#define FT_MULFIX_ASSEMBLER  FT_MulFix_i386
+
+  /* documentation is in freetype.h */
+
+  static __inline__ FT_Int32
+  FT_MulFix_i386( FT_Int32  a,
+                  FT_Int32  b )
+  {
+    register FT_Int32  result;
+
+
+    __asm__ __volatile__ (
+      "imul  %%edx\n"
+      "movl  %%edx, %%ecx\n"
+      "sarl  $31, %%ecx\n"
+      "addl  $0x8000, %%ecx\n"
+      "addl  %%ecx, %%eax\n"
+      "adcl  $0, %%edx\n"
+      "shrl  $16, %%eax\n"
+      "shll  $16, %%edx\n"
+      "addl  %%edx, %%eax\n"
+      : "=a"(result), "=d"(b)
+      : "a"(a), "d"(b)
+      : "%ecx", "cc" );
+    return result;
+  }
+
+#endif /* i386 */
+
+#endif /* __GNUC__ */
+
+#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
+
+
+#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
+#ifdef FT_MULFIX_ASSEMBLER
+#define FT_MULFIX_INLINED  FT_MULFIX_ASSEMBLER
+#endif
+#endif
+
+
 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
 
 #define FT_LOCAL( x )      static  x
 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
 
 #define FT_LOCAL( x )      static  x
index b957d05..b63945d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Build macros of the FreeType 2 library.                              */
 /*                                                                         */
 /*                                                                         */
 /*    Build macros of the FreeType 2 library.                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -74,7 +74,7 @@
   /*                                                                       */
   /* <Description>                                                         */
   /*    The following macros are defined to the name of specific           */
   /*                                                                       */
   /* <Description>                                                         */
   /*    The following macros are defined to the name of specific           */
-  /*    FreeType 2 header files.  They can be used directly in #include    */
+  /*    FreeType~2 header files.  They can be used directly in #include    */
   /*    statements as in:                                                  */
   /*                                                                       */
   /*    {                                                                  */
   /*    statements as in:                                                  */
   /*                                                                       */
   /*    {                                                                  */
   /*                                                                       */
   /*    There are several reasons why we are now using macros to name      */
   /*    public header files.  The first one is that such macros are not    */
   /*                                                                       */
   /*    There are several reasons why we are now using macros to name      */
   /*    public header files.  The first one is that such macros are not    */
-  /*    limited to the infamous 8.3 naming rule required by DOS (and       */
+  /*    limited to the infamous 8.3~naming rule required by DOS (and       */
   /*    `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h').   */
   /*                                                                       */
   /*    The second reason is that it allows for more flexibility in the    */
   /*    `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h').   */
   /*                                                                       */
   /*    The second reason is that it allows for more flexibility in the    */
-  /*    way FreeType 2 is installed on a given system.                     */
+  /*    way FreeType~2 is installed on a given system.                     */
   /*                                                                       */
   /*************************************************************************/
 
   /*                                                                       */
   /*************************************************************************/
 
    *
    * @description:
    *   A macro used in #include statements to name the file containing
    *
    * @description:
    *   A macro used in #include statements to name the file containing
-   *   FreeType 2 configuration data.
+   *   FreeType~2 configuration data.
    *
    */
 #ifndef FT_CONFIG_CONFIG_H
    *
    */
 #ifndef FT_CONFIG_CONFIG_H
    *
    * @description:
    *   A macro used in #include statements to name the file containing
    *
    * @description:
    *   A macro used in #include statements to name the file containing
-   *   FreeType 2 interface to the standard C library functions.
+   *   FreeType~2 interface to the standard C library functions.
    *
    */
 #ifndef FT_CONFIG_STANDARD_LIBRARY_H
    *
    */
 #ifndef FT_CONFIG_STANDARD_LIBRARY_H
    *
    * @description:
    *   A macro used in #include statements to name the file containing
    *
    * @description:
    *   A macro used in #include statements to name the file containing
-   *   FreeType 2 project-specific configuration options.
+   *   FreeType~2 project-specific configuration options.
    *
    */
 #ifndef FT_CONFIG_OPTIONS_H
    *
    */
 #ifndef FT_CONFIG_OPTIONS_H
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   list of FreeType 2 modules that are statically linked to new library
+   *   list of FreeType~2 modules that are statically linked to new library
    *   instances in @FT_Init_FreeType.
    *
    */
    *   instances in @FT_Init_FreeType.
    *
    */
 #define FT_CONFIG_MODULES_H  <freetype/config/ftmodule.h>
 #endif
 
 #define FT_CONFIG_MODULES_H  <freetype/config/ftmodule.h>
 #endif
 
+  /* */
 
   /* public headers */
 
 
   /* public headers */
 
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   base FreeType 2 API.
+   *   base FreeType~2 API.
    *
    */
 #define FT_FREETYPE_H  <freetype/freetype.h>
    *
    */
 #define FT_FREETYPE_H  <freetype/freetype.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   list of FreeType 2 error codes (and messages).
+   *   list of FreeType~2 error codes (and messages).
    *
    *   It is included by @FT_FREETYPE_H.
    *
    *
    *   It is included by @FT_FREETYPE_H.
    *
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   list of FreeType 2 module error offsets (and messages).
+   *   list of FreeType~2 module error offsets (and messages).
    *
    */
 #define FT_MODULE_ERRORS_H  <freetype/ftmoderr.h>
    *
    */
 #define FT_MODULE_ERRORS_H  <freetype/ftmoderr.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType 2 interface to low-level operations (i.e., memory management
+   *   FreeType~2 interface to low-level operations (i.e., memory management
    *   and stream i/o).
    *
    *   It is included by @FT_FREETYPE_H.
    *   and stream i/o).
    *
    *   It is included by @FT_FREETYPE_H.
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   basic data types defined by FreeType 2.
+   *   basic data types defined by FreeType~2.
    *
    *   It is included by @FT_FREETYPE_H.
    *
    *
    *   It is included by @FT_FREETYPE_H.
    *
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   list management API of FreeType 2.
+   *   list management API of FreeType~2.
    *
    *   (Most applications will never need to include this file.)
    *
    *
    *   (Most applications will never need to include this file.)
    *
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   scalable outline management API of FreeType 2.
+   *   scalable outline management API of FreeType~2.
    *
    */
 #define FT_OUTLINE_H  <freetype/ftoutln.h>
    *
    */
 #define FT_OUTLINE_H  <freetype/ftoutln.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   module management API of FreeType 2.
+   *   module management API of FreeType~2.
    *
    */
 #define FT_MODULE_H  <freetype/ftmodapi.h>
    *
    */
 #define FT_MODULE_H  <freetype/ftmodapi.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   renderer module management API of FreeType 2.
+   *   renderer module management API of FreeType~2.
    *
    */
 #define FT_RENDER_H  <freetype/ftrender.h>
    *
    */
 #define FT_RENDER_H  <freetype/ftrender.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   types and API specific to the Type 1 format.
+   *   types and API specific to the Type~1 format.
    *
    */
 #define FT_TYPE1_TABLES_H  <freetype/t1tables.h>
    *
    */
 #define FT_TYPE1_TABLES_H  <freetype/t1tables.h>
 #define FT_BDF_H  <freetype/ftbdf.h>
 
 
 #define FT_BDF_H  <freetype/ftbdf.h>
 
 
+  /*************************************************************************
+   *
+   * @macro:
+   *   FT_CID_H
+   *
+   * @description:
+   *   A macro used in #include statements to name the file containing the
+   *   definitions of an API which access CID font information from a
+   *   face.
+   *
+   */
+#define FT_CID_H  <freetype/ftcid.h>
+
+
   /*************************************************************************
    *
    * @macro:
   /*************************************************************************
    *
    * @macro:
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   API of the optional FreeType 2 cache sub-system.
+   *   API of the optional FreeType~2 cache sub-system.
    *
    */
 #define FT_CACHE_H  <freetype/ftcache.h>
    *
    */
 #define FT_CACHE_H  <freetype/ftcache.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   `glyph image' API of the FreeType 2 cache sub-system.
+   *   `glyph image' API of the FreeType~2 cache sub-system.
    *
    *   It is used to define a cache for @FT_Glyph elements.  You can also
    *   use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
    *
    *   It is used to define a cache for @FT_Glyph elements.  You can also
    *   use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   `small bitmaps' API of the FreeType 2 cache sub-system.
+   *   `small bitmaps' API of the FreeType~2 cache sub-system.
    *
    *   It is used to define a cache for small glyph bitmaps in a relatively
    *   memory-efficient way.  You can also use the API defined in
    *
    *   It is used to define a cache for small glyph bitmaps in a relatively
    *   memory-efficient way.  You can also use the API defined in
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   `charmap' API of the FreeType 2 cache sub-system.
+   *   `charmap' API of the FreeType~2 cache sub-system.
    *
    *   This macro is deprecated.  Simply include @FT_CACHE_H to have all
    *   charmap-based cache declarations.
    *
    *   This macro is deprecated.  Simply include @FT_CACHE_H to have all
    *   charmap-based cache declarations.
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   Macintosh-specific FreeType 2 API.  The latter is used to access
+   *   Macintosh-specific FreeType~2 API.  The latter is used to access
    *   fonts embedded in resource forks.
    *
    *   This header file must be explicitly included by client applications
    *   fonts embedded in resource forks.
    *
    *   This header file must be explicitly included by client applications
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   optional multiple-masters management API of FreeType 2.
+   *   optional multiple-masters management API of FreeType~2.
    *
    */
 #define FT_MULTIPLE_MASTERS_H  <freetype/ftmm.h>
    *
    */
 #define FT_MULTIPLE_MASTERS_H  <freetype/ftmm.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   optional FreeType 2 API which accesses embedded `name' strings in
+   *   optional FreeType~2 API which accesses embedded `name' strings in
    *   SFNT-based font formats (i.e., TrueType and OpenType).
    *
    */
    *   SFNT-based font formats (i.e., TrueType and OpenType).
    *
    */
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   optional FreeType 2 API which validates OpenType tables (BASE, GDEF,
+   *   optional FreeType~2 API which validates OpenType tables (BASE, GDEF,
    *   GPOS, GSUB, JSTF).
    *
    */
    *   GPOS, GSUB, JSTF).
    *
    */
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   optional FreeType 2 API which validates TrueTypeGX/AAT tables (feat,
+   *   optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat,
    *   mort, morx, bsln, just, kern, opbd, trak, prop).
    *
    */
    *   mort, morx, bsln, just, kern, opbd, trak, prop).
    *
    */
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType 2 API which accesses PFR-specific data.
+   *   FreeType~2 API which accesses PFR-specific data.
    *
    */
 #define FT_PFR_H  <freetype/ftpfr.h>
    *
    */
 #define FT_PFR_H  <freetype/ftpfr.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType 2 API which provides functions to stroke outline paths.
+   *   FreeType~2 API which provides functions to stroke outline paths.
    */
 #define FT_STROKER_H  <freetype/ftstroke.h>
 
    */
 #define FT_STROKER_H  <freetype/ftstroke.h>
 
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType 2 API which performs artificial obliquing and emboldening.
+   *   FreeType~2 API which performs artificial obliquing and emboldening.
    */
 #define FT_SYNTHESIS_H  <freetype/ftsynth.h>
 
    */
 #define FT_SYNTHESIS_H  <freetype/ftsynth.h>
 
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType 2 API which provides functions specific to the XFree86 and
+   *   FreeType~2 API which provides functions specific to the XFree86 and
    *   X.Org X11 servers.
    */
 #define FT_XFREE86_H  <freetype/ftxf86.h>
    *   X.Org X11 servers.
    */
 #define FT_XFREE86_H  <freetype/ftxf86.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType 2 API which performs trigonometric computations (e.g.,
+   *   FreeType~2 API which performs trigonometric computations (e.g.,
    *   cosines and arc tangents).
    */
 #define FT_TRIGONOMETRY_H  <freetype/fttrigon.h>
    *   cosines and arc tangents).
    */
 #define FT_TRIGONOMETRY_H  <freetype/fttrigon.h>
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType 2 API which performs color filtering for subpixel rendering.
+   *   FreeType~2 API which performs color filtering for subpixel rendering.
    */
 #define FT_LCD_FILTER_H  <freetype/ftlcdfil.h>
 
 
    */
 #define FT_LCD_FILTER_H  <freetype/ftlcdfil.h>
 
 
+  /*************************************************************************
+   *
+   * @macro:
+   *   FT_UNPATENTED_HINTING_H
+   *
+   * @description:
+   *   A macro used in #include statements to name the file containing the
+   *   FreeType~2 API which performs color filtering for subpixel rendering.
+   */
+#define FT_UNPATENTED_HINTING_H  <freetype/ttunpat.h>
+
+
+  /*************************************************************************
+   *
+   * @macro:
+   *   FT_INCREMENTAL_H
+   *
+   * @description:
+   *   A macro used in #include statements to name the file containing the
+   *   FreeType~2 API which performs color filtering for subpixel rendering.
+   */
+#define FT_INCREMENTAL_H  <freetype/ftincrem.h>
+
+
   /*************************************************************************
    *
    * @macro:
   /*************************************************************************
    *
    * @macro:
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType 2 API which returns entries from the TrueType GASP table.
+   *   FreeType~2 API which returns entries from the TrueType GASP table.
    */
 #define FT_GASP_H  <freetype/ftgasp.h>
 
 
    */
 #define FT_GASP_H  <freetype/ftgasp.h>
 
 
+  /*************************************************************************
+   *
+   * @macro:
+   *   FT_ADVANCES_H
+   *
+   * @description:
+   *   A macro used in #include statements to name the file containing the
+   *   FreeType~2 API which returns individual and ranged glyph advances.
+   */
+#define FT_ADVANCES_H  <freetype/ftadvanc.h>
+
+
   /* */
 
 #define FT_ERROR_DEFINITIONS_H  <freetype/fterrdef.h>
   /* */
 
 #define FT_ERROR_DEFINITIONS_H  <freetype/fterrdef.h>
index d92b0ee..76d271a 100644 (file)
  *
  */
 
  *
  */
 
-FT_USE_MODULE(autofit_module_class)
-FT_USE_MODULE(tt_driver_class)
-FT_USE_MODULE(t1_driver_class)
-FT_USE_MODULE(cff_driver_class)
-FT_USE_MODULE(t1cid_driver_class)
-FT_USE_MODULE(pfr_driver_class)
-FT_USE_MODULE(t42_driver_class)
-FT_USE_MODULE(winfnt_driver_class)
-FT_USE_MODULE(pcf_driver_class)
-FT_USE_MODULE(psaux_module_class)
-FT_USE_MODULE(psnames_module_class)
-FT_USE_MODULE(pshinter_module_class)
-FT_USE_MODULE(ft_raster1_renderer_class)
-FT_USE_MODULE(sfnt_module_class)
-FT_USE_MODULE(ft_smooth_renderer_class)
-FT_USE_MODULE(ft_smooth_lcd_renderer_class)
-FT_USE_MODULE(ft_smooth_lcdv_renderer_class)
-FT_USE_MODULE(bdf_driver_class)
+FT_USE_MODULE( FT_Module_Class, autofit_module_class )
+FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
+FT_USE_MODULE( FT_Module_Class, psaux_module_class )
+FT_USE_MODULE( FT_Module_Class, psnames_module_class )
+FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
+FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
+FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
 
 /* EOF */
 
 /* EOF */
index 5d99ae3..f725089 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    User-selectable configuration macros (specification only).           */
 /*                                                                         */
 /*                                                                         */
 /*    User-selectable configuration macros (specification only).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -112,7 +112,28 @@ FT_BEGIN_HEADER
   /*         file `ftconfig.h' either statically or through the            */
   /*         `configure' script on supported platforms.                    */
   /*                                                                       */
   /*         file `ftconfig.h' either statically or through the            */
   /*         `configure' script on supported platforms.                    */
   /*                                                                       */
-#undef  FT_CONFIG_OPTION_FORCE_INT64
+#undef FT_CONFIG_OPTION_FORCE_INT64
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* If this macro is defined, do not try to use an assembler version of   */
+  /* performance-critical functions (e.g. FT_MulFix).  You should only do  */
+  /* that to verify that the assembler function works properly, or to      */
+  /* execute benchmark tests of the various implementations.               */
+/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* If this macro is defined, try to use an inlined assembler version of  */
+  /* the `FT_MulFix' function, which is a `hotspot' when loading and       */
+  /* hinting glyphs, and which should be executed as fast as possible.     */
+  /*                                                                       */
+  /* Note that if your compiler or CPU is not supported, this will default */
+  /* to the standard and portable implementation found in `ftcalc.c'.      */
+  /*                                                                       */
+#define FT_CONFIG_OPTION_INLINE_MULFIX
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -163,7 +184,7 @@ FT_BEGIN_HEADER
   /*   Do not #undef this macro here since the build system might define   */
   /*   it for certain configurations only.                                 */
   /*                                                                       */
   /*   Do not #undef this macro here since the build system might define   */
   /*   it for certain configurations only.                                 */
   /*                                                                       */
-/* #define  FT_CONFIG_OPTION_SYSTEM_ZLIB */
+/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -204,27 +225,27 @@ FT_BEGIN_HEADER
   /*   Do not #undef these macros here since the build system might define */
   /*   them for certain configurations only.                               */
   /*                                                                       */
   /*   Do not #undef these macros here since the build system might define */
   /*   them for certain configurations only.                               */
   /*                                                                       */
-/* #define  FT_EXPORT(x)       extern x */
-/* #define  FT_EXPORT_DEF(x)   x */
+/* #define FT_EXPORT(x)      extern x */
+/* #define FT_EXPORT_DEF(x)  x */
 
 
   /*************************************************************************/
   /*                                                                       */
   /* Glyph Postscript Names handling                                       */
   /*                                                                       */
 
 
   /*************************************************************************/
   /*                                                                       */
   /* Glyph Postscript Names handling                                       */
   /*                                                                       */
-  /*   By default, FreeType 2 is compiled with the `PSNames' module.  This */
+  /*   By default, FreeType 2 is compiled with the `psnames' module.  This */
   /*   module is in charge of converting a glyph name string into a        */
   /*   Unicode value, or return a Macintosh standard glyph name for the    */
   /*   use with the TrueType `post' table.                                 */
   /*                                                                       */
   /*   module is in charge of converting a glyph name string into a        */
   /*   Unicode value, or return a Macintosh standard glyph name for the    */
   /*   use with the TrueType `post' table.                                 */
   /*                                                                       */
-  /*   Undefine this macro if you do not want `PSNames' compiled in your   */
+  /*   Undefine this macro if you do not want `psnames' compiled in your   */
   /*   build of FreeType.  This has the following effects:                 */
   /*                                                                       */
   /*   - The TrueType driver will provide its own set of glyph names,      */
   /*     if you build it to support postscript names in the TrueType       */
   /*     `post' table.                                                     */
   /*                                                                       */
   /*   build of FreeType.  This has the following effects:                 */
   /*                                                                       */
   /*   - The TrueType driver will provide its own set of glyph names,      */
   /*     if you build it to support postscript names in the TrueType       */
   /*     `post' table.                                                     */
   /*                                                                       */
-  /*   - The Type 1 driver will not be able to synthetize a Unicode        */
+  /*   - The Type 1 driver will not be able to synthesize a Unicode        */
   /*     charmap out of the glyphs found in the fonts.                     */
   /*                                                                       */
   /*   You would normally undefine this configuration macro when building  */
   /*     charmap out of the glyphs found in the fonts.                     */
   /*                                                                       */
   /*   You would normally undefine this configuration macro when building  */
@@ -240,12 +261,12 @@ FT_BEGIN_HEADER
   /*   By default, FreeType 2 is built with the `PSNames' module compiled  */
   /*   in.  Among other things, the module is used to convert a glyph name */
   /*   into a Unicode value.  This is especially useful in order to        */
   /*   By default, FreeType 2 is built with the `PSNames' module compiled  */
   /*   in.  Among other things, the module is used to convert a glyph name */
   /*   into a Unicode value.  This is especially useful in order to        */
-  /*   synthetize on the fly a Unicode charmap from the CFF/Type 1 driver  */
+  /*   synthesize on the fly a Unicode charmap from the CFF/Type 1 driver  */
   /*   through a big table named the `Adobe Glyph List' (AGL).             */
   /*                                                                       */
   /*   Undefine this macro if you do not want the Adobe Glyph List         */
   /*   compiled in your `PSNames' module.  The Type 1 driver will not be   */
   /*   through a big table named the `Adobe Glyph List' (AGL).             */
   /*                                                                       */
   /*   Undefine this macro if you do not want the Adobe Glyph List         */
   /*   compiled in your `PSNames' module.  The Type 1 driver will not be   */
-  /*   able to synthetize a Unicode charmap out of the glyphs found in the */
+  /*   able to synthesize a Unicode charmap out of the glyphs found in the */
   /*   fonts.                                                              */
   /*                                                                       */
 #define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
   /*   fonts.                                                              */
   /*                                                                       */
 #define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
@@ -375,6 +396,20 @@ FT_BEGIN_HEADER
 #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
 
 
 #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* Position Independent Code                                             */
+  /*                                                                       */
+  /*   If this macro is set (which is _not_ the default), FreeType2 will   */
+  /*   avoid creating constants that require address fixups. Instead the   */
+  /*   constants will be moved into a struct and additional intialization  */
+  /*   code will be used.                                                  */
+  /*                                                                       */
+  /*   Setting this macro is needed for systems that prohibit address      */
+  /*   fixups, such as BREW.                                               */
+  /*                                                                       */
+/* #define FT_CONFIG_OPTION_PIC */
+
 
   /*************************************************************************/
   /*************************************************************************/
 
   /*************************************************************************/
   /*************************************************************************/
@@ -418,7 +453,7 @@ FT_BEGIN_HEADER
   /* does not contain any glyph name though.                               */
   /*                                                                       */
   /* Accessing SFNT names is done through the functions declared in        */
   /* does not contain any glyph name though.                               */
   /*                                                                       */
   /* Accessing SFNT names is done through the functions declared in        */
-  /* `freetype/ftnames.h'.                                                 */
+  /* `freetype/ftsnames.h'.                                                */
   /*                                                                       */
 #define TT_CONFIG_OPTION_SFNT_NAMES
 
   /*                                                                       */
 #define TT_CONFIG_OPTION_SFNT_NAMES
 
@@ -436,6 +471,8 @@ FT_BEGIN_HEADER
 #define TT_CONFIG_CMAP_FORMAT_8
 #define TT_CONFIG_CMAP_FORMAT_10
 #define TT_CONFIG_CMAP_FORMAT_12
 #define TT_CONFIG_CMAP_FORMAT_8
 #define TT_CONFIG_CMAP_FORMAT_10
 #define TT_CONFIG_CMAP_FORMAT_12
+#define TT_CONFIG_CMAP_FORMAT_13
+#define TT_CONFIG_CMAP_FORMAT_14
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -466,9 +503,9 @@ FT_BEGIN_HEADER
   /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version  */
   /* of the TrueType bytecode interpreter is used that doesn't implement   */
   /* any of the patented opcodes and algorithms.  Note that the            */
   /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version  */
   /* of the TrueType bytecode interpreter is used that doesn't implement   */
   /* any of the patented opcodes and algorithms.  Note that the            */
-  /* the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you     */
-  /* define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; with other words,       */
-  /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                */
+  /* TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you define  */
+  /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, either define  */
+  /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                              */
   /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time.    */
   /*                                                                       */
   /* This macro is only useful for a small number of font files (mostly    */
   /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time.    */
   /*                                                                       */
   /* This macro is only useful for a small number of font files (mostly    */
@@ -505,7 +542,7 @@ FT_BEGIN_HEADER
   /*     ...                                                               */
   /*   }                                                                   */
   /*                                                                       */
   /*     ...                                                               */
   /*   }                                                                   */
   /*                                                                       */
-/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */
+//#define TT_CONFIG_OPTION_UNPATENTED_HINTING
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -624,7 +661,8 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
-  /* Compile autofit module with CJK script support.                       */
+  /* Compile autofit module with CJK (Chinese, Japanese, Korean) script    */
+  /* support.                                                              */
   /*                                                                       */
 #define AF_CONFIG_OPTION_CJK
 
   /*                                                                       */
 #define AF_CONFIG_OPTION_CJK
 
@@ -632,7 +670,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* Compile autofit module with Indic script support.                     */
   /*                                                                       */
   /*                                                                       */
   /* Compile autofit module with Indic script support.                     */
   /*                                                                       */
-/* #define AF_CONFIG_OPTION_INDIC */
+#define AF_CONFIG_OPTION_INDIC
 
   /* */
 
 
   /* */
 
@@ -651,11 +689,12 @@ FT_BEGIN_HEADER
 
 
   /*
 
 
   /*
-   * This variable is defined if either unpatented or native TrueType
+   * This macro is defined if either unpatented or native TrueType
    * hinting is requested by the definitions above.
    */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 #define  TT_USE_BYTECODE_INTERPRETER
    * hinting is requested by the definitions above.
    */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 #define  TT_USE_BYTECODE_INTERPRETER
+#undef   TT_CONFIG_OPTION_UNPATENTED_HINTING
 #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
 #define  TT_USE_BYTECODE_INTERPRETER
 #endif
 #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
 #define  TT_USE_BYTECODE_INTERPRETER
 #endif
index f923f3e..30ec14e 100644 (file)
@@ -5,7 +5,7 @@
 /*    ANSI-specific library and header configuration file (specification   */
 /*    only).                                                               */
 /*                                                                         */
 /*    ANSI-specific library and header configuration file (specification   */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007 by                        */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   /* In these case, `ftconfig.h' will refuse to compile anyway with a   */
   /* message like `couldn't find 32-bit type' or something similar.     */
   /*                                                                    */
   /* In these case, `ftconfig.h' will refuse to compile anyway with a   */
   /* message like `couldn't find 32-bit type' or something similar.     */
   /*                                                                    */
-  /* IMPORTANT NOTE: We do not define aliases for heap management and   */
-  /*                 i/o routines (i.e. malloc/free/fopen/fread/...)    */
-  /*                 since these functions should all be encapsulated   */
-  /*                 by platform-specific implementations of            */
-  /*                 `ftsystem.c'.                                      */
-  /*                                                                    */
   /**********************************************************************/
 
 
   /**********************************************************************/
 
 
@@ -67,6 +61,7 @@
 
 #define FT_CHAR_BIT   CHAR_BIT
 #define FT_INT_MAX    INT_MAX
 
 #define FT_CHAR_BIT   CHAR_BIT
 #define FT_INT_MAX    INT_MAX
+#define FT_INT_MIN    INT_MIN
 #define FT_UINT_MAX   UINT_MAX
 #define FT_ULONG_MAX  ULONG_MAX
 
 #define FT_UINT_MAX   UINT_MAX
 #define FT_ULONG_MAX  ULONG_MAX
 
 
 #define ft_qsort  qsort
 
 
 #define ft_qsort  qsort
 
-#define ft_exit   exit    /* only used to exit from unhandled exceptions */
-
 
   /**********************************************************************/
   /*                                                                    */
 
   /**********************************************************************/
   /*                                                                    */
index dbca087..9e74f11 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType high-level API and common types (specification only).       */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType high-level API and common types (specification only).       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #endif
 
 
 #endif
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* The `raster' component duplicates some of the declarations in         */
-  /* freetype.h for stand-alone use if _FREETYPE_ isn't defined.           */
-  /*                                                                       */
-  /*************************************************************************/
-
-
 #ifndef __FREETYPE_H__
 #define __FREETYPE_H__
 
 #ifndef __FREETYPE_H__
 #define __FREETYPE_H__
 
@@ -60,8 +52,8 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    FreeType assumes that structures allocated by the user and passed  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FreeType assumes that structures allocated by the user and passed  */
-  /*    as arguments are zeroed out except for the actual data.  With      */
-  /*    other words, it is recommended to use `calloc' (or variants of it) */
+  /*    as arguments are zeroed out except for the actual data.  In other  */
+  /*    words, it is recommended to use `calloc' (or variants of it)       */
   /*    instead of `malloc' for allocation.                                */
   /*                                                                       */
   /*************************************************************************/
   /*    instead of `malloc' for allocation.                                */
   /*                                                                       */
   /*************************************************************************/
@@ -86,10 +78,10 @@ FT_BEGIN_HEADER
   /*    Base Interface                                                     */
   /*                                                                       */
   /* <Abstract>                                                            */
   /*    Base Interface                                                     */
   /*                                                                       */
   /* <Abstract>                                                            */
-  /*    The FreeType 2 base font interface.                                */
+  /*    The FreeType~2 base font interface.                                */
   /*                                                                       */
   /* <Description>                                                         */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    This section describes the public high-level API of FreeType 2.    */
+  /*    This section describes the public high-level API of FreeType~2.    */
   /*                                                                       */
   /* <Order>                                                               */
   /*    FT_Library                                                         */
   /*                                                                       */
   /* <Order>                                                               */
   /*    FT_Library                                                         */
@@ -191,6 +183,15 @@ FT_BEGIN_HEADER
   /*    FT_Set_Charmap                                                     */
   /*    FT_Get_Charmap_Index                                               */
   /*                                                                       */
   /*    FT_Set_Charmap                                                     */
   /*    FT_Get_Charmap_Index                                               */
   /*                                                                       */
+  /*    FT_FSTYPE_INSTALLABLE_EMBEDDING                                    */
+  /*    FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING                             */
+  /*    FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING                              */
+  /*    FT_FSTYPE_EDITABLE_EMBEDDING                                       */
+  /*    FT_FSTYPE_NO_SUBSETTING                                            */
+  /*    FT_FSTYPE_BITMAP_EMBEDDING_ONLY                                    */
+  /*                                                                       */
+  /*    FT_Get_FSType_Flags                                                */
+  /*                                                                       */
   /*************************************************************************/
 
 
   /*************************************************************************/
 
 
@@ -386,8 +387,8 @@ FT_BEGIN_HEADER
   /*    Use @FT_Done_Face to destroy it (along with its slot and sizes).   */
   /*                                                                       */
   /* <Also>                                                                */
   /*    Use @FT_Done_Face to destroy it (along with its slot and sizes).   */
   /*                                                                       */
   /* <Also>                                                                */
-  /*    The @FT_FaceRec details the publicly accessible fields of a given  */
-  /*    face object.                                                       */
+  /*    See @FT_FaceRec for the publicly accessible fields of a given face */
+  /*    object.                                                            */
   /*                                                                       */
   typedef struct FT_FaceRec_*  FT_Face;
 
   /*                                                                       */
   typedef struct FT_FaceRec_*  FT_Face;
 
@@ -416,8 +417,8 @@ FT_BEGIN_HEADER
   /*    activated at any given time per face.                              */
   /*                                                                       */
   /* <Also>                                                                */
   /*    activated at any given time per face.                              */
   /*                                                                       */
   /* <Also>                                                                */
-  /*    The @FT_SizeRec structure details the publicly accessible fields   */
-  /*    of a given size object.                                            */
+  /*    See @FT_SizeRec for the publicly accessible fields of a given size */
+  /*    object.                                                            */
   /*                                                                       */
   typedef struct FT_SizeRec_*  FT_Size;
 
   /*                                                                       */
   typedef struct FT_SizeRec_*  FT_Size;
 
@@ -429,7 +430,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    A handle to a given `glyph slot'.  A slot is a container where it  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    A handle to a given `glyph slot'.  A slot is a container where it  */
-  /*    is possible to load any one of the glyphs contained in its parent  */
+  /*    is possible to load any of the glyphs contained in its parent      */
   /*    face.                                                              */
   /*                                                                       */
   /*    In other words, each time you call @FT_Load_Glyph or               */
   /*    face.                                                              */
   /*                                                                       */
   /*    In other words, each time you call @FT_Load_Glyph or               */
@@ -438,7 +439,7 @@ FT_BEGIN_HEADER
   /*    other control information.                                         */
   /*                                                                       */
   /* <Also>                                                                */
   /*    other control information.                                         */
   /*                                                                       */
   /* <Also>                                                                */
-  /*    @FT_GlyphSlotRec details the publicly accessible glyph fields.     */
+  /*    See @FT_GlyphSlotRec for the publicly accessible glyph fields.     */
   /*                                                                       */
   typedef struct FT_GlyphSlotRec_*  FT_GlyphSlot;
 
   /*                                                                       */
   typedef struct FT_GlyphSlotRec_*  FT_GlyphSlot;
 
@@ -469,8 +470,8 @@ FT_BEGIN_HEADER
   /*    the list and automatically activates it.                           */
   /*                                                                       */
   /* <Also>                                                                */
   /*    the list and automatically activates it.                           */
   /*                                                                       */
   /* <Also>                                                                */
-  /*    The @FT_CharMapRec details the publicly accessible fields of a     */
-  /*    given character map.                                               */
+  /*    See @FT_CharMapRec for the publicly accessible fields of a given   */
+  /*    character map.                                                     */
   /*                                                                       */
   typedef struct FT_CharMapRec_*  FT_CharMap;
 
   /*                                                                       */
   typedef struct FT_CharMapRec_*  FT_CharMap;
 
@@ -485,7 +486,7 @@ FT_BEGIN_HEADER
   /*    used to define `encoding' identifiers (see @FT_Encoding).          */
   /*                                                                       */
   /* <Note>                                                                */
   /*    used to define `encoding' identifiers (see @FT_Encoding).          */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    Since many 16bit compilers don't like 32bit enumerations, you      */
+  /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */
   /*    should redefine this macro in case of problems to something like   */
   /*    this:                                                              */
   /*                                                                       */
   /*    should redefine this macro in case of problems to something like   */
   /*    this:                                                              */
   /*                                                                       */
@@ -518,131 +519,132 @@ FT_BEGIN_HEADER
   /* <Note>                                                                */
   /*    Despite the name, this enumeration lists specific character        */
   /*    repertories (i.e., charsets), and not text encoding methods (e.g., */
   /* <Note>                                                                */
   /*    Despite the name, this enumeration lists specific character        */
   /*    repertories (i.e., charsets), and not text encoding methods (e.g., */
-  /*    UTF-8, UTF-16, GB2312_EUC, etc.).                                  */
-  /*                                                                       */
-  /*    Because of 32-bit charcodes defined in Unicode (i.e., surrogates), */
-  /*    all character codes must be expressed as FT_Longs.                 */
+  /*    UTF-8, UTF-16, etc.).                                              */
   /*                                                                       */
   /*    Other encodings might be defined in the future.                    */
   /*                                                                       */
   /* <Values>                                                              */
   /*                                                                       */
   /*    Other encodings might be defined in the future.                    */
   /*                                                                       */
   /* <Values>                                                              */
-  /*   FT_ENCODING_NONE ::                                                 */
-  /*     The encoding value 0 is reserved.                                 */
+  /*    FT_ENCODING_NONE ::                                                */
+  /*      The encoding value~0 is reserved.                                */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_UNICODE ::                                              */
-  /*     Corresponds to the Unicode character set.  This value covers      */
-  /*     all versions of the Unicode repertoire, including ASCII and       */
-  /*     Latin-1.  Most fonts include a Unicode charmap, but not all       */
-  /*     of them.                                                          */
+  /*    FT_ENCODING_UNICODE ::                                             */
+  /*      Corresponds to the Unicode character set.  This value covers     */
+  /*      all versions of the Unicode repertoire, including ASCII and      */
+  /*      Latin-1.  Most fonts include a Unicode charmap, but not all      */
+  /*      of them.                                                         */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_MS_SYMBOL ::                                            */
-  /*     Corresponds to the Microsoft Symbol encoding, used to encode      */
-  /*     mathematical symbols in the 32..255 character code range.  For    */
-  /*     more information, see `http://www.ceviz.net/symbol.htm'.          */
+  /*      For example, if you want to access Unicode value U+1F028 (and    */
+  /*      the font contains it), use value 0x1F028 as the input value for  */
+  /*      @FT_Get_Char_Index.                                              */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_SJIS ::                                                 */
-  /*     Corresponds to Japanese SJIS encoding.  More info at              */
-  /*     at `http://langsupport.japanreference.com/encoding.shtml'.        */
-  /*     See note on multi-byte encodings below.                           */
+  /*    FT_ENCODING_MS_SYMBOL ::                                           */
+  /*      Corresponds to the Microsoft Symbol encoding, used to encode     */
+  /*      mathematical symbols in the 32..255 character code range.  For   */
+  /*      more information, see `http://www.ceviz.net/symbol.htm'.         */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_GB2312 ::                                               */
-  /*     Corresponds to an encoding system for Simplified Chinese as used  */
-  /*     used in mainland China.                                           */
+  /*    FT_ENCODING_SJIS ::                                                */
+  /*      Corresponds to Japanese SJIS encoding.  More info at             */
+  /*      at `http://langsupport.japanreference.com/encoding.shtml'.       */
+  /*      See note on multi-byte encodings below.                          */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_BIG5 ::                                                 */
-  /*     Corresponds to an encoding system for Traditional Chinese as used */
-  /*     in Taiwan and Hong Kong.                                          */
+  /*    FT_ENCODING_GB2312 ::                                              */
+  /*      Corresponds to an encoding system for Simplified Chinese as used */
+  /*      used in mainland China.                                          */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_WANSUNG ::                                              */
-  /*     Corresponds to the Korean encoding system known as Wansung.       */
-  /*     For more information see                                          */
-  /*     `http://www.microsoft.com/typography/unicode/949.txt'.            */
+  /*    FT_ENCODING_BIG5 ::                                                */
+  /*      Corresponds to an encoding system for Traditional Chinese as     */
+  /*      used in Taiwan and Hong Kong.                                    */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_JOHAB ::                                                */
-  /*     The Korean standard character set (KS C-5601-1992), which         */
-  /*     corresponds to MS Windows code page 1361.  This character set     */
-  /*     includes all possible Hangeul character combinations.             */
+  /*    FT_ENCODING_WANSUNG ::                                             */
+  /*      Corresponds to the Korean encoding system known as Wansung.      */
+  /*      For more information see                                         */
+  /*      `http://www.microsoft.com/typography/unicode/949.txt'.           */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_ADOBE_LATIN_1 ::                                        */
-  /*     Corresponds to a Latin-1 encoding as defined in a Type 1          */
-  /*     Postscript font.  It is limited to 256 character codes.           */
+  /*    FT_ENCODING_JOHAB ::                                               */
+  /*      The Korean standard character set (KS~C 5601-1992), which        */
+  /*      corresponds to MS Windows code page 1361.  This character set    */
+  /*      includes all possible Hangeul character combinations.            */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_ADOBE_STANDARD ::                                       */
-  /*     Corresponds to the Adobe Standard encoding, as found in Type 1,   */
-  /*     CFF, and OpenType/CFF fonts.  It is limited to 256 character      */
-  /*     codes.                                                            */
+  /*    FT_ENCODING_ADOBE_LATIN_1 ::                                       */
+  /*      Corresponds to a Latin-1 encoding as defined in a Type~1         */
+  /*      PostScript font.  It is limited to 256 character codes.          */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_ADOBE_EXPERT ::                                         */
-  /*     Corresponds to the Adobe Expert encoding, as found in Type 1,     */
-  /*     CFF, and OpenType/CFF fonts.  It is limited to 256 character      */
-  /*     codes.                                                            */
+  /*    FT_ENCODING_ADOBE_STANDARD ::                                      */
+  /*      Corresponds to the Adobe Standard encoding, as found in Type~1,  */
+  /*      CFF, and OpenType/CFF fonts.  It is limited to 256 character     */
+  /*      codes.                                                           */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_ADOBE_CUSTOM ::                                         */
-  /*     Corresponds to a custom encoding, as found in Type 1, CFF, and    */
-  /*     OpenType/CFF fonts.  It is limited to 256 character codes.        */
+  /*    FT_ENCODING_ADOBE_EXPERT ::                                        */
+  /*      Corresponds to the Adobe Expert encoding, as found in Type~1,    */
+  /*      CFF, and OpenType/CFF fonts.  It is limited to 256 character     */
+  /*      codes.                                                           */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_APPLE_ROMAN ::                                          */
-  /*     Corresponds to the 8-bit Apple roman encoding.  Many TrueType and */
-  /*     OpenType fonts contain a charmap for this encoding, since older   */
-  /*     versions of Mac OS are able to use it.                            */
+  /*    FT_ENCODING_ADOBE_CUSTOM ::                                        */
+  /*      Corresponds to a custom encoding, as found in Type~1, CFF, and   */
+  /*      OpenType/CFF fonts.  It is limited to 256 character codes.       */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_OLD_LATIN_2 ::                                          */
-  /*     This value is deprecated and was never used nor reported by       */
-  /*     FreeType.  Don't use or test for it.                              */
+  /*    FT_ENCODING_APPLE_ROMAN ::                                         */
+  /*      Corresponds to the 8-bit Apple roman encoding.  Many TrueType    */
+  /*      and OpenType fonts contain a charmap for this encoding, since    */
+  /*      older versions of Mac OS are able to use it.                     */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_MS_SJIS ::                                              */
-  /*     Same as FT_ENCODING_SJIS.  Deprecated.                            */
+  /*    FT_ENCODING_OLD_LATIN_2 ::                                         */
+  /*      This value is deprecated and was never used nor reported by      */
+  /*      FreeType.  Don't use or test for it.                             */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_MS_GB2312 ::                                            */
-  /*     Same as FT_ENCODING_GB2312.  Deprecated.                          */
+  /*    FT_ENCODING_MS_SJIS ::                                             */
+  /*      Same as FT_ENCODING_SJIS.  Deprecated.                           */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_MS_BIG5 ::                                              */
-  /*     Same as FT_ENCODING_BIG5.  Deprecated.                            */
+  /*    FT_ENCODING_MS_GB2312 ::                                           */
+  /*      Same as FT_ENCODING_GB2312.  Deprecated.                         */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_MS_WANSUNG ::                                           */
-  /*     Same as FT_ENCODING_WANSUNG.  Deprecated.                         */
+  /*    FT_ENCODING_MS_BIG5 ::                                             */
+  /*      Same as FT_ENCODING_BIG5.  Deprecated.                           */
   /*                                                                       */
   /*                                                                       */
-  /*   FT_ENCODING_MS_JOHAB ::                                             */
-  /*     Same as FT_ENCODING_JOHAB.  Deprecated.                           */
+  /*    FT_ENCODING_MS_WANSUNG ::                                          */
+  /*      Same as FT_ENCODING_WANSUNG.  Deprecated.                        */
+  /*                                                                       */
+  /*    FT_ENCODING_MS_JOHAB ::                                            */
+  /*      Same as FT_ENCODING_JOHAB.  Deprecated.                          */
   /*                                                                       */
   /* <Note>                                                                */
   /*                                                                       */
   /* <Note>                                                                */
-  /*   By default, FreeType automatically synthetizes a Unicode charmap    */
-  /*   for Postscript fonts, using their glyph names dictionaries.         */
-  /*   However, it also reports the encodings defined explicitly in 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  c     */
-  /*   @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, */
-  /*   don't 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.                                        */
+  /*    By default, FreeType automatically synthesizes a Unicode charmap   */
+  /*    for PostScript fonts, using their glyph names dictionaries.        */
+  /*    However, it also reports the encodings defined explicitly in 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, don't 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_
   {
   /*                                                                       */
   typedef enum  FT_Encoding_
   {
@@ -753,7 +755,7 @@ FT_BEGIN_HEADER
   /*    An opaque handle to an `FT_Face_InternalRec' structure, used to    */
   /*    model private data of a given @FT_Face object.                     */
   /*                                                                       */
   /*    An opaque handle to an `FT_Face_InternalRec' structure, used to    */
   /*    model private data of a given @FT_Face object.                     */
   /*                                                                       */
-  /*    This structure might change between releases of FreeType 2 and is  */
+  /*    This structure might change between releases of FreeType~2 and is  */
   /*    not generally available to client applications.                    */
   /*                                                                       */
   typedef struct FT_Face_InternalRec_*  FT_Face_Internal;
   /*    not generally available to client applications.                    */
   /*                                                                       */
   typedef struct FT_Face_InternalRec_*  FT_Face_Internal;
@@ -774,7 +776,7 @@ FT_BEGIN_HEADER
   /*                           a font file.                                */
   /*                                                                       */
   /*    face_index          :: The index of the face in the font file.  It */
   /*                           a font file.                                */
   /*                                                                       */
   /*    face_index          :: The index of the face in the font file.  It */
-  /*                           is set to 0 if there is only one face in    */
+  /*                           is set to~0 if there is only one face in    */
   /*                           the font file.                              */
   /*                                                                       */
   /*    face_flags          :: A set of bit flags that give important      */
   /*                           the font file.                              */
   /*                                                                       */
   /*    face_flags          :: A set of bit flags that give important      */
@@ -790,6 +792,9 @@ FT_BEGIN_HEADER
   /*                           `num_fixed_sizes'), it is set to the number */
   /*                           of outline glyphs.                          */
   /*                                                                       */
   /*                           `num_fixed_sizes'), it is set to the number */
   /*                           of outline glyphs.                          */
   /*                                                                       */
+  /*                           For CID-keyed fonts, this value gives the   */
+  /*                           highest CID used in the font.               */
+  /*                                                                       */
   /*    family_name         :: The face's family name.  This is an ASCII   */
   /*                           string, usually in English, which describes */
   /*                           the typeface's family (like `Times New      */
   /*    family_name         :: The face's family name.  This is an ASCII   */
   /*                           string, usually in English, which describes */
   /*                           the typeface's family (like `Times New      */
@@ -799,6 +804,8 @@ FT_BEGIN_HEADER
   /*                           provide localized and Unicode versions of   */
   /*                           this string.  Applications should use the   */
   /*                           format specific interface to access them.   */
   /*                           provide localized and Unicode versions of   */
   /*                           this string.  Applications should use the   */
   /*                           format specific interface to access them.   */
+  /*                           Can be NULL (e.g., in fonts embedded in a   */
+  /*                           PDF file).                                  */
   /*                                                                       */
   /*    style_name          :: The face's style name.  This is an ASCII    */
   /*                           string, usually in English, which describes */
   /*                                                                       */
   /*    style_name          :: The face's style name.  This is an ASCII    */
   /*                           string, usually in English, which describes */
@@ -836,9 +843,13 @@ FT_BEGIN_HEADER
   /*                           descender'.  Only relevant for scalable     */
   /*                           formats.                                    */
   /*                                                                       */
   /*                           descender'.  Only relevant for scalable     */
   /*                           formats.                                    */
   /*                                                                       */
+  /*                           Note that the bounding box might be off by  */
+  /*                           (at least) one pixel for hinted fonts.  See */
+  /*                           @FT_Size_Metrics for further discussion.    */
+  /*                                                                       */
   /*    units_per_EM        :: The number of font units per EM square for  */
   /*                           this face.  This is typically 2048 for      */
   /*    units_per_EM        :: The number of font units per EM square for  */
   /*                           this face.  This is typically 2048 for      */
-  /*                           TrueType fonts, and 1000 for Type 1 fonts.  */
+  /*                           TrueType fonts, and 1000 for Type~1 fonts.  */
   /*                           Only relevant for scalable formats.         */
   /*                                                                       */
   /*    ascender            :: The typographic ascender of the face,       */
   /*                           Only relevant for scalable formats.         */
   /*                                                                       */
   /*    ascender            :: The typographic ascender of the face,       */
@@ -874,7 +885,7 @@ FT_BEGIN_HEADER
   /*                           scalable formats.                           */
   /*                                                                       */
   /*    underline_position  :: The position, in font units, of the         */
   /*                           scalable formats.                           */
   /*                                                                       */
   /*    underline_position  :: The position, in font units, of the         */
-  /*                           underline line for this face.  It's the     */
+  /*                           underline line for this face.  It is the    */
   /*                           center of the underlining stem.  Only       */
   /*                           relevant for scalable formats.              */
   /*                                                                       */
   /*                           center of the underlining stem.  Only       */
   /*                           relevant for scalable formats.              */
   /*                                                                       */
@@ -889,8 +900,8 @@ FT_BEGIN_HEADER
   /*    charmap             :: The current active charmap for this face.   */
   /*                                                                       */
   /* <Note>                                                                */
   /*    charmap             :: The current active charmap for this face.   */
   /*                                                                       */
   /* <Note>                                                                */
-  /*   Fields may be changed after a call to @FT_Attach_File or            */
-  /*   @FT_Attach_Stream.                                                  */
+  /*    Fields may be changed after a call to @FT_Attach_File or           */
+  /*    @FT_Attach_Stream.                                                 */
   /*                                                                       */
   typedef struct  FT_FaceRec_
   {
   /*                                                                       */
   typedef struct  FT_FaceRec_
   {
@@ -1019,6 +1030,36 @@ FT_BEGIN_HEADER
   /*      the SFNT `gasp' table only if the native TrueType hinting engine */
   /*      (with the bytecode interpreter) is available and active.         */
   /*                                                                       */
   /*      the SFNT `gasp' table only if the native TrueType hinting engine */
   /*      (with the bytecode interpreter) is available and active.         */
   /*                                                                       */
+  /*    FT_FACE_FLAG_CID_KEYED ::                                          */
+  /*      Set if the font is CID-keyed.  In that case, the font is not     */
+  /*      accessed by glyph indices but by CID values.  For subsetted      */
+  /*      CID-keyed fonts this has the consequence that not all index      */
+  /*      values are a valid argument to FT_Load_Glyph.  Only the CID      */
+  /*      values for which corresponding glyphs in the subsetted font      */
+  /*      exist make FT_Load_Glyph return successfully; in all other cases */
+  /*      you get an `FT_Err_Invalid_Argument' error.                      */
+  /*                                                                       */
+  /*      Note that CID-keyed fonts which are in an SFNT wrapper don't     */
+  /*      have this flag set since the glyphs are accessed in the normal   */
+  /*      way (using contiguous indices); the `CID-ness' isn't visible to  */
+  /*      the application.                                                 */
+  /*                                                                       */
+  /*    FT_FACE_FLAG_TRICKY ::                                             */
+  /*      Set if the font is `tricky', this is, it always needs the        */
+  /*      font format's native hinting engine to get a reasonable result.  */
+  /*      A typical example is the Chinese font `mingli.ttf' which uses    */
+  /*      TrueType bytecode instructions to move and scale all of its      */
+  /*      subglyphs.                                                       */
+  /*                                                                       */
+  /*      It is not possible to autohint such fonts using                  */
+  /*      @FT_LOAD_FORCE_AUTOHINT; it will also ignore                     */
+  /*      @FT_LOAD_NO_HINTING.  You have to set both FT_LOAD_NO_HINTING    */
+  /*      and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
+  /*      probably never want this except for demonstration purposes.      */
+  /*                                                                       */
+  /*      Currently, there are six TrueType fonts in the list of tricky    */
+  /*      fonts; they are hard-coded in file `ttobjs.c'.                   */
+  /*                                                                       */
 #define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )
 #define FT_FACE_FLAG_FIXED_SIZES       ( 1L <<  1 )
 #define FT_FACE_FLAG_FIXED_WIDTH       ( 1L <<  2 )
 #define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )
 #define FT_FACE_FLAG_FIXED_SIZES       ( 1L <<  1 )
 #define FT_FACE_FLAG_FIXED_WIDTH       ( 1L <<  2 )
@@ -1031,8 +1072,8 @@ FT_BEGIN_HEADER
 #define FT_FACE_FLAG_GLYPH_NAMES       ( 1L <<  9 )
 #define FT_FACE_FLAG_EXTERNAL_STREAM   ( 1L << 10 )
 #define FT_FACE_FLAG_HINTER            ( 1L << 11 )
 #define FT_FACE_FLAG_GLYPH_NAMES       ( 1L <<  9 )
 #define FT_FACE_FLAG_EXTERNAL_STREAM   ( 1L << 10 )
 #define FT_FACE_FLAG_HINTER            ( 1L << 11 )
-
-  /* */
+#define FT_FACE_FLAG_CID_KEYED         ( 1L << 12 )
+#define FT_FACE_FLAG_TRICKY            ( 1L << 13 )
 
 
   /*************************************************************************
 
 
   /*************************************************************************
@@ -1087,7 +1128,7 @@ FT_BEGIN_HEADER
    *
    * @description:
    *   A macro that returns true whenever a face object contains a scalable
    *
    * @description:
    *   A macro that returns true whenever a face object contains a scalable
-   *   font face (true for TrueType, Type 1, Type 42, CID, OpenType/CFF,
+   *   font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
    *   and PFR font formats.
    *
    */
    *   and PFR font formats.
    *
    */
@@ -1143,8 +1184,6 @@ FT_BEGIN_HEADER
 #define FT_HAS_FIXED_SIZES( face ) \
           ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
 
 #define FT_HAS_FIXED_SIZES( face ) \
           ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
 
-  /* */
-
 
   /*************************************************************************
    *
 
   /*************************************************************************
    *
@@ -1187,9 +1226,41 @@ FT_BEGIN_HEADER
           ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
 
 
           ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
 
 
+  /*************************************************************************
+   *
+   * @macro:
+   *   FT_IS_CID_KEYED( face )
+   *
+   * @description:
+   *   A macro that returns true whenever a face object contains a CID-keyed
+   *   font.  See the discussion of @FT_FACE_FLAG_CID_KEYED for more
+   *   details.
+   *
+   *   If this macro is true, all functions defined in @FT_CID_H are
+   *   available.
+   *
+   */
+#define FT_IS_CID_KEYED( face ) \
+          ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
+
+
+  /*************************************************************************
+   *
+   * @macro:
+   *   FT_IS_TRICKY( face )
+   *
+   * @description:
+   *   A macro that returns true whenever a face represents a `tricky' font.
+   *   See the discussion of @FT_FACE_FLAG_TRICKY for more details.
+   *
+   */
+#define FT_IS_TRICKY( face ) \
+          ( face->face_flags & FT_FACE_FLAG_TRICKY )
+
+
   /*************************************************************************/
   /*                                                                       */
   /*************************************************************************/
   /*                                                                       */
-  /* <Constant>                                                            */
+  /* <Const>                                                               */
   /*    FT_STYLE_FLAG_XXX                                                  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_STYLE_FLAG_XXX                                                  */
   /*                                                                       */
   /* <Description>                                                         */
@@ -1198,11 +1269,17 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_STYLE_FLAG_ITALIC ::                                            */
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_STYLE_FLAG_ITALIC ::                                            */
-  /*      Indicates that a given face is italicized.                       */
+  /*      Indicates that a given face style is italic or oblique.          */
   /*                                                                       */
   /*    FT_STYLE_FLAG_BOLD ::                                              */
   /*      Indicates that a given face is bold.                             */
   /*                                                                       */
   /*                                                                       */
   /*    FT_STYLE_FLAG_BOLD ::                                              */
   /*      Indicates that a given face is bold.                             */
   /*                                                                       */
+  /* <Note>                                                                */
+  /*    The style information as provided by FreeType is very basic.  More */
+  /*    details are beyond the scope and should be done on a higher level  */
+  /*    (for example, by analyzing various fields of the `OS/2' table in   */
+  /*    SFNT based fonts).                                                 */
+  /*                                                                       */
 #define FT_STYLE_FLAG_ITALIC  ( 1 << 0 )
 #define FT_STYLE_FLAG_BOLD    ( 1 << 1 )
 
 #define FT_STYLE_FLAG_ITALIC  ( 1 << 0 )
 #define FT_STYLE_FLAG_BOLD    ( 1 << 1 )
 
@@ -1214,7 +1291,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    An opaque handle to an `FT_Size_InternalRec' structure, used to    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    An opaque handle to an `FT_Size_InternalRec' structure, used to    */
-  /*    model private data of a given FT_Size object.                      */
+  /*    model private data of a given @FT_Size object.                     */
   /*                                                                       */
   typedef struct FT_Size_InternalRec_*  FT_Size_Internal;
 
   /*                                                                       */
   typedef struct FT_Size_InternalRec_*  FT_Size_Internal;
 
@@ -1345,7 +1422,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    An opaque handle to an `FT_Slot_InternalRec' structure, used to    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    An opaque handle to an `FT_Slot_InternalRec' structure, used to    */
-  /*    model private data of a given FT_GlyphSlot object.                 */
+  /*    model private data of a given @FT_GlyphSlot object.                */
   /*                                                                       */
   typedef struct FT_Slot_InternalRec_*  FT_Slot_Internal;
 
   /*                                                                       */
   typedef struct FT_Slot_InternalRec_*  FT_Slot_Internal;
 
@@ -1401,7 +1478,7 @@ FT_BEGIN_HEADER
   /*                         Only relevant for outline glyphs.             */
   /*                                                                       */
   /*    advance           :: This is the transformed advance width for the */
   /*                         Only relevant for outline glyphs.             */
   /*                                                                       */
   /*    advance           :: This is the transformed advance width for the */
-  /*                         glyph.                                        */
+  /*                         glyph (in 26.6 fractional pixel format).      */
   /*                                                                       */
   /*    format            :: This field indicates the format of the image  */
   /*                         contained in the glyph slot.  Typically       */
   /*                                                                       */
   /*    format            :: This field indicates the format of the image  */
   /*                         contained in the glyph slot.  Typically       */
@@ -1425,7 +1502,7 @@ FT_BEGIN_HEADER
   /*    bitmap_top        :: This is the bitmap's top bearing expressed in */
   /*                         integer pixels.  Remember that this is the    */
   /*                         distance from the baseline to the top-most    */
   /*    bitmap_top        :: This is the bitmap's top bearing expressed in */
   /*                         integer pixels.  Remember that this is the    */
   /*                         distance from the baseline to the top-most    */
-  /*                         glyph scanline, upwards y-coordinates being   */
+  /*                         glyph scanline, upwards y~coordinates being   */
   /*                         *positive*.                                   */
   /*                                                                       */
   /*    outline           :: The outline descriptor for the current glyph  */
   /*                         *positive*.                                   */
   /*                                                                       */
   /*    outline           :: The outline descriptor for the current glyph  */
@@ -1448,7 +1525,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    control_data      :: Certain font drivers can also return the      */
   /*                         control data for a given glyph image (e.g.    */
   /*                                                                       */
   /*    control_data      :: Certain font drivers can also return the      */
   /*                         control data for a given glyph image (e.g.    */
-  /*                         TrueType bytecode, Type 1 charstrings, etc.). */
+  /*                         TrueType bytecode, Type~1 charstrings, etc.). */
   /*                         This field is a pointer to such data.         */
   /*                                                                       */
   /*    control_len       :: This is the length in bytes of the control    */
   /*                         This field is a pointer to such data.         */
   /*                                                                       */
   /*    control_len       :: This is the length in bytes of the control    */
@@ -1470,15 +1547,15 @@ FT_BEGIN_HEADER
   /* <Note>                                                                */
   /*    If @FT_Load_Glyph is called with default flags (see                */
   /*    @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in   */
   /* <Note>                                                                */
   /*    If @FT_Load_Glyph is called with default flags (see                */
   /*    @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in   */
-  /*    its native format (e.g., an outline glyph for TrueType and Type 1  */
+  /*    its native format (e.g., an outline glyph for TrueType and Type~1  */
   /*    formats).                                                          */
   /*                                                                       */
   /*    This image can later be converted into a bitmap by calling         */
   /*    @FT_Render_Glyph.  This function finds the current renderer for    */
   /*    formats).                                                          */
   /*                                                                       */
   /*    This image can later be converted into a bitmap by calling         */
   /*    @FT_Render_Glyph.  This function finds the current renderer for    */
-  /*    the native image's format then invokes it.                         */
+  /*    the native image's format, then invokes it.                        */
   /*                                                                       */
   /*    The renderer is in charge of transforming the native image through */
   /*                                                                       */
   /*    The renderer is in charge of transforming the native image through */
-  /*    the slot's face transformation fields, then convert it into a      */
+  /*    the slot's face transformation fields, then converting it into a   */
   /*    bitmap that is returned in `slot->bitmap'.                         */
   /*                                                                       */
   /*    Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
   /*    bitmap that is returned in `slot->bitmap'.                         */
   /*                                                                       */
   /*    Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
@@ -1573,7 +1650,12 @@ FT_BEGIN_HEADER
   /*    alibrary :: A handle to a new library object.                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*    alibrary :: A handle to a new library object.                      */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    In case you want to provide your own memory allocating routines,   */
+  /*    use @FT_New_Library instead, followed by a call to                 */
+  /*    @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module).  */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Init_FreeType( FT_Library  *alibrary );
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Init_FreeType( FT_Library  *alibrary );
@@ -1592,7 +1674,7 @@ FT_BEGIN_HEADER
   /*    library :: A handle to the target library object.                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*    library :: A handle to the target library object.                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Done_FreeType( FT_Library  library );
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Done_FreeType( FT_Library  library );
@@ -1608,26 +1690,26 @@ FT_BEGIN_HEADER
   /*    @FT_Open_Args structure.                                           */
   /*                                                                       */
   /* <Values>                                                              */
   /*    @FT_Open_Args structure.                                           */
   /*                                                                       */
   /* <Values>                                                              */
-  /*    FT_OPEN_MEMORY      :: This is a memory-based stream.              */
+  /*    FT_OPEN_MEMORY   :: This is a memory-based stream.                 */
   /*                                                                       */
   /*                                                                       */
-  /*    FT_OPEN_STREAM      :: Copy the stream from the `stream' field.    */
+  /*    FT_OPEN_STREAM   :: Copy the stream from the `stream' field.       */
   /*                                                                       */
   /*                                                                       */
-  /*    FT_OPEN_PATHNAME    :: Create a new input stream from a C          */
-  /*                           path name.                                  */
+  /*    FT_OPEN_PATHNAME :: Create a new input stream from a C~path        */
+  /*                        name.                                          */
   /*                                                                       */
   /*                                                                       */
-  /*    FT_OPEN_DRIVER      :: Use the `driver' field.                     */
+  /*    FT_OPEN_DRIVER   :: Use the `driver' field.                        */
   /*                                                                       */
   /*                                                                       */
-  /*    FT_OPEN_PARAMS      :: Use the `num_params' and `params' fields.   */
+  /*    FT_OPEN_PARAMS   :: Use the `num_params' and `params' fields.      */
   /*                                                                       */
   /*                                                                       */
-  /*    ft_open_memory      :: Deprecated; use @FT_OPEN_MEMORY instead.    */
+  /*    ft_open_memory   :: Deprecated; use @FT_OPEN_MEMORY instead.       */
   /*                                                                       */
   /*                                                                       */
-  /*    ft_open_stream      :: Deprecated; use @FT_OPEN_STREAM instead.    */
+  /*    ft_open_stream   :: Deprecated; use @FT_OPEN_STREAM instead.       */
   /*                                                                       */
   /*                                                                       */
-  /*    ft_open_pathname    :: Deprecated; use @FT_OPEN_PATHNAME instead.  */
+  /*    ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead.     */
   /*                                                                       */
   /*                                                                       */
-  /*    ft_open_driver      :: Deprecated; use @FT_OPEN_DRIVER instead.    */
+  /*    ft_open_driver   :: Deprecated; use @FT_OPEN_DRIVER instead.       */
   /*                                                                       */
   /*                                                                       */
-  /*    ft_open_params      :: Deprecated; use @FT_OPEN_PARAMS instead.    */
+  /*    ft_open_params   :: Deprecated; use @FT_OPEN_PARAMS instead.       */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME'     */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME'     */
@@ -1652,8 +1734,8 @@ FT_BEGIN_HEADER
   /*    FT_Parameter                                                       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Parameter                                                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A simple structure used to pass more or less generic parameters    */
-  /*    to @FT_Open_Face.                                                  */
+  /*    A simple structure used to pass more or less generic parameters to */
+  /*    @FT_Open_Face.                                                     */
   /*                                                                       */
   /* <Fields>                                                              */
   /*    tag  :: A four-byte identification tag.                            */
   /*                                                                       */
   /* <Fields>                                                              */
   /*    tag  :: A four-byte identification tag.                            */
@@ -1695,7 +1777,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    driver      :: This field is exclusively used by @FT_Open_Face;    */
   /*                   it simply specifies the font driver to use to open  */
   /*                                                                       */
   /*    driver      :: This field is exclusively used by @FT_Open_Face;    */
   /*                   it simply specifies the font driver to use to open  */
-  /*                   the face.  If set to 0, FreeType tries to load the  */
+  /*                   the face.  If set to~0, FreeType tries to load the  */
   /*                   face with each one of the drivers in its list.      */
   /*                                                                       */
   /*    num_params  :: The number of extra parameters.                     */
   /*                   face with each one of the drivers in its list.      */
   /*                                                                       */
   /*    num_params  :: The number of extra parameters.                     */
@@ -1726,7 +1808,7 @@ FT_BEGIN_HEADER
   /*    `num_params' and `params' is used.  They are ignored otherwise.    */
   /*                                                                       */
   /*    Ideally, both the `pathname' and `params' fields should be tagged  */
   /*    `num_params' and `params' is used.  They are ignored otherwise.    */
   /*                                                                       */
   /*    Ideally, both the `pathname' and `params' fields should be tagged  */
-  /*    as `const'; this is missing for API backwards compatibility.  With */
+  /*    as `const'; this is missing for API backwards compatibility.  In   */
   /*    other words, applications should treat them as read-only.          */
   /*                                                                       */
   typedef struct  FT_Open_Args_
   /*    other words, applications should treat them as read-only.          */
   /*                                                                       */
   typedef struct  FT_Open_Args_
@@ -1758,7 +1840,7 @@ FT_BEGIN_HEADER
   /*    pathname   :: A path to the font file.                             */
   /*                                                                       */
   /*    face_index :: The index of the face within the font.  The first    */
   /*    pathname   :: A path to the font file.                             */
   /*                                                                       */
   /*    face_index :: The index of the face within the font.  The first    */
-  /*                  face has index 0.                                    */
+  /*                  face has index~0.                                    */
   /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.  If `face_index' is   */
   /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.  If `face_index' is   */
@@ -1766,7 +1848,7 @@ FT_BEGIN_HEADER
   /*                  See @FT_Open_Face for more details.                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  See @FT_Open_Face for more details.                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_New_Face( FT_Library   library,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_New_Face( FT_Library   library,
@@ -1793,7 +1875,7 @@ FT_BEGIN_HEADER
   /*    file_size  :: The size of the memory chunk used by the font data.  */
   /*                                                                       */
   /*    face_index :: The index of the face within the font.  The first    */
   /*    file_size  :: The size of the memory chunk used by the font data.  */
   /*                                                                       */
   /*    face_index :: The index of the face within the font.  The first    */
-  /*                  face has index 0.                                    */
+  /*                  face has index~0.                                    */
   /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.  If `face_index' is   */
   /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.  If `face_index' is   */
@@ -1801,7 +1883,7 @@ FT_BEGIN_HEADER
   /*                  See @FT_Open_Face for more details.                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  See @FT_Open_Face for more details.                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    You must not deallocate the memory before calling @FT_Done_Face.   */
   /*                                                                       */
   /* <Note>                                                                */
   /*    You must not deallocate the memory before calling @FT_Done_Face.   */
@@ -1831,7 +1913,7 @@ FT_BEGIN_HEADER
   /*                  be filled by the caller.                             */
   /*                                                                       */
   /*    face_index :: The index of the face within the font.  The first    */
   /*                  be filled by the caller.                             */
   /*                                                                       */
   /*    face_index :: The index of the face within the font.  The first    */
-  /*                  face has index 0.                                    */
+  /*                  face has index~0.                                    */
   /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.  If `face_index' is   */
   /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.  If `face_index' is   */
@@ -1839,7 +1921,7 @@ FT_BEGIN_HEADER
   /*                  See note below.                                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  See note below.                                      */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Unlike FreeType 1.x, this function automatically creates a glyph   */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Unlike FreeType 1.x, this function automatically creates a glyph   */
@@ -1848,7 +1930,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    FT_Open_Face can be used to quickly check whether the font         */
   /*    format of a given font resource is supported by FreeType.  If the  */
   /*                                                                       */
   /*    FT_Open_Face can be used to quickly check whether the font         */
   /*    format of a given font resource is supported by FreeType.  If the  */
-  /*    `face_index' field is negative, the function's return value is 0   */
+  /*    `face_index' field is negative, the function's return value is~0   */
   /*    if the font format is recognized, or non-zero otherwise;           */
   /*    the function returns a more or less empty face handle in `*aface'  */
   /*    (if `aface' isn't NULL).  The only useful field in this special    */
   /*    if the font format is recognized, or non-zero otherwise;           */
   /*    the function returns a more or less empty face handle in `*aface'  */
   /*    (if `aface' isn't NULL).  The only useful field in this special    */
@@ -1881,7 +1963,7 @@ FT_BEGIN_HEADER
   /*    filepathname :: The pathname.                                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*    filepathname :: The pathname.                                      */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Attach_File( FT_Face      face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Attach_File( FT_Face      face,
@@ -1896,7 +1978,7 @@ FT_BEGIN_HEADER
   /* <Description>                                                         */
   /*    `Attach' data to a face object.  Normally, this is used to read    */
   /*    additional information for the face object.  For example, you can  */
   /* <Description>                                                         */
   /*    `Attach' data to a face object.  Normally, this is used to read    */
   /*    additional information for the face object.  For example, you can  */
-  /*    attach an AFM file that comes with a Type 1 font to get the        */
+  /*    attach an AFM file that comes with a Type~1 font to get the        */
   /*    kerning values and other metrics.                                  */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    kerning values and other metrics.                                  */
   /*                                                                       */
   /* <InOut>                                                               */
@@ -1907,7 +1989,7 @@ FT_BEGIN_HEADER
   /*                  the caller.                                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  the caller.                                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The meaning of the `attach' (i.e., what really happens when the    */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The meaning of the `attach' (i.e., what really happens when the    */
@@ -1936,7 +2018,7 @@ FT_BEGIN_HEADER
   /*    face :: A handle to a target face object.                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*    face :: A handle to a target face object.                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Done_Face( FT_Face  face );
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Done_Face( FT_Face  face );
@@ -1958,7 +2040,7 @@ FT_BEGIN_HEADER
   /*                    `available_sizes' field of @FT_FaceRec structure.  */
   /*                                                                       */
   /* <Return>                                                              */
   /*                    `available_sizes' field of @FT_FaceRec structure.  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Select_Size( FT_Face  face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Select_Size( FT_Face  face,
@@ -2044,8 +2126,8 @@ FT_BEGIN_HEADER
   /*                      value.                                           */
   /*                                                                       */
   /* <Note>                                                                */
   /*                      value.                                           */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    If `width' is zero, then the horizontal scaling value is set      */
-  /*    equal to the vertical scaling value, and vice versa.               */
+  /*    If `width' is zero, then the horizontal scaling value is set equal */
+  /*    to the vertical scaling value, and vice versa.                     */
   /*                                                                       */
   typedef struct  FT_Size_RequestRec_
   {
   /*                                                                       */
   typedef struct  FT_Size_RequestRec_
   {
@@ -2055,7 +2137,18 @@ FT_BEGIN_HEADER
     FT_UInt               horiResolution;
     FT_UInt               vertResolution;
 
     FT_UInt               horiResolution;
     FT_UInt               vertResolution;
 
-  } FT_Size_RequestRec, *FT_Size_Request;
+  } FT_Size_RequestRec;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    FT_Size_Request                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to a size request structure.                              */
+  /*                                                                       */
+  typedef struct FT_Size_RequestRec_  *FT_Size_Request;
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -2073,7 +2166,7 @@ FT_BEGIN_HEADER
   /*    req  :: A pointer to a @FT_Size_RequestRec.                        */
   /*                                                                       */
   /* <Return>                                                              */
   /*    req  :: A pointer to a @FT_Size_RequestRec.                        */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Although drivers may select the bitmap strike matching the         */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Although drivers may select the bitmap strike matching the         */
@@ -2108,7 +2201,7 @@ FT_BEGIN_HEADER
   /*    vert_resolution :: The vertical resolution in dpi.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    vert_resolution :: The vertical resolution in dpi.                 */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    If either the character width or height is zero, it is set equal   */
   /*                                                                       */
   /* <Note>                                                                */
   /*    If either the character width or height is zero, it is set equal   */
@@ -2120,7 +2213,8 @@ FT_BEGIN_HEADER
   /*    A character width or height smaller than 1pt is set to 1pt; if     */
   /*    both resolution values are zero, they are set to 72dpi.            */
   /*                                                                       */
   /*    A character width or height smaller than 1pt is set to 1pt; if     */
   /*    both resolution values are zero, they are set to 72dpi.            */
   /*                                                                       */
-
+  /*    Don't use this function if you are using the FreeType cache API.   */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_Char_Size( FT_Face     face,
                     FT_F26Dot6  char_width,
   FT_EXPORT( FT_Error )
   FT_Set_Char_Size( FT_Face     face,
                     FT_F26Dot6  char_width,
@@ -2147,7 +2241,7 @@ FT_BEGIN_HEADER
   /*    pixel_height :: The nominal height, in pixels.                     */
   /*                                                                       */
   /* <Return>                                                              */
   /*    pixel_height :: The nominal height, in pixels.                     */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_Pixel_Sizes( FT_Face  face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_Pixel_Sizes( FT_Face  face,
@@ -2180,12 +2274,17 @@ FT_BEGIN_HEADER
   /*                   whether to hint the outline, etc).                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*                   whether to hint the outline, etc).                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The loaded glyph may be transformed.  See @FT_Set_Transform for    */
   /*    the details.                                                       */
   /*                                                                       */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The loaded glyph may be transformed.  See @FT_Set_Transform for    */
   /*    the details.                                                       */
   /*                                                                       */
+  /*    For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is        */
+  /*    returned for invalid CID values (this is, for CID values which     */
+  /*    don't have a corresponding glyph in the font).  See the discussion */
+  /*    of the @FT_FACE_FLAG_CID_KEYED flag for more details.              */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Load_Glyph( FT_Face   face,
                  FT_UInt   glyph_index,
   FT_EXPORT( FT_Error )
   FT_Load_Glyph( FT_Face   face,
                  FT_UInt   glyph_index,
@@ -2216,7 +2315,7 @@ FT_BEGIN_HEADER
   /*                   whether to hint the outline, etc).                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*                   whether to hint the outline, etc).                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph.  */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph.  */
@@ -2238,7 +2337,7 @@ FT_BEGIN_HEADER
    *
    * @values:
    *   FT_LOAD_DEFAULT ::
    *
    * @values:
    *   FT_LOAD_DEFAULT ::
-   *     Corresponding to 0, this value is used as the default glyph load
+   *     Corresponding to~0, this value is used as the default glyph load
    *     operation.  In this case, the following happens:
    *
    *     1. FreeType looks for a bitmap for the glyph corresponding to the
    *     operation.  In this case, the following happens:
    *
    *     1. FreeType looks for a bitmap for the glyph corresponding to the
@@ -2328,10 +2427,10 @@ FT_BEGIN_HEADER
    *   FT_LOAD_MONOCHROME ::
    *     This flag is used with @FT_LOAD_RENDER to indicate that you want to
    *     render an outline glyph to a 1-bit monochrome bitmap glyph, with
    *   FT_LOAD_MONOCHROME ::
    *     This flag is used with @FT_LOAD_RENDER to indicate that you want to
    *     render an outline glyph to a 1-bit monochrome bitmap glyph, with
-   *     8 pixels packed into each byte of the bitmap data.
+   *     8~pixels packed into each byte of the bitmap data.
    *
    *     Note that this has no effect on the hinting algorithm used.  You
    *
    *     Note that this has no effect on the hinting algorithm used.  You
-   *     should use @FT_LOAD_TARGET_MONO instead so that the
+   *     should rather use @FT_LOAD_TARGET_MONO so that the
    *     monochrome-optimized hinting algorithm is used.
    *
    *   FT_LOAD_LINEAR_DESIGN ::
    *     monochrome-optimized hinting algorithm is used.
    *
    *   FT_LOAD_LINEAR_DESIGN ::
@@ -2350,8 +2449,12 @@ FT_BEGIN_HEADER
    *   @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
    *   used at all.
    *
    *   @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
    *   used at all.
    *
+   *   See the description of @FT_FACE_FLAG_TRICKY for a special exception
+   *   (affecting only a handful of Asian fonts).
+   *
    *   Besides deciding which hinter to use, you can also decide which
    *   hinting algorithm to use.  See @FT_LOAD_TARGET_XXX for details.
    *   Besides deciding which hinter to use, you can also decide which
    *   hinting algorithm to use.  See @FT_LOAD_TARGET_XXX for details.
+   *
    */
 #define FT_LOAD_DEFAULT                      0x0
 #define FT_LOAD_NO_SCALE                     0x1
    */
 #define FT_LOAD_DEFAULT                      0x0
 #define FT_LOAD_NO_SCALE                     0x1
@@ -2367,13 +2470,14 @@ FT_BEGIN_HEADER
 #define FT_LOAD_IGNORE_TRANSFORM             0x800
 #define FT_LOAD_MONOCHROME                   0x1000
 #define FT_LOAD_LINEAR_DESIGN                0x2000
 #define FT_LOAD_IGNORE_TRANSFORM             0x800
 #define FT_LOAD_MONOCHROME                   0x1000
 #define FT_LOAD_LINEAR_DESIGN                0x2000
-
-  /* temporary hack! */
-#define FT_LOAD_SBITS_ONLY                   0x4000
 #define FT_LOAD_NO_AUTOHINT                  0x8000U
 
   /* */
 
 #define FT_LOAD_NO_AUTOHINT                  0x8000U
 
   /* */
 
+  /* used internally only by certain font drivers! */
+#define FT_LOAD_ADVANCE_ONLY                 0x100
+#define FT_LOAD_SBITS_ONLY                   0x4000
+
 
   /**************************************************************************
    *
 
   /**************************************************************************
    *
@@ -2401,7 +2505,7 @@ FT_BEGIN_HEADER
    *   FT_LOAD_TARGET_LIGHT ::
    *     A lighter hinting algorithm for non-monochrome modes.  Many
    *     generated glyphs are more fuzzy but better resemble its original
    *   FT_LOAD_TARGET_LIGHT ::
    *     A lighter hinting algorithm for non-monochrome modes.  Many
    *     generated glyphs are more fuzzy but better resemble its original
-   *     shape.  A bit like rendering on Mac OS X.
+   *     shape.  A bit like rendering on Mac OS~X.
    *
    *     As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
    *
    *
    *     As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
    *
@@ -2437,30 +2541,29 @@ FT_BEGIN_HEADER
    *
    *       FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
    *     }
    *
    *       FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
    *     }
+   *
    */
    */
+#define FT_LOAD_TARGET_( x )   ( (FT_Int32)( (x) & 15 ) << 16 )
 
 
-#define FT_LOAD_TARGET_( x )      ( (FT_Int32)( (x) & 15 ) << 16 )
+#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   )
+#define FT_LOAD_TARGET_LCD     FT_LOAD_TARGET_( FT_RENDER_MODE_LCD    )
+#define FT_LOAD_TARGET_LCD_V   FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V  )
 
 
-#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   )
-#define FT_LOAD_TARGET_LCD        FT_LOAD_TARGET_( FT_RENDER_MODE_LCD    )
-#define FT_LOAD_TARGET_LCD_V      FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V  )
 
 
-
-  /*
+  /**************************************************************************
+   *
    * @macro:
    *   FT_LOAD_TARGET_MODE
    *
    * @description:
    *   Return the @FT_Render_Mode corresponding to a given
    *   @FT_LOAD_TARGET_XXX value.
    * @macro:
    *   FT_LOAD_TARGET_MODE
    *
    * @description:
    *   Return the @FT_Render_Mode corresponding to a given
    *   @FT_LOAD_TARGET_XXX value.
+   *
    */
    */
-
 #define FT_LOAD_TARGET_MODE( x )  ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
 
 #define FT_LOAD_TARGET_MODE( x )  ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
 
-  /* */
-
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -2476,9 +2579,9 @@ FT_BEGIN_HEADER
   /*    face   :: A handle to the source face object.                      */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the source face object.                      */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    matrix :: A pointer to the transformation's 2x2 matrix.  Use 0 for */
+  /*    matrix :: A pointer to the transformation's 2x2 matrix.  Use~0 for */
   /*              the identity matrix.                                     */
   /*              the identity matrix.                                     */
-  /*    delta  :: A pointer to the translation vector.  Use 0 for the null */
+  /*    delta  :: A pointer to the translation vector.  Use~0 for the null */
   /*              vector.                                                  */
   /*                                                                       */
   /* <Note>                                                                */
   /*              vector.                                                  */
   /*                                                                       */
   /* <Note>                                                                */
@@ -2503,17 +2606,19 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    An enumeration type that lists the render modes supported by       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    An enumeration type that lists the render modes supported by       */
-  /*    FreeType 2.  Each mode corresponds to a specific type of scanline  */
+  /*    FreeType~2.  Each mode corresponds to a specific type of scanline  */
   /*    conversion performed on the outline.                               */
   /*                                                                       */
   /*    conversion performed on the outline.                               */
   /*                                                                       */
-  /*    For bitmap fonts the `bitmap->pixel_mode' field in the             */
-  /*    @FT_GlyphSlotRec structure gives the format of the returned        */
-  /*    bitmap.                                                            */
+  /*    For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode'     */
+  /*    field in the @FT_GlyphSlotRec structure gives the format of the    */
+  /*    returned bitmap.                                                   */
+  /*                                                                       */
+  /*    All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity.   */
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_RENDER_MODE_NORMAL ::                                           */
   /*      This is the default render mode; it corresponds to 8-bit         */
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_RENDER_MODE_NORMAL ::                                           */
   /*      This is the default render mode; it corresponds to 8-bit         */
-  /*      anti-aliased bitmaps, using 256 levels of opacity.               */
+  /*      anti-aliased bitmaps.                                            */
   /*                                                                       */
   /*    FT_RENDER_MODE_LIGHT ::                                            */
   /*      This is equivalent to @FT_RENDER_MODE_NORMAL.  It is only        */
   /*                                                                       */
   /*    FT_RENDER_MODE_LIGHT ::                                            */
   /*      This is equivalent to @FT_RENDER_MODE_NORMAL.  It is only        */
@@ -2522,24 +2627,32 @@ FT_BEGIN_HEADER
   /*      @FT_LOAD_TARGET_XXX for details.                                 */
   /*                                                                       */
   /*    FT_RENDER_MODE_MONO ::                                             */
   /*      @FT_LOAD_TARGET_XXX for details.                                 */
   /*                                                                       */
   /*    FT_RENDER_MODE_MONO ::                                             */
-  /*      This mode corresponds to 1-bit bitmaps.                          */
+  /*      This mode corresponds to 1-bit bitmaps (with 2~levels of         */
+  /*      opacity).                                                        */
   /*                                                                       */
   /*    FT_RENDER_MODE_LCD ::                                              */
   /*      This mode corresponds to horizontal RGB and BGR sub-pixel        */
   /*                                                                       */
   /*    FT_RENDER_MODE_LCD ::                                              */
   /*      This mode corresponds to horizontal RGB and BGR sub-pixel        */
-  /*      displays, like LCD-screens.  It produces 8-bit bitmaps that are  */
-  /*      3 times the width of the original glyph outline in pixels, and   */
+  /*      displays like LCD screens.  It produces 8-bit bitmaps that are   */
+  /*      3~times the width of the original glyph outline in pixels, and   */
   /*      which use the @FT_PIXEL_MODE_LCD mode.                           */
   /*                                                                       */
   /*    FT_RENDER_MODE_LCD_V ::                                            */
   /*      This mode corresponds to vertical RGB and BGR sub-pixel displays */
   /*      (like PDA screens, rotated LCD displays, etc.).  It produces     */
   /*      which use the @FT_PIXEL_MODE_LCD mode.                           */
   /*                                                                       */
   /*    FT_RENDER_MODE_LCD_V ::                                            */
   /*      This mode corresponds to vertical RGB and BGR sub-pixel displays */
   /*      (like PDA screens, rotated LCD displays, etc.).  It produces     */
-  /*      8-bit bitmaps that are 3 times the height of the original        */
+  /*      8-bit bitmaps that are 3~times the height of the original        */
   /*      glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode.   */
   /*                                                                       */
   /* <Note>                                                                */
   /*      glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode.   */
   /*                                                                       */
   /* <Note>                                                                */
-  /*   The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are     */
-  /*   _not_ _filtered_ to reduce color-fringes.  It is up to the caller   */
-  /*   to perform this pass.                                               */
+  /*    The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
+  /*    filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
+  /*    (not active in the default builds).  It is up to the caller to     */
+  /*    either call @FT_Library_SetLcdFilter (if available) or do the      */
+  /*    filtering itself.                                                  */
+  /*                                                                       */
+  /*    The selected render mode only affects vector glyphs of a font.     */
+  /*    Embedded bitmaps often have a different pixel mode like            */
+  /*    @FT_PIXEL_MODE_MONO.  You can use @FT_Bitmap_Convert to transform  */
+  /*    them into 8-bit pixmaps.                                           */
   /*                                                                       */
   typedef enum  FT_Render_Mode_
   {
   /*                                                                       */
   typedef enum  FT_Render_Mode_
   {
@@ -2564,8 +2677,8 @@ FT_BEGIN_HEADER
   /*    @FT_Render_Mode values instead.                                    */
   /*                                                                       */
   /* <Values>                                                              */
   /*    @FT_Render_Mode values instead.                                    */
   /*                                                                       */
   /* <Values>                                                              */
-  /*   ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL                 */
-  /*   ft_render_mode_mono   :: see @FT_RENDER_MODE_MONO                   */
+  /*    ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL                */
+  /*    ft_render_mode_mono   :: see @FT_RENDER_MODE_MONO                  */
   /*                                                                       */
 #define ft_render_mode_normal  FT_RENDER_MODE_NORMAL
 #define ft_render_mode_mono    FT_RENDER_MODE_MONO
   /*                                                                       */
 #define ft_render_mode_normal  FT_RENDER_MODE_NORMAL
 #define ft_render_mode_mono    FT_RENDER_MODE_MONO
@@ -2591,7 +2704,7 @@ FT_BEGIN_HEADER
   /*                   list of possible values.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*                   list of possible values.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Render_Glyph( FT_GlyphSlot    slot,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Render_Glyph( FT_GlyphSlot    slot,
@@ -2609,7 +2722,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_KERNING_DEFAULT  :: Return scaled and grid-fitted kerning       */
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_KERNING_DEFAULT  :: Return scaled and grid-fitted kerning       */
-  /*                           distances (value is 0).                     */
+  /*                           distances (value is~0).                     */
   /*                                                                       */
   /*    FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning    */
   /*                           distances.                                  */
   /*                                                                       */
   /*    FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning    */
   /*                           distances.                                  */
@@ -2687,7 +2800,7 @@ FT_BEGIN_HEADER
   /*                   and in pixels for fixed-sizes formats.              */
   /*                                                                       */
   /* <Return>                                                              */
   /*                   and in pixels for fixed-sizes formats.              */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Only horizontal layouts (left-to-right & right-to-left) are        */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Only horizontal layouts (left-to-right & right-to-left) are        */
@@ -2712,17 +2825,17 @@ FT_BEGIN_HEADER
   /*    Return the track kerning for a given face object at a given size.  */
   /*                                                                       */
   /* <Input>                                                               */
   /*    Return the track kerning for a given face object at a given size.  */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    face        :: A handle to a source face object.                   */
+  /*    face       :: A handle to a source face object.                    */
   /*                                                                       */
   /*                                                                       */
-  /*    point_size  :: The point size in 16.16 fractional points.          */
+  /*    point_size :: The point size in 16.16 fractional points.           */
   /*                                                                       */
   /*                                                                       */
-  /*    degree      :: The degree of tightness.                            */
+  /*    degree     :: The degree of tightness.                             */
   /*                                                                       */
   /* <Output>                                                              */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    akerning    :: The kerning in 16.16 fractional points.             */
+  /*    akerning   :: The kerning in 16.16 fractional points.              */
   /*                                                                       */
   /* <Return>                                                              */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Get_Track_Kerning( FT_Face    face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Get_Track_Kerning( FT_Face    face,
@@ -2738,7 +2851,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    Retrieve the ASCII name of a given glyph in a face.  This only     */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Retrieve the ASCII name of a given glyph in a face.  This only     */
-  /*    works for those faces where @FT_HAS_GLYPH_NAMES(face) returns 1.   */
+  /*    works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1.   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face        :: A handle to a source face object.                   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face        :: A handle to a source face object.                   */
@@ -2753,12 +2866,12 @@ FT_BEGIN_HEADER
   /*                   copied to.                                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*                   copied to.                                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    An error is returned if the face doesn't provide glyph names or if */
   /*    the glyph index is invalid.  In all cases of failure, the first    */
   /*                                                                       */
   /* <Note>                                                                */
   /*    An error is returned if the face doesn't provide glyph names or if */
   /*    the glyph index is invalid.  In all cases of failure, the first    */
-  /*    byte of `buffer' is set to 0 to indicate an empty name.            */
+  /*    byte of `buffer' is set to~0 to indicate an empty name.            */
   /*                                                                       */
   /*    The glyph name is truncated to fit within the buffer if it is too  */
   /*    long.  The returned string is always zero-terminated.              */
   /*                                                                       */
   /*    The glyph name is truncated to fit within the buffer if it is too  */
   /*    long.  The returned string is always zero-terminated.              */
@@ -2780,14 +2893,14 @@ FT_BEGIN_HEADER
   /*    FT_Get_Postscript_Name                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_Postscript_Name                                             */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieve the ASCII Postscript name of a given face, if available.  */
-  /*    This only works with Postscript and TrueType fonts.                */
+  /*    Retrieve the ASCII PostScript name of a given face, if available.  */
+  /*    This only works with PostScript and TrueType fonts.                */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A handle to the source face object.                        */
   /*                                                                       */
   /* <Return>                                                              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A handle to the source face object.                        */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    A pointer to the face's Postscript name.  NULL if unavailable.     */
+  /*    A pointer to the face's PostScript name.  NULL if unavailable.     */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned pointer is owned by the face and is destroyed with    */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned pointer is owned by the face and is destroyed with    */
@@ -2813,7 +2926,7 @@ FT_BEGIN_HEADER
   /*    encoding :: A handle to the selected encoding.                     */
   /*                                                                       */
   /* <Return>                                                              */
   /*    encoding :: A handle to the selected encoding.                     */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This function returns an error if no charmap in the face           */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This function returns an error if no charmap in the face           */
@@ -2821,7 +2934,8 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    Because many fonts contain more than a single cmap for Unicode     */
   /*    encoding, this function has some special code to select the one    */
   /*                                                                       */
   /*    Because many fonts contain more than a single cmap for Unicode     */
   /*    encoding, this function has some special code to select the one    */
-  /*    which covers Unicode best.  It is thus preferable to               */
+  /*    which covers Unicode best (`best' in the sense that a UCS-4 cmap   */
+  /*    is preferred to a UCS-2 cmap).  It is thus preferable to           */
   /*    @FT_Set_Charmap in this case.                                      */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   /*    @FT_Set_Charmap in this case.                                      */
   /*                                                                       */
   FT_EXPORT( FT_Error )
@@ -2844,13 +2958,15 @@ FT_BEGIN_HEADER
   /*    charmap :: A handle to the selected charmap.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /*    charmap :: A handle to the selected charmap.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This function returns an error if the charmap is not part of       */
   /*    the face (i.e., if it is not listed in the `face->charmaps'        */
   /*    table).                                                            */
   /*                                                                       */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This function returns an error if the charmap is not part of       */
   /*    the face (i.e., if it is not listed in the `face->charmaps'        */
   /*    table).                                                            */
   /*                                                                       */
+  /*    It also fails if a type~14 charmap is selected.                    */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_Charmap( FT_Face     face,
                   FT_CharMap  charmap );
   FT_EXPORT( FT_Error )
   FT_Set_Charmap( FT_Face     face,
                   FT_CharMap  charmap );
@@ -2892,13 +3008,13 @@ FT_BEGIN_HEADER
   /*    charcode :: The character code.                                    */
   /*                                                                       */
   /* <Return>                                                              */
   /*    charcode :: The character code.                                    */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    The glyph index.  0 means `undefined character code'.              */
+  /*    The glyph index.  0~means `undefined character code'.              */
   /*                                                                       */
   /* <Note>                                                                */
   /*    If you use FreeType to manipulate the contents of font files       */
   /*    directly, be aware that the glyph index returned by this function  */
   /*    doesn't always correspond to the internal indices used within      */
   /*                                                                       */
   /* <Note>                                                                */
   /*    If you use FreeType to manipulate the contents of font files       */
   /*    directly, be aware that the glyph index returned by this function  */
   /*    doesn't always correspond to the internal indices used within      */
-  /*    the file.  This is done to ensure that value 0 always corresponds  */
+  /*    the file.  This is done to ensure that value~0 always corresponds  */
   /*    to the `missing glyph'.                                            */
   /*                                                                       */
   FT_EXPORT( FT_UInt )
   /*    to the `missing glyph'.                                            */
   /*                                                                       */
   FT_EXPORT( FT_UInt )
@@ -2920,7 +3036,7 @@ FT_BEGIN_HEADER
   /*    face    :: A handle to the source face object.                     */
   /*                                                                       */
   /* <Output>                                                              */
   /*    face    :: A handle to the source face object.                     */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    agindex :: Glyph index of first character code.  0 if charmap is   */
+  /*    agindex :: Glyph index of first character code.  0~if charmap is   */
   /*               empty.                                                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*               empty.                                                  */
   /*                                                                       */
   /* <Return>                                                              */
@@ -2945,9 +3061,9 @@ FT_BEGIN_HEADER
   /*      }                                                                */
   /*    }                                                                  */
   /*                                                                       */
   /*      }                                                                */
   /*    }                                                                  */
   /*                                                                       */
-  /*    Note that `*agindex' is set to 0 if the charmap is empty.  The     */
-  /*    result itself can be 0 in two cases: if the charmap is empty or    */
-  /*    when the value 0 is the first valid character code.                */
+  /*    Note that `*agindex' is set to~0 if the charmap is empty.  The     */
+  /*    result itself can be~0 in two cases: if the charmap is empty or    */
+  /*    if the value~0 is the first valid character code.                  */
   /*                                                                       */
   FT_EXPORT( FT_ULong )
   FT_Get_First_Char( FT_Face   face,
   /*                                                                       */
   FT_EXPORT( FT_ULong )
   FT_Get_First_Char( FT_Face   face,
@@ -2969,7 +3085,7 @@ FT_BEGIN_HEADER
   /*    char_code :: The starting character code.                          */
   /*                                                                       */
   /* <Output>                                                              */
   /*    char_code :: The starting character code.                          */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    agindex   :: Glyph index of first character code.  0 if charmap    */
+  /*    agindex   :: Glyph index of next character code.  0~if charmap     */
   /*                 is empty.                                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*                 is empty.                                             */
   /*                                                                       */
   /* <Return>                                                              */
@@ -2980,7 +3096,7 @@ FT_BEGIN_HEADER
   /*    over all character codes available in a given charmap.  See the    */
   /*    note for this function for a simple code example.                  */
   /*                                                                       */
   /*    over all character codes available in a given charmap.  See the    */
   /*    note for this function for a simple code example.                  */
   /*                                                                       */
-  /*    Note that `*agindex' is set to 0 when there are no more codes in   */
+  /*    Note that `*agindex' is set to~0 when there are no more codes in   */
   /*    the charmap.                                                       */
   /*                                                                       */
   FT_EXPORT( FT_ULong )
   /*    the charmap.                                                       */
   /*                                                                       */
   FT_EXPORT( FT_ULong )
@@ -3004,7 +3120,7 @@ FT_BEGIN_HEADER
   /*    glyph_name :: The glyph name.                                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*    glyph_name :: The glyph name.                                      */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    The glyph index.  0 means `undefined character code'.              */
+  /*    The glyph index.  0~means `undefined character code'.              */
   /*                                                                       */
   FT_EXPORT( FT_UInt )
   FT_Get_Name_Index( FT_Face     face,
   /*                                                                       */
   FT_EXPORT( FT_UInt )
   FT_Get_Name_Index( FT_Face     face,
@@ -3046,15 +3162,16 @@ FT_BEGIN_HEADER
    *
    * @description:
    *   Retrieve a description of a given subglyph.  Only use it if
    *
    * @description:
    *   Retrieve a description of a given subglyph.  Only use it if
-   *   `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE, or an error is
-   *   returned.
+   *   `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
+   *   returned otherwise.
    *
    * @input:
    *   glyph ::
    *     The source glyph slot.
    *
    *   sub_index ::
    *
    * @input:
    *   glyph ::
    *     The source glyph slot.
    *
    *   sub_index ::
-   *     The index of subglyph.  Must be less than `glyph->num_subglyphs'.
+   *     The index of the subglyph.  Must be less than
+   *     `glyph->num_subglyphs'.
    *
    * @output:
    *   p_index ::
    *
    * @output:
    *   p_index ::
@@ -3073,7 +3190,7 @@ FT_BEGIN_HEADER
    *     The subglyph transformation (if any).
    *
    * @return:
    *     The subglyph transformation (if any).
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
    *
    * @note:
    *   The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
@@ -3091,6 +3208,305 @@ FT_BEGIN_HEADER
                         FT_Matrix    *p_transform );
 
 
                         FT_Matrix    *p_transform );
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Enum>                                                                */
+  /*    FT_FSTYPE_XXX                                                      */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A list of bit flags used in the `fsType' field of the OS/2 table   */
+  /*    in a TrueType or OpenType font and the `FSType' entry in a         */
+  /*    PostScript font.  These bit flags are returned by                  */
+  /*    @FT_Get_FSType_Flags; they inform client applications of embedding */
+  /*    and subsetting restrictions associated with a font.                */
+  /*                                                                       */
+  /*    See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for  */
+  /*    more details.                                                      */
+  /*                                                                       */
+  /* <Values>                                                              */
+  /*    FT_FSTYPE_INSTALLABLE_EMBEDDING ::                                 */
+  /*      Fonts with no fsType bit set may be embedded and permanently     */
+  /*      installed on the remote system by an application.                */
+  /*                                                                       */
+  /*    FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING ::                          */
+  /*      Fonts that have only this bit set must not be modified, embedded */
+  /*      or exchanged in any manner without first obtaining permission of */
+  /*      the font software copyright owner.                               */
+  /*                                                                       */
+  /*    FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING ::                           */
+  /*      If this bit is set, the font may be embedded and temporarily     */
+  /*      loaded on the remote system.  Documents containing Preview &     */
+  /*      Print fonts must be opened `read-only'; no edits can be applied  */
+  /*      to the document.                                                 */
+  /*                                                                       */
+  /*    FT_FSTYPE_EDITABLE_EMBEDDING ::                                    */
+  /*      If this bit is set, the font may be embedded but must only be    */
+  /*      installed temporarily on other systems.  In contrast to Preview  */
+  /*      & Print fonts, documents containing editable fonts may be opened */
+  /*      for reading, editing is permitted, and changes may be saved.     */
+  /*                                                                       */
+  /*    FT_FSTYPE_NO_SUBSETTING ::                                         */
+  /*      If this bit is set, the font may not be subsetted prior to       */
+  /*      embedding.                                                       */
+  /*                                                                       */
+  /*    FT_FSTYPE_BITMAP_EMBEDDING_ONLY ::                                 */
+  /*      If this bit is set, only bitmaps contained in the font may be    */
+  /*      embedded; no outline data may be embedded.  If there are no      */
+  /*      bitmaps available in the font, then the font is unembeddable.    */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    While the fsType flags can indicate that a font may be embedded, a */
+  /*    license with the font vendor may be separately required to use the */
+  /*    font in this way.                                                  */
+  /*                                                                       */
+#define FT_FSTYPE_INSTALLABLE_EMBEDDING         0x0000
+#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING  0x0002
+#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING   0x0004
+#define FT_FSTYPE_EDITABLE_EMBEDDING            0x0008
+#define FT_FSTYPE_NO_SUBSETTING                 0x0100
+#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY         0x0200
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Get_FSType_Flags                                                */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return the fsType flags for a font.                                */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face :: A handle to the source face object.                        */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The fsType flags, @FT_FSTYPE_XXX.                                  */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    Use this function rather than directly reading the `fs_type' field */
+  /*    in the @PS_FontInfoRec structure which is only guaranteed to       */
+  /*    return the correct results for Type~1 fonts.                       */
+  /*                                                                       */
+  FT_EXPORT( FT_UShort )
+  FT_Get_FSType_Flags( FT_Face  face );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Section>                                                             */
+  /*    glyph_variants                                                     */
+  /*                                                                       */
+  /* <Title>                                                               */
+  /*    Glyph Variants                                                     */
+  /*                                                                       */
+  /* <Abstract>                                                            */
+  /*    The FreeType~2 interface to Unicode Ideographic Variation          */
+  /*    Sequences (IVS), using the SFNT cmap format~14.                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Many CJK characters have variant forms.  They are a sort of grey   */
+  /*    area somewhere between being totally irrelevant and semantically   */
+  /*    distinct; for this reason, the Unicode consortium decided to       */
+  /*    introduce Ideographic Variation Sequences (IVS), consisting of a   */
+  /*    Unicode base character and one of 240 variant selectors            */
+  /*    (U+E0100-U+E01EF), instead of further extending the already huge   */
+  /*    code range for CJK characters.                                     */
+  /*                                                                       */
+  /*    An IVS is registered and unique; for further details please refer  */
+  /*    to Unicode Technical Report #37, the Ideographic Variation         */
+  /*    Database.  To date (October 2007), the character with the most     */
+  /*    variants is U+908A, having 8~such IVS.                             */
+  /*                                                                       */
+  /*    Adobe and MS decided to support IVS with a new cmap subtable       */
+  /*    (format~14).  It is an odd subtable because it is not a mapping of */
+  /*    input code points to glyphs, but contains lists of all variants    */
+  /*    supported by the font.                                             */
+  /*                                                                       */
+  /*    A variant may be either `default' or `non-default'.  A default     */
+  /*    variant is the one you will get for that code point if you look it */
+  /*    up in the standard Unicode cmap.  A non-default variant is a       */
+  /*    different glyph.                                                   */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Face_GetCharVariantIndex                                        */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return the glyph index of a given character code as modified by    */
+  /*    the variation selector.                                            */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face ::                                                            */
+  /*      A handle to the source face object.                              */
+  /*                                                                       */
+  /*    charcode ::                                                        */
+  /*      The character code point in Unicode.                             */
+  /*                                                                       */
+  /*    variantSelector ::                                                 */
+  /*      The Unicode code point of the variation selector.                */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The glyph index.  0~means either `undefined character code', or    */
+  /*    `undefined selector code', or `no variation selector cmap          */
+  /*    subtable', or `current CharMap is not Unicode'.                    */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    If you use FreeType to manipulate the contents of font files       */
+  /*    directly, be aware that the glyph index returned by this function  */
+  /*    doesn't always correspond to the internal indices used within      */
+  /*    the file.  This is done to ensure that value~0 always corresponds  */
+  /*    to the `missing glyph'.                                            */
+  /*                                                                       */
+  /*    This function is only meaningful if                                */
+  /*      a) the font has a variation selector cmap sub table,             */
+  /*    and                                                                */
+  /*      b) the current charmap has a Unicode encoding.                   */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
+  /*                                                                       */
+  FT_EXPORT( FT_UInt )
+  FT_Face_GetCharVariantIndex( FT_Face   face,
+                               FT_ULong  charcode,
+                               FT_ULong  variantSelector );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Face_GetCharVariantIsDefault                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Check whether this variant of this Unicode character is the one to */
+  /*    be found in the `cmap'.                                            */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face ::                                                            */
+  /*      A handle to the source face object.                              */
+  /*                                                                       */
+  /*    charcode ::                                                        */
+  /*      The character codepoint in Unicode.                              */
+  /*                                                                       */
+  /*    variantSelector ::                                                 */
+  /*      The Unicode codepoint of the variation selector.                 */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    1~if found in the standard (Unicode) cmap, 0~if found in the       */
+  /*    variation selector cmap, or -1 if it is not a variant.             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This function is only meaningful if the font has a variation       */
+  /*    selector cmap subtable.                                            */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
+  /*                                                                       */
+  FT_EXPORT( FT_Int )
+  FT_Face_GetCharVariantIsDefault( FT_Face   face,
+                                   FT_ULong  charcode,
+                                   FT_ULong  variantSelector );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Face_GetVariantSelectors                                        */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return a zero-terminated list of Unicode variant selectors found   */
+  /*    in the font.                                                       */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face ::                                                            */
+  /*      A handle to the source face object.                              */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    A pointer to an array of selector code points, or NULL if there is */
+  /*    no valid variant selector cmap subtable.                           */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The last item in the array is~0; the array is owned by the         */
+  /*    @FT_Face object but can be overwritten or released on the next     */
+  /*    call to a FreeType function.                                       */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
+  /*                                                                       */
+  FT_EXPORT( FT_UInt32* )
+  FT_Face_GetVariantSelectors( FT_Face  face );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Face_GetVariantsOfChar                                          */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return a zero-terminated list of Unicode variant selectors found   */
+  /*    for the specified character code.                                  */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face ::                                                            */
+  /*      A handle to the source face object.                              */
+  /*                                                                       */
+  /*    charcode ::                                                        */
+  /*      The character codepoint in Unicode.                              */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    A pointer to an array of variant selector code points which are    */
+  /*    active for the given character, or NULL if the corresponding list  */
+  /*    is empty.                                                          */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The last item in the array is~0; the array is owned by the         */
+  /*    @FT_Face object but can be overwritten or released on the next     */
+  /*    call to a FreeType function.                                       */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
+  /*                                                                       */
+  FT_EXPORT( FT_UInt32* )
+  FT_Face_GetVariantsOfChar( FT_Face   face,
+                             FT_ULong  charcode );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Face_GetCharsOfVariant                                          */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return a zero-terminated list of Unicode character codes found for */
+  /*    the specified variant selector.                                    */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face ::                                                            */
+  /*      A handle to the source face object.                              */
+  /*                                                                       */
+  /*    variantSelector ::                                                 */
+  /*      The variant selector code point in Unicode.                      */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    A list of all the code points which are specified by this selector */
+  /*    (both default and non-default codes are returned) or NULL if there */
+  /*    is no valid cmap or the variant selector is invalid.               */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The last item in the array is~0; the array is owned by the         */
+  /*    @FT_Face object but can be overwritten or released on the next     */
+  /*    call to a FreeType function.                                       */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
+  /*                                                                       */
+  FT_EXPORT( FT_UInt32* )
+  FT_Face_GetCharsOfVariant( FT_Face   face,
+                             FT_ULong  variantSelector );
+
+
   /*************************************************************************/
   /*                                                                       */
   /* <Section>                                                             */
   /*************************************************************************/
   /*                                                                       */
   /* <Section>                                                             */
@@ -3149,6 +3565,12 @@ FT_BEGIN_HEADER
              FT_Long  c );
 
 
              FT_Long  c );
 
 
+  /* */
+
+  /* The following #if 0 ... #endif is for the documentation formatter, */
+  /* hiding the internal `FT_MULFIX_INLINED' macro.                     */
+
+#if 0
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -3182,6 +3604,17 @@ FT_BEGIN_HEADER
   FT_MulFix( FT_Long  a,
              FT_Long  b );
 
   FT_MulFix( FT_Long  a,
              FT_Long  b );
 
+  /* */
+#endif
+
+#ifdef FT_MULFIX_INLINED
+#define FT_MulFix( a, b )  FT_MULFIX_INLINED( a, b )
+#else
+  FT_EXPORT( FT_Long )
+  FT_MulFix( FT_Long  a,
+             FT_Long  b );
+#endif
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -3202,8 +3635,8 @@ FT_BEGIN_HEADER
   /*    The result of `(a*0x10000)/b'.                                     */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The result of `(a*0x10000)/b'.                                     */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    The optimization for FT_DivFix() is simple: If (a << 16) fits in   */
-  /*    32 bits, then the division is computed directly.  Otherwise, we    */
+  /*    The optimization for FT_DivFix() is simple: If (a~<<~16) fits in   */
+  /*    32~bits, then the division is computed directly.  Otherwise, we    */
   /*    use a specialized version of @FT_MulDiv.                           */
   /*                                                                       */
   FT_EXPORT( FT_Long )
   /*    use a specialized version of @FT_MulDiv.                           */
   /*                                                                       */
   FT_EXPORT( FT_Long )
@@ -3310,26 +3743,27 @@ FT_BEGIN_HEADER
 
   /*************************************************************************
    *
 
   /*************************************************************************
    *
-   *  @enum:
-   *    FREETYPE_XXX
+   * @enum:
+   *   FREETYPE_XXX
    *
    *
-   *  @description:
-   *    These three macros identify the FreeType source code version.
-   *    Use @FT_Library_Version to access them at runtime.
+   * @description:
+   *   These three macros identify the FreeType source code version.
+   *   Use @FT_Library_Version to access them at runtime.
    *
    *
-   *  @values:
-   *    FREETYPE_MAJOR :: The major version number.
-   *    FREETYPE_MINOR :: The minor version number.
-   *    FREETYPE_PATCH :: The patch level.
+   * @values:
+   *   FREETYPE_MAJOR :: The major version number.
+   *   FREETYPE_MINOR :: The minor version number.
+   *   FREETYPE_PATCH :: The patch level.
+   *
+   * @note:
+   *   The version number of FreeType if built as a dynamic link library
+   *   with the `libtool' package is _not_ controlled by these three
+   *   macros.
    *
    *
-   *  @note:
-   *    The version number of FreeType if built as a dynamic link library
-   *    with the `libtool' package is _not_ controlled by these three
-   *    macros.
    */
 #define FREETYPE_MAJOR  2
 #define FREETYPE_MINOR  3
    */
 #define FREETYPE_MAJOR  2
 #define FREETYPE_MINOR  3
-#define FREETYPE_PATCH  5
+#define FREETYPE_PATCH  11
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -3386,8 +3820,8 @@ FT_BEGIN_HEADER
   /*    face :: A face handle.                                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*    face :: A face handle.                                             */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    1 if this is a TrueType font that uses one of the patented         */
-  /*    opcodes, 0 otherwise.                                              */
+  /*    1~if this is a TrueType font that uses one of the patented         */
+  /*    opcodes, 0~otherwise.                                              */
   /*                                                                       */
   /* <Since>                                                               */
   /*    2.3.5                                                              */
   /*                                                                       */
   /* <Since>                                                               */
   /*    2.3.5                                                              */
@@ -3413,7 +3847,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Return>                                                              */
   /*    The old setting value.  This will always be false if this is not   */
   /*                                                                       */
   /* <Return>                                                              */
   /*    The old setting value.  This will always be false if this is not   */
-  /*    a SFNT font, or if the unpatented hinter is not compiled in this   */
+  /*    an SFNT font, or if the unpatented hinter is not compiled in this  */
   /*    instance of the library.                                           */
   /*                                                                       */
   /* <Since>                                                               */
   /*    instance of the library.                                           */
   /*                                                                       */
   /* <Since>                                                               */
diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftadvanc.h b/reactos/lib/3rdparty/freetype/include/freetype/ftadvanc.h
new file mode 100644 (file)
index 0000000..b2451be
--- /dev/null
@@ -0,0 +1,179 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftadvanc.h                                                             */
+/*                                                                         */
+/*    Quick computation of advance widths (specification only).            */
+/*                                                                         */
+/*  Copyright 2008 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 __FTADVANC_H__
+#define __FTADVANC_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:
+   *   quick_advance
+   *
+   * @title:
+   *   Quick retrieval of advance values
+   *
+   * @abstract:
+   *   Retrieve horizontal and vertical advance values without processing
+   *   glyph outlines, if possible.
+   *
+   * @description:
+   *   This section contains functions to quickly extract advance values
+   *   without handling glyph outlines, if possible.
+   */
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Const>                                                               */
+  /*    FT_ADVANCE_FLAG_FAST_ONLY                                          */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A bit-flag to be OR-ed with the `flags' parameter of the           */
+  /*    @FT_Get_Advance and @FT_Get_Advances functions.                    */
+  /*                                                                       */
+  /*    If set, it indicates that you want these functions to fail if the  */
+  /*    corresponding hinting mode or font driver doesn't allow for very   */
+  /*    quick advance computation.                                         */
+  /*                                                                       */
+  /*    Typically, glyphs which are either unscaled, unhinted, bitmapped,  */
+  /*    or light-hinted can have their advance width computed very         */
+  /*    quickly.                                                           */
+  /*                                                                       */
+  /*    Normal and bytecode hinted modes, which require loading, scaling,  */
+  /*    and hinting of the glyph outline, are extremely slow by            */
+  /*    comparison.                                                        */
+  /*                                                                       */
+#define FT_ADVANCE_FLAG_FAST_ONLY  0x20000000UL
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Get_Advance                                                     */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Retrieve the advance value of a given glyph outline in an          */
+  /*    @FT_Face.  By default, the unhinted advance is returned in font    */
+  /*    units.                                                             */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face       :: The source @FT_Face handle.                          */
+  /*                                                                       */
+  /*    gindex     :: The glyph index.                                     */
+  /*                                                                       */
+  /*    load_flags :: A set of bit flags similar to those used when        */
+  /*                  calling @FT_Load_Glyph, used to determine what kind  */
+  /*                  of advances you need.                                */
+  /* <Output>                                                              */
+  /*    padvance :: The advance value, in either font units or 16.16       */
+  /*                format.                                                */
+  /*                                                                       */
+  /*                If @FT_LOAD_VERTICAL_LAYOUT is set, this is the        */
+  /*                vertical advance corresponding to a vertical layout.   */
+  /*                Otherwise, it is the horizontal advance in a           */
+  /*                horizontal layout.                                     */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and   */
+  /*    if the corresponding font backend doesn't have a quick way to      */
+  /*    retrieve the advances.                                             */
+  /*                                                                       */
+  /*    A scaled advance is returned in 16.16 format but isn't transformed */
+  /*    by the affine transformation specified by @FT_Set_Transform.       */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_Get_Advance( FT_Face    face,
+                  FT_UInt    gindex,
+                  FT_Int32   load_flags,
+                  FT_Fixed  *padvance );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Get_Advances                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Retrieve the advance values of several glyph outlines in an        */
+  /*    @FT_Face.  By default, the unhinted advances are returned in font  */
+  /*    units.                                                             */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face        :: The source @FT_Face handle.                         */
+  /*                                                                       */
+  /*    start       :: The first glyph index.                              */
+  /*                                                                       */
+  /*    count       :: The number of advance values you want to retrieve.  */
+  /*                                                                       */
+  /*    load_flags  :: A set of bit flags similar to those used when       */
+  /*                   calling @FT_Load_Glyph.                             */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    padvance :: The advances, in either font units or 16.16 format.    */
+  /*                This array must contain at least `count' elements.     */
+  /*                                                                       */
+  /*                If @FT_LOAD_VERTICAL_LAYOUT is set, these are the      */
+  /*                vertical advances corresponding to a vertical layout.  */
+  /*                Otherwise, they are the horizontal advances in a       */
+  /*                horizontal layout.                                     */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and   */
+  /*    if the corresponding font backend doesn't have a quick way to      */
+  /*    retrieve the advances.                                             */
+  /*                                                                       */
+  /*    Scaled advances are returned in 16.16 format but aren't            */
+  /*    transformed by the affine transformation specified by              */
+  /*    @FT_Set_Transform.                                                 */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_Get_Advances( FT_Face    face,
+                   FT_UInt    start,
+                   FT_UInt    count,
+                   FT_Int32   load_flags,
+                   FT_Fixed  *padvances );
+
+/* */
+
+
+FT_END_HEADER
+
+#endif /* __FTADVANC_H__ */
+
+
+/* END */
index 5f79c32..01fe3fb 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType exact bbox computation (specification).                     */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType exact bbox computation (specification).                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2003 by                                           */
+/*  Copyright 1996-2001, 2003, 2007 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -58,10 +58,10 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Get_BBox                                                */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Get_BBox                                                */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Computes the exact bounding box of an outline.  This is slower     */
+  /*    Compute the exact bounding box of an outline.  This is slower      */
   /*    than computing the control box.  However, it uses an advanced      */
   /*    algorithm which returns _very_ quickly when the two boxes          */
   /*    than computing the control box.  However, it uses an advanced      */
   /*    algorithm which returns _very_ quickly when the two boxes          */
-  /*    coincide.  Otherwise, the outline Bézier arcs are walked over to   */
+  /*    coincide.  Otherwise, the outline Bézier arcs are traversed to     */
   /*    extract their extrema.                                             */
   /*                                                                       */
   /* <Input>                                                               */
   /*    extract their extrema.                                             */
   /*                                                                       */
   /* <Input>                                                               */
@@ -71,7 +71,7 @@ FT_BEGIN_HEADER
   /*    abbox   :: The outline's exact bounding box.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /*    abbox   :: The outline's exact bounding box.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Get_BBox( FT_Outline*  outline,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Get_BBox( FT_Outline*  outline,
index 9555694..4f8baf8 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for accessing BDF-specific strings (specification).     */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType API for accessing BDF-specific strings (specification).     */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2006 by                                    */
+/*  Copyright 2002, 2003, 2004, 2006, 2009 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -38,38 +38,39 @@ FT_BEGIN_HEADER
   /*    bdf_fonts                                                          */
   /*                                                                       */
   /* <Title>                                                               */
   /*    bdf_fonts                                                          */
   /*                                                                       */
   /* <Title>                                                               */
-  /*    BDF Files                                                          */
+  /*    BDF and PCF Files                                                  */
   /*                                                                       */
   /* <Abstract>                                                            */
   /*                                                                       */
   /* <Abstract>                                                            */
-  /*    BDF specific API.                                                  */
+  /*    BDF and PCF specific API.                                          */
   /*                                                                       */
   /* <Description>                                                         */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    This section contains the declaration of BDF specific functions.   */
+  /*    This section contains the declaration of functions specific to BDF */
+  /*    and PCF fonts.                                                     */
   /*                                                                       */
   /*************************************************************************/
 
 
   /*                                                                       */
   /*************************************************************************/
 
 
- /**********************************************************************
-  *
-  * @enum:
-  *    FT_PropertyType
-  *
-  * @description:
-  *    A list of BDF property types.
-  *
-  * @values:
-  *    BDF_PROPERTY_TYPE_NONE ::
-  *      Value 0 is used to indicate a missing property.
-  *
-  *    BDF_PROPERTY_TYPE_ATOM ::
-  *      Property is a string atom.
-  *
-  *    BDF_PROPERTY_TYPE_INTEGER ::
-  *      Property is a 32-bit signed integer.
-  *
-  *    BDF_PROPERTY_TYPE_CARDINAL ::
-  *      Property is a 32-bit unsigned integer.
-  */
 /**********************************************************************
+   *
+   * @enum:
+   *    FT_PropertyType
+   *
+   * @description:
+   *    A list of BDF property types.
+   *
+   * @values:
+   *    BDF_PROPERTY_TYPE_NONE ::
+   *      Value~0 is used to indicate a missing property.
+   *
+   *    BDF_PROPERTY_TYPE_ATOM ::
+   *      Property is a string atom.
+   *
+   *    BDF_PROPERTY_TYPE_INTEGER ::
+   *      Property is a 32-bit signed integer.
+   *
+   *    BDF_PROPERTY_TYPE_CARDINAL ::
+   *      Property is a 32-bit unsigned integer.
+   */
   typedef enum  BDF_PropertyType_
   {
     BDF_PROPERTY_TYPE_NONE     = 0,
   typedef enum  BDF_PropertyType_
   {
     BDF_PROPERTY_TYPE_NONE     = 0,
@@ -80,15 +81,15 @@ FT_BEGIN_HEADER
   } BDF_PropertyType;
 
 
   } BDF_PropertyType;
 
 
- /**********************************************************************
-  *
-  * @type:
-  *    BDF_Property
-  *
-  * @description:
-  *    A handle to a @BDF_PropertyRec structure to model a given
-  *    BDF/PCF property.
-  */
 /**********************************************************************
+   *
+   * @type:
+   *    BDF_Property
+   *
+   * @description:
+   *    A handle to a @BDF_PropertyRec structure to model a given
+   *    BDF/PCF property.
+   */
   typedef struct BDF_PropertyRec_*  BDF_Property;
 
 
   typedef struct BDF_PropertyRec_*  BDF_Property;
 
 
@@ -132,7 +133,7 @@ FT_BEGIN_HEADER
   *    FT_Get_BDF_Charset_ID
   *
   * @description:
   *    FT_Get_BDF_Charset_ID
   *
   * @description:
-  *    Retrieves a BDF font character set identity, according to
+  *    Retrieve a BDF font character set identity, according to
   *    the BDF specification.
   *
   * @input:
   *    the BDF specification.
   *
   * @input:
@@ -141,13 +142,13 @@ FT_BEGIN_HEADER
   *
   * @output:
   *    acharset_encoding ::
   *
   * @output:
   *    acharset_encoding ::
-  *       Charset encoding, as a C string, owned by the face.
+  *       Charset encoding, as a C~string, owned by the face.
   *
   *    acharset_registry ::
   *
   *    acharset_registry ::
-  *       Charset registry, as a C string, owned by the face.
+  *       Charset registry, as a C~string, owned by the face.
   *
   * @return:
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *   This function only works with BDF faces, returning an error otherwise.
   *
   * @note:
   *   This function only works with BDF faces, returning an error otherwise.
@@ -164,7 +165,7 @@ FT_BEGIN_HEADER
   *    FT_Get_BDF_Property
   *
   * @description:
   *    FT_Get_BDF_Property
   *
   * @description:
-  *    Retrieves a BDF property from a BDF or PCF font file.
+  *    Retrieve a BDF property from a BDF or PCF font file.
   *
   * @input:
   *    face :: A handle to the input face.
   *
   * @input:
   *    face :: A handle to the input face.
@@ -175,13 +176,21 @@ FT_BEGIN_HEADER
   *    aproperty :: The property.
   *
   * @return:
   *    aproperty :: The property.
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *   This function works with BDF _and_ PCF fonts.  It returns an error
   *   otherwise.  It also returns an error if the property is not in the
   *   font.
   *
   *
   * @note:
   *   This function works with BDF _and_ PCF fonts.  It returns an error
   *   otherwise.  It also returns an error if the property is not in the
   *   font.
   *
+  *   A `property' is a either key-value pair within the STARTPROPERTIES
+  *   ... ENDPROPERTIES block of a BDF font or a key-value pair from the
+  *   `info->props' array within a `FontRec' structure of a PCF font.
+  *
+  *   Integer properties are always stored as `signed' within PCF fonts;
+  *   consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value
+  *   for BDF fonts only.
+  *
   *   In case of error, `aproperty->type' is always set to
   *   @BDF_PROPERTY_TYPE_NONE.
   */
   *   In case of error, `aproperty->type' is always set to
   *   @BDF_PROPERTY_TYPE_NONE.
   */
index 337d888..9274236 100644 (file)
@@ -2,10 +2,9 @@
 /*                                                                         */
 /*  ftbitmap.h                                                             */
 /*                                                                         */
 /*                                                                         */
 /*  ftbitmap.h                                                             */
 /*                                                                         */
-/*    FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */
-/*    bitmaps into 8bpp format (specification).                            */
+/*    FreeType utility functions for bitmaps (specification).              */
 /*                                                                         */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006 by                                          */
+/*  Copyright 2004, 2005, 2006, 2008 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -72,7 +71,7 @@ FT_BEGIN_HEADER
   /*    FT_Bitmap_Copy                                                     */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Bitmap_Copy                                                     */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Copies an bitmap into another one.                                 */
+  /*    Copy a bitmap into another one.                                    */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library :: A handle to a library object.                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library :: A handle to a library object.                           */
@@ -83,7 +82,7 @@ FT_BEGIN_HEADER
   /*    target  :: A handle to the target bitmap.                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*    target  :: A handle to the target bitmap.                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Bitmap_Copy( FT_Library        library,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Bitmap_Copy( FT_Library        library,
@@ -114,14 +113,14 @@ FT_BEGIN_HEADER
   /*    bitmap    :: A handle to the target bitmap.                        */
   /*                                                                       */
   /* <Return>                                                              */
   /*    bitmap    :: A handle to the target bitmap.                        */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The current implementation restricts `xStrength' to be less than   */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The current implementation restricts `xStrength' to be less than   */
-  /*    or equal to 8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.      */
+  /*    or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.      */
   /*                                                                       */
   /*    If you want to embolden the bitmap owned by a @FT_GlyphSlotRec,    */
   /*                                                                       */
   /*    If you want to embolden the bitmap owned by a @FT_GlyphSlotRec,    */
-  /*    you should call `FT_GlyphSlot_Own_Bitmap' on the slot first.       */
+  /*    you should call @FT_GlyphSlot_Own_Bitmap on the slot first.        */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Bitmap_Embolden( FT_Library  library,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Bitmap_Embolden( FT_Library  library,
@@ -152,7 +151,7 @@ FT_BEGIN_HEADER
   /*    target    :: The target bitmap.                                    */
   /*                                                                       */
   /* <Return>                                                              */
   /*    target    :: The target bitmap.                                    */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    It is possible to call @FT_Bitmap_Convert multiple times without   */
   /*                                                                       */
   /* <Note>                                                                */
   /*    It is possible to call @FT_Bitmap_Convert multiple times without   */
@@ -170,6 +169,28 @@ FT_BEGIN_HEADER
                      FT_Int            alignment );
 
 
                      FT_Int            alignment );
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_GlyphSlot_Own_Bitmap                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Make sure that a glyph slot owns `slot->bitmap'.                   */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    slot :: The glyph slot.                                            */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0~means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This function is to be used in combination with                    */
+  /*    @FT_Bitmap_Embolden.                                               */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot );
+
+
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -184,7 +205,7 @@ FT_BEGIN_HEADER
   /*    bitmap  :: The bitmap object to be freed.                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*    bitmap  :: The bitmap object to be freed.                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The `library' argument is taken to have access to FreeType's       */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The `library' argument is taken to have access to FreeType's       */
index 721aa16..0916d70 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Cache subsystem (specification).                            */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType Cache subsystem (specification).                            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -36,10 +36,10 @@ FT_BEGIN_HEADER
    *    Cache Sub-System
    *
    * <Abstract>
    *    Cache Sub-System
    *
    * <Abstract>
-   *    How to cache face, size, and glyph data with FreeType 2.
+   *    How to cache face, size, and glyph data with FreeType~2.
    *
    * <Description>
    *
    * <Description>
-   *   This section describes the FreeType 2 cache sub-system, which is used
+   *   This section describes the FreeType~2 cache sub-system, which is used
    *   to limit the number of concurrently opened @FT_Face and @FT_Size
    *   objects, as well as caching information like character maps and glyph
    *   images while limiting their maximum memory usage.
    *   to limit the number of concurrently opened @FT_Face and @FT_Size
    *   objects, as well as caching information like character maps and glyph
    *   images while limiting their maximum memory usage.
@@ -165,7 +165,7 @@ FT_BEGIN_HEADER
    *   Failure to do so will result in incorrect behaviour or even
    *   memory leaks and crashes.
    */
    *   Failure to do so will result in incorrect behaviour or even
    *   memory leaks and crashes.
    */
-  typedef struct FTC_FaceIDRec_*  FTC_FaceID;
+  typedef FT_Pointer  FTC_FaceID;
 
 
   /************************************************************************
 
 
   /************************************************************************
@@ -193,7 +193,7 @@ FT_BEGIN_HEADER
    *     A new @FT_Face handle.
    *
    * <Return>
    *     A new @FT_Face handle.
    *
    * <Return>
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * <Note>
    *   The third parameter `req_data' is the same as the one passed by the
    *
    * <Note>
    *   The third parameter `req_data' is the same as the one passed by the
@@ -260,7 +260,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    An opaque handle to a cache node object.  Each cache node is       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    An opaque handle to a cache node object.  Each cache node is       */
-  /*    reference-counted.  A node with a count of 0 might be flushed      */
+  /*    reference-counted.  A node with a count of~0 might be flushed      */
   /*    out of a full cache whenever a lookup request is performed.        */
   /*                                                                       */
   /*    If you lookup nodes, you have the ability to `acquire' them, i.e., */
   /*    out of a full cache whenever a lookup request is performed.        */
   /*                                                                       */
   /*    If you lookup nodes, you have the ability to `acquire' them, i.e., */
@@ -279,19 +279,19 @@ FT_BEGIN_HEADER
   /*    FTC_Manager_New                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FTC_Manager_New                                                    */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Creates a new cache manager.                                       */
+  /*    Create a new cache manager.                                        */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library   :: The parent FreeType library handle to use.            */
   /*                                                                       */
   /*    max_faces :: Maximum number of opened @FT_Face objects managed by  */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library   :: The parent FreeType library handle to use.            */
   /*                                                                       */
   /*    max_faces :: Maximum number of opened @FT_Face objects managed by  */
-  /*                 this cache instance.  Use 0 for defaults.             */
+  /*                 this cache instance.  Use~0 for defaults.             */
   /*                                                                       */
   /*    max_sizes :: Maximum number of opened @FT_Size objects managed by  */
   /*                                                                       */
   /*    max_sizes :: Maximum number of opened @FT_Size objects managed by  */
-  /*                 this cache instance.  Use 0 for defaults.             */
+  /*                 this cache instance.  Use~0 for defaults.             */
   /*                                                                       */
   /*    max_bytes :: Maximum number of bytes to use for cached data nodes. */
   /*                                                                       */
   /*    max_bytes :: Maximum number of bytes to use for cached data nodes. */
-  /*                 Use 0 for defaults.  Note that this value does not    */
+  /*                 Use~0 for defaults.  Note that this value does not    */
   /*                 account for managed @FT_Face and @FT_Size objects.    */
   /*                                                                       */
   /*    requester :: An application-provided callback used to translate    */
   /*                 account for managed @FT_Face and @FT_Size objects.    */
   /*                                                                       */
   /*    requester :: An application-provided callback used to translate    */
@@ -301,11 +301,11 @@ FT_BEGIN_HEADER
   /*                 each time it is called (see @FTC_Face_Requester).     */
   /*                                                                       */
   /* <Output>                                                              */
   /*                 each time it is called (see @FTC_Face_Requester).     */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    amanager  :: A handle to a new manager object.  0 in case of       */
+  /*    amanager  :: A handle to a new manager object.  0~in case of       */
   /*                 failure.                                              */
   /*                                                                       */
   /* <Return>                                                              */
   /*                 failure.                                              */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FTC_Manager_New( FT_Library          library,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FTC_Manager_New( FT_Library          library,
@@ -323,7 +323,7 @@ FT_BEGIN_HEADER
   /*    FTC_Manager_Reset                                                  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FTC_Manager_Reset                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Empties a given cache manager.  This simply gets rid of all the    */
+  /*    Empty a given cache manager.  This simply gets rid of all the      */
   /*    currently cached @FT_Face and @FT_Size objects within the manager. */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    currently cached @FT_Face and @FT_Size objects within the manager. */
   /*                                                                       */
   /* <InOut>                                                               */
@@ -339,7 +339,7 @@ FT_BEGIN_HEADER
   /*    FTC_Manager_Done                                                   */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FTC_Manager_Done                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Destroys a given manager after emptying it.                        */
+  /*    Destroy a given manager after emptying it.                         */
   /*                                                                       */
   /* <Input>                                                               */
   /*    manager :: A handle to the target cache manager object.            */
   /*                                                                       */
   /* <Input>                                                               */
   /*    manager :: A handle to the target cache manager object.            */
@@ -354,7 +354,7 @@ FT_BEGIN_HEADER
   /*    FTC_Manager_LookupFace                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FTC_Manager_LookupFace                                             */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieves the @FT_Face object that corresponds to a given face ID  */
+  /*    Retrieve the @FT_Face object that corresponds to a given face ID   */
   /*    through a cache manager.                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    through a cache manager.                                           */
   /*                                                                       */
   /* <Input>                                                               */
@@ -366,7 +366,7 @@ FT_BEGIN_HEADER
   /*    aface   :: A handle to the face object.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*    aface   :: A handle to the face object.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned @FT_Face object is always owned by the manager.  You  */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned @FT_Face object is always owned by the manager.  You  */
@@ -415,10 +415,10 @@ FT_BEGIN_HEADER
   /*               interpreted as integer pixel character sizes.           */
   /*               Otherwise, they are expressed as 1/64th of points.      */
   /*                                                                       */
   /*               interpreted as integer pixel character sizes.           */
   /*               Otherwise, they are expressed as 1/64th of points.      */
   /*                                                                       */
-  /*    x_res   :: Only used when `pixel' is value 0 to indicate the       */
+  /*    x_res   :: Only used when `pixel' is value~0 to indicate the       */
   /*               horizontal resolution in dpi.                           */
   /*                                                                       */
   /*               horizontal resolution in dpi.                           */
   /*                                                                       */
-  /*    y_res   :: Only used when `pixel' is value 0 to indicate the       */
+  /*    y_res   :: Only used when `pixel' is value~0 to indicate the       */
   /*               vertical resolution in dpi.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*               vertical resolution in dpi.                             */
   /*                                                                       */
   /* <Note>                                                                */
@@ -434,7 +434,18 @@ FT_BEGIN_HEADER
     FT_UInt     x_res;
     FT_UInt     y_res;
 
     FT_UInt     x_res;
     FT_UInt     y_res;
 
-  } FTC_ScalerRec, *FTC_Scaler;
+  } FTC_ScalerRec;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    FTC_Scaler                                                         */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to an @FTC_ScalerRec structure.                           */
+  /*                                                                       */
+  typedef struct FTC_ScalerRec_*  FTC_Scaler;
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -455,7 +466,7 @@ FT_BEGIN_HEADER
   /*    asize   :: A handle to the size object.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*    asize   :: A handle to the size object.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned @FT_Size object is always owned by the manager.  You  */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned @FT_Size object is always owned by the manager.  You  */
@@ -569,7 +580,7 @@ FT_BEGIN_HEADER
    *     A new cache handle.  NULL in case of error.
    *
    * @return:
    *     A new cache handle.  NULL in case of error.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   Like all other caches, this one will be destroyed with the cache
    *
    * @note:
    *   Like all other caches, this one will be destroyed with the cache
@@ -598,13 +609,14 @@ FT_BEGIN_HEADER
    *     The source face ID.
    *
    *   cmap_index ::
    *     The source face ID.
    *
    *   cmap_index ::
-   *     The index of the charmap in the source face.
+   *     The index of the charmap in the source face.  Any negative value
+   *     means to use the cache @FT_Face's default charmap.
    *
    *   char_code ::
    *     The character code (in the corresponding charmap).
    *
    * @return:
    *
    *   char_code ::
    *     The character code (in the corresponding charmap).
    *
    * @return:
-   *    Glyph index.  0 means `no glyph'.
+   *    Glyph index.  0~means `no glyph'.
    *
    */
   FT_EXPORT( FT_UInt )
    *
    */
   FT_EXPORT( FT_UInt )
@@ -710,7 +722,7 @@ FT_BEGIN_HEADER
   /*    FTC_ImageCache_New                                                 */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FTC_ImageCache_New                                                 */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Creates a new glyph image cache.                                   */
+  /*    Create a new glyph image cache.                                    */
   /*                                                                       */
   /* <Input>                                                               */
   /*    manager :: The parent manager for the image cache.                 */
   /*                                                                       */
   /* <Input>                                                               */
   /*    manager :: The parent manager for the image cache.                 */
@@ -719,7 +731,7 @@ FT_BEGIN_HEADER
   /*    acache  :: A handle to the new glyph image cache object.           */
   /*                                                                       */
   /* <Return>                                                              */
   /*    acache  :: A handle to the new glyph image cache object.           */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FTC_ImageCache_New( FTC_Manager      manager,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FTC_ImageCache_New( FTC_Manager      manager,
@@ -732,7 +744,7 @@ FT_BEGIN_HEADER
   /*    FTC_ImageCache_Lookup                                              */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FTC_ImageCache_Lookup                                              */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieves a given glyph image from a glyph image cache.            */
+  /*    Retrieve a given glyph image from a glyph image cache.             */
   /*                                                                       */
   /* <Input>                                                               */
   /*    cache  :: A handle to the source glyph image cache.                */
   /*                                                                       */
   /* <Input>                                                               */
   /*    cache  :: A handle to the source glyph image cache.                */
@@ -742,7 +754,7 @@ FT_BEGIN_HEADER
   /*    gindex :: The glyph index to retrieve.                             */
   /*                                                                       */
   /* <Output>                                                              */
   /*    gindex :: The glyph index to retrieve.                             */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    aglyph :: The corresponding @FT_Glyph object.  0 in case of        */
+  /*    aglyph :: The corresponding @FT_Glyph object.  0~in case of        */
   /*              failure.                                                 */
   /*                                                                       */
   /*    anode  :: Used to return the address of of the corresponding cache */
   /*              failure.                                                 */
   /*                                                                       */
   /*    anode  :: Used to return the address of of the corresponding cache */
@@ -750,7 +762,7 @@ FT_BEGIN_HEADER
   /*              below).                                                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*              below).                                                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned glyph is owned and managed by the glyph image cache.  */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned glyph is owned and managed by the glyph image cache.  */
@@ -795,7 +807,7 @@ FT_BEGIN_HEADER
   /*    gindex     :: The glyph index to retrieve.                         */
   /*                                                                       */
   /* <Output>                                                              */
   /*    gindex     :: The glyph index to retrieve.                         */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    aglyph     :: The corresponding @FT_Glyph object.  0 in case of    */
+  /*    aglyph     :: The corresponding @FT_Glyph object.  0~in case of    */
   /*                  failure.                                             */
   /*                                                                       */
   /*    anode      :: Used to return the address of of the corresponding   */
   /*                  failure.                                             */
   /*                                                                       */
   /*    anode      :: Used to return the address of of the corresponding   */
@@ -803,7 +815,7 @@ FT_BEGIN_HEADER
   /*                  (see note below).                                    */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  (see note below).                                    */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned glyph is owned and managed by the glyph image cache.  */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The returned glyph is owned and managed by the glyph image cache.  */
@@ -821,6 +833,9 @@ FT_BEGIN_HEADER
   /*    call to one of the caching sub-system APIs.  Don't assume that it  */
   /*    is persistent!                                                     */
   /*                                                                       */
   /*    call to one of the caching sub-system APIs.  Don't assume that it  */
   /*    is persistent!                                                     */
   /*                                                                       */
+  /*    Calls to @FT_Set_Char_Size and friends have no effect on cached    */
+  /*    glyphs; you should always use the FreeType cache API instead.      */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FTC_ImageCache_LookupScaler( FTC_ImageCache  cache,
                                FTC_Scaler      scaler,
   FT_EXPORT( FT_Error )
   FTC_ImageCache_LookupScaler( FTC_ImageCache  cache,
                                FTC_Scaler      scaler,
@@ -862,11 +877,11 @@ FT_BEGIN_HEADER
   /*    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 */
   /*    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 */
-  /*                 coordinates.                                        */
+  /*                 y~coordinates.                                        */
   /*                                                                       */
   /*    format    :: The format of the glyph bitmap (monochrome or gray).  */
   /*                                                                       */
   /*                                                                       */
   /*    format    :: The format of the glyph bitmap (monochrome or gray).  */
   /*                                                                       */
-  /*    max_grays :: Maximum gray level value (in the range 1 to 255).     */
+  /*    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.                                          */
   /*                                                                       */
   /*    pitch     :: The number of bytes per bitmap line.  May be positive */
   /*                 or negative.                                          */
@@ -915,7 +930,7 @@ FT_BEGIN_HEADER
   /*    FTC_SBitCache_New                                                  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FTC_SBitCache_New                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Creates a new cache to store small glyph bitmaps.                  */
+  /*    Create a new cache to store small glyph bitmaps.                   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    manager :: A handle to the source cache manager.                   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    manager :: A handle to the source cache manager.                   */
@@ -924,7 +939,7 @@ FT_BEGIN_HEADER
   /*    acache  :: A handle to the new sbit cache.  NULL in case of error. */
   /*                                                                       */
   /* <Return>                                                              */
   /*    acache  :: A handle to the new sbit cache.  NULL in case of error. */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FTC_SBitCache_New( FTC_Manager     manager,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FTC_SBitCache_New( FTC_Manager     manager,
@@ -937,7 +952,7 @@ FT_BEGIN_HEADER
   /*    FTC_SBitCache_Lookup                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FTC_SBitCache_Lookup                                               */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Looks up a given small glyph bitmap in a given sbit cache and      */
+  /*    Look up a given small glyph bitmap in a given sbit cache and       */
   /*    `lock' it to prevent its flushing from the cache until needed.     */
   /*                                                                       */
   /* <Input>                                                               */
   /*    `lock' it to prevent its flushing from the cache until needed.     */
   /*                                                                       */
   /* <Input>                                                               */
@@ -955,7 +970,7 @@ FT_BEGIN_HEADER
   /*              below).                                                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*              below).                                                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The small bitmap descriptor and its bit buffer are owned by the    */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The small bitmap descriptor and its bit buffer are owned by the    */
@@ -963,7 +978,7 @@ FT_BEGIN_HEADER
   /*    as well disappear from memory on the next cache lookup, so don't   */
   /*    treat them as persistent data.                                     */
   /*                                                                       */
   /*    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  */
+  /*    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     */
   /*    glyph bitmap.                                                      */
   /*                                                                       */
   /*    If `anode' is _not_ NULL, it receives the address of the cache     */
@@ -1010,7 +1025,7 @@ FT_BEGIN_HEADER
   /*                  (see note below).                                    */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  (see note below).                                    */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The small bitmap descriptor and its bit buffer are owned by the    */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The small bitmap descriptor and its bit buffer are owned by the    */
@@ -1018,7 +1033,7 @@ FT_BEGIN_HEADER
   /*    as well disappear from memory on the next cache lookup, so don't   */
   /*    treat them as persistent data.                                     */
   /*                                                                       */
   /*    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  */
+  /*    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     */
   /*    glyph bitmap.                                                      */
   /*                                                                       */
   /*    If `anode' is _not_ NULL, it receives the address of the cache     */
index bd812c8..7775a6b 100644 (file)
@@ -32,6 +32,7 @@
 /*    version                                                              */
 /*    basic_types                                                          */
 /*    base_interface                                                       */
 /*    version                                                              */
 /*    basic_types                                                          */
 /*    base_interface                                                       */
+/*    glyph_variants                                                       */
 /*    glyph_management                                                     */
 /*    mac_specific                                                         */
 /*    sizes_management                                                     */
 /*    glyph_management                                                     */
 /*    mac_specific                                                         */
 /*    sizes_management                                                     */
@@ -54,6 +55,7 @@
 /*    type1_tables                                                         */
 /*    sfnt_names                                                           */
 /*    bdf_fonts                                                            */
 /*    type1_tables                                                         */
 /*    sfnt_names                                                           */
 /*    bdf_fonts                                                            */
+/*    cid_fonts                                                            */
 /*    pfr_fonts                                                            */
 /*    winfnt_fonts                                                         */
 /*    font_formats                                                         */
 /*    pfr_fonts                                                            */
 /*    winfnt_fonts                                                         */
 /*    font_formats                                                         */
@@ -88,6 +90,7 @@
 /*    computations                                                         */
 /*    list_processing                                                      */
 /*    outline_processing                                                   */
 /*    computations                                                         */
 /*    list_processing                                                      */
 /*    outline_processing                                                   */
+/*    quick_advance                                                        */
 /*    bitmap_handling                                                      */
 /*    raster                                                               */
 /*    glyph_stroker                                                        */
 /*    bitmap_handling                                                      */
 /*    raster                                                               */
 /*    glyph_stroker                                                        */
diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftcid.h b/reactos/lib/3rdparty/freetype/include/freetype/ftcid.h
new file mode 100644 (file)
index 0000000..203a30c
--- /dev/null
@@ -0,0 +1,166 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftcid.h                                                                */
+/*                                                                         */
+/*    FreeType API for accessing CID font information (specification).     */
+/*                                                                         */
+/*  Copyright 2007, 2009 by Dereg Clegg, Michael Toftdal.                  */
+/*                                                                         */
+/*  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 __FTCID_H__
+#define __FTCID_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>                                                             */
+  /*    cid_fonts                                                          */
+  /*                                                                       */
+  /* <Title>                                                               */
+  /*    CID Fonts                                                          */
+  /*                                                                       */
+  /* <Abstract>                                                            */
+  /*    CID-keyed font specific API.                                       */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    This section contains the declaration of CID-keyed font specific   */
+  /*    functions.                                                         */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  /**********************************************************************
+   *
+   * @function:
+   *    FT_Get_CID_Registry_Ordering_Supplement
+   *
+   * @description:
+   *    Retrieve the Registry/Ordering/Supplement triple (also known as the
+   *    "R/O/S") from a CID-keyed font.
+   *
+   * @input:
+   *    face ::
+   *       A handle to the input face.
+   *
+   * @output:
+   *    registry ::
+   *       The registry, as a C~string, owned by the face.
+   *
+   *    ordering ::
+   *       The ordering, as a C~string, owned by the face.
+   *
+   *    supplement ::
+   *       The supplement.
+   *
+   * @return:
+   *    FreeType error code.  0~means success.
+   *
+   * @note:
+   *    This function only works with CID faces, returning an error
+   *    otherwise.
+   *
+   * @since:
+   *    2.3.6
+   */
+  FT_EXPORT( FT_Error )
+  FT_Get_CID_Registry_Ordering_Supplement( FT_Face       face,
+                                           const char*  *registry,
+                                           const char*  *ordering,
+                                           FT_Int       *supplement);
+
+
+  /**********************************************************************
+   *
+   * @function:
+   *    FT_Get_CID_Is_Internally_CID_Keyed
+   *
+   * @description:
+   *    Retrieve the type of the input face, CID keyed or not.  In
+   *    constrast to the @FT_IS_CID_KEYED macro this function returns
+   *    successfully also for CID-keyed fonts in an SNFT wrapper.
+   *
+   * @input:
+   *    face ::
+   *       A handle to the input face.
+   *
+   * @output:
+   *    is_cid ::
+   *       The type of the face as an @FT_Bool.
+   *
+   * @return:
+   *    FreeType error code.  0~means success.
+   *
+   * @note:
+   *    This function only works with CID faces and OpenType fonts,
+   *    returning an error otherwise.
+   *
+   * @since:
+   *    2.3.9
+   */
+  FT_EXPORT( FT_Error )
+  FT_Get_CID_Is_Internally_CID_Keyed( FT_Face   face,
+                                      FT_Bool  *is_cid );
+
+
+  /**********************************************************************
+   *
+   * @function:
+   *    FT_Get_CID_From_Glyph_Index
+   *
+   * @description:
+   *    Retrieve the CID of the input glyph index.
+   *
+   * @input:
+   *    face ::
+   *       A handle to the input face.
+   *
+   *    glyph_index ::
+   *       The input glyph index.
+   *
+   * @output:
+   *    cid ::
+   *       The CID as an @FT_UInt.
+   *
+   * @return:
+   *    FreeType error code.  0~means success.
+   *
+   * @note:
+   *    This function only works with CID faces and OpenType fonts,
+   *    returning an error otherwise.
+   *
+   * @since:
+   *    2.3.9
+   */
+  FT_EXPORT( FT_Error )
+  FT_Get_CID_From_Glyph_Index( FT_Face   face,
+                               FT_UInt   glyph_index,
+                               FT_UInt  *cid );
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __FTCID_H__ */
+
+
+/* END */
index 97cd330..91a769e 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Access of TrueType's `gasp' table (specification).                   */
 /*                                                                         */
 /*                                                                         */
 /*    Access of TrueType's `gasp' table (specification).                   */
 /*                                                                         */
-/*  Copyright 2007 by                                                      */
+/*  Copyright 2007, 2008 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #include <ft2build.h>
 #include FT_FREETYPE_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
+
+
   /***************************************************************************
    *
    * @section:
   /***************************************************************************
    *
    * @section:
    *   Gasp Table
    *
    * @abstract:
    *   Gasp Table
    *
    * @abstract:
-   *   Retrieving TrueType `gasp' table entries
+   *   Retrieving TrueType `gasp' table entries.
    *
    * @description:
    *   The function @FT_Get_Gasp can be used to query a TrueType or OpenType
    *
    * @description:
    *   The function @FT_Get_Gasp can be used to query a TrueType or OpenType
-   *   font for specific entries in their `gasp' table, if any.  This is
+   *   font for specific entries in its `gasp' table, if any.  This is
    *   mainly useful when implementing native TrueType hinting with the
    *   bytecode interpreter to duplicate the Windows text rendering results.
    */
    *   mainly useful when implementing native TrueType hinting with the
    *   bytecode interpreter to duplicate the Windows text rendering results.
    */
    *   ppem :: The vertical character pixel size.
    *
    * @return:
    *   ppem :: The vertical character pixel size.
    *
    * @return:
-   *   Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE is there is no
+   *   Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no
    *   `gasp' table in the face.
    *
    * @since:
    *   `gasp' table in the face.
    *
    * @since:
index 08058da..cacccf0 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType convenience functions to handle glyphs (specification).     */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType convenience functions to handle glyphs (specification).     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2006 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -145,7 +145,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    top    :: The top-side bearing, i.e., the vertical distance from   */
   /*              the current pen position to the top border of the glyph  */
   /*                                                                       */
   /*    top    :: The top-side bearing, i.e., the vertical distance from   */
   /*              the current pen position to the top border of the glyph  */
-  /*              bitmap.  This distance is positive for upwards-y!        */
+  /*              bitmap.  This distance is positive for upwards~y!        */
   /*                                                                       */
   /*    bitmap :: A descriptor for the bitmap.                             */
   /*                                                                       */
   /*                                                                       */
   /*    bitmap :: A descriptor for the bitmap.                             */
   /*                                                                       */
@@ -194,7 +194,7 @@ FT_BEGIN_HEADER
   /*    outline :: A descriptor for the outline.                           */
   /*                                                                       */
   /* <Note>                                                                */
   /*    outline :: A descriptor for the outline.                           */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    You can typecast a @FT_Glyph to @FT_OutlineGlyph if you have       */
+  /*    You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have      */
   /*    `glyph->format == FT_GLYPH_FORMAT_OUTLINE'.  This lets you access  */
   /*    the outline's content easily.                                      */
   /*                                                                       */
   /*    `glyph->format == FT_GLYPH_FORMAT_OUTLINE'.  This lets you access  */
   /*    the outline's content easily.                                      */
   /*                                                                       */
@@ -219,7 +219,8 @@ FT_BEGIN_HEADER
   /*    FT_Get_Glyph                                                       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_Glyph                                                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A function used to extract a glyph image from a slot.              */
+  /*    A function used to extract a glyph image from a slot.  Note that   */
+  /*    the created @FT_Glyph object must be released with @FT_Done_Glyph. */
   /*                                                                       */
   /* <Input>                                                               */
   /*    slot   :: A handle to the source glyph slot.                       */
   /*                                                                       */
   /* <Input>                                                               */
   /*    slot   :: A handle to the source glyph slot.                       */
@@ -228,7 +229,7 @@ FT_BEGIN_HEADER
   /*    aglyph :: A handle to the glyph object.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*    aglyph :: A handle to the glyph object.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Get_Glyph( FT_GlyphSlot  slot,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Get_Glyph( FT_GlyphSlot  slot,
@@ -248,11 +249,11 @@ FT_BEGIN_HEADER
   /*    source :: A handle to the source glyph object.                     */
   /*                                                                       */
   /* <Output>                                                              */
   /*    source :: A handle to the source glyph object.                     */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    target :: A handle to the target glyph object.  0 in case of       */
+  /*    target :: A handle to the target glyph object.  0~in case of       */
   /*              error.                                                   */
   /*                                                                       */
   /* <Return>                                                              */
   /*              error.                                                   */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Glyph_Copy( FT_Glyph   source,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Glyph_Copy( FT_Glyph   source,
@@ -265,7 +266,7 @@ FT_BEGIN_HEADER
   /*    FT_Glyph_Transform                                                 */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Glyph_Transform                                                 */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Transforms a glyph image if its format is scalable.                */
+  /*    Transform a glyph image if its format is scalable.                 */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    glyph  :: A handle to the target glyph object.                     */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    glyph  :: A handle to the target glyph object.                     */
@@ -375,7 +376,7 @@ FT_BEGIN_HEADER
   /*             expressed in 1/64th of pixels if it is grid-fitted.       */
   /*                                                                       */
   /* <Note>                                                                */
   /*             expressed in 1/64th of pixels if it is grid-fitted.       */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    Coordinates are relative to the glyph origin, using the Y-upwards  */
+  /*    Coordinates are relative to the glyph origin, using the y~upwards  */
   /*    convention.                                                        */
   /*                                                                       */
   /*    If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode'   */
   /*    convention.                                                        */
   /*                                                                       */
   /*    If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode'   */
@@ -421,17 +422,17 @@ FT_BEGIN_HEADER
   /*    FT_Glyph_To_Bitmap                                                 */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Glyph_To_Bitmap                                                 */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Converts a given glyph object to a bitmap glyph object.            */
+  /*    Convert a given glyph object to a bitmap glyph object.             */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    the_glyph   :: A pointer to a handle to the target glyph.          */
   /*                                                                       */
   /* <Input>                                                               */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    the_glyph   :: A pointer to a handle to the target glyph.          */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    render_mode :: An enumeration that describe how the data is        */
+  /*    render_mode :: An enumeration that describes how the data is       */
   /*                   rendered.                                           */
   /*                                                                       */
   /*    origin      :: A pointer to a vector used to translate the glyph   */
   /*                   rendered.                                           */
   /*                                                                       */
   /*    origin      :: A pointer to a vector used to translate the glyph   */
-  /*                   image before rendering.  Can be 0 (if no            */
+  /*                   image before rendering.  Can be~0 (if no            */
   /*                   translation).  The origin is expressed in           */
   /*                   26.6 pixels.                                        */
   /*                                                                       */
   /*                   translation).  The origin is expressed in           */
   /*                   26.6 pixels.                                        */
   /*                                                                       */
@@ -440,15 +441,17 @@ FT_BEGIN_HEADER
   /*                   never destroyed in case of error.                   */
   /*                                                                       */
   /* <Return>                                                              */
   /*                   never destroyed in case of error.                   */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*                                                                       */
   /* <Note>                                                                */
+  /*    This function does nothing if the glyph format isn't scalable.     */
+  /*                                                                       */
   /*    The glyph image is translated with the `origin' vector before      */
   /*    rendering.                                                         */
   /*                                                                       */
   /*    The first parameter is a pointer to an @FT_Glyph handle, that will */
   /*    The glyph image is translated with the `origin' vector before      */
   /*    rendering.                                                         */
   /*                                                                       */
   /*    The first parameter is a pointer to an @FT_Glyph handle, that will */
-  /*    be replaced by this function.  Typically, you would use (omitting  */
-  /*    error handling):                                                   */
+  /*    be _replaced_ by this function (with newly allocated data).        */
+  /*    Typically, you would use (omitting error handling):                */
   /*                                                                       */
   /*                                                                       */
   /*      {                                                                */
   /*                                                                       */
   /*                                                                       */
   /*      {                                                                */
@@ -462,12 +465,12 @@ FT_BEGIN_HEADER
   /*        // extract glyph image                                         */
   /*        error = FT_Get_Glyph( face->glyph, &glyph );                   */
   /*                                                                       */
   /*        // extract glyph image                                         */
   /*        error = FT_Get_Glyph( face->glyph, &glyph );                   */
   /*                                                                       */
-  /*        // convert to a bitmap (default render mode + destroy old)     */
+  /*        // convert to a bitmap (default render mode + destroying old)  */
   /*        if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )                 */
   /*        {                                                              */
   /*          error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_DEFAULT,  */
   /*                                      0, 1 );                          */
   /*        if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )                 */
   /*        {                                                              */
   /*          error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_DEFAULT,  */
   /*                                      0, 1 );                          */
-  /*          if ( error ) // glyph unchanged                              */
+  /*          if ( error ) // `glyph' unchanged                            */
   /*            ...                                                        */
   /*        }                                                              */
   /*                                                                       */
   /*            ...                                                        */
   /*        }                                                              */
   /*                                                                       */
@@ -482,7 +485,42 @@ FT_BEGIN_HEADER
   /*      }                                                                */
   /*                                                                       */
   /*                                                                       */
   /*      }                                                                */
   /*                                                                       */
   /*                                                                       */
-  /*    This function does nothing if the glyph format isn't scalable.     */
+  /*    Here another example, again without error handling:                */
+  /*                                                                       */
+  /*                                                                       */
+  /*      {                                                                */
+  /*        FT_Glyph  glyphs[MAX_GLYPHS]                                   */
+  /*                                                                       */
+  /*                                                                       */
+  /*        ...                                                            */
+  /*                                                                       */
+  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */
+  /*          error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||       */
+  /*                  FT_Get_Glyph ( face->glyph, &glyph[idx] );           */
+  /*                                                                       */
+  /*        ...                                                            */
+  /*                                                                       */
+  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */
+  /*        {                                                              */
+  /*          FT_Glyph  bitmap = glyphs[idx];                              */
+  /*                                                                       */
+  /*                                                                       */
+  /*          ...                                                          */
+  /*                                                                       */
+  /*          // after this call, `bitmap' no longer points into           */
+  /*          // the `glyphs' array (and the old value isn't destroyed)    */
+  /*          FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );    */
+  /*                                                                       */
+  /*          ...                                                          */
+  /*                                                                       */
+  /*          FT_Done_Glyph( bitmap );                                     */
+  /*        }                                                              */
+  /*                                                                       */
+  /*        ...                                                            */
+  /*                                                                       */
+  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */
+  /*          FT_Done_Glyph( glyphs[idx] );                                */
+  /*      }                                                                */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,
@@ -497,7 +535,7 @@ FT_BEGIN_HEADER
   /*    FT_Done_Glyph                                                      */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Done_Glyph                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Destroys a given glyph.                                            */
+  /*    Destroy a given glyph.                                             */
   /*                                                                       */
   /* <Input>                                                               */
   /*    glyph :: A handle to the target glyph object.                      */
   /*                                                                       */
   /* <Input>                                                               */
   /*    glyph :: A handle to the target glyph object.                      */
@@ -524,7 +562,7 @@ FT_BEGIN_HEADER
   /*    FT_Matrix_Multiply                                                 */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Matrix_Multiply                                                 */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Performs the matrix operation `b = a*b'.                           */
+  /*    Perform the matrix operation `b = a*b'.                            */
   /*                                                                       */
   /* <Input>                                                               */
   /*    a :: A pointer to matrix `a'.                                      */
   /*                                                                       */
   /* <Input>                                                               */
   /*    a :: A pointer to matrix `a'.                                      */
@@ -537,7 +575,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   FT_EXPORT( void )
   FT_Matrix_Multiply( const FT_Matrix*  a,
   /*                                                                       */
   FT_EXPORT( void )
   FT_Matrix_Multiply( const FT_Matrix*  a,
-                      FT_Matrix*  b );
+                      FT_Matrix*        b );
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -546,14 +584,14 @@ FT_BEGIN_HEADER
   /*    FT_Matrix_Invert                                                   */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Matrix_Invert                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Inverts a 2x2 matrix.  Returns an error if it can't be inverted.   */
+  /*    Invert a 2x2 matrix.  Return an error if it can't be inverted.     */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    matrix :: A pointer to the target matrix.  Remains untouched in    */
   /*              case of error.                                           */
   /*                                                                       */
   /* <Return>                                                              */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    matrix :: A pointer to the target matrix.  Remains untouched in    */
   /*              case of error.                                           */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Matrix_Invert( FT_Matrix*  matrix );
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Matrix_Invert( FT_Matrix*  matrix );
index c7ea861..497015c 100644 (file)
@@ -202,7 +202,7 @@ FT_BEGIN_HEADER
   *       The array itself must be allocated by a client.
   *
   * @return:
   *       The array itself must be allocated by a client.
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *   This function only works with TrueTypeGX fonts, returning an error
   *
   * @note:
   *   This function only works with TrueTypeGX fonts, returning an error
@@ -285,14 +285,14 @@ FT_BEGIN_HEADER
   *    FT_ClassicKern_Validate
   *
   * @description:
   *    FT_ClassicKern_Validate
   *
   * @description:
-  *    Validate classic (16bit format) kern table to assure that the offsets
+  *    Validate classic (16-bit format) kern table to assure that the offsets
   *    and indices are valid.  The idea is that a higher-level library which
   *    actually does the text layout can access those tables without error
   *    checking (which can be quite time consuming).
   *
   *    The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
   *    and indices are valid.  The idea is that a higher-level library which
   *    actually does the text layout can access those tables without error
   *    checking (which can be quite time consuming).
   *
   *    The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
-  *    the new 32bit format and the classic 16bit format, while
-  *    FT_ClassicKern_Validate only supports the classic 16bit format.
+  *    the new 32-bit format and the classic 16-bit format, while
+  *    FT_ClassicKern_Validate only supports the classic 16-bit format.
   *
   * @input:
   *    face ::
   *
   * @input:
   *    face ::
@@ -307,7 +307,7 @@ FT_BEGIN_HEADER
   *       A pointer to the kern table.
   *
   * @return:
   *       A pointer to the kern table.
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *   After use, the application should deallocate the buffers pointed to by
   *
   * @note:
   *   After use, the application should deallocate the buffers pointed to by
index 9893437..acbc4f0 100644 (file)
@@ -66,7 +66,7 @@ FT_BEGIN_HEADER
   *     The source stream.
   *
   * @return:
   *     The source stream.
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *   The source stream must be opened _before_ calling this function.
   *
   * @note:
   *   The source stream must be opened _before_ calling this function.
index 1c428f1..2fcc113 100644 (file)
@@ -5,7 +5,7 @@
 /*    FreeType glyph image formats and default raster interface            */
 /*    (specification).                                                     */
 /*                                                                         */
 /*    FreeType glyph image formats and default raster interface            */
 /*    (specification).                                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -28,7 +28,7 @@
 #define __FTIMAGE_H__
 
 
 #define __FTIMAGE_H__
 
 
-/* _STANDALONE_ is from ftgrays.c */
+  /* _STANDALONE_ is from ftgrays.c */
 #ifndef _STANDALONE_
 #include <ft2build.h>
 #endif
 #ifndef _STANDALONE_
 #include <ft2build.h>
 #endif
@@ -53,7 +53,7 @@ FT_BEGIN_HEADER
   /* <Description>                                                         */
   /*    The type FT_Pos is a 32-bit integer used to store vectorial        */
   /*    coordinates.  Depending on the context, these can represent        */
   /* <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 16,16, or 26.6 fixed float     */
+  /*    distances in integer font units, or 16.16, or 26.6 fixed float     */
   /*    pixel coordinates.                                                 */
   /*                                                                       */
   typedef signed long  FT_Pos;
   /*    pixel coordinates.                                                 */
   /*                                                                       */
   typedef signed long  FT_Pos;
@@ -119,39 +119,40 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_PIXEL_MODE_NONE ::                                              */
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_PIXEL_MODE_NONE ::                                              */
-  /*      Value 0 is reserved.                                             */
+  /*      Value~0 is reserved.                                             */
   /*                                                                       */
   /*    FT_PIXEL_MODE_MONO ::                                              */
   /*                                                                       */
   /*    FT_PIXEL_MODE_MONO ::                                              */
-  /*      A monochrome bitmap, using 1 bit per pixel.  Note that pixels    */
+  /*      A monochrome bitmap, using 1~bit per pixel.  Note that pixels    */
   /*      are stored in most-significant order (MSB), which means that     */
   /*      the left-most pixel in a byte has value 128.                     */
   /*                                                                       */
   /*    FT_PIXEL_MODE_GRAY ::                                              */
   /*      An 8-bit bitmap, generally used to represent anti-aliased glyph  */
   /*      images.  Each pixel is stored in one byte.  Note that the number */
   /*      are stored in most-significant order (MSB), which means that     */
   /*      the left-most pixel in a byte has value 128.                     */
   /*                                                                       */
   /*    FT_PIXEL_MODE_GRAY ::                                              */
   /*      An 8-bit bitmap, generally used to represent anti-aliased glyph  */
   /*      images.  Each pixel is stored in one byte.  Note that the number */
-  /*      of value `gray' levels is stored in the `num_bytes' field of     */
-  /*      the @FT_Bitmap structure (it generally is 256).                  */
+  /*      of `gray' levels is stored in the `num_grays' field of the       */
+  /*      @FT_Bitmap structure (it generally is 256).                      */
   /*                                                                       */
   /*    FT_PIXEL_MODE_GRAY2 ::                                             */
   /*                                                                       */
   /*    FT_PIXEL_MODE_GRAY2 ::                                             */
-  /*      A 2-bit/pixel bitmap, used to represent embedded anti-aliased    */
-  /*      bitmaps in font files according to the OpenType specification.   */
-  /*      We haven't found a single font using this format, however.       */
+  /*      A 2-bit per pixel bitmap, used to represent embedded             */
+  /*      anti-aliased bitmaps in font files according to the OpenType     */
+  /*      specification.  We haven't found a single font using this        */
+  /*      format, however.                                                 */
   /*                                                                       */
   /*    FT_PIXEL_MODE_GRAY4 ::                                             */
   /*                                                                       */
   /*    FT_PIXEL_MODE_GRAY4 ::                                             */
-  /*      A 4-bit/pixel bitmap, used to represent embedded anti-aliased    */
+  /*      A 4-bit per pixel bitmap, representing embedded anti-aliased     */
   /*      bitmaps in font files according to the OpenType specification.   */
   /*      We haven't found a single font using this format, however.       */
   /*                                                                       */
   /*    FT_PIXEL_MODE_LCD ::                                               */
   /*      bitmaps in font files according to the OpenType specification.   */
   /*      We haven't found a single font using this format, however.       */
   /*                                                                       */
   /*    FT_PIXEL_MODE_LCD ::                                               */
-  /*      An 8-bit bitmap, used to represent RGB or BGR decimated glyph    */
-  /*      images used for display on LCD displays; the bitmap is three     */
-  /*      times wider than the original glyph image.  See also             */
+  /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */
+  /*      used for display on LCD displays; the bitmap is three times      */
+  /*      wider than the original glyph image.  See also                   */
   /*      @FT_RENDER_MODE_LCD.                                             */
   /*                                                                       */
   /*    FT_PIXEL_MODE_LCD_V ::                                             */
   /*      @FT_RENDER_MODE_LCD.                                             */
   /*                                                                       */
   /*    FT_PIXEL_MODE_LCD_V ::                                             */
-  /*      An 8-bit bitmap, used to represent RGB or BGR decimated glyph    */
-  /*      images used for display on rotated LCD displays; the bitmap      */
-  /*      is three times taller than the original glyph image.  See also   */
+  /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */
+  /*      used for display on rotated LCD displays; the bitmap is three    */
+  /*      times taller than the original glyph image.  See also            */
   /*      @FT_RENDER_MODE_LCD_V.                                           */
   /*                                                                       */
   typedef enum  FT_Pixel_Mode_
   /*      @FT_RENDER_MODE_LCD_V.                                           */
   /*                                                                       */
   typedef enum  FT_Pixel_Mode_
@@ -206,11 +207,11 @@ FT_BEGIN_HEADER
   /*    An enumeration type to describe the format of a bitmap palette,    */
   /*    used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8.               */
   /*                                                                       */
   /*    An enumeration type to describe the format of a bitmap palette,    */
   /*    used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8.               */
   /*                                                                       */
-  /* <Fields>                                                              */
-  /*    ft_palette_mode_rgb  :: The palette is an array of 3-bytes RGB     */
+  /* <Values>                                                              */
+  /*    ft_palette_mode_rgb  :: The palette is an array of 3-byte RGB      */
   /*                            records.                                   */
   /*                                                                       */
   /*                            records.                                   */
   /*                                                                       */
-  /*    ft_palette_mode_rgba :: The palette is an array of 4-bytes RGBA    */
+  /*    ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA     */
   /*                            records.                                   */
   /*                                                                       */
   /* <Note>                                                                */
   /*                            records.                                   */
   /*                                                                       */
   /* <Note>                                                                */
@@ -222,7 +223,7 @@ FT_BEGIN_HEADER
     ft_palette_mode_rgb = 0,
     ft_palette_mode_rgba,
 
     ft_palette_mode_rgb = 0,
     ft_palette_mode_rgba,
 
-    ft_palettte_mode_max   /* do not remove */
+    ft_palette_mode_max   /* do not remove */
 
   } FT_Palette_Mode;
 
 
   } FT_Palette_Mode;
 
@@ -317,14 +318,23 @@ FT_BEGIN_HEADER
   /*                  elements, giving the outline's point coordinates.    */
   /*                                                                       */
   /*    tags       :: A pointer to an array of `n_points' chars, giving    */
   /*                  elements, giving the outline's point coordinates.    */
   /*                                                                       */
   /*    tags       :: A pointer to an array of `n_points' chars, giving    */
-  /*                  each outline point's type.  If bit 0 is unset, the   */
-  /*                  point is `off' the curve, i.e., a Bézier control     */
-  /*                  point, while it is `on' when set.                    */
+  /*                  each outline point's type.                           */
+  /*                                                                       */
+  /*                  If bit~0 is unset, the point is `off' the curve,     */
+  /*                  i.e., a Bézier control point, while it is `on' if    */
+  /*                  set.                                                 */
   /*                                                                       */
   /*                                                                       */
-  /*                  Bit 1 is meaningful for `off' points only.  If set,  */
+  /*                  Bit~1 is meaningful for `off' points only.  If set,  */
   /*                  it indicates a third-order Bézier arc control point; */
   /*                  and a second-order control point if unset.           */
   /*                                                                       */
   /*                  it indicates a third-order Bézier arc control point; */
   /*                  and a second-order control point if unset.           */
   /*                                                                       */
+  /*                  If bit~2 is set, bits 5-7 contain the drop-out mode  */
+  /*                  (as defined in the OpenType specification; the value */
+  /*                  is the same as the argument to the SCANMODE          */
+  /*                  instruction).                                        */
+  /*                                                                       */
+  /*                  Bits 3 and~4 are reserved for internal purposes.     */
+  /*                                                                       */
   /*    contours   :: An array of `n_contours' shorts, giving the end      */
   /*                  point of each contour within the outline.  For       */
   /*                  example, the first contour is defined by the points  */
   /*    contours   :: An array of `n_contours' shorts, giving the end      */
   /*                  point of each contour within the outline.  For       */
   /*                  example, the first contour is defined by the points  */
@@ -335,6 +345,12 @@ FT_BEGIN_HEADER
   /*                  and give hints to the scan-converter and hinter on   */
   /*                  how to convert/grid-fit it.  See @FT_OUTLINE_FLAGS.  */
   /*                                                                       */
   /*                  and give hints to the scan-converter and hinter on   */
   /*                  how to convert/grid-fit it.  See @FT_OUTLINE_FLAGS.  */
   /*                                                                       */
+  /* <Note>                                                                */
+  /*    The B/W rasterizer only checks bit~2 in the `tags' array for the   */
+  /*    first point of each contour.  The drop-out mode as given with      */
+  /*    @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and       */
+  /*    @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden.           */
+  /*                                                                       */
   typedef struct  FT_Outline_
   {
     short       n_contours;      /* number of contours in glyph        */
   typedef struct  FT_Outline_
   {
     short       n_contours;      /* number of contours in glyph        */
@@ -348,71 +364,91 @@ FT_BEGIN_HEADER
 
   } FT_Outline;
 
 
   } FT_Outline;
 
+  /* Following limits must be consistent with */
+  /* FT_Outline.{n_contours,n_points}         */
+#define FT_OUTLINE_CONTOURS_MAX  SHRT_MAX
+#define FT_OUTLINE_POINTS_MAX    SHRT_MAX
+
 
   /*************************************************************************/
   /*                                                                       */
   /* <Enum>                                                                */
 
   /*************************************************************************/
   /*                                                                       */
   /* <Enum>                                                                */
-  /*   FT_OUTLINE_FLAGS                                                    */
+  /*    FT_OUTLINE_FLAGS                                                   */
   /*                                                                       */
   /* <Description>                                                         */
   /*    A list of bit-field constants use for the flags in an outline's    */
   /*    `flags' field.                                                     */
   /*                                                                       */
   /* <Values>                                                              */
   /*                                                                       */
   /* <Description>                                                         */
   /*    A list of bit-field constants use for the flags in an outline's    */
   /*    `flags' field.                                                     */
   /*                                                                       */
   /* <Values>                                                              */
-  /*    FT_OUTLINE_NONE           :: Value 0 is reserved.                  */
-  /*                                                                       */
-  /*    FT_OUTLINE_OWNER          :: If set, this flag indicates that the  */
-  /*                                 outline's field arrays (i.e.,         */
-  /*                                 `points', `flags' & `contours') are   */
-  /*                                 `owned' by the outline object, and    */
-  /*                                 should thus be freed when it is       */
-  /*                                 destroyed.                            */
-  /*                                                                       */
-  /*   FT_OUTLINE_EVEN_ODD_FILL   :: By default, outlines are filled using */
-  /*                                 the non-zero winding rule.  If set to */
-  /*                                 1, the outline will be filled using   */
-  /*                                 the even-odd fill rule (only works    */
-  /*                                 with the smooth raster).              */
-  /*                                                                       */
-  /*   FT_OUTLINE_REVERSE_FILL    :: By default, outside contours of an    */
-  /*                                 outline are oriented in clock-wise    */
-  /*                                 direction, as defined in the TrueType */
-  /*                                 specification.  This flag is set if   */
-  /*                                 the outline uses the opposite         */
-  /*                                 direction (typically for Type 1       */
-  /*                                 fonts).  This flag is ignored by the  */
-  /*                                 scan-converter.                       */
-  /*                                                                       */
-  /*   FT_OUTLINE_IGNORE_DROPOUTS :: By default, the scan converter will   */
-  /*                                 try to detect drop-outs in an outline */
-  /*                                 and correct the glyph bitmap to       */
-  /*                                 ensure consistent shape continuity.   */
-  /*                                 If set, this flag hints the scan-line */
-  /*                                 converter to ignore such cases.       */
-  /*                                                                       */
-  /*   FT_OUTLINE_HIGH_PRECISION  :: This flag indicates that the          */
-  /*                                 scan-line converter should try to     */
-  /*                                 convert this outline to bitmaps with  */
-  /*                                 the highest possible quality.  It is  */
-  /*                                 typically set for small character     */
-  /*                                 sizes.  Note that this is only a      */
-  /*                                 hint, that might be completely        */
-  /*                                 ignored by a given scan-converter.    */
-  /*                                                                       */
-  /*   FT_OUTLINE_SINGLE_PASS     :: This flag is set to force a given     */
-  /*                                 scan-converter to only use a single   */
-  /*                                 pass over the outline to render a     */
-  /*                                 bitmap glyph image.  Normally, it is  */
-  /*                                 set for very large character sizes.   */
-  /*                                 It is only a hint, that might be      */
-  /*                                 completely ignored by a given         */
-  /*                                 scan-converter.                       */
+  /*    FT_OUTLINE_NONE ::                                                 */
+  /*      Value~0 is reserved.                                             */
+  /*                                                                       */
+  /*    FT_OUTLINE_OWNER ::                                                */
+  /*      If set, this flag indicates that the outline's field arrays      */
+  /*      (i.e., `points', `flags', and `contours') are `owned' by the     */
+  /*      outline object, and should thus be freed when it is destroyed.   */
+  /*                                                                       */
+  /*    FT_OUTLINE_EVEN_ODD_FILL ::                                        */
+  /*      By default, outlines are filled using the non-zero winding rule. */
+  /*      If set to 1, the outline will be filled using the even-odd fill  */
+  /*      rule (only works with the smooth rasterizer).                    */
+  /*                                                                       */
+  /*    FT_OUTLINE_REVERSE_FILL ::                                         */
+  /*      By default, outside contours of an outline are oriented in       */
+  /*      clock-wise direction, as defined in the TrueType specification.  */
+  /*      This flag is set if the outline uses the opposite direction      */
+  /*      (typically for Type~1 fonts).  This flag is ignored by the scan  */
+  /*      converter.                                                       */
+  /*                                                                       */
+  /*    FT_OUTLINE_IGNORE_DROPOUTS ::                                      */
+  /*      By default, the scan converter will try to detect drop-outs in   */
+  /*      an outline and correct the glyph bitmap to ensure consistent     */
+  /*      shape continuity.  If set, this flag hints the scan-line         */
+  /*      converter to ignore such cases.  See below for more information. */
+  /*                                                                       */
+  /*    FT_OUTLINE_SMART_DROPOUTS ::                                       */
+  /*      Select smart dropout control.  If unset, use simple dropout      */
+  /*      control.  Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See    */
+  /*      below for more information.                                      */
+  /*                                                                       */
+  /*    FT_OUTLINE_INCLUDE_STUBS ::                                        */
+  /*      If set, turn pixels on for `stubs', otherwise exclude them.      */
+  /*      Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See below for    */
+  /*      more information.                                                */
+  /*                                                                       */
+  /*    FT_OUTLINE_HIGH_PRECISION ::                                       */
+  /*      This flag indicates that the scan-line converter should try to   */
+  /*      convert this outline to bitmaps with the highest possible        */
+  /*      quality.  It is typically set for small character sizes.  Note   */
+  /*      that this is only a hint that might be completely ignored by a   */
+  /*      given scan-converter.                                            */
+  /*                                                                       */
+  /*    FT_OUTLINE_SINGLE_PASS ::                                          */
+  /*      This flag is set to force a given scan-converter to only use a   */
+  /*      single pass over the outline to render a bitmap glyph image.     */
+  /*      Normally, it is set for very large character sizes.  It is only  */
+  /*      a hint that might be completely ignored by a given               */
+  /*      scan-converter.                                                  */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */
+  /*    and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth            */
+  /*    rasterizer.                                                        */
+  /*                                                                       */
+  /*    There exists a second mechanism to pass the drop-out mode to the   */
+  /*    B/W rasterizer; see the `tags' field in @FT_Outline.               */
+  /*                                                                       */
+  /*    Please refer to the description of the `SCANTYPE' instruction in   */
+  /*    the OpenType specification (in file `ttinst1.doc') how simple      */
+  /*    drop-outs, smart drop-outs, and stubs are defined.                 */
   /*                                                                       */
 #define FT_OUTLINE_NONE             0x0
 #define FT_OUTLINE_OWNER            0x1
 #define FT_OUTLINE_EVEN_ODD_FILL    0x2
 #define FT_OUTLINE_REVERSE_FILL     0x4
 #define FT_OUTLINE_IGNORE_DROPOUTS  0x8
   /*                                                                       */
 #define FT_OUTLINE_NONE             0x0
 #define FT_OUTLINE_OWNER            0x1
 #define FT_OUTLINE_EVEN_ODD_FILL    0x2
 #define FT_OUTLINE_REVERSE_FILL     0x4
 #define FT_OUTLINE_IGNORE_DROPOUTS  0x8
+#define FT_OUTLINE_SMART_DROPOUTS   0x10
+#define FT_OUTLINE_INCLUDE_STUBS    0x20
 
 #define FT_OUTLINE_HIGH_PRECISION   0x100
 #define FT_OUTLINE_SINGLE_PASS      0x200
 
 #define FT_OUTLINE_HIGH_PRECISION   0x100
 #define FT_OUTLINE_SINGLE_PASS      0x200
@@ -448,21 +484,24 @@ FT_BEGIN_HEADER
 
 #define FT_CURVE_TAG( flag )  ( flag & 3 )
 
 
 #define FT_CURVE_TAG( flag )  ( flag & 3 )
 
-#define FT_CURVE_TAG_ON           1
-#define FT_CURVE_TAG_CONIC        0
-#define FT_CURVE_TAG_CUBIC        2
+#define FT_CURVE_TAG_ON            1
+#define FT_CURVE_TAG_CONIC         0
+#define FT_CURVE_TAG_CUBIC         2
+
+#define FT_CURVE_TAG_HAS_SCANMODE  4
 
 
-#define FT_CURVE_TAG_TOUCH_X      8  /* reserved for the TrueType hinter */
-#define FT_CURVE_TAG_TOUCH_Y     16  /* reserved for the TrueType hinter */
+#define FT_CURVE_TAG_TOUCH_X       8  /* reserved for the TrueType hinter */
+#define FT_CURVE_TAG_TOUCH_Y      16  /* reserved for the TrueType hinter */
 
 
-#define FT_CURVE_TAG_TOUCH_BOTH  ( FT_CURVE_TAG_TOUCH_X | \
-                                   FT_CURVE_TAG_TOUCH_Y )
+#define FT_CURVE_TAG_TOUCH_BOTH    ( FT_CURVE_TAG_TOUCH_X | \
+                                     FT_CURVE_TAG_TOUCH_Y )
+
+#define FT_Curve_Tag_On       FT_CURVE_TAG_ON
+#define FT_Curve_Tag_Conic    FT_CURVE_TAG_CONIC
+#define FT_Curve_Tag_Cubic    FT_CURVE_TAG_CUBIC
+#define FT_Curve_Tag_Touch_X  FT_CURVE_TAG_TOUCH_X
+#define FT_Curve_Tag_Touch_Y  FT_CURVE_TAG_TOUCH_Y
 
 
-#define  FT_Curve_Tag_On       FT_CURVE_TAG_ON
-#define  FT_Curve_Tag_Conic    FT_CURVE_TAG_CONIC
-#define  FT_Curve_Tag_Cubic    FT_CURVE_TAG_CUBIC
-#define  FT_Curve_Tag_Touch_X  FT_CURVE_TAG_TOUCH_X
-#define  FT_Curve_Tag_Touch_Y  FT_CURVE_TAG_TOUCH_Y
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -482,7 +521,7 @@ FT_BEGIN_HEADER
   /*            decomposition function.                                    */
   /*                                                                       */
   /* <Return>                                                              */
   /*            decomposition function.                                    */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Error code.  0~means success.                                      */
   /*                                                                       */
   typedef int
   (*FT_Outline_MoveToFunc)( const FT_Vector*  to,
   /*                                                                       */
   typedef int
   (*FT_Outline_MoveToFunc)( const FT_Vector*  to,
@@ -490,6 +529,7 @@ FT_BEGIN_HEADER
 
 #define FT_Outline_MoveTo_Func  FT_Outline_MoveToFunc
 
 
 #define FT_Outline_MoveTo_Func  FT_Outline_MoveToFunc
 
+
   /*************************************************************************/
   /*                                                                       */
   /* <FuncType>                                                            */
   /*************************************************************************/
   /*                                                                       */
   /* <FuncType>                                                            */
@@ -508,13 +548,14 @@ FT_BEGIN_HEADER
   /*            decomposition function.                                    */
   /*                                                                       */
   /* <Return>                                                              */
   /*            decomposition function.                                    */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Error code.  0~means success.                                      */
   /*                                                                       */
   typedef int
   (*FT_Outline_LineToFunc)( const FT_Vector*  to,
                             void*             user );
 
   /*                                                                       */
   typedef int
   (*FT_Outline_LineToFunc)( const FT_Vector*  to,
                             void*             user );
 
-#define  FT_Outline_LineTo_Func  FT_Outline_LineToFunc
+#define FT_Outline_LineTo_Func  FT_Outline_LineToFunc
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -538,14 +579,15 @@ FT_BEGIN_HEADER
   /*               the decomposition function.                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*               the decomposition function.                             */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Error code.  0~means success.                                      */
   /*                                                                       */
   typedef int
   (*FT_Outline_ConicToFunc)( const FT_Vector*  control,
                              const FT_Vector*  to,
                              void*             user );
 
   /*                                                                       */
   typedef int
   (*FT_Outline_ConicToFunc)( const FT_Vector*  control,
                              const FT_Vector*  to,
                              void*             user );
 
-#define  FT_Outline_ConicTo_Func  FT_Outline_ConicToFunc
+#define FT_Outline_ConicTo_Func  FT_Outline_ConicToFunc
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -569,7 +611,7 @@ FT_BEGIN_HEADER
   /*                the decomposition function.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*                the decomposition function.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Error code.  0~means success.                                      */
   /*                                                                       */
   typedef int
   (*FT_Outline_CubicToFunc)( const FT_Vector*  control1,
   /*                                                                       */
   typedef int
   (*FT_Outline_CubicToFunc)( const FT_Vector*  control1,
@@ -577,7 +619,7 @@ FT_BEGIN_HEADER
                              const FT_Vector*  to,
                              void*             user );
 
                              const FT_Vector*  to,
                              void*             user );
 
-#define  FT_Outline_CubicTo_Func  FT_Outline_CubicToFunc
+#define FT_Outline_CubicTo_Func  FT_Outline_CubicToFunc
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -615,7 +657,7 @@ FT_BEGIN_HEADER
   /*      y' = (x << shift) - delta                                        */
   /*    }                                                                  */
   /*                                                                       */
   /*      y' = (x << shift) - delta                                        */
   /*    }                                                                  */
   /*                                                                       */
-  /*    Set the value of `shift' and `delta' to 0 to get the original      */
+  /*    Set the value of `shift' and `delta' to~0 to get the original      */
   /*    point coordinates.                                                 */
   /*                                                                       */
   typedef struct  FT_Outline_Funcs_
   /*    point coordinates.                                                 */
   /*                                                                       */
   typedef struct  FT_Outline_Funcs_
@@ -648,7 +690,7 @@ FT_BEGIN_HEADER
   /*    This macro converts four-letter tags to an unsigned long type.     */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This macro converts four-letter tags to an unsigned long type.     */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    Since many 16bit compilers don't like 32bit enumerations, you      */
+  /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */
   /*    should redefine this macro in case of problems to something like   */
   /*    this:                                                              */
   /*                                                                       */
   /*    should redefine this macro in case of problems to something like   */
   /*    this:                                                              */
   /*                                                                       */
@@ -680,7 +722,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_GLYPH_FORMAT_NONE ::                                            */
   /*                                                                       */
   /* <Values>                                                              */
   /*    FT_GLYPH_FORMAT_NONE ::                                            */
-  /*      The value 0 is reserved.                                         */
+  /*      The value~0 is reserved.                                         */
   /*                                                                       */
   /*    FT_GLYPH_FORMAT_COMPOSITE ::                                       */
   /*      The glyph image is a composite of several other images.  This    */
   /*                                                                       */
   /*    FT_GLYPH_FORMAT_COMPOSITE ::                                       */
   /*      The glyph image is a composite of several other images.  This    */
@@ -700,7 +742,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    FT_GLYPH_FORMAT_PLOTTER ::                                         */
   /*      The glyph image is a vectorial path with no inside and outside   */
   /*                                                                       */
   /*    FT_GLYPH_FORMAT_PLOTTER ::                                         */
   /*      The glyph image is a vectorial path with no inside and outside   */
-  /*      contours.  Some Type 1 fonts, like those in the Hershey family,  */
+  /*      contours.  Some Type~1 fonts, like those in the Hershey family,  */
   /*      contain glyphs in this format.  These are described as           */
   /*      @FT_Outline, but FreeType isn't currently capable of rendering   */
   /*      them correctly.                                                  */
   /*      contain glyphs in this format.  These are described as           */
   /*      @FT_Outline, but FreeType isn't currently capable of rendering   */
   /*      them correctly.                                                  */
@@ -812,10 +854,11 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Note>                                                                */
   /*    This structure is used by the span drawing callback type named     */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This structure is used by the span drawing callback type named     */
-  /*    @FT_SpanFunc which takes the y-coordinate of the span as a         */
+  /*    @FT_SpanFunc which takes the y~coordinate of the span as a         */
   /*    a parameter.                                                       */
   /*                                                                       */
   /*    a parameter.                                                       */
   /*                                                                       */
-  /*    The coverage value is always between 0 and 255.                    */
+  /*    The coverage value is always between 0 and 255.  If you want less  */
+  /*    gray values, the callback function has to reduce them.             */
   /*                                                                       */
   typedef struct  FT_Span_
   {
   /*                                                                       */
   typedef struct  FT_Span_
   {
@@ -837,7 +880,7 @@ FT_BEGIN_HEADER
   /*    spans on each scan line.                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    spans on each scan line.                                           */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    y     :: The scanline's y-coordinate.                              */
+  /*    y     :: The scanline's y~coordinate.                              */
   /*                                                                       */
   /*    count :: The number of spans to draw on this scanline.             */
   /*                                                                       */
   /*                                                                       */
   /*    count :: The number of spans to draw on this scanline.             */
   /*                                                                       */
@@ -854,8 +897,8 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    Note that the `count' field cannot be greater than a fixed value   */
   /*    defined by the `FT_MAX_GRAY_SPANS' configuration macro in          */
   /*                                                                       */
   /*    Note that the `count' field cannot be greater than a fixed value   */
   /*    defined by the `FT_MAX_GRAY_SPANS' configuration macro in          */
-  /*    `ftoption.h'.  By default, this value is set to 32, which means    */
-  /*    that if there are more than 32 spans on a given scanline, the      */
+  /*    `ftoption.h'.  By default, this value is set to~32, which means    */
+  /*    that if there are more than 32~spans on a given scanline, the      */
   /*    callback is called several times with the same `y' parameter in    */
   /*    order to draw all callbacks.                                       */
   /*                                                                       */
   /*    callback is called several times with the same `y' parameter in    */
   /*    order to draw all callbacks.                                       */
   /*                                                                       */
@@ -868,7 +911,7 @@ FT_BEGIN_HEADER
                   const FT_Span*  spans,
                   void*           user );
 
                   const FT_Span*  spans,
                   void*           user );
 
-#define FT_Raster_Span_Func   FT_SpanFunc
+#define FT_Raster_Span_Func  FT_SpanFunc
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -885,14 +928,14 @@ FT_BEGIN_HEADER
   /*    per-se the TrueType spec.                                          */
   /*                                                                       */
   /* <Input>                                                               */
   /*    per-se the TrueType spec.                                          */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    y     :: The pixel's y-coordinate.                                 */
+  /*    y     :: The pixel's y~coordinate.                                 */
   /*                                                                       */
   /*                                                                       */
-  /*    x     :: The pixel's x-coordinate.                                 */
+  /*    x     :: The pixel's x~coordinate.                                 */
   /*                                                                       */
   /*    user  :: User-supplied data that is passed to the callback.        */
   /*                                                                       */
   /* <Return>                                                              */
   /*                                                                       */
   /*    user  :: User-supplied data that is passed to the callback.        */
   /*                                                                       */
   /* <Return>                                                              */
-  /*   1 if the pixel is `set', 0 otherwise.                               */
+  /*   1~if the pixel is `set', 0~otherwise.                               */
   /*                                                                       */
   typedef int
   (*FT_Raster_BitTest_Func)( int    y,
   /*                                                                       */
   typedef int
   (*FT_Raster_BitTest_Func)( int    y,
@@ -913,14 +956,14 @@ FT_BEGIN_HEADER
   /*    drop-out control according to the TrueType specification.          */
   /*                                                                       */
   /* <Input>                                                               */
   /*    drop-out control according to the TrueType specification.          */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    y     :: The pixel's y-coordinate.                                 */
+  /*    y     :: The pixel's y~coordinate.                                 */
   /*                                                                       */
   /*                                                                       */
-  /*    x     :: The pixel's x-coordinate.                                 */
+  /*    x     :: The pixel's x~coordinate.                                 */
   /*                                                                       */
   /*    user  :: User-supplied data that is passed to the callback.        */
   /*                                                                       */
   /* <Return>                                                              */
   /*                                                                       */
   /*    user  :: User-supplied data that is passed to the callback.        */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    1 if the pixel is `set', 0 otherwise.                              */
+  /*    1~if the pixel is `set', 0~otherwise.                              */
   /*                                                                       */
   typedef void
   (*FT_Raster_BitSet_Func)( int    y,
   /*                                                                       */
   typedef void
   (*FT_Raster_BitSet_Func)( int    y,
@@ -999,7 +1042,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    gray_spans  :: The gray span drawing callback.                     */
   /*                                                                       */
   /*                                                                       */
   /*    gray_spans  :: The gray span drawing callback.                     */
   /*                                                                       */
-  /*    black_spans :: The black span drawing callback.                    */
+  /*    black_spans :: The black span drawing callback.  UNIMPLEMENTED!    */
   /*                                                                       */
   /*    bit_test    :: The bit test callback.  UNIMPLEMENTED!              */
   /*                                                                       */
   /*                                                                       */
   /*    bit_test    :: The bit test callback.  UNIMPLEMENTED!              */
   /*                                                                       */
@@ -1036,7 +1079,7 @@ FT_BEGIN_HEADER
     const void*             source;
     int                     flags;
     FT_SpanFunc             gray_spans;
     const void*             source;
     int                     flags;
     FT_SpanFunc             gray_spans;
-    FT_SpanFunc             black_spans;
+    FT_SpanFunc             black_spans;  /* doesn't work! */
     FT_Raster_BitTest_Func  bit_test;     /* doesn't work! */
     FT_Raster_BitSet_Func   bit_set;      /* doesn't work! */
     void*                   user;
     FT_Raster_BitTest_Func  bit_test;     /* doesn't work! */
     FT_Raster_BitSet_Func   bit_set;      /* doesn't work! */
     void*                   user;
@@ -1060,7 +1103,7 @@ FT_BEGIN_HEADER
   /*    raster :: A handle to the new raster object.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /*    raster :: A handle to the new raster object.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Error code.  0~means success.                                      */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The `memory' parameter is a typeless pointer in order to avoid     */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The `memory' parameter is a typeless pointer in order to avoid     */
@@ -1073,7 +1116,8 @@ FT_BEGIN_HEADER
   (*FT_Raster_NewFunc)( void*       memory,
                         FT_Raster*  raster );
 
   (*FT_Raster_NewFunc)( void*       memory,
                         FT_Raster*  raster );
 
-#define  FT_Raster_New_Func    FT_Raster_NewFunc
+#define FT_Raster_New_Func  FT_Raster_NewFunc
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -1089,7 +1133,8 @@ FT_BEGIN_HEADER
   typedef void
   (*FT_Raster_DoneFunc)( FT_Raster  raster );
 
   typedef void
   (*FT_Raster_DoneFunc)( FT_Raster  raster );
 
-#define  FT_Raster_Done_Func   FT_Raster_DoneFunc
+#define FT_Raster_Done_Func  FT_Raster_DoneFunc
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -1123,7 +1168,8 @@ FT_BEGIN_HEADER
                           unsigned char*  pool_base,
                           unsigned long   pool_size );
 
                           unsigned char*  pool_base,
                           unsigned long   pool_size );
 
-#define  FT_Raster_Reset_Func   FT_Raster_ResetFunc
+#define FT_Raster_Reset_Func  FT_Raster_ResetFunc
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -1148,7 +1194,8 @@ FT_BEGIN_HEADER
                             unsigned long  mode,
                             void*          args );
 
                             unsigned long  mode,
                             void*          args );
 
-#define  FT_Raster_Set_Mode_Func  FT_Raster_SetModeFunc
+#define FT_Raster_Set_Mode_Func  FT_Raster_SetModeFunc
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -1156,8 +1203,8 @@ FT_BEGIN_HEADER
   /*    FT_Raster_RenderFunc                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Raster_RenderFunc                                               */
   /*                                                                       */
   /* <Description>                                                         */
-  /*   Invokes a given raster to scan-convert a given glyph image into a   */
-  /*   target bitmap.                                                      */
+  /*    Invoke a given raster to scan-convert a given glyph image into a   */
+  /*    target bitmap.                                                     */
   /*                                                                       */
   /* <Input>                                                               */
   /*    raster :: A handle to the raster object.                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    raster :: A handle to the raster object.                           */
@@ -1166,7 +1213,7 @@ FT_BEGIN_HEADER
   /*              store the rendering parameters.                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*              store the rendering parameters.                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Error code.  0~means success.                                      */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The exact format of the source image depends on the raster's glyph */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The exact format of the source image depends on the raster's glyph */
@@ -1188,7 +1235,8 @@ FT_BEGIN_HEADER
   (*FT_Raster_RenderFunc)( FT_Raster                raster,
                            const FT_Raster_Params*  params );
 
   (*FT_Raster_RenderFunc)( FT_Raster                raster,
                            const FT_Raster_Params*  params );
 
-#define  FT_Raster_Render_Func    FT_Raster_RenderFunc
+#define FT_Raster_Render_Func  FT_Raster_RenderFunc
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
@@ -1211,12 +1259,12 @@ FT_BEGIN_HEADER
   /*                                                                       */
   typedef struct  FT_Raster_Funcs_
   {
   /*                                                                       */
   typedef struct  FT_Raster_Funcs_
   {
-    FT_Glyph_Format         glyph_format;
-    FT_Raster_NewFunc       raster_new;
-    FT_Raster_ResetFunc     raster_reset;
-    FT_Raster_SetModeFunc   raster_set_mode;
-    FT_Raster_RenderFunc    raster_render;
-    FT_Raster_DoneFunc      raster_done;
+    FT_Glyph_Format        glyph_format;
+    FT_Raster_NewFunc      raster_new;
+    FT_Raster_ResetFunc    raster_reset;
+    FT_Raster_SetModeFunc  raster_set_mode;
+    FT_Raster_RenderFunc   raster_render;
+    FT_Raster_DoneFunc     raster_done;
 
   } FT_Raster_Funcs;
 
 
   } FT_Raster_Funcs;
 
index 46bc8bd..96abede 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType incremental loading (specification).                        */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType incremental loading (specification).                        */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2006, 2007 by                                    */
+/*  Copyright 2002, 2003, 2006, 2007, 2008 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
- /***************************************************************************
-  *
-  * @section:
-  *    incremental
-  *
-  * @title:
-  *    Incremental Loading
-  *
-  * @abstract:
-  *    Custom Glyph Loading.
-  *
-  * @description:
-  *   This section contains various functions used to perform so-called
-  *   `incremental' glyph loading.  This is a mode where all glyphs loaded
-  *   from a given @FT_Face are provided by the client application,
-  *
-  *   Apart from that, all other tables are loaded normally from the font
-  *   file.  This mode is useful when FreeType is used within another
-  *   engine, e.g., a Postscript Imaging Processor.
-  *
-  *   To enable this mode, you must use @FT_Open_Face, passing an
-  *   @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an
-  *   @FT_Incremental_Interface value.  See the comments for
-  *   @FT_Incremental_InterfaceRec for an example.
-  *
-  */
-
-
- /***************************************************************************
-  *
-  * @type:
-  *   FT_Incremental
-  *
-  * @description:
-  *   An opaque type describing a user-provided object used to implement
-  *   `incremental' glyph loading within FreeType.  This is used to support
-  *   embedded fonts in certain environments (e.g., Postscript interpreters),
-  *   where the glyph data isn't in the font file, or must be overridden by
-  *   different values.
-  *
-  * @note:
-  *   It is up to client applications to create and implement @FT_Incremental
-  *   objects, as long as they provide implementations for the methods
-  *   @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc
-  *   and @FT_Incremental_GetGlyphMetricsFunc.
-  *
-  *   See the description of @FT_Incremental_InterfaceRec to understand how
-  *   to use incremental objects with FreeType.
-  */
+  /***************************************************************************
+   *
+   * @section:
+   *    incremental
+   *
+   * @title:
+   *    Incremental Loading
+   *
+   * @abstract:
+   *    Custom Glyph Loading.
+   *
+   * @description:
+   *   This section contains various functions used to perform so-called
+   *   `incremental' glyph loading.  This is a mode where all glyphs loaded
+   *   from a given @FT_Face are provided by the client application,
+   *
+   *   Apart from that, all other tables are loaded normally from the font
+   *   file.  This mode is useful when FreeType is used within another
+   *   engine, e.g., a PostScript Imaging Processor.
+   *
+   *   To enable this mode, you must use @FT_Open_Face, passing an
+   *   @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an
+   *   @FT_Incremental_Interface value.  See the comments for
+   *   @FT_Incremental_InterfaceRec for an example.
+   *
+   */
+
+
+  /***************************************************************************
+   *
+   * @type:
+   *   FT_Incremental
+   *
+   * @description:
+   *   An opaque type describing a user-provided object used to implement
+   *   `incremental' glyph loading within FreeType.  This is used to support
+   *   embedded fonts in certain environments (e.g., PostScript interpreters),
+   *   where the glyph data isn't in the font file, or must be overridden by
+   *   different values.
+   *
+   * @note:
+   *   It is up to client applications to create and implement @FT_Incremental
+   *   objects, as long as they provide implementations for the methods
+   *   @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc
+   *   and @FT_Incremental_GetGlyphMetricsFunc.
+   *
+   *   See the description of @FT_Incremental_InterfaceRec to understand how
+   *   to use incremental objects with FreeType.
+   *
+   */
   typedef struct FT_IncrementalRec_*  FT_Incremental;
 
 
   typedef struct FT_IncrementalRec_*  FT_Incremental;
 
 
- /***************************************************************************
-  *
-  * @struct:
-  *   FT_Incremental_Metrics
-  *
-  * @description:
-  *   A small structure used to contain the basic glyph metrics returned
-  *   by the @FT_Incremental_GetGlyphMetricsFunc method.
-  *
-  * @fields:
-  *   bearing_x ::
-  *     Left bearing, in font units.
-  *
-  *   bearing_y ::
-  *     Top bearing, in font units.
-  *
-  *   advance ::
-  *     Glyph advance, in font units.
-  *
-  * @note:
-  *   These correspond to horizontal or vertical metrics depending on the
-  *   value of the `vertical' argument to the function
-  *   @FT_Incremental_GetGlyphMetricsFunc.
-  */
+  /***************************************************************************
+   *
+   * @struct:
+   *   FT_Incremental_MetricsRec
+   *
+   * @description:
+   *   A small structure used to contain the basic glyph metrics returned
+   *   by the @FT_Incremental_GetGlyphMetricsFunc method.
+   *
+   * @fields:
+   *   bearing_x ::
+   *     Left bearing, in font units.
+   *
+   *   bearing_y ::
+   *     Top bearing, in font units.
+   *
+   *   advance ::
+   *     Glyph advance, in font units.
+   *
+   * @note:
+   *   These correspond to horizontal or vertical metrics depending on the
+   *   value of the `vertical' argument to the function
+   *   @FT_Incremental_GetGlyphMetricsFunc.
+   *
+   */
   typedef struct  FT_Incremental_MetricsRec_
   {
     FT_Long  bearing_x;
     FT_Long  bearing_y;
     FT_Long  advance;
 
   typedef struct  FT_Incremental_MetricsRec_
   {
     FT_Long  bearing_x;
     FT_Long  bearing_y;
     FT_Long  advance;
 
-  } FT_Incremental_MetricsRec, *FT_Incremental_Metrics;
-
-
- /***************************************************************************
-  *
-  * @type:
-  *   FT_Incremental_GetGlyphDataFunc
-  *
-  * @description:
-  *   A function called by FreeType to access a given glyph's data bytes
-  *   during @FT_Load_Glyph or @FT_Load_Char if incremental loading is
-  *   enabled.
-  *
-  *   Note that the format of the glyph's data bytes depends on the font
-  *   file format.  For TrueType, it must correspond to the raw bytes within
-  *   the `glyf' table.  For Postscript formats, it must correspond to the
-  *   *unencrypted* charstring bytes, without any `lenIV' header.  It is
-  *   undefined for any other format.
-  *
-  * @input:
-  *   incremental ::
-  *     Handle to an opaque @FT_Incremental handle provided by the client
-  *     application.
-  *
-  *   glyph_index ::
-  *     Index of relevant glyph.
-  *
-  * @output:
-  *   adata ::
-  *     A structure describing the returned glyph data bytes (which will be
-  *     accessed as a read-only byte block).
-  *
-  * @return:
-  *   FreeType error code.  0 means success.
-  *
-  * @note:
-  *   If this function returns successfully the method
-  *   @FT_Incremental_FreeGlyphDataFunc will be called later to release
-  *   the data bytes.
-  *
-  *   Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for
-  *   compound glyphs.
-  */
+  } FT_Incremental_MetricsRec;
+
+
+  /***************************************************************************
+   *
+   * @struct:
+   *   FT_Incremental_Metrics
+   *
+   * @description:
+   *   A handle to an @FT_Incremental_MetricsRec structure.
+   *
+   */
+   typedef struct FT_Incremental_MetricsRec_*  FT_Incremental_Metrics;
+
+
+  /***************************************************************************
+   *
+   * @type:
+   *   FT_Incremental_GetGlyphDataFunc
+   *
+   * @description:
+   *   A function called by FreeType to access a given glyph's data bytes
+   *   during @FT_Load_Glyph or @FT_Load_Char if incremental loading is
+   *   enabled.
+   *
+   *   Note that the format of the glyph's data bytes depends on the font
+   *   file format.  For TrueType, it must correspond to the raw bytes within
+   *   the `glyf' table.  For PostScript formats, it must correspond to the
+   *   *unencrypted* charstring bytes, without any `lenIV' header.  It is
+   *   undefined for any other format.
+   *
+   * @input:
+   *   incremental ::
+   *     Handle to an opaque @FT_Incremental handle provided by the client
+   *     application.
+   *
+   *   glyph_index ::
+   *     Index of relevant glyph.
+   *
+   * @output:
+   *   adata ::
+   *     A structure describing the returned glyph data bytes (which will be
+   *     accessed as a read-only byte block).
+   *
+   * @return:
+   *   FreeType error code.  0~means success.
+   *
+   * @note:
+   *   If this function returns successfully the method
+   *   @FT_Incremental_FreeGlyphDataFunc will be called later to release
+   *   the data bytes.
+   *
+   *   Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for
+   *   compound glyphs.
+   *
+   */
   typedef FT_Error
   (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental  incremental,
                                       FT_UInt         glyph_index,
                                       FT_Data*        adata );
 
 
   typedef FT_Error
   (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental  incremental,
                                       FT_UInt         glyph_index,
                                       FT_Data*        adata );
 
 
- /***************************************************************************
-  *
-  * @type:
-  *   FT_Incremental_FreeGlyphDataFunc
-  *
-  * @description:
-  *   A function used to release the glyph data bytes returned by a
-  *   successful call to @FT_Incremental_GetGlyphDataFunc.
-  *
-  * @input:
-  *   incremental ::
-  *     A handle to an opaque @FT_Incremental handle provided by the client
-  *     application.
-  *
-  *   data ::
-  *     A structure describing the glyph data bytes (which will be accessed
-  *     as a read-only byte block).
-  */
+  /***************************************************************************
+   *
+   * @type:
+   *   FT_Incremental_FreeGlyphDataFunc
+   *
+   * @description:
+   *   A function used to release the glyph data bytes returned by a
+   *   successful call to @FT_Incremental_GetGlyphDataFunc.
+   *
+   * @input:
+   *   incremental ::
+   *     A handle to an opaque @FT_Incremental handle provided by the client
+   *     application.
+   *
+   *   data ::
+   *     A structure describing the glyph data bytes (which will be accessed
+   *     as a read-only byte block).
+   *
+   */
   typedef void
   (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental  incremental,
                                        FT_Data*        data );
 
 
   typedef void
   (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental  incremental,
                                        FT_Data*        data );
 
 
- /***************************************************************************
-  *
-  * @type:
-  *   FT_Incremental_GetGlyphMetricsFunc
-  *
-  * @description:
-  *   A function used to retrieve the basic metrics of a given glyph index
-  *   before accessing its data.  This is necessary because, in certain
-  *   formats like TrueType, the metrics are stored in a different place from
-  *   the glyph images proper.
-  *
-  * @input:
-  *   incremental ::
-  *     A handle to an opaque @FT_Incremental handle provided by the client
-  *     application.
-  *
-  *   glyph_index ::
-  *     Index of relevant glyph.
-  *
-  *   vertical ::
-  *     If true, return vertical metrics.
-  *
-  *   ametrics ::
-  *     This parameter is used for both input and output.
-  *     The original glyph metrics, if any, in font units.  If metrics are
-  *     not available all the values must be set to zero.
-  *
-  * @output:
-  *   ametrics ::
-  *     The replacement glyph metrics in font units.
-  *
-  */
 /***************************************************************************
+   *
+   * @type:
+   *   FT_Incremental_GetGlyphMetricsFunc
+   *
+   * @description:
+   *   A function used to retrieve the basic metrics of a given glyph index
+   *   before accessing its data.  This is necessary because, in certain
+   *   formats like TrueType, the metrics are stored in a different place from
+   *   the glyph images proper.
+   *
+   * @input:
+   *   incremental ::
+   *     A handle to an opaque @FT_Incremental handle provided by the client
+   *     application.
+   *
+   *   glyph_index ::
+   *     Index of relevant glyph.
+   *
+   *   vertical ::
+   *     If true, return vertical metrics.
+   *
+   *   ametrics ::
+   *     This parameter is used for both input and output.
+   *     The original glyph metrics, if any, in font units.  If metrics are
+   *     not available all the values must be set to zero.
+   *
+   * @output:
+   *   ametrics ::
+   *     The replacement glyph metrics in font units.
+   *
+   */
   typedef FT_Error
   (*FT_Incremental_GetGlyphMetricsFunc)
                       ( FT_Incremental              incremental,
   typedef FT_Error
   (*FT_Incremental_GetGlyphMetricsFunc)
                       ( FT_Incremental              incremental,
@@ -244,6 +260,7 @@ FT_BEGIN_HEADER
    *   get_glyph_metrics ::
    *     The function to get glyph metrics.  May be null if the font does
    *     not provide overriding glyph metrics.
    *   get_glyph_metrics ::
    *     The function to get glyph metrics.  May be null if the font does
    *     not provide overriding glyph metrics.
+   *
    */
   typedef struct  FT_Incremental_FuncsRec_
   {
    */
   typedef struct  FT_Incremental_FuncsRec_
   {
@@ -254,41 +271,42 @@ FT_BEGIN_HEADER
   } FT_Incremental_FuncsRec;
 
 
   } FT_Incremental_FuncsRec;
 
 
- /***************************************************************************
-  *
-  * @struct:
-  *   FT_Incremental_InterfaceRec
-  *
-  * @description:
-  *   A structure to be used with @FT_Open_Face to indicate that the user
-  *   wants to support incremental glyph loading.  You should use it with
-  *   @FT_PARAM_TAG_INCREMENTAL as in the following example:
-  *
-  *     {
-  *       FT_Incremental_InterfaceRec  inc_int;
-  *       FT_Parameter                 parameter;
-  *       FT_Open_Args                 open_args;
-  *
-  *
-  *       // set up incremental descriptor
-  *       inc_int.funcs  = my_funcs;
-  *       inc_int.object = my_object;
-  *
-  *       // set up optional parameter
-  *       parameter.tag  = FT_PARAM_TAG_INCREMENTAL;
-  *       parameter.data = &inc_int;
-  *
-  *       // set up FT_Open_Args structure
-  *       open_args.flags      = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;
-  *       open_args.pathname   = my_font_pathname;
-  *       open_args.num_params = 1;
-  *       open_args.params     = &parameter; // we use one optional argument
-  *
-  *       // open the font
-  *       error = FT_Open_Face( library, &open_args, index, &face );
-  *       ...
-  *     }
-  */
+  /***************************************************************************
+   *
+   * @struct:
+   *   FT_Incremental_InterfaceRec
+   *
+   * @description:
+   *   A structure to be used with @FT_Open_Face to indicate that the user
+   *   wants to support incremental glyph loading.  You should use it with
+   *   @FT_PARAM_TAG_INCREMENTAL as in the following example:
+   *
+   *     {
+   *       FT_Incremental_InterfaceRec  inc_int;
+   *       FT_Parameter                 parameter;
+   *       FT_Open_Args                 open_args;
+   *
+   *
+   *       // set up incremental descriptor
+   *       inc_int.funcs  = my_funcs;
+   *       inc_int.object = my_object;
+   *
+   *       // set up optional parameter
+   *       parameter.tag  = FT_PARAM_TAG_INCREMENTAL;
+   *       parameter.data = &inc_int;
+   *
+   *       // set up FT_Open_Args structure
+   *       open_args.flags      = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;
+   *       open_args.pathname   = my_font_pathname;
+   *       open_args.num_params = 1;
+   *       open_args.params     = &parameter; // we use one optional argument
+   *
+   *       // open the font
+   *       error = FT_Open_Face( library, &open_args, index, &face );
+   *       ...
+   *     }
+   *
+   */
   typedef struct  FT_Incremental_InterfaceRec_
   {
     const FT_Incremental_FuncsRec*  funcs;
   typedef struct  FT_Incremental_InterfaceRec_
   {
     const FT_Incremental_FuncsRec*  funcs;
@@ -297,31 +315,31 @@ FT_BEGIN_HEADER
   } FT_Incremental_InterfaceRec;
 
 
   } FT_Incremental_InterfaceRec;
 
 
- /***************************************************************************
-  *
-  * @type:
-  *   FT_Incremental_Interface
-  *
-  * @description:
-  *   A pointer to an @FT_Incremental_InterfaceRec structure.
-  *
-  */
 /***************************************************************************
+   *
+   * @type:
+   *   FT_Incremental_Interface
+   *
+   * @description:
+   *   A pointer to an @FT_Incremental_InterfaceRec structure.
+   *
+   */
   typedef FT_Incremental_InterfaceRec*   FT_Incremental_Interface;
 
 
   typedef FT_Incremental_InterfaceRec*   FT_Incremental_Interface;
 
 
- /***************************************************************************
-  *
-  * @constant:
-  *   FT_PARAM_TAG_INCREMENTAL
-  *
-  * @description:
-  *   A constant used as the tag of @FT_Parameter structures to indicate
-  *   an incremental loading object to be used by FreeType.
-  *
-  */
 /***************************************************************************
+   *
+   * @constant:
+   *   FT_PARAM_TAG_INCREMENTAL
+   *
+   * @description:
+   *   A constant used as the tag of @FT_Parameter structures to indicate
+   *   an incremental loading object to be used by FreeType.
+   *
+   */
 #define FT_PARAM_TAG_INCREMENTAL  FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
 
 #define FT_PARAM_TAG_INCREMENTAL  FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
 
- /* */
 /* */
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index 9a61377..c6201b3 100644 (file)
@@ -5,7 +5,7 @@
 /*    FreeType API for color filtering of subpixel bitmap glyphs           */
 /*    (specification).                                                     */
 /*                                                                         */
 /*    FreeType API for color filtering of subpixel bitmap glyphs           */
 /*    (specification).                                                     */
 /*                                                                         */
-/*  Copyright 2006, 2007 by                                                */
+/*  Copyright 2006, 2007, 2008 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #include <ft2build.h>
 #include FT_FREETYPE_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
 
 
 FT_BEGIN_HEADER
 
@@ -85,7 +91,7 @@ FT_BEGIN_HEADER
    * @since:
    *   2.3.0
    */
    * @since:
    *   2.3.0
    */
-  typedef enum
+  typedef enum  FT_LcdFilter_
   {
     FT_LCD_FILTER_NONE    = 0,
     FT_LCD_FILTER_DEFAULT = 1,
   {
     FT_LCD_FILTER_NONE    = 0,
     FT_LCD_FILTER_DEFAULT = 1,
@@ -119,7 +125,7 @@ FT_BEGIN_HEADER
    *     well on most LCD screens.
    *
    * @return:
    *     well on most LCD screens.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   This feature is always disabled by default.  Clients must make an
    *
    * @note:
    *   This feature is always disabled by default.  Clients must make an
@@ -141,8 +147,8 @@ FT_BEGIN_HEADER
    *   If this feature is activated, the dimensions of LCD glyph bitmaps are
    *   either larger or taller than the dimensions of the corresponding
    *   outline with regards to the pixel grid.  For example, for
    *   If this feature is activated, the dimensions of LCD glyph bitmaps are
    *   either larger or taller than the dimensions of the corresponding
    *   outline with regards to the pixel grid.  For example, for
-   *   @FT_RENDER_MODE_LCD, the filter adds up to 3 pixels to the left, and
-   *   up to 3 pixels to the right.
+   *   @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and
+   *   up to 3~pixels to the right.
    *
    *   The bitmap offset values are adjusted correctly, so clients shouldn't
    *   need to modify their layout and glyph positioning code when enabling
    *
    *   The bitmap offset values are adjusted correctly, so clients shouldn't
    *   need to modify their layout and glyph positioning code when enabling
index f3223ee..93b05fc 100644 (file)
@@ -81,7 +81,7 @@ FT_BEGIN_HEADER
   /*    FT_List_Find                                                       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_List_Find                                                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Finds the list node for a given listed object.                     */
+  /*    Find the list node for a given listed object.                      */
   /*                                                                       */
   /* <Input>                                                               */
   /*    list :: A pointer to the parent list.                              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    list :: A pointer to the parent list.                              */
@@ -101,7 +101,7 @@ FT_BEGIN_HEADER
   /*    FT_List_Add                                                        */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_List_Add                                                        */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Appends an element to the end of a list.                           */
+  /*    Append an element to the end of a list.                            */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    list :: A pointer to the parent list.                              */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    list :: A pointer to the parent list.                              */
@@ -118,7 +118,7 @@ FT_BEGIN_HEADER
   /*    FT_List_Insert                                                     */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_List_Insert                                                     */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Inserts an element at the head of a list.                          */
+  /*    Insert an element at the head of a list.                           */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    list :: A pointer to parent list.                                  */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    list :: A pointer to parent list.                                  */
@@ -135,7 +135,7 @@ FT_BEGIN_HEADER
   /*    FT_List_Remove                                                     */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_List_Remove                                                     */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Removes a node from a list.  This function doesn't check whether   */
+  /*    Remove a node from a list.  This function doesn't check whether    */
   /*    the node is in the list!                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    the node is in the list!                                           */
   /*                                                                       */
   /* <Input>                                                               */
@@ -155,7 +155,7 @@ FT_BEGIN_HEADER
   /*    FT_List_Up                                                         */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_List_Up                                                         */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Moves a node to the head/top of a list.  Used to maintain LRU      */
+  /*    Move a node to the head/top of a list.  Used to maintain LRU       */
   /*    lists.                                                             */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    lists.                                                             */
   /*                                                                       */
   /* <InOut>                                                               */
@@ -193,7 +193,7 @@ FT_BEGIN_HEADER
   /*    FT_List_Iterate                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_List_Iterate                                                    */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Parses a list and calls a given iterator function on each element. */
+  /*    Parse a list and calls a given iterator function on each element.  */
   /*    Note that parsing is stopped as soon as one of the iterator calls  */
   /*    returns a non-zero value.                                          */
   /*                                                                       */
   /*    Note that parsing is stopped as soon as one of the iterator calls  */
   /*    returns a non-zero value.                                          */
   /*                                                                       */
@@ -242,7 +242,7 @@ FT_BEGIN_HEADER
   /*    FT_List_Finalize                                                   */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_List_Finalize                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Destroys all elements in the list as well as the list itself.      */
+  /*    Destroy all elements in the list as well as the list itself.       */
   /*                                                                       */
   /* <Input>                                                               */
   /*    list    :: A handle to the list.                                   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    list    :: A handle to the list.                                   */
index d950653..00d4016 100644 (file)
@@ -63,7 +63,7 @@ FT_BEGIN_HEADER
   *   source :: The source stream.
   *
   * @return:
   *   source :: The source stream.
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *   The source stream must be opened _before_ calling this function.
   *
   * @note:
   *   The source stream must be opened _before_ calling this function.
index 3c6fafe..ab5bab5 100644 (file)
@@ -18,9 +18,9 @@
 
 /***************************************************************************/
 /*                                                                         */
 
 /***************************************************************************/
 /*                                                                         */
-/* NOTE: Include this file after <freetype/freetype.h> and after the       */
-/*       Mac-specific <Types.h> header (or any other Mac header that       */
-/*       includes <Types.h>); we use Handle type.                          */
+/* NOTE: Include this file after <freetype/freetype.h> and after any       */
+/*       Mac-specific headers (because this header uses Mac types such as  */
+/*       Handle, FSSpec, FSRef, etc.)                                      */
 /*                                                                         */
 /***************************************************************************/
 
 /*                                                                         */
 /***************************************************************************/
 
@@ -85,7 +85,7 @@ FT_BEGIN_HEADER
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Notes>                                                               */
   /*    This function can be used to create @FT_Face objects from fonts    */
   /*                                                                       */
   /* <Notes>                                                               */
   /*    This function can be used to create @FT_Face objects from fonts    */
@@ -100,7 +100,8 @@ FT_BEGIN_HEADER
   FT_New_Face_From_FOND( FT_Library  library,
                          Handle      fond,
                          FT_Long     face_index,
   FT_New_Face_From_FOND( FT_Library  library,
                          Handle      fond,
                          FT_Long     face_index,
-                         FT_Face    *aface );
+                         FT_Face    *aface )
+                       FT_DEPRECATED_ATTRIBUTE;
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -123,7 +124,7 @@ FT_BEGIN_HEADER
   /*                  @FT_New_Face_From_FSSpec.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  @FT_New_Face_From_FSSpec.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_GetFile_From_Mac_Name( const char*  fontName,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_GetFile_From_Mac_Name( const char*  fontName,
@@ -151,7 +152,7 @@ FT_BEGIN_HEADER
   /*                  @FT_New_Face_From_FSSpec.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  @FT_New_Face_From_FSSpec.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_GetFile_From_Mac_ATS_Name( const char*  fontName,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_GetFile_From_Mac_ATS_Name( const char*  fontName,
@@ -182,13 +183,14 @@ FT_BEGIN_HEADER
   /*    face_index  :: Index of the face.  For passing to @FT_New_Face.    */
   /*                                                                       */
   /* <Return>                                                              */
   /*    face_index  :: Index of the face.  For passing to @FT_New_Face.    */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_GetFilePath_From_Mac_ATS_Name( const char*  fontName,
                                     UInt8*       path,
                                     UInt32       maxPathSize,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_GetFilePath_From_Mac_ATS_Name( const char*  fontName,
                                     UInt8*       path,
                                     UInt32       maxPathSize,
-                                    FT_Long*     face_index );
+                                    FT_Long*     face_index )
+                                  FT_DEPRECATED_ATTRIBUTE;
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -207,12 +209,12 @@ FT_BEGIN_HEADER
   /*    spec       :: FSSpec to the font file.                             */
   /*                                                                       */
   /*    face_index :: The index of the face within the resource.  The      */
   /*    spec       :: FSSpec to the font file.                             */
   /*                                                                       */
   /*    face_index :: The index of the face within the resource.  The      */
-  /*                  first face has index 0.                              */
+  /*                  first face has index~0.                              */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    @FT_New_Face_From_FSSpec is identical to @FT_New_Face except       */
   /*                                                                       */
   /* <Note>                                                                */
   /*    @FT_New_Face_From_FSSpec is identical to @FT_New_Face except       */
@@ -242,12 +244,12 @@ FT_BEGIN_HEADER
   /*    spec       :: FSRef to the font file.                              */
   /*                                                                       */
   /*    face_index :: The index of the face within the resource.  The      */
   /*    spec       :: FSRef to the font file.                              */
   /*                                                                       */
   /*    face_index :: The index of the face within the resource.  The      */
-  /*                  first face has index 0.                              */
+  /*                  first face has index~0.                              */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    @FT_New_Face_From_FSRef is identical to @FT_New_Face except        */
   /*                                                                       */
   /* <Note>                                                                */
   /*    @FT_New_Face_From_FSRef is identical to @FT_New_Face except        */
index a9ccfe7..3aefb9e 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Multiple Master font interface (specification).             */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType Multiple Master font interface (specification).             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2003, 2004, 2006 by                               */
+/*  Copyright 1996-2001, 2003, 2004, 2006, 2009 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -44,7 +44,7 @@ FT_BEGIN_HEADER
   /*    setting design axis coordinates.                                   */
   /*                                                                       */
   /*    George Williams has extended this interface to make it work with   */
   /*    setting design axis coordinates.                                   */
   /*                                                                       */
   /*    George Williams has extended this interface to make it work with   */
-  /*    both Type 1 Multiple Masters fonts and GX distortable (var)        */
+  /*    both Type~1 Multiple Masters fonts and GX distortable (var)        */
   /*    fonts.  Some of these routines only work with MM fonts, others     */
   /*    will work with both types.  They are similar enough that a         */
   /*    consistent interface makes sense.                                  */
   /*    fonts.  Some of these routines only work with MM fonts, others     */
   /*    will work with both types.  They are similar enough that a         */
   /*    consistent interface makes sense.                                  */
@@ -91,12 +91,12 @@ FT_BEGIN_HEADER
   /*    This structure can't be used for GX var fonts.                     */
   /*                                                                       */
   /* <Fields>                                                              */
   /*    This structure can't be used for GX var fonts.                     */
   /*                                                                       */
   /* <Fields>                                                              */
-  /*    num_axis    :: Number of axes.  Cannot exceed 4.                   */
+  /*    num_axis    :: Number of axes.  Cannot exceed~4.                   */
   /*                                                                       */
   /*    num_designs :: Number of designs; should be normally 2^num_axis    */
   /*                                                                       */
   /*    num_designs :: Number of designs; should be normally 2^num_axis    */
-  /*                   even though the Type 1 specification strangely      */
+  /*                   even though the Type~1 specification strangely      */
   /*                   allows for intermediate designs to be present. This */
   /*                   allows for intermediate designs to be present. This */
-  /*                   number cannot exceed 16.                            */
+  /*                   number cannot exceed~16.                            */
   /*                                                                       */
   /*    axis        :: A table of axis descriptors.                        */
   /*                                                                       */
   /*                                                                       */
   /*    axis        :: A table of axis descriptors.                        */
   /*                                                                       */
@@ -187,7 +187,7 @@ FT_BEGIN_HEADER
   /*    Some fields are specific to one format and not to the other.       */
   /*                                                                       */
   /* <Fields>                                                              */
   /*    Some fields are specific to one format and not to the other.       */
   /*                                                                       */
   /* <Fields>                                                              */
-  /*    num_axis        :: The number of axes.  The maximum value is 4 for */
+  /*    num_axis        :: The number of axes.  The maximum value is~4 for */
   /*                       MM; no limit in GX.                             */
   /*                                                                       */
   /*    num_designs     :: The number of designs; should be normally       */
   /*                       MM; no limit in GX.                             */
   /*                                                                       */
   /*    num_designs     :: The number of designs; should be normally       */
@@ -227,7 +227,7 @@ FT_BEGIN_HEADER
   /*    FT_Get_Multi_Master                                                */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_Multi_Master                                                */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieves the Multiple Master descriptor of a given font.          */
+  /*    Retrieve the Multiple Master descriptor of a given font.           */
   /*                                                                       */
   /*    This function can't be used with GX fonts.                         */
   /*                                                                       */
   /*                                                                       */
   /*    This function can't be used with GX fonts.                         */
   /*                                                                       */
@@ -238,7 +238,7 @@ FT_BEGIN_HEADER
   /*    amaster :: The Multiple Masters descriptor.                        */
   /*                                                                       */
   /* <Return>                                                              */
   /*    amaster :: The Multiple Masters descriptor.                        */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Get_Multi_Master( FT_Face           face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Get_Multi_Master( FT_Face           face,
@@ -251,18 +251,18 @@ FT_BEGIN_HEADER
   /*    FT_Get_MM_Var                                                      */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_MM_Var                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieves the Multiple Master/GX var descriptor of a given font.   */
+  /*    Retrieve the Multiple Master/GX var descriptor of a given font.    */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face    :: A handle to the source face.                            */
   /*                                                                       */
   /* <Output>                                                              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face    :: A handle to the source face.                            */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    amaster :: The Multiple Masters descriptor.                        */
+  /*    amaster :: The Multiple Masters/GX var descriptor.                 */
   /*               Allocates a data structure, which the user must free    */
   /*               (a single call to FT_FREE will do it).                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*               Allocates a data structure, which the user must free    */
   /*               (a single call to FT_FREE will do it).                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Get_MM_Var( FT_Face      face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Get_MM_Var( FT_Face      face,
@@ -290,7 +290,7 @@ FT_BEGIN_HEADER
   /*    coords     :: An array of design coordinates.                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*    coords     :: An array of design coordinates.                      */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_MM_Design_Coordinates( FT_Face   face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_MM_Design_Coordinates( FT_Face   face,
@@ -317,7 +317,7 @@ FT_BEGIN_HEADER
   /*    coords     :: An array of design coordinates.                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*    coords     :: An array of design coordinates.                      */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_Var_Design_Coordinates( FT_Face    face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_Var_Design_Coordinates( FT_Face    face,
@@ -345,7 +345,7 @@ FT_BEGIN_HEADER
   /*                  between 0 and 1.0).                                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*                  between 0 and 1.0).                                  */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_MM_Blend_Coordinates( FT_Face    face,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_MM_Blend_Coordinates( FT_Face    face,
index 9cc32af..3c9b876 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType modules public interface (specification).                   */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType modules public interface (specification).                   */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2006 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -78,12 +78,50 @@ FT_BEGIN_HEADER
 
   typedef FT_Pointer  FT_Module_Interface;
 
 
   typedef FT_Pointer  FT_Module_Interface;
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <FuncType>                                                            */
+  /*    FT_Module_Constructor                                              */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A function used to initialize (not create) a new module object.    */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    module :: The module to initialize.                                */
+  /*                                                                       */
   typedef FT_Error
   (*FT_Module_Constructor)( FT_Module  module );
 
   typedef FT_Error
   (*FT_Module_Constructor)( FT_Module  module );
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <FuncType>                                                            */
+  /*    FT_Module_Destructor                                               */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A function used to finalize (not destroy) a given module object.   */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    module :: The module to finalize.                                  */
+  /*                                                                       */
   typedef void
   (*FT_Module_Destructor)( FT_Module  module );
 
   typedef void
   (*FT_Module_Destructor)( FT_Module  module );
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <FuncType>                                                            */
+  /*    FT_Module_Requester                                                */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A function used to query a given module for a specific interface.  */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    module :: The module to finalize.                                  */
+  /*                                                                       */
+  /*    name ::   The name of the interface in the module.                 */
+  /*                                                                       */
   typedef FT_Module_Interface
   (*FT_Module_Requester)( FT_Module    module,
                           const char*  name );
   typedef FT_Module_Interface
   (*FT_Module_Requester)( FT_Module    module,
                           const char*  name );
@@ -112,14 +150,11 @@ FT_BEGIN_HEADER
   /*                       as a 16.16 fixed number (major.minor).  Starts  */
   /*                       at version 2.0, i.e., 0x20000.                  */
   /*                                                                       */
   /*                       as a 16.16 fixed number (major.minor).  Starts  */
   /*                       at version 2.0, i.e., 0x20000.                  */
   /*                                                                       */
-  /*    module_init     :: A function used to initialize (not create) a    */
-  /*                       new module object.                              */
+  /*    module_init     :: The initializing function.                      */
   /*                                                                       */
   /*                                                                       */
-  /*    module_done     :: A function used to finalize (not destroy) a     */
-  /*                       given module object                             */
+  /*    module_done     :: The finalizing function.                        */
   /*                                                                       */
   /*                                                                       */
-  /*    get_interface   :: Queries a given module for a specific           */
-  /*                       interface by name.                              */
+  /*    get_interface   :: The interface requesting function.              */
   /*                                                                       */
   typedef struct  FT_Module_Class_
   {
   /*                                                                       */
   typedef struct  FT_Module_Class_
   {
@@ -144,7 +179,7 @@ FT_BEGIN_HEADER
   /*    FT_Add_Module                                                      */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Add_Module                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Adds a new module to a given library instance.                     */
+  /*    Add a new module to a given library instance.                      */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    library :: A handle to the library object.                         */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    library :: A handle to the library object.                         */
@@ -153,7 +188,7 @@ FT_BEGIN_HEADER
   /*    clazz   :: A pointer to class descriptor for the module.           */
   /*                                                                       */
   /* <Return>                                                              */
   /*    clazz   :: A pointer to class descriptor for the module.           */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    An error will be returned if a module already exists by that name, */
   /*                                                                       */
   /* <Note>                                                                */
   /*    An error will be returned if a module already exists by that name, */
@@ -170,7 +205,7 @@ FT_BEGIN_HEADER
   /*    FT_Get_Module                                                      */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_Module                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Finds a module by its name.                                        */
+  /*    Find a module by its name.                                         */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library     :: A handle to the library object.                     */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library     :: A handle to the library object.                     */
@@ -178,7 +213,7 @@ FT_BEGIN_HEADER
   /*    module_name :: The module's name (as an ASCII string).             */
   /*                                                                       */
   /* <Return>                                                              */
   /*    module_name :: The module's name (as an ASCII string).             */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    A module handle.  0 if none was found.                             */
+  /*    A module handle.  0~if none was found.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    FreeType's internal modules aren't documented very well, and you   */
   /*                                                                       */
   /* <Note>                                                                */
   /*    FreeType's internal modules aren't documented very well, and you   */
@@ -195,7 +230,7 @@ FT_BEGIN_HEADER
   /*    FT_Remove_Module                                                   */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Remove_Module                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Removes a given module from a library instance.                    */
+  /*    Remove a given module from a library instance.                     */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    library :: A handle to a library object.                           */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    library :: A handle to a library object.                           */
@@ -204,7 +239,7 @@ FT_BEGIN_HEADER
   /*    module  :: A handle to a module object.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*    module  :: A handle to a module object.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The module object is destroyed by the function in case of success. */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The module object is destroyed by the function in case of success. */
@@ -224,6 +259,10 @@ FT_BEGIN_HEADER
   /*    from a given memory object.  It is thus possible to use libraries  */
   /*    with distinct memory allocators within the same program.           */
   /*                                                                       */
   /*    from a given memory object.  It is thus possible to use libraries  */
   /*    with distinct memory allocators within the same program.           */
   /*                                                                       */
+  /*    Normally, you would call this function (followed by a call to      */
+  /*    @FT_Add_Default_Modules or a series of calls to @FT_Add_Module)    */
+  /*    instead of @FT_Init_FreeType to initialize the FreeType library.   */
+  /*                                                                       */
   /* <Input>                                                               */
   /*    memory   :: A handle to the original memory object.                */
   /*                                                                       */
   /* <Input>                                                               */
   /*    memory   :: A handle to the original memory object.                */
   /*                                                                       */
@@ -231,7 +270,7 @@ FT_BEGIN_HEADER
   /*    alibrary :: A pointer to handle of a new library object.           */
   /*                                                                       */
   /* <Return>                                                              */
   /*    alibrary :: A pointer to handle of a new library object.           */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_New_Library( FT_Memory    memory,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_New_Library( FT_Memory    memory,
@@ -244,14 +283,14 @@ FT_BEGIN_HEADER
   /*    FT_Done_Library                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Done_Library                                                    */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Discards a given library object.  This closes all drivers and      */
+  /*    Discard a given library object.  This closes all drivers and       */
   /*    discards all resource objects.                                     */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library :: A handle to the target library.                         */
   /*                                                                       */
   /* <Return>                                                              */
   /*    discards all resource objects.                                     */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library :: A handle to the target library.                         */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Done_Library( FT_Library  library );
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Done_Library( FT_Library  library );
@@ -268,7 +307,7 @@ FT_BEGIN_HEADER
   /*    FT_Set_Debug_Hook                                                  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Set_Debug_Hook                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Sets a debug hook function for debugging the interpreter of a font */
+  /*    Set a debug hook function for debugging the interpreter of a font  */
   /*    format.                                                            */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    format.                                                            */
   /*                                                                       */
   /* <InOut>                                                               */
@@ -283,7 +322,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Note>                                                                */
   /*    Currently, four debug hook slots are available, but only two (for  */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Currently, four debug hook slots are available, but only two (for  */
-  /*    the TrueType and the Type 1 interpreter) are defined.              */
+  /*    the TrueType and the Type~1 interpreter) are defined.              */
   /*                                                                       */
   /*    Since the internal headers of FreeType are no longer installed,    */
   /*    the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly.      */
   /*                                                                       */
   /*    Since the internal headers of FreeType are no longer installed,    */
   /*    the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly.      */
@@ -301,7 +340,7 @@ FT_BEGIN_HEADER
   /*    FT_Add_Default_Modules                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Add_Default_Modules                                             */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Adds the set of default drivers to a given library object.         */
+  /*    Add 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).         */
   /*                                                                       */
   /*    This is only useful when you create a library object with          */
   /*    @FT_New_Library (usually to plug a custom memory manager).         */
   /*                                                                       */
@@ -362,7 +401,7 @@ FT_BEGIN_HEADER
    *       2.2
    *
    */
    *       2.2
    *
    */
-  typedef enum
+  typedef enum  FT_TrueTypeEngineType_
   {
     FT_TRUETYPE_ENGINE_TYPE_NONE = 0,
     FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,
   {
     FT_TRUETYPE_ENGINE_TYPE_NONE = 0,
     FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,
@@ -377,7 +416,7 @@ FT_BEGIN_HEADER
    *     FT_Get_TrueType_Engine_Type
    *
    *  @description:
    *     FT_Get_TrueType_Engine_Type
    *
    *  @description:
-   *     Return a @FT_TrueTypeEngineType value to indicate which level of
+   *     Return an @FT_TrueTypeEngineType value to indicate which level of
    *     the TrueType virtual machine a given library instance supports.
    *
    *  @input:
    *     the TrueType virtual machine a given library instance supports.
    *
    *  @input:
index 7c488fd..027f2e8 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for validating OpenType tables (specification).         */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType API for validating OpenType tables (specification).         */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006 by                                          */
+/*  Copyright 2004, 2005, 2006, 2007 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -56,7 +56,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    This section contains the declaration of functions to validate     */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This section contains the declaration of functions to validate     */
-  /*    some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF).               */
+  /*    some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).         */
   /*                                                                       */
   /*************************************************************************/
 
   /*                                                                       */
   /*************************************************************************/
 
@@ -86,8 +86,11 @@ FT_BEGIN_HEADER
   *    FT_VALIDATE_JSTF ::
   *      Validate JSTF table.
   *
   *    FT_VALIDATE_JSTF ::
   *      Validate JSTF table.
   *
+  *    FT_VALIDATE_MATH ::
+  *      Validate MATH table.
+  *
   *    FT_VALIDATE_OT ::
   *    FT_VALIDATE_OT ::
-  *      Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF).
+  *      Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).
   *
   */
 #define FT_VALIDATE_BASE  0x0100
   *
   */
 #define FT_VALIDATE_BASE  0x0100
@@ -95,12 +98,14 @@ FT_BEGIN_HEADER
 #define FT_VALIDATE_GPOS  0x0400
 #define FT_VALIDATE_GSUB  0x0800
 #define FT_VALIDATE_JSTF  0x1000
 #define FT_VALIDATE_GPOS  0x0400
 #define FT_VALIDATE_GSUB  0x0800
 #define FT_VALIDATE_JSTF  0x1000
+#define FT_VALIDATE_MATH  0x2000
 
 #define FT_VALIDATE_OT  FT_VALIDATE_BASE | \
                         FT_VALIDATE_GDEF | \
                         FT_VALIDATE_GPOS | \
                         FT_VALIDATE_GSUB | \
 
 #define FT_VALIDATE_OT  FT_VALIDATE_BASE | \
                         FT_VALIDATE_GDEF | \
                         FT_VALIDATE_GPOS | \
                         FT_VALIDATE_GSUB | \
-                        FT_VALIDATE_JSTF
+                        FT_VALIDATE_JSTF | \
+                        FT_VALIDATE_MATH
 
   /* */
 
 
   /* */
 
@@ -140,7 +145,7 @@ FT_BEGIN_HEADER
   *       A pointer to the JSTF table.
   *
   * @return:
   *       A pointer to the JSTF table.
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *   This function only works with OpenType fonts, returning an error
   *
   * @note:
   *   This function only works with OpenType fonts, returning an error
index 786ae13..d7d01e8 100644 (file)
@@ -5,7 +5,7 @@
 /*    Support for the FT_Outline type used to store glyph shapes of        */
 /*    most scalable font formats (specification).                          */
 /*                                                                         */
 /*    Support for the FT_Outline type used to store glyph shapes of        */
 /*    most scalable font formats (specification).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -84,7 +84,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Decompose                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Decompose                                               */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Walks over an outline's structure to decompose it into individual  */
+  /*    Walk over an outline's structure to decompose it into individual   */
   /*    segments and Bézier arcs.  This function is also able to emit      */
   /*    `move to' and `close to' operations to indicate the start and end  */
   /*    of new contours in the outline.                                    */
   /*    segments and Bézier arcs.  This function is also able to emit      */
   /*    `move to' and `close to' operations to indicate the start and end  */
   /*    of new contours in the outline.                                    */
@@ -92,7 +92,7 @@ FT_BEGIN_HEADER
   /* <Input>                                                               */
   /*    outline        :: A pointer to the source target.                  */
   /*                                                                       */
   /* <Input>                                                               */
   /*    outline        :: A pointer to the source target.                  */
   /*                                                                       */
-  /*    func_interface :: A table of `emitters', i.e,. function pointers   */
+  /*    func_interface :: A table of `emitters', i.e., function pointers   */
   /*                      called during decomposition to indicate path     */
   /*                      operations.                                      */
   /*                                                                       */
   /*                      called during decomposition to indicate path     */
   /*                      operations.                                      */
   /*                                                                       */
@@ -103,7 +103,7 @@ FT_BEGIN_HEADER
   /*                      decomposition.                                   */
   /*                                                                       */
   /* <Return>                                                              */
   /*                      decomposition.                                   */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Decompose( FT_Outline*              outline,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Decompose( FT_Outline*              outline,
@@ -117,7 +117,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_New                                                     */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_New                                                     */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Creates a new outline of a given size.                             */
+  /*    Create a new outline of a given size.                              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library     :: A handle to the library object from where the       */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library     :: A handle to the library object from where the       */
@@ -130,11 +130,10 @@ FT_BEGIN_HEADER
   /*    numContours :: The maximal number of contours within the outline.  */
   /*                                                                       */
   /* <Output>                                                              */
   /*    numContours :: The maximal number of contours within the outline.  */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    anoutline   :: A handle to the new outline.  NULL in case of       */
-  /*                   error.                                              */
+  /*    anoutline   :: A handle to the new outline.                        */
   /*                                                                       */
   /* <Return>                                                              */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The reason why this function takes a `library' parameter is simply */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The reason why this function takes a `library' parameter is simply */
@@ -160,7 +159,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Done                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Done                                                    */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Destroys an outline created with @FT_Outline_New.                  */
+  /*    Destroy an outline created with @FT_Outline_New.                   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library :: A handle of the library object used to allocate the     */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library :: A handle of the library object used to allocate the     */
@@ -169,7 +168,7 @@ FT_BEGIN_HEADER
   /*    outline :: A pointer to the outline object to be discarded.        */
   /*                                                                       */
   /* <Return>                                                              */
   /*    outline :: A pointer to the outline object to be discarded.        */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    If the outline's `owner' field is not set, only the outline        */
   /*                                                                       */
   /* <Note>                                                                */
   /*    If the outline's `owner' field is not set, only the outline        */
@@ -200,7 +199,7 @@ FT_BEGIN_HEADER
   /*    outline :: A handle to a source outline.                           */
   /*                                                                       */
   /* <Return>                                                              */
   /*    outline :: A handle to a source outline.                           */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Check( FT_Outline*  outline );
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Check( FT_Outline*  outline );
@@ -212,7 +211,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Get_CBox                                                */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Get_CBox                                                */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Returns an outline's `control box'.  The control box encloses all  */
+  /*    Return an outline's `control box'.  The control box encloses all   */
   /*    the outline's points, including Bézier control points.  Though it  */
   /*    coincides with the exact bounding box for most glyphs, it can be   */
   /*    slightly larger in some situations (like when rotating an outline  */
   /*    the outline's points, including Bézier control points.  Though it  */
   /*    coincides with the exact bounding box for most glyphs, it can be   */
   /*    slightly larger in some situations (like when rotating an outline  */
@@ -240,7 +239,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Translate                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Translate                                               */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Applies a simple translation to the points of an outline.          */
+  /*    Apply a simple translation to the points of an outline.            */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    outline :: A pointer to the target outline descriptor.             */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    outline :: A pointer to the target outline descriptor.             */
@@ -262,7 +261,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Copy                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Copy                                                    */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Copies an outline into another one.  Both objects must have the    */
+  /*    Copy an outline into another one.  Both objects must have the      */
   /*    same sizes (number of points & number of contours) when this       */
   /*    function is called.                                                */
   /*                                                                       */
   /*    same sizes (number of points & number of contours) when this       */
   /*    function is called.                                                */
   /*                                                                       */
@@ -273,7 +272,7 @@ FT_BEGIN_HEADER
   /*    target :: A handle to the target outline.                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*    target :: A handle to the target outline.                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Copy( const FT_Outline*  source,
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Copy( const FT_Outline*  source,
@@ -286,7 +285,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Transform                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Transform                                               */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Applies a simple 2x2 matrix to all of an outline's points.  Useful */
+  /*    Apply a simple 2x2 matrix to all of an outline's points.  Useful   */
   /*    for applying rotations, slanting, flipping, etc.                   */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    for applying rotations, slanting, flipping, etc.                   */
   /*                                                                       */
   /* <InOut>                                                               */
@@ -310,7 +309,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Embolden                                                */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Embolden                                                */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Emboldens an outline.  The new outline will be at most 4 times     */
+  /*    Embolden an outline.  The new outline will be at most 4~times      */
   /*    `strength' pixels wider and higher.  You may think of the left and */
   /*    bottom borders as unchanged.                                       */
   /*                                                                       */
   /*    `strength' pixels wider and higher.  You may think of the left and */
   /*    bottom borders as unchanged.                                       */
   /*                                                                       */
@@ -325,7 +324,7 @@ FT_BEGIN_HEADER
   /*                26.6 pixel format.                                     */
   /*                                                                       */
   /* <Return>                                                              */
   /*                26.6 pixel format.                                     */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The used algorithm to increase or decrease the thickness of the    */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The used algorithm to increase or decrease the thickness of the    */
@@ -333,6 +332,9 @@ FT_BEGIN_HEADER
   /*    situations like acute angles or intersections are sometimes        */
   /*    handled incorrectly.                                               */
   /*                                                                       */
   /*    situations like acute angles or intersections are sometimes        */
   /*    handled incorrectly.                                               */
   /*                                                                       */
+  /*    If you need `better' metrics values you should call                */
+  /*    @FT_Outline_Get_CBox ot @FT_Outline_Get_BBox.                      */
+  /*                                                                       */
   /*    Example call:                                                      */
   /*                                                                       */
   /*    {                                                                  */
   /*    Example call:                                                      */
   /*                                                                       */
   /*    {                                                                  */
@@ -352,14 +354,14 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Reverse                                                 */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Reverse                                                 */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Reverses the drawing direction of an outline.  This is used to     */
+  /*    Reverse the drawing direction of an outline.  This is used to      */
   /*    ensure consistent fill conventions for mirrored glyphs.            */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    outline :: A pointer to the target outline descriptor.             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    ensure consistent fill conventions for mirrored glyphs.            */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    outline :: A pointer to the target outline descriptor.             */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    This functions toggles the bit flag @FT_OUTLINE_REVERSE_FILL in    */
+  /*    This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in     */
   /*    the outline's `flags' field.                                       */
   /*                                                                       */
   /*    It shouldn't be used by a normal client application, unless it     */
   /*    the outline's `flags' field.                                       */
   /*                                                                       */
   /*    It shouldn't be used by a normal client application, unless it     */
@@ -375,7 +377,7 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Get_Bitmap                                              */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Get_Bitmap                                              */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Renders an outline within a bitmap.  The outline's image is simply */
+  /*    Render an outline within a bitmap.  The outline's image is simply  */
   /*    OR-ed to the target bitmap.                                        */
   /*                                                                       */
   /* <Input>                                                               */
   /*    OR-ed to the target bitmap.                                        */
   /*                                                                       */
   /* <Input>                                                               */
@@ -387,14 +389,19 @@ FT_BEGIN_HEADER
   /*    abitmap :: A pointer to the target bitmap descriptor.              */
   /*                                                                       */
   /* <Return>                                                              */
   /*    abitmap :: A pointer to the target bitmap descriptor.              */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This function does NOT CREATE the bitmap, it only renders an       */
   /*                                                                       */
   /* <Note>                                                                */
   /*    This function does NOT CREATE the bitmap, it only renders an       */
-  /*    outline image within the one you pass to it!                       */
+  /*    outline image within the one you pass to it!  Consequently, the    */
+  /*    various fields in `abitmap' should be set accordingly.             */
   /*                                                                       */
   /*    It will use the raster corresponding to the default glyph format.  */
   /*                                                                       */
   /*                                                                       */
   /*    It will use the raster corresponding to the default glyph format.  */
   /*                                                                       */
+  /*    The value of the `num_grays' field in `abitmap' is ignored.  If    */
+  /*    you select the gray-level rasterizer, and you want less than 256   */
+  /*    gray levels, you have to use @FT_Outline_Render directly.          */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Get_Bitmap( FT_Library        library,
                          FT_Outline*       outline,
   FT_EXPORT( FT_Error )
   FT_Outline_Get_Bitmap( FT_Library        library,
                          FT_Outline*       outline,
@@ -407,8 +414,8 @@ FT_BEGIN_HEADER
   /*    FT_Outline_Render                                                  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Render                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Renders an outline within a bitmap using the current scan-convert. */
-  /*    This functions uses an @FT_Raster_Params structure as an argument, */
+  /*    Render an outline within a bitmap using the current scan-convert.  */
+  /*    This function uses an @FT_Raster_Params structure as an argument,  */
   /*    allowing advanced features like direct composition, translucency,  */
   /*    etc.                                                               */
   /*                                                                       */
   /*    allowing advanced features like direct composition, translucency,  */
   /*    etc.                                                               */
   /*                                                                       */
@@ -422,7 +429,7 @@ FT_BEGIN_HEADER
   /*               describe the rendering operation.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /*               describe the rendering operation.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    You should know what you are doing and how @FT_Raster_Params works */
   /*                                                                       */
   /* <Note>                                                                */
   /*    You should know what you are doing and how @FT_Raster_Params works */
@@ -432,6 +439,11 @@ FT_BEGIN_HEADER
   /*    converter is called, which means that the value you give to it is  */
   /*    actually ignored.                                                  */
   /*                                                                       */
   /*    converter is called, which means that the value you give to it is  */
   /*    actually ignored.                                                  */
   /*                                                                       */
+  /*    The gray-level rasterizer always uses 256 gray levels.  If you     */
+  /*    want less gray levels, you have to provide your own span callback. */
+  /*    See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the   */
+  /*    @FT_Raster_Params structure for more details.                      */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Render( FT_Library         library,
                      FT_Outline*        outline,
   FT_EXPORT( FT_Error )
   FT_Outline_Render( FT_Library         library,
                      FT_Outline*        outline,
@@ -446,7 +458,7 @@ FT_BEGIN_HEADER
   * @description:
   *   A list of values used to describe an outline's contour orientation.
   *
   * @description:
   *   A list of values used to describe an outline's contour orientation.
   *
-  *   The TrueType and Postscript specifications use different conventions
+  *   The TrueType and PostScript specifications use different conventions
   *   to determine whether outline contours should be filled or unfilled.
   *
   * @values:
   *   to determine whether outline contours should be filled or unfilled.
   *
   * @values:
@@ -455,7 +467,7 @@ FT_BEGIN_HEADER
   *     be filled, and counter-clockwise ones must be unfilled.
   *
   *   FT_ORIENTATION_POSTSCRIPT ::
   *     be filled, and counter-clockwise ones must be unfilled.
   *
   *   FT_ORIENTATION_POSTSCRIPT ::
-  *     According to the Postscript specification, counter-clockwise contours
+  *     According to the PostScript specification, counter-clockwise contours
   *     must be filled, and clockwise ones must be unfilled.
   *
   *   FT_ORIENTATION_FILL_RIGHT ::
   *     must be filled, and clockwise ones must be unfilled.
   *
   *   FT_ORIENTATION_FILL_RIGHT ::
@@ -465,7 +477,7 @@ FT_BEGIN_HEADER
   *
   *   FT_ORIENTATION_FILL_LEFT ::
   *     This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
   *
   *   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
+  *     remember that in PostScript, everything that is to the left of
   *     the drawing direction of a contour must be filled.
   *
   *   FT_ORIENTATION_NONE ::
   *     the drawing direction of a contour must be filled.
   *
   *   FT_ORIENTATION_NONE ::
@@ -473,7 +485,7 @@ FT_BEGIN_HEADER
   *     the glyph have different orientation.
   *
   */
   *     the glyph have different orientation.
   *
   */
-  typedef enum
+  typedef enum  FT_Orientation_
   {
     FT_ORIENTATION_TRUETYPE   = 0,
     FT_ORIENTATION_POSTSCRIPT = 1,
   {
     FT_ORIENTATION_TRUETYPE   = 0,
     FT_ORIENTATION_POSTSCRIPT = 1,
index e2801fd..0b7b7d4 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for accessing PFR-specific data (specification only).   */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType API for accessing PFR-specific data (specification only).   */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2006 by                                    */
+/*  Copyright 2002, 2003, 2004, 2006, 2008, 2009 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -62,8 +62,8 @@ FT_BEGIN_HEADER
   *
   * @output:
   *    aoutline_resolution ::
   *
   * @output:
   *    aoutline_resolution ::
-  *      Outline resolution.  This is equivalent to `face->units_per_EM'.
-  *      Optional (parameter can be NULL).
+  *      Outline resolution.  This is equivalent to `face->units_per_EM'
+  *      for non-PFR fonts.  Optional (parameter can be NULL).
   *
   *    ametrics_resolution ::
   *      Metrics resolution.  This is equivalent to `outline_resolution'
   *
   *    ametrics_resolution ::
   *      Metrics resolution.  This is equivalent to `outline_resolution'
@@ -73,14 +73,14 @@ FT_BEGIN_HEADER
   *      A 16.16 fixed-point number used to scale distance expressed
   *      in metrics units to device sub-pixels.  This is equivalent to
   *      `face->size->x_scale', but for metrics only.  Optional (parameter
   *      A 16.16 fixed-point number used to scale distance expressed
   *      in metrics units to device sub-pixels.  This is equivalent to
   *      `face->size->x_scale', but for metrics only.  Optional (parameter
-  *      can be NULL)
+  *      can be NULL).
   *
   *    ametrics_y_scale ::
   *      Same as `ametrics_x_scale' but for the vertical direction.
   *
   *    ametrics_y_scale ::
   *      Same as `ametrics_x_scale' but for the vertical direction.
-  *      optional (parameter can be NULL)
+  *      optional (parameter can be NULL).
   *
   * @return:
   *
   * @return:
-  *    FreeType error code.  0 means success.
+  *    FreeType error code.  0~means success.
   *
   * @note:
   *   If the input face is not a PFR, this function will return an error.
   *
   * @note:
   *   If the input face is not a PFR, this function will return an error.
@@ -115,7 +115,7 @@ FT_BEGIN_HEADER
   *    avector :: A kerning vector.
   *
   * @return:
   *    avector :: A kerning vector.
   *
   * @return:
-  *    FreeType error code.  0 means success.
+  *    FreeType error code.  0~means success.
   *
   * @note:
   *    This function always return distances in original PFR metrics
   *
   * @note:
   *    This function always return distances in original PFR metrics
@@ -150,7 +150,7 @@ FT_BEGIN_HEADER
   *    aadvance :: The glyph advance in metrics units.
   *
   * @return:
   *    aadvance :: The glyph advance in metrics units.
   *
   * @return:
-  *    FreeType error code.  0 means success.
+  *    FreeType error code.  0~means success.
   *
   * @note:
   *    You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics
   *
   * @note:
   *    You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics
index 5b07f08..41c31ea 100644 (file)
@@ -124,27 +124,32 @@ FT_BEGIN_HEADER
   /*    The renderer module class descriptor.                              */
   /*                                                                       */
   /* <Fields>                                                              */
   /*    The renderer module class descriptor.                              */
   /*                                                                       */
   /* <Fields>                                                              */
-  /*    root         :: The root @FT_Module_Class fields.                  */
+  /*    root            :: The root @FT_Module_Class fields.               */
   /*                                                                       */
   /*                                                                       */
-  /*    glyph_format :: The glyph image format this renderer handles.      */
+  /*    glyph_format    :: The glyph image format this renderer handles.   */
   /*                                                                       */
   /*                                                                       */
-  /*    render_glyph :: A method used to render the image that is in a     */
-  /*                    given glyph slot into a bitmap.                    */
+  /*    render_glyph    :: A method used to render the image that is in a  */
+  /*                       given glyph slot into a bitmap.                 */
   /*                                                                       */
   /*                                                                       */
-  /*    set_mode     :: A method used to pass additional parameters.       */
+  /*    transform_glyph :: A method used to transform the image that is in */
+  /*                       a given glyph slot.                             */
   /*                                                                       */
   /*                                                                       */
-  /*    raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.  This */
-  /*                    is a pointer to its raster's class.                */
+  /*    get_glyph_cbox  :: A method used to access the glyph's cbox.       */
   /*                                                                       */
   /*                                                                       */
-  /*    raster       :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.  This */
-  /*                    is a pointer to the corresponding raster object,   */
-  /*                    if any.                                            */
+  /*    set_mode        :: A method used to pass additional parameters.    */
+  /*                                                                       */
+  /*    raster_class    :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.    */
+  /*                       This is a pointer to its raster's class.        */
+  /*                                                                       */
+  /*    raster          :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.    */
+  /*                       This is a pointer to the corresponding raster   */
+  /*                       object, if any.                                 */
   /*                                                                       */
   typedef struct  FT_Renderer_Class_
   {
   /*                                                                       */
   typedef struct  FT_Renderer_Class_
   {
-    FT_Module_Class       root;
+    FT_Module_Class            root;
 
 
-    FT_Glyph_Format       glyph_format;
+    FT_Glyph_Format            glyph_format;
 
     FT_Renderer_RenderFunc     render_glyph;
     FT_Renderer_TransformFunc  transform_glyph;
 
     FT_Renderer_RenderFunc     render_glyph;
     FT_Renderer_TransformFunc  transform_glyph;
@@ -162,7 +167,7 @@ FT_BEGIN_HEADER
   /*    FT_Get_Renderer                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_Renderer                                                    */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieves the current renderer for a given glyph format.           */
+  /*    Retrieve the current renderer for a given glyph format.            */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library :: A handle to the library object.                         */
   /*                                                                       */
   /* <Input>                                                               */
   /*    library :: A handle to the library object.                         */
@@ -170,7 +175,7 @@ FT_BEGIN_HEADER
   /*    format  :: The glyph format.                                       */
   /*                                                                       */
   /* <Return>                                                              */
   /*    format  :: The glyph format.                                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    A renderer handle.  0 if none found.                               */
+  /*    A renderer handle.  0~if none found.                               */
   /*                                                                       */
   /* <Note>                                                                */
   /*    An error will be returned if a module already exists by that name, */
   /*                                                                       */
   /* <Note>                                                                */
   /*    An error will be returned if a module already exists by that name, */
@@ -190,7 +195,7 @@ FT_BEGIN_HEADER
   /*    FT_Set_Renderer                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Set_Renderer                                                    */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Sets the current renderer to use, and set additional mode.         */
+  /*    Set the current renderer to use, and set additional mode.          */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    library    :: A handle to the library object.                      */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    library    :: A handle to the library object.                      */
@@ -203,7 +208,7 @@ FT_BEGIN_HEADER
   /*    parameters :: Additional parameters.                               */
   /*                                                                       */
   /* <Return>                                                              */
   /*    parameters :: Additional parameters.                               */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    In case of success, the renderer will be used to convert glyph     */
   /*                                                                       */
   /* <Note>                                                                */
   /*    In case of success, the renderer will be used to convert glyph     */
index 622df16..3e548cc 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType size objects management (specification).                    */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType size objects management (specification).                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2003, 2004, 2006 by                               */
+/*  Copyright 1996-2001, 2003, 2004, 2006, 2009 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -89,7 +89,7 @@ FT_BEGIN_HEADER
   /*    asize :: A handle to a new size object.                            */
   /*                                                                       */
   /* <Return>                                                              */
   /*    asize :: A handle to a new size object.                            */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    You need to call @FT_Activate_Size in order to select the new size */
   /*                                                                       */
   /* <Note>                                                                */
   /*    You need to call @FT_Activate_Size in order to select the new size */
@@ -115,7 +115,7 @@ FT_BEGIN_HEADER
   /*    size :: A handle to a target size object.                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*    size :: A handle to a target size object.                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Done_Size( FT_Size  size );
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Done_Size( FT_Size  size );
@@ -129,8 +129,8 @@ FT_BEGIN_HEADER
   /* <Description>                                                         */
   /*    Even though it is possible to create several size objects for a    */
   /*    given face (see @FT_New_Size for details), functions like          */
   /* <Description>                                                         */
   /*    Even though it is possible to create several size objects for a    */
   /*    given face (see @FT_New_Size for details), functions like          */
-  /*    @FT_Load_Glyph or @FT_Load_Char only use the last-created one to   */
-  /*    determine the `current character pixel size'.                      */
+  /*    @FT_Load_Glyph or @FT_Load_Char only use the one which has been    */
+  /*    activated last to determine the `current character pixel size'.    */
   /*                                                                       */
   /*    This function can be used to `activate' a previously created size  */
   /*    object.                                                            */
   /*                                                                       */
   /*    This function can be used to `activate' a previously created size  */
   /*    object.                                                            */
@@ -139,7 +139,7 @@ FT_BEGIN_HEADER
   /*    size :: A handle to a target size object.                          */
   /*                                                                       */
   /* <Return>                                                              */
   /*    size :: A handle to a target size object.                          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    If `face' is the size's parent face object, this function changes  */
   /*                                                                       */
   /* <Note>                                                                */
   /*    If `face' is the size's parent face object, this function changes  */
index 003cbcd..f20b409 100644 (file)
@@ -7,7 +7,7 @@
 /*                                                                         */
 /*    This is _not_ used to retrieve glyph names!                          */
 /*                                                                         */
 /*                                                                         */
 /*    This is _not_ used to retrieve glyph names!                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2006 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2006, 2009 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -48,7 +48,7 @@ FT_BEGIN_HEADER
   /*    Access the names embedded in TrueType and OpenType files.          */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Access the names embedded in TrueType and OpenType files.          */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    The TrueType and OpenType specification allow the inclusion of     */
+  /*    The TrueType and OpenType specifications allow the inclusion of    */
   /*    a special `names table' in font files.  This table contains        */
   /*    textual (and internationalized) information regarding the font,    */
   /*    like family name, copyright, version, etc.                         */
   /*    a special `names table' in font files.  This table contains        */
   /*    textual (and internationalized) information regarding the font,    */
   /*    like family name, copyright, version, etc.                         */
@@ -114,7 +114,7 @@ FT_BEGIN_HEADER
   /*    FT_Get_Sfnt_Name_Count                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_Sfnt_Name_Count                                             */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieves the number of name strings in the SFNT `name' table.     */
+  /*    Retrieve the number of name strings in the SFNT `name' table.      */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A handle to the source face.                               */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A handle to the source face.                               */
@@ -132,7 +132,7 @@ FT_BEGIN_HEADER
   /*    FT_Get_Sfnt_Name                                                   */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_Sfnt_Name                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieves a string of the SFNT `name' table for a given index.     */
+  /*    Retrieve a string of the SFNT `name' table for a given index.      */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face  :: A handle to the source face.                              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face  :: A handle to the source face.                              */
@@ -143,11 +143,12 @@ FT_BEGIN_HEADER
   /*    aname :: The indexed @FT_SfntName structure.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /*    aname :: The indexed @FT_SfntName structure.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
+  /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The `string' array returned in the `aname' structure is not        */
   /*                                                                       */
   /* <Note>                                                                */
   /*    The `string' array returned in the `aname' structure is not        */
-  /*    null-terminated.                                                   */
+  /*    null-terminated.  The application should deallocate it if it is no */
+  /*    longer in use.                                                     */
   /*                                                                       */
   /*    Use @FT_Get_Sfnt_Name_Count to get the total number of available   */
   /*    `name' table entries, then do a loop until you get the right       */
   /*                                                                       */
   /*    Use @FT_Get_Sfnt_Name_Count to get the total number of available   */
   /*    `name' table entries, then do a loop until you get the right       */
index 738b43c..3afb87d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType path stroker (specification).                               */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType path stroker (specification).                               */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006 by                              */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -84,7 +84,7 @@ FT_BEGIN_HEADER
    *     is too closed (this is useful to avoid unpleasant spikes
    *     in beveled rendering).
    */
    *     is too closed (this is useful to avoid unpleasant spikes
    *     in beveled rendering).
    */
-  typedef enum
+  typedef enum  FT_Stroker_LineJoin_
   {
     FT_STROKER_LINEJOIN_ROUND = 0,
     FT_STROKER_LINEJOIN_BEVEL,
   {
     FT_STROKER_LINEJOIN_ROUND = 0,
     FT_STROKER_LINEJOIN_BEVEL,
@@ -115,7 +115,7 @@ FT_BEGIN_HEADER
    *     The end of lines is rendered as a square around the
    *     last point.
    */
    *     The end of lines is rendered as a square around the
    *     last point.
    */
-  typedef enum
+  typedef enum  FT_Stroker_LineCap_
   {
     FT_STROKER_LINECAP_BUTT = 0,
     FT_STROKER_LINECAP_ROUND,
   {
     FT_STROKER_LINECAP_BUTT = 0,
     FT_STROKER_LINECAP_ROUND,
@@ -149,7 +149,7 @@ FT_BEGIN_HEADER
    *   You can however use @FT_Outline_GetInsideBorder and
    *   @FT_Outline_GetOutsideBorder to get these.
    */
    *   You can however use @FT_Outline_GetInsideBorder and
    *   @FT_Outline_GetOutsideBorder to get these.
    */
-  typedef enum
+  typedef enum  FT_StrokerBorder_
   {
     FT_STROKER_BORDER_LEFT = 0,
     FT_STROKER_BORDER_RIGHT
   {
     FT_STROKER_BORDER_LEFT = 0,
     FT_STROKER_BORDER_RIGHT
@@ -171,7 +171,7 @@ FT_BEGIN_HEADER
    *     The source outline handle.
    *
    * @return:
    *     The source outline handle.
    *
    * @return:
-   *   The border index.  @FT_STROKER_BORDER_LEFT for empty or invalid
+   *   The border index.  @FT_STROKER_BORDER_RIGHT for empty or invalid
    *   outlines.
    */
   FT_EXPORT( FT_StrokerBorder )
    *   outlines.
    */
   FT_EXPORT( FT_StrokerBorder )
@@ -216,7 +216,7 @@ FT_BEGIN_HEADER
    *     A new stroker object handle.  NULL in case of error.
    *
    * @return:
    *     A new stroker object handle.  NULL in case of error.
    *
    * @return:
-   *    FreeType error code.  0 means success.
+   *    FreeType error code.  0~means success.
    */
   FT_EXPORT( FT_Error )
   FT_Stroker_New( FT_Library   library,
    */
   FT_EXPORT( FT_Error )
   FT_Stroker_New( FT_Library   library,
@@ -249,7 +249,7 @@ FT_BEGIN_HEADER
    *     expressed as 16.16 fixed point value.
    *
    * @note:
    *     expressed as 16.16 fixed point value.
    *
    * @note:
-   *   The radius is expressed in the same units that the outline
+   *   The radius is expressed in the same units as the outline
    *   coordinates.
    */
   FT_EXPORT( void )
    *   coordinates.
    */
   FT_EXPORT( void )
@@ -297,18 +297,18 @@ FT_BEGIN_HEADER
    *     The source outline.
    *
    *   opened ::
    *     The source outline.
    *
    *   opened ::
-   *     A boolean.  If 1, the outline is treated as an open path instead
+   *     A boolean.  If~1, the outline is treated as an open path instead
    *     of a closed one.
    *
    * @return:
    *     of a closed one.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *
    * @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~0 (the default), the outline is treated as a closed
+   *   path, and the stroker generates 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.
+   *   If `opened' is~1, the outline is processed as an open path, and the
+   *   stroker generates a single `stroke' outline.
    *
    *   This function calls @FT_Stroker_Rewind automatically.
    */
    *
    *   This function calls @FT_Stroker_Rewind automatically.
    */
@@ -334,10 +334,10 @@ FT_BEGIN_HEADER
    *     A pointer to the start vector.
    *
    *   open ::
    *     A pointer to the start vector.
    *
    *   open ::
-   *     A boolean.  If 1, the sub-path is treated as an open one.
+   *     A boolean.  If~1, the sub-path is treated as an open one.
    *
    * @return:
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   This function is useful when you need to stroke a path that is
    *
    * @note:
    *   This function is useful when you need to stroke a path that is
@@ -362,11 +362,11 @@ FT_BEGIN_HEADER
    *     The target stroker handle.
    *
    * @return:
    *     The target stroker handle.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   You should call this function after @FT_Stroker_BeginSubPath.
    *
    * @note:
    *   You should call this function after @FT_Stroker_BeginSubPath.
-   *   If the subpath was not `opened', this function will `draw' a
+   *   If the subpath was not `opened', this function `draws' a
    *   single line segment to the start position when needed.
    */
   FT_EXPORT( FT_Error )
    *   single line segment to the start position when needed.
    */
   FT_EXPORT( FT_Error )
@@ -390,7 +390,7 @@ FT_BEGIN_HEADER
    *     A pointer to the destination point.
    *
    * @return:
    *     A pointer to the destination point.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   You should call this function between @FT_Stroker_BeginSubPath and
    *
    * @note:
    *   You should call this function between @FT_Stroker_BeginSubPath and
@@ -421,7 +421,7 @@ FT_BEGIN_HEADER
    *     A pointer to the destination point.
    *
    * @return:
    *     A pointer to the destination point.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   You should call this function between @FT_Stroker_BeginSubPath and
    *
    * @note:
    *   You should call this function between @FT_Stroker_BeginSubPath and
@@ -456,7 +456,7 @@ FT_BEGIN_HEADER
    *     A pointer to the destination point.
    *
    * @return:
    *     A pointer to the destination point.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   You should call this function between @FT_Stroker_BeginSubPath and
    *
    * @note:
    *   You should call this function between @FT_Stroker_BeginSubPath and
@@ -476,7 +476,7 @@ FT_BEGIN_HEADER
    *
    * @description:
    *   Call this function once you have finished parsing your paths
    *
    * @description:
    *   Call this function once you have finished parsing your paths
-   *   with the stroker.  It will return the number of points and
+   *   with the stroker.  It returns the number of points and
    *   contours necessary to export one of the `border' or `stroke'
    *   outlines generated by the stroker.
    *
    *   contours necessary to export one of the `border' or `stroke'
    *   outlines generated by the stroker.
    *
@@ -495,7 +495,7 @@ FT_BEGIN_HEADER
    *     The number of contours.
    *
    * @return:
    *     The number of contours.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    *
    * @note:
    *   When an outline, or a sub-path, is `closed', the stroker generates
    *
    * @note:
    *   When an outline, or a sub-path, is `closed', the stroker generates
@@ -525,8 +525,8 @@ FT_BEGIN_HEADER
    *   export the corresponding border to your own @FT_Outline
    *   structure.
    *
    *   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
+   *   Note that this function appends the border points and
+   *   contours to your outline, but does not try to resize its
    *   arrays.
    *
    * @input:
    *   arrays.
    *
    * @input:
@@ -583,7 +583,7 @@ FT_BEGIN_HEADER
    *     The number of contours.
    *
    * @return:
    *     The number of contours.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *   FreeType error code.  0~means success.
    */
   FT_EXPORT( FT_Error )
   FT_Stroker_GetCounts( FT_Stroker  stroker,
    */
   FT_EXPORT( FT_Error )
   FT_Stroker_GetCounts( FT_Stroker  stroker,
@@ -598,10 +598,10 @@ FT_BEGIN_HEADER
    *
    * @description:
    *   Call this function after @FT_Stroker_GetBorderCounts to
    *
    * @description:
    *   Call this function after @FT_Stroker_GetBorderCounts to
-   *   export the all borders to your own @FT_Outline structure.
+   *   export 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
+   *   Note that this function appends the border points and
+   *   contours to your outline, but does not try to resize its
    *   arrays.
    *
    * @input:
    *   arrays.
    *
    * @input:
@@ -649,11 +649,11 @@ FT_BEGIN_HEADER
    *     A stroker handle.
    *
    *   destroy ::
    *     A stroker handle.
    *
    *   destroy ::
-   *     A Boolean.  If 1, the source glyph object is destroyed
+   *     A Boolean.  If~1, the source glyph object is destroyed
    *     on success.
    *
    * @return:
    *     on success.
    *
    * @return:
-   *    FreeType error code.  0 means success.
+   *    FreeType error code.  0~means success.
    *
    * @note:
    *   The source glyph is untouched in case of error.
    *
    * @note:
    *   The source glyph is untouched in case of error.
@@ -682,15 +682,15 @@ FT_BEGIN_HEADER
    *     A stroker handle.
    *
    *   inside ::
    *     A stroker handle.
    *
    *   inside ::
-   *     A Boolean.  If 1, return the inside border, otherwise
+   *     A Boolean.  If~1, return the inside border, otherwise
    *     the outside border.
    *
    *   destroy ::
    *     the outside border.
    *
    *   destroy ::
-   *     A Boolean.  If 1, the source glyph object is destroyed
+   *     A Boolean.  If~1, the source glyph object is destroyed
    *     on success.
    *
    * @return:
    *     on success.
    *
    * @return:
-   *    FreeType error code.  0 means success.
+   *    FreeType error code.  0~means success.
    *
    * @note:
    *   The source glyph is untouched in case of error.
    *
    * @note:
    *   The source glyph is untouched in case of error.
index 36984bf..a068b79 100644 (file)
@@ -5,7 +5,7 @@
 /*    FreeType synthesizing code for emboldening and slanting              */
 /*    (specification).                                                     */
 /*                                                                         */
 /*    FreeType synthesizing code for emboldening and slanting              */
 /*    (specification).                                                     */
 /*                                                                         */
-/*  Copyright 2000-2001, 2003, 2006 by                                     */
+/*  Copyright 2000-2001, 2003, 2006, 2008 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -23,7 +23,7 @@
   /*************************************************************************/
   /*************************************************************************/
   /*********                                                       *********/
   /*************************************************************************/
   /*************************************************************************/
   /*********                                                       *********/
-  /*********        WARNING, THIS IS ALPHA CODE, THIS API          *********/
+  /*********        WARNING, THIS IS ALPHA CODE!  THIS API         *********/
   /*********    IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE    *********/
   /*********            FREETYPE DEVELOPMENT TEAM                  *********/
   /*********                                                       *********/
   /*********    IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE    *********/
   /*********            FREETYPE DEVELOPMENT TEAM                  *********/
   /*********                                                       *********/
   /*************************************************************************/
 
 
   /*************************************************************************/
 
 
+  /* Main reason for not lifting the functions in this module to a  */
+  /* `standard' API is that the used parameters for emboldening and */
+  /* slanting are not configurable.  Consider the functions as a    */
+  /* code resource which should be copied into the application and  */
+  /* adapted to the particular needs.                               */
+
+
 #ifndef __FTSYNTH_H__
 #define __FTSYNTH_H__
 
 #ifndef __FTSYNTH_H__
 #define __FTSYNTH_H__
 
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
-  /* Make sure slot owns slot->bitmap. */
-  FT_EXPORT( FT_Error )
-  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot );
-
-  /* Do not use this function directly!  Copy the code to */
-  /* your application and modify it to suit your need.    */
+  /* Embolden a glyph by a `reasonable' value (which is highly a matter of */
+  /* taste).  This function is actually a convenience function, providing  */
+  /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden.           */
+  /*                                                                       */
+  /* For emboldened outlines the metrics are estimates only; if you need   */
+  /* precise values you should call @FT_Outline_Get_CBox.                  */
   FT_EXPORT( void )
   FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );
 
   FT_EXPORT( void )
   FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );
 
-
+  /* Slant an outline glyph to the right by about 12 degrees. */
   FT_EXPORT( void )
   FT_GlyphSlot_Oblique( FT_GlyphSlot  slot );
 
   FT_EXPORT( void )
   FT_GlyphSlot_Oblique( FT_GlyphSlot  slot );
 
- /* */
 /* */
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index 59cd019..a95b2c7 100644 (file)
@@ -82,7 +82,7 @@ FT_BEGIN_HEADER
    *     The size in bytes to allocate.
    *
    * @return:
    *     The size in bytes to allocate.
    *
    * @return:
-   *   Address of new memory block.  0 in case of failure.
+   *   Address of new memory block.  0~in case of failure.
    *
    */
   typedef void*
    *
    */
   typedef void*
@@ -133,7 +133,7 @@ FT_BEGIN_HEADER
    *     The block's current address.
    *
    * @return:
    *     The block's current address.
    *
    * @return:
-   *   New block address.  0 in case of memory shortage.
+   *   New block address.  0~in case of memory shortage.
    *
    * @note:
    *   In case of error, the old block must still be available.
    *
    * @note:
    *   In case of error, the old block must still be available.
@@ -152,7 +152,7 @@ FT_BEGIN_HEADER
    *   FT_MemoryRec
    *
    * @description:
    *   FT_MemoryRec
    *
    * @description:
-   *   A structure used to describe a given memory manager to FreeType 2.
+   *   A structure used to describe a given memory manager to FreeType~2.
    *
    * @fields:
    *   user ::
    *
    * @fields:
    *   user ::
@@ -240,7 +240,7 @@ FT_BEGIN_HEADER
    *
    * @note:
    *   This function might be called to perform a seek or skip operation
    *
    * @note:
    *   This function might be called to perform a seek or skip operation
-   *   with a `count' of 0.
+   *   with a `count' of~0.
    *
    */
   typedef unsigned long
    *
    */
   typedef unsigned long
index 2340bac..a57ffa6 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType simple types definitions (specification only).              */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType simple types definitions (specification only).              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004, 2006, 2007 by                         */
+/*  Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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_BEGIN_HEADER
   /*    The basic data types defined by the library.                       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    The basic data types defined by the library.                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    This section contains the basic data types defined by FreeType 2,  */
+  /*    This section contains the basic data types defined by FreeType~2,  */
   /*    ranging from simple scalar types to bitmap descriptors.  More      */
   /*    font-specific structures are defined in a different section.       */
   /*                                                                       */
   /*    ranging from simple scalar types to bitmap descriptors.  More      */
   /*    font-specific structures are defined in a different section.       */
   /*                                                                       */
@@ -53,6 +53,10 @@ FT_BEGIN_HEADER
   /*    FT_Char                                                            */
   /*    FT_Int                                                             */
   /*    FT_UInt                                                            */
   /*    FT_Char                                                            */
   /*    FT_Int                                                             */
   /*    FT_UInt                                                            */
+  /*    FT_Int16                                                           */
+  /*    FT_UInt16                                                          */
+  /*    FT_Int32                                                           */
+  /*    FT_UInt32                                                          */
   /*    FT_Short                                                           */
   /*    FT_UShort                                                          */
   /*    FT_Long                                                            */
   /*    FT_Short                                                           */
   /*    FT_UShort                                                          */
   /*    FT_Long                                                            */
@@ -95,7 +99,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    A typedef of unsigned char, used for simple booleans.  As usual,   */
   /*                                                                       */
   /* <Description>                                                         */
   /*    A typedef of unsigned char, used for simple booleans.  As usual,   */
-  /*    values 1 and 0 represent true and false, respectively.             */
+  /*    values 1 and~0 represent true and false, respectively.             */
   /*                                                                       */
   typedef unsigned char  FT_Bool;
 
   /*                                                                       */
   typedef unsigned char  FT_Bool;
 
@@ -163,7 +167,7 @@ FT_BEGIN_HEADER
   /*    FT_Tag                                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Tag                                                             */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A typedef for 32bit tags (as used in the SFNT format).             */
+  /*    A typedef for 32-bit tags (as used in the SFNT format).            */
   /*                                                                       */
   typedef FT_UInt32  FT_Tag;
 
   /*                                                                       */
   typedef FT_UInt32  FT_Tag;
 
@@ -286,7 +290,7 @@ FT_BEGIN_HEADER
   /*    FT_Error                                                           */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Error                                                           */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    The FreeType error code type.  A value of 0 is always interpreted  */
+  /*    The FreeType error code type.  A value of~0 is always interpreted  */
   /*    as a successful operation.                                         */
   /*                                                                       */
   typedef int  FT_Error;
   /*    as a successful operation.                                         */
   /*                                                                       */
   typedef int  FT_Error;
@@ -309,7 +313,7 @@ FT_BEGIN_HEADER
   /*    FT_Offset                                                          */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Offset                                                          */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    This is equivalent to the ANSI C `size_t' type, i.e., the largest  */
+  /*    This is equivalent to the ANSI~C `size_t' type, i.e., the largest  */
   /*    _unsigned_ integer type used to express a file size or position,   */
   /*    or a memory block size.                                            */
   /*                                                                       */
   /*    _unsigned_ integer type used to express a file size or position,   */
   /*    or a memory block size.                                            */
   /*                                                                       */
@@ -322,7 +326,7 @@ FT_BEGIN_HEADER
   /*    FT_PtrDist                                                         */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_PtrDist                                                         */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    This is equivalent to the ANSI C `ptrdiff_t' type, i.e., the       */
+  /*    This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the       */
   /*    largest _signed_ integer type used to express the distance         */
   /*    between two pointers.                                              */
   /*                                                                       */
   /*    largest _signed_ integer type used to express the distance         */
   /*    between two pointers.                                              */
   /*                                                                       */
@@ -409,7 +413,7 @@ FT_BEGIN_HEADER
   /*    FT_Generic_Finalizer                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Generic_Finalizer                                               */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Describes a function used to destroy the `client' data of any      */
+  /*    Describe a function used to destroy the `client' data of any       */
   /*    FreeType object.  See the description of the @FT_Generic type for  */
   /*    details of usage.                                                  */
   /*                                                                       */
   /*    FreeType object.  See the description of the @FT_Generic type for  */
   /*    details of usage.                                                  */
   /*                                                                       */
@@ -466,10 +470,11 @@ FT_BEGIN_HEADER
   /*    TrueType tables into an unsigned long to be used within FreeType.  */
   /*                                                                       */
   /* <Note>                                                                */
   /*    TrueType tables into an unsigned long to be used within FreeType.  */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    The produced values *must* be 32bit integers.  Don't redefine this */
-  /*    macro.                                                             */
+  /*    The produced values *must* be 32-bit integers.  Don't redefine     */
+  /*    this macro.                                                        */
   /*                                                                       */
 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
   /*                                                                       */
 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
+          (FT_Tag)                        \
           ( ( (FT_ULong)_x1 << 24 ) |     \
             ( (FT_ULong)_x2 << 16 ) |     \
             ( (FT_ULong)_x3 <<  8 ) |     \
           ( ( (FT_ULong)_x1 << 24 ) |     \
             ( (FT_ULong)_x2 << 16 ) |     \
             ( (FT_ULong)_x3 <<  8 ) |     \
index a0063cc..ea33353 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for accessing Windows fnt-specific data.                */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType API for accessing Windows fnt-specific data.                */
 /*                                                                         */
-/*  Copyright 2003, 2004 by                                                */
+/*  Copyright 2003, 2004, 2008 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -111,11 +111,11 @@ FT_BEGIN_HEADER
    *     ordering and minor deviations).
    *
    *   FT_WinFNT_ID_CP949 ::
    *     ordering and minor deviations).
    *
    *   FT_WinFNT_ID_CP949 ::
-   *     A superset of Korean Hangul KS C 5601-1987 (with different
+   *     A superset of Korean Hangul KS~C 5601-1987 (with different
    *     ordering and minor deviations).
    *
    *   FT_WinFNT_ID_CP950 ::
    *     ordering and minor deviations).
    *
    *   FT_WinFNT_ID_CP950 ::
-   *     A superset of traditional Chinese Big 5 ETen (with different
+   *     A superset of traditional Chinese Big~5 ETen (with different
    *     ordering and minor deviations).
    *
    *   FT_WinFNT_ID_CP1250 ::
    *     ordering and minor deviations).
    *
    *   FT_WinFNT_ID_CP1250 ::
@@ -219,36 +219,47 @@ FT_BEGIN_HEADER
     FT_UShort  color_table_offset;
     FT_ULong   reserved1[4];
 
     FT_UShort  color_table_offset;
     FT_ULong   reserved1[4];
 
-  } FT_WinFNT_HeaderRec, *FT_WinFNT_Header;
+  } FT_WinFNT_HeaderRec;
 
 
 
 
- /**********************************************************************
-  *
-  * @function:
-  *    FT_Get_WinFNT_Header
-  *
-  * @description:
-  *    Retrieve a Windows FNT font info header.
-  *
-  * @input:
-  *    face    :: A handle to the input face.
-  *
-  * @output:
-  *    aheader :: The WinFNT header.
-  *
-  * @return:
-  *   FreeType error code.  0 means success.
-  *
-  * @note:
-  *   This function only works with Windows FNT faces, returning an error
-  *   otherwise.
-  */
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    FT_WinFNT_Header                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to an @FT_WinFNT_HeaderRec structure.                     */
+  /*                                                                       */
+  typedef struct FT_WinFNT_HeaderRec_*  FT_WinFNT_Header;
+
+
+  /**********************************************************************
+   *
+   * @function:
+   *    FT_Get_WinFNT_Header
+   *
+   * @description:
+   *    Retrieve a Windows FNT font info header.
+   *
+   * @input:
+   *    face    :: A handle to the input face.
+   *
+   * @output:
+   *    aheader :: The WinFNT header.
+   *
+   * @return:
+   *   FreeType error code.  0~means success.
+   *
+   * @note:
+   *   This function only works with Windows FNT faces, returning an error
+   *   otherwise.
+   */
   FT_EXPORT( FT_Error )
   FT_Get_WinFNT_Header( FT_Face               face,
                         FT_WinFNT_HeaderRec  *aheader );
 
 
   FT_EXPORT( FT_Error )
   FT_Get_WinFNT_Header( FT_Face               face,
                         FT_WinFNT_HeaderRec  *aheader );
 
 
- /* */
 /* */
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index ea82abb..8c68afd 100644 (file)
@@ -49,6 +49,9 @@ FT_BEGIN_HEADER
   /*   however, there are special cases (like in PDF devices) where it is  */
   /*   important to differentiate, in spite of FreeType's uniform API.     */
   /*                                                                       */
   /*   however, there are special cases (like in PDF devices) where it is  */
   /*   important to differentiate, in spite of FreeType's uniform API.     */
   /*                                                                       */
+  /*   This function is in the X11/xf86 namespace for historical reasons   */
+  /*   and in no way depends on that windowing system.                     */
+  /*                                                                       */
   /*************************************************************************/
 
 
   /*************************************************************************/
 
 
@@ -60,8 +63,8 @@ FT_BEGIN_HEADER
   /* <Description>                                                         */
   /*   Return a string describing the format of a given face, using values */
   /*   which can be used as an X11 FONT_PROPERTY.  Possible values are     */
   /* <Description>                                                         */
   /*   Return a string describing the format of a given face, using values */
   /*   which can be used as an X11 FONT_PROPERTY.  Possible values are     */
-  /*   `TrueType', `Type 1', `BDF', `PCF', `Type 42', `CID Type 1', `CFF', */
-  /*   `PFR', and `Windows FNT'.                                           */
+  /*   `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */
+  /*   `PFR', and `Windows~FNT'.                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*   face ::                                                             */
   /*                                                                       */
   /* <Input>                                                               */
   /*   face ::                                                             */
index ee00402..7e3a08a 100644 (file)
@@ -196,6 +196,32 @@ FT_BEGIN_HEADER
 
   } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service;
 
 
   } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service;
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \
+                                     done_global_hints_, load_glyph_)        \
+  FT_CALLBACK_TABLE_DEF                                                      \
+  const FT_AutoHinter_ServiceRec class_ =                                    \
+  {                                                                          \
+    reset_face_, get_global_hints_, done_global_hints_, load_glyph_          \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \
+                                     done_global_hints_, load_glyph_)        \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Library library,                                \
+                          FT_AutoHinter_ServiceRec* clazz)                   \
+  {                                                                          \
+    FT_UNUSED(library);                                                      \
+    clazz->reset_face = reset_face_;                                         \
+    clazz->get_global_hints = get_global_hints_;                             \
+    clazz->done_global_hints = done_global_hints_;                           \
+    clazz->load_glyph = load_glyph_;                                         \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index c7e9901..f8b4324 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (specification).                             */
 /*                                                                         */
 /*                                                                         */
 /*    Arithmetic computations (specification).                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -111,6 +111,31 @@ FT_BEGIN_HEADER
 #endif /* TT_USE_BYTECODE_INTERPRETER */
 
 
 #endif /* TT_USE_BYTECODE_INTERPRETER */
 
 
+  /*
+   *  A variant of FT_Matrix_Multiply which scales its result afterwards.
+   *  The idea is that both `a' and `b' are scaled by factors of 10 so that
+   *  the values are as precise as possible to get a correct result during
+   *  the 64bit multiplication.  Let `sa' and `sb' be the scaling factors of
+   *  `a' and `b', respectively, then the scaling factor of the result is
+   *  `sa*sb'.
+   */
+  FT_BASE( void )
+  FT_Matrix_Multiply_Scaled( const FT_Matrix*  a,
+                             FT_Matrix        *b,
+                             FT_Long           scaling );
+
+
+  /*
+   *  A variant of FT_Vector_Transform.  See comments for
+   *  FT_Matrix_Multiply_Scaled.
+   */
+
+  FT_BASE( void )
+  FT_Vector_Transform_Scaled( FT_Vector*        vector,
+                              const FT_Matrix*  matrix,
+                              FT_Long           scaling );
+
+
   /*
    *  Return -1, 0, or +1, depending on the orientation of a given corner.
    *  We use the Cartesian coordinate system, with positive vertical values
   /*
    *  Return -1, 0, or +1, depending on the orientation of a given corner.
    *  We use the Cartesian coordinate system, with positive vertical values
@@ -140,6 +165,7 @@ FT_BEGIN_HEADER
 #define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )
 #define F2DOT14_TO_FIXED( x )  ( (FT_Long)(x) << 2  )
 #define FLOAT_TO_FIXED( x )    ( (FT_Long)( x * 65536.0 ) )
 #define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )
 #define F2DOT14_TO_FIXED( x )  ( (FT_Long)(x) << 2  )
 #define FLOAT_TO_FIXED( x )    ( (FT_Long)( x * 65536.0 ) )
+#define FIXED_TO_INT( x )      ( FT_RoundFix( x ) >> 16 )
 
 #define ROUND_F26DOT6( x )     ( x >= 0 ? (    ( (x) + 32 ) & -64 )     \
                                         : ( -( ( 32 - (x) ) & -64 ) ) )
 
 #define ROUND_F26DOT6( x )     ( x >= 0 ? (    ( (x) + 32 ) & -64 )     \
                                         : ( -( ( 32 - (x) ) & -64 ) ) )
index 1562714..7baae35 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Debugging and logging component (specification).                     */
 /*                                                                         */
 /*                                                                         */
 /*    Debugging and logging component (specification).                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004, 2006, 2007 by                         */
+/*  Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -54,7 +54,7 @@ FT_BEGIN_HEADER
 #define FT_TRACE_DEF( x )  trace_ ## x ,
 
   /* defining the enumeration */
 #define FT_TRACE_DEF( x )  trace_ ## x ,
 
   /* defining the enumeration */
-  typedef enum
+  typedef enum  FT_Trace_
   {
 #include FT_INTERNAL_TRACE_H
     trace_count
   {
 #include FT_INTERNAL_TRACE_H
     trace_count
@@ -92,7 +92,7 @@ FT_BEGIN_HEADER
 
 #else /* !FT_DEBUG_LEVEL_TRACE */
 
 
 #else /* !FT_DEBUG_LEVEL_TRACE */
 
-#define FT_TRACE( level, varformat )  do ; while ( 0 )      /* nothing */
+#define FT_TRACE( level, varformat )  do { } while ( 0 )      /* nothing */
 
 #endif /* !FT_DEBUG_LEVEL_TRACE */
 
 
 #endif /* !FT_DEBUG_LEVEL_TRACE */
 
@@ -146,10 +146,12 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
-  /* You need two opening resp. closing parentheses!                       */
+  /* You need two opening and closing parentheses!                         */
   /*                                                                       */
   /* Example: FT_TRACE0(( "Value is %i", foo ))                            */
   /*                                                                       */
   /*                                                                       */
   /* Example: FT_TRACE0(( "Value is %i", foo ))                            */
   /*                                                                       */
+  /* Output of the FT_TRACEX macros is sent to stderr.                     */
+  /*                                                                       */
   /*************************************************************************/
 
 #define FT_TRACE0( varformat )  FT_TRACE( 0, varformat )
   /*************************************************************************/
 
 #define FT_TRACE0( varformat )  FT_TRACE( 0, varformat )
@@ -164,7 +166,9 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
-  /*  Define the FT_ERROR macro                                            */
+  /* Define the FT_ERROR macro.                                            */
+  /*                                                                       */
+  /* Output of this macro is sent to stderr.                               */
   /*                                                                       */
   /*************************************************************************/
 
   /*                                                                       */
   /*************************************************************************/
 
@@ -174,14 +178,14 @@ FT_BEGIN_HEADER
 
 #else  /* !FT_DEBUG_LEVEL_ERROR */
 
 
 #else  /* !FT_DEBUG_LEVEL_ERROR */
 
-#define FT_ERROR( varformat )  do ; while ( 0 )      /* nothing */
+#define FT_ERROR( varformat )  do { } while ( 0 )      /* nothing */
 
 #endif /* !FT_DEBUG_LEVEL_ERROR */
 
 
   /*************************************************************************/
   /*                                                                       */
 
 #endif /* !FT_DEBUG_LEVEL_ERROR */
 
 
   /*************************************************************************/
   /*                                                                       */
-  /* Define the FT_ASSERT macro                                            */
+  /* Define the FT_ASSERT macro.                                           */
   /*                                                                       */
   /*************************************************************************/
 
   /*                                                                       */
   /*************************************************************************/
 
@@ -197,28 +201,30 @@ FT_BEGIN_HEADER
 
 #else /* !FT_DEBUG_LEVEL_ERROR */
 
 
 #else /* !FT_DEBUG_LEVEL_ERROR */
 
-#define FT_ASSERT( condition )  do ; while ( 0 )
+#define FT_ASSERT( condition )  do { } while ( 0 )
 
 #endif /* !FT_DEBUG_LEVEL_ERROR */
 
 
   /*************************************************************************/
   /*                                                                       */
 
 #endif /* !FT_DEBUG_LEVEL_ERROR */
 
 
   /*************************************************************************/
   /*                                                                       */
-  /*  Define `FT_Message' and `FT_Panic' when needed                       */
+  /* Define `FT_Message' and `FT_Panic' when needed.                       */
   /*                                                                       */
   /*************************************************************************/
 
 #ifdef FT_DEBUG_LEVEL_ERROR
 
   /*                                                                       */
   /*************************************************************************/
 
 #ifdef FT_DEBUG_LEVEL_ERROR
 
-#include "stdio.h"  /* for vprintf() */
+#include "stdio.h"  /* for vfprintf() */
 
   /* print a message */
   FT_BASE( void )
 
   /* print a message */
   FT_BASE( void )
-  FT_Message( const char*  fmt, ... );
+  FT_Message( const char*  fmt,
+              ... );
 
   /* print a message and exit */
   FT_BASE( void )
 
   /* print a message and exit */
   FT_BASE( void )
-  FT_Panic( const char*  fmt, ... );
+  FT_Panic( const char*  fmt,
+            ... );
 
 #endif /* FT_DEBUG_LEVEL_ERROR */
 
 
 #endif /* FT_DEBUG_LEVEL_ERROR */
 
@@ -229,8 +235,8 @@ FT_BEGIN_HEADER
 
 #if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */
 
 
 #if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */
 
-  /* we disable the warning `conditional expression is constant' here */
-  /* in order to compile cleanly with the maximum level of warnings   */
+  /* We disable the warning `conditional expression is constant' here */
+  /* in order to compile cleanly with the maximum level of warnings.  */
 #pragma warning( disable : 4127 )
 
 #endif /* _MSC_VER */
 #pragma warning( disable : 4127 )
 
 #endif /* _MSC_VER */
index 97f3fd0..1d06997 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver interface (specification).                      */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType font driver interface (specification).                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2006 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2006, 2008 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -91,6 +91,7 @@ FT_BEGIN_HEADER
   (*FT_CharMap_CharNextFunc)( FT_CharMap  charmap,
                               FT_Long     charcode );
 
   (*FT_CharMap_CharNextFunc)( FT_CharMap  charmap,
                               FT_Long     charcode );
 
+
   typedef FT_Error
   (*FT_Face_GetKerningFunc)( FT_Face     face,
                              FT_UInt     left_glyph,
   typedef FT_Error
   (*FT_Face_GetKerningFunc)( FT_Face     face,
                              FT_UInt     left_glyph,
@@ -104,11 +105,11 @@ FT_BEGIN_HEADER
 
 
   typedef FT_Error
 
 
   typedef FT_Error
-  (*FT_Face_GetAdvancesFunc)( FT_Face     face,
-                              FT_UInt     first,
-                              FT_UInt     count,
-                              FT_Bool     vertical,
-                              FT_UShort*  advances );
+  (*FT_Face_GetAdvancesFunc)( FT_Face    face,
+                              FT_UInt    first,
+                              FT_UInt    count,
+                              FT_Int32   flags,
+                              FT_Fixed*  advances );
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -145,10 +146,6 @@ FT_BEGIN_HEADER
   /*    load_glyph       :: A function handle to load a glyph to a slot.   */
   /*                        This field is mandatory!                       */
   /*                                                                       */
   /*    load_glyph       :: A function handle to load a glyph to a slot.   */
   /*                        This field is mandatory!                       */
   /*                                                                       */
-  /*    get_char_index   :: A function handle to return the glyph index of */
-  /*                        a given character for a given charmap.  This   */
-  /*                        field is mandatory!                            */
-  /*                                                                       */
   /*    get_kerning      :: A function handle to return the unscaled       */
   /*                        kerning for a given pair of glyphs.  Can be    */
   /*                        set to 0 if the format doesn't support         */
   /*    get_kerning      :: A function handle to return the unscaled       */
   /*                        kerning for a given pair of glyphs.  Can be    */
   /*                        set to 0 if the format doesn't support         */
@@ -180,8 +177,8 @@ FT_BEGIN_HEADER
   /*                        to 0 if the scaling done in the base layer     */
   /*                        suffices.                                      */
   /* <Note>                                                                */
   /*                        to 0 if the scaling done in the base layer     */
   /*                        suffices.                                      */
   /* <Note>                                                                */
-  /*    Most function pointers, with the exception of `load_glyph' and     */
-  /*    `get_char_index' can be set to 0 to indicate a default behaviour.  */
+  /*    Most function pointers, with the exception of `load_glyph', can be */
+  /*    set to 0 to indicate a default behaviour.                          */
   /*                                                                       */
   typedef struct  FT_Driver_ClassRec_
   {
   /*                                                                       */
   typedef struct  FT_Driver_ClassRec_
   {
@@ -243,6 +240,179 @@ FT_BEGIN_HEADER
 
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DECLARE_DRIVER                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to create a forward declaration of a                          */
+  /*    FT_Driver_ClassRec stract instance.                                */
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_DRIVER                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an instance of FT_Driver_ClassRec struct.       */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
+  /*    to called with a pointer where the allocated stracture is returned.*/
+  /*    And when it is no longer needed a Destroy function needs           */
+  /*    to be called to release that allocation.                           */
+  /*    fcinit.c (ft_create_default_module_classes) already contains       */
+  /*    a mechanism to call these functions for the default modules        */
+  /*    described in ftmodule.h                                            */
+  /*                                                                       */
+  /*    Notice that the created Create and Destroy functions call          */
+  /*    pic_init and pic_free function to allow you to manually allocate   */
+  /*    and initialize any additional global data, like module specific    */
+  /*    interface, and put them in the global pic container defined in     */
+  /*    ftpic.h. if you don't need them just implement the functions as    */
+  /*    empty to resolve the link error.                                   */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
+  /*    allocated in the global scope (or the scope where the macro        */
+  /*    is used).                                                          */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \
+  a_, b_,
+#else
+  #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)
+#endif
+
+#define FT_DECLARE_DRIVER(class_)    \
+  FT_CALLBACK_TABLE                  \
+  const FT_Driver_ClassRec  class_;  
+
+#define FT_DEFINE_DRIVER(class_,                                             \
+                         flags_, size_, name_, version_, requires_,          \
+                         interface_, init_, done_, get_interface_,           \
+                         face_object_size_, size_object_size_,               \
+                         slot_object_size_, init_face_, done_face_,          \
+                         init_size_, done_size_, init_slot_, done_slot_,     \
+                         old_set_char_sizes_, old_set_pixel_sizes_,          \
+                         load_glyph_, get_kerning_, attach_file_,            \
+                         get_advances_, request_size_, select_size_ )        \
+  FT_CALLBACK_TABLE_DEF                                                      \
+  const FT_Driver_ClassRec class_ =                                          \
+  {                                                                          \
+    FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_,  \
+                          init_,done_,get_interface_)                        \
+                                                                             \
+    face_object_size_,                                                       \
+    size_object_size_,                                                       \
+    slot_object_size_,                                                       \
+                                                                             \
+    init_face_,                                                              \
+    done_face_,                                                              \
+                                                                             \
+    init_size_,                                                              \
+    done_size_,                                                              \
+                                                                             \
+    init_slot_,                                                              \
+    done_slot_,                                                              \
+                                                                             \
+    FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \
+                                                                             \
+    load_glyph_,                                                             \
+                                                                             \
+    get_kerning_,                                                            \
+    attach_file_,                                                            \
+    get_advances_,                                                           \
+                                                                             \
+    request_size_,                                                           \
+    select_size_                                                             \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \
+  clazz->set_char_sizes = a_; \
+  clazz->set_pixel_sizes = b_;
+#else
+  #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)
+#endif
+
+#define FT_DECLARE_DRIVER(class_)    FT_DECLARE_MODULE(class_)
+
+#define FT_DEFINE_DRIVER(class_,                                             \
+                         flags_, size_, name_, version_, requires_,          \
+                         interface_, init_, done_, get_interface_,           \
+                         face_object_size_, size_object_size_,               \
+                         slot_object_size_, init_face_, done_face_,          \
+                         init_size_, done_size_, init_slot_, done_slot_,     \
+                         old_set_char_sizes_, old_set_pixel_sizes_,          \
+                         load_glyph_, get_kerning_, attach_file_,            \
+                         get_advances_, request_size_, select_size_ )        \
+  void class_##_pic_free( FT_Library library );                              \
+  FT_Error class_##_pic_init( FT_Library library );                          \
+                                                                             \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library        library,                      \
+                             FT_Module_Class*  clazz )                       \
+  {                                                                          \
+    FT_Memory       memory = library->memory;                                \
+    FT_Driver_Class dclazz = (FT_Driver_Class)clazz;                         \
+    class_##_pic_free( library );                                            \
+    if ( dclazz )                                                            \
+      FT_FREE( dclazz );                                                     \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library        library,                       \
+                            FT_Module_Class**  output_class )                \
+  {                                                                          \
+    FT_Driver_Class  clazz;                                                  \
+    FT_Error         error;                                                  \
+    FT_Memory        memory = library->memory;                               \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \
+      return error;                                                          \
+                                                                             \
+    error = class_##_pic_init( library );                                    \
+    if(error)                                                                \
+    {                                                                        \
+      FT_FREE( clazz );                                                      \
+      return error;                                                          \
+    }                                                                        \
+                                                                             \
+    FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_,  \
+                          init_,done_,get_interface_)                        \
+                                                                             \
+    clazz->face_object_size    = face_object_size_;                          \
+    clazz->size_object_size    = size_object_size_;                          \
+    clazz->slot_object_size    = slot_object_size_;                          \
+                                                                             \
+    clazz->init_face           = init_face_;                                 \
+    clazz->done_face           = done_face_;                                 \
+                                                                             \
+    clazz->init_size           = init_size_;                                 \
+    clazz->done_size           = done_size_;                                 \
+                                                                             \
+    clazz->init_slot           = init_slot_;                                 \
+    clazz->done_slot           = done_slot_;                                 \
+                                                                             \
+    FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \
+                                                                             \
+    clazz->load_glyph          = load_glyph_;                                \
+                                                                             \
+    clazz->get_kerning         = get_kerning_;                               \
+    clazz->attach_file         = attach_file_;                               \
+    clazz->get_advances        = get_advances_;                              \
+                                                                             \
+    clazz->request_size        = request_size_;                              \
+    clazz->select_size         = select_size_;                               \
+                                                                             \
+    *output_class = (FT_Module_Class*)clazz;                                 \
+    return FT_Err_Ok;                                                        \
+  }                
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index 9f47c0b..ce4dc6c 100644 (file)
@@ -67,11 +67,11 @@ FT_BEGIN_HEADER
 
   typedef struct  FT_GlyphLoadRec_
   {
 
   typedef struct  FT_GlyphLoadRec_
   {
-    FT_Outline   outline;       /* outline             */
-    FT_Vector*   extra_points;  /* extra points table  */
+    FT_Outline   outline;       /* outline                   */
+    FT_Vector*   extra_points;  /* extra points table        */
     FT_Vector*   extra_points2; /* second extra points table */
     FT_Vector*   extra_points2; /* second extra points table */
-    FT_UInt      num_subglyphs; /* number of subglyphs */
-    FT_SubGlyph  subglyphs;     /* subglyphs           */
+    FT_UInt      num_subglyphs; /* number of subglyphs       */
+    FT_SubGlyph  subglyphs;     /* subglyphs                 */
 
   } FT_GlyphLoadRec, *FT_GlyphLoad;
 
 
   } FT_GlyphLoadRec, *FT_GlyphLoad;
 
@@ -121,15 +121,15 @@ FT_BEGIN_HEADER
                               FT_UInt         n_contours );
 
 
                               FT_UInt         n_contours );
 
 
-#define FT_GLYPHLOADER_CHECK_P( _loader, _count )                    \
-   ( (_count) == 0 || (int)((_loader)->base.outline.n_points    +    \
-                            (_loader)->current.outline.n_points +    \
-                            (_count)) <= (int)(_loader)->max_points )
+#define FT_GLYPHLOADER_CHECK_P( _loader, _count )                         \
+   ( (_count) == 0 || ((_loader)->base.outline.n_points    +              \
+                       (_loader)->current.outline.n_points +              \
+                       (unsigned long)(_count)) <= (_loader)->max_points )
 
 
-#define FT_GLYPHLOADER_CHECK_C( _loader, _count )                     \
-  ( (_count) == 0 || (int)((_loader)->base.outline.n_contours    +    \
-                           (_loader)->current.outline.n_contours +    \
-                           (_count)) <= (int)(_loader)->max_contours )
+#define FT_GLYPHLOADER_CHECK_C( _loader, _count )                          \
+  ( (_count) == 0 || ((_loader)->base.outline.n_contours    +              \
+                      (_loader)->current.outline.n_contours +              \
+                      (unsigned long)(_count)) <= (_loader)->max_contours )
 
 #define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours )      \
   ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points )   &&                  \
 
 #define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours )      \
   ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points )   &&                  \
index c6ddc42..2010ca9 100644 (file)
@@ -333,8 +333,8 @@ FT_BEGIN_HEADER
               FT_ULong     size,
               FT_Error    *p_error );
 
               FT_ULong     size,
               FT_Error    *p_error );
 
-#define FT_MEM_STRDUP( dst, str )                                     \
-          (dst) = ft_mem_strdup( memory, (const char*)(str), &error )
+#define FT_MEM_STRDUP( dst, str )                                            \
+          (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )
 
 #define FT_STRDUP( dst, str )                           \
           FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
 
 #define FT_STRDUP( dst, str )                           \
           FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
index 15b68d6..574cf58 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (specification).                   */
 /*                                                                         */
 /*                                                                         */
 /*    The FreeType private base classes (specification).                   */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -35,6 +35,7 @@
 #include FT_INTERNAL_DRIVER_H
 #include FT_INTERNAL_AUTOHINT_H
 #include FT_INTERNAL_SERVICE_H
 #include FT_INTERNAL_DRIVER_H
 #include FT_INTERNAL_AUTOHINT_H
 #include FT_INTERNAL_SERVICE_H
+#include FT_INTERNAL_PIC_H
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 #include FT_INCREMENTAL_H
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 #include FT_INCREMENTAL_H
@@ -160,6 +161,31 @@ FT_BEGIN_HEADER
   (*FT_CMap_CharNextFunc)( FT_CMap     cmap,
                            FT_UInt32  *achar_code );
 
   (*FT_CMap_CharNextFunc)( FT_CMap     cmap,
                            FT_UInt32  *achar_code );
 
+  typedef FT_UInt
+  (*FT_CMap_CharVarIndexFunc)( FT_CMap    cmap,
+                               FT_CMap    unicode_cmap,
+                               FT_UInt32  char_code,
+                               FT_UInt32  variant_selector );
+
+  typedef FT_Bool
+  (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap    cmap,
+                                   FT_UInt32  char_code,
+                                   FT_UInt32  variant_selector );
+
+  typedef FT_UInt32 *
+  (*FT_CMap_VariantListFunc)( FT_CMap    cmap,
+                              FT_Memory  mem );
+
+  typedef FT_UInt32 *
+  (*FT_CMap_CharVariantListFunc)( FT_CMap    cmap,
+                                  FT_Memory  mem,
+                                  FT_UInt32  char_code );
+
+  typedef FT_UInt32 *
+  (*FT_CMap_VariantCharListFunc)( FT_CMap    cmap,
+                                  FT_Memory  mem,
+                                  FT_UInt32  variant_selector );
+
 
   typedef struct  FT_CMap_ClassRec_
   {
 
   typedef struct  FT_CMap_ClassRec_
   {
@@ -169,8 +195,56 @@ FT_BEGIN_HEADER
     FT_CMap_CharIndexFunc  char_index;
     FT_CMap_CharNextFunc   char_next;
 
     FT_CMap_CharIndexFunc  char_index;
     FT_CMap_CharNextFunc   char_next;
 
+    /* Subsequent entries are special ones for format 14 -- the variant */
+    /* selector subtable which behaves like no other                    */
+
+    FT_CMap_CharVarIndexFunc      char_var_index;
+    FT_CMap_CharVarIsDefaultFunc  char_var_default;
+    FT_CMap_VariantListFunc       variant_list;
+    FT_CMap_CharVariantListFunc   charvariant_list;
+    FT_CMap_VariantCharListFunc   variantchar_list;
+
   } FT_CMap_ClassRec;
 
   } FT_CMap_ClassRec;
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DECLARE_CMAP_CLASS(class_) \
+    FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
+
+#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_,       \
+        char_next_, char_var_index_, char_var_default_, variant_list_,       \
+        charvariant_list_, variantchar_list_)                                \
+  FT_CALLBACK_TABLE_DEF                                                      \
+  const FT_CMap_ClassRec class_ =                                            \
+  {                                                                          \
+    size_, init_, done_, char_index_, char_next_, char_var_index_,           \
+    char_var_default_, variant_list_, charvariant_list_, variantchar_list_   \
+  };
+#else /* FT_CONFIG_OPTION_PIC */
+
+#define FT_DECLARE_CMAP_CLASS(class_) \
+    void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec*  clazz);
+
+#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_,       \
+        char_next_, char_var_index_, char_var_default_, variant_list_,       \
+        charvariant_list_, variantchar_list_)                                \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Library library,                                \
+                          FT_CMap_ClassRec*  clazz)                          \
+  {                                                                          \
+    FT_UNUSED(library);                                                      \
+    clazz->size = size_;                                                     \
+    clazz->init = init_;                                                     \
+    clazz->done = done_;                                                     \
+    clazz->char_index = char_index_;                                         \
+    clazz->char_next = char_next_;                                           \
+    clazz->char_var_index = char_var_index_;                                 \
+    clazz->char_var_default = char_var_default_;                             \
+    clazz->variant_list = variant_list_;                                     \
+    clazz->charvariant_list = charvariant_list_;                             \
+    clazz->variantchar_list = variantchar_list_;                             \
+  } 
+#endif /* FT_CONFIG_OPTION_PIC */
 
   /* create a new charmap and add it to charmap->face */
   FT_BASE( FT_Error )
 
   /* create a new charmap and add it to charmap->face */
   FT_BASE( FT_Error )
@@ -306,7 +380,28 @@ FT_BEGIN_HEADER
   } FT_GlyphSlot_InternalRec;
 
 
   } FT_GlyphSlot_InternalRec;
 
 
+#if 0
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    FT_Size_InternalRec                                                */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    This structure contains the internal fields of each FT_Size        */
+  /*    object.  Currently, it's empty.                                    */
+  /*                                                                       */
   /*************************************************************************/
   /*************************************************************************/
+
+  typedef struct  FT_Size_InternalRec_
+  {
+    /* empty */
+
+  } FT_Size_InternalRec;
+
+#endif
+
+
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
@@ -710,6 +805,10 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    debug_hooks      :: XXX                                            */
   /*                                                                       */
   /*                                                                       */
   /*    debug_hooks      :: XXX                                            */
   /*                                                                       */
+  /*    pic_container    :: Contains global structs and tables, instead    */
+  /*                        of defining them globallly.                    */
+  /*                                                                       */
+
   typedef struct  FT_LibraryRec_
   {
     FT_Memory          memory;           /* library's memory manager */
   typedef struct  FT_LibraryRec_
   {
     FT_Memory          memory;           /* library's memory manager */
@@ -740,6 +839,10 @@ FT_BEGIN_HEADER
     FT_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */
 #endif
 
     FT_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */
 #endif
 
+#ifdef FT_CONFIG_OPTION_PIC
+    FT_PIC_Container   pic_container;
+#endif
+
   } FT_LibraryRec;
 
 
   } FT_LibraryRec;
 
 
@@ -811,6 +914,484 @@ FT_BEGIN_HEADER
   FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;
 #endif
 
   FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;
 #endif
 
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /****              PIC-Support Macros for ftimage.h                   ****/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_OUTLINE_FUNCS                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an instance of FT_Outline_Funcs struct.         */
+  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */
+  /*    called with a pre-allocated stracture to be filled.                */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
+  /*    allocated in the global scope (or the scope where the macro        */
+  /*    is used).                                                          */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_,       \
+                                cubic_to_, shift_, delta_)                   \
+  static const FT_Outline_Funcs class_ =                                     \
+  {                                                                          \
+    move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_                 \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_,       \
+                                cubic_to_, shift_, delta_)                   \
+  static FT_Error                                                            \
+  Init_Class_##class_( FT_Outline_Funcs*  clazz )                            \
+  {                                                                          \
+    clazz->move_to = move_to_;                                               \
+    clazz->line_to = line_to_;                                               \
+    clazz->conic_to = conic_to_;                                             \
+    clazz->cubic_to = cubic_to_;                                             \
+    clazz->shift = shift_;                                                   \
+    clazz->delta = delta_;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_RASTER_FUNCS                                             */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an instance of FT_Raster_Funcs struct.          */
+  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */
+  /*    called with a pre-allocated stracture to be filled.                */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
+  /*    allocated in the global scope (or the scope where the macro        */
+  /*    is used).                                                          */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_,           \
+                               raster_reset_, raster_set_mode_,              \
+                               raster_render_, raster_done_)                 \
+  const FT_Raster_Funcs class_ =                                      \
+  {                                                                          \
+    glyph_format_, raster_new_, raster_reset_,                               \
+    raster_set_mode_, raster_render_, raster_done_                           \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_,           \
+    raster_reset_, raster_set_mode_, raster_render_, raster_done_)           \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Raster_Funcs*  clazz )                          \
+  {                                                                          \
+    clazz->glyph_format = glyph_format_;                                     \
+    clazz->raster_new = raster_new_;                                         \
+    clazz->raster_reset = raster_reset_;                                     \
+    clazz->raster_set_mode = raster_set_mode_;                               \
+    clazz->raster_render = raster_render_;                                   \
+    clazz->raster_done = raster_done_;                                       \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /****              PIC-Support Macros for ftrender.h                  ****/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_GLYPH                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an instance of FT_Glyph_Class struct.           */
+  /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */
+  /*    called with a pre-allocated stracture to be filled.                */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
+  /*    allocated in the global scope (or the scope where the macro        */
+  /*    is used).                                                          */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_,         \
+                        transform_, bbox_, prepare_)                         \
+  FT_CALLBACK_TABLE_DEF                                                      \
+  const FT_Glyph_Class class_ =                                              \
+  {                                                                          \
+    size_, format_, init_, done_, copy_, transform_, bbox_, prepare_         \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_,         \
+                        transform_, bbox_, prepare_)                         \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Glyph_Class*  clazz )                           \
+  {                                                                          \
+    clazz->glyph_size = size_;                                               \
+    clazz->glyph_format = format_;                                           \
+    clazz->glyph_init = init_;                                               \
+    clazz->glyph_done = done_;                                               \
+    clazz->glyph_copy = copy_;                                               \
+    clazz->glyph_transform = transform_;                                     \
+    clazz->glyph_bbox = bbox_;                                               \
+    clazz->glyph_prepare = prepare_;                                         \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DECLARE_RENDERER                                                */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to create a forward declaration of a                          */
+  /*    FT_Renderer_Class stract instance.                                 */
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_RENDERER                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an instance of FT_Renderer_Class struct.        */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
+  /*    to called with a pointer where the allocated stracture is returned.*/
+  /*    And when it is no longer needed a Destroy function needs           */
+  /*    to be called to release that allocation.                           */
+  /*    fcinit.c (ft_create_default_module_classes) already contains       */
+  /*    a mechanism to call these functions for the default modules        */
+  /*    described in ftmodule.h                                            */
+  /*                                                                       */
+  /*    Notice that the created Create and Destroy functions call          */
+  /*    pic_init and pic_free function to allow you to manually allocate   */
+  /*    and initialize any additional global data, like module specific    */
+  /*    interface, and put them in the global pic container defined in     */
+  /*    ftpic.h. if you don't need them just implement the functions as    */
+  /*    empty to resolve the link error.                                   */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
+  /*    allocated in the global scope (or the scope where the macro        */
+  /*    is used).                                                          */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DECLARE_RENDERER(class_)                                          \
+    FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
+
+#define FT_DEFINE_RENDERER(class_,                                           \
+                           flags_, size_, name_, version_, requires_,        \
+                           interface_, init_, done_, get_interface_,         \
+                           glyph_format_, render_glyph_, transform_glyph_,   \
+                           get_glyph_cbox_, set_mode_, raster_class_ )       \
+  FT_CALLBACK_TABLE_DEF                                                      \
+  const FT_Renderer_Class  class_ =                                          \
+  {                                                                          \
+    FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,             \
+                          interface_,init_,done_,get_interface_)             \
+    glyph_format_,                                                           \
+                                                                             \
+    render_glyph_,                                                           \
+    transform_glyph_,                                                        \
+    get_glyph_cbox_,                                                         \
+    set_mode_,                                                               \
+                                                                             \
+    raster_class_                                                            \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DECLARE_RENDERER(class_)  FT_DECLARE_MODULE(class_)
+
+#define FT_DEFINE_RENDERER(class_, \
+                           flags_, size_, name_, version_, requires_,        \
+                           interface_, init_, done_, get_interface_,         \
+                           glyph_format_, render_glyph_, transform_glyph_,   \
+                           get_glyph_cbox_, set_mode_, raster_class_ )       \
+  void class_##_pic_free( FT_Library library );                              \
+  FT_Error class_##_pic_init( FT_Library library );                          \
+                                                                             \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library        library,                      \
+                        FT_Module_Class*  clazz )                            \
+  {                                                                          \
+    FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz;                   \
+    FT_Memory         memory = library->memory;                              \
+    class_##_pic_free( library );                                            \
+    if ( rclazz )                                                            \
+      FT_FREE( rclazz );                                                     \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library         library,                      \
+                            FT_Module_Class**  output_class )                \
+  {                                                                          \
+    FT_Renderer_Class*  clazz;                                               \
+    FT_Error            error;                                               \
+    FT_Memory           memory = library->memory;                            \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \
+      return error;                                                          \
+                                                                             \
+    error = class_##_pic_init( library );                                    \
+    if(error)                                                                \
+    {                                                                        \
+      FT_FREE( clazz );                                                      \
+      return error;                                                          \
+    }                                                                        \
+                                                                             \
+    FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,             \
+                          interface_,init_,done_,get_interface_)             \
+                                                                             \
+    clazz->glyph_format       = glyph_format_;                               \
+                                                                             \
+    clazz->render_glyph       = render_glyph_;                               \
+    clazz->transform_glyph    = transform_glyph_;                            \
+    clazz->get_glyph_cbox     = get_glyph_cbox_;                             \
+    clazz->set_mode           = set_mode_;                                   \
+                                                                             \
+    clazz->raster_class       = raster_class_;                               \
+                                                                             \
+    *output_class = (FT_Module_Class*)clazz;                                 \
+    return FT_Err_Ok;                                                        \
+  } 
+
+
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /****              PIC-Support Macros for ftmodapi.h                  ****/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <FuncType>                                                            */
+  /*    FT_Module_Creator                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A function used to create (allocate) a new module class object.    */
+  /*    The object's members are initialized, but the module itself is     */
+  /*    not.                                                               */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    memory       :: A handle to the memory manager.                    */
+  /*    output_class :: Initialized with the newly allocated class.        */
+  /*                                                                       */
+  typedef FT_Error
+  (*FT_Module_Creator)( FT_Memory          memory,
+                        FT_Module_Class**  output_class );
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <FuncType>                                                            */
+  /*    FT_Module_Destroyer                                                */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A function used to destroy (deallocate) a module class object.     */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    memory :: A handle to the memory manager.                          */
+  /*    clazz  :: Module class to destroy.                                 */
+  /*                                                                       */
+  typedef void
+  (*FT_Module_Destroyer)( FT_Memory         memory,
+                          FT_Module_Class*  clazz );
+
+#endif
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DECLARE_MODULE                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to create a forward declaration of a                          */
+  /*    FT_Module_Class stract instance.                                   */
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_MODULE                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an instance of FT_Module_Class struct.          */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
+  /*    to called with a pointer where the allocated stracture is returned.*/
+  /*    And when it is no longer needed a Destroy function needs           */
+  /*    to be called to release that allocation.                           */
+  /*    fcinit.c (ft_create_default_module_classes) already contains       */
+  /*    a mechanism to call these functions for the default modules        */
+  /*    described in ftmodule.h                                            */
+  /*                                                                       */
+  /*    Notice that the created Create and Destroy functions call          */
+  /*    pic_init and pic_free function to allow you to manually allocate   */
+  /*    and initialize any additional global data, like module specific    */
+  /*    interface, and put them in the global pic container defined in     */
+  /*    ftpic.h. if you don't need them just implement the functions as    */
+  /*    empty to resolve the link error.                                   */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
+  /*    allocated in the global scope (or the scope where the macro        */
+  /*    is used).                                                          */
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_ROOT_MODULE                                              */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an instance of FT_Module_Class struct inside    */
+  /*    another stract that contains it or in a function that initializes  */
+  /*    that containing stract                                             */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DECLARE_MODULE(class_)                                            \
+  FT_CALLBACK_TABLE                                                          \
+  const FT_Module_Class  class_;                                             \
+
+#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_,     \
+                              interface_, init_, done_, get_interface_)      \
+  {                                                                          \
+    flags_,                                                                  \
+    size_,                                                                   \
+                                                                             \
+    name_,                                                                   \
+    version_,                                                                \
+    requires_,                                                               \
+                                                                             \
+    interface_,                                                              \
+                                                                             \
+    init_,                                                                   \
+    done_,                                                                   \
+    get_interface_,                                                          \
+  },
+
+#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_,  \
+                         interface_, init_, done_, get_interface_)           \
+  FT_CALLBACK_TABLE_DEF                                                      \
+  const FT_Module_Class class_ =                                             \
+  {                                                                          \
+    flags_,                                                                  \
+    size_,                                                                   \
+                                                                             \
+    name_,                                                                   \
+    version_,                                                                \
+    requires_,                                                               \
+                                                                             \
+    interface_,                                                              \
+                                                                             \
+    init_,                                                                   \
+    done_,                                                                   \
+    get_interface_,                                                          \
+  };
+
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#define FT_DECLARE_MODULE(class_)                                            \
+  FT_Error FT_Create_Class_##class_( FT_Library library,                     \
+                                     FT_Module_Class** output_class );       \
+  void     FT_Destroy_Class_##class_( FT_Library library,                    \
+                                      FT_Module_Class*  clazz );
+
+#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_,     \
+                              interface_, init_, done_, get_interface_)      \
+    clazz->root.module_flags       = flags_;                                 \
+    clazz->root.module_size        = size_;                                  \
+    clazz->root.module_name        = name_;                                  \
+    clazz->root.module_version     = version_;                               \
+    clazz->root.module_requires    = requires_;                              \
+                                                                             \
+    clazz->root.module_interface   = interface_;                             \
+                                                                             \
+    clazz->root.module_init        = init_;                                  \
+    clazz->root.module_done        = done_;                                  \
+    clazz->root.get_interface      = get_interface_;               
+
+#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_,  \
+                         interface_, init_, done_, get_interface_)           \
+  void class_##_pic_free( FT_Library library );                              \
+  FT_Error class_##_pic_init( FT_Library library );                          \
+                                                                             \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_Module_Class*  clazz )                       \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    class_##_pic_free( library );                                            \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_Module_Class**  output_class )                \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    FT_Module_Class*  clazz;                                                 \
+    FT_Error          error;                                                 \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \
+      return error;                                                          \
+    error = class_##_pic_init( library );                                    \
+    if(error)                                                                \
+    {                                                                        \
+      FT_FREE( clazz );                                                      \
+      return error;                                                          \
+    }                                                                        \
+                                                                             \
+    clazz->module_flags       = flags_;                                      \
+    clazz->module_size        = size_;                                       \
+    clazz->module_name        = name_;                                       \
+    clazz->module_version     = version_;                                    \
+    clazz->module_requires    = requires_;                                   \
+                                                                             \
+    clazz->module_interface   = interface_;                                  \
+                                                                             \
+    clazz->module_init        = init_;                                       \
+    clazz->module_done        = done_;                                       \
+    clazz->get_interface      = get_interface_;                              \
+                                                                             \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftpic.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/ftpic.h
new file mode 100644 (file)
index 0000000..1b31957
--- /dev/null
@@ -0,0 +1,67 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftpic.h                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services (declaration).       */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /*  Modules that ordinarily have const global data that need address     */
+  /*  can instead define pointers here.                                    */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+#ifndef __FTPIC_H__
+#define __FTPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  typedef struct FT_PIC_Container_
+  {
+    /* pic containers for base */
+    void* base;
+    /* pic containers for modules */
+    void* autofit;   
+    void* cff;    
+    void* pshinter;    
+    void* psnames;    
+    void* raster;     
+    void* sfnt;     
+    void* smooth;     
+    void* truetype;     
+  } FT_PIC_Container;
+
+  /* Initialize the various function tables, structs, etc. stored in the container. */
+  FT_BASE( FT_Error )
+  ft_pic_container_init( FT_Library library );
+
+
+  /* Destroy the contents of the container. */
+  FT_BASE( void )
+  ft_pic_container_destroy( FT_Library library );
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __FTPIC_H__ */
+
+
+/* END */
index 94402bc..aa573c8 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Embedded resource forks accessor (specification).                    */
 /*                                                                         */
 /*                                                                         */
 /*    Embedded resource forks accessor (specification).                    */
 /*                                                                         */
-/*  Copyright 2004, 2006 by                                                */
+/*  Copyright 2004, 2006, 2007 by                                          */
 /*  Masatake YAMATO and Redhat K.K.                                        */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  Masatake YAMATO and Redhat K.K.                                        */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -34,7 +34,19 @@ 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. */
 
   /* 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
+#define FT_RACCESS_N_RULES  9
+
+
+  /* A structure to describe a reference in a resource by its resource ID */
+  /* and internal offset.  The `POST' resource expects to be concatenated */
+  /* by the order of resource IDs instead of its appearance in the file.  */
+
+  typedef struct  FT_RFork_Ref_
+  {
+    FT_UShort  res_id;
+    FT_ULong   offset;
+
+  } FT_RFork_Ref;
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
index 45d2fa9..569b9f7 100644 (file)
@@ -163,6 +163,298 @@ FT_BEGIN_HEADER
 
   typedef const FT_ServiceDescRec*  FT_ServiceDesc;
 
 
   typedef const FT_ServiceDescRec*  FT_ServiceDesc;
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6             */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an array of FT_ServiceDescRec structs.          */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
+  /*    to called with a pointer where the allocated array is returned.    */
+  /*    And when it is no longer needed a Destroy function needs           */
+  /*    to be called to release that allocation.                           */
+  /*                                                                       */
+  /*    These functions should be manyally called from the pic_init and    */
+  /*    pic_free functions of your module (see FT_DEFINE_MODULE)           */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the array will be         */
+  /*    allocated in the global scope (or the scope where the macro        */
+  /*    is used).                                                          */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1)            \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2)                                              \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3)                      \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {serv_id_3, serv_data_3},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4)                                              \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {serv_id_3, serv_data_3},                                                  \
+  {serv_id_4, serv_data_4},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4, serv_id_5, serv_data_5)                      \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {serv_id_3, serv_data_3},                                                  \
+  {serv_id_4, serv_data_4},                                                  \
+  {serv_id_5, serv_data_5},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4, serv_id_5, serv_data_5,                      \
+        serv_id_6, serv_data_6)                                              \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {serv_id_3, serv_data_3},                                                  \
+  {serv_id_4, serv_data_4},                                                  \
+  {serv_id_5, serv_data_5},                                                  \
+  {serv_id_6, serv_data_6},                                                  \
+  {NULL, NULL}                                                               \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1)            \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*2 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = NULL;                                                 \
+    clazz[1].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2)                                              \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*3 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = NULL;                                                 \
+    clazz[2].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3)                      \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*4 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = serv_id_3;                                            \
+    clazz[2].serv_data = serv_data_3;                                        \
+    clazz[3].serv_id = NULL;                                                 \
+    clazz[3].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4)                                              \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*5 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = serv_id_3;                                            \
+    clazz[2].serv_data = serv_data_3;                                        \
+    clazz[3].serv_id = serv_id_4;                                            \
+    clazz[3].serv_data = serv_data_4;                                        \
+    clazz[4].serv_id = NULL;                                                 \
+    clazz[4].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3, serv_id_4,           \
+        serv_data_4, serv_id_5, serv_data_5)                                 \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*6 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = serv_id_3;                                            \
+    clazz[2].serv_data = serv_data_3;                                        \
+    clazz[3].serv_id = serv_id_4;                                            \
+    clazz[3].serv_data = serv_data_4;                                        \
+    clazz[4].serv_id = serv_id_5;                                            \
+    clazz[4].serv_data = serv_data_5;                                        \
+    clazz[5].serv_id = NULL;                                                 \
+    clazz[5].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4, serv_id_5, serv_data_5,                      \
+        serv_id_6, serv_data_6)                                              \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*7 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = serv_id_3;                                            \
+    clazz[2].serv_data = serv_data_3;                                        \
+    clazz[3].serv_id = serv_id_4;                                            \
+    clazz[3].serv_data = serv_data_4;                                        \
+    clazz[4].serv_id = serv_id_5;                                            \
+    clazz[4].serv_data = serv_data_5;                                        \
+    clazz[5].serv_id = serv_id_6;                                            \
+    clazz[5].serv_data = serv_data_6;                                        \
+    clazz[6].serv_id = NULL;                                                 \
+    clazz[6].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+#endif /* FT_CONFIG_OPTION_PIC */ 
 
   /*
    *  Parse a list of FT_ServiceDescRec descriptors and look for
 
   /*
    *  Parse a list of FT_ServiceDescRec descriptors and look for
@@ -301,6 +593,7 @@ FT_BEGIN_HEADER
    */
 
 #define FT_SERVICE_BDF_H                <freetype/internal/services/svbdf.h>
    */
 
 #define FT_SERVICE_BDF_H                <freetype/internal/services/svbdf.h>
+#define FT_SERVICE_CID_H                <freetype/internal/services/svcid.h>
 #define FT_SERVICE_GLYPH_DICT_H         <freetype/internal/services/svgldict.h>
 #define FT_SERVICE_GX_VALIDATE_H        <freetype/internal/services/svgxval.h>
 #define FT_SERVICE_KERNING_H            <freetype/internal/services/svkern.h>
 #define FT_SERVICE_GLYPH_DICT_H         <freetype/internal/services/svgldict.h>
 #define FT_SERVICE_GX_VALIDATE_H        <freetype/internal/services/svgxval.h>
 #define FT_SERVICE_KERNING_H            <freetype/internal/services/svkern.h>
index 81916fc..e9b383a 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Tracing handling (specification only).                               */
 /*                                                                         */
 /*                                                                         */
 /*    Tracing handling (specification only).                               */
 /*                                                                         */
-/*  Copyright 2002, 2004, 2005, 2006 by                                    */
+/*  Copyright 2002, 2004, 2005, 2006, 2007 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -31,16 +31,19 @@ FT_TRACE_DEF( init )      /* initialization          (ftinit.c)   */
 FT_TRACE_DEF( objs )      /* base objects            (ftobjs.c)   */
 FT_TRACE_DEF( outline )   /* outline management      (ftoutln.c)  */
 FT_TRACE_DEF( glyph )     /* glyph management        (ftglyph.c)  */
 FT_TRACE_DEF( objs )      /* base objects            (ftobjs.c)   */
 FT_TRACE_DEF( outline )   /* outline management      (ftoutln.c)  */
 FT_TRACE_DEF( glyph )     /* glyph management        (ftglyph.c)  */
+FT_TRACE_DEF( gloader )   /* glyph loader            (ftgloadr.c) */
 
 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)  */
 
 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)  */
+FT_TRACE_DEF( synth )     /* bold/slant synthesizer  (ftsynth.c)  */
 
   /* Cache sub-system */
 FT_TRACE_DEF( cache )     /* cache sub-system        (ftcache.c, etc.) */
 
   /* SFNT driver components */
 
   /* Cache sub-system */
 FT_TRACE_DEF( cache )     /* cache sub-system        (ftcache.c, etc.) */
 
   /* SFNT driver components */
+FT_TRACE_DEF( sfdriver )  /* SFNT font driver        (sfdriver.c) */
 FT_TRACE_DEF( sfobjs )    /* SFNT object handler     (sfobjs.c)   */
 FT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)   */
 FT_TRACE_DEF( ttkern )    /* kerning handler         (ttkern.c)   */
 FT_TRACE_DEF( sfobjs )    /* SFNT object handler     (sfobjs.c)   */
 FT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)   */
 FT_TRACE_DEF( ttkern )    /* kerning handler         (ttkern.c)   */
@@ -48,6 +51,7 @@ FT_TRACE_DEF( ttload )    /* basic TrueType tables   (ttload.c)   */
 FT_TRACE_DEF( ttmtx )     /* metrics-related tables  (ttmtx.c)    */
 FT_TRACE_DEF( ttpost )    /* PS table processing     (ttpost.c)   */
 FT_TRACE_DEF( ttsbit )    /* TrueType sbit handling  (ttsbit.c)   */
 FT_TRACE_DEF( ttmtx )     /* metrics-related tables  (ttmtx.c)    */
 FT_TRACE_DEF( ttpost )    /* PS table processing     (ttpost.c)   */
 FT_TRACE_DEF( ttsbit )    /* TrueType sbit handling  (ttsbit.c)   */
+FT_TRACE_DEF( ttbdf )     /* TrueType embedded BDF   (ttbdf.c)    */
 
   /* TrueType driver components */
 FT_TRACE_DEF( ttdriver )  /* TT font driver          (ttdriver.c) */
 
   /* TrueType driver components */
 FT_TRACE_DEF( ttdriver )  /* TT font driver          (ttdriver.c) */
@@ -58,6 +62,7 @@ FT_TRACE_DEF( ttpload )   /* TT data/program loader  (ttpload.c)  */
 FT_TRACE_DEF( ttgxvar )   /* TrueType GX var handler (ttgxvar.c)  */
 
   /* Type 1 driver components */
 FT_TRACE_DEF( ttgxvar )   /* TrueType GX var handler (ttgxvar.c)  */
 
   /* Type 1 driver components */
+FT_TRACE_DEF( t1afm )
 FT_TRACE_DEF( t1driver )
 FT_TRACE_DEF( t1gload )
 FT_TRACE_DEF( t1hint )
 FT_TRACE_DEF( t1driver )
 FT_TRACE_DEF( t1gload )
 FT_TRACE_DEF( t1hint )
@@ -114,6 +119,7 @@ FT_TRACE_DEF( otvgdef )
 FT_TRACE_DEF( otvgpos )
 FT_TRACE_DEF( otvgsub )
 FT_TRACE_DEF( otvjstf )
 FT_TRACE_DEF( otvgpos )
 FT_TRACE_DEF( otvgsub )
 FT_TRACE_DEF( otvjstf )
+FT_TRACE_DEF( otvmath )
 
   /* TrueTypeGX/AAT validation components */
 FT_TRACE_DEF( gxvmodule )
 
   /* TrueTypeGX/AAT validation components */
 FT_TRACE_DEF( gxvmodule )
index 27d5dc5..f500a65 100644 (file)
@@ -25,6 +25,7 @@
 
 
 #define FT_INTERNAL_OBJECTS_H             <freetype/internal/ftobjs.h>
 
 
 #define FT_INTERNAL_OBJECTS_H             <freetype/internal/ftobjs.h>
+#define FT_INTERNAL_PIC_H                 <freetype/internal/ftpic.h>
 #define FT_INTERNAL_STREAM_H              <freetype/internal/ftstream.h>
 #define FT_INTERNAL_MEMORY_H              <freetype/internal/ftmemory.h>
 #define FT_INTERNAL_DEBUG_H               <freetype/internal/ftdebug.h>
 #define FT_INTERNAL_STREAM_H              <freetype/internal/ftstream.h>
 #define FT_INTERNAL_MEMORY_H              <freetype/internal/ftmemory.h>
 #define FT_INTERNAL_DEBUG_H               <freetype/internal/ftdebug.h>
index 4baf7a0..a96e0df 100644 (file)
@@ -5,7 +5,7 @@
 /*    Auxiliary functions and data structures related to PostScript fonts  */
 /*    (specification).                                                     */
 /*                                                                         */
 /*    Auxiliary functions and data structures related to PostScript fonts  */
 /*    (specification).                                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -197,6 +197,7 @@ FT_BEGIN_HEADER
   {
     T1_FIELD_LOCATION_CID_INFO,
     T1_FIELD_LOCATION_FONT_DICT,
   {
     T1_FIELD_LOCATION_CID_INFO,
     T1_FIELD_LOCATION_FONT_DICT,
+    T1_FIELD_LOCATION_FONT_EXTRA,
     T1_FIELD_LOCATION_FONT_INFO,
     T1_FIELD_LOCATION_PRIVATE,
     T1_FIELD_LOCATION_BBOX,
     T1_FIELD_LOCATION_FONT_INFO,
     T1_FIELD_LOCATION_PRIVATE,
     T1_FIELD_LOCATION_BBOX,
@@ -227,7 +228,11 @@ FT_BEGIN_HEADER
     FT_UInt             array_max;    /* maximal number of elements for */
                                       /* array                          */
     FT_UInt             count_offset; /* offset of element count for    */
     FT_UInt             array_max;    /* maximal number of elements for */
                                       /* array                          */
     FT_UInt             count_offset; /* offset of element count for    */
-                                      /* arrays                         */
+                                      /* arrays; must not be zero if in */
+                                      /* use -- in other words, a       */
+                                      /* `num_FOO' element must not     */
+                                      /* start the used structure if we */
+                                      /* parse a `FOO' array            */
     FT_UInt             dict;         /* where we expect it             */
   } T1_FieldRec;
 
     FT_UInt             dict;         /* where we expect it             */
   } T1_FieldRec;
 
@@ -355,7 +360,7 @@ FT_BEGIN_HEADER
     FT_Error
     (*to_bytes)( PS_Parser  parser,
                  FT_Byte*   bytes,
     FT_Error
     (*to_bytes)( PS_Parser  parser,
                  FT_Byte*   bytes,
-                 FT_Long    max_bytes,
+                 FT_Offset  max_bytes,
                  FT_Long*   pnum_bytes,
                  FT_Bool    delimiters );
 
                  FT_Long*   pnum_bytes,
                  FT_Bool    delimiters );
 
@@ -528,13 +533,6 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    max_contours :: Maximal number of contours in builder outline.     */
   /*                                                                       */
   /*                                                                       */
   /*    max_contours :: Maximal number of contours in builder outline.     */
   /*                                                                       */
-  /*    last         :: The last point position.                           */
-  /*                                                                       */
-  /*    scale_x      :: The horizontal scaling value (FUnits to            */
-  /*                    sub-pixels).                                       */
-  /*                                                                       */
-  /*    scale_y      :: The vertical scaling value (FUnits to sub-pixels). */
-  /*                                                                       */
   /*    pos_x        :: The horizontal translation (if composite glyph).   */
   /*                                                                       */
   /*    pos_y        :: The vertical translation (if composite glyph).     */
   /*    pos_x        :: The horizontal translation (if composite glyph).   */
   /*                                                                       */
   /*    pos_y        :: The vertical translation (if composite glyph).     */
@@ -567,11 +565,6 @@ FT_BEGIN_HEADER
     FT_Outline*     base;
     FT_Outline*     current;
 
     FT_Outline*     base;
     FT_Outline*     current;
 
-    FT_Vector       last;
-
-    FT_Fixed        scale_x;
-    FT_Fixed        scale_y;
-
     FT_Pos          pos_x;
     FT_Pos          pos_y;
 
     FT_Pos          pos_x;
     FT_Pos          pos_y;
 
@@ -582,7 +575,6 @@ FT_BEGIN_HEADER
     T1_ParseState   parse_state;
     FT_Bool         load_points;
     FT_Bool         no_recurse;
     T1_ParseState   parse_state;
     FT_Bool         load_points;
     FT_Bool         no_recurse;
-    FT_Bool         shift;
 
     FT_Bool         metrics_only;
 
 
     FT_Bool         metrics_only;
 
@@ -697,9 +689,11 @@ FT_BEGIN_HEADER
     T1_Decoder_Callback  parse_callback;
     T1_Decoder_FuncsRec  funcs;
 
     T1_Decoder_Callback  parse_callback;
     T1_Decoder_FuncsRec  funcs;
 
-    FT_Int*              buildchar;
+    FT_Long*             buildchar;
     FT_UInt              len_buildchar;
 
     FT_UInt              len_buildchar;
 
+    FT_Bool              seac;
+
   } T1_DecoderRec;
 
 
   } T1_DecoderRec;
 
 
@@ -761,7 +755,7 @@ FT_BEGIN_HEADER
 
     FT_Int
     (*get_index)( const char*  name,
 
     FT_Int
     (*get_index)( const char*  name,
-                  FT_UInt      len,
+                  FT_Offset    len,
                   void*        user_data );
 
     void*         user_data;
                   void*        user_data );
 
     void*         user_data;
index 48452c0..0c35765 100644 (file)
@@ -6,7 +6,7 @@
 /*    recorders (specification only).  These are used to support native    */
 /*    T1/T2 hints in the `type1', `cid', and `cff' font drivers.           */
 /*                                                                         */
 /*    recorders (specification only).  These are used to support native    */
 /*    T1/T2 hints in the `type1', `cid', and `cff' font drivers.           */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003, 2005, 2006, 2007 by                        */
+/*  Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -157,7 +157,8 @@ FT_BEGIN_HEADER
    *     0 for horizontal stems (hstem), 1 for vertical ones (vstem).
    *
    *   coords ::
    *     0 for horizontal stems (hstem), 1 for vertical ones (vstem).
    *
    *   coords ::
-   *     Array of 2 integers, used as (position,length) stem descriptor.
+   *     Array of 2 coordinates in 16.16 format, used as (position,length)
+   *     stem descriptor.
    *
    * @note:
    *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use
    *
    * @note:
    *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use
@@ -175,9 +176,9 @@ FT_BEGIN_HEADER
    *
    */
   typedef void
    *
    */
   typedef void
-  (*T1_Hints_SetStemFunc)( T1_Hints  hints,
-                           FT_UInt   dimension,
-                           FT_Long*  coords );
+  (*T1_Hints_SetStemFunc)( T1_Hints   hints,
+                           FT_UInt    dimension,
+                           FT_Fixed*  coords );
 
 
   /*************************************************************************
 
 
   /*************************************************************************
@@ -197,8 +198,8 @@ FT_BEGIN_HEADER
    *     0 for horizontal stems, 1 for vertical ones.
    *
    *   coords ::
    *     0 for horizontal stems, 1 for vertical ones.
    *
    *   coords ::
-   *     An array of 6 integers, holding 3 (position,length) pairs for the
-   *     counter-controlled stems.
+   *     An array of 6 values in 16.16 format, holding 3 (position,length)
+   *     pairs for the counter-controlled stems.
    *
    * @note:
    *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use
    *
    * @note:
    *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use
@@ -209,9 +210,9 @@ FT_BEGIN_HEADER
    *
    */
   typedef void
    *
    */
   typedef void
-  (*T1_Hints_SetStem3Func)( T1_Hints  hints,
-                            FT_UInt   dimension,
-                            FT_Long*  coords );
+  (*T1_Hints_SetStem3Func)( T1_Hints   hints,
+                            FT_UInt    dimension,
+                            FT_Fixed*  coords );
 
 
   /*************************************************************************
 
 
   /*************************************************************************
@@ -446,7 +447,7 @@ FT_BEGIN_HEADER
    *     The number of stems.
    *
    *   coords ::
    *     The number of stems.
    *
    *   coords ::
-   *     An array of `count' (position,length) pairs.
+   *     An array of `count' (position,length) pairs in 16.16 format.
    *
    * @note:
    *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use
    *
    * @note:
    *   Use vertical coordinates (y) for horizontal stems (dim=0).  Use
@@ -678,6 +679,30 @@ FT_BEGIN_HEADER
 
   typedef PSHinter_Interface*  PSHinter_Service;
 
 
   typedef PSHinter_Interface*  PSHinter_Service;
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_,             \
+                                     get_t1_funcs_, get_t2_funcs_)           \
+  static const PSHinter_Interface class_ =                                   \
+  {                                                                          \
+    get_globals_funcs_, get_t1_funcs_, get_t2_funcs_                         \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_,             \
+                                     get_t1_funcs_, get_t2_funcs_)           \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Library library,                                \
+                          PSHinter_Interface*  clazz)                        \
+  {                                                                          \
+    FT_UNUSED(library);                                                      \
+    clazz->get_globals_funcs = get_globals_funcs_;                           \
+    clazz->get_t1_funcs = get_t1_funcs_;                                     \
+    clazz->get_t2_funcs = get_t2_funcs_;                                     \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index 0f7fc61..9264239 100644 (file)
@@ -45,6 +45,26 @@ FT_BEGIN_HEADER
     FT_BDF_GetPropertyFunc   get_property;
   };
 
     FT_BDF_GetPropertyFunc   get_property;
   };
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \
+  static const FT_Service_BDFRec class_ =                                \
+  {                                                                      \
+    get_charset_id_, get_property_                                       \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \
+  void                                                                   \
+  FT_Init_Class_##class_( FT_Service_BDFRec*  clazz )                    \
+  {                                                                      \
+    clazz->get_charset_id = get_charset_id_;                             \
+    clazz->get_property = get_property_;                                 \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h b/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h
new file mode 100644 (file)
index 0000000..9b874b5
--- /dev/null
@@ -0,0 +1,83 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svcid.h                                                                */
+/*                                                                         */
+/*    The FreeType CID font services (specification).                      */
+/*                                                                         */
+/*  Copyright 2007, 2009 by Derek Clegg, Michael Toftdal.                  */
+/*                                                                         */
+/*  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 __SVCID_H__
+#define __SVCID_H__
+
+#include FT_INTERNAL_SERVICE_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_CID  "CID"
+
+  typedef FT_Error
+  (*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face       face,
+                                               const char*  *registry,
+                                               const char*  *ordering,
+                                               FT_Int       *supplement );
+  typedef FT_Error
+  (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face   face,
+                                         FT_Bool  *is_cid );
+  typedef FT_Error
+  (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face   face,
+                                      FT_UInt   glyph_index,
+                                      FT_UInt  *cid );
+
+  FT_DEFINE_SERVICE( CID )
+  {
+    FT_CID_GetRegistryOrderingSupplementFunc  get_ros;
+    FT_CID_GetIsInternallyCIDKeyedFunc        get_is_cid;
+    FT_CID_GetCIDFromGlyphIndexFunc           get_cid_from_glyph_index;
+  };
+
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_,                           \
+        get_is_cid_, get_cid_from_glyph_index_ )                             \
+  static const FT_Service_CIDRec class_ =                                    \
+  {                                                                          \
+    get_ros_, get_is_cid_, get_cid_from_glyph_index_                         \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_,                           \
+        get_is_cid_, get_cid_from_glyph_index_ )                             \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Library library,                                \
+                          FT_Service_CIDRec* clazz)                          \
+  {                                                                          \
+    FT_UNUSED(library);                                                      \
+    clazz->get_ros = get_ros_;                                               \
+    clazz->get_is_cid = get_is_cid_;                                         \
+    clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_;             \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
+  /* */
+
+
+FT_END_HEADER
+
+
+#endif /* __SVCID_H__ */
+
+
+/* END */
index e5e56b2..d66a41d 100644 (file)
@@ -51,6 +51,28 @@ FT_BEGIN_HEADER
     FT_GlyphDict_NameIndexFunc  name_index;  /* optional */
   };
 
     FT_GlyphDict_NameIndexFunc  name_index;  /* optional */
   };
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \
+  static const FT_Service_GlyphDictRec class_ =                        \
+  {                                                                    \
+    get_name_, name_index_                                             \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \
+  void                                                                 \
+  FT_Init_Class_##class_( FT_Library library,                          \
+                          FT_Service_GlyphDictRec* clazz)              \
+  {                                                                    \
+    FT_UNUSED(library);                                                \
+    clazz->get_name = get_name_;                                       \
+    clazz->name_index = name_index_;                                   \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
index 8a99ec4..66e1da2 100644 (file)
@@ -68,6 +68,31 @@ FT_BEGIN_HEADER
     FT_Set_Var_Design_Func  set_var_design;
   };
 
     FT_Set_Var_Design_Func  set_var_design;
   };
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_,   \
+        set_mm_blend_, get_mm_var_, set_var_design_)                         \
+  static const FT_Service_MultiMastersRec class_ =                           \
+  {                                                                          \
+    get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_     \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_,   \
+        set_mm_blend_, get_mm_var_, set_var_design_)                         \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Service_MultiMastersRec*  clazz )               \
+  {                                                                          \
+    clazz->get_mm = get_mm_;                                                 \
+    clazz->set_mm_design = set_mm_design_;                                   \
+    clazz->set_mm_blend = set_mm_blend_;                                     \
+    clazz->get_mm_var = get_mm_var_;                                         \
+    clazz->set_var_design = set_var_design_;                                 \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
index 282da68..106c54f 100644 (file)
@@ -46,6 +46,27 @@ FT_BEGIN_HEADER
     FT_PsName_GetFunc  get_ps_font_name;
   };
 
     FT_PsName_GetFunc  get_ps_font_name;
   };
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \
+  static const FT_Service_PsFontNameRec class_ =                   \
+  {                                                                \
+    get_ps_font_name_                                              \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \
+  void                                                             \
+  FT_Init_Class_##class_( FT_Library library,                      \
+                          FT_Service_PsFontNameRec* clazz)         \
+  {                                                                \
+    FT_UNUSED(library);                                            \
+    clazz->get_ps_font_name = get_ps_font_name_;                   \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
index c4e25ed..961030c 100644 (file)
@@ -98,7 +98,7 @@ FT_BEGIN_HEADER
   (*PS_Unicodes_CharIndexFunc)( PS_Unicodes  unicodes,
                                 FT_UInt32    unicode );
 
   (*PS_Unicodes_CharIndexFunc)( PS_Unicodes  unicodes,
                                 FT_UInt32    unicode );
 
-  typedef FT_ULong
+  typedef FT_UInt32
   (*PS_Unicodes_CharNextFunc)( PS_Unicodes  unicodes,
                                FT_UInt32   *unicode );
 
   (*PS_Unicodes_CharNextFunc)( PS_Unicodes  unicodes,
                                FT_UInt32   *unicode );
 
@@ -117,6 +117,41 @@ FT_BEGIN_HEADER
     const unsigned short*      adobe_expert_encoding;
   };
 
     const unsigned short*      adobe_expert_encoding;
   };
 
+
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_PSCMAPSREC(class_, unicode_value_, unicodes_init_, \
+        unicodes_char_index_, unicodes_char_next_, macintosh_name_,          \
+        adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_)     \
+  static const FT_Service_PsCMapsRec class_ =                                \
+  {                                                                          \
+    unicode_value_, unicodes_init_,                                          \
+    unicodes_char_index_, unicodes_char_next_, macintosh_name_,              \
+    adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_          \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_PSCMAPSREC(class_, unicode_value_, unicodes_init_, \
+        unicodes_char_index_, unicodes_char_next_, macintosh_name_,          \
+        adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_)     \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Library library,                                \
+                          FT_Service_PsCMapsRec* clazz)                      \
+  {                                                                          \
+    FT_UNUSED(library);                                                      \
+    clazz->unicode_value = unicode_value_;                                   \
+    clazz->unicodes_init = unicodes_init_;                                   \
+    clazz->unicodes_char_index = unicodes_char_index_;                       \
+    clazz->unicodes_char_next = unicodes_char_next_;                         \
+    clazz->macintosh_name = macintosh_name_;                                 \
+    clazz->adobe_std_strings = adobe_std_strings_;                           \
+    clazz->adobe_std_encoding = adobe_std_encoding_;                         \
+    clazz->adobe_expert_encoding = adobe_expert_encoding_;                   \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
index 63f5db9..91ba91e 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType PostScript info service (specification).                */
 /*                                                                         */
 /*                                                                         */
 /*    The FreeType PostScript info service (specification).                */
 /*                                                                         */
-/*  Copyright 2003, 2004 by                                                */
+/*  Copyright 2003, 2004, 2009 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -33,6 +33,10 @@ FT_BEGIN_HEADER
   (*PS_GetFontInfoFunc)( FT_Face          face,
                          PS_FontInfoRec*  afont_info );
 
   (*PS_GetFontInfoFunc)( FT_Face          face,
                          PS_FontInfoRec*  afont_info );
 
+  typedef FT_Error
+  (*PS_GetFontExtraFunc)( FT_Face           face,
+                          PS_FontExtraRec*  afont_extra );
+
   typedef FT_Int
   (*PS_HasGlyphNamesFunc)( FT_Face   face );
 
   typedef FT_Int
   (*PS_HasGlyphNamesFunc)( FT_Face   face );
 
@@ -44,10 +48,38 @@ FT_BEGIN_HEADER
   FT_DEFINE_SERVICE( PsInfo )
   {
     PS_GetFontInfoFunc     ps_get_font_info;
   FT_DEFINE_SERVICE( PsInfo )
   {
     PS_GetFontInfoFunc     ps_get_font_info;
+    PS_GetFontExtraFunc    ps_get_font_extra;
     PS_HasGlyphNamesFunc   ps_has_glyph_names;
     PS_GetFontPrivateFunc  ps_get_font_private;
   };
 
     PS_HasGlyphNamesFunc   ps_has_glyph_names;
     PS_GetFontPrivateFunc  ps_get_font_private;
   };
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_,      \
+        ps_get_font_extra_, has_glyph_names_, get_font_private_) \
+  static const FT_Service_PsInfoRec class_ =                     \
+  {                                                              \
+    get_font_info_, ps_get_font_extra_, has_glyph_names_,        \
+    get_font_private_                                            \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_,      \
+        ps_get_font_extra_, has_glyph_names_, get_font_private_) \
+  void                                                           \
+  FT_Init_Class_##class_( FT_Library library,                    \
+                          FT_Service_PsInfoRec*  clazz)          \
+  {                                                              \
+    FT_UNUSED(library);                                          \
+    clazz->ps_get_font_info = get_font_info_;                    \
+    clazz->ps_get_font_extra = ps_get_font_extra_;               \
+    clazz->ps_has_glyph_names = has_glyph_names_;                \
+    clazz->ps_get_font_private = get_font_private_;              \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
index b4a85d9..30bb162 100644 (file)
@@ -58,6 +58,7 @@ FT_BEGIN_HEADER
   (*FT_SFNT_TableInfoFunc)( FT_Face    face,
                             FT_UInt    idx,
                             FT_ULong  *tag,
   (*FT_SFNT_TableInfoFunc)( FT_Face    face,
                             FT_UInt    idx,
                             FT_ULong  *tag,
+                            FT_ULong  *offset,
                             FT_ULong  *length );
 
 
                             FT_ULong  *length );
 
 
@@ -68,6 +69,27 @@ FT_BEGIN_HEADER
     FT_SFNT_TableInfoFunc  table_info;
   };
 
     FT_SFNT_TableInfoFunc  table_info;
   };
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_)  \
+  static const FT_Service_SFNT_TableRec class_ =                     \
+  {                                                                  \
+    load_, get_, info_                                               \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \
+  void                                                              \
+  FT_Init_Class_##class_( FT_Service_SFNT_TableRec*  clazz )        \
+  {                                                                 \
+    clazz->load_table = load_;                                      \
+    clazz->get_table = get_;                                        \
+    clazz->table_info = info_;                                      \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
index 1e02d15..8af0035 100644 (file)
@@ -1,13 +1,13 @@
 /***************************************************************************/
 /*                                                                         */
 /***************************************************************************/
 /*                                                                         */
-/*  svsttcmap.h                                                            */
+/*  svttcmap.h                                                             */
 /*                                                                         */
 /*    The FreeType TrueType/sfnt cmap extra information service.           */
 /*                                                                         */
 /*  Copyright 2003 by                                                      */
 /*  Masatake YAMATO, Redhat K.K.                                           */
 /*                                                                         */
 /*                                                                         */
 /*    The FreeType TrueType/sfnt cmap extra information service.           */
 /*                                                                         */
 /*  Copyright 2003 by                                                      */
 /*  Masatake YAMATO, Redhat K.K.                                           */
 /*                                                                         */
-/*  Copyright 2003 by                                                      */
+/*  Copyright 2003, 2008 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -49,6 +49,13 @@ FT_BEGIN_HEADER
   /*      The language ID used in Mac fonts.  Definitions of values are in */
   /*      freetype/ttnameid.h.                                             */
   /*                                                                       */
   /*      The language ID used in Mac fonts.  Definitions of values are in */
   /*      freetype/ttnameid.h.                                             */
   /*                                                                       */
+  /*    format ::                                                          */
+  /*      The cmap format.  OpenType 1.5 defines the formats 0 (byte       */
+  /*      encoding table), 2~(high-byte mapping through table), 4~(segment */
+  /*      mapping to delta values), 6~(trimmed table mapping), 8~(mixed    */
+  /*      16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented   */
+  /*      coverage), and 14 (Unicode Variation Sequences).                 */
+  /*                                                                       */
   typedef struct  TT_CMapInfo_
   {
     FT_ULong language;
   typedef struct  TT_CMapInfo_
   {
     FT_ULong language;
@@ -67,6 +74,27 @@ FT_BEGIN_HEADER
     TT_CMap_Info_GetFunc  get_cmap_info;
   };
 
     TT_CMap_Info_GetFunc  get_cmap_info;
   };
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_)  \
+  static const FT_Service_TTCMapsRec class_ =                 \
+  {                                                           \
+    get_cmap_info_                                            \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \
+  void                                                       \
+  FT_Init_Class_##class_( FT_Library library,                \
+                          FT_Service_TTCMapsRec*  clazz)     \
+  {                                                          \
+    FT_UNUSED(library);                                      \
+    clazz->get_cmap_info = get_cmap_info_;                   \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
index e57d484..ab2dc9a 100644 (file)
@@ -37,6 +37,25 @@ FT_BEGIN_HEADER
     TT_Glyf_GetLocationFunc  get_location;
   };
 
     TT_Glyf_GetLocationFunc  get_location;
   };
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ )   \
+  static const FT_Service_TTGlyfRec class_ =                  \
+  {                                                           \
+    get_location_                                             \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ )   \
+  void                                                        \
+  FT_Init_Class_##class_( FT_Service_TTGlyfRec*  clazz )      \
+  {                                                           \
+    clazz->get_location = get_location_;                      \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
+
   /* */
 
 
   /* */
 
 
index 7e8f684..6326deb 100644 (file)
@@ -753,6 +753,141 @@ FT_BEGIN_HEADER
   /* transitional */
   typedef SFNT_Interface*   SFNT_Service;
 
   /* transitional */
   typedef SFNT_Interface*   SFNT_Service;
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \
+  a, 
+#else
+  #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a)
+#endif
+#define FT_INTERNAL(a) \
+  a, 
+
+#define FT_DEFINE_SFNT_INTERFACE(class_,                                     \
+    goto_table_, init_face_, load_face_, done_face_, get_interface_,         \
+    load_any_, load_sfnt_header_, load_directory_, load_head_,               \
+    load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_,               \
+    load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_,                \
+    load_kern_, load_gasp_, load_pclt_, load_bhed_,                          \
+    set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_,               \
+    load_sbit_metrics_, load_sbit_image_, free_sbits_stub_,                  \
+    get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_,      \
+    get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_,        \
+    set_sbit_strike_, load_strike_metrics_, get_metrics_ )                   \
+  static const SFNT_Interface class_ =                                       \
+  {                                                                          \
+    FT_INTERNAL(goto_table_) \
+    FT_INTERNAL(init_face_) \
+    FT_INTERNAL(load_face_) \
+    FT_INTERNAL(done_face_) \
+    FT_INTERNAL(get_interface_) \
+    FT_INTERNAL(load_any_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory_) \
+    FT_INTERNAL(load_head_) \
+    FT_INTERNAL(load_hhea_) \
+    FT_INTERNAL(load_cmap_) \
+    FT_INTERNAL(load_maxp_) \
+    FT_INTERNAL(load_os2_) \
+    FT_INTERNAL(load_post_) \
+    FT_INTERNAL(load_name_) \
+    FT_INTERNAL(free_name_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub_) \
+    FT_INTERNAL(load_kern_) \
+    FT_INTERNAL(load_gasp_) \
+    FT_INTERNAL(load_pclt_) \
+    FT_INTERNAL(load_bhed_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics_) \
+    FT_INTERNAL(load_sbit_image_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub_) \
+    FT_INTERNAL(get_psname_) \
+    FT_INTERNAL(free_psnames_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub_) \
+    FT_INTERNAL(get_kerning_) \
+    FT_INTERNAL(load_font_dir_) \
+    FT_INTERNAL(load_hmtx_) \
+    FT_INTERNAL(load_eblc_) \
+    FT_INTERNAL(free_eblc_) \
+    FT_INTERNAL(set_sbit_strike_) \
+    FT_INTERNAL(load_strike_metrics_) \
+    FT_INTERNAL(get_metrics_) \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \
+  clazz->a = a_;
+#else
+  #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_)
+#endif
+#define FT_INTERNAL(a, a_) \
+  clazz->a = a_;
+
+#define FT_DEFINE_SFNT_INTERFACE(class_,                                     \
+    goto_table_, init_face_, load_face_, done_face_, get_interface_,         \
+    load_any_, load_sfnt_header_, load_directory_, load_head_,               \
+    load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_,               \
+    load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_,                \
+    load_kern_, load_gasp_, load_pclt_, load_bhed_,                          \
+    set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_,               \
+    load_sbit_metrics_, load_sbit_image_, free_sbits_stub_,                  \
+    get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_,      \
+    get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_,        \
+    set_sbit_strike_, load_strike_metrics_, get_metrics_ )                   \
+  void                                                                       \
+  FT_Init_Class_##class_( FT_Library library, SFNT_Interface*  clazz )       \
+  {                                                                          \
+    FT_UNUSED(library);                                                      \
+    FT_INTERNAL(goto_table,goto_table_) \
+    FT_INTERNAL(init_face,init_face_) \
+    FT_INTERNAL(load_face,load_face_) \
+    FT_INTERNAL(done_face,done_face_) \
+    FT_INTERNAL(get_interface,get_interface_) \
+    FT_INTERNAL(load_any,load_any_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header,load_sfnt_header_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory,load_directory_) \
+    FT_INTERNAL(load_head,load_head_) \
+    FT_INTERNAL(load_hhea,load_hhea_) \
+    FT_INTERNAL(load_cmap,load_cmap_) \
+    FT_INTERNAL(load_maxp,load_maxp_) \
+    FT_INTERNAL(load_os2,load_os2_) \
+    FT_INTERNAL(load_post,load_post_) \
+    FT_INTERNAL(load_name,load_name_) \
+    FT_INTERNAL(free_name,free_name_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub,load_hdmx_stub_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub,free_hdmx_stub_) \
+    FT_INTERNAL(load_kern,load_kern_) \
+    FT_INTERNAL(load_gasp,load_gasp_) \
+    FT_INTERNAL(load_pclt,load_pclt_) \
+    FT_INTERNAL(load_bhed,load_bhed_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub,set_sbit_strike_stub_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub,load_sbits_stub_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image,find_sbit_image_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics,load_sbit_metrics_) \
+    FT_INTERNAL(load_sbit_image,load_sbit_image_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub,free_sbits_stub_) \
+    FT_INTERNAL(get_psname,get_psname_) \
+    FT_INTERNAL(free_psnames,free_psnames_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub,load_charmap_stub_) \
+    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub,free_charmap_stub_) \
+    FT_INTERNAL(get_kerning,get_kerning_) \
+    FT_INTERNAL(load_font_dir,load_font_dir_) \
+    FT_INTERNAL(load_hmtx,load_hmtx_) \
+    FT_INTERNAL(load_eblc,load_eblc_) \
+    FT_INTERNAL(free_eblc,free_eblc_) \
+    FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \
+    FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \
+    FT_INTERNAL(get_metrics,get_metrics_) \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index 047c6d5..5f73063 100644 (file)
@@ -5,7 +5,7 @@
 /*    Basic Type1/Type2 type definitions and interface (specification      */
 /*    only).                                                               */
 /*                                                                         */
 /*    Basic Type1/Type2 type definitions and interface (specification      */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -58,7 +58,9 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    code_first :: The lowest valid character code in the encoding.     */
   /*                                                                       */
   /*                                                                       */
   /*    code_first :: The lowest valid character code in the encoding.     */
   /*                                                                       */
-  /*    code_last  :: The highest valid character code in the encoding.    */
+  /*    code_last  :: The highest valid character code in the encoding     */
+  /*                  + 1. When equal to code_first there are no valid     */
+  /*                  character codes.                                     */
   /*                                                                       */
   /*    char_index :: An array of corresponding glyph indices.             */
   /*                                                                       */
   /*                                                                       */
   /*    char_index :: An array of corresponding glyph indices.             */
   /*                                                                       */
@@ -87,11 +89,24 @@ FT_BEGIN_HEADER
   } T1_EncodingType;
 
 
   } T1_EncodingType;
 
 
+  /* used to hold extra data of PS_FontInfoRec that
+   * cannot be stored in the publicly defined structure.
+   *
+   * Note these can't be blended with multiple-masters.
+   */
+  typedef struct  PS_FontExtraRec_
+  {
+    FT_UShort  fs_type;
+
+  } PS_FontExtraRec;
+
+
   typedef struct  T1_FontRec_
   {
   typedef struct  T1_FontRec_
   {
-    PS_FontInfoRec   font_info;         /* font info dictionary */
-    PS_PrivateRec    private_dict;      /* private dictionary   */
-    FT_String*       font_name;         /* top-level dictionary */
+    PS_FontInfoRec   font_info;         /* font info dictionary   */
+    PS_FontExtraRec  font_extra;        /* font info extra fields */
+    PS_PrivateRec    private_dict;      /* private dictionary     */
+    FT_String*       font_name;         /* top-level dictionary   */
 
     T1_EncodingType  encoding_type;
     T1_EncodingRec   encoding;
 
     T1_EncodingType  encoding_type;
     T1_EncodingRec   encoding;
@@ -217,7 +232,7 @@ FT_BEGIN_HEADER
     /* undocumented, optional: has the same meaning as len_buildchar */
     /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25    */
     FT_UInt          len_buildchar;
     /* undocumented, optional: has the same meaning as len_buildchar */
     /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25    */
     FT_UInt          len_buildchar;
-    FT_Int*          buildchar;
+    FT_Long*         buildchar;
 
     /* since version 2.1 - interface to PostScript hinter */
     const void*     pshinter;
 
     /* since version 2.1 - interface to PostScript hinter */
     const void*     pshinter;
@@ -231,7 +246,10 @@ FT_BEGIN_HEADER
     void*            psnames;
     void*            psaux;
     CID_FaceInfoRec  cid;
     void*            psnames;
     void*            psaux;
     CID_FaceInfoRec  cid;
+    PS_FontExtraRec  font_extra;
+#if 0
     void*            afm_data;
     void*            afm_data;
+#endif
     CID_Subrs        subrs;
 
     /* since version 2.1 - interface to PostScript hinter */
     CID_Subrs        subrs;
 
     /* since version 2.1 - interface to PostScript hinter */
index dfbb6a1..acbb863 100644 (file)
@@ -5,7 +5,7 @@
 /*    Basic SFNT/TrueType type definitions and interface (specification    */
 /*    only).                                                               */
 /*                                                                         */
 /*    Basic SFNT/TrueType type definitions and interface (specification    */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -586,7 +586,7 @@ FT_BEGIN_HEADER
   /*    table_offset  :: The offset of the index table in the `EBLC'       */
   /*                     table.  Only used during strike loading.          */
   /*                                                                       */
   /*    table_offset  :: The offset of the index table in the `EBLC'       */
   /*                     table.  Only used during strike loading.          */
   /*                                                                       */
-  typedef struct  TT_SBit_RangeRec
+  typedef struct  TT_SBit_RangeRec_
   {
     FT_UShort           first_glyph;
     FT_UShort           last_glyph;
   {
     FT_UShort           first_glyph;
     FT_UShort           last_glyph;
@@ -902,7 +902,7 @@ FT_BEGIN_HEADER
     FT_Byte*   table;
     FT_Byte*   table_end;
     FT_Byte*   strings;
     FT_Byte*   table;
     FT_Byte*   table_end;
     FT_Byte*   strings;
-    FT_UInt32  strings_size;
+    FT_ULong   strings_size;
     FT_UInt    num_strikes;
     FT_Bool    loaded;
 
     FT_UInt    num_strikes;
     FT_Bool    loaded;
 
@@ -1401,7 +1401,7 @@ FT_BEGIN_HEADER
     FT_Byte*              vert_metrics;
     FT_ULong              vert_metrics_size;
 
     FT_Byte*              vert_metrics;
     FT_ULong              vert_metrics_size;
 
-    FT_UInt               num_locations;
+    FT_ULong              num_locations; /* in broken TTF, gid > 0xFFFF */ 
     FT_Byte*              glyph_locations;
 
     FT_Byte*              hdmx_table;
     FT_Byte*              glyph_locations;
 
     FT_Byte*              hdmx_table;
index 250629d..5e2a393 100644 (file)
@@ -5,7 +5,7 @@
 /*    Basic Type 1/Type 2 tables definitions and interface (specification  */
 /*    only).                                                               */
 /*                                                                         */
 /*    Basic Type 1/Type 2 tables definitions and interface (specification  */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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_BEGIN_HEADER
   /*    Type 1 Tables                                                      */
   /*                                                                       */
   /* <Abstract>                                                            */
   /*    Type 1 Tables                                                      */
   /*                                                                       */
   /* <Abstract>                                                            */
-  /*    Type 1 (PostScript) specific font tables.                          */
+  /*    Type~1 (PostScript) specific font tables.                          */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This section contains the definition of Type 1-specific tables,    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This section contains the definition of Type 1-specific tables,    */
@@ -62,11 +62,11 @@ FT_BEGIN_HEADER
   /*    PS_FontInfoRec                                                     */
   /*                                                                       */
   /* <Description>                                                         */
   /*    PS_FontInfoRec                                                     */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A structure used to model a Type1/Type2 FontInfo dictionary.  Note */
-  /*    that for Multiple Master fonts, each instance has its own          */
+  /*    A structure used to model a Type~1 or Type~2 FontInfo dictionary.  */
+  /*    Note that for Multiple Master fonts, each instance has its own     */
   /*    FontInfo dictionary.                                               */
   /*                                                                       */
   /*    FontInfo dictionary.                                               */
   /*                                                                       */
-  typedef struct  PS_FontInfoRec
+  typedef struct  PS_FontInfoRec_
   {
     FT_String*  version;
     FT_String*  notice;
   {
     FT_String*  version;
     FT_String*  notice;
@@ -78,7 +78,18 @@ FT_BEGIN_HEADER
     FT_Short    underline_position;
     FT_UShort   underline_thickness;
 
     FT_Short    underline_position;
     FT_UShort   underline_thickness;
 
-  } PS_FontInfoRec, *PS_FontInfo;
+  } PS_FontInfoRec;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    PS_FontInfo                                                        */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to a @PS_FontInfoRec structure.                           */
+  /*                                                                       */
+  typedef struct PS_FontInfoRec_*  PS_FontInfo;
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -100,9 +111,9 @@ FT_BEGIN_HEADER
   /*    PS_PrivateRec                                                      */
   /*                                                                       */
   /* <Description>                                                         */
   /*    PS_PrivateRec                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A structure used to model a Type1/Type2 private dictionary.  Note  */
-  /*    that for Multiple Master fonts, each instance has its own Private  */
-  /*    dictionary.                                                        */
+  /*    A structure used to model a Type~1 or Type~2 private dictionary.   */
+  /*    Note that for Multiple Master fonts, each instance has its own     */
+  /*    Private dictionary.                                                */
   /*                                                                       */
   typedef struct  PS_PrivateRec_
   {
   /*                                                                       */
   typedef struct  PS_PrivateRec_
   {
@@ -142,7 +153,18 @@ FT_BEGIN_HEADER
 
     FT_Short   min_feature[2];
 
 
     FT_Short   min_feature[2];
 
-  } PS_PrivateRec, *PS_Private;
+  } PS_PrivateRec;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    PS_Private                                                         */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to a @PS_PrivateRec structure.                            */
+  /*                                                                       */
+  typedef struct PS_PrivateRec_*  PS_Private;
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -168,7 +190,7 @@ FT_BEGIN_HEADER
   /*    given blend dictionary (font info or private).  Used to support    */
   /*    Multiple Masters fonts.                                            */
   /*                                                                       */
   /*    given blend dictionary (font info or private).  Used to support    */
   /*    Multiple Masters fonts.                                            */
   /*                                                                       */
-  typedef enum
+  typedef enum  T1_Blend_Flags_
   {
     /*# required fields in a FontInfo blend dictionary */
     T1_BLEND_UNDERLINE_POSITION = 0,
   {
     /*# required fields in a FontInfo blend dictionary */
     T1_BLEND_UNDERLINE_POSITION = 0,
@@ -272,6 +294,14 @@ FT_BEGIN_HEADER
   typedef PS_BlendRec  T1_Blend;
 
 
   typedef PS_BlendRec  T1_Blend;
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    CID_FaceDictRec                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A structure used to represent data in a CID top-level dictionary.  */
+  /*                                                                       */
   typedef struct  CID_FaceDictRec_
   {
     PS_PrivateRec  private_dict;
   typedef struct  CID_FaceDictRec_
   {
     PS_PrivateRec  private_dict;
@@ -290,7 +320,20 @@ FT_BEGIN_HEADER
     FT_ULong       subrmap_offset;
     FT_Int         sd_bytes;
 
     FT_ULong       subrmap_offset;
     FT_Int         sd_bytes;
 
-  } CID_FaceDictRec, *CID_FaceDict;
+  } CID_FaceDictRec;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    CID_FaceDict                                                       */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to a @CID_FaceDictRec structure.                          */
+  /*                                                                       */
+  typedef struct CID_FaceDictRec_*  CID_FaceDict;
+
+  /* */
 
 
   /* backwards-compatible definition */
 
 
   /* backwards-compatible definition */
@@ -332,7 +375,18 @@ FT_BEGIN_HEADER
 
     FT_ULong        data_offset;
 
 
     FT_ULong        data_offset;
 
-  } CID_FaceInfoRec, *CID_FaceInfo;
+  } CID_FaceInfoRec;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    CID_FaceInfo                                                       */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to a @CID_FaceInfoRec structure.                          */
+  /*                                                                       */
+  typedef struct CID_FaceInfoRec_*  CID_FaceInfo;
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -347,99 +401,99 @@ FT_BEGIN_HEADER
   /*                                                                       */
   typedef CID_FaceInfoRec  CID_Info;
 
   /*                                                                       */
   typedef CID_FaceInfoRec  CID_Info;
 
-  /* */
-
 
 
- /************************************************************************
-  *
-  * @function:
-  *    FT_Has_PS_Glyph_Names
-  *
-  * @description:
-  *    Return true if a given face provides reliable Postscript glyph
-  *    names.  This is similar to using the @FT_HAS_GLYPH_NAMES macro,
-  *    except that certain fonts (mostly TrueType) contain incorrect
-  *    glyph name tables.
-  *
-  *    When this function returns true, the caller is sure that the glyph
-  *    names returned by @FT_Get_Glyph_Name are reliable.
-  *
-  * @input:
-  *    face ::
-  *       face handle
-  *
-  * @return:
-  *    Boolean.  True if glyph names are reliable.
-  */
+  /************************************************************************
+   *
+   * @function:
+   *    FT_Has_PS_Glyph_Names
+   *
+   * @description:
+   *    Return true if a given face provides reliable PostScript glyph
+   *    names.  This is similar to using the @FT_HAS_GLYPH_NAMES macro,
+   *    except that certain fonts (mostly TrueType) contain incorrect
+   *    glyph name tables.
+   *
+   *    When this function returns true, the caller is sure that the glyph
+   *    names returned by @FT_Get_Glyph_Name are reliable.
+   *
+   * @input:
+   *    face ::
+   *       face handle
+   *
+   * @return:
+   *    Boolean.  True if glyph names are reliable.
+   *
+   */
   FT_EXPORT( FT_Int )
   FT_Has_PS_Glyph_Names( FT_Face  face );
 
 
   FT_EXPORT( FT_Int )
   FT_Has_PS_Glyph_Names( FT_Face  face );
 
 
- /************************************************************************
-  *
-  * @function:
-  *    FT_Get_PS_Font_Info
-  *
-  * @description:
-  *    Retrieve the @PS_FontInfoRec structure corresponding to a given
-  *    Postscript font.
-  *
-  * @input:
-  *    face ::
-  *       Postscript face handle.
-  *
-  * @output:
-  *    afont_info ::
-  *       Output font info structure pointer.
-  *
-  * @return:
-  *    FreeType error code.  0 means success.
-  *
-  * @note:
-  *    The string pointers within the font info structure are owned by
-  *    the face and don't need to be freed by the caller.
-  *
-  *    If the font's format is not Postscript-based, this function will
-  *    return the `FT_Err_Invalid_Argument' error code.
-  */
+  /************************************************************************
+   *
+   * @function:
+   *    FT_Get_PS_Font_Info
+   *
+   * @description:
+   *    Retrieve the @PS_FontInfoRec structure corresponding to a given
+   *    PostScript font.
+   *
+   * @input:
+   *    face ::
+   *       PostScript face handle.
+   *
+   * @output:
+   *    afont_info ::
+   *       Output font info structure pointer.
+   *
+   * @return:
+   *    FreeType error code.  0~means success.
+   *
+   * @note:
+   *    The string pointers within the font info structure are owned by
+   *    the face and don't need to be freed by the caller.
+   *
+   *    If the font's format is not PostScript-based, this function will
+   *    return the `FT_Err_Invalid_Argument' error code.
+   *
+   */
   FT_EXPORT( FT_Error )
   FT_EXPORT( FT_Error )
-  FT_Get_PS_Font_Info( FT_Face          face,
-                       PS_FontInfoRec  *afont_info );
-
-
- /************************************************************************
-  *
-  * @function:
-  *    FT_Get_PS_Font_Private
-  *
-  * @description:
-  *    Retrieve the @PS_PrivateRec structure corresponding to a given
-  *    Postscript font.
-  *
-  * @input:
-  *    face ::
-  *       Postscript face handle.
-  *
-  * @output:
-  *    afont_private ::
-  *       Output private dictionary structure pointer.
-  *
-  * @return:
-  *    FreeType error code.  0 means success.
-  *
-  * @note:
-  *    The string pointers within the font info structure are owned by
-  *    the face and don't need to be freed by the caller.
-  *
-  *    If the font's format is not Postscript-based, this function will
-  *    return the `FT_Err_Invalid_Argument' error code.
-  */
+  FT_Get_PS_Font_Info( FT_Face      face,
+                       PS_FontInfo  afont_info );
+
+
+  /************************************************************************
+   *
+   * @function:
+   *    FT_Get_PS_Font_Private
+   *
+   * @description:
+   *    Retrieve the @PS_PrivateRec structure corresponding to a given
+   *    PostScript font.
+   *
+   * @input:
+   *    face ::
+   *       PostScript face handle.
+   *
+   * @output:
+   *    afont_private ::
+   *       Output private dictionary structure pointer.
+   *
+   * @return:
+   *    FreeType error code.  0~means success.
+   *
+   * @note:
+   *    The string pointers within the @PS_PrivateRec structure are owned by
+   *    the face and don't need to be freed by the caller.
+   *
+   *    If the font's format is not PostScript-based, this function returns
+   *    the `FT_Err_Invalid_Argument' error code.
+   *
+   */
   FT_EXPORT( FT_Error )
   FT_EXPORT( FT_Error )
-  FT_Get_PS_Font_Private( FT_Face         face,
-                          PS_PrivateRec  *afont_private );
-
- /* */
+  FT_Get_PS_Font_Private( FT_Face     face,
+                          PS_Private  afont_private );
 
 
+  /* */
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
index b9acbda..cbeac78 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType name ID definitions (specification only).                   */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType name ID definitions (specification only).                   */
 /*                                                                         */
-/*  Copyright 1996-2002, 2003, 2004, 2006, 2007 by                         */
+/*  Copyright 1996-2002, 2003, 2004, 2006, 2007, 2008 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Section>                                                             */
+  /*    truetype_tables                                                    */
+  /*                                                                       */
+
+
   /*************************************************************************/
   /*                                                                       */
   /* Possible values for the `platform' identifier code in the name        */
   /*************************************************************************/
   /*                                                                       */
   /* Possible values for the `platform' identifier code in the name        */
@@ -108,13 +115,18 @@ FT_BEGIN_HEADER
    *
    *   TT_APPLE_ID_UNICODE_32 ::
    *     Unicode 3.1 and beyond, using UTF-32.
    *
    *   TT_APPLE_ID_UNICODE_32 ::
    *     Unicode 3.1 and beyond, using UTF-32.
+   *
+   *   TT_APPLE_ID_VARIANT_SELECTOR ::
+   *     From Adobe, not Apple.  Not a normal cmap.  Specifies variations
+   *     on a real cmap.
    */
 
    */
 
-#define TT_APPLE_ID_DEFAULT      0 /* Unicode 1.0 */
-#define TT_APPLE_ID_UNICODE_1_1  1 /* specify Hangul at U+34xx */
-#define TT_APPLE_ID_ISO_10646    2 /* deprecated */
-#define TT_APPLE_ID_UNICODE_2_0  3 /* or later */
-#define TT_APPLE_ID_UNICODE_32   4 /* 2.0 or later, full repertoire */
+#define TT_APPLE_ID_DEFAULT           0 /* Unicode 1.0 */
+#define TT_APPLE_ID_UNICODE_1_1       1 /* specify Hangul at U+34xx */
+#define TT_APPLE_ID_ISO_10646         2 /* deprecated */
+#define TT_APPLE_ID_UNICODE_2_0       3 /* or later */
+#define TT_APPLE_ID_UNICODE_32        4 /* 2.0 or later, full repertoire */
+#define TT_APPLE_ID_VARIANT_SELECTOR  5 /* variation selector data */
 
 
   /***********************************************************************
 
 
   /***********************************************************************
@@ -290,6 +302,8 @@ FT_BEGIN_HEADER
    *     Adobe expert encoding.
    *   TT_ADOBE_ID_CUSTOM ::
    *     Adobe custom encoding.
    *     Adobe expert encoding.
    *   TT_ADOBE_ID_CUSTOM ::
    *     Adobe custom encoding.
+   *   TT_ADOBE_ID_LATIN_1 ::
+   *     Adobe Latin~1 encoding.
    */
 
 #define TT_ADOBE_ID_STANDARD  0
    */
 
 #define TT_ADOBE_ID_STANDARD  0
@@ -821,16 +835,18 @@ FT_BEGIN_HEADER
   /* This is new in OpenType 1.3 */
 #define TT_NAME_ID_CID_FINDFONT_NAME    20
 
   /* This is new in OpenType 1.3 */
 #define TT_NAME_ID_CID_FINDFONT_NAME    20
 
+  /* This is new in OpenType 1.5 */
+#define TT_NAME_ID_WWS_FAMILY           21
+#define TT_NAME_ID_WWS_SUBFAMILY        22
+
 
   /*************************************************************************/
   /*                                                                       */
   /* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table.     */
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
   /* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table.     */
   /*                                                                       */
-  /* Updated 02-Jul-2000.                                                  */
+  /* Updated 08-Nov-2008.                                                  */
   /*                                                                       */
 
   /*                                                                       */
 
-  /* General Scripts Area */
-
   /* Bit  0   Basic Latin */
 #define TT_UCR_BASIC_LATIN                     (1L <<  0) /* U+0020-U+007E */
   /* Bit  1   C1 Controls and Latin-1 Supplement */
   /* Bit  0   Basic Latin */
 #define TT_UCR_BASIC_LATIN                     (1L <<  0) /* U+0020-U+007E */
   /* Bit  1   C1 Controls and Latin-1 Supplement */
@@ -839,27 +855,44 @@ FT_BEGIN_HEADER
 #define TT_UCR_LATIN_EXTENDED_A                (1L <<  2) /* U+0100-U+017F */
   /* Bit  3   Latin Extended-B */
 #define TT_UCR_LATIN_EXTENDED_B                (1L <<  3) /* U+0180-U+024F */
 #define TT_UCR_LATIN_EXTENDED_A                (1L <<  2) /* U+0100-U+017F */
   /* Bit  3   Latin Extended-B */
 #define TT_UCR_LATIN_EXTENDED_B                (1L <<  3) /* U+0180-U+024F */
-  /* Bit  4   IPA Extensions */
+  /* Bit  4   IPA Extensions                 */
+  /*          Phonetic Extensions            */
+  /*          Phonetic Extensions Supplement */
 #define TT_UCR_IPA_EXTENSIONS                  (1L <<  4) /* U+0250-U+02AF */
 #define TT_UCR_IPA_EXTENSIONS                  (1L <<  4) /* U+0250-U+02AF */
+                                                          /* U+1D00-U+1D7F */
+                                                          /* U+1D80-U+1DBF */
   /* Bit  5   Spacing Modifier Letters */
   /* Bit  5   Spacing Modifier Letters */
+  /*          Modifier Tone Letters    */
 #define TT_UCR_SPACING_MODIFIER                (1L <<  5) /* U+02B0-U+02FF */
 #define TT_UCR_SPACING_MODIFIER                (1L <<  5) /* U+02B0-U+02FF */
-  /* Bit  6   Combining Diacritical Marks */
+                                                          /* U+A700-U+A71F */
+  /* Bit  6   Combining Diacritical Marks            */
+  /*          Combining Diacritical Marks Supplement */
 #define TT_UCR_COMBINING_DIACRITICS            (1L <<  6) /* U+0300-U+036F */
 #define TT_UCR_COMBINING_DIACRITICS            (1L <<  6) /* U+0300-U+036F */
+                                                          /* U+1DC0-U+1DFF */
   /* Bit  7   Greek and Coptic */
 #define TT_UCR_GREEK                           (1L <<  7) /* U+0370-U+03FF */
   /* Bit  7   Greek and Coptic */
 #define TT_UCR_GREEK                           (1L <<  7) /* U+0370-U+03FF */
-  /* Bit  8 is reserved (was: Greek Symbols and Coptic) */
-  /* Bit  9   Cyrillic               + */
-  /*          Cyrillic Supplementary   */
+  /* Bit  8   Coptic */
+#define TT_UCR_COPTIC                          (1L <<  8) /* U+2C80-U+2CFF */
+  /* Bit  9   Cyrillic            */
+  /*          Cyrillic Supplement */
+  /*          Cyrillic Extended-A */
+  /*          Cyrillic Extended-B */
 #define TT_UCR_CYRILLIC                        (1L <<  9) /* U+0400-U+04FF */
                                                           /* U+0500-U+052F */
 #define TT_UCR_CYRILLIC                        (1L <<  9) /* U+0400-U+04FF */
                                                           /* U+0500-U+052F */
+                                                          /* U+2DE0-U+2DFF */
+                                                          /* U+A640-U+A69F */
   /* Bit 10   Armenian */
 #define TT_UCR_ARMENIAN                        (1L << 10) /* U+0530-U+058F */
   /* Bit 11   Hebrew */
 #define TT_UCR_HEBREW                          (1L << 11) /* U+0590-U+05FF */
   /* Bit 10   Armenian */
 #define TT_UCR_ARMENIAN                        (1L << 10) /* U+0530-U+058F */
   /* Bit 11   Hebrew */
 #define TT_UCR_HEBREW                          (1L << 11) /* U+0590-U+05FF */
-  /* Bit 12 is reserved (was: Hebrew Extended) */
-  /* Bit 13   Arabic */
+  /* Bit 12   Vai */
+#define TT_UCR_VAI                             (1L << 12) /* U+A500-U+A63F */
+  /* Bit 13   Arabic            */
+  /*          Arabic Supplement */
 #define TT_UCR_ARABIC                          (1L << 13) /* U+0600-U+06FF */
 #define TT_UCR_ARABIC                          (1L << 13) /* U+0600-U+06FF */
-  /* Bit 14 is reserved (was: Arabic Extended) */
+                                                          /* U+0750-U+077F */
+  /* Bit 14   NKo */
+#define TT_UCR_NKO                             (1L << 14) /* U+07C0-U+07FF */
   /* Bit 15   Devanagari */
 #define TT_UCR_DEVANAGARI                      (1L << 15) /* U+0900-U+097F */
   /* Bit 16   Bengali */
   /* Bit 15   Devanagari */
 #define TT_UCR_DEVANAGARI                      (1L << 15) /* U+0900-U+097F */
   /* Bit 16   Bengali */
@@ -882,20 +915,26 @@ FT_BEGIN_HEADER
 #define TT_UCR_THAI                            (1L << 24) /* U+0E00-U+0E7F */
   /* Bit 25   Lao */
 #define TT_UCR_LAO                             (1L << 25) /* U+0E80-U+0EFF */
 #define TT_UCR_THAI                            (1L << 24) /* U+0E00-U+0E7F */
   /* Bit 25   Lao */
 #define TT_UCR_LAO                             (1L << 25) /* U+0E80-U+0EFF */
-  /* Bit 26   Georgian */
+  /* Bit 26   Georgian            */
+  /*          Georgian Supplement */
 #define TT_UCR_GEORGIAN                        (1L << 26) /* U+10A0-U+10FF */
 #define TT_UCR_GEORGIAN                        (1L << 26) /* U+10A0-U+10FF */
-  /* Bit 27 is reserved (was Georgian Extended) */
+                                                          /* U+2D00-U+2D2F */
+  /* Bit 27   Balinese */
+#define TT_UCR_BALINESE                        (1L << 27) /* U+1B00-U+1B7F */
   /* Bit 28   Hangul Jamo */
 #define TT_UCR_HANGUL_JAMO                     (1L << 28) /* U+1100-U+11FF */
   /* Bit 29   Latin Extended Additional */
   /* Bit 28   Hangul Jamo */
 #define TT_UCR_HANGUL_JAMO                     (1L << 28) /* U+1100-U+11FF */
   /* Bit 29   Latin Extended Additional */
+  /*          Latin Extended-C          */
+  /*          Latin Extended-D          */
 #define TT_UCR_LATIN_EXTENDED_ADDITIONAL       (1L << 29) /* U+1E00-U+1EFF */
 #define TT_UCR_LATIN_EXTENDED_ADDITIONAL       (1L << 29) /* U+1E00-U+1EFF */
+                                                          /* U+2C60-U+2C7F */
+                                                          /* U+A720-U+A7FF */
   /* Bit 30   Greek Extended */
 #define TT_UCR_GREEK_EXTENDED                  (1L << 30) /* U+1F00-U+1FFF */
   /* Bit 30   Greek Extended */
 #define TT_UCR_GREEK_EXTENDED                  (1L << 30) /* U+1F00-U+1FFF */
-
-  /* Symbols Area */
-
-  /* Bit 31   General Punctuation */
+  /* Bit 31   General Punctuation      */
+  /*          Supplemental Punctuation */
 #define TT_UCR_GENERAL_PUNCTUATION             (1L << 31) /* U+2000-U+206F */
 #define TT_UCR_GENERAL_PUNCTUATION             (1L << 31) /* U+2000-U+206F */
+                                                          /* U+2E00-U+2E7F */
   /* Bit 32   Superscripts And Subscripts */
 #define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS         (1L <<  0) /* U+2070-U+209F */
   /* Bit 33   Currency Symbols */
   /* Bit 32   Superscripts And Subscripts */
 #define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS         (1L <<  0) /* U+2070-U+209F */
   /* Bit 33   Currency Symbols */
@@ -906,16 +945,18 @@ FT_BEGIN_HEADER
 #define TT_UCR_LETTERLIKE_SYMBOLS              (1L <<  3) /* U+2100-U+214F */
   /* Bit 36   Number Forms */
 #define TT_UCR_NUMBER_FORMS                    (1L <<  4) /* U+2150-U+218F */
 #define TT_UCR_LETTERLIKE_SYMBOLS              (1L <<  3) /* U+2100-U+214F */
   /* Bit 36   Number Forms */
 #define TT_UCR_NUMBER_FORMS                    (1L <<  4) /* U+2150-U+218F */
-  /* Bit 37   Arrows                + */
-  /*          Supplemental Arrows-A + */
-  /*          Supplemental Arrows-B   */
+  /* Bit 37   Arrows                           */
+  /*          Supplemental Arrows-A            */
+  /*          Supplemental Arrows-B            */
+  /*          Miscellaneous Symbols and Arrows */
 #define TT_UCR_ARROWS                          (1L <<  5) /* U+2190-U+21FF */
                                                           /* U+27F0-U+27FF */
                                                           /* U+2900-U+297F */
 #define TT_UCR_ARROWS                          (1L <<  5) /* U+2190-U+21FF */
                                                           /* U+27F0-U+27FF */
                                                           /* U+2900-U+297F */
-  /* Bit 38   Mathematical Operators               + */
-  /*          Supplemental Mathematical Operators  + */
-  /*          Miscellaneous Mathematical Symbols-A + */
-  /*          Miscellaneous Mathematical Symbols-B   */
+                                                          /* U+2B00-U+2BFF */
+  /* Bit 38   Mathematical Operators               */
+  /*          Supplemental Mathematical Operators  */
+  /*          Miscellaneous Mathematical Symbols-A */
+  /*          Miscellaneous Mathematical Symbols-B */
 #define TT_UCR_MATHEMATICAL_OPERATORS          (1L <<  6) /* U+2200-U+22FF */
                                                           /* U+2A00-U+2AFF */
                                                           /* U+27C0-U+27EF */
 #define TT_UCR_MATHEMATICAL_OPERATORS          (1L <<  6) /* U+2200-U+22FF */
                                                           /* U+2A00-U+2AFF */
                                                           /* U+27C0-U+27EF */
@@ -938,60 +979,53 @@ FT_BEGIN_HEADER
 #define TT_UCR_MISCELLANEOUS_SYMBOLS           (1L << 14) /* U+2600-U+26FF */
   /* Bit 47   Dingbats */
 #define TT_UCR_DINGBATS                        (1L << 15) /* U+2700-U+27BF */
 #define TT_UCR_MISCELLANEOUS_SYMBOLS           (1L << 14) /* U+2600-U+26FF */
   /* Bit 47   Dingbats */
 #define TT_UCR_DINGBATS                        (1L << 15) /* U+2700-U+27BF */
-
-  /* CJK Phonetics and Symbols Area */
-
   /* Bit 48   CJK Symbols and Punctuation */
 #define TT_UCR_CJK_SYMBOLS                     (1L << 16) /* U+3000-U+303F */
   /* Bit 49   Hiragana */
 #define TT_UCR_HIRAGANA                        (1L << 17) /* U+3040-U+309F */
   /* Bit 48   CJK Symbols and Punctuation */
 #define TT_UCR_CJK_SYMBOLS                     (1L << 16) /* U+3000-U+303F */
   /* Bit 49   Hiragana */
 #define TT_UCR_HIRAGANA                        (1L << 17) /* U+3040-U+309F */
-  /* Bit 50   Katakana                     */
-  /*          Katakana Phonetic Extensions   */
+  /* Bit 50   Katakana                     */
+  /*          Katakana Phonetic Extensions */
 #define TT_UCR_KATAKANA                        (1L << 18) /* U+30A0-U+30FF */
                                                           /* U+31F0-U+31FF */
 #define TT_UCR_KATAKANA                        (1L << 18) /* U+30A0-U+30FF */
                                                           /* U+31F0-U+31FF */
-  /* Bit 51   Bopomofo          */
-  /*          Bopomofo Extended   */
+  /* Bit 51   Bopomofo          */
+  /*          Bopomofo Extended */
 #define TT_UCR_BOPOMOFO                        (1L << 19) /* U+3100-U+312F */
                                                           /* U+31A0-U+31BF */
   /* Bit 52   Hangul Compatibility Jamo */
 #define TT_UCR_HANGUL_COMPATIBILITY_JAMO       (1L << 20) /* U+3130-U+318F */
 #define TT_UCR_BOPOMOFO                        (1L << 19) /* U+3100-U+312F */
                                                           /* U+31A0-U+31BF */
   /* Bit 52   Hangul Compatibility Jamo */
 #define TT_UCR_HANGUL_COMPATIBILITY_JAMO       (1L << 20) /* U+3130-U+318F */
-  /* Bit 53   Kanbun */
-#define TT_UCR_CJK_MISC                        (1L << 21) /* U+3190-U+319F */
-#define TT_UCR_KANBUN  TT_UCR_CJK_MISC
+  /* Bit 53   Phags-Pa */
+#define TT_UCR_CJK_MISC                        (1L << 21) /* U+A840-U+A87F */
+#define TT_UCR_KANBUN  TT_UCR_CJK_MISC /* deprecated */
+#define TT_UCR_PHAGSPA
   /* Bit 54   Enclosed CJK Letters and Months */
 #define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS     (1L << 22) /* U+3200-U+32FF */
   /* Bit 55   CJK Compatibility */
 #define TT_UCR_CJK_COMPATIBILITY               (1L << 23) /* U+3300-U+33FF */
   /* Bit 54   Enclosed CJK Letters and Months */
 #define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS     (1L << 22) /* U+3200-U+32FF */
   /* Bit 55   CJK Compatibility */
 #define TT_UCR_CJK_COMPATIBILITY               (1L << 23) /* U+3300-U+33FF */
-
-  /* Hangul Syllables Area */
-
-  /* Bit 56   Hangul */
+  /* Bit 56   Hangul Syllables */
 #define TT_UCR_HANGUL                          (1L << 24) /* U+AC00-U+D7A3 */
 #define TT_UCR_HANGUL                          (1L << 24) /* U+AC00-U+D7A3 */
-
-  /* Surrogates Area */
-
-  /* Bit 57   High Surrogates             + */
-  /*          High Private Use Surrogates + */
-  /*          Low Surrogates                */
+  /* Bit 57   High Surrogates              */
+  /*          High Private Use Surrogates  */
+  /*          Low Surrogates               */
+  /*                                       */
+  /* According to OpenType specs v.1.3+,   */
+  /* setting bit 57 implies that there is  */
+  /* at least one codepoint beyond the     */
+  /* Basic Multilingual Plane that is      */
+  /* supported by this font.  So it really */
+  /* means >= U+10000                      */
 #define TT_UCR_SURROGATES                      (1L << 25) /* U+D800-U+DB7F */
                                                           /* U+DB80-U+DBFF */
                                                           /* U+DC00-U+DFFF */
 #define TT_UCR_SURROGATES                      (1L << 25) /* U+D800-U+DB7F */
                                                           /* U+DB80-U+DBFF */
                                                           /* U+DC00-U+DFFF */
-  /* According to OpenType specs v.1.3+, setting bit 57 implies that there */
-  /* is at least one codepoint beyond the Basic Multilingual Plane that is */
-  /* supported by this font.  So it really means:            >= U+10000    */
-
-  /* Bit 58 is reserved for Unicode SubRanges */
-
-  /* CJK Ideographs Area */
-
-  /* Bit 59   CJK Unified Ideographs             + */
-  /*          CJK Radicals Supplement            + */
-  /*          Kangxi Radicals                    + */
-  /*          Ideographic Description Characters + */
-  /*          CJK Unified Ideographs Extension A   */
-  /*          CJK Unified Ideographs Extension A + */
-  /*          CJK Unified Ideographs Extension B + */
-  /*          Kanbun                               */
+#define TT_UCR_NON_PLANE_0  TT_UCR_SURROGATES
+  /* Bit 58  Phoenician */
+#define TT_UCR_PHOENICIAN                      (1L << 26) /*U+10900-U+1091F*/
+  /* Bit 59   CJK Unified Ideographs             */
+  /*          CJK Radicals Supplement            */
+  /*          Kangxi Radicals                    */
+  /*          Ideographic Description Characters */
+  /*          CJK Unified Ideographs Extension A */
+  /*          CJK Unified Ideographs Extension B */
+  /*          Kanbun                             */
 #define TT_UCR_CJK_UNIFIED_IDEOGRAPHS          (1L << 27) /* U+4E00-U+9FFF */
                                                           /* U+2E80-U+2EFF */
                                                           /* U+2F00-U+2FDF */
 #define TT_UCR_CJK_UNIFIED_IDEOGRAPHS          (1L << 27) /* U+4E00-U+9FFF */
                                                           /* U+2E80-U+2EFF */
                                                           /* U+2F00-U+2FDF */
@@ -999,17 +1033,13 @@ FT_BEGIN_HEADER
                                                           /* U+3400-U+4DB5 */
                                                           /*U+20000-U+2A6DF*/
                                                           /* U+3190-U+319F */
                                                           /* U+3400-U+4DB5 */
                                                           /*U+20000-U+2A6DF*/
                                                           /* U+3190-U+319F */
-
-  /* Private Use Area */
-
   /* Bit 60   Private Use */
 #define TT_UCR_PRIVATE_USE                     (1L << 28) /* U+E000-U+F8FF */
   /* Bit 60   Private Use */
 #define TT_UCR_PRIVATE_USE                     (1L << 28) /* U+E000-U+F8FF */
-
-  /* Compatibility Area and Specials */
-
-  /* Bit 61   CJK Compatibility Ideographs            + */
-  /*          CJK Compatibility Ideographs Supplement   */
-#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS    (1L << 29) /* U+F900-U+FAFF */
+  /* Bit 61   CJK Strokes                             */
+  /*          CJK Compatibility Ideographs            */
+  /*          CJK Compatibility Ideographs Supplement */
+#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS    (1L << 29) /* U+31C0-U+31EF */
+                                                          /* U+F900-U+FAFF */
                                                           /*U+2F800-U+2FA1F*/
   /* Bit 62   Alphabetic Presentation Forms */
 #define TT_UCR_ALPHABETIC_PRESENTATION_FORMS   (1L << 30) /* U+FB00-U+FB4F */
                                                           /*U+2F800-U+2FA1F*/
   /* Bit 62   Alphabetic Presentation Forms */
 #define TT_UCR_ALPHABETIC_PRESENTATION_FORMS   (1L << 30) /* U+FB00-U+FB4F */
@@ -1017,8 +1047,10 @@ FT_BEGIN_HEADER
 #define TT_UCR_ARABIC_PRESENTATIONS_A          (1L << 31) /* U+FB50-U+FDFF */
   /* Bit 64   Combining Half Marks */
 #define TT_UCR_COMBINING_HALF_MARKS            (1L <<  0) /* U+FE20-U+FE2F */
 #define TT_UCR_ARABIC_PRESENTATIONS_A          (1L << 31) /* U+FB50-U+FDFF */
   /* Bit 64   Combining Half Marks */
 #define TT_UCR_COMBINING_HALF_MARKS            (1L <<  0) /* U+FE20-U+FE2F */
-  /* Bit 65   CJK Compatibility Forms */
-#define TT_UCR_CJK_COMPATIBILITY_FORMS         (1L <<  1) /* U+FE30-U+FE4F */
+  /* Bit 65   Vertical forms          */
+  /*          CJK Compatibility Forms */
+#define TT_UCR_CJK_COMPATIBILITY_FORMS         (1L <<  1) /* U+FE10-U+FE1F */
+                                                          /* U+FE30-U+FE4F */
   /* Bit 66   Small Form Variants */
 #define TT_UCR_SMALL_FORM_VARIANTS             (1L <<  2) /* U+FE50-U+FE6F */
   /* Bit 67   Arabic Presentation Forms-B */
   /* Bit 66   Small Form Variants */
 #define TT_UCR_SMALL_FORM_VARIANTS             (1L <<  2) /* U+FE50-U+FE6F */
   /* Bit 67   Arabic Presentation Forms-B */
@@ -1037,8 +1069,12 @@ FT_BEGIN_HEADER
 #define TT_UCR_SINHALA                         (1L <<  9) /* U+0D80-U+0DFF */
   /* Bit 74   Myanmar */
 #define TT_UCR_MYANMAR                         (1L << 10) /* U+1000-U+109F */
 #define TT_UCR_SINHALA                         (1L <<  9) /* U+0D80-U+0DFF */
   /* Bit 74   Myanmar */
 #define TT_UCR_MYANMAR                         (1L << 10) /* U+1000-U+109F */
-  /* Bit 75   Ethiopic */
+  /* Bit 75   Ethiopic            */
+  /*          Ethiopic Supplement */
+  /*          Ethiopic Extended   */
 #define TT_UCR_ETHIOPIC                        (1L << 11) /* U+1200-U+137F */
 #define TT_UCR_ETHIOPIC                        (1L << 11) /* U+1200-U+137F */
+                                                          /* U+1380-U+139F */
+                                                          /* U+2D80-U+2DDF */
   /* Bit 76   Cherokee */
 #define TT_UCR_CHEROKEE                        (1L << 12) /* U+13A0-U+13FF */
   /* Bit 77   Unified Canadian Aboriginal Syllabics */
   /* Bit 76   Cherokee */
 #define TT_UCR_CHEROKEE                        (1L << 12) /* U+13A0-U+13FF */
   /* Bit 77   Unified Canadian Aboriginal Syllabics */
@@ -1047,20 +1083,22 @@ FT_BEGIN_HEADER
 #define TT_UCR_OGHAM                           (1L << 14) /* U+1680-U+169F */
   /* Bit 79   Runic */
 #define TT_UCR_RUNIC                           (1L << 15) /* U+16A0-U+16FF */
 #define TT_UCR_OGHAM                           (1L << 14) /* U+1680-U+169F */
   /* Bit 79   Runic */
 #define TT_UCR_RUNIC                           (1L << 15) /* U+16A0-U+16FF */
-  /* Bit 80   Khmer */
+  /* Bit 80   Khmer         */
+  /*          Khmer Symbols */
 #define TT_UCR_KHMER                           (1L << 16) /* U+1780-U+17FF */
 #define TT_UCR_KHMER                           (1L << 16) /* U+1780-U+17FF */
+                                                          /* U+19E0-U+19FF */
   /* Bit 81   Mongolian */
 #define TT_UCR_MONGOLIAN                       (1L << 17) /* U+1800-U+18AF */
   /* Bit 82   Braille Patterns */
 #define TT_UCR_BRAILLE                         (1L << 18) /* U+2800-U+28FF */
   /* Bit 81   Mongolian */
 #define TT_UCR_MONGOLIAN                       (1L << 17) /* U+1800-U+18AF */
   /* Bit 82   Braille Patterns */
 #define TT_UCR_BRAILLE                         (1L << 18) /* U+2800-U+28FF */
-  /* Bit 83   Yi Syllables */
-  /*          Yi Radicals    */
+  /* Bit 83   Yi Syllables */
+  /*          Yi Radicals  */
 #define TT_UCR_YI                              (1L << 19) /* U+A000-U+A48F */
                                                           /* U+A490-U+A4CF */
 #define TT_UCR_YI                              (1L << 19) /* U+A000-U+A48F */
                                                           /* U+A490-U+A4CF */
-  /* Bit 84   Tagalog  */
-  /*          Hanunoo  */
-  /*          Buhid    */
-  /*          Tagbanwa   */
+  /* Bit 84   Tagalog  */
+  /*          Hanunoo  */
+  /*          Buhid    */
+  /*          Tagbanwa */
 #define TT_UCR_PHILIPPINE                      (1L << 20) /* U+1700-U+171F */
                                                           /* U+1720-U+173F */
                                                           /* U+1740-U+175F */
 #define TT_UCR_PHILIPPINE                      (1L << 20) /* U+1700-U+171F */
                                                           /* U+1720-U+173F */
                                                           /* U+1740-U+175F */
@@ -1071,20 +1109,97 @@ FT_BEGIN_HEADER
 #define TT_UCR_GOTHIC                          (1L << 22) /*U+10330-U+1034F*/
   /* Bit 87   Deseret */
 #define TT_UCR_DESERET                         (1L << 23) /*U+10400-U+1044F*/
 #define TT_UCR_GOTHIC                          (1L << 22) /*U+10330-U+1034F*/
   /* Bit 87   Deseret */
 #define TT_UCR_DESERET                         (1L << 23) /*U+10400-U+1044F*/
-  /* Bit 88   Byzantine Musical Symbols + */
-  /*          Musical Symbols             */
+  /* Bit 88   Byzantine Musical Symbols      */
+  /*          Musical Symbols                */
+  /*          Ancient Greek Musical Notation */
 #define TT_UCR_MUSICAL_SYMBOLS                 (1L << 24) /*U+1D000-U+1D0FF*/
                                                           /*U+1D100-U+1D1FF*/
 #define TT_UCR_MUSICAL_SYMBOLS                 (1L << 24) /*U+1D000-U+1D0FF*/
                                                           /*U+1D100-U+1D1FF*/
+                                                          /*U+1D200-U+1D24F*/
   /* Bit 89   Mathematical Alphanumeric Symbols */
 #define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS       (1L << 25) /*U+1D400-U+1D7FF*/
   /* Bit 89   Mathematical Alphanumeric Symbols */
 #define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS       (1L << 25) /*U+1D400-U+1D7FF*/
-  /* Bit 90   Private Use (plane 15) */
-  /*          Private Use (plane 16)   */
+  /* Bit 90   Private Use (plane 15) */
+  /*          Private Use (plane 16) */
 #define TT_UCR_PRIVATE_USE_SUPPLEMENTARY       (1L << 26) /*U+F0000-U+FFFFD*/
                                                         /*U+100000-U+10FFFD*/
 #define TT_UCR_PRIVATE_USE_SUPPLEMENTARY       (1L << 26) /*U+F0000-U+FFFFD*/
                                                         /*U+100000-U+10FFFD*/
-  /* Bit 91   Variation Selectors */
+  /* Bit 91   Variation Selectors            */
+  /*          Variation Selectors Supplement */
 #define TT_UCR_VARIATION_SELECTORS             (1L << 27) /* U+FE00-U+FE0F */
 #define TT_UCR_VARIATION_SELECTORS             (1L << 27) /* U+FE00-U+FE0F */
+                                                          /*U+E0100-U+E01EF*/
   /* Bit 92   Tags */
 #define TT_UCR_TAGS                            (1L << 28) /*U+E0000-U+E007F*/
   /* Bit 92   Tags */
 #define TT_UCR_TAGS                            (1L << 28) /*U+E0000-U+E007F*/
+  /* Bit 93   Limbu */
+#define TT_UCR_LIMBU                           (1L << 29) /* U+1900-U+194F */
+  /* Bit 94   Tai Le */
+#define TT_UCR_TAI_LE                          (1L << 30) /* U+1950-U+197F */
+  /* Bit 95   New Tai Lue */
+#define TT_UCR_NEW_TAI_LUE                     (1L << 31) /* U+1980-U+19DF */
+  /* Bit 96   Buginese */
+#define TT_UCR_BUGINESE                        (1L <<  0) /* U+1A00-U+1A1F */
+  /* Bit 97   Glagolitic */
+#define TT_UCR_GLAGOLITIC                      (1L <<  1) /* U+2C00-U+2C5F */
+  /* Bit 98   Tifinagh */
+#define TT_UCR_TIFINAGH                        (1L <<  2) /* U+2D30-U+2D7F */
+  /* Bit 99   Yijing Hexagram Symbols */
+#define TT_UCR_YIJING                          (1L <<  3) /* U+4DC0-U+4DFF */
+  /* Bit 100  Syloti Nagri */
+#define TT_UCR_SYLOTI_NAGRI                    (1L <<  4) /* U+A800-U+A82F */
+  /* Bit 101  Linear B Syllabary */
+  /*          Linear B Ideograms */
+  /*          Aegean Numbers     */
+#define TT_UCR_LINEAR_B                        (1L <<  5) /*U+10000-U+1007F*/
+                                                          /*U+10080-U+100FF*/
+                                                          /*U+10100-U+1013F*/
+  /* Bit 102  Ancient Greek Numbers */
+#define TT_UCR_ANCIENT_GREEK_NUMBERS           (1L <<  6) /*U+10140-U+1018F*/
+  /* Bit 103  Ugaritic */
+#define TT_UCR_UGARITIC                        (1L <<  7) /*U+10380-U+1039F*/
+  /* Bit 104  Old Persian */
+#define TT_UCR_OLD_PERSIAN                     (1L <<  8) /*U+103A0-U+103DF*/
+  /* Bit 105  Shavian */
+#define TT_UCR_SHAVIAN                         (1L <<  9) /*U+10450-U+1047F*/
+  /* Bit 106  Osmanya */
+#define TT_UCR_OSMANYA                         (1L << 10) /*U+10480-U+104AF*/
+  /* Bit 107  Cypriot Syllabary */
+#define TT_UCR_CYPRIOT_SYLLABARY               (1L << 11) /*U+10800-U+1083F*/
+  /* Bit 108  Kharoshthi */
+#define TT_UCR_KHAROSHTHI                      (1L << 12) /*U+10A00-U+10A5F*/
+  /* Bit 109  Tai Xuan Jing Symbols */
+#define TT_UCR_TAI_XUAN_JING                   (1L << 13) /*U+1D300-U+1D35F*/
+  /* Bit 110  Cuneiform                         */
+  /*          Cuneiform Numbers and Punctuation */
+#define TT_UCR_CUNEIFORM                       (1L << 14) /*U+12000-U+123FF*/
+                                                          /*U+12400-U+1247F*/
+  /* Bit 111  Counting Rod Numerals */
+#define TT_UCR_COUNTING_ROD_NUMERALS           (1L << 15) /*U+1D360-U+1D37F*/
+  /* Bit 112  Sundanese */
+#define TT_UCR_SUNDANESE                       (1L << 16) /* U+1B80-U+1BBF */
+  /* Bit 113  Lepcha */
+#define TT_UCR_LEPCHA                          (1L << 17) /* U+1C00-U+1C4F */
+  /* Bit 114  Ol Chiki */
+#define TT_UCR_OL_CHIKI                        (1L << 18) /* U+1C50-U+1C7F */
+  /* Bit 115  Saurashtra */
+#define TT_UCR_SAURASHTRA                      (1L << 19) /* U+A880-U+A8DF */
+  /* Bit 116  Kayah Li */
+#define TT_UCR_KAYAH_LI                        (1L << 20) /* U+A900-U+A92F */
+  /* Bit 117  Rejang */
+#define TT_UCR_REJANG                          (1L << 21) /* U+A930-U+A95F */
+  /* Bit 118  Cham */
+#define TT_UCR_CHAM                            (1L << 22) /* U+AA00-U+AA5F */
+  /* Bit 119  Ancient Symbols */
+#define TT_UCR_ANCIENT_SYMBOLS                 (1L << 23) /*U+10190-U+101CF*/
+  /* Bit 120  Phaistos Disc */
+#define TT_UCR_PHAISTOS_DISC                   (1L << 24) /*U+101D0-U+101FF*/
+  /* Bit 121  Carian */
+  /*          Lycian */
+  /*          Lydian */
+#define TT_UCR_OLD_ANATOLIAN                   (1L << 25) /*U+102A0-U+102DF*/
+                                                          /*U+10280-U+1029F*/
+                                                          /*U+10920-U+1093F*/
+  /* Bit 122  Domino Tiles  */
+  /*          Mahjong Tiles */
+#define TT_UCR_GAME_TILES                      (1L << 26) /*U+1F030-U+1F09F*/
+                                                          /*U+1F000-U+1F02F*/
+  /* Bit 123-127 Reserved for process-internal usage */
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -1103,7 +1218,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* Here some alias #defines in order to be clearer.                      */
   /*                                                                       */
   /*                                                                       */
   /* Here some alias #defines in order to be clearer.                      */
   /*                                                                       */
-  /* These are not always #defined to stay within the 31 character limit   */
+  /* These are not always #defined to stay within the 31~character limit   */
   /* which some compilers have.                                            */
   /*                                                                       */
   /* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern  */
   /* which some compilers have.                                            */
   /*                                                                       */
   /* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern  */
index 43eca2e..c12b172 100644 (file)
@@ -5,7 +5,7 @@
 /*    Basic SFNT/TrueType tables definitions and interface                 */
 /*    (specification only).                                                */
 /*                                                                         */
 /*    Basic SFNT/TrueType tables definitions and interface                 */
 /*    (specification only).                                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -156,9 +156,9 @@ FT_BEGIN_HEADER
   /*    caret_Slope_Run        :: The run coefficient of the cursor's      */
   /*                              slope.                                   */
   /*                                                                       */
   /*    caret_Slope_Run        :: The run coefficient of the cursor's      */
   /*                              slope.                                   */
   /*                                                                       */
-  /*    Reserved               :: 10 reserved bytes.                       */
+  /*    Reserved               :: 8~reserved bytes.                        */
   /*                                                                       */
   /*                                                                       */
-  /*    metric_Data_Format     :: Always 0.                                */
+  /*    metric_Data_Format     :: Always~0.                                */
   /*                                                                       */
   /*    number_Of_HMetrics     :: Number of HMetrics entries in the `hmtx' */
   /*                              table -- this value can be smaller than  */
   /*                                                                       */
   /*    number_Of_HMetrics     :: Number of HMetrics entries in the `hmtx' */
   /*                              table -- this value can be smaller than  */
@@ -281,9 +281,9 @@ FT_BEGIN_HEADER
   /*                               This value is `reserved' in vmtx        */
   /*                               version 1.0.                            */
   /*                                                                       */
   /*                               This value is `reserved' in vmtx        */
   /*                               version 1.0.                            */
   /*                                                                       */
-  /*    Reserved                :: 8 reserved bytes.                       */
+  /*    Reserved                :: 8~reserved bytes.                       */
   /*                                                                       */
   /*                                                                       */
-  /*    metric_Data_Format      :: Always 0.                               */
+  /*    metric_Data_Format      :: Always~0.                               */
   /*                                                                       */
   /*    number_Of_HMetrics      :: Number of VMetrics entries in the       */
   /*                               `vmtx' table -- this value can be       */
   /*                                                                       */
   /*    number_Of_HMetrics      :: Number of VMetrics entries in the       */
   /*                               `vmtx' table -- this value can be       */
@@ -406,9 +406,9 @@ FT_BEGIN_HEADER
   /*    TT_Postscript                                                      */
   /*                                                                       */
   /* <Description>                                                         */
   /*    TT_Postscript                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A structure used to model a TrueType Postscript table.  All fields */
+  /*    A structure used to model a TrueType PostScript table.  All fields */
   /*    comply to the TrueType specification.  This structure does not     */
   /*    comply to the TrueType specification.  This structure does not     */
-  /*    reference the Postscript glyph names, which can be nevertheless    */
+  /*    reference the PostScript glyph names, which can be nevertheless    */
   /*    accessed with the `ttpost' module.                                 */
   /*                                                                       */
   typedef struct  TT_Postscript_
   /*    accessed with the `ttpost' module.                                 */
   /*                                                                       */
   typedef struct  TT_Postscript_
@@ -555,7 +555,7 @@ FT_BEGIN_HEADER
   /*    An enumeration used to specify the index of an SFNT table.         */
   /*    Used in the @FT_Get_Sfnt_Table API function.                       */
   /*                                                                       */
   /*    An enumeration used to specify the index of an SFNT table.         */
   /*    Used in the @FT_Get_Sfnt_Table API function.                       */
   /*                                                                       */
-  typedef enum
+  typedef enum  FT_Sfnt_Tag_
   {
     ft_sfnt_head = 0,
     ft_sfnt_maxp = 1,
   {
     ft_sfnt_head = 0,
     ft_sfnt_maxp = 1,
@@ -578,7 +578,7 @@ FT_BEGIN_HEADER
   /*    FT_Get_Sfnt_Table                                                  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Get_Sfnt_Table                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Returns a pointer to a given SFNT table within a face.             */
+  /*    Return a pointer to a given SFNT table within a face.              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A handle to the source.                                    */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A handle to the source.                                    */
@@ -586,7 +586,7 @@ FT_BEGIN_HEADER
   /*    tag  :: The index of the SFNT table.                               */
   /*                                                                       */
   /* <Return>                                                              */
   /*    tag  :: The index of the SFNT table.                               */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    A type-less pointer to the table.  This will be 0 in case of       */
+  /*    A type-less pointer to the table.  This will be~0 in case of       */
   /*    error, or if the corresponding table was not found *OR* loaded     */
   /*    from the file.                                                     */
   /*                                                                       */
   /*    error, or if the corresponding table was not found *OR* loaded     */
   /*    from the file.                                                     */
   /*                                                                       */
@@ -608,14 +608,14 @@ FT_BEGIN_HEADER
   *   FT_Load_Sfnt_Table
   *
   * @description:
   *   FT_Load_Sfnt_Table
   *
   * @description:
-  *   Loads any font table into client memory.
+  *   Load any font table into client memory.
   *
   * @input:
   *   face ::
   *     A handle to the source face.
   *
   *   tag ::
   *
   * @input:
   *   face ::
   *     A handle to the source face.
   *
   *   tag ::
-  *     The four-byte tag of the table to load.  Use the value 0 if you want
+  *     The four-byte tag of the table to load.  Use the value~0 if you want
   *     to access the whole font file.  Otherwise, you can use one of the
   *     definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new
   *     one with @FT_MAKE_TAG.
   *     to access the whole font file.  Otherwise, you can use one of the
   *     definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new
   *     one with @FT_MAKE_TAG.
@@ -633,18 +633,18 @@ FT_BEGIN_HEADER
   *     If the `length' parameter is NULL, then try to load the whole table.
   *     Return an error code if it fails.
   *
   *     If the `length' parameter is NULL, then try to load the whole table.
   *     Return an error code if it fails.
   *
-  *     Else, if `*length' is 0, exit immediately while returning the
+  *     Else, if `*length' is~0, exit immediately while returning the
   *     table's (or file) full size in it.
   *
   *     Else the number of bytes to read from the table or file, from the
   *     starting offset.
   *
   * @return:
   *     table's (or file) full size in it.
   *
   *     Else the number of bytes to read from the table or file, from the
   *     starting offset.
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *   If you need to determine the table's length you should first call this
   *
   * @note:
   *   If you need to determine the table's length you should first call this
-  *   function with `*length' set to 0, as in the following example:
+  *   function with `*length' set to~0, as in the following example:
   *
   *     {
   *       FT_ULong  length = 0;
   *
   *     {
   *       FT_ULong  length = 0;
@@ -674,7 +674,7 @@ FT_BEGIN_HEADER
   *   FT_Sfnt_Table_Info
   *
   * @description:
   *   FT_Sfnt_Table_Info
   *
   * @description:
-  *   Returns information on an SFNT table.
+  *   Return information on an SFNT table.
   *
   * @input:
   *   face ::
   *
   * @input:
   *   face ::
@@ -692,10 +692,10 @@ FT_BEGIN_HEADER
   *     The length of the SFNT table.
   *
   * @return:
   *     The length of the SFNT table.
   *
   * @return:
-  *   FreeType error code.  0 means success.
+  *   FreeType error code.  0~means success.
   *
   * @note:
   *
   * @note:
-  *   SFNT tables with length zero are treated as missing by Windows.
+  *   SFNT tables with length zero are treated as missing.
   *
   */
   FT_EXPORT( FT_Error )
   *
   */
   FT_EXPORT( FT_Error )
@@ -720,7 +720,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Return>                                                              */
   /*    The language ID of `charmap'.  If `charmap' doesn't belong to a    */
   /*                                                                       */
   /* <Return>                                                              */
   /*    The language ID of `charmap'.  If `charmap' doesn't belong to a    */
-  /*    TrueType/sfnt face, just return 0 as the default value.            */
+  /*    TrueType/sfnt face, just return~0 as the default value.            */
   /*                                                                       */
   FT_EXPORT( FT_ULong )
   FT_Get_CMap_Language_ID( FT_CharMap  charmap );
   /*                                                                       */
   FT_EXPORT( FT_ULong )
   FT_Get_CMap_Language_ID( FT_CharMap  charmap );
index e10244c..307ce4b 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Tags for TrueType and OpenType tables (specification only).          */
 /*                                                                         */
 /*                                                                         */
 /*    Tags for TrueType and OpenType tables (specification only).          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2004, 2005 by                                     */
+/*  Copyright 1996-2001, 2004, 2005, 2007, 2008 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -41,6 +41,7 @@ FT_BEGIN_HEADER
 #define TTAG_bloc  FT_MAKE_TAG( 'b', 'l', 'o', 'c' )
 #define TTAG_bsln  FT_MAKE_TAG( 'b', 's', 'l', 'n' )
 #define TTAG_CFF   FT_MAKE_TAG( 'C', 'F', 'F', ' ' )
 #define TTAG_bloc  FT_MAKE_TAG( 'b', 'l', 'o', 'c' )
 #define TTAG_bsln  FT_MAKE_TAG( 'b', 's', 'l', 'n' )
 #define TTAG_CFF   FT_MAKE_TAG( 'C', 'F', 'F', ' ' )
+#define TTAG_CID   FT_MAKE_TAG( 'C', 'I', 'D', ' ' )
 #define TTAG_cmap  FT_MAKE_TAG( 'c', 'm', 'a', 'p' )
 #define TTAG_cvar  FT_MAKE_TAG( 'c', 'v', 'a', 'r' )
 #define TTAG_cvt   FT_MAKE_TAG( 'c', 'v', 't', ' ' )
 #define TTAG_cmap  FT_MAKE_TAG( 'c', 'm', 'a', 'p' )
 #define TTAG_cvar  FT_MAKE_TAG( 'c', 'v', 'a', 'r' )
 #define TTAG_cvt   FT_MAKE_TAG( 'c', 'v', 't', ' ' )
@@ -49,6 +50,7 @@ FT_BEGIN_HEADER
 #define TTAG_EBLC  FT_MAKE_TAG( 'E', 'B', 'L', 'C' )
 #define TTAG_EBSC  FT_MAKE_TAG( 'E', 'B', 'S', 'C' )
 #define TTAG_feat  FT_MAKE_TAG( 'f', 'e', 'a', 't' )
 #define TTAG_EBLC  FT_MAKE_TAG( 'E', 'B', 'L', 'C' )
 #define TTAG_EBSC  FT_MAKE_TAG( 'E', 'B', 'S', 'C' )
 #define TTAG_feat  FT_MAKE_TAG( 'f', 'e', 'a', 't' )
+#define TTAG_FOND  FT_MAKE_TAG( 'F', 'O', 'N', 'D' )
 #define TTAG_fpgm  FT_MAKE_TAG( 'f', 'p', 'g', 'm' )
 #define TTAG_fvar  FT_MAKE_TAG( 'f', 'v', 'a', 'r' )
 #define TTAG_gasp  FT_MAKE_TAG( 'g', 'a', 's', 'p' )
 #define TTAG_fpgm  FT_MAKE_TAG( 'f', 'p', 'g', 'm' )
 #define TTAG_fvar  FT_MAKE_TAG( 'f', 'v', 'a', 'r' )
 #define TTAG_gasp  FT_MAKE_TAG( 'g', 'a', 's', 'p' )
@@ -67,6 +69,8 @@ FT_BEGIN_HEADER
 #define TTAG_lcar  FT_MAKE_TAG( 'l', 'c', 'a', 'r' )
 #define TTAG_loca  FT_MAKE_TAG( 'l', 'o', 'c', 'a' )
 #define TTAG_LTSH  FT_MAKE_TAG( 'L', 'T', 'S', 'H' )
 #define TTAG_lcar  FT_MAKE_TAG( 'l', 'c', 'a', 'r' )
 #define TTAG_loca  FT_MAKE_TAG( 'l', 'o', 'c', 'a' )
 #define TTAG_LTSH  FT_MAKE_TAG( 'L', 'T', 'S', 'H' )
+#define TTAG_LWFN  FT_MAKE_TAG( 'L', 'W', 'F', 'N' )
+#define TTAG_MATH  FT_MAKE_TAG( 'M', 'A', 'T', 'H' )
 #define TTAG_maxp  FT_MAKE_TAG( 'm', 'a', 'x', 'p' )
 #define TTAG_META  FT_MAKE_TAG( 'M', 'E', 'T', 'A' )
 #define TTAG_MMFX  FT_MAKE_TAG( 'M', 'M', 'F', 'X' )
 #define TTAG_maxp  FT_MAKE_TAG( 'm', 'a', 'x', 'p' )
 #define TTAG_META  FT_MAKE_TAG( 'M', 'E', 'T', 'A' )
 #define TTAG_MMFX  FT_MAKE_TAG( 'M', 'M', 'F', 'X' )
@@ -78,14 +82,18 @@ FT_BEGIN_HEADER
 #define TTAG_OS2   FT_MAKE_TAG( 'O', 'S', '/', '2' )
 #define TTAG_OTTO  FT_MAKE_TAG( 'O', 'T', 'T', 'O' )
 #define TTAG_PCLT  FT_MAKE_TAG( 'P', 'C', 'L', 'T' )
 #define TTAG_OS2   FT_MAKE_TAG( 'O', 'S', '/', '2' )
 #define TTAG_OTTO  FT_MAKE_TAG( 'O', 'T', 'T', 'O' )
 #define TTAG_PCLT  FT_MAKE_TAG( 'P', 'C', 'L', 'T' )
+#define TTAG_POST  FT_MAKE_TAG( 'P', 'O', 'S', 'T' )
 #define TTAG_post  FT_MAKE_TAG( 'p', 'o', 's', 't' )
 #define TTAG_prep  FT_MAKE_TAG( 'p', 'r', 'e', 'p' )
 #define TTAG_prop  FT_MAKE_TAG( 'p', 'r', 'o', 'p' )
 #define TTAG_post  FT_MAKE_TAG( 'p', 'o', 's', 't' )
 #define TTAG_prep  FT_MAKE_TAG( 'p', 'r', 'e', 'p' )
 #define TTAG_prop  FT_MAKE_TAG( 'p', 'r', 'o', 'p' )
+#define TTAG_sfnt  FT_MAKE_TAG( 's', 'f', 'n', 't' )
 #define TTAG_SING  FT_MAKE_TAG( 'S', 'I', 'N', 'G' )
 #define TTAG_trak  FT_MAKE_TAG( 't', 'r', 'a', 'k' )
 #define TTAG_true  FT_MAKE_TAG( 't', 'r', 'u', 'e' )
 #define TTAG_ttc   FT_MAKE_TAG( 't', 't', 'c', ' ' )
 #define TTAG_ttcf  FT_MAKE_TAG( 't', 't', 'c', 'f' )
 #define TTAG_SING  FT_MAKE_TAG( 'S', 'I', 'N', 'G' )
 #define TTAG_trak  FT_MAKE_TAG( 't', 'r', 'a', 'k' )
 #define TTAG_true  FT_MAKE_TAG( 't', 'r', 'u', 'e' )
 #define TTAG_ttc   FT_MAKE_TAG( 't', 't', 'c', ' ' )
 #define TTAG_ttcf  FT_MAKE_TAG( 't', 't', 'c', 'f' )
+#define TTAG_TYP1  FT_MAKE_TAG( 'T', 'Y', 'P', '1' )
+#define TTAG_typ1  FT_MAKE_TAG( 't', 'y', 'p', '1' )
 #define TTAG_VDMX  FT_MAKE_TAG( 'V', 'D', 'M', 'X' )
 #define TTAG_vhea  FT_MAKE_TAG( 'v', 'h', 'e', 'a' )
 #define TTAG_vmtx  FT_MAKE_TAG( 'v', 'm', 't', 'x' )
 #define TTAG_VDMX  FT_MAKE_TAG( 'V', 'D', 'M', 'X' )
 #define TTAG_vhea  FT_MAKE_TAG( 'v', 'h', 'e', 'a' )
 #define TTAG_vmtx  FT_MAKE_TAG( 'v', 'm', 't', 'x' )
index 6d8a95e..4047d7f 100644 (file)
@@ -1,6 +1,6 @@
 # modules.cfg
 #
 # modules.cfg
 #
-# Copyright 2005, 2006, 2007 by
+# Copyright 2005, 2006, 2007, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -106,7 +106,7 @@ RASTER_MODULES += smooth
 
 # FreeType's cache sub-system (quite stable but still in beta -- this means
 # that its public API is subject to change if necessary).  See
 
 # FreeType's cache sub-system (quite stable but still in beta -- this means
 # that its public API is subject to change if necessary).  See
-# include/freetype/ftcache.h.
+# include/freetype/ftcache.h.  Needs ftglyph.c.
 AUX_MODULES += cache
 
 # TrueType GX/AAT table validation.  Needs ftgxval.c below.
 AUX_MODULES += cache
 
 # TrueType GX/AAT table validation.  Needs ftgxval.c below.
@@ -158,37 +158,62 @@ BASE_EXTENSIONS += ftbdf.c
 # See include/freetype/ftbitmap.h for the API.
 BASE_EXTENSIONS += ftbitmap.c
 
 # See include/freetype/ftbitmap.h for the API.
 BASE_EXTENSIONS += ftbitmap.c
 
-# Convenience functions to handle glyphs.
+# Access CID font information.
+#
+# See include/freetype/ftcid.h for the API.
+BASE_EXTENSIONS += ftcid.c
+
+# Access FSType information.  Needs fttype1.c.
+#
+# See include/freetype/freetype.h for the API.
+BASE_EXTENSIONS += ftfstype.c
+
+# Support for GASP table queries.
+#
+# See include/freetype/ftgasp.h for the API.
+BASE_EXTENSIONS += ftgasp.c
+
+# Convenience functions to handle glyphs.  Needs ftbitmap.c.
 #
 # See include/freetype/ftglyph.h for the API.
 BASE_EXTENSIONS += ftglyph.c
 
 #
 # See include/freetype/ftglyph.h for the API.
 BASE_EXTENSIONS += ftglyph.c
 
-# Interface for gxvalid module (which is required).
+# Interface for gxvalid module.
 #
 # See include/freetype/ftgxval.h for the API.
 BASE_EXTENSIONS += ftgxval.c
 
 #
 # See include/freetype/ftgxval.h for the API.
 BASE_EXTENSIONS += ftgxval.c
 
+# Support for LCD color filtering of subpixel bitmaps.
+#
+# See include/freetype/ftlcdfil.h for the API.
+BASE_EXTENSIONS += ftlcdfil.c
+
 # Multiple Master font interface.
 #
 # See include/freetype/ftmm.h for the API.
 BASE_EXTENSIONS += ftmm.c
 
 # Multiple Master font interface.
 #
 # See include/freetype/ftmm.h for the API.
 BASE_EXTENSIONS += ftmm.c
 
-# Interface for otvalid module (which is required).
+# Interface for otvalid module.
 #
 # See include/freetype/ftotval.h for the API.
 BASE_EXTENSIONS += ftotval.c
 
 #
 # See include/freetype/ftotval.h for the API.
 BASE_EXTENSIONS += ftotval.c
 
+# Support for FT_Face_CheckTrueTypePatents.
+#
+# See include/freetype/freetype.h for the API.
+BASE_EXTENSIONS += ftpatent.c
+
 # Interface for accessing PFR-specific data.  Needs PFR font driver.
 #
 # See include/freetype/ftpfr.h for the API.
 BASE_EXTENSIONS += ftpfr.c
 
 # Interface for accessing PFR-specific data.  Needs PFR font driver.
 #
 # See include/freetype/ftpfr.h for the API.
 BASE_EXTENSIONS += ftpfr.c
 
-# Path stroker.
+# Path stroker.  Needs ftglyph.c.
 #
 # See include/freetype/ftstroke.h for the API.
 BASE_EXTENSIONS += ftstroke.c
 
 #
 # See include/freetype/ftstroke.h for the API.
 BASE_EXTENSIONS += ftstroke.c
 
-# Support for synthetic embolding and slanting of fonts.
+# Support for synthetic embolding and slanting of fonts.  Needs ftbitmap.c.
 #
 # See include/freetype/ftsynth.h for the API.
 BASE_EXTENSIONS += ftsynth.c
 #
 # See include/freetype/ftsynth.h for the API.
 BASE_EXTENSIONS += ftsynth.c
@@ -210,21 +235,6 @@ BASE_EXTENSIONS += ftwinfnt.c
 # See include/freetype/ftxf86.h for the API.
 BASE_EXTENSIONS += ftxf86.c
 
 # See include/freetype/ftxf86.h for the API.
 BASE_EXTENSIONS += ftxf86.c
 
-# Support for LCD color filtering of subpixel bitmaps.
-#
-# See include/freetype/ftlcdfil.h for the API.
-BASE_EXTENSIONS += ftlcdfil.c
-
-# Support for GASP table queries.
-#
-# See include/freetype/ftgasp.h for the API.
-BASE_EXTENSIONS += ftgasp.c
-
-# Support for FT_Face_CheckTrueTypePatents.
-#
-# See include/freetype.h for the API.
-BASE_EXTENSIONS += ftpatent.c
-
 ####
 #### The components `ftsystem.c' (for memory allocation and stream I/O
 #### management) and `ftdebug.c' (for emitting debug messages to the user)
 ####
 #### The components `ftsystem.c' (for memory allocation and stream I/O
 #### management) and `ftdebug.c' (for emitting debug messages to the user)
index acee8bf..2714765 100644 (file)
@@ -1,6 +1,6 @@
 # FreeType 2 src/autofit Jamfile
 #
 # FreeType 2 src/autofit Jamfile
 #
-# Copyright 2003, 2004, 2005, 2006, 2007 by
+# Copyright 2003, 2004, 2005, 2006, 2007, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -14,14 +14,14 @@ SubDir FT2_TOP src autofit ;
 {
   local  _sources ;
 
 {
   local  _sources ;
 
-  # define FT2_AUTOFIT2 do enable to experimental latin hinter replacement
+  # define FT2_AUTOFIT2 to enable experimental latin hinter replacement
   if $(FT2_AUTOFIT2)
   {
     DEFINES += FT_OPTION_AUTOFIT2 ;
   }
   if $(FT2_MULTI)
   {
   if $(FT2_AUTOFIT2)
   {
     DEFINES += FT_OPTION_AUTOFIT2 ;
   }
   if $(FT2_MULTI)
   {
-    _sources = afangles afglobal afhints aflatin afcjk afindic afloader afmodule afdummy afwarp ;
+    _sources = afangles afglobal afhints aflatin afcjk afindic afloader afmodule afdummy afwarp afpic ;
 
     if $(FT2_AUTOFIT2)
     {
 
     if $(FT2_AUTOFIT2)
     {
index c7ca266..bab0c42 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines for CJK script (body).                  */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter hinting routines for CJK script (body).                  */
 /*                                                                         */
-/*  Copyright 2006, 2007 by                                                */
+/*  Copyright 2006, 2007, 2008, 2009 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -45,7 +45,7 @@
   /*************************************************************************/
   /*************************************************************************/
 
   /*************************************************************************/
   /*************************************************************************/
 
-  static FT_Error
+  FT_LOCAL_DEF( FT_Error )
   af_cjk_metrics_init( AF_LatinMetrics  metrics,
                        FT_Face          face )
   {
   af_cjk_metrics_init( AF_LatinMetrics  metrics,
                        FT_Face          face )
   {
 
     if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
       face->charmap = NULL;
 
     if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
       face->charmap = NULL;
-
-    /* latin's version would suffice */
-    af_latin_metrics_init_widths( metrics, face, 0x7530 );
+    else
+    {
+      /* latin's version would suffice */
+      af_latin_metrics_init_widths( metrics, face, 0x7530 );
+      af_latin_metrics_check_digits( metrics, face );
+    }
 
     FT_Set_Charmap( face, oldmap );
 
 
     FT_Set_Charmap( face, oldmap );
 
@@ -91,7 +94,7 @@
   }
 
 
   }
 
 
-  static void
+  FT_LOCAL_DEF( void )
   af_cjk_metrics_scale( AF_LatinMetrics  metrics,
                         AF_Scaler        scaler )
   {
   af_cjk_metrics_scale( AF_LatinMetrics  metrics,
                         AF_Scaler        scaler )
   {
 
         /* insert a new edge in the list and */
         /* sort according to the position    */
 
         /* insert a new edge in the list and */
         /* sort according to the position    */
-        error = af_axis_hints_new_edge( axis, seg->pos, seg->dir, memory, &edge );
+        error = af_axis_hints_new_edge( axis, seg->pos,
+                                        (AF_Direction)seg->dir,
+                                        memory, &edge );
         if ( error )
           goto Exit;
 
         if ( error )
           goto Exit;
 
   }
 
 
   }
 
 
-  static FT_Error
+  FT_LOCAL_DEF( FT_Error )
   af_cjk_hints_init( AF_GlyphHints    hints,
                      AF_LatinMetrics  metrics )
   {
   af_cjk_hints_init( AF_GlyphHints    hints,
                      AF_LatinMetrics  metrics )
   {
     AF_AxisHints  axis       = &hints->axis[dim];
     AF_Edge       edges      = axis->edges;
     AF_Edge       edge_limit = edges + axis->num_edges;
     AF_AxisHints  axis       = &hints->axis[dim];
     AF_Edge       edges      = axis->edges;
     AF_Edge       edge_limit = edges + axis->num_edges;
-    FT_Int        n_edges;
+    FT_PtrDist    n_edges;
     AF_Edge       edge;
     AF_Edge       anchor   = 0;
     FT_Pos        delta    = 0;
     AF_Edge       edge;
     AF_Edge       anchor   = 0;
     FT_Pos        delta    = 0;
         else if ( after >= edge_limit )
           af_cjk_align_serif_edge( hints, before, edge );
         else
         else if ( after >= edge_limit )
           af_cjk_align_serif_edge( hints, before, edge );
         else
-          edge->pos = before->pos +
-            FT_MulDiv( edge->fpos - before->fpos,
-                       after->pos - before->pos,
-                       after->fpos - before->fpos );
+        {
+          if ( after->fpos == before->fpos )
+            edge->pos = before->pos;
+          else
+            edge->pos = before->pos +
+                        FT_MulDiv( edge->fpos - before->fpos,
+                                   after->pos - before->pos,
+                                   after->fpos - before->fpos );
+        }
       }
     }
   }
       }
     }
   }
   }
 
 
   }
 
 
-  static FT_Error
+  FT_LOCAL_DEF( FT_Error )
   af_cjk_hints_apply( AF_GlyphHints    hints,
                       FT_Outline*      outline,
                       AF_LatinMetrics  metrics )
   af_cjk_hints_apply( AF_GlyphHints    hints,
                       FT_Outline*      outline,
                       AF_LatinMetrics  metrics )
   static const AF_Script_UniRangeRec  af_cjk_uniranges[] =
   {
 #if 0
   static const AF_Script_UniRangeRec  af_cjk_uniranges[] =
   {
 #if 0
-    { 0x0100,  0xFFFF },  /* why this? */
+    AF_UNIRANGE_REC(  0x0100UL,  0xFFFFUL ),  /* why this? */
 #endif
 #endif
-    { 0x2E80,  0x2EFF },  /* CJK Radicals Supplement */
-    { 0x2F00,  0x2FDF },  /* Kangxi Radicals */
-    { 0x3000,  0x303F },  /* CJK Symbols and Punctuation */
-    { 0x3040,  0x309F },  /* Hiragana */
-    { 0x30A0,  0x30FF },  /* Katakana */
-    { 0x3100,  0x312F },  /* Bopomofo */
-    { 0x3130,  0x318F },  /* Hangul Compatibility Jamo */
-    { 0x31A0,  0x31BF },  /* Bopomofo Extended */
-    { 0x31C0,  0x31EF },  /* CJK Strokes */
-    { 0x31F0,  0x31FF },  /* Katakana Phonetic Extensions */
-    { 0x3200,  0x32FF },  /* Enclosed CJK Letters and Months */
-    { 0x3300,  0x33FF },  /* CJK Compatibility */
-    { 0x3400,  0x4DBF },  /* CJK Unified Ideographs Extension A */
-    { 0x4DC0,  0x4DFF },  /* Yijing Hexagram Symbols */
-    { 0x4E00,  0x9FFF },  /* CJK Unified Ideographs */
-    { 0xF900,  0xFAFF },  /* CJK Compatibility Ideographs */
-    { 0xFE30,  0xFE4F },  /* CJK Compatibility Forms */
-    { 0xFF00,  0xFFEF },  /* Halfwidth and Fullwidth Forms */
-    { 0x20000, 0x2A6DF }, /* CJK Unified Ideographs Extension B */
-    { 0x2F800, 0x2FA1F }, /* CJK Compatibility Ideographs Supplement */
-    { 0,       0 }
+    AF_UNIRANGE_REC(  0x2E80UL,  0x2EFFUL ),  /* CJK Radicals Supplement                 */
+    AF_UNIRANGE_REC(  0x2F00UL,  0x2FDFUL ),  /* Kangxi Radicals                         */
+    AF_UNIRANGE_REC(  0x3000UL,  0x303FUL ),  /* CJK Symbols and Punctuation             */
+    AF_UNIRANGE_REC(  0x3040UL,  0x309FUL ),  /* Hiragana                                */
+    AF_UNIRANGE_REC(  0x30A0UL,  0x30FFUL ),  /* Katakana                                */
+    AF_UNIRANGE_REC(  0x3100UL,  0x312FUL ),  /* Bopomofo                                */
+    AF_UNIRANGE_REC(  0x3130UL,  0x318FUL ),  /* Hangul Compatibility Jamo               */
+    AF_UNIRANGE_REC(  0x31A0UL,  0x31BFUL ),  /* Bopomofo Extended                       */
+    AF_UNIRANGE_REC(  0x31C0UL,  0x31EFUL ),  /* CJK Strokes                             */
+    AF_UNIRANGE_REC(  0x31F0UL,  0x31FFUL ),  /* Katakana Phonetic Extensions            */
+    AF_UNIRANGE_REC(  0x3200UL,  0x32FFUL ),  /* Enclosed CJK Letters and Months         */
+    AF_UNIRANGE_REC(  0x3300UL,  0x33FFUL ),  /* CJK Compatibility                       */
+    AF_UNIRANGE_REC(  0x3400UL,  0x4DBFUL ),  /* CJK Unified Ideographs Extension A      */
+    AF_UNIRANGE_REC(  0x4DC0UL,  0x4DFFUL ),  /* Yijing Hexagram Symbols                 */
+    AF_UNIRANGE_REC(  0x4E00UL,  0x9FFFUL ),  /* CJK Unified Ideographs                  */
+    AF_UNIRANGE_REC(  0xF900UL,  0xFAFFUL ),  /* CJK Compatibility Ideographs            */
+    AF_UNIRANGE_REC(  0xFE30UL,  0xFE4FUL ),  /* CJK Compatibility Forms                 */
+    AF_UNIRANGE_REC(  0xFF00UL,  0xFFEFUL ),  /* Halfwidth and Fullwidth Forms           */
+    AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ),  /* CJK Unified Ideographs Extension B      */
+    AF_UNIRANGE_REC( 0x2F800UL, 0x2FA1FUL ),  /* CJK Compatibility Ideographs Supplement */
+    AF_UNIRANGE_REC(       0UL,       0UL )
   };
 
 
   };
 
 
-  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec
-  af_cjk_script_class =
-  {
+  AF_DEFINE_SCRIPT_CLASS(af_cjk_script_class,
     AF_SCRIPT_CJK,
     af_cjk_uniranges,
 
     AF_SCRIPT_CJK,
     af_cjk_uniranges,
 
 
     (AF_Script_InitHintsFunc)   af_cjk_hints_init,
     (AF_Script_ApplyHintsFunc)  af_cjk_hints_apply
 
     (AF_Script_InitHintsFunc)   af_cjk_hints_init,
     (AF_Script_ApplyHintsFunc)  af_cjk_hints_apply
-  };
+  )
 
 #else /* !AF_CONFIG_OPTION_CJK */
 
   static const AF_Script_UniRangeRec  af_cjk_uniranges[] =
   {
 
 #else /* !AF_CONFIG_OPTION_CJK */
 
   static const AF_Script_UniRangeRec  af_cjk_uniranges[] =
   {
-    { 0, 0 }
+    AF_UNIRANGE_REC( 0UL, 0UL )
   };
 
 
   };
 
 
-  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec
-  af_cjk_script_class =
-  {
+  AF_DEFINE_SCRIPT_CLASS(af_cjk_script_class,
     AF_SCRIPT_CJK,
     af_cjk_uniranges,
 
     AF_SCRIPT_CJK,
     af_cjk_uniranges,
 
 
     (AF_Script_InitHintsFunc)   NULL,
     (AF_Script_ApplyHintsFunc)  NULL
 
     (AF_Script_InitHintsFunc)   NULL,
     (AF_Script_ApplyHintsFunc)  NULL
-  };
+  )
 
 #endif /* !AF_CONFIG_OPTION_CJK */
 
 
 #endif /* !AF_CONFIG_OPTION_CJK */
 
index 0de4a5a..0b20d4a 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines for CJK script (specification).         */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter hinting routines for CJK script (specification).         */
 /*                                                                         */
-/*  Copyright 2006 by                                                      */
+/*  Copyright 2006, 2007 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -27,10 +27,26 @@ FT_BEGIN_HEADER
 
   /* the CJK-specific script class */
 
 
   /* the CJK-specific script class */
 
-  FT_CALLBACK_TABLE const AF_ScriptClassRec
-  af_cjk_script_class;
+  AF_DECLARE_SCRIPT_CLASS(af_cjk_script_class)
 
 
 
 
+  FT_LOCAL( FT_Error )
+  af_cjk_metrics_init( AF_LatinMetrics  metrics,
+                       FT_Face          face );
+
+  FT_LOCAL( void )
+  af_cjk_metrics_scale( AF_LatinMetrics  metrics,
+                        AF_Scaler        scaler );
+
+  FT_LOCAL( FT_Error )
+  af_cjk_hints_init( AF_GlyphHints    hints,
+                     AF_LatinMetrics  metrics );
+
+  FT_LOCAL( FT_Error )
+  af_cjk_hints_apply( AF_GlyphHints    hints,
+                      FT_Outline*      outline,
+                      AF_LatinMetrics  metrics );
+
 /* */
 
 FT_END_HEADER
 /* */
 
 FT_END_HEADER
index ed96e96..42b2fcb 100644 (file)
@@ -42,9 +42,7 @@
   }
 
 
   }
 
 
-  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec
-  af_dummy_script_class =
-  {
+  AF_DEFINE_SCRIPT_CLASS(af_dummy_script_class,
     AF_SCRIPT_NONE,
     NULL,
 
     AF_SCRIPT_NONE,
     NULL,
 
@@ -56,7 +54,7 @@
 
     (AF_Script_InitHintsFunc)   af_dummy_hints_init,
     (AF_Script_ApplyHintsFunc)  af_dummy_hints_apply
 
     (AF_Script_InitHintsFunc)   af_dummy_hints_init,
     (AF_Script_ApplyHintsFunc)  af_dummy_hints_apply
-  };
+  )
 
 
 /* END */
 
 
 /* END */
index 2a5faf8..b69ef43 100644 (file)
@@ -29,8 +29,7 @@ FT_BEGIN_HEADER
   *  be performed.  This is the default for non-latin glyphs!
   */
 
   *  be performed.  This is the default for non-latin glyphs!
   */
 
-  FT_CALLBACK_TABLE const AF_ScriptClassRec
-  af_dummy_script_class;
+  AF_DECLARE_SCRIPT_CLASS(af_dummy_script_class)
 
 /* */
 
 
 /* */
 
index 1875f52..ac29361 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter routines to compute global hinting values (body).        */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter routines to compute global hinting values (body).        */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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 "aflatin.h"
 #include "afcjk.h"
 #include "afindic.h"
 #include "aflatin.h"
 #include "afcjk.h"
 #include "afindic.h"
+#include "afpic.h"
 
 #include "aferrors.h"
 
 
 #include "aferrors.h"
 
 #include "aflatin2.h"
 #endif
 
 #include "aflatin2.h"
 #endif
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+/* when updating this table, don't forget to update 
+  AF_SCRIPT_CLASSES_COUNT and autofit_module_class_pic_init */
+
   /* populate this list when you add new scripts */
   static AF_ScriptClass const  af_script_classes[] =
   {
   /* populate this list when you add new scripts */
   static AF_ScriptClass const  af_script_classes[] =
   {
 #endif
     &af_latin_script_class,
     &af_cjk_script_class,
 #endif
     &af_latin_script_class,
     &af_cjk_script_class,
-    &af_indic_script_class,
+    &af_indic_script_class, 
     NULL  /* do not remove */
   };
 
     NULL  /* do not remove */
   };
 
+#endif /* FT_CONFIG_OPTION_PIC */
+
   /* index of default script in `af_script_classes' */
 #define AF_SCRIPT_LIST_DEFAULT  2
   /* index of default script in `af_script_classes' */
 #define AF_SCRIPT_LIST_DEFAULT  2
-  /* indicates an uncovered glyph                   */
-#define AF_SCRIPT_LIST_NONE   255
+  /* a bit mask indicating an uncovered glyph       */
+#define AF_SCRIPT_LIST_NONE     0x7F
+  /* if this flag is set, we have an ASCII digit    */
+#define AF_DIGIT                0x80
 
 
   /*
 
 
   /*
@@ -55,7 +65,7 @@
   typedef struct  AF_FaceGlobalsRec_
   {
     FT_Face           face;
   typedef struct  AF_FaceGlobalsRec_
   {
     FT_Face           face;
-    FT_UInt           glyph_count;    /* same as face->num_glyphs */
+    FT_Long           glyph_count;    /* same as face->num_glyphs */
     FT_Byte*          glyph_scripts;
 
     AF_ScriptMetrics  metrics[AF_SCRIPT_MAX];
     FT_Byte*          glyph_scripts;
 
     AF_ScriptMetrics  metrics[AF_SCRIPT_MAX];
@@ -72,7 +82,7 @@
     FT_Face     face        = globals->face;
     FT_CharMap  old_charmap = face->charmap;
     FT_Byte*    gscripts    = globals->glyph_scripts;
     FT_Face     face        = globals->face;
     FT_CharMap  old_charmap = face->charmap;
     FT_Byte*    gscripts    = globals->glyph_scripts;
-    FT_UInt     ss;
+    FT_UInt     ss, i;
 
 
     /* the value 255 means `uncovered glyph' */
 
 
     /* the value 255 means `uncovered glyph' */
     if ( error )
     {
      /*
     if ( error )
     {
      /*
-      *  Ignore this error; we simply use Latin as the standard
-      *  script.  XXX: Shouldn't we rather disable hinting?
+      *  Ignore this error; we simply use the default script.
+      *  XXX: Shouldn't we rather disable hinting?
       */
       error = AF_Err_Ok;
       goto Exit;
     }
 
     /* scan each script in a Unicode charmap */
       */
       error = AF_Err_Ok;
       goto Exit;
     }
 
     /* scan each script in a Unicode charmap */
-    for ( ss = 0; af_script_classes[ss]; ss++ )
+    for ( ss = 0; AF_SCRIPT_CLASSES_GET[ss]; ss++ )
     {
     {
-      AF_ScriptClass      clazz = af_script_classes[ss];
+      AF_ScriptClass      clazz = AF_SCRIPT_CLASSES_GET[ss];
       AF_Script_UniRange  range;
 
 
       AF_Script_UniRange  range;
 
 
         gindex = FT_Get_Char_Index( face, charcode );
 
         if ( gindex != 0                             &&
         gindex = FT_Get_Char_Index( face, charcode );
 
         if ( gindex != 0                             &&
-             gindex < globals->glyph_count           &&
+             gindex < (FT_ULong)globals->glyph_count &&
              gscripts[gindex] == AF_SCRIPT_LIST_NONE )
         {
           gscripts[gindex] = (FT_Byte)ss;
              gscripts[gindex] == AF_SCRIPT_LIST_NONE )
         {
           gscripts[gindex] = (FT_Byte)ss;
           if ( gindex == 0 || charcode > range->last )
             break;
 
           if ( gindex == 0 || charcode > range->last )
             break;
 
-          if ( gindex < globals->glyph_count           &&
+          if ( gindex < (FT_ULong)globals->glyph_count &&
                gscripts[gindex] == AF_SCRIPT_LIST_NONE )
           {
             gscripts[gindex] = (FT_Byte)ss;
                gscripts[gindex] == AF_SCRIPT_LIST_NONE )
           {
             gscripts[gindex] = (FT_Byte)ss;
       }
     }
 
       }
     }
 
+    /* mark ASCII digits */
+    for ( i = 0x30; i <= 0x39; i++ )
+    {
+      FT_UInt  gindex = FT_Get_Char_Index( face, i );
+
+
+      if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count )
+        gscripts[gindex] |= AF_DIGIT;
+    }
+
   Exit:
     /*
      *  By default, all uncovered glyphs are set to the latin script.
      *  XXX: Shouldn't we disable hinting or do something similar?
      */
     {
   Exit:
     /*
      *  By default, all uncovered glyphs are set to the latin script.
      *  XXX: Shouldn't we disable hinting or do something similar?
      */
     {
-      FT_UInt  nn;
+      FT_Long  nn;
 
 
       for ( nn = 0; nn < globals->glyph_count; nn++ )
 
 
       for ( nn = 0; nn < globals->glyph_count; nn++ )
       {
         if ( globals->metrics[nn] )
         {
       {
         if ( globals->metrics[nn] )
         {
-          AF_ScriptClass  clazz = af_script_classes[nn];
+          AF_ScriptClass  clazz = AF_SCRIPT_CLASSES_GET[nn];
 
 
           FT_ASSERT( globals->metrics[nn]->clazz == clazz );
 
 
           FT_ASSERT( globals->metrics[nn]->clazz == clazz );
     FT_UInt           gidx;
     AF_ScriptClass    clazz;
     FT_UInt           script     = options & 15;
     FT_UInt           gidx;
     AF_ScriptClass    clazz;
     FT_UInt           script     = options & 15;
-    const FT_UInt     script_max = sizeof ( af_script_classes ) /
-                                     sizeof ( af_script_classes[0] );
+    const FT_Offset   script_max = sizeof ( AF_SCRIPT_CLASSES_GET ) /
+                                     sizeof ( AF_SCRIPT_CLASSES_GET[0] );
     FT_Error          error      = AF_Err_Ok;
 
 
     FT_Error          error      = AF_Err_Ok;
 
 
-    if ( gindex >= globals->glyph_count )
+    if ( gindex >= (FT_ULong)globals->glyph_count )
     {
       error = AF_Err_Invalid_Argument;
       goto Exit;
     {
       error = AF_Err_Invalid_Argument;
       goto Exit;
 
     gidx = script;
     if ( gidx == 0 || gidx + 1 >= script_max )
 
     gidx = script;
     if ( gidx == 0 || gidx + 1 >= script_max )
-      gidx = globals->glyph_scripts[gindex];
+      gidx = globals->glyph_scripts[gindex] & AF_SCRIPT_LIST_NONE;
 
 
-    clazz = af_script_classes[gidx];
+    clazz = AF_SCRIPT_CLASSES_GET[gidx];
     if ( script == 0 )
       script = clazz->script;
 
     if ( script == 0 )
       script = clazz->script;
 
   }
 
 
   }
 
 
+  FT_LOCAL_DEF( FT_Bool )
+  af_face_globals_is_digit( AF_FaceGlobals  globals,
+                            FT_UInt         gindex )
+  {
+    if ( gindex < (FT_ULong)globals->glyph_count )
+      return (FT_Bool)( globals->glyph_scripts[gindex] & AF_DIGIT );
+
+    return (FT_Bool)0;
+  }
+
+
 /* END */
 /* END */
index cf52c08..2a68e19 100644 (file)
@@ -5,7 +5,7 @@
 /*    Auto-fitter routines to compute global hinting values                */
 /*    (specification).                                                     */
 /*                                                                         */
 /*    Auto-fitter routines to compute global hinting values                */
 /*    (specification).                                                     */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2007 by                                    */
+/*  Copyright 2003, 2004, 2005, 2007, 2009 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -56,7 +56,11 @@ FT_BEGIN_HEADER
   FT_LOCAL( void )
   af_face_globals_free( AF_FaceGlobals  globals );
 
   FT_LOCAL( void )
   af_face_globals_free( AF_FaceGlobals  globals );
 
- /* */
+  FT_LOCAL_DEF( FT_Bool )
+  af_face_globals_is_digit( AF_FaceGlobals  globals,
+                            FT_UInt         gindex );
+
+  /* */
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
index 4828706..fe38fba 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines (body).                                 */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter hinting routines (body).                                 */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2009 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -34,7 +34,7 @@
     {
       FT_Int  old_max = axis->max_segments;
       FT_Int  new_max = old_max;
     {
       FT_Int  old_max = axis->max_segments;
       FT_Int  new_max = old_max;
-      FT_Int  big_max = FT_INT_MAX / sizeof ( *segment );
+      FT_Int  big_max = (FT_Int)( FT_INT_MAX / sizeof ( *segment ) );
 
 
       if ( old_max >= big_max )
 
 
       if ( old_max >= big_max )
@@ -77,7 +77,7 @@
     {
       FT_Int  old_max = axis->max_edges;
       FT_Int  new_max = old_max;
     {
       FT_Int  old_max = axis->max_edges;
       FT_Int  new_max = old_max;
-      FT_Int  big_max = FT_INT_MAX / sizeof ( *edge );
+      FT_Int  big_max = (FT_Int)( FT_INT_MAX / sizeof ( *edge ) );
 
 
       if ( old_max >= big_max )
 
 
       if ( old_max >= big_max )
 
 #ifdef AF_DEBUG
 
 
 #ifdef AF_DEBUG
 
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
 
   static const char*
   af_dir_str( AF_Direction  dir )
 
   static const char*
   af_dir_str( AF_Direction  dir )
 
     if ( flags & AF_EDGE_ROUND )
     {
 
     if ( flags & AF_EDGE_ROUND )
     {
-      memcpy( temp + pos, "round", 5 );
+      ft_memcpy( temp + pos, "round", 5 );
       pos += 5;
     }
     if ( flags & AF_EDGE_SERIF )
     {
       if ( pos > 0 )
         temp[pos++] = ' ';
       pos += 5;
     }
     if ( flags & AF_EDGE_SERIF )
     {
       if ( pos > 0 )
         temp[pos++] = ' ';
-      memcpy( temp + pos, "serif", 5 );
+      ft_memcpy( temp + pos, "serif", 5 );
       pos += 5;
     }
     if ( pos == 0 )
       pos += 5;
     }
     if ( pos == 0 )
         FT_Int      contour_index = 0;
 
 
         FT_Int      contour_index = 0;
 
 
+        FT_UNUSED( first );
         for ( point = points; point < point_limit; point++, vec++, tag++ )
         {
           point->fx = (FT_Short)vec->x;
         for ( point = points; point < point_limit; point++, vec++, tag++ )
         {
           point->fx = (FT_Short)vec->x;
         }
 
         {
         }
 
         {
-          FT_UInt  min, max, mid;
-          FT_Pos   fpos;
+          FT_PtrDist  min, max, mid;
+          FT_Pos      fpos;
 
 
           /* find enclosing edges */
 
 
           /* find enclosing edges */
           /* for small edge counts, a linear search is better */
           if ( max <= 8 )
           {
           /* for small edge counts, a linear search is better */
           if ( max <= 8 )
           {
-            FT_UInt  nn;
+            FT_PtrDist  nn;
 
             for ( nn = 0; nn < max; nn++ )
               if ( edges[nn].fpos >= u )
 
             for ( nn = 0; nn < max; nn++ )
               if ( edges[nn].fpos >= u )
index 49e88d1..6758268 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines (specification).                        */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter hinting routines (specification).                        */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2008 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -30,7 +30,7 @@ FT_BEGIN_HEADER
   *  script analysis routines (until now).
   */
 
   *  script analysis routines (until now).
   */
 
-  typedef enum
+  typedef enum  AF_Dimension_
   {
     AF_DIMENSION_HORZ = 0,  /* x coordinates,                    */
                             /* i.e., vertical segments & edges   */
   {
     AF_DIMENSION_HORZ = 0,  /* x coordinates,                    */
                             /* i.e., vertical segments & edges   */
@@ -44,7 +44,7 @@ FT_BEGIN_HEADER
 
   /* hint directions -- the values are computed so that two vectors are */
   /* in opposite directions iff `dir1 + dir2 == 0'                      */
 
   /* hint directions -- the values are computed so that two vectors are */
   /* in opposite directions iff `dir1 + dir2 == 0'                      */
-  typedef enum
+  typedef enum  AF_Direction_
   {
     AF_DIR_NONE  =  4,
     AF_DIR_RIGHT =  1,
   {
     AF_DIR_NONE  =  4,
     AF_DIR_RIGHT =  1,
@@ -56,7 +56,7 @@ FT_BEGIN_HEADER
 
 
   /* point hint flags */
 
 
   /* point hint flags */
-  typedef enum
+  typedef enum  AF_Flags_
   {
     AF_FLAG_NONE = 0,
 
   {
     AF_FLAG_NONE = 0,
 
@@ -87,7 +87,7 @@ FT_BEGIN_HEADER
 
 
   /* edge hint flags */
 
 
   /* edge hint flags */
-  typedef enum
+  typedef enum  AF_Edge_Flags_
   {
     AF_EDGE_NORMAL = 0,
     AF_EDGE_ROUND  = 1 << 0,
   {
     AF_EDGE_NORMAL = 0,
     AF_EDGE_ROUND  = 1 << 0,
@@ -214,7 +214,7 @@ FT_BEGIN_HEADER
 
     FT_Pos            xmin_delta;    /* used for warping */
     FT_Pos            xmax_delta;
 
     FT_Pos            xmin_delta;    /* used for warping */
     FT_Pos            xmax_delta;
-
+    
   } AF_GlyphHintsRec;
 
 
   } AF_GlyphHintsRec;
 
 
index c6e7522..1d9e9ea 100644 (file)
@@ -43,7 +43,7 @@
 
   static void
   af_indic_metrics_scale( AF_LatinMetrics  metrics,
 
   static void
   af_indic_metrics_scale( AF_LatinMetrics  metrics,
-                         AF_Scaler        scaler )
+                          AF_Scaler        scaler )
   {
     /* use CJK routines */
     af_cjk_metrics_scale( metrics, scaler );
   {
     /* use CJK routines */
     af_cjk_metrics_scale( metrics, scaler );
@@ -52,7 +52,7 @@
 
   static FT_Error
   af_indic_hints_init( AF_GlyphHints    hints,
 
   static FT_Error
   af_indic_hints_init( AF_GlyphHints    hints,
-                      AF_LatinMetrics  metrics )
+                       AF_LatinMetrics  metrics )
   {
     /* use CJK routines */
     return af_cjk_hints_init( hints, metrics );
   {
     /* use CJK routines */
     return af_cjk_hints_init( hints, metrics );
@@ -61,8 +61,8 @@
 
   static FT_Error
   af_indic_hints_apply( AF_GlyphHints    hints,
 
   static FT_Error
   af_indic_hints_apply( AF_GlyphHints    hints,
-                       FT_Outline*      outline,
-                       AF_LatinMetrics  metrics)
+                        FT_Outline*      outline,
+                        AF_LatinMetrics  metrics)
   {
     /* use CJK routines */
     return af_cjk_hints_apply( hints, outline, metrics );
   {
     /* use CJK routines */
     return af_cjk_hints_apply( hints, outline, metrics );
   static const AF_Script_UniRangeRec  af_indic_uniranges[] =
   {
 #if 0
   static const AF_Script_UniRangeRec  af_indic_uniranges[] =
   {
 #if 0
-    { 0x0100,  0xFFFF },  /* why this? */
+    AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ),  /* why this? */
 #endif
 #endif
-    { 0x0900, 0x0DFF},    /* Indic Range */
-    { 0,       0 }
+    AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL),    /* Indic Range */
+    AF_UNIRANGE_REC(      0UL,      0UL)
   };
 
 
   };
 
 
-  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec
-  af_indic_script_class =
-  {
+  AF_DEFINE_SCRIPT_CLASS(af_indic_script_class,
     AF_SCRIPT_INDIC,
     af_indic_uniranges,
 
     AF_SCRIPT_INDIC,
     af_indic_uniranges,
 
 
     (AF_Script_InitHintsFunc)   af_indic_hints_init,
     (AF_Script_ApplyHintsFunc)  af_indic_hints_apply
 
     (AF_Script_InitHintsFunc)   af_indic_hints_init,
     (AF_Script_ApplyHintsFunc)  af_indic_hints_apply
-  };
+  )
 
 #else /* !AF_CONFIG_OPTION_INDIC */
 
 
 #else /* !AF_CONFIG_OPTION_INDIC */
 
   };
 
 
   };
 
 
-  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec
-  af_indic_script_class =
-  {
+  AF_DEFINE_SCRIPT_CLASS(af_indic_script_class,
     AF_SCRIPT_INDIC,
     af_indic_uniranges,
 
     AF_SCRIPT_INDIC,
     af_indic_uniranges,
 
 
     (AF_Script_InitHintsFunc)   NULL,
     (AF_Script_ApplyHintsFunc)  NULL
 
     (AF_Script_InitHintsFunc)   NULL,
     (AF_Script_ApplyHintsFunc)  NULL
-  };
+  )
 
 #endif /* !AF_CONFIG_OPTION_INDIC */
 
 
 #endif /* !AF_CONFIG_OPTION_INDIC */
 
index b242b26..662a982 100644 (file)
@@ -27,8 +27,7 @@ FT_BEGIN_HEADER
 
   /* the Indic-specific script class */
 
 
   /* the Indic-specific script class */
 
-  FT_CALLBACK_TABLE const AF_ScriptClassRec
-  af_indic_script_class;
+  AF_DECLARE_SCRIPT_CLASS(af_indic_script_class)
 
 
 /* */
 
 
 /* */
index 52e952d..394fb97 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines for latin script (body).                */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter hinting routines for latin script (body).                */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -16,6 +16,9 @@
 /***************************************************************************/
 
 
 /***************************************************************************/
 
 
+#include <ft2build.h>
+#include FT_ADVANCES_H
+
 #include "aflatin.h"
 #include "aferrors.h"
 
 #include "aflatin.h"
 #include "aferrors.h"
 
 #define AF_LATIN_MAX_TEST_CHARACTERS  12
 
 
 #define AF_LATIN_MAX_TEST_CHARACTERS  12
 
 
-  static const char* const  af_latin_blue_chars[AF_LATIN_MAX_BLUES] =
+  static const char af_latin_blue_chars[AF_LATIN_MAX_BLUES]
+                                       [AF_LATIN_MAX_TEST_CHARACTERS + 1] =
   {
     "THEZOCQS",
     "HEZLOCUS",
   {
     "THEZOCQS",
     "HEZLOCUS",
       for ( ; p < limit && *p; p++ )
       {
         FT_UInt     glyph_index;
       for ( ; p < limit && *p; p++ )
       {
         FT_UInt     glyph_index;
-        FT_Int      best_point, best_y, best_first, best_last;
+        FT_Pos      best_y; /* same as points.y */
+        FT_Int      best_point, best_first, best_last;
         FT_Vector*  points;
         FT_Bool     round = 0;
 
         FT_Vector*  points;
         FT_Bool     round = 0;
 
          *  we couldn't find a single glyph to compute this blue zone,
          *  we will simply ignore it then
          */
          *  we couldn't find a single glyph to compute this blue zone,
          *  we will simply ignore it then
          */
-        AF_LOG(( "empty!\n" ));
+        AF_LOG(( "empty\n" ));
         continue;
       }
 
         continue;
       }
 
         blue->flags |= AF_LATIN_BLUE_TOP;
 
       /*
         blue->flags |= AF_LATIN_BLUE_TOP;
 
       /*
-       * The following flags is used later to adjust the y and x scales
+       * The following flag is used later to adjust the y and x scales
        * in order to optimize the pixel grid alignment of the top of small
        * letters.
        */
        * in order to optimize the pixel grid alignment of the top of small
        * letters.
        */
   }
 
 
   }
 
 
+  FT_LOCAL_DEF( void )
+  af_latin_metrics_check_digits( AF_LatinMetrics  metrics,
+                                 FT_Face          face )
+  {
+    FT_UInt  i;
+    FT_Bool  started = 0, same_width = 1;
+
+
+    /* check whether all ASCII digits have the same advance width; */
+    /* digit `0' is 0x30 in all supported charmaps                 */
+    for ( i = 0x30; i <= 0x39; i++ )
+    {
+      FT_UInt   glyph_index;
+      FT_Fixed  advance, old_advance = 0;
+
+
+      glyph_index = FT_Get_Char_Index( face, i );
+      if ( glyph_index == 0 )
+        continue;
+
+      if ( FT_Get_Advance( face, glyph_index,
+                           FT_LOAD_NO_SCALE         |
+                           FT_LOAD_NO_HINTING       |
+                           FT_LOAD_IGNORE_TRANSFORM,
+                           &advance ) )
+        continue;
+
+      if ( started )
+      {
+        if ( advance != old_advance )
+        {
+          same_width = 0;
+          break;
+        }
+      }
+      else
+      {
+        old_advance = advance;
+        started     = 1;
+      }
+    }
+
+    metrics->root.digits_have_same_width = same_width;
+  }
+
+
   FT_LOCAL_DEF( FT_Error )
   af_latin_metrics_init( AF_LatinMetrics  metrics,
                          FT_Face          face )
   FT_LOCAL_DEF( FT_Error )
   af_latin_metrics_init( AF_LatinMetrics  metrics,
                          FT_Face          face )
       /* For now, compute the standard width and height from the `o'. */
       af_latin_metrics_init_widths( metrics, face, 'o' );
       af_latin_metrics_init_blues( metrics, face );
       /* For now, compute the standard width and height from the `o'. */
       af_latin_metrics_init_widths( metrics, face, 'o' );
       af_latin_metrics_init_blues( metrics, face );
+      af_latin_metrics_check_digits( metrics, face );
     }
 
     FT_Set_Charmap( face, oldmap );
     }
 
     FT_Set_Charmap( face, oldmap );
 
       if ( !found )
       {
 
       if ( !found )
       {
-        AF_Edge   edge;
+        AF_Edge  edge;
 
 
         /* insert a new edge in the list and */
         /* sort according to the position    */
 
 
         /* insert a new edge in the list and */
         /* sort according to the position    */
-        error = af_axis_hints_new_edge( axis, seg->pos, seg->dir, memory, &edge );
+        error = af_axis_hints_new_edge( axis, seg->pos,
+                                        (AF_Direction)seg->dir,
+                                        memory, &edge );
         if ( error )
           goto Exit;
 
         if ( error )
           goto Exit;
 
             /* not hinted, appear a lot bolder or thinner than the    */
             /* vertical stems.                                        */
 
             /* not hinted, appear a lot bolder or thinner than the    */
             /* vertical stems.                                        */
 
-            FT_Int  delta;
+            FT_Pos  delta;
 
 
             dist = ( dist + 22 ) & ~63;
 
 
             dist = ( dist + 22 ) & ~63;
     AF_AxisHints  axis       = &hints->axis[dim];
     AF_Edge       edges      = axis->edges;
     AF_Edge       edge_limit = edges + axis->num_edges;
     AF_AxisHints  axis       = &hints->axis[dim];
     AF_Edge       edges      = axis->edges;
     AF_Edge       edge_limit = edges + axis->num_edges;
-    FT_Int        n_edges;
+    FT_PtrDist    n_edges;
     AF_Edge       edge;
     AF_Edge       anchor     = 0;
     FT_Int        has_serifs = 0;
     AF_Edge       edge;
     AF_Edge       anchor     = 0;
     FT_Int        has_serifs = 0;
           if ( before >= edges && before < edge   &&
                after < edge_limit && after > edge )
           {
           if ( before >= edges && before < edge   &&
                after < edge_limit && after > edge )
           {
-            edge->pos = before->pos +
+            if ( after->opos == before->opos )
+              edge->pos = before->pos;
+            else
+              edge->pos = before->pos +
                           FT_MulDiv( edge->opos - before->opos,
                                      after->pos - before->pos,
                                      after->opos - before->opos );
                           FT_MulDiv( edge->opos - before->opos,
                                      after->pos - before->pos,
                                      after->opos - before->opos );
 
   static const AF_Script_UniRangeRec  af_latin_uniranges[] =
   {
 
   static const AF_Script_UniRangeRec  af_latin_uniranges[] =
   {
-    { 0x0020, 0x007F },  /* Basic Latin (no control characters) */
-    { 0x00A0, 0x00FF },  /* Latin-1 Supplement (no control characters) */
-    { 0x0100, 0x017F },  /* Latin Extended-A */
-    { 0x0180, 0x024F },  /* Latin Extended-B */
-    { 0x0250, 0x02AF },  /* IPA Extensions */
-    { 0x02B0, 0x02FF },  /* Spacing Modifier Letters */
-    { 0x0300, 0x036F },  /* Combining Diacritical Marks */
-    { 0x0370, 0x03FF },  /* Greek and Coptic */
-    { 0x0400, 0x04FF },  /* Cyrillic */
-    { 0x0500, 0x052F },  /* Cyrillic Supplement */
-    { 0x1D00, 0x1D7F },  /* Phonetic Extensions */
-    { 0x1D80, 0x1DBF },  /* Phonetic Extensions Supplement */
-    { 0x1DC0, 0x1DFF },  /* Combining Diacritical Marks Supplement */
-    { 0x1E00, 0x1EFF },  /* Latin Extended Additional */
-    { 0x1F00, 0x1FFF },  /* Greek Extended */
-    { 0x2000, 0x206F },  /* General Punctuation */
-    { 0x2070, 0x209F },  /* Superscripts and Subscripts */
-    { 0x20A0, 0x20CF },  /* Currency Symbols */
-    { 0x2150, 0x218F },  /* Number Forms */
-    { 0x2460, 0x24FF },  /* Enclosed Alphanumerics */
-    { 0     , 0      }
+    AF_UNIRANGE_REC(  0x0020UL,  0x007FUL ),  /* Basic Latin (no control chars) */
+    AF_UNIRANGE_REC(  0x00A0UL,  0x00FFUL ),  /* Latin-1 Supplement (no control chars) */
+    AF_UNIRANGE_REC(  0x0100UL,  0x017FUL ),  /* Latin Extended-A */
+    AF_UNIRANGE_REC(  0x0180UL,  0x024FUL ),  /* Latin Extended-B */
+    AF_UNIRANGE_REC(  0x0250UL,  0x02AFUL ),  /* IPA Extensions */
+    AF_UNIRANGE_REC(  0x02B0UL,  0x02FFUL ),  /* Spacing Modifier Letters */
+    AF_UNIRANGE_REC(  0x0300UL,  0x036FUL ),  /* Combining Diacritical Marks */
+    AF_UNIRANGE_REC(  0x0370UL,  0x03FFUL ),  /* Greek and Coptic */
+    AF_UNIRANGE_REC(  0x0400UL,  0x04FFUL ),  /* Cyrillic */
+    AF_UNIRANGE_REC(  0x0500UL,  0x052FUL ),  /* Cyrillic Supplement */
+    AF_UNIRANGE_REC(  0x1D00UL,  0x1D7FUL ),  /* Phonetic Extensions */
+    AF_UNIRANGE_REC(  0x1D80UL,  0x1DBFUL ),  /* Phonetic Extensions Supplement */
+    AF_UNIRANGE_REC(  0x1DC0UL,  0x1DFFUL ),  /* Combining Diacritical Marks Supplement */
+    AF_UNIRANGE_REC(  0x1E00UL,  0x1EFFUL ),  /* Latin Extended Additional */
+    AF_UNIRANGE_REC(  0x1F00UL,  0x1FFFUL ),  /* Greek Extended */
+    AF_UNIRANGE_REC(  0x2000UL,  0x206FUL ),  /* General Punctuation */
+    AF_UNIRANGE_REC(  0x2070UL,  0x209FUL ),  /* Superscripts and Subscripts */
+    AF_UNIRANGE_REC(  0x20A0UL,  0x20CFUL ),  /* Currency Symbols */
+    AF_UNIRANGE_REC(  0x2150UL,  0x218FUL ),  /* Number Forms */
+    AF_UNIRANGE_REC(  0x2460UL,  0x24FFUL ),  /* Enclosed Alphanumerics */
+    AF_UNIRANGE_REC(  0x2C60UL,  0x2C7FUL ),  /* Latin Extended-C */
+    AF_UNIRANGE_REC(  0x2DE0UL,  0x2DFFUL ),  /* Cyrillic Extended-A */
+    AF_UNIRANGE_REC(  0xA640UL,  0xA69FUL ),  /* Cyrillic Extended-B */
+    AF_UNIRANGE_REC(  0xA720UL,  0xA7FFUL ),  /* Latin Extended-D */
+    AF_UNIRANGE_REC(  0xFB00UL,  0xFB06UL ),  /* Alphab. Present. Forms (Latin Ligs) */
+    AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ),  /* Mathematical Alphanumeric Symbols */
+    AF_UNIRANGE_REC(       0UL,       0UL )
   };
 
 
   };
 
 
-  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec
-  af_latin_script_class =
-  {
+  AF_DEFINE_SCRIPT_CLASS(af_latin_script_class,  
     AF_SCRIPT_LATIN,
     af_latin_uniranges,
 
     AF_SCRIPT_LATIN,
     af_latin_uniranges,
 
 
     (AF_Script_InitHintsFunc)   af_latin_hints_init,
     (AF_Script_ApplyHintsFunc)  af_latin_hints_apply
 
     (AF_Script_InitHintsFunc)   af_latin_hints_init,
     (AF_Script_ApplyHintsFunc)  af_latin_hints_apply
-  };
+  )
 
 
 /* END */
 
 
 /* END */
index 3251d37..660b10c 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines for latin script (specification).       */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter hinting routines for latin script (specification).       */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2009 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -27,8 +27,7 @@ FT_BEGIN_HEADER
 
   /* the latin-specific script class */
 
 
   /* the latin-specific script class */
 
-  FT_CALLBACK_TABLE const AF_ScriptClassRec
-  af_latin_script_class;
+  AF_DECLARE_SCRIPT_CLASS(af_latin_script_class)
 
 
 /* constants are given with units_per_em == 2048 in mind */
 
 
 /* constants are given with units_per_em == 2048 in mind */
@@ -138,6 +137,10 @@ FT_BEGIN_HEADER
                                 FT_Face          face,
                                 FT_ULong         charcode );
 
                                 FT_Face          face,
                                 FT_ULong         charcode );
 
+  FT_LOCAL( void )
+  af_latin_metrics_check_digits( AF_LatinMetrics  metrics,
+                                 FT_Face          face );
+
 
   /*************************************************************************/
   /*************************************************************************/
 
   /*************************************************************************/
   /*************************************************************************/
index 0b41774..5e2ad48 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines for latin script (body).                */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter hinting routines for latin script (body).                */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -16,6 +16,8 @@
 /***************************************************************************/
 
 
 /***************************************************************************/
 
 
+#include FT_ADVANCES_H
+
 #include "aflatin.h"
 #include "aflatin2.h"
 #include "aferrors.h"
 #include "aflatin.h"
 #include "aflatin2.h"
 #include "aferrors.h"
 #define AF_LATIN_MAX_TEST_CHARACTERS  12
 
 
 #define AF_LATIN_MAX_TEST_CHARACTERS  12
 
 
-  static const char* const  af_latin2_blue_chars[AF_LATIN_MAX_BLUES] =
+  static const char af_latin2_blue_chars[AF_LATIN_MAX_BLUES][AF_LATIN_MAX_TEST_CHARACTERS+1] =
   {
     "THEZOCQS",
     "HEZLOCUS",
   {
     "THEZOCQS",
     "HEZLOCUS",
          *  we couldn't find a single glyph to compute this blue zone,
          *  we will simply ignore it then
          */
          *  we couldn't find a single glyph to compute this blue zone,
          *  we will simply ignore it then
          */
-        AF_LOG(( "empty!\n" ));
+        AF_LOG(( "empty\n" ));
         continue;
       }
 
         continue;
       }
 
   }
 
 
   }
 
 
+  FT_LOCAL_DEF( void )
+  af_latin2_metrics_check_digits( AF_LatinMetrics  metrics,
+                                  FT_Face          face )
+  {
+    FT_UInt  i;
+    FT_Bool  started = 0, same_width = 1;
+
+
+    /* check whether all ASCII digits have the same advance width; */
+    /* digit `0' is 0x30 in all supported charmaps                 */
+    for ( i = 0x30; i <= 0x39; i++ )
+    {
+      FT_UInt   glyph_index;
+      FT_Fixed  advance, old_advance;
+
+
+      glyph_index = FT_Get_Char_Index( face, i );
+      if ( glyph_index == 0 )
+        continue;
+
+      if ( FT_Get_Advance( face, glyph_index,
+                           FT_LOAD_NO_SCALE         |
+                           FT_LOAD_NO_HINTING       |
+                           FT_LOAD_IGNORE_TRANSFORM,
+                           &advance ) )
+        continue;
+
+      if ( started )
+      {
+        if ( advance != old_advance )
+        {
+          same_width = 0;
+          break;
+        }
+      }
+      else
+      {
+        old_advance = advance;
+        started     = 1;
+      }
+    }
+
+    metrics->root.digits_have_same_width = same_width;
+  }
+
+
   FT_LOCAL_DEF( FT_Error )
   af_latin2_metrics_init( AF_LatinMetrics  metrics,
                          FT_Face          face )
   FT_LOCAL_DEF( FT_Error )
   af_latin2_metrics_init( AF_LatinMetrics  metrics,
                          FT_Face          face )
       /* For now, compute the standard width and height from the `o'. */
       af_latin2_metrics_init_widths( metrics, face, 'o' );
       af_latin2_metrics_init_blues( metrics, face );
       /* For now, compute the standard width and height from the `o'. */
       af_latin2_metrics_init_widths( metrics, face, 'o' );
       af_latin2_metrics_init_blues( metrics, face );
+      af_latin2_metrics_check_digits( metrics, face );
     }
 
     FT_Set_Charmap( face, oldmap );
     }
 
     FT_Set_Charmap( face, oldmap );
           }
         }
     }
           }
         }
     }
+#if 0
+    }
+#endif
 
     /* now, compute the `serif' segments */
     for ( seg1 = segments; seg1 < segment_limit; seg1++ )
 
     /* now, compute the `serif' segments */
     for ( seg1 = segments; seg1 < segment_limit; seg1++ )
     AF_AxisHints  axis       = &hints->axis[dim];
     AF_Edge       edges      = axis->edges;
     AF_Edge       edge_limit = edges + axis->num_edges;
     AF_AxisHints  axis       = &hints->axis[dim];
     AF_Edge       edges      = axis->edges;
     AF_Edge       edge_limit = edges + axis->num_edges;
-    FT_Int        n_edges;
     AF_Edge       edge;
     AF_Edge       anchor     = 0;
     FT_Int        has_serifs = 0;
     AF_Edge       edge;
     AF_Edge       anchor     = 0;
     FT_Int        has_serifs = 0;
     /* We don't handle horizontal edges since we can't easily assure that */
     /* the third (lowest) stem aligns with the base line; it might end up */
     /* one pixel higher or lower.                                         */
     /* We don't handle horizontal edges since we can't easily assure that */
     /* the third (lowest) stem aligns with the base line; it might end up */
     /* one pixel higher or lower.                                         */
+
 #if 0
 #if 0
-    n_edges = edge_limit - edges;
-    if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) )
     {
     {
-      AF_Edge  edge1, edge2, edge3;
-      FT_Pos   dist1, dist2, span, delta;
+      FT_Int  n_edges = edge_limit - edges;
 
 
 
 
-      if ( n_edges == 6 )
+      if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) )
       {
       {
-        edge1 = edges;
-        edge2 = edges + 2;
-        edge3 = edges + 4;
-      }
-      else
-      {
-        edge1 = edges + 1;
-        edge2 = edges + 5;
-        edge3 = edges + 9;
-      }
+        AF_Edge  edge1, edge2, edge3;
+        FT_Pos   dist1, dist2, span, delta;
 
 
-      dist1 = edge2->opos - edge1->opos;
-      dist2 = edge3->opos - edge2->opos;
 
 
-      span = dist1 - dist2;
-      if ( span < 0 )
-        span = -span;
+        if ( n_edges == 6 )
+        {
+          edge1 = edges;
+          edge2 = edges + 2;
+          edge3 = edges + 4;
+        }
+        else
+        {
+          edge1 = edges + 1;
+          edge2 = edges + 5;
+          edge3 = edges + 9;
+        }
 
 
-      if ( span < 8 )
-      {
-        delta = edge3->pos - ( 2 * edge2->pos - edge1->pos );
-        edge3->pos -= delta;
-        if ( edge3->link )
-          edge3->link->pos -= delta;
+        dist1 = edge2->opos - edge1->opos;
+        dist2 = edge3->opos - edge2->opos;
+
+        span = dist1 - dist2;
+        if ( span < 0 )
+          span = -span;
 
 
-        /* move the serifs along with the stem */
-        if ( n_edges == 12 )
+        if ( span < 8 )
         {
         {
-          ( edges + 8 )->pos -= delta;
-          ( edges + 11 )->pos -= delta;
-        }
+          delta = edge3->pos - ( 2 * edge2->pos - edge1->pos );
+          edge3->pos -= delta;
+          if ( edge3->link )
+            edge3->link->pos -= delta;
+
+          /* move the serifs along with the stem */
+          if ( n_edges == 12 )
+          {
+            ( edges + 8 )->pos -= delta;
+            ( edges + 11 )->pos -= delta;
+          }
 
 
-        edge3->flags |= AF_EDGE_DONE;
-        if ( edge3->link )
-          edge3->link->flags |= AF_EDGE_DONE;
+          edge3->flags |= AF_EDGE_DONE;
+          if ( edge3->link )
+            edge3->link->flags |= AF_EDGE_DONE;
+        }
       }
     }
 #endif
       }
     }
 #endif
+
     if ( has_serifs || !anchor )
     {
       /*
     if ( has_serifs || !anchor )
     {
       /*
           if ( before >= edges && before < edge   &&
                after < edge_limit && after > edge )
           {
           if ( before >= edges && before < edge   &&
                after < edge_limit && after > edge )
           {
-            edge->pos = before->pos +
+            if ( after->opos == before->opos )
+              edge->pos = before->pos;
+            else
+              edge->pos = before->pos +
                           FT_MulDiv( edge->opos - before->opos,
                                      after->pos - before->pos,
                                      after->opos - before->opos );
                           FT_MulDiv( edge->opos - before->opos,
                                      after->pos - before->pos,
                                      after->opos - before->opos );
 
   static const AF_Script_UniRangeRec  af_latin2_uniranges[] =
   {
 
   static const AF_Script_UniRangeRec  af_latin2_uniranges[] =
   {
-    { 32,  127 },    /* XXX: TODO: Add new Unicode ranges here! */
-    { 160, 255 },
-    { 0,   0 }
+    AF_UNIRANGE_REC( 32UL,  127UL ),    /* XXX: TODO: Add new Unicode ranges here! */
+    AF_UNIRANGE_REC( 160UL, 255UL ),
+    AF_UNIRANGE_REC( 0UL,   0UL )
   };
 
 
   };
 
 
-  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec
-  af_latin2_script_class =
-  {
+  AF_DEFINE_SCRIPT_CLASS(af_latin2_script_class,
     AF_SCRIPT_LATIN2,
     af_latin2_uniranges,
 
     AF_SCRIPT_LATIN2,
     af_latin2_uniranges,
 
 
     (AF_Script_InitHintsFunc)   af_latin2_hints_init,
     (AF_Script_ApplyHintsFunc)  af_latin2_hints_apply
 
     (AF_Script_InitHintsFunc)   af_latin2_hints_init,
     (AF_Script_ApplyHintsFunc)  af_latin2_hints_apply
-  };
+  )
 
 
 /* END */
 
 
 /* END */
index 34eda05..925c621 100644 (file)
@@ -27,8 +27,7 @@ FT_BEGIN_HEADER
 
   /* the latin-specific script class */
 
 
   /* the latin-specific script class */
 
-  FT_CALLBACK_TABLE const AF_ScriptClassRec
-  af_latin2_script_class;
+  AF_DECLARE_SCRIPT_CLASS(af_latin2_script_class)
 
 /* */
 
 
 /* */
 
index 4e4373a..6dd9f2a 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter glyph loading routines (body).                           */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter glyph loading routines (body).                           */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,7 +19,6 @@
 #include "afloader.h"
 #include "afhints.h"
 #include "afglobal.h"
 #include "afloader.h"
 #include "afhints.h"
 #include "afglobal.h"
-#include "aflatin.h"
 #include "aferrors.h"
 
 
 #include "aferrors.h"
 
 
 
       /* now load the slot image into the auto-outline and run the */
       /* automatic hinting process                                 */
 
       /* now load the slot image into the auto-outline and run the */
       /* automatic hinting process                                 */
-      metrics->clazz->script_hints_apply( hints,
-                                          &gloader->current.outline,
-                                          metrics );
+      if ( metrics->clazz->script_hints_apply )
+        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 occurred during the hinting process */
 
       /* we now need to hint the metrics according to the change in */
       /* width/positioning that occurred during the hinting process */
 
         if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) )
         {
 
         if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) )
         {
-          old_rsb     = loader->pp2.x - edge2->opos;
-          old_lsb     = edge1->opos;
-          new_lsb     = edge1->pos;
+          old_rsb = loader->pp2.x - edge2->opos;
+          old_lsb = edge1->opos;
+          new_lsb = edge1->pos;
 
           /* remember unhinted values to later account */
           /* for rounding errors                       */
 
           /* remember unhinted values to later account */
           /* for rounding errors                       */
         }
         else
         {
         }
         else
         {
-          FT_Pos   pp1x = loader->pp1.x;
-          FT_Pos   pp2x = loader->pp2.x;
+          FT_Pos  pp1x = loader->pp1.x;
+          FT_Pos  pp2x = loader->pp2.x;
+
 
           loader->pp1.x = FT_PIX_ROUND( pp1x );
           loader->pp2.x = FT_PIX_ROUND( pp2x );
 
           loader->pp1.x = FT_PIX_ROUND( pp1x );
           loader->pp2.x = FT_PIX_ROUND( pp2x );
       }
       else
       {
       }
       else
       {
-        FT_Pos   pp1x = loader->pp1.x;
-        FT_Pos   pp2x = loader->pp2.x;
+        FT_Pos  pp1x = loader->pp1.x;
+        FT_Pos  pp2x = loader->pp2.x;
+
 
         loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
         loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
 
         loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
         loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
       slot->metrics.vertBearingY = FT_PIX_FLOOR( bbox.yMax + vvector.y );
 
       /* for mono-width fonts (like Andale, Courier, etc.) we need */
       slot->metrics.vertBearingY = FT_PIX_FLOOR( bbox.yMax + vvector.y );
 
       /* for mono-width fonts (like Andale, Courier, etc.) we need */
-      /* to keep the original rounded advance width                */
+      /* to keep the original rounded advance width; ditto for     */
+      /* digits if all have the same advance width                 */
 #if 0
       if ( !FT_IS_FIXED_WIDTH( slot->face ) )
         slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
 #if 0
       if ( !FT_IS_FIXED_WIDTH( slot->face ) )
         slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
         slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
                                                x_scale );
 #else
         slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
                                                x_scale );
 #else
-      if ( !FT_IS_FIXED_WIDTH( slot->face ) )
-      {
-        /* non-spacing glyphs must stay as-is */
-        if ( slot->metrics.horiAdvance )
-          slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
-      }
-      else
+      if ( FT_IS_FIXED_WIDTH( slot->face )                              ||
+           ( af_face_globals_is_digit( loader->globals, glyph_index ) &&
+             metrics->digits_have_same_width                          ) )
       {
         slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
                                                metrics->scaler.x_scale );
       {
         slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
                                                metrics->scaler.x_scale );
         slot->lsb_delta = 0;
         slot->rsb_delta = 0;
       }
         slot->lsb_delta = 0;
         slot->rsb_delta = 0;
       }
+      else
+      {
+        /* non-spacing glyphs must stay as-is */
+        if ( slot->metrics.horiAdvance )
+          slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
+      }
 #endif
 
       slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance,
 #endif
 
       slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance,
         load_flags |=  FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;
         load_flags &= ~FT_LOAD_RENDER;
 
         load_flags |=  FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;
         load_flags &= ~FT_LOAD_RENDER;
 
-        error = metrics->clazz->script_hints_init( &loader->hints, metrics );
-        if ( error )
-          goto Exit;
+        if ( metrics->clazz->script_hints_init )
+        {
+          error = metrics->clazz->script_hints_init( &loader->hints,
+                                                     metrics );
+          if ( error )
+            goto Exit;
+        }
 
         error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 );
       }
 
         error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 );
       }
index cd5e1cc..ec2d707 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "afmodule.h"
 #include "afloader.h"
 
 #include "afmodule.h"
 #include "afloader.h"
+#include "afpic.h"
 
 #ifdef AF_DEBUG
   int    _af_debug;
 
 #ifdef AF_DEBUG
   int    _af_debug;
   }
 
 
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_AutoHinter_ServiceRec  af_autofitter_service =
-  {
+  FT_DEFINE_AUTOHINTER_SERVICE(af_autofitter_service,
     NULL,
     NULL,
     NULL,
     (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph
     NULL,
     NULL,
     NULL,
     (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph
-  };
+  )
 
 
+  FT_DEFINE_MODULE(autofit_module_class,
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Module_Class  autofit_module_class =
-  {
     FT_MODULE_HINTER,
     sizeof ( FT_AutofitterRec ),
 
     FT_MODULE_HINTER,
     sizeof ( FT_AutofitterRec ),
 
     0x10000L,   /* version 1.0 of the autofitter  */
     0x20000L,   /* requires FreeType 2.0 or above */
 
     0x10000L,   /* version 1.0 of the autofitter  */
     0x20000L,   /* requires FreeType 2.0 or above */
 
-    (const void*)&af_autofitter_service,
+    (const void*)&AF_AF_AUTOFITTER_SERVICE_GET,
 
     (FT_Module_Constructor)af_autofitter_init,
     (FT_Module_Destructor) af_autofitter_done,
     (FT_Module_Requester)  NULL
 
     (FT_Module_Constructor)af_autofitter_init,
     (FT_Module_Destructor) af_autofitter_done,
     (FT_Module_Requester)  NULL
-  };
+  )
 
 
 /* END */
 
 
 /* END */
index 36268a0..d979239 100644 (file)
 #define __AFMODULE_H__
 
 #include <ft2build.h>
 #define __AFMODULE_H__
 
 #include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
 #include FT_MODULE_H
 
 
 FT_BEGIN_HEADER
 
 #include FT_MODULE_H
 
 
 FT_BEGIN_HEADER
 
-  FT_CALLBACK_TABLE
-  const FT_Module_Class  autofit_module_class;
+FT_DECLARE_MODULE(autofit_module_class)
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afpic.c b/reactos/lib/3rdparty/freetype/src/autofit/afpic.c
new file mode 100644 (file)
index 0000000..76822c3
--- /dev/null
@@ -0,0 +1,92 @@
+/***************************************************************************/
+/*                                                                         */
+/*  afpic.c                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services for autofit module.  */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "afpic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from afmodule.c */
+  void FT_Init_Class_af_autofitter_service( FT_Library, FT_AutoHinter_ServiceRec*);
+
+  /* forward declaration of PIC init functions from script classes */
+#include "aflatin.h"
+#include "aflatin2.h"
+#include "afcjk.h"
+#include "afdummy.h"
+#include "afindic.h"
+
+  void
+  autofit_module_class_pic_free( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory memory = library->memory;
+    if ( pic_container->autofit )
+    {
+      FT_FREE( pic_container->autofit );
+      pic_container->autofit = NULL;
+    }
+  }
+
+  FT_Error
+  autofit_module_class_pic_init( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_UInt         ss;
+    FT_Error        error = FT_Err_Ok;
+    AFModulePIC*  container;
+    FT_Memory memory = library->memory;
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->autofit = container;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ )
+    {
+      container->af_script_classes[ss] = &container->af_script_classes_rec[ss];
+    }
+    container->af_script_classes[AF_SCRIPT_CLASSES_COUNT-1] = NULL;
+    
+    /* add call to initialization function when you add new scripts */
+    ss = 0;
+    FT_Init_Class_af_dummy_script_class(&container->af_script_classes_rec[ss++]);
+#ifdef FT_OPTION_AUTOFIT2
+    FT_Init_Class_af_latin2_script_class(&container->af_script_classes_rec[ss++]);
+#endif
+    FT_Init_Class_af_latin_script_class(&container->af_script_classes_rec[ss++]);
+    FT_Init_Class_af_cjk_script_class(&container->af_script_classes_rec[ss++]);
+    FT_Init_Class_af_indic_script_class(&container->af_script_classes_rec[ss++]);    
+
+    FT_Init_Class_af_autofitter_service(library, &container->af_autofitter_service);
+
+/*Exit:*/
+    if(error)
+      autofit_module_class_pic_free(library);
+    return error;
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afpic.h b/reactos/lib/3rdparty/freetype/src/autofit/afpic.h
new file mode 100644 (file)
index 0000000..80e62d3
--- /dev/null
@@ -0,0 +1,64 @@
+/***************************************************************************/
+/*                                                                         */
+/*  afpic.h                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services for autofit module.  */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __AFPIC_H__
+#define __AFPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define AF_SCRIPT_CLASSES_GET         af_script_classes
+#define AF_AF_AUTOFITTER_SERVICE_GET  af_autofitter_service
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include "aftypes.h"
+
+/* increase these when you add new scripts, and update autofit_module_class_pic_init */
+#ifdef FT_OPTION_AUTOFIT2
+  #define AF_SCRIPT_CLASSES_COUNT     6
+#else
+  #define AF_SCRIPT_CLASSES_COUNT     5  
+#endif
+#define AF_SCRIPT_CLASSES_REC_COUNT  (AF_SCRIPT_CLASSES_COUNT-1)    
+
+  typedef struct AFModulePIC_
+  {
+    AF_ScriptClass    af_script_classes[AF_SCRIPT_CLASSES_COUNT];
+    AF_ScriptClassRec af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT];
+    FT_AutoHinter_ServiceRec af_autofitter_service;
+  } AFModulePIC;
+
+#define GET_PIC(lib)                  ((AFModulePIC*)((lib)->pic_container.autofit))
+#define AF_SCRIPT_CLASSES_GET         (GET_PIC(FT_FACE_LIBRARY(globals->face))->af_script_classes)
+#define AF_AF_AUTOFITTER_SERVICE_GET  (GET_PIC(library)->af_autofitter_service)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __AFPIC_H__ */
+
+
+/* END */
index 9c27df2..5574f0c 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter types (specification only).                              */
 /*                                                                         */
 /*                                                                         */
 /*    Auto-fitter types (specification only).                              */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -58,7 +58,8 @@ FT_BEGIN_HEADER
 
 #ifdef AF_DEBUG
 
 
 #ifdef AF_DEBUG
 
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
+
 #define AF_LOG( x )  do { if ( _af_debug ) printf x; } while ( 0 )
 
 extern int    _af_debug;
 #define AF_LOG( x )  do { if ( _af_debug ) printf x; } while ( 0 )
 
 extern int    _af_debug;
@@ -69,7 +70,7 @@ extern void*  _af_debug_hints;
 
 #else /* !AF_DEBUG */
 
 
 #else /* !AF_DEBUG */
 
-#define AF_LOG( x )  do ; while ( 0 )        /* nothing */
+#define AF_LOG( x )  do { } while ( 0 )        /* nothing */
 
 #endif /* !AF_DEBUG */
 
 
 #endif /* !AF_DEBUG */
 
@@ -202,7 +203,7 @@ extern void*  _af_debug_hints;
    *  auto-hinted glyph image.
    */
 
    *  auto-hinted glyph image.
    */
 
-  typedef enum
+  typedef enum  AF_ScalerFlags_
   {
     AF_SCALER_FLAG_NO_HORIZONTAL = 1,  /* disable horizontal hinting */
     AF_SCALER_FLAG_NO_VERTICAL   = 2,  /* disable vertical hinting   */
   {
     AF_SCALER_FLAG_NO_HORIZONTAL = 1,  /* disable horizontal hinting */
     AF_SCALER_FLAG_NO_VERTICAL   = 2,  /* disable vertical hinting   */
@@ -260,12 +261,12 @@ extern void*  _af_debug_hints;
    *  used by more than one script.
    */
 
    *  used by more than one script.
    */
 
-  typedef enum
+  typedef enum  AF_Script_
   {
     AF_SCRIPT_NONE  = 0,
     AF_SCRIPT_LATIN = 1,
     AF_SCRIPT_CJK   = 2,
   {
     AF_SCRIPT_NONE  = 0,
     AF_SCRIPT_LATIN = 1,
     AF_SCRIPT_CJK   = 2,
-    AF_SCRIPT_INDIC = 3,
+    AF_SCRIPT_INDIC = 3, 
 #ifdef FT_OPTION_AUTOFIT2
     AF_SCRIPT_LATIN2,
 #endif
 #ifdef FT_OPTION_AUTOFIT2
     AF_SCRIPT_LATIN2,
 #endif
@@ -284,6 +285,7 @@ extern void*  _af_debug_hints;
   {
     AF_ScriptClass  clazz;
     AF_ScalerRec    scaler;
   {
     AF_ScriptClass  clazz;
     AF_ScalerRec    scaler;
+    FT_Bool         digits_have_same_width;
 
   } AF_ScriptMetricsRec, *AF_ScriptMetrics;
 
 
   } AF_ScriptMetricsRec, *AF_ScriptMetrics;
 
@@ -320,6 +322,8 @@ extern void*  _af_debug_hints;
 
   } AF_Script_UniRangeRec;
 
 
   } AF_Script_UniRangeRec;
 
+#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) }
+
   typedef const AF_Script_UniRangeRec  *AF_Script_UniRange;
 
 
   typedef const AF_Script_UniRangeRec  *AF_Script_UniRange;
 
 
@@ -328,7 +332,7 @@ extern void*  _af_debug_hints;
     AF_Script                   script;
     AF_Script_UniRange          script_uni_ranges; /* last must be { 0, 0 } */
 
     AF_Script                   script;
     AF_Script_UniRange          script_uni_ranges; /* last must be { 0, 0 } */
 
-    FT_UInt                     script_metrics_size;
+    FT_Offset                   script_metrics_size;
     AF_Script_InitMetricsFunc   script_metrics_init;
     AF_Script_ScaleMetricsFunc  script_metrics_scale;
     AF_Script_DoneMetricsFunc   script_metrics_done;
     AF_Script_InitMetricsFunc   script_metrics_init;
     AF_Script_ScaleMetricsFunc  script_metrics_scale;
     AF_Script_DoneMetricsFunc   script_metrics_done;
@@ -338,6 +342,56 @@ extern void*  _af_debug_hints;
 
   } AF_ScriptClassRec;
 
 
   } AF_ScriptClassRec;
 
+/* Declare and define vtables for classes */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define AF_DECLARE_SCRIPT_CLASS(script_class)                                \
+  FT_CALLBACK_TABLE const AF_ScriptClassRec                                  \
+  script_class;
+
+#define AF_DEFINE_SCRIPT_CLASS(script_class, script_, ranges, m_size,        \
+                               m_init, m_scale, m_done, h_init, h_apply)     \
+  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec                              \
+  script_class =                                                             \
+  {                                                                          \
+    script_,                                                                 \
+    ranges,                                                                  \
+                                                                             \
+    m_size,                                                                  \
+                                                                             \
+    m_init,                                                                  \
+    m_scale,                                                                 \
+    m_done,                                                                  \
+                                                                             \
+    h_init,                                                                  \
+    h_apply                                                                  \
+  };
+
+#else 
+
+#define AF_DECLARE_SCRIPT_CLASS(script_class)                                \
+  FT_LOCAL(void)                                                             \
+  FT_Init_Class_##script_class(AF_ScriptClassRec* ac);
+
+#define AF_DEFINE_SCRIPT_CLASS(script_class, script_, ranges, m_size,        \
+                               m_init, m_scale, m_done, h_init, h_apply)     \
+  FT_LOCAL_DEF(void)                                                         \
+  FT_Init_Class_##script_class(AF_ScriptClassRec* ac)                        \
+  {                                                                          \
+    ac->script                = script_;                                     \
+    ac->script_uni_ranges     = ranges;                                      \
+                                                                             \
+    ac->script_metrics_size   = m_size;                                      \
+                                                                             \
+    ac->script_metrics_init   = m_init;                                      \
+    ac->script_metrics_scale  = m_scale;                                     \
+    ac->script_metrics_done   = m_done;                                      \
+                                                                             \
+    ac->script_hints_init     = h_init;                                      \
+    ac->script_hints_apply    = h_apply;                                     \
+  }
+#endif
+
 
 /* */
 
 
 /* */
 
index 6c31cff..f5bb9b1 100644 (file)
     {
       FT_Fixed  best_scale = warper->best_scale;
       FT_Pos    best_delta = warper->best_delta;
     {
       FT_Fixed  best_scale = warper->best_scale;
       FT_Pos    best_delta = warper->best_delta;
-
+     
 
       hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale )
                           + best_delta;
 
       hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale )
                           + best_delta;
index 2fe66a9..83b613e 100644 (file)
@@ -18,6 +18,7 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 #include <ft2build.h>
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 #include <ft2build.h>
+#include "afpic.c"
 #include "afangles.c"
 #include "afglobal.c"
 #include "afhints.c"
 #include "afangles.c"
 #include "afglobal.c"
 #include "afhints.c"
index 4a386ce..6ec6091 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += AUTOFIT_MODULE
 
 define AUTOFIT_MODULE
 FTMODULE_H_COMMANDS += AUTOFIT_MODULE
 
 define AUTOFIT_MODULE
-$(OPEN_DRIVER)autofit_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, autofit_module_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)autofit   $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)autofit   $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE)
 endef
 
index aeffe38..832e8b8 100644 (file)
@@ -1,6 +1,6 @@
 # FreeType 2 src/base Jamfile
 #
 # FreeType 2 src/base Jamfile
 #
-# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 by
+# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -17,8 +17,11 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) base ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = ftutil ftdbgmem ftstream ftcalc fttrigon ftgloadr ftoutln
-               ftobjs ftnames  ftrfork  ;
+    _sources = ftadvanc ftcalc   ftdbgmem ftgloadr
+               ftobjs   ftoutln  ftrfork  ftsnames
+               ftstream fttrigon ftutil
+               basepic  ftpic
+               ;
   }
   else
   {
   }
   else
   {
@@ -31,11 +34,11 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) base ;
 # Add the optional/replaceable files.
 #
 {
 # Add the optional/replaceable files.
 #
 {
-  local  _sources =  system  init    glyph  mm      bdf
-                     bbox    debug   xf86   type1   pfr
-                     stroke  winfnt  otval  bitmap  synth
-                     gxval   lcdfil  gasp   patent
-                     ;
+  local  _sources = bbox   bdf    bitmap debug  gasp
+                    glyph  gxval  init   lcdfil mm
+                    otval  pfr    stroke synth  system
+                    type1  winfnt xf86   patent
+                    ;
 
   Library  $(FT2_LIB) : ft$(_sources).c ;
 }
 
   Library  $(FT2_LIB) : ft$(_sources).c ;
 }
@@ -46,5 +49,12 @@ if $(MAC)
 {
   Library  $(FT2_LIB) : ftmac.c ;
 }
 {
   Library  $(FT2_LIB) : ftmac.c ;
 }
+else if $(OS) = MACOSX
+{
+  if $(FT2_MULTI)
+  {
+    Library  $(FT2_LIB) : ftmac.c ;
+  }
+}
 
 # end of src/base Jamfile
 
 # end of src/base Jamfile
diff --git a/reactos/lib/3rdparty/freetype/src/base/basepic.c b/reactos/lib/3rdparty/freetype/src/base/basepic.c
new file mode 100644 (file)
index 0000000..c0bccb6
--- /dev/null
@@ -0,0 +1,83 @@
+/***************************************************************************/
+/*                                                                         */
+/*  basepic.c                                                              */
+/*                                                                         */
+/*    The FreeType position independent code services for base.            */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "basepic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from ftglyph.c */
+  void FT_Init_Class_ft_outline_glyph_class(FT_Glyph_Class*);
+  void FT_Init_Class_ft_bitmap_glyph_class(FT_Glyph_Class*);
+
+  /* forward declaration of PIC init functions from ftinit.c */
+  FT_Error ft_create_default_module_classes(FT_Library);
+  void ft_destroy_default_module_classes(FT_Library);
+
+  void
+  ft_base_pic_free( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory    memory = library->memory;
+    if ( pic_container->base )
+    {
+      /* Destroy default module classes (in case FT_Add_Default_Modules was used) */
+      ft_destroy_default_module_classes( library );
+
+      FT_FREE( pic_container->base );
+      pic_container->base = NULL;
+    }
+  }
+
+
+  FT_Error
+  ft_base_pic_init( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    BasePIC*     container;
+    FT_Memory    memory = library->memory;
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->base = container;
+
+    /* initialize default modules list and pointers */
+    error = ft_create_default_module_classes( library );
+    if ( error )
+      goto Exit;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    FT_Init_Class_ft_outline_glyph_class(&container->ft_outline_glyph_class);
+    FT_Init_Class_ft_bitmap_glyph_class(&container->ft_bitmap_glyph_class);
+
+Exit:
+    if(error)
+      ft_base_pic_free(library);
+    return error;
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/base/basepic.h b/reactos/lib/3rdparty/freetype/src/base/basepic.h
new file mode 100644 (file)
index 0000000..bb17745
--- /dev/null
@@ -0,0 +1,62 @@
+/***************************************************************************/
+/*                                                                         */
+/*  basepic.h                                                              */
+/*                                                                         */
+/*    The FreeType position independent code services for base.            */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __BASEPIC_H__
+#define __BASEPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class
+#define FT_BITMAP_GLYPH_CLASS_GET  &ft_bitmap_glyph_class
+#define FT_DEFAULT_MODULES_GET     ft_default_modules
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include FT_GLYPH_H
+
+  typedef struct BasePIC_
+  {
+    FT_Module_Class** default_module_classes;
+    FT_Glyph_Class ft_outline_glyph_class;
+    FT_Glyph_Class ft_bitmap_glyph_class;
+  } BasePIC;
+
+#define GET_PIC(lib)                  ((BasePIC*)((lib)->pic_container.base))
+#define FT_OUTLINE_GLYPH_CLASS_GET    (&GET_PIC(library)->ft_outline_glyph_class)
+#define FT_BITMAP_GLYPH_CLASS_GET     (&GET_PIC(library)->ft_bitmap_glyph_class)
+#define FT_DEFAULT_MODULES_GET        (GET_PIC(library)->default_module_classes)
+
+  void
+  ft_base_pic_free( FT_Library library );
+
+  FT_Error
+  ft_base_pic_init( FT_Library library );
+
+#endif /* FT_CONFIG_OPTION_PIC */
+ /* */
+
+FT_END_HEADER
+
+#endif /* __BASEPIC_H__ */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/base/ftadvanc.c b/reactos/lib/3rdparty/freetype/src/base/ftadvanc.c
new file mode 100644 (file)
index 0000000..8ab7fcb
--- /dev/null
@@ -0,0 +1,163 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftadvanc.c                                                             */
+/*                                                                         */
+/*    Quick computation of advance widths (body).                          */
+/*                                                                         */
+/*  Copyright 2008, 2009 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_ADVANCES_H
+#include FT_INTERNAL_OBJECTS_H
+
+
+  static FT_Error
+  _ft_face_scale_advances( FT_Face    face,
+                           FT_Fixed*  advances,
+                           FT_UInt    count,
+                           FT_Int32   flags )
+  {
+    FT_Fixed  scale;
+    FT_UInt   nn;
+
+
+    if ( flags & FT_LOAD_NO_SCALE )
+      return FT_Err_Ok;
+
+    if ( face->size == NULL )
+      return FT_Err_Invalid_Size_Handle;
+
+    if ( flags & FT_LOAD_VERTICAL_LAYOUT )
+      scale = face->size->metrics.y_scale;
+    else
+      scale = face->size->metrics.x_scale;
+
+    /* this must be the same scaling as to get linear{Hori,Vert}Advance */
+    /* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c)        */
+
+    for ( nn = 0; nn < count; nn++ )
+      advances[nn] = FT_MulDiv( advances[nn], scale, 64 );
+
+    return FT_Err_Ok;
+  }
+
+
+   /* at the moment, we can perform fast advance retrieval only in */
+   /* the following cases:                                         */
+   /*                                                              */
+   /*  - unscaled load                                             */
+   /*  - unhinted load                                             */
+   /*  - light-hinted load                                         */
+
+#define LOAD_ADVANCE_FAST_CHECK( flags )                            \
+          ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING )    || \
+            FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT )
+
+
+  /* documentation is in ftadvanc.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Get_Advance( FT_Face    face,
+                  FT_UInt    gindex,
+                  FT_Int32   flags,
+                  FT_Fixed  *padvance )
+  {
+    FT_Face_GetAdvancesFunc  func;
+
+
+    if ( !face )
+      return FT_Err_Invalid_Face_Handle;
+
+    if ( gindex >= (FT_UInt)face->num_glyphs )
+      return FT_Err_Invalid_Glyph_Index;
+
+    func = face->driver->clazz->get_advances;
+    if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
+    {
+      FT_Error  error;
+
+
+      error = func( face, gindex, 1, flags, padvance );
+      if ( !error )
+        return _ft_face_scale_advances( face, padvance, 1, flags );
+
+      if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )
+        return error;
+    }
+
+    return FT_Get_Advances( face, gindex, 1, flags, padvance );
+  }
+
+
+  /* documentation is in ftadvanc.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Get_Advances( FT_Face    face,
+                   FT_UInt    start,
+                   FT_UInt    count,
+                   FT_Int32   flags,
+                   FT_Fixed  *padvances )
+  {
+    FT_Face_GetAdvancesFunc  func;
+    FT_UInt                  num, end, nn;
+    FT_Error                 error = FT_Err_Ok;
+
+
+    if ( !face )
+      return FT_Err_Invalid_Face_Handle;
+
+    num = (FT_UInt)face->num_glyphs;
+    end = start + count;
+    if ( start >= num || end < start || end > num )
+      return FT_Err_Invalid_Glyph_Index;
+
+    if ( count == 0 )
+      return FT_Err_Ok;
+
+    func = face->driver->clazz->get_advances;
+    if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
+    {
+      error = func( face, start, count, flags, padvances );
+      if ( !error )
+        goto Exit;
+
+      if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )
+        return error;
+    }
+
+    error = FT_Err_Ok;
+
+    if ( flags & FT_ADVANCE_FLAG_FAST_ONLY )
+      return FT_Err_Unimplemented_Feature;
+
+    flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
+    for ( nn = 0; nn < count; nn++ )
+    {
+      error = FT_Load_Glyph( face, start + nn, flags );
+      if ( error )
+        break;
+
+      padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
+                      ? face->glyph->advance.y
+                      : face->glyph->advance.x;
+    }
+
+    if ( error )
+      return error;
+
+  Exit:
+    return _ft_face_scale_advances( face, padvances, count, flags );
+  }
+
+
+/* END */
index d176b81..6a27ea9 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Single object library component (body only).                         */
 /*                                                                         */
 /*                                                                         */
 /*    Single object library component (body only).                         */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 #define  FT_MAKE_OPTION_SINGLE_OBJECT
 
 
 #define  FT_MAKE_OPTION_SINGLE_OBJECT
 
+#include "ftpic.c"
+#include "basepic.c"
+#include "ftadvanc.c"
 #include "ftcalc.c"
 #include "ftdbgmem.c"
 #include "ftgloadr.c"
 #include "ftcalc.c"
 #include "ftdbgmem.c"
 #include "ftgloadr.c"
-#include "ftnames.c"
 #include "ftobjs.c"
 #include "ftoutln.c"
 #include "ftrfork.c"
 #include "ftobjs.c"
 #include "ftoutln.c"
 #include "ftrfork.c"
+#include "ftsnames.c"
 #include "ftstream.c"
 #include "fttrigon.c"
 #include "ftutil.c"
 
 #include "ftstream.c"
 #include "fttrigon.c"
 #include "ftutil.c"
 
-#if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON )
-#include <ftmac.c>
+#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON )
+#include "ftmac.c"
 #endif
 
 /* END */
 #endif
 
 /* END */
diff --git a/reactos/lib/3rdparty/freetype/src/base/ftbase.h b/reactos/lib/3rdparty/freetype/src/base/ftbase.h
new file mode 100644 (file)
index 0000000..9cae85d
--- /dev/null
@@ -0,0 +1,57 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftbase.h                                                               */
+/*                                                                         */
+/*    The FreeType private functions used in base module (specification).  */
+/*                                                                         */
+/*  Copyright 2008 by                                                      */
+/*  David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.      */
+/*                                                                         */
+/*  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 __FTBASE_H__
+#define __FTBASE_H__
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+
+
+FT_BEGIN_HEADER
+
+
+  /* Assume the stream is sfnt-wrapped PS Type1 or sfnt-wrapped CID-keyed */
+  /* font, and try to load a face specified by the face_index.            */
+  FT_LOCAL_DEF( FT_Error )
+  open_face_PS_from_sfnt_stream( FT_Library     library,
+                                 FT_Stream      stream,
+                                 FT_Long        face_index,
+                                 FT_Int         num_params,
+                                 FT_Parameter  *params,
+                                 FT_Face       *aface );
+
+
+  /* Create a new FT_Face given a buffer and a driver name. */
+  /* From ftmac.c.                                          */
+  FT_LOCAL_DEF( FT_Error )
+  open_face_from_buffer( FT_Library   library,
+                         FT_Byte*     base,
+                         FT_ULong     size,
+                         FT_Long      face_index,
+                         const char*  driver_name,
+                         FT_Face     *aface );
+
+
+FT_END_HEADER
+
+#endif /* __FTBASE_H__ */
+
+
+/* END */
index 532ab13..8136ccc 100644 (file)
@@ -29,6 +29,7 @@
 #include FT_IMAGE_H
 #include FT_OUTLINE_H
 #include FT_INTERNAL_CALC_H
 #include FT_IMAGE_H
 #include FT_OUTLINE_H
 #include FT_INTERNAL_CALC_H
+#include FT_INTERNAL_OBJECTS_H
 
 
   typedef struct  TBBox_Rec_
 
 
   typedef struct  TBBox_Rec_
     return 0;
   }
 
     return 0;
   }
 
+FT_DEFINE_OUTLINE_FUNCS(bbox_interface,
+    (FT_Outline_MoveTo_Func) BBox_Move_To,
+    (FT_Outline_LineTo_Func) BBox_Move_To,
+    (FT_Outline_ConicTo_Func)BBox_Conic_To,
+    (FT_Outline_CubicTo_Func)BBox_Cubic_To,
+    0, 0
+  )
 
   /* documentation is in ftbbox.h */
 
 
   /* documentation is in ftbbox.h */
 
       /* the two boxes are different, now walk over the outline to */
       /* get the Bezier arc extrema.                               */
 
       /* the two boxes are different, now walk over the outline to */
       /* get the Bezier arc extrema.                               */
 
-      static const FT_Outline_Funcs  bbox_interface =
-      {
-        (FT_Outline_MoveTo_Func) BBox_Move_To,
-        (FT_Outline_LineTo_Func) BBox_Move_To,
-        (FT_Outline_ConicTo_Func)BBox_Conic_To,
-        (FT_Outline_CubicTo_Func)BBox_Cubic_To,
-        0, 0
-      };
-
       FT_Error   error;
       TBBox_Rec  user;
 
       FT_Error   error;
       TBBox_Rec  user;
 
+#ifdef FT_CONFIG_OPTION_PIC
+      FT_Outline_Funcs bbox_interface;
+      Init_Class_bbox_interface(&bbox_interface);
+#endif
 
       user.bbox = bbox;
 
 
       user.bbox = bbox;
 
index c847eb0..82b5baf 100644 (file)
@@ -2,10 +2,9 @@
 /*                                                                         */
 /*  ftbitmap.c                                                             */
 /*                                                                         */
 /*                                                                         */
 /*  ftbitmap.c                                                             */
 /*                                                                         */
-/*    FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */
-/*    bitmaps into 8bpp format (body).                                     */
+/*    FreeType utility functions for bitmaps (body).                       */
 /*                                                                         */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006, 2007 by                                    */
+/*  Copyright 2004, 2005, 2006, 2007, 2008, 2009 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,6 +18,7 @@
 
 #include <ft2build.h>
 #include FT_BITMAP_H
 
 #include <ft2build.h>
 #include FT_BITMAP_H
+#include FT_IMAGE_H
 #include FT_INTERNAL_OBJECTS_H
 
 
 #include FT_INTERNAL_OBJECTS_H
 
 
     if ( !bitmap || !bitmap->buffer )
       return FT_Err_Invalid_Argument;
 
     if ( !bitmap || !bitmap->buffer )
       return FT_Err_Invalid_Argument;
 
-    xstr = FT_PIX_ROUND( xStrength ) >> 6;
-    ystr = FT_PIX_ROUND( yStrength ) >> 6;
+    if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) ||
+         ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) )
+      return FT_Err_Invalid_Argument;
+       
+    xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6;
+    ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6;
 
     if ( xstr == 0 && ystr == 0 )
       return FT_Err_Ok;
 
     if ( xstr == 0 && ystr == 0 )
       return FT_Err_Ok;
     case FT_PIXEL_MODE_GRAY:
     case FT_PIXEL_MODE_GRAY2:
     case FT_PIXEL_MODE_GRAY4:
     case FT_PIXEL_MODE_GRAY:
     case FT_PIXEL_MODE_GRAY2:
     case FT_PIXEL_MODE_GRAY4:
+    case FT_PIXEL_MODE_LCD:
+    case FT_PIXEL_MODE_LCD_V:
       {
         FT_Int   pad;
         FT_Long  old_size;
       {
         FT_Int   pad;
         FT_Long  old_size;
 
 
     case FT_PIXEL_MODE_GRAY:
 
 
     case FT_PIXEL_MODE_GRAY:
+    case FT_PIXEL_MODE_LCD:
+    case FT_PIXEL_MODE_LCD_V:
       {
         FT_Int    width   = source->width;
         FT_Byte*  s       = source->buffer;
       {
         FT_Int    width   = source->width;
         FT_Byte*  s       = source->buffer;
   }
 
 
   }
 
 
+  /* documentation is in ftbitmap.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot )
+  {
+    if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP   &&
+         !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
+    {
+      FT_Bitmap  bitmap;
+      FT_Error   error;
+
+
+      FT_Bitmap_New( &bitmap );
+      error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
+      if ( error )
+        return error;
+
+      slot->bitmap = bitmap;
+      slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
+    }
+
+    return FT_Err_Ok;
+  }
+
+
   /* documentation is in ftbitmap.h */
 
   FT_EXPORT_DEF( FT_Error )
   /* documentation is in ftbitmap.h */
 
   FT_EXPORT_DEF( FT_Error )
index 63aed95..3892fab 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (body).                                      */
 /*                                                                         */
 /*                                                                         */
 /*    Arithmetic computations (body).                                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 
 #include <ft2build.h>
 
 
 #include <ft2build.h>
+#include FT_GLYPH_H
 #include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_OBJECTS_H
 
 #include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_OBJECTS_H
 
+#ifdef FT_MULFIX_INLINED
+#undef FT_MulFix
+#endif
 
 /* we need to define a 64-bits data type here */
 
 
 /* we need to define a 64-bits data type here */
 
   FT_EXPORT_DEF( FT_Int32 )
   FT_Sqrt32( FT_Int32  x )
   {
   FT_EXPORT_DEF( FT_Int32 )
   FT_Sqrt32( FT_Int32  x )
   {
-    FT_ULong  val, root, newroot, mask;
+    FT_UInt32  val, root, newroot, mask;
 
 
     root = 0;
 
 
     root = 0;
-    mask = 0x40000000L;
-    val  = (FT_ULong)x;
+    mask = (FT_UInt32)0x40000000UL;
+    val  = (FT_UInt32)x;
 
     do
     {
 
     do
     {
   FT_MulFix( FT_Long  a,
              FT_Long  b )
   {
   FT_MulFix( FT_Long  a,
              FT_Long  b )
   {
+#ifdef FT_MULFIX_ASSEMBLER
+
+    return FT_MULFIX_ASSEMBLER( a, b );
+
+#else
+
     FT_Int   s = 1;
     FT_Long  c;
 
 
     FT_Int   s = 1;
     FT_Long  c;
 
 
-    if ( a < 0 ) { a = -a; s = -1; }
-    if ( b < 0 ) { b = -b; s = -s; }
+    if ( a < 0 )
+    {
+      a = -a;
+      s = -1;
+    }
+
+    if ( b < 0 )
+    {
+      b = -b;
+      s = -s;
+    }
 
     c = (FT_Long)( ( (FT_Int64)a * b + 0x8000L ) >> 16 );
 
     c = (FT_Long)( ( (FT_Int64)a * b + 0x8000L ) >> 16 );
-    return ( s > 0 ) ? c : -c ;
+
+    return ( s > 0 ) ? c : -c;
+
+#endif /* FT_MULFIX_ASSEMBLER */
   }
 
 
   }
 
 
     long  s;
 
 
     long  s;
 
 
+    /* XXX: this function does not allow 64-bit arguments */
     if ( a == 0 || b == c )
       return a;
 
     if ( a == 0 || b == c )
       return a;
 
       FT_Int64  temp, temp2;
 
 
       FT_Int64  temp, temp2;
 
 
-      ft_multo64( a, b, &temp );
+      ft_multo64( (FT_Int32)a, (FT_Int32)b, &temp );
 
       temp2.hi = 0;
       temp2.lo = (FT_UInt32)(c >> 1);
       FT_Add64( &temp, &temp2, &temp );
 
       temp2.hi = 0;
       temp2.lo = (FT_UInt32)(c >> 1);
       FT_Add64( &temp, &temp2, &temp );
-      a = ft_div64by32( temp.hi, temp.lo, c );
+      a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c );
     }
     else
       a = 0x7FFFFFFFL;
     }
     else
       a = 0x7FFFFFFFL;
       FT_Int64  temp;
 
 
       FT_Int64  temp;
 
 
-      ft_multo64( a, b, &temp );
-      a = ft_div64by32( temp.hi, temp.lo, c );
+      ft_multo64( (FT_Int32)a, (FT_Int32)b, &temp );
+      a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c );
     }
     else
       a = 0x7FFFFFFFL;
     }
     else
       a = 0x7FFFFFFFL;
   FT_MulFix( FT_Long  a,
              FT_Long  b )
   {
   FT_MulFix( FT_Long  a,
              FT_Long  b )
   {
-    /* use inline assembly to speed up things a bit */
-
-#if defined( __GNUC__ ) && defined( i386 )
-
-    FT_Long  result;
+#ifdef FT_MULFIX_ASSEMBLER
 
 
+    return FT_MULFIX_ASSEMBLER( a, b );
 
 
-    __asm__ __volatile__ (
-      "imul  %%edx\n"
-      "movl  %%edx, %%ecx\n"
-      "sarl  $31, %%ecx\n"
-      "addl  $0x8000, %%ecx\n"
-      "addl  %%ecx, %%eax\n"
-      "adcl  $0, %%edx\n"
-      "shrl  $16, %%eax\n"
-      "shll  $16, %%edx\n"
-      "addl  %%edx, %%eax\n"
-      "mov   %%eax, %0\n"
-      : "=r"(result)
-      : "a"(a), "d"(b)
-      : "%ecx"
-    );
-    return result;
+#elif 0
 
 
-#elif 1
+    /*
+     *  This code is nonportable.  See comment below.
+     *
+     *  However, on a platform where right-shift of a signed quantity fills
+     *  the leftmost bits by copying the sign bit, it might be faster.
+     */
 
     FT_Long   sa, sb;
     FT_ULong  ua, ub;
 
     FT_Long   sa, sb;
     FT_ULong  ua, ub;
     if ( a == 0 || b == 0x10000L )
       return a;
 
     if ( a == 0 || b == 0x10000L )
       return a;
 
+    /*
+     *  This is a clever way of converting a signed number `a' into its
+     *  absolute value (stored back into `a') and its sign.  The sign is
+     *  stored in `sa'; 0 means `a' was positive or zero, and -1 means `a'
+     *  was negative.  (Similarly for `b' and `sb').
+     *
+     *  Unfortunately, it doesn't work (at least not portably).
+     *
+     *  It makes the assumption that right-shift on a negative signed value
+     *  fills the leftmost bits by copying the sign bit.  This is wrong. 
+     *  According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206,
+     *  the result of right-shift of a negative signed value is
+     *  implementation-defined.  At least one implementation fills the
+     *  leftmost bits with 0s (i.e., it is exactly the same as an unsigned
+     *  right shift).  This means that when `a' is negative, `sa' ends up
+     *  with the value 1 rather than -1.  After that, everything else goes
+     *  wrong.
+     */
     sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );
     a  = ( a ^ sa ) - sa;
     sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );
     sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );
     a  = ( a ^ sa ) - sa;
     sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );
     FT_UInt32  q;
 
 
     FT_UInt32  q;
 
 
-    s  = a; a = FT_ABS(a);
-    s ^= b; b = FT_ABS(b);
+    /* XXX: this function does not allow 64-bit arguments */
+    s  = (FT_Int32)a; a = FT_ABS( a );
+    s ^= (FT_Int32)b; b = FT_ABS( b );
 
     if ( b == 0 )
     {
       /* check for division by 0 */
 
     if ( b == 0 )
     {
       /* check for division by 0 */
-      q = 0x7FFFFFFFL;
+      q = (FT_UInt32)0x7FFFFFFFL;
     }
     else if ( ( a >> 16 ) == 0 )
     {
     }
     else if ( ( a >> 16 ) == 0 )
     {
       temp2.hi = 0;
       temp2.lo = (FT_UInt32)( b >> 1 );
       FT_Add64( &temp, &temp2, &temp );
       temp2.hi = 0;
       temp2.lo = (FT_UInt32)( b >> 1 );
       FT_Add64( &temp, &temp2, &temp );
-      q = ft_div64by32( temp.hi, temp.lo, b );
+      q = ft_div64by32( temp.hi, temp.lo, (FT_Int32)b );
     }
 
     return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
     }
 
     return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
 #endif /* FT_LONG64 */
 
 
 #endif /* FT_LONG64 */
 
 
+  /* documentation is in ftglyph.h */
+
+  FT_EXPORT_DEF( void )
+  FT_Matrix_Multiply( const FT_Matrix*  a,
+                      FT_Matrix        *b )
+  {
+    FT_Fixed  xx, xy, yx, yy;
+
+
+    if ( !a || !b )
+      return;
+
+    xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
+    xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
+    yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
+    yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
+
+    b->xx = xx;  b->xy = xy;
+    b->yx = yx;  b->yy = yy;
+  }
+
+
+  /* documentation is in ftglyph.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Matrix_Invert( FT_Matrix*  matrix )
+  {
+    FT_Pos  delta, xx, yy;
+
+
+    if ( !matrix )
+      return FT_Err_Invalid_Argument;
+
+    /* compute discriminant */
+    delta = FT_MulFix( matrix->xx, matrix->yy ) -
+            FT_MulFix( matrix->xy, matrix->yx );
+
+    if ( !delta )
+      return FT_Err_Invalid_Argument;  /* matrix can't be inverted */
+
+    matrix->xy = - FT_DivFix( matrix->xy, delta );
+    matrix->yx = - FT_DivFix( matrix->yx, delta );
+
+    xx = matrix->xx;
+    yy = matrix->yy;
+
+    matrix->xx = FT_DivFix( yy, delta );
+    matrix->yy = FT_DivFix( xx, delta );
+
+    return FT_Err_Ok;
+  }
+
+
+  /* documentation is in ftcalc.h */
+
+  FT_BASE_DEF( void )
+  FT_Matrix_Multiply_Scaled( const FT_Matrix*  a,
+                             FT_Matrix        *b,
+                             FT_Long           scaling )
+  {
+    FT_Fixed  xx, xy, yx, yy;
+
+    FT_Long   val = 0x10000L * scaling;
+
+
+    if ( !a || !b )
+      return;
+
+    xx = FT_MulDiv( a->xx, b->xx, val ) + FT_MulDiv( a->xy, b->yx, val );
+    xy = FT_MulDiv( a->xx, b->xy, val ) + FT_MulDiv( a->xy, b->yy, val );
+    yx = FT_MulDiv( a->yx, b->xx, val ) + FT_MulDiv( a->yy, b->yx, val );
+    yy = FT_MulDiv( a->yx, b->xy, val ) + FT_MulDiv( a->yy, b->yy, val );
+
+    b->xx = xx;  b->xy = xy;
+    b->yx = yx;  b->yy = yy;
+  }
+
+
+  /* documentation is in ftcalc.h */
+
+  FT_BASE_DEF( void )
+  FT_Vector_Transform_Scaled( FT_Vector*        vector,
+                              const FT_Matrix*  matrix,
+                              FT_Long           scaling )
+  {
+    FT_Pos   xz, yz;
+
+    FT_Long  val = 0x10000L * scaling;
+
+
+    if ( !vector || !matrix )
+      return;
+
+    xz = FT_MulDiv( vector->x, matrix->xx, val ) +
+         FT_MulDiv( vector->y, matrix->xy, val );
+
+    yz = FT_MulDiv( vector->x, matrix->yx, val ) +
+         FT_MulDiv( vector->y, matrix->yy, val );
+
+    vector->x = xz;
+    vector->y = yz;
+  }
+
+
   /* documentation is in ftcalc.h */
 
   FT_BASE_DEF( FT_Int32 )
   /* documentation is in ftcalc.h */
 
   FT_BASE_DEF( FT_Int32 )
                          FT_Pos  out_x,
                          FT_Pos  out_y )
   {
                          FT_Pos  out_x,
                          FT_Pos  out_y )
   {
-    FT_Int  result;
+    FT_Long  result; /* avoid overflow on 16-bit system */
 
 
     /* deal with the trivial cases quickly */
 
 
     /* deal with the trivial cases quickly */
       FT_Int64  z1, z2;
 
 
       FT_Int64  z1, z2;
 
 
-      ft_multo64( in_x, out_y, &z1 );
-      ft_multo64( in_y, out_x, &z2 );
+      /* XXX: this function does not allow 64-bit arguments */
+      ft_multo64( (FT_Int32)in_x, (FT_Int32)out_y, &z1 );
+      ft_multo64( (FT_Int32)in_y, (FT_Int32)out_x, &z2 );
 
       if ( z1.hi > z2.hi )
         result = +1;
 
       if ( z1.hi > z2.hi )
         result = +1;
 #endif
     }
 
 #endif
     }
 
-    return result;
+    /* XXX: only the sign of return value, +1/0/-1 must be used */
+    return (FT_Int)result;
   }
 
 
   }
 
 
diff --git a/reactos/lib/3rdparty/freetype/src/base/ftcid.c b/reactos/lib/3rdparty/freetype/src/base/ftcid.c
new file mode 100644 (file)
index 0000000..733aae1
--- /dev/null
@@ -0,0 +1,117 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftcid.c                                                                */
+/*                                                                         */
+/*    FreeType API for accessing CID font information.                     */
+/*                                                                         */
+/*  Copyright 2007, 2009 by Derek Clegg, Michael Toftdal.                  */
+/*                                                                         */
+/*  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_CID_H
+#include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_CID_H
+
+
+  /* documentation is in ftcid.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Get_CID_Registry_Ordering_Supplement( FT_Face       face,
+                                           const char*  *registry,
+                                           const char*  *ordering,
+                                           FT_Int       *supplement)
+  {
+    FT_Error     error;
+    const char*  r = NULL;
+    const char*  o = NULL;
+    FT_Int       s = 0;
+
+
+    error = FT_Err_Invalid_Argument;
+
+    if ( face )
+    {
+      FT_Service_CID  service;
+
+
+      FT_FACE_FIND_SERVICE( face, service, CID );
+
+      if ( service && service->get_ros )
+        error = service->get_ros( face, &r, &o, &s );
+    }
+
+    if ( registry )
+      *registry = r;
+
+    if ( ordering )
+      *ordering = o;
+
+    if ( supplement )
+      *supplement = s;
+
+    return error;
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Get_CID_Is_Internally_CID_Keyed( FT_Face   face,
+                                      FT_Bool  *is_cid )
+  {
+    FT_Error  error = FT_Err_Invalid_Argument;
+    FT_Bool   ic = 0;
+
+
+    if ( face )
+    {
+      FT_Service_CID  service;
+
+
+      FT_FACE_FIND_SERVICE( face, service, CID );
+
+      if ( service && service->get_is_cid )
+        error = service->get_is_cid( face, &ic);
+    }
+
+    if ( is_cid )
+      *is_cid = ic;
+
+    return error;
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Get_CID_From_Glyph_Index( FT_Face   face,
+                               FT_UInt   glyph_index,
+                               FT_UInt  *cid )
+  {
+    FT_Error  error = FT_Err_Invalid_Argument;
+    FT_UInt   c = 0;
+
+
+    if ( face )
+    {
+      FT_Service_CID  service;
+
+
+      FT_FACE_FIND_SERVICE( face, service, CID );
+
+      if ( service && service->get_cid_from_glyph_index )
+        error = service->get_cid_from_glyph_index( face, glyph_index, &c);
+    }
+
+    if ( cid )
+      *cid = c;
+
+    return error;
+  }
+
+
+/* END */
index 52a5c20..677f242 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Memory debugger (body).                                              */
 /*                                                                         */
 /*                                                                         */
 /*    Memory debugger (body).                                              */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003, 2004, 2005, 2006 by                        */
+/*  Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -33,8 +33,7 @@
                     * memory, however.
                     */
 
                     * memory, however.
                     */
 
-#include <stdio.h>
-#include <stdlib.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
 
   FT_BASE_DEF( const char* )  _ft_debug_file   = 0;
   FT_BASE_DEF( long )         _ft_debug_lineno = 0;
 
   FT_BASE_DEF( const char* )  _ft_debug_file   = 0;
   FT_BASE_DEF( long )         _ft_debug_lineno = 0;
           "FreeType: %ld bytes of memory leaked in %ld blocks\n",
           leaks, leak_count );
 
           "FreeType: %ld bytes of memory leaked in %ld blocks\n",
           leaks, leak_count );
 
-      printf( "FreeType: No memory leaks detected!\n" );
+      printf( "FreeType: no memory leaks detected\n" );
     }
   }
 
     }
   }
 
 #else  /* !FT_DEBUG_MEMORY */
 
   /* ANSI C doesn't like empty source files */
 #else  /* !FT_DEBUG_MEMORY */
 
   /* ANSI C doesn't like empty source files */
-  const FT_Byte  _debug_mem_dummy = 0;
+  static const FT_Byte  _debug_mem_dummy = 0;
 
 #endif /* !FT_DEBUG_MEMORY */
 
 
 #endif /* !FT_DEBUG_MEMORY */
 
index c55d3c8..2adbeab 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Debugging and logging component (body).                              */
 /*                                                                         */
 /*                                                                         */
 /*    Debugging and logging component (body).                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004 by                                     */
+/*  Copyright 1996-2001, 2002, 2004, 2008 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -46,7 +46,7 @@
 #include FT_INTERNAL_DEBUG_H
 
 
 #include FT_INTERNAL_DEBUG_H
 
 
-#if defined( FT_DEBUG_LEVEL_ERROR )
+#ifdef FT_DEBUG_LEVEL_ERROR
 
   /* documentation is in ftdebug.h */
 
 
   /* documentation is in ftdebug.h */
 
@@ -57,7 +57,7 @@
 
 
     va_start( ap, fmt );
 
 
     va_start( ap, fmt );
-    vprintf( fmt, ap );
+    vfprintf( stderr, fmt, ap );
     va_end( ap );
   }
 
     va_end( ap );
   }
 
@@ -71,7 +71,7 @@
 
 
     va_start( ap, fmt );
 
 
     va_start( ap, fmt );
-    vprintf( fmt, ap );
+    vfprintf( stderr, fmt, ap );
     va_end( ap );
 
     exit( EXIT_FAILURE );
     va_end( ap );
 
     exit( EXIT_FAILURE );
diff --git a/reactos/lib/3rdparty/freetype/src/base/ftfstype.c b/reactos/lib/3rdparty/freetype/src/base/ftfstype.c
new file mode 100644 (file)
index 0000000..d0ef7b7
--- /dev/null
@@ -0,0 +1,62 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftfstype.c                                                             */
+/*                                                                         */
+/*    FreeType utility file to access FSType data (body).                  */
+/*                                                                         */
+/*  Copyright 2008, 2009 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_TYPE1_TABLES_H
+#include FT_TRUETYPE_TABLES_H
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
+
+
+  /* documentation is in freetype.h */
+
+  FT_EXPORT_DEF( FT_UShort )
+  FT_Get_FSType_Flags( FT_Face  face )
+  {
+    TT_OS2*  os2;
+
+
+    /* first, try to get the fs_type directly from the font */
+    if ( face )
+    {
+      FT_Service_PsInfo  service = NULL;
+
+
+      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
+
+      if ( service && service->ps_get_font_extra )
+      {
+        PS_FontExtraRec  extra;
+
+
+        if ( !service->ps_get_font_extra( face, &extra ) &&
+             extra.fs_type != 0                          )
+          return extra.fs_type;
+      }
+    }
+
+    /* look at FSType before fsType for Type42 */
+
+    if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, ft_sfnt_os2 ) ) != NULL &&
+         os2->version != 0xFFFFU                                           )
+      return os2->fsType;
+
+    return 0;
+  }
+
+
+/* END */
index ab52621..ac0010d 100644 (file)
     {
       new_max = FT_PAD_CEIL( new_max, 8 );
 
     {
       new_max = FT_PAD_CEIL( new_max, 8 );
 
+      if ( new_max > FT_OUTLINE_POINTS_MAX )
+        return FT_Err_Array_Too_Large;
+
       if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
            FT_RENEW_ARRAY( base->tags,   old_max, new_max ) )
         goto Exit;
       if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
            FT_RENEW_ARRAY( base->tags,   old_max, new_max ) )
         goto Exit;
     if ( new_max > old_max )
     {
       new_max = FT_PAD_CEIL( new_max, 4 );
     if ( new_max > old_max )
     {
       new_max = FT_PAD_CEIL( new_max, 4 );
+
+      if ( new_max > FT_OUTLINE_CONTOURS_MAX )
+        return FT_Err_Array_Too_Large;
+
       if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
         goto Exit;
 
       if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
         goto Exit;
 
index 969c5db..ef61d45 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType convenience functions to handle glyphs (body).              */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType convenience functions to handle glyphs (body).              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -34,6 +34,7 @@
 #include FT_BITMAP_H
 #include FT_INTERNAL_OBJECTS_H
 
 #include FT_BITMAP_H
 #include FT_INTERNAL_OBJECTS_H
 
+#include "basepic.h"
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
 #define FT_COMPONENT  trace_glyph
 
 
 #define FT_COMPONENT  trace_glyph
 
 
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****   Convenience functions                                         ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  /* documentation is in ftglyph.h */
-
-  FT_EXPORT_DEF( void )
-  FT_Matrix_Multiply( const FT_Matrix*  a,
-                      FT_Matrix        *b )
-  {
-    FT_Fixed  xx, xy, yx, yy;
-
-
-    if ( !a || !b )
-      return;
-
-    xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
-    xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
-    yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
-    yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
-
-    b->xx = xx;  b->xy = xy;
-    b->yx = yx;  b->yy = yy;
-  }
-
-
-  /* documentation is in ftglyph.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_Matrix_Invert( FT_Matrix*  matrix )
-  {
-    FT_Pos  delta, xx, yy;
-
-
-    if ( !matrix )
-      return FT_Err_Invalid_Argument;
-
-    /* compute discriminant */
-    delta = FT_MulFix( matrix->xx, matrix->yy ) -
-            FT_MulFix( matrix->xy, matrix->yx );
-
-    if ( !delta )
-      return FT_Err_Invalid_Argument;  /* matrix can't be inverted */
-
-    matrix->xy = - FT_DivFix( matrix->xy, delta );
-    matrix->yx = - FT_DivFix( matrix->yx, delta );
-
-    xx = matrix->xx;
-    yy = matrix->yy;
-
-    matrix->xx = FT_DivFix( yy, delta );
-    matrix->yy = FT_DivFix( xx, delta );
-
-    return FT_Err_Ok;
-  }
-
-
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
   }
 
 
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Glyph_Class  ft_bitmap_glyph_class =
-  {
+  FT_DEFINE_GLYPH(ft_bitmap_glyph_class,
     sizeof ( FT_BitmapGlyphRec ),
     FT_GLYPH_FORMAT_BITMAP,
 
     sizeof ( FT_BitmapGlyphRec ),
     FT_GLYPH_FORMAT_BITMAP,
 
     0,                          /* FT_Glyph_TransformFunc */
     ft_bitmap_glyph_bbox,
     0                           /* FT_Glyph_PrepareFunc   */
     0,                          /* FT_Glyph_TransformFunc */
     ft_bitmap_glyph_bbox,
     0                           /* FT_Glyph_PrepareFunc   */
-  };
+  )
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
   }
 
 
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Glyph_Class  ft_outline_glyph_class =
-  {
+  FT_DEFINE_GLYPH( ft_outline_glyph_class, 
     sizeof ( FT_OutlineGlyphRec ),
     FT_GLYPH_FORMAT_OUTLINE,
 
     sizeof ( FT_OutlineGlyphRec ),
     FT_GLYPH_FORMAT_OUTLINE,
 
     ft_outline_glyph_transform,
     ft_outline_glyph_bbox,
     ft_outline_glyph_prepare
     ft_outline_glyph_transform,
     ft_outline_glyph_bbox,
     ft_outline_glyph_prepare
-  };
+  )
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
     const FT_Glyph_Class*  clazz;
 
 
     const FT_Glyph_Class*  clazz;
 
 
+    /* check arguments */
+    if ( !target )
+    {
+      error = FT_Err_Invalid_Argument;
+      goto Exit;
+    }
+
     *target = 0;
 
     *target = 0;
 
-    /* check arguments */
-    if ( !target || !source || !source->clazz )
+    if ( !source || !source->clazz )
     {
       error = FT_Err_Invalid_Argument;
       goto Exit;
     {
       error = FT_Err_Invalid_Argument;
       goto Exit;
 
     /* if it is a bitmap, that's easy :-) */
     if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
 
     /* if it is a bitmap, that's easy :-) */
     if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
-      clazz = &ft_bitmap_glyph_class;
+      clazz = FT_BITMAP_GLYPH_CLASS_GET;
 
     /* it it is an outline too */
     else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
 
     /* it it is an outline too */
     else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
-      clazz = &ft_outline_glyph_class;
+      clazz = FT_OUTLINE_GLYPH_CLASS_GET;
 
     else
     {
 
     else
     {
     clazz = glyph->clazz;
 
     /* when called with a bitmap glyph, do nothing and return successfully */
     clazz = glyph->clazz;
 
     /* when called with a bitmap glyph, do nothing and return successfully */
-    if ( clazz == &ft_bitmap_glyph_class )
+    if ( clazz == FT_BITMAP_GLYPH_CLASS_GET )
       goto Exit;
 
     if ( !clazz || !clazz->glyph_prepare )
       goto Exit;
 
     if ( !clazz || !clazz->glyph_prepare )
     dummy.format   = clazz->glyph_format;
 
     /* create result bitmap glyph */
     dummy.format   = clazz->glyph_format;
 
     /* create result bitmap glyph */
-    error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class,
+    error = ft_new_glyph( glyph->library, FT_BITMAP_GLYPH_CLASS_GET,
                           (FT_Glyph*)(void*)&bitmap );
     if ( error )
       goto Exit;
                           (FT_Glyph*)(void*)&bitmap );
     if ( error )
       goto Exit;
index 7af19c3..ef13503 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType initialization layer (body).                                */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType initialization layer (body).                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2005, 2007 by                               */
+/*  Copyright 1996-2001, 2002, 2005, 2007, 2009 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -42,6 +42,7 @@
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_MODULE_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_MODULE_H
+#include "basepic.h"
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_init
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_init
 
+#ifndef FT_CONFIG_OPTION_PIC
+
 #undef  FT_USE_MODULE
 #ifdef __cplusplus
 #undef  FT_USE_MODULE
 #ifdef __cplusplus
-#define FT_USE_MODULE( x )  extern "C" const FT_Module_Class  x;
+#define FT_USE_MODULE( type, x )  extern "C" const type  x;
 #else
 #else
-#define FT_USE_MODULE( x )  extern const FT_Module_Class  x;
+#define FT_USE_MODULE( type, x )  extern const type  x;
 #endif
 
 
 #endif
 
 
@@ -65,7 +68,7 @@
 
 
 #undef  FT_USE_MODULE
 
 
 #undef  FT_USE_MODULE
-#define FT_USE_MODULE( x )  (const FT_Module_Class*)&(x),
+#define FT_USE_MODULE( type, x )  (const FT_Module_Class*)&(x),
 
   static
   const FT_Module_Class*  const ft_default_modules[] =
 
   static
   const FT_Module_Class*  const ft_default_modules[] =
     0
   };
 
     0
   };
 
+#else /* FT_CONFIG_OPTION_PIC */
+
+#ifdef __cplusplus
+#define FT_EXTERNC  extern "C"
+#else
+#define FT_EXTERNC  extern
+#endif
+
+  /* declare the module's class creation/destruction functions */
+#undef  FT_USE_MODULE
+#define FT_USE_MODULE( type, x )  \
+  FT_EXTERNC FT_Error FT_Create_Class_##x( FT_Library library, FT_Module_Class** output_class ); \
+  FT_EXTERNC void     FT_Destroy_Class_##x( FT_Library library, FT_Module_Class*  clazz );
+
+#include FT_CONFIG_MODULES_H
+
+
+  /* count all module classes */
+#undef  FT_USE_MODULE
+#define FT_USE_MODULE( type, x )  MODULE_CLASS_##x,
+
+  enum {
+#include FT_CONFIG_MODULES_H
+    FT_NUM_MODULE_CLASSES
+  };
+
+  /* destroy all module classes */  
+#undef  FT_USE_MODULE
+#define FT_USE_MODULE( type, x )  \
+  if ( classes[i] ) { FT_Destroy_Class_##x(library, classes[i]); } \
+  i++;                                                             \
+
+  FT_BASE_DEF( void )
+  ft_destroy_default_module_classes( FT_Library  library )
+  {
+    FT_Module_Class** classes;
+    FT_Memory         memory;
+    FT_UInt           i;
+    BasePIC*          pic_container = library->pic_container.base;
+
+    if ( !pic_container->default_module_classes )
+      return;
+
+    memory = library->memory;
+    classes = pic_container->default_module_classes;
+    i = 0;
+
+#include FT_CONFIG_MODULES_H
+
+    FT_FREE( classes );
+    pic_container->default_module_classes = 0;
+  }
+
+  /* initialize all module classes and the pointer table */
+#undef  FT_USE_MODULE
+#define FT_USE_MODULE( type, x )                \
+  error = FT_Create_Class_##x(library, &clazz); \
+  if (error) goto Exit;                         \
+  classes[i++] = clazz;
+
+  FT_BASE_DEF( FT_Error )
+  ft_create_default_module_classes( FT_Library  library )
+  {
+    FT_Error          error;
+    FT_Memory         memory;
+    FT_Module_Class** classes;
+    FT_Module_Class*  clazz;
+    FT_UInt           i;
+    BasePIC*          pic_container = library->pic_container.base;
+
+    memory = library->memory;  
+    pic_container->default_module_classes = 0;
+
+    if ( FT_ALLOC(classes, sizeof(FT_Module_Class*) * (FT_NUM_MODULE_CLASSES + 1) ) )
+      return error;
+    /* initialize all pointers to 0, especially the last one */
+    for (i = 0; i < FT_NUM_MODULE_CLASSES; i++)
+      classes[i] = 0;
+    classes[FT_NUM_MODULE_CLASSES] = 0;
+
+    i = 0;
+
+#include FT_CONFIG_MODULES_H
+
+Exit:    
+    if (error) ft_destroy_default_module_classes( library );
+    else pic_container->default_module_classes = classes;
+
+    return error;    
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
 
   /* documentation is in ftmodapi.h */
 
 
   /* documentation is in ftmodapi.h */
 
 
     /* test for valid `library' delayed to FT_Add_Module() */
 
 
     /* test for valid `library' delayed to FT_Add_Module() */
 
-    cur = ft_default_modules;
+    cur = FT_DEFAULT_MODULES_GET;
     while ( *cur )
     {
       error = FT_Add_Module( library, *cur );
       /* notify errors, but don't stop */
       if ( error )
     while ( *cur )
     {
       error = FT_Add_Module( library, *cur );
       /* notify errors, but don't stop */
       if ( error )
-      {
-        FT_ERROR(( "FT_Add_Default_Module: Cannot install `%s', error = 0x%x\n",
-                   (*cur)->module_name, error ));
-      }
+        FT_TRACE0(( "FT_Add_Default_Module:"
+                    " Cannot install `%s', error = 0x%x\n",
+                    (*cur)->module_name, error ));
       cur++;
     }
   }
       cur++;
     }
   }
     if ( error )
       FT_Done_Memory( memory );
     else
     if ( error )
       FT_Done_Memory( memory );
     else
-    {
-      (*alibrary)->version_major = FREETYPE_MAJOR;
-      (*alibrary)->version_minor = FREETYPE_MINOR;
-      (*alibrary)->version_patch = FREETYPE_PATCH;
-
       FT_Add_Default_Modules( *alibrary );
       FT_Add_Default_Modules( *alibrary );
-    }
 
     return error;
   }
 
     return error;
   }
index f40bbea..8064011 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for color filtering of subpixel bitmap glyphs (body).   */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType API for color filtering of subpixel bitmap glyphs (body).   */
 /*                                                                         */
-/*  Copyright 2006 by                                                      */
+/*  Copyright 2006, 2008, 2009 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 #ifdef USE_LEGACY
 
 
 #ifdef USE_LEGACY
 
-  /* FIR filter used by the default and light filters */
+  /* intra-pixel filter used by the legacy filter */
   static void
   _ft_lcd_filter_legacy( FT_Bitmap*      bitmap,
                          FT_Render_Mode  mode,
   static void
   _ft_lcd_filter_legacy( FT_Bitmap*      bitmap,
                          FT_Render_Mode  mode,
     FT_UNUSED( library );
 
 
     FT_UNUSED( library );
 
 
-    /* horizontal in-place FIR filter */
+    /* horizontal in-place intra-pixel filter */
     if ( mode == FT_RENDER_MODE_LCD && width >= 3 )
     {
       FT_Byte*  line = bitmap->buffer;
     if ( mode == FT_RENDER_MODE_LCD && width >= 3 )
     {
       FT_Byte*  line = bitmap->buffer;
 #endif /* USE_LEGACY */
 
 
 #endif /* USE_LEGACY */
 
 
-  FT_EXPORT( FT_Error )
+  FT_EXPORT_DEF( FT_Error )
   FT_Library_SetLcdFilter( FT_Library     library,
                            FT_LcdFilter   filter )
   {
   FT_Library_SetLcdFilter( FT_Library     library,
                            FT_LcdFilter   filter )
   {
 
 #elif defined( FT_FORCE_LIGHT_LCD_FILTER )
 
 
 #elif defined( FT_FORCE_LIGHT_LCD_FILTER )
 
-      memcpy( library->lcd_weights, light_filter, 5 );
+      ft_memcpy( library->lcd_weights, light_filter, 5 );
       library->lcd_filter_func = _ft_lcd_filter_fir;
       library->lcd_extra       = 2;
 
 #else
 
       library->lcd_filter_func = _ft_lcd_filter_fir;
       library->lcd_extra       = 2;
 
 #else
 
-      memcpy( library->lcd_weights, default_filter, 5 );
+      ft_memcpy( library->lcd_weights, default_filter, 5 );
       library->lcd_filter_func = _ft_lcd_filter_fir;
       library->lcd_extra       = 2;
 
       library->lcd_filter_func = _ft_lcd_filter_fir;
       library->lcd_extra       = 2;
 
       break;
 
     case FT_LCD_FILTER_LIGHT:
       break;
 
     case FT_LCD_FILTER_LIGHT:
-      memcpy( library->lcd_weights, light_filter, 5 );
+      ft_memcpy( library->lcd_weights, light_filter, 5 );
       library->lcd_filter_func = _ft_lcd_filter_fir;
       library->lcd_extra       = 2;
       break;
       library->lcd_filter_func = _ft_lcd_filter_fir;
       library->lcd_extra       = 2;
       break;
 
 #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
 
 
 #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
 
-  FT_EXPORT( FT_Error )
+  FT_EXPORT_DEF( FT_Error )
   FT_Library_SetLcdFilter( FT_Library    library,
                            FT_LcdFilter  filter )
   {
   FT_Library_SetLcdFilter( FT_Library    library,
                            FT_LcdFilter  filter )
   {
index fd6201a..63f927d 100644 (file)
@@ -8,7 +8,8 @@
 /*  This file is for Mac OS X only; see builds/mac/ftoldmac.c for          */
 /*  classic platforms built by MPW.                                        */
 /*                                                                         */
 /*  This file is for Mac OS X only; see builds/mac/ftoldmac.c for          */
 /*  classic platforms built by MPW.                                        */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,         */
+/*            2009 by                                                      */
 /*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -67,7 +68,9 @@
 
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
 #include <ft2build.h>
 #include FT_FREETYPE_H
+#include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_STREAM_H
+#include "ftbase.h"
 
   /* This is for Mac OS X.  Without redefinition, OS_INLINE */
   /* expands to `static inline' which doesn't survive the   */
 
   /* This is for Mac OS X.  Without redefinition, OS_INLINE */
   /* expands to `static inline' which doesn't survive the   */
 #undef  OS_INLINE
 #define OS_INLINE  static __inline__
 #endif
 #undef  OS_INLINE
 #define OS_INLINE  static __inline__
 #endif
-#include <Carbon/Carbon.h>
 
 
-#ifndef HFS_MAXPATHLEN
-#define HFS_MAXPATHLEN  1024
+  /* `configure' checks the availability of `ResourceIndex' strictly */
+  /* and sets HAVE_TYPE_RESOURCE_INDEX 1 or 0 always.  If it is      */
+  /* not set (e.g., a build without `configure'), the availability   */
+  /* is guessed from the SDK version.                                */
+#ifndef HAVE_TYPE_RESOURCE_INDEX
+#if !defined( MAC_OS_X_VERSION_10_5 ) || \
+    ( MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 )
+#define HAVE_TYPE_RESOURCE_INDEX 0
+#else
+#define HAVE_TYPE_RESOURCE_INDEX 1
+#endif
+#endif /* !HAVE_TYPE_RESOURCE_INDEX */
+
+#if ( HAVE_TYPE_RESOURCE_INDEX == 0 )
+  typedef short  ResourceIndex;
 #endif
 
 #endif
 
+#include <CoreServices/CoreServices.h>
+#include <ApplicationServices/ApplicationServices.h>
+#include <sys/syslimits.h> /* PATH_MAX */
+
+  /* Don't want warnings about our own use of deprecated functions. */
 #define FT_DEPRECATED_ATTRIBUTE
 
 #include FT_MAC_H
 
 #define FT_DEPRECATED_ATTRIBUTE
 
 #include FT_MAC_H
 
-  /* undefine blocking-macros in ftmac.h */
-#undef FT_GetFile_From_Mac_Name( a, b, c )
-#undef FT_GetFile_From_Mac_ATS_Name( a, b, c )
-#undef FT_New_Face_From_FSSpec( a, b, c, d )
+#ifndef kATSOptionFlagsUnRestrictedScope /* since Mac OS X 10.1 */
+#define kATSOptionFlagsUnRestrictedScope kATSOptionFlagsDefault
+#endif
 
 
   /* Set PREFER_LWFN to 1 if LWFN (Type 1) is preferred over
 
 
   /* Set PREFER_LWFN to 1 if LWFN (Type 1) is preferred over
 #endif
 
 
 #endif
 
 
+  /* This function is deprecated because FSSpec is deprecated in Mac OS X  */
   FT_EXPORT_DEF( FT_Error )
   FT_GetFile_From_Mac_Name( const char*  fontName,
                             FSSpec*      pathSpec,
   FT_EXPORT_DEF( FT_Error )
   FT_GetFile_From_Mac_Name( const char*  fontName,
                             FSSpec*      pathSpec,
 
   /* Private function.                                         */
   /* The FSSpec type has been discouraged for a long time,     */
 
   /* Private function.                                         */
   /* The FSSpec type has been discouraged for a long time,     */
-  /* but for some reason, there is no FSRef version of         */
-  /* ATSFontGetFileSpecification(), so we made our own.        */
-  /* Apple will provide one eventually.                        */
+  /* unfortunately an FSRef replacement API for                */
+  /* ATSFontGetFileSpecification() is only available in        */
+  /* Mac OS X 10.5 and later.                                  */
   static OSStatus
   FT_ATSFontGetFileReference( ATSFontRef  ats_font_id,
                               FSRef*      ats_font_ref )
   {
   static OSStatus
   FT_ATSFontGetFileReference( ATSFontRef  ats_font_id,
                               FSRef*      ats_font_ref )
   {
-#if __LP64__
+#if defined( MAC_OS_X_VERSION_10_5 ) && \
+    ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
+    OSStatus  err;
+
+    err = ATSFontGetFileReference( ats_font_id, ats_font_ref );
+
+    return err;
+#elif __LP64__ /* No 64bit Carbon API on legacy platforms */
     FT_UNUSED( ats_font_id );
     FT_UNUSED( ats_font_ref );
 
     FT_UNUSED( ats_font_id );
     FT_UNUSED( ats_font_ref );
 
+
     return fnfErr;
     return fnfErr;
-#else
+#else /* 32bit Carbon API on legacy platforms */
     OSStatus  err;
     FSSpec    spec;
 
     OSStatus  err;
     FSSpec    spec;
 
                                 FSSpec*      pathSpec,
                                 FT_Long*     face_index )
   {
                                 FSSpec*      pathSpec,
                                 FT_Long*     face_index )
   {
-#if __LP64__
+#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
+      ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
     FT_UNUSED( fontName );
     FT_UNUSED( pathSpec );
     FT_UNUSED( face_index );
     FT_UNUSED( fontName );
     FT_UNUSED( pathSpec );
     FT_UNUSED( face_index );
 
 
   static OSErr
 
 
   static OSErr
-  FT_FSPathMakeRes( const UInt8*  pathname,
-                    short*        res )
+  FT_FSPathMakeRes( const UInt8*    pathname,
+                    ResFileRefNum*  res )
   {
     OSErr  err;
     FSRef  ref;
   {
     OSErr  err;
     FSRef  ref;
   static void
   parse_fond( char*   fond_data,
               short*  have_sfnt,
   static void
   parse_fond( char*   fond_data,
               short*  have_sfnt,
-              short*  sfnt_id,
+              ResID*  sfnt_id,
               Str255  lwfn_file_name,
               short   face_index )
   {
               Str255  lwfn_file_name,
               short   face_index )
   {
     assoc      = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
     base_assoc = assoc;
 
     assoc      = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
     base_assoc = assoc;
 
+    /* the maximum faces in a FOND is 48, size of StyleTable.indexes[] */
+    if ( 47 < face_index )
+      return;
+
     /* Let's do a little range checking before we get too excited here */
     if ( face_index < count_faces_sfnt( fond_data ) )
     {
     /* Let's do a little range checking before we get too excited here */
     if ( face_index < count_faces_sfnt( fond_data ) )
     {
           ft_memcpy(ps_name, names[0] + 1, ps_name_len);
           ps_name[ps_name_len] = 0;
         }
           ft_memcpy(ps_name, names[0] + 1, ps_name_len);
           ps_name[ps_name_len] = 0;
         }
-        if ( style->indexes[0] > 1 )
+        if ( style->indexes[face_index] > 1 &&
+             style->indexes[face_index] <= FT_MIN( string_count, 64 ) )
         {
         {
-          unsigned char*  suffixes = names[style->indexes[0] - 1];
+          unsigned char*  suffixes = names[style->indexes[face_index] - 1];
 
 
           for ( i = 1; i <= suffixes[0]; i++ )
 
 
           for ( i = 1; i <= suffixes[0]; i++ )
                        UInt8*            path_lwfn,
                        size_t            path_size )
   {
                        UInt8*            path_lwfn,
                        size_t            path_size )
   {
-    FSRef  ref, par_ref;
-    int    dirname_len;
+    FSRef   ref, par_ref;
+    size_t  dirname_len;
 
 
     /* Pathname for FSRef can be in various formats: HFS, HFS+, and POSIX. */
 
 
     /* Pathname for FSRef can be in various formats: HFS, HFS+, and POSIX. */
   count_faces( Handle        fond,
                const UInt8*  pathname )
   {
   count_faces( Handle        fond,
                const UInt8*  pathname )
   {
-    short     sfnt_id;
+    ResID     sfnt_id;
     short     have_sfnt, have_lwfn;
     Str255    lwfn_file_name;
     short     have_sfnt, have_lwfn;
     Str255    lwfn_file_name;
-    UInt8     buff[HFS_MAXPATHLEN];
+    UInt8     buff[PATH_MAX];
     FT_Error  err;
     short     num_faces;
 
     FT_Error  err;
     short     num_faces;
 
      chunks are often not organized that way, so we glue chunks
      of the same type together. */
   static FT_Error
      chunks are often not organized that way, so we glue chunks
      of the same type together. */
   static FT_Error
-  read_lwfn( FT_Memory  memory,
-             short      res,
-             FT_Byte**  pfb_data,
-             FT_ULong*  size )
+  read_lwfn( FT_Memory      memory,
+             ResFileRefNum  res,
+             FT_Byte**      pfb_data,
+             FT_ULong*      size )
   {
     FT_Error       error = FT_Err_Ok;
   {
     FT_Error       error = FT_Err_Ok;
-    short          res_id;
+    ResID          res_id;
     unsigned char  *buffer, *p, *size_p = NULL;
     FT_ULong       total_size = 0;
     FT_ULong       old_total_size = 0;
     unsigned char  *buffer, *p, *size_p = NULL;
     FT_ULong       total_size = 0;
     FT_ULong       old_total_size = 0;
 
     for (;;)
     {
 
     for (;;)
     {
-      post_data = Get1Resource( 'POST', res_id++ );
+      post_data = Get1Resource( TTAG_POST, res_id++ );
       if ( post_data == NULL )
         break;  /* we are done */
 
       if ( post_data == NULL )
         break;  /* we are done */
 
 
     for (;;)
     {
 
     for (;;)
     {
-      post_data = Get1Resource( 'POST', res_id++ );
+      post_data = Get1Resource( TTAG_POST, res_id++ );
       if ( post_data == NULL )
         break;  /* we are done */
 
       if ( post_data == NULL )
         break;  /* we are done */
 
   }
 
 
   }
 
 
-  /* Finalizer for a memory stream; gets called by FT_Done_Face().
-     It frees the memory it uses. */
-  static void
-  memory_stream_close( FT_Stream  stream )
-  {
-    FT_Memory  memory = stream->memory;
-
-
-    FT_FREE( stream->base );
-
-    stream->size  = 0;
-    stream->base  = 0;
-    stream->close = 0;
-  }
-
-
-  /* Create a new memory stream from a buffer and a size. */
-  static FT_Error
-  new_memory_stream( FT_Library           library,
-                     FT_Byte*             base,
-                     FT_ULong             size,
-                     FT_Stream_CloseFunc  close,
-                     FT_Stream*           astream )
-  {
-    FT_Error   error;
-    FT_Memory  memory;
-    FT_Stream  stream;
-
-
-    if ( !library )
-      return FT_Err_Invalid_Library_Handle;
-
-    if ( !base )
-      return FT_Err_Invalid_Argument;
-
-    *astream = 0;
-    memory = library->memory;
-    if ( FT_NEW( stream ) )
-      goto Exit;
-
-    FT_Stream_OpenMemory( stream, base, size );
-
-    stream->close = close;
-
-    *astream = stream;
-
-  Exit:
-    return error;
-  }
-
-
-  /* Create a new FT_Face given a buffer and a driver name. */
-  static FT_Error
-  open_face_from_buffer( FT_Library  library,
-                         FT_Byte*    base,
-                         FT_ULong    size,
-                         FT_Long     face_index,
-                         char*       driver_name,
-                         FT_Face*    aface )
-  {
-    FT_Open_Args  args;
-    FT_Error      error;
-    FT_Stream     stream;
-    FT_Memory     memory = library->memory;
-
-
-    error = new_memory_stream( library,
-                               base,
-                               size,
-                               memory_stream_close,
-                               &stream );
-    if ( error )
-    {
-      FT_FREE( base );
-      return error;
-    }
-
-    args.flags  = FT_OPEN_STREAM;
-    args.stream = stream;
-    if ( driver_name )
-    {
-      args.flags  = args.flags | FT_OPEN_DRIVER;
-      args.driver = FT_Get_Module( library, driver_name );
-    }
-
-    /* At this point, face_index has served its purpose;      */
-    /* whoever calls this function has already used it to     */
-    /* locate the correct font data.  We should not propagate */
-    /* this index to FT_Open_Face() (unless it is negative).  */
-
-    if ( face_index > 0 )
-      face_index = 0;
-
-    error = FT_Open_Face( library, &args, face_index, aface );
-    if ( error == FT_Err_Ok )
-      (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
-    else
-      FT_Stream_Free( stream, 0 );
-
-    return error;
-  }
-
-
-  /* Create a new FT_Face from a file spec to an LWFN file. */
+  /* Create a new FT_Face from a file path to an LWFN file. */
   static FT_Error
   FT_New_Face_From_LWFN( FT_Library    library,
                          const UInt8*  pathname,
                          FT_Long       face_index,
                          FT_Face*      aface )
   {
   static FT_Error
   FT_New_Face_From_LWFN( FT_Library    library,
                          const UInt8*  pathname,
                          FT_Long       face_index,
                          FT_Face*      aface )
   {
-    FT_Byte*  pfb_data;
-    FT_ULong  pfb_size;
-    FT_Error  error;
-    short     res;
+    FT_Byte*       pfb_data;
+    FT_ULong       pfb_size;
+    FT_Error       error;
+    ResFileRefNum  res;
 
 
     if ( noErr != FT_FSPathMakeRes( pathname, &res ) )
 
 
     if ( noErr != FT_FSPathMakeRes( pathname, &res ) )
   /* Create a new FT_Face from an SFNT resource, specified by res ID. */
   static FT_Error
   FT_New_Face_From_SFNT( FT_Library  library,
   /* Create a new FT_Face from an SFNT resource, specified by res ID. */
   static FT_Error
   FT_New_Face_From_SFNT( FT_Library  library,
-                         short       sfnt_id,
+                         ResID       sfnt_id,
                          FT_Long     face_index,
                          FT_Face*    aface )
   {
                          FT_Long     face_index,
                          FT_Face*    aface )
   {
     size_t     sfnt_size;
     FT_Error   error  = FT_Err_Ok;
     FT_Memory  memory = library->memory;
     size_t     sfnt_size;
     FT_Error   error  = FT_Err_Ok;
     FT_Memory  memory = library->memory;
-    int        is_cff;
+    int        is_cff, is_sfnt_ps;
 
 
 
 
-    sfnt = GetResource( 'sfnt', sfnt_id );
-    if ( ResError() )
+    sfnt = GetResource( TTAG_sfnt, sfnt_id );
+    if ( sfnt == NULL )
       return FT_Err_Invalid_Handle;
 
     sfnt_size = (FT_ULong)GetHandleSize( sfnt );
       return FT_Err_Invalid_Handle;
 
     sfnt_size = (FT_ULong)GetHandleSize( sfnt );
     ft_memcpy( sfnt_data, *sfnt, sfnt_size );
     ReleaseResource( sfnt );
 
     ft_memcpy( sfnt_data, *sfnt, sfnt_size );
     ReleaseResource( sfnt );
 
-    is_cff = sfnt_size > 4 && sfnt_data[0] == 'O' &&
-                              sfnt_data[1] == 'T' &&
-                              sfnt_data[2] == 'T' &&
-                              sfnt_data[3] == 'O';
+    is_cff     = sfnt_size > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
+    is_sfnt_ps = sfnt_size > 4 && !ft_memcmp( sfnt_data, "typ1", 4 );
 
 
-    return open_face_from_buffer( library,
-                                  sfnt_data,
-                                  sfnt_size,
-                                  face_index,
-                                  is_cff ? "cff" : "truetype",
-                                  aface );
+    if ( is_sfnt_ps )
+    {
+      FT_Stream  stream;
+
+
+      if ( FT_NEW( stream ) )
+        goto Try_OpenType;
+
+      FT_Stream_OpenMemory( stream, sfnt_data, sfnt_size );
+      if ( !open_face_PS_from_sfnt_stream( library,
+                                           stream,
+                                           face_index,
+                                           0, NULL,
+                                           aface ) )
+      {
+        FT_Stream_Close( stream );
+        FT_FREE( stream );
+        FT_FREE( sfnt_data );
+        goto Exit;
+      }
+
+      FT_FREE( stream );
+    }
+  Try_OpenType:
+    error = open_face_from_buffer( library,
+                                   sfnt_data,
+                                   sfnt_size,
+                                   face_index,
+                                   is_cff ? "cff" : "truetype",
+                                   aface );
+  Exit:
+    return error;
   }
 
 
   }
 
 
-  /* Create a new FT_Face from a file spec to a suitcase file. */
+  /* Create a new FT_Face from a file path to a suitcase file. */
   static FT_Error
   FT_New_Face_From_Suitcase( FT_Library    library,
                              const UInt8*  pathname,
                              FT_Long       face_index,
                              FT_Face*      aface )
   {
   static FT_Error
   FT_New_Face_From_Suitcase( FT_Library    library,
                              const UInt8*  pathname,
                              FT_Long       face_index,
                              FT_Face*      aface )
   {
-    FT_Error  error = FT_Err_Cannot_Open_Resource;
-    short     res_ref, res_index;
-    Handle    fond;
-    short     num_faces_in_res, num_faces_in_fond;
+    FT_Error       error = FT_Err_Cannot_Open_Resource;
+    ResFileRefNum  res_ref;
+    ResourceIndex  res_index;
+    Handle         fond;
+    short          num_faces_in_res, num_faces_in_fond;
 
 
     if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
 
 
     if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
     num_faces_in_res = 0;
     for ( res_index = 1; ; ++res_index )
     {
     num_faces_in_res = 0;
     for ( res_index = 1; ; ++res_index )
     {
-      fond = Get1IndResource( 'FOND', res_index );
+      fond = Get1IndResource( TTAG_FOND, res_index );
       if ( ResError() )
         break;
 
       if ( ResError() )
         break;
 
     }
 
     CloseResFile( res_ref );
     }
 
     CloseResFile( res_ref );
-    if ( FT_Err_Ok == error && NULL != aface )
+    if ( FT_Err_Ok == error && NULL != aface && NULL != *aface )
       (*aface)->num_faces = num_faces_in_res;
     return error;
   }
       (*aface)->num_faces = num_faces_in_res;
     return error;
   }
                          FT_Long     face_index,
                          FT_Face*    aface )
   {
                          FT_Long     face_index,
                          FT_Face*    aface )
   {
-    short     sfnt_id, have_sfnt, have_lwfn = 0;
-    short     fond_id;
+    short     have_sfnt, have_lwfn = 0;
+    ResID     sfnt_id, fond_id;
     OSType    fond_type;
     Str255    fond_name;
     Str255    lwfn_file_name;
     OSType    fond_type;
     Str255    fond_name;
     Str255    lwfn_file_name;
-    UInt8     path_lwfn[HFS_MAXPATHLEN];
+    UInt8     path_lwfn[PATH_MAX];
     OSErr     err;
     FT_Error  error = FT_Err_Ok;
 
 
     GetResInfo( fond, &fond_id, &fond_type, fond_name );
     OSErr     err;
     FT_Error  error = FT_Err_Ok;
 
 
     GetResInfo( fond, &fond_id, &fond_type, fond_name );
-    if ( ResError() != noErr || fond_type != 'FOND' )
+    if ( ResError() != noErr || fond_type != TTAG_FOND )
       return FT_Err_Invalid_File_Format;
 
     parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
 
     if ( lwfn_file_name[0] )
     {
       return FT_Err_Invalid_File_Format;
 
     parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
 
     if ( lwfn_file_name[0] )
     {
-      short  res;
+      ResFileRefNum  res;
 
 
       res = HomeResFile( fond );
 
 
       res = HomeResFile( fond );
         goto found_no_lwfn_file;
 
       {
         goto found_no_lwfn_file;
 
       {
-        UInt8  path_fond[HFS_MAXPATHLEN];
+        UInt8  path_fond[PATH_MAX];
         FSRef  ref;
 
 
         FSRef  ref;
 
 
 
     /* LWFN is a (very) specific file format, check for it explicitly */
     file_type = get_file_type_from_path( pathname );
 
     /* LWFN is a (very) specific file format, check for it explicitly */
     file_type = get_file_type_from_path( pathname );
-    if ( file_type == 'LWFN' )
+    if ( file_type == TTAG_LWFN )
       return FT_New_Face_From_LWFN( library, pathname, face_index, aface );
 
     /* Otherwise the file type doesn't matter (there are more than  */
       return FT_New_Face_From_LWFN( library, pathname, face_index, aface );
 
     /* Otherwise the file type doesn't matter (there are more than  */
   /*    FT_New_Face_From_FSRef is identical to FT_New_Face except it       */
   /*    accepts an FSRef instead of a path.                                */
   /*                                                                       */
   /*    FT_New_Face_From_FSRef is identical to FT_New_Face except it       */
   /*    accepts an FSRef instead of a path.                                */
   /*                                                                       */
+  /* This function is deprecated because Carbon data types (FSRef)         */
+  /* are not cross-platform, and thus not suitable for the freetype API.   */
   FT_EXPORT_DEF( FT_Error )
   FT_New_Face_From_FSRef( FT_Library    library,
                           const FSRef*  ref,
   FT_EXPORT_DEF( FT_Error )
   FT_New_Face_From_FSRef( FT_Library    library,
                           const FSRef*  ref,
     FT_Error      error;
     FT_Open_Args  args;
     OSErr   err;
     FT_Error      error;
     FT_Open_Args  args;
     OSErr   err;
-    UInt8   pathname[HFS_MAXPATHLEN];
+    UInt8   pathname[PATH_MAX];
 
 
     if ( !ref )
 
 
     if ( !ref )
   /*    FT_New_Face_From_FSSpec is identical to FT_New_Face except it      */
   /*    accepts an FSSpec instead of a path.                               */
   /*                                                                       */
   /*    FT_New_Face_From_FSSpec is identical to FT_New_Face except it      */
   /*    accepts an FSSpec instead of a path.                               */
   /*                                                                       */
+  /* This function is deprecated because FSSpec is deprecated in Mac OS X  */
   FT_EXPORT_DEF( FT_Error )
   FT_New_Face_From_FSSpec( FT_Library     library,
                            const FSSpec*  spec,
                            FT_Long        face_index,
                            FT_Face*       aface )
   {
   FT_EXPORT_DEF( FT_Error )
   FT_New_Face_From_FSSpec( FT_Library     library,
                            const FSSpec*  spec,
                            FT_Long        face_index,
                            FT_Face*       aface )
   {
-#if __LP64__
+#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
+      ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
     FT_UNUSED( library );
     FT_UNUSED( spec );
     FT_UNUSED( face_index );
     FT_UNUSED( library );
     FT_UNUSED( spec );
     FT_UNUSED( face_index );
index 586d5e8..0307729 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Multiple Master font support (body).                                 */
 /*                                                                         */
 /*                                                                         */
 /*    Multiple Master font support (body).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001, 2003, 2004 by                                     */
+/*  Copyright 1996-2001, 2003, 2004, 2009 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -52,7 +52,7 @@
                               *aservice,
                               MULTI_MASTERS );
 
                               *aservice,
                               MULTI_MASTERS );
 
-      if ( aservice )
+      if ( *aservice )
         error = FT_Err_Ok;
     }
 
         error = FT_Err_Ok;
     }
 
index fa08094..421540c 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (body).                            */
 /*                                                                         */
 /*                                                                         */
 /*    The FreeType private base classes (body).                            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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 FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H    /* for SFNT_Load_Table_Func */
 #include FT_TRUETYPE_TABLES_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H    /* for SFNT_Load_Table_Func */
 #include FT_TRUETYPE_TABLES_H
+#include FT_TRUETYPE_TAGS_H
 #include FT_TRUETYPE_IDS_H
 #include FT_OUTLINE_H
 
 #include FT_TRUETYPE_IDS_H
 #include FT_OUTLINE_H
 
 #include FT_SERVICE_KERNING_H
 #include FT_SERVICE_TRUETYPE_ENGINE_H
 
 #include FT_SERVICE_KERNING_H
 #include FT_SERVICE_TRUETYPE_ENGINE_H
 
+#include "ftbase.h"
+
 #define GRID_FIT_METRICS
 
 #define GRID_FIT_METRICS
 
+
   FT_BASE_DEF( FT_Pointer )
   ft_service_list_lookup( FT_ServiceDesc  service_descriptors,
                           const char*     service_id )
   FT_BASE_DEF( FT_Pointer )
   ft_service_list_lookup( FT_ServiceDesc  service_descriptors,
                           const char*     service_id )
     FT_Stream  stream;
 
 
     FT_Stream  stream;
 
 
+    *astream = 0;
+
     if ( !library )
       return FT_Err_Invalid_Library_Handle;
 
     if ( !args )
       return FT_Err_Invalid_Argument;
 
     if ( !library )
       return FT_Err_Invalid_Library_Handle;
 
     if ( !args )
       return FT_Err_Invalid_Argument;
 
-    *astream = 0;
     memory   = library->memory;
 
     if ( FT_NEW( stream ) )
     memory   = library->memory;
 
     if ( FT_NEW( stream ) )
   }
 
 
   }
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* 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_objs
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_objs
 
   FT_BASE_DEF( void )
   ft_glyphslot_free_bitmap( FT_GlyphSlot  slot )
   {
   FT_BASE_DEF( void )
   ft_glyphslot_free_bitmap( FT_GlyphSlot  slot )
   {
-    if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
+    if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
     {
       FT_Memory  memory = FT_FACE_MEMORY( slot->face );
 
     {
       FT_Memory  memory = FT_FACE_MEMORY( slot->face );
 
     /* free bitmap buffer if needed */
     ft_glyphslot_free_bitmap( slot );
 
     /* free bitmap buffer if needed */
     ft_glyphslot_free_bitmap( slot );
 
-    /* free glyph loader */
-    if ( FT_DRIVER_USES_OUTLINES( driver ) )
+    /* slot->internal might be NULL in out-of-memory situations */
+    if ( slot->internal )
     {
     {
-      FT_GlyphLoader_Done( slot->internal->loader );
-      slot->internal->loader = 0;
-    }
+      /* free glyph loader */
+      if ( FT_DRIVER_USES_OUTLINES( driver ) )
+      {
+        FT_GlyphLoader_Done( slot->internal->loader );
+        slot->internal->loader = 0;
+      }
 
 
-    FT_FREE( slot->internal );
+      FT_FREE( slot->internal );
+    }
   }
 
 
   }
 
 
     FT_Driver     driver;
     FT_GlyphSlot  slot;
     FT_Library    library;
     FT_Driver     driver;
     FT_GlyphSlot  slot;
     FT_Library    library;
-    FT_Bool       autohint = 0;
+    FT_Bool       autohint = FALSE;
     FT_Module     hinter;
 
 
     FT_Module     hinter;
 
 
      * Determine whether we need to auto-hint or not.
      * The general rules are:
      *
      * Determine whether we need to auto-hint or not.
      * The general rules are:
      *
-     * - Do only auto-hinting if we have a hinter module,
-     *   a scalable font format dealing with outlines,
-     *   and no transforms except simple slants.
+     * - Do only auto-hinting if we have a hinter module, a scalable font
+     *   format dealing with outlines, and no transforms except simple
+     *   slants and/or rotations by integer multiples of 90 degrees.
      *
      *
-     * - Then, autohint if FT_LOAD_FORCE_AUTOHINT is set
-     *   or if we don't have a native font hinter.
+     * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't
+     *   have a native font hinter.
      *
      * - Otherwise, auto-hint for LIGHT hinting mode.
      *
      *
      * - Otherwise, auto-hint for LIGHT hinting mode.
      *
-     * - Exception: The font requires the unpatented
-     *   bytecode interpreter to load properly.
+     * - Exception: The font is `tricky' and requires the native hinter to
+     *   load properly.
      */
 
      */
 
-    autohint = 0;
-    if ( hinter                                    &&
-         ( load_flags & FT_LOAD_NO_HINTING  ) == 0 &&
-         ( load_flags & FT_LOAD_NO_AUTOHINT ) == 0 &&
-         FT_DRIVER_IS_SCALABLE( driver )           &&
-         FT_DRIVER_USES_OUTLINES( driver )         &&
-         face->internal->transform_matrix.yy > 0   &&
-         face->internal->transform_matrix.yx == 0  )
-    {
-      if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) != 0 ||
-           !FT_DRIVER_HAS_HINTER( driver )              )
-        autohint = 1;
+    if ( hinter                                           &&
+         !( load_flags & FT_LOAD_NO_HINTING )             &&
+         !( load_flags & FT_LOAD_NO_AUTOHINT )            &&
+         FT_DRIVER_IS_SCALABLE( driver )                  &&
+         FT_DRIVER_USES_OUTLINES( driver )                &&
+         !FT_IS_TRICKY( face )                            &&
+         ( ( face->internal->transform_matrix.yx == 0 &&
+             face->internal->transform_matrix.xx != 0 ) ||
+           ( face->internal->transform_matrix.xx == 0 &&
+             face->internal->transform_matrix.yx != 0 ) ) )
+    {
+      if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ||
+           !FT_DRIVER_HAS_HINTER( driver )         )
+        autohint = TRUE;
       else
       {
         FT_Render_Mode  mode = FT_LOAD_TARGET_MODE( load_flags );
       else
       {
         FT_Render_Mode  mode = FT_LOAD_TARGET_MODE( load_flags );
 
         if ( mode == FT_RENDER_MODE_LIGHT             ||
              face->internal->ignore_unpatented_hinter )
 
         if ( mode == FT_RENDER_MODE_LIGHT             ||
              face->internal->ignore_unpatented_hinter )
-          autohint = 1;
+          autohint = TRUE;
       }
     }
 
       }
     }
 
           goto Load_Ok;
       }
 
           goto Load_Ok;
       }
 
-      /* load auto-hinted outline */
-      hinting = (FT_AutoHinter_Service)hinter->clazz->module_interface;
+      {
+        FT_Face_Internal  internal        = face->internal;
+        FT_Int            transform_flags = internal->transform_flags;
+
 
 
-      error   = hinting->load_glyph( (FT_AutoHinter)hinter,
-                                     slot, face->size,
-                                     glyph_index, load_flags );
+        /* since the auto-hinter calls FT_Load_Glyph by itself, */
+        /* make sure that glyphs aren't transformed             */
+        internal->transform_flags = 0;
+
+        /* load auto-hinted outline */
+        hinting = (FT_AutoHinter_Service)hinter->clazz->module_interface;
+
+        error   = hinting->load_glyph( (FT_AutoHinter)hinter,
+                                       slot, face->size,
+                                       glyph_index, load_flags );
+
+        internal->transform_flags = transform_flags;
+      }
     }
     else
     {
     }
     else
     {
 
     /* compute the linear advance in 16.16 pixels */
     if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0  &&
 
     /* compute the linear advance in 16.16 pixels */
     if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0  &&
-         ( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
+         ( FT_IS_SCALABLE( face ) )                   )
     {
       FT_Size_Metrics*  metrics = &face->size->metrics;
 
     {
       FT_Size_Metrics*  metrics = &face->size->metrics;
 
   /*    are limited to the BMP (said UCS-2 encoding.)                      */
   /*                                                                       */
   /*    This function is called from open_face() (just below), and also    */
   /*    are limited to the BMP (said UCS-2 encoding.)                      */
   /*                                                                       */
   /*    This function is called from open_face() (just below), and also    */
-  /*    from FT_Select_Charmap( ..., FT_ENCODING_UNICODE).                 */
+  /*    from FT_Select_Charmap( ..., FT_ENCODING_UNICODE ).                */
   /*                                                                       */
   static FT_Error
   find_unicode_charmap( FT_Face  face )
   {
     FT_CharMap*  first;
     FT_CharMap*  cur;
   /*                                                                       */
   static FT_Error
   find_unicode_charmap( FT_Face  face )
   {
     FT_CharMap*  first;
     FT_CharMap*  cur;
-    FT_CharMap*  unicmap = NULL;  /* some UCS-2 map, if we found it */
 
 
     /* caller should have already checked that `face' is valid */
 
 
     /* caller should have already checked that `face' is valid */
     {
       if ( cur[0]->encoding == FT_ENCODING_UNICODE )
       {
     {
       if ( cur[0]->encoding == FT_ENCODING_UNICODE )
       {
-        unicmap = cur;  /* record we found a Unicode charmap */
-
-        /* XXX If some new encodings to represent UCS-4 are added,  */
-        /*     they should be added here.                           */
+        /* XXX If some new encodings to represent UCS-4 are added, */
+        /*     they should be added here.                          */
         if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
         if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
-               cur[0]->encoding_id == TT_MS_ID_UCS_4        )          ||
+               cur[0]->encoding_id == TT_MS_ID_UCS_4        )     ||
              ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
              ( 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! */
+               cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32    ) )
         {
           face->charmap = cur[0];
         {
           face->charmap = cur[0];
-          return 0;
+          return FT_Err_Ok;
         }
       }
     }
 
         }
       }
     }
 
-    /* We do not have any UCS-4 charmap.  Sigh.                         */
-    /* Let's see if we have some other kind of Unicode charmap, though. */
-    if ( unicmap != NULL )
+    /* We do not have any UCS-4 charmap.                */
+    /* Do the loop again and search for UCS-2 charmaps. */
+    cur = first + face->num_charmaps;
+
+    for ( ; --cur >= first; )
     {
     {
-      face->charmap = unicmap[0];
-      return 0;
+      if ( cur[0]->encoding == FT_ENCODING_UNICODE )
+      {
+        face->charmap = cur[0];
+        return FT_Err_Ok;
+      }
     }
 
     }
 
-    /* Chou blanc! */
     return FT_Err_Invalid_CharMap_Handle;
   }
 
 
     return FT_Err_Invalid_CharMap_Handle;
   }
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    find_variant_selector_charmap                                      */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    This function finds the variant selector charmap, if there is one. */
+  /*    There can only be one (platform=0, specific=5, format=14).         */
+  /*                                                                       */
+  static FT_CharMap
+  find_variant_selector_charmap( FT_Face  face )
+  {
+    FT_CharMap*  first;
+    FT_CharMap*  end;
+    FT_CharMap*  cur;
+
+
+    /* caller should have already checked that `face' is valid */
+    FT_ASSERT( face );
+
+    first = face->charmaps;
+
+    if ( !first )
+      return NULL;
+
+    end = first + face->num_charmaps;  /* points after the last one */
+
+    for ( cur = first; cur < end; ++cur )
+    {
+      if ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE    &&
+           cur[0]->encoding_id == TT_APPLE_ID_VARIANT_SELECTOR &&
+           FT_Get_CMap_Format( cur[0] ) == 14                  )
+        return cur[0];
+    }
+
+    return NULL;
+  }
+
+
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
       for ( i = 0; i < num_params && !face->internal->incremental_interface;
             i++ )
         if ( params[i].tag == FT_PARAM_TAG_INCREMENTAL )
       for ( i = 0; i < num_params && !face->internal->incremental_interface;
             i++ )
         if ( params[i].tag == FT_PARAM_TAG_INCREMENTAL )
-          face->internal->incremental_interface = params[i].data;
+          face->internal->incremental_interface =
+            (FT_Incremental_Interface)params[i].data;
     }
 #endif
 
     }
 #endif
 
-    error = clazz->init_face( stream,
-                              face,
-                              (FT_Int)face_index,
-                              num_params,
-                              params );
+    if ( clazz->init_face )
+      error = clazz->init_face( stream,
+                                face,
+                                (FT_Int)face_index,
+                                num_params,
+                                params );
     if ( error )
       goto Fail;
 
     if ( error )
       goto Fail;
 
     if ( error )
     {
       destroy_charmaps( face, memory );
     if ( error )
     {
       destroy_charmaps( face, memory );
-      clazz->done_face( face );
+      if ( clazz->done_face )
+        clazz->done_face( face );
       FT_FREE( internal );
       FT_FREE( face );
       *aface = 0;
       FT_FREE( internal );
       FT_FREE( face );
       *aface = 0;
   /* there's a Mac-specific extended implementation of FT_New_Face() */
   /* in src/base/ftmac.c                                             */
 
   /* there's a Mac-specific extended implementation of FT_New_Face() */
   /* in src/base/ftmac.c                                             */
 
-#ifndef FT_MACINTOSH
+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
 
   /* documentation is in freetype.h */
 
 
   /* documentation is in freetype.h */
 
 
     args.flags    = FT_OPEN_PATHNAME;
     args.pathname = (char*)pathname;
 
     args.flags    = FT_OPEN_PATHNAME;
     args.pathname = (char*)pathname;
+    args.stream   = NULL;
 
     return FT_Open_Face( library, &args, face_index, aface );
   }
 
 
     return FT_Open_Face( library, &args, face_index, aface );
   }
 
-#endif  /* !FT_MACINTOSH */
+#endif  /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */
 
 
   /* documentation is in freetype.h */
 
 
   /* documentation is in freetype.h */
     args.flags       = FT_OPEN_MEMORY;
     args.memory_base = file_base;
     args.memory_size = file_size;
     args.flags       = FT_OPEN_MEMORY;
     args.memory_base = file_base;
     args.memory_size = file_size;
+    args.stream      = NULL;
 
     return FT_Open_Face( library, &args, face_index, aface );
   }
 
 
 
     return FT_Open_Face( library, &args, face_index, aface );
   }
 
 
-#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
 
   /* The behavior here is very similar to that in base/ftmac.c, but it     */
   /* is designed to work on non-mac systems, so no mac specific calls.     */
 
   /* The behavior here is very similar to that in base/ftmac.c, but it     */
   /* is designed to work on non-mac systems, so no mac specific calls.     */
   /* we don't really have access to it.                                    */
 
 
   /* we don't really have access to it.                                    */
 
 
-  /* Finalizer for a memory stream; gets called by FT_Done_Face().
-     It frees the memory it uses. */
-  /* from ftmac.c */
+  /* Finalizer for a memory stream; gets called by FT_Done_Face(). */
+  /* It frees the memory it uses.                                  */
+  /* From ftmac.c.                                                 */
   static void
   memory_stream_close( FT_Stream  stream )
   {
   static void
   memory_stream_close( FT_Stream  stream )
   {
 
 
   /* Create a new memory stream from a buffer and a size. */
 
 
   /* Create a new memory stream from a buffer and a size. */
-  /* from ftmac.c */
+  /* From ftmac.c.                                        */
   static FT_Error
   new_memory_stream( FT_Library           library,
                      FT_Byte*             base,
   static FT_Error
   new_memory_stream( FT_Library           library,
                      FT_Byte*             base,
 
   /* Create a new FT_Face given a buffer and a driver name. */
   /* from ftmac.c */
 
   /* Create a new FT_Face given a buffer and a driver name. */
   /* from ftmac.c */
-  static FT_Error
+  FT_LOCAL_DEF( FT_Error )
   open_face_from_buffer( FT_Library   library,
                          FT_Byte*     base,
                          FT_ULong     size,
   open_face_from_buffer( FT_Library   library,
                          FT_Byte*     base,
                          FT_ULong     size,
       args.driver = FT_Get_Module( library, driver_name );
     }
 
       args.driver = FT_Get_Module( library, driver_name );
     }
 
+#ifdef FT_MACINTOSH
+    /* 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;
+#endif
+
     error = FT_Open_Face( library, &args, face_index, aface );
 
     if ( error == FT_Err_Ok )
       (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
     else
     error = FT_Open_Face( library, &args, face_index, aface );
 
     if ( error == FT_Err_Ok )
       (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
     else
+#ifdef FT_MACINTOSH
+      FT_Stream_Free( stream, 0 );
+#else
     {
       FT_Stream_Close( stream );
       FT_FREE( stream );
     }
     {
       FT_Stream_Close( stream );
       FT_FREE( stream );
     }
+#endif
 
     return error;
   }
 
 
 
     return error;
   }
 
 
+  /* Look up `TYP1' or `CID ' table from sfnt table directory.       */
+  /* `offset' and `length' must exclude the binary header in tables. */
+
+  /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */
+  /* format too.  Here, since we can't expect that the TrueType font */
+  /* driver is loaded unconditially, we must parse the font by       */
+  /* ourselves.  We are only interested in the name of the table and */
+  /* the offset.                                                     */
+
+  static FT_Error
+  ft_lookup_PS_in_sfnt_stream( FT_Stream  stream,
+                               FT_Long    face_index,
+                               FT_ULong*  offset,
+                               FT_ULong*  length,
+                               FT_Bool*   is_sfnt_cid )
+  {
+    FT_Error   error;
+    FT_UShort  numTables;
+    FT_Long    pstable_index;
+    FT_ULong   tag;
+    int        i;
+
+
+    *offset = 0;
+    *length = 0;
+    *is_sfnt_cid = FALSE;
+
+    /* TODO: support for sfnt-wrapped PS/CID in TTC format */
+
+    /* version check for 'typ1' (should be ignored?) */
+    if ( FT_READ_ULONG( tag ) )
+      return error;
+    if ( tag != TTAG_typ1 )
+      return FT_Err_Unknown_File_Format;
+
+    if ( FT_READ_USHORT( numTables ) )
+      return error;
+    if ( FT_STREAM_SKIP( 2 * 3 ) ) /* skip binary search header */
+      return error;
+
+    pstable_index = -1;
+    *is_sfnt_cid  = FALSE;
+
+    for ( i = 0; i < numTables; i++ )
+    {
+      if ( FT_READ_ULONG( tag )     || FT_STREAM_SKIP( 4 )      ||
+           FT_READ_ULONG( *offset ) || FT_READ_ULONG( *length ) )
+        return error;
+
+      if ( tag == TTAG_CID )
+      {
+        pstable_index++;
+        *offset += 22;
+        *length -= 22;
+        *is_sfnt_cid = TRUE;
+        if ( face_index < 0 )
+          return FT_Err_Ok;
+      }
+      else if ( tag == TTAG_TYP1 )
+      {
+        pstable_index++;
+        *offset += 24;
+        *length -= 24;
+        *is_sfnt_cid = FALSE;
+        if ( face_index < 0 )
+          return FT_Err_Ok;
+      }
+      if ( face_index >= 0 && pstable_index == face_index )
+        return FT_Err_Ok;
+    }
+    return FT_Err_Table_Missing;
+  }
+
+
+  FT_LOCAL_DEF( FT_Error )
+  open_face_PS_from_sfnt_stream( FT_Library     library,
+                                 FT_Stream      stream,
+                                 FT_Long        face_index,
+                                 FT_Int         num_params,
+                                 FT_Parameter  *params,
+                                 FT_Face       *aface )
+  {
+    FT_Error   error;
+    FT_Memory  memory = library->memory;
+    FT_ULong   offset, length;
+    FT_Long    pos;
+    FT_Bool    is_sfnt_cid;
+    FT_Byte*   sfnt_ps;
+
+    FT_UNUSED( num_params );
+    FT_UNUSED( params );
+
+
+    pos = FT_Stream_Pos( stream );
+
+    error = ft_lookup_PS_in_sfnt_stream( stream,
+                                         face_index,
+                                         &offset,
+                                         &length,
+                                         &is_sfnt_cid );
+    if ( error )
+      goto Exit;
+
+    if ( FT_Stream_Seek( stream, pos + offset ) )
+      goto Exit;
+
+    if ( FT_ALLOC( sfnt_ps, (FT_Long)length ) )
+      goto Exit;
+
+    error = FT_Stream_Read( stream, (FT_Byte *)sfnt_ps, length );
+    if ( error )
+      goto Exit;
+
+    error = open_face_from_buffer( library,
+                                   sfnt_ps,
+                                   length,
+                                   face_index < 0 ? face_index : 0,
+                                   is_sfnt_cid ? "cid" : "type1",
+                                   aface );
+  Exit:
+    {
+      FT_Error  error1;
+
+
+      if ( error == FT_Err_Unknown_File_Format )
+      {
+        error1 = FT_Stream_Seek( stream, pos );
+        if ( error1 )
+          return error1;
+      }
+
+      return error;
+    }
+  }
+
+
+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
+
   /* The resource header says we've got resource_cnt `POST' (type1) */
   /* resources in this file.  They all need to be coalesced into    */
   /* one lump which gets passed on to the type1 driver.             */
   /* The resource header says we've got resource_cnt `POST' (type1) */
   /* resources in this file.  They all need to be coalesced into    */
   /* one lump which gets passed on to the type1 driver.             */
     if ( rlen == -1 )
       return FT_Err_Cannot_Open_Resource;
 
     if ( rlen == -1 )
       return FT_Err_Cannot_Open_Resource;
 
+    error = open_face_PS_from_sfnt_stream( library,
+                                           stream,
+                                           face_index,
+                                           0, NULL,
+                                           aface );
+    if ( !error )
+      goto Exit;
+
+    /* rewind sfnt stream before open_face_PS_from_sfnt_stream() */
+    if ( FT_Stream_Seek( stream, flag_offset + 4 ) )
+      goto Exit;
+
     if ( FT_ALLOC( sfnt_data, (FT_Long)rlen ) )
       return error;
     error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, rlen );
     if ( error )
       goto Exit;
 
     if ( FT_ALLOC( sfnt_data, (FT_Long)rlen ) )
       return error;
     error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, rlen );
     if ( error )
       goto Exit;
 
-    is_cff = rlen > 4 && sfnt_data[0] == 'O' &&
-                         sfnt_data[1] == 'T' &&
-                         sfnt_data[2] == 'T' &&
-                         sfnt_data[3] == 'O';
-
+    is_cff = rlen > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
     error = open_face_from_buffer( library,
                                    sfnt_data,
                                    rlen,
     error = open_face_from_buffer( library,
                                    sfnt_data,
                                    rlen,
 
     error = FT_Raccess_Get_DataOffsets( library, stream,
                                         map_offset, rdara_pos,
 
     error = FT_Raccess_Get_DataOffsets( library, stream,
                                         map_offset, rdara_pos,
-                                        FT_MAKE_TAG( 'P', 'O', 'S', 'T' ),
+                                        TTAG_POST,
                                         &data_offsets, &count );
     if ( !error )
     {
                                         &data_offsets, &count );
     if ( !error )
     {
 
     error = FT_Raccess_Get_DataOffsets( library, stream,
                                         map_offset, rdara_pos,
 
     error = FT_Raccess_Get_DataOffsets( library, stream,
                                         map_offset, rdara_pos,
-                                        FT_MAKE_TAG( 's', 'f', 'n', 't' ),
+                                        TTAG_sfnt,
                                         &data_offsets, &count );
     if ( !error )
     {
                                         &data_offsets, &count );
     if ( !error )
     {
     FT_Long        dlen, offset;
 
 
     FT_Long        dlen, offset;
 
 
+    if ( NULL == stream )
+      return FT_Err_Invalid_Stream_Operation;
+
     error = FT_Stream_Seek( stream, 0 );
     if ( error )
       goto Exit;
     error = FT_Stream_Seek( stream, 0 );
     if ( error )
       goto Exit;
     FT_Error   errors[FT_RACCESS_N_RULES];
 
     FT_Open_Args  args2;
     FT_Error   errors[FT_RACCESS_N_RULES];
 
     FT_Open_Args  args2;
-    FT_Stream     stream2;
+    FT_Stream     stream2 = 0;
 
 
     FT_Raccess_Guess( library, stream,
 
 
     FT_Raccess_Guess( library, stream,
   }
 
 
   }
 
 
-  /* Check for some macintosh formats.                             */
+  /* Check for some macintosh formats without Carbon framework.    */
   /* 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)                 */
   /* 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)                 */
                                            face_index, aface, args );
     return error;
   }
                                            face_index, aface, args );
     return error;
   }
+#endif
 
 #endif  /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
 
 
 #endif  /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
 
     FT_Error     error;
     FT_Driver    driver;
     FT_Memory    memory;
     FT_Error     error;
     FT_Driver    driver;
     FT_Memory    memory;
-    FT_Stream    stream;
+    FT_Stream    stream = 0;
     FT_Face      face = 0;
     FT_ListNode  node = 0;
     FT_Bool      external_stream;
     FT_Face      face = 0;
     FT_ListNode  node = 0;
     FT_Bool      external_stream;
+    FT_Module*   cur;
+    FT_Module*   limit;
 
 
     /* test for valid `library' delayed to */
 
 
     /* test for valid `library' delayed to */
     /* create input stream */
     error = FT_Stream_New( library, args, &stream );
     if ( error )
     /* create input stream */
     error = FT_Stream_New( library, args, &stream );
     if ( error )
-      goto Exit;
+      goto Fail3;
 
     memory = library->memory;
 
 
     memory = library->memory;
 
     else
     {
       /* check each font driver for an appropriate format */
     else
     {
       /* check each font driver for an appropriate format */
-      FT_Module*  cur   = library->modules;
-      FT_Module*  limit = cur + library->num_modules;
+      cur   = library->modules;
+      limit = cur + library->num_modules;
 
 
       for ( ; cur < limit; cur++ )
 
 
       for ( ; cur < limit; cur++ )
           if ( !error )
             goto Success;
 
           if ( !error )
             goto Success;
 
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
+          if ( ft_strcmp( cur[0]->clazz->module_name, "truetype" ) == 0 &&
+               FT_ERROR_BASE( error ) == FT_Err_Table_Missing           )
+          {
+            /* TrueType but essential tables are missing */
+            if ( FT_Stream_Seek( stream, 0 ) )
+              break;
+
+            error = open_face_PS_from_sfnt_stream( library,
+                                                   stream,
+                                                   face_index,
+                                                   num_params,
+                                                   params,
+                                                   aface );
+            if ( !error )
+            {
+              FT_Stream_Free( stream, external_stream );
+              return error;
+            }
+          }
+#endif
+
           if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
             goto Fail3;
         }
           if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
             goto Fail3;
         }
     /* If we are on the mac, and we get an FT_Err_Invalid_Stream_Operation */
     /* it may be because we have an empty data fork, so we need to check   */
     /* the resource fork.                                                  */
     /* If we are on the mac, and we get an FT_Err_Invalid_Stream_Operation */
     /* it may be because we have an empty data fork, so we need to check   */
     /* the resource fork.                                                  */
-    if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format      &&
+    if ( FT_ERROR_BASE( error ) != FT_Err_Cannot_Open_Stream       &&
+         FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format      &&
          FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation )
       goto Fail2;
 
          FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation )
       goto Fail2;
 
   ft_synthesize_vertical_metrics( FT_Glyph_Metrics*  metrics,
                                   FT_Pos             advance )
   {
   ft_synthesize_vertical_metrics( FT_Glyph_Metrics*  metrics,
                                   FT_Pos             advance )
   {
+    FT_Pos  height = metrics->height;
+
+
+    /* compensate for glyph with bbox above/below the baseline */
+    if ( metrics->horiBearingY < 0 )
+    {
+      if ( height < metrics->horiBearingY )
+        height = metrics->horiBearingY;
+    }
+    else if ( metrics->horiBearingY > 0 )
+      height -= metrics->horiBearingY;
+
     /* the factor 1.2 is a heuristical value */
     if ( !advance )
     /* the factor 1.2 is a heuristical value */
     if ( !advance )
-      advance = metrics->height * 12 / 10;
+      advance = height * 12 / 10;
 
 
-    metrics->vertBearingX = -( metrics->width / 2 );
-    metrics->vertBearingY = ( advance - metrics->height ) / 2;
+    metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2;
+    metrics->vertBearingY = ( advance - height ) / 2;
     metrics->vertAdvance  = advance;
   }
 
     metrics->vertAdvance  = advance;
   }
 
     }
     else
     {
     }
     else
     {
-      metrics->x_scale     = 1L << 22;
-      metrics->y_scale     = 1L << 22;
+      metrics->x_scale     = 1L << 16;
+      metrics->y_scale     = 1L << 16;
       metrics->ascender    = bsize->y_ppem;
       metrics->descender   = 0;
       metrics->height      = bsize->height << 6;
       metrics->ascender    = bsize->y_ppem;
       metrics->descender   = 0;
       metrics->height      = bsize->height << 6;
     else
     {
       FT_ZERO( metrics );
     else
     {
       FT_ZERO( metrics );
-      metrics->x_scale = 1L << 22;
-      metrics->y_scale = 1L << 22;
+      metrics->x_scale = 1L << 16;
+      metrics->y_scale = 1L << 16;
     }
   }
 
     }
   }
 
     cur = face->charmaps;
     if ( !cur )
       return FT_Err_Invalid_CharMap_Handle;
     cur = face->charmaps;
     if ( !cur )
       return FT_Err_Invalid_CharMap_Handle;
+    if ( FT_Get_CMap_Format( charmap ) == 14 )
+      return FT_Err_Invalid_Argument;
 
     limit = cur + face->num_charmaps;
 
 
     limit = cur + face->num_charmaps;
 
       FT_CMap  cmap = FT_CMAP( face->charmap );
 
 
       FT_CMap  cmap = FT_CMAP( face->charmap );
 
 
-      result = cmap->clazz->char_index( cmap, charcode );
+      if ( charcode > 0xFFFFFFFFUL )
+      {
+        FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
+        FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+      }
+      result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode );
     }
     return  result;
   }
     }
     return  result;
   }
   }
 
 
   }
 
 
+  /* documentation is in freetype.h */
+
+  FT_EXPORT_DEF( FT_UInt )
+  FT_Face_GetCharVariantIndex( FT_Face   face,
+                               FT_ULong  charcode,
+                               FT_ULong  variantSelector )
+  {
+    FT_UInt  result = 0;
+
+
+    if ( face && face->charmap &&
+        face->charmap->encoding == FT_ENCODING_UNICODE )
+    {
+      FT_CharMap  charmap = find_variant_selector_charmap( face );
+      FT_CMap     ucmap = FT_CMAP( face->charmap );
+
+
+      if ( charmap != NULL )
+      {
+        FT_CMap  vcmap = FT_CMAP( charmap );
+
+
+        if ( charcode > 0xFFFFFFFFUL )
+        {
+          FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
+          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+        }
+        if ( variantSelector > 0xFFFFFFFFUL )
+        {
+          FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
+          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+        }
+
+        result = vcmap->clazz->char_var_index( vcmap, ucmap,
+                                               (FT_UInt32)charcode,
+                                               (FT_UInt32)variantSelector );
+      }
+    }
+
+    return result;
+  }
+
+
+  /* documentation is in freetype.h */
+
+  FT_EXPORT_DEF( FT_Int )
+  FT_Face_GetCharVariantIsDefault( FT_Face   face,
+                                   FT_ULong  charcode,
+                                   FT_ULong  variantSelector )
+  {
+    FT_Int  result = -1;
+
+
+    if ( face )
+    {
+      FT_CharMap  charmap = find_variant_selector_charmap( face );
+
+
+      if ( charmap != NULL )
+      {
+        FT_CMap  vcmap = FT_CMAP( charmap );
+
+
+        if ( charcode > 0xFFFFFFFFUL )
+        {
+          FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
+          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+        }
+        if ( variantSelector > 0xFFFFFFFFUL )
+        {
+          FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
+          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+        }
+
+        result = vcmap->clazz->char_var_default( vcmap,
+                                                 (FT_UInt32)charcode,
+                                                 (FT_UInt32)variantSelector );
+      }
+    }
+
+    return result;
+  }
+
+
+  /* documentation is in freetype.h */
+
+  FT_EXPORT_DEF( FT_UInt32* )
+  FT_Face_GetVariantSelectors( FT_Face  face )
+  {
+    FT_UInt32  *result = NULL;
+
+
+    if ( face )
+    {
+      FT_CharMap  charmap = find_variant_selector_charmap( face );
+
+
+      if ( charmap != NULL )
+      {
+        FT_CMap    vcmap  = FT_CMAP( charmap );
+        FT_Memory  memory = FT_FACE_MEMORY( face );
+
+
+        result = vcmap->clazz->variant_list( vcmap, memory );
+      }
+    }
+
+    return result;
+  }
+
+
+  /* documentation is in freetype.h */
+
+  FT_EXPORT_DEF( FT_UInt32* )
+  FT_Face_GetVariantsOfChar( FT_Face   face,
+                             FT_ULong  charcode )
+  {
+    FT_UInt32  *result = NULL;
+
+
+    if ( face )
+    {
+      FT_CharMap  charmap = find_variant_selector_charmap( face );
+
+
+      if ( charmap != NULL )
+      {
+        FT_CMap    vcmap  = FT_CMAP( charmap );
+        FT_Memory  memory = FT_FACE_MEMORY( face );
+
+
+        if ( charcode > 0xFFFFFFFFUL )
+        {
+          FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
+          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+        }
+
+        result = vcmap->clazz->charvariant_list( vcmap, memory,
+                                                 (FT_UInt32)charcode );
+      }
+    }
+    return result;
+  }
+
+
+  /* documentation is in freetype.h */
+
+  FT_EXPORT_DEF( FT_UInt32* )
+  FT_Face_GetCharsOfVariant( FT_Face   face,
+                             FT_ULong  variantSelector )
+  {
+    FT_UInt32  *result = NULL;
+
+
+    if ( face )
+    {
+      FT_CharMap  charmap = find_variant_selector_charmap( face );
+
+
+      if ( charmap != NULL )
+      {
+        FT_CMap    vcmap  = FT_CMAP( charmap );
+        FT_Memory  memory = FT_FACE_MEMORY( face );
+
+
+        if ( variantSelector > 0xFFFFFFFFUL )
+        {
+          FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
+          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+        }
+
+        result = vcmap->clazz->variantchar_list( vcmap, memory,
+                                                 (FT_UInt32)variantSelector );
+      }
+    }
+
+    return result;
+  }
+
+
   /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( FT_UInt )
   /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( FT_UInt )
       ((FT_Byte*)buffer)[0] = 0;
 
     if ( face                                     &&
       ((FT_Byte*)buffer)[0] = 0;
 
     if ( face                                     &&
-         glyph_index <= (FT_UInt)face->num_glyphs &&
+         (FT_Long)glyph_index <= face->num_glyphs &&
          FT_HAS_GLYPH_NAMES( face )               )
     {
       FT_Service_GlyphDict  service;
          FT_HAS_GLYPH_NAMES( face )               )
     {
       FT_Service_GlyphDict  service;
                       FT_ULong  *length )
   {
     FT_Service_SFNT_Table  service;
                       FT_ULong  *length )
   {
     FT_Service_SFNT_Table  service;
+    FT_ULong               offset;
 
 
     if ( !face || !FT_IS_SFNT( face ) )
 
 
     if ( !face || !FT_IS_SFNT( face ) )
     if ( service == NULL )
       return FT_Err_Unimplemented_Feature;
 
     if ( service == NULL )
       return FT_Err_Unimplemented_Feature;
 
-    return service->table_info( face, table_index, tag, length );
+    return service->table_info( face, table_index, tag, &offset, length );
   }
 
 
   }
 
 
 
 
     if ( size == NULL )
 
 
     if ( size == NULL )
-      return FT_Err_Bad_Argument;
+      return FT_Err_Invalid_Argument;
 
     face = size->face;
     if ( face == NULL || face->driver == NULL )
 
     face = size->face;
     if ( face == NULL || face->driver == NULL )
-      return FT_Err_Bad_Argument;
+      return FT_Err_Invalid_Argument;
 
     /* we don't need anything more complex than that; all size objects */
     /* are already listed by the face                                  */
 
     /* we don't need anything more complex than that; all size objects */
     /* are already listed by the face                                  */
         while ( renderer )
         {
           error = renderer->render( renderer, slot, render_mode, NULL );
         while ( renderer )
         {
           error = renderer->render( renderer, slot, render_mode, NULL );
-          if ( !error ||
+          if ( !error                                               ||
                FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph )
             break;
 
                FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph )
             break;
 
 
     library->memory = memory;
 
 
     library->memory = memory;
 
+#ifdef FT_CONFIG_OPTION_PIC
+    /* initialize position independent code containers */
+    error = ft_pic_container_init( library );
+    if ( error )
+      goto Fail;
+#endif
+
     /* allocate the render pool */
     library->raster_pool_size = FT_RENDER_POOL_SIZE;
     /* allocate the render pool */
     library->raster_pool_size = FT_RENDER_POOL_SIZE;
-    if ( FT_RENDER_POOL_SIZE > 0 )
-      if ( FT_ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) )
-        goto Fail;
+#if FT_RENDER_POOL_SIZE > 0
+    if ( FT_ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) )
+      goto Fail;
+#endif
+
+    library->version_major = FREETYPE_MAJOR;
+    library->version_minor = FREETYPE_MINOR;
+    library->version_patch = FREETYPE_PATCH;
 
     /* That's ok now */
     *alibrary = library;
 
     /* That's ok now */
     *alibrary = library;
     return FT_Err_Ok;
 
   Fail:
     return FT_Err_Ok;
 
   Fail:
+#ifdef FT_CONFIG_OPTION_PIC
+    ft_pic_container_destroy( library );
+#endif
     FT_FREE( library );
     return error;
   }
     FT_FREE( library );
     return error;
   }
 
         faces = &FT_DRIVER(module)->faces_list;
         while ( faces->head )
 
         faces = &FT_DRIVER(module)->faces_list;
         while ( faces->head )
+        {
           FT_Done_Face( FT_FACE( faces->head->data ) );
           FT_Done_Face( FT_FACE( faces->head->data ) );
+          if ( faces->head )
+            FT_TRACE0(( "FT_Done_Library: failed to free some faces\n" ));
+        }
       }
     }
 
       }
     }
 
     FT_FREE( library->raster_pool );
     library->raster_pool_size = 0;
 
     FT_FREE( library->raster_pool );
     library->raster_pool_size = 0;
 
+#ifdef FT_CONFIG_OPTION_PIC
+    /* Destroy pic container contents */
+    ft_pic_container_destroy( library );
+#endif
+
     FT_FREE( library );
     return FT_Err_Ok;
   }
     FT_FREE( library );
     return FT_Err_Ok;
   }
index b6de6db..20ed686 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for validating OpenType tables (body).                  */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType API for validating OpenType tables (body).                  */
 /*                                                                         */
-/*  Copyright 2004, 2006 by                                                */
+/*  Copyright 2004, 2006, 2008 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,6 +18,7 @@
 #include <ft2build.h>
 #include FT_INTERNAL_OBJECTS_H
 #include FT_SERVICE_OPENTYPE_VALIDATE_H
 #include <ft2build.h>
 #include FT_INTERNAL_OBJECTS_H
 #include FT_SERVICE_OPENTYPE_VALIDATE_H
+#include FT_OPENTYPE_VALIDATE_H
 
 
   /* documentation is in ftotval.h */
 
 
   /* documentation is in ftotval.h */
index 6926f3a..49ef82e 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType outline management (body).                                  */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType outline management (body).                                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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 <ft2build.h>
 #include FT_OUTLINE_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_DEBUG_H
 #include FT_TRIGONOMETRY_H
 
 
 #include FT_TRIGONOMETRY_H
 
 
       FT_Int  last;  /* index of last point in contour */
 
 
       FT_Int  last;  /* index of last point in contour */
 
 
+      FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
+
       last = outline->contours[n];
       if ( last < 0 )
         goto Invalid_Outline;
       limit = outline->points + last;
 
       last = outline->contours[n];
       if ( last < 0 )
         goto Invalid_Outline;
       limit = outline->points + last;
 
-      v_start = outline->points[first];
-      v_last  = outline->points[last];
+      v_start   = outline->points[first];
+      v_start.x = SCALED( v_start.x );
+      v_start.y = SCALED( v_start.y );
 
 
-      v_start.x = SCALED( v_start.x ); v_start.y = SCALED( v_start.y );
-      v_last.x  = SCALED( v_last.x );  v_last.y  = SCALED( v_last.y );
+      v_last   = outline->points[last];
+      v_last.x = SCALED( v_last.x );
+      v_last.y = SCALED( v_last.y );
 
       v_control = v_start;
 
       point = outline->points + first;
 
       v_control = v_start;
 
       point = outline->points + first;
-      tags  = outline->tags  + first;
+      tags  = outline->tags   + first;
       tag   = FT_CURVE_TAG( tags[0] );
 
       /* A contour cannot start with a cubic control point! */
       tag   = FT_CURVE_TAG( tags[0] );
 
       /* A contour cannot start with a cubic control point! */
         tags--;
       }
 
         tags--;
       }
 
+      FT_TRACE5(( "  move to (%.2f, %.2f)\n",
+                  v_start.x / 64.0, v_start.y / 64.0 ));
       error = func_interface->move_to( &v_start, user );
       if ( error )
         goto Exit;
       error = func_interface->move_to( &v_start, user );
       if ( error )
         goto Exit;
             vec.x = SCALED( point->x );
             vec.y = SCALED( point->y );
 
             vec.x = SCALED( point->x );
             vec.y = SCALED( point->y );
 
+            FT_TRACE5(( "  line to (%.2f, %.2f)\n",
+                        vec.x / 64.0, vec.y / 64.0 ));
             error = func_interface->line_to( &vec, user );
             if ( error )
               goto Exit;
             error = func_interface->line_to( &vec, user );
             if ( error )
               goto Exit;
 
             if ( tag == FT_CURVE_TAG_ON )
             {
 
             if ( tag == FT_CURVE_TAG_ON )
             {
+              FT_TRACE5(( "  conic to (%.2f, %.2f)"
+                          " with control (%.2f, %.2f)\n",
+                          vec.x / 64.0, vec.y / 64.0,
+                          v_control.x / 64.0, v_control.y / 64.0 ));
               error = func_interface->conic_to( &v_control, &vec, user );
               if ( error )
                 goto Exit;
               error = func_interface->conic_to( &v_control, &vec, user );
               if ( error )
                 goto Exit;
             v_middle.x = ( v_control.x + vec.x ) / 2;
             v_middle.y = ( v_control.y + vec.y ) / 2;
 
             v_middle.x = ( v_control.x + vec.x ) / 2;
             v_middle.y = ( v_control.y + vec.y ) / 2;
 
+            FT_TRACE5(( "  conic to (%.2f, %.2f)"
+                        " with control (%.2f, %.2f)\n",
+                        v_middle.x / 64.0, v_middle.y / 64.0,
+                        v_control.x / 64.0, v_control.y / 64.0 ));
             error = func_interface->conic_to( &v_control, &v_middle, user );
             if ( error )
               goto Exit;
             error = func_interface->conic_to( &v_control, &v_middle, user );
             if ( error )
               goto Exit;
             goto Do_Conic;
           }
 
             goto Do_Conic;
           }
 
+          FT_TRACE5(( "  conic to (%.2f, %.2f)"
+                      " with control (%.2f, %.2f)\n",
+                      v_start.x / 64.0, v_start.y / 64.0,
+                      v_control.x / 64.0, v_control.y / 64.0 ));
           error = func_interface->conic_to( &v_control, &v_start, user );
           goto Close;
 
           error = func_interface->conic_to( &v_control, &v_start, user );
           goto Close;
 
             point += 2;
             tags  += 2;
 
             point += 2;
             tags  += 2;
 
-            vec1.x = SCALED( point[-2].x ); vec1.y = SCALED( point[-2].y );
-            vec2.x = SCALED( point[-1].x ); vec2.y = SCALED( point[-1].y );
+            vec1.x = SCALED( point[-2].x );
+            vec1.y = SCALED( point[-2].y );
+
+            vec2.x = SCALED( point[-1].x );
+            vec2.y = SCALED( point[-1].y );
 
             if ( point <= limit )
             {
 
             if ( point <= limit )
             {
               vec.x = SCALED( point->x );
               vec.y = SCALED( point->y );
 
               vec.x = SCALED( point->x );
               vec.y = SCALED( point->y );
 
+              FT_TRACE5(( "  cubic to (%.2f, %.2f)"
+                          " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+                          vec.x / 64.0, vec.y / 64.0,
+                          vec1.x / 64.0, vec1.y / 64.0,
+                          vec2.x / 64.0, vec2.y / 64.0 ));
               error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
               if ( error )
                 goto Exit;
               continue;
             }
 
               error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
               if ( error )
                 goto Exit;
               continue;
             }
 
+            FT_TRACE5(( "  cubic to (%.2f, %.2f)"
+                        " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+                        v_start.x / 64.0, v_start.y / 64.0,
+                        vec1.x / 64.0, vec1.y / 64.0,
+                        vec2.x / 64.0, vec2.y / 64.0 ));
             error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
             goto Close;
           }
             error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
             goto Close;
           }
       }
 
       /* close the contour with a line segment */
       }
 
       /* close the contour with a line segment */
+      FT_TRACE5(( "  line to (%.2f, %.2f)\n",
+                  v_start.x / 64.0, v_start.y / 64.0 ));
       error = func_interface->line_to( &v_start, user );
 
     Close:
       error = func_interface->line_to( &v_start, user );
 
     Close:
       first = last + 1;
     }
 
       first = last + 1;
     }
 
-    return 0;
+    FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
+    return FT_Err_Ok;
 
   Exit:
 
   Exit:
+    FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
     return error;
 
   Invalid_Outline:
     return error;
 
   Invalid_Outline:
                         FT_Pos             yOffset )
   {
     FT_UShort   n;
                         FT_Pos             yOffset )
   {
     FT_UShort   n;
-    FT_Vector*  vec = outline->points;
+    FT_Vector*  vec;
 
 
     if ( !outline )
       return;
 
 
 
     if ( !outline )
       return;
 
+    vec = outline->points;
+
     for ( n = 0; n < outline->n_points; n++ )
     {
       vec->x += xOffset;
     for ( n = 0; n < outline->n_points; n++ )
     {
       vec->x += xOffset;
                      FT_Raster_Params*  params )
   {
     FT_Error     error;
                      FT_Raster_Params*  params )
   {
     FT_Error     error;
-    FT_Bool      update = 0;
+    FT_Bool      update = FALSE;
     FT_Renderer  renderer;
     FT_ListNode  node;
 
     FT_Renderer  renderer;
     FT_ListNode  node;
 
       /* format                                                */
       renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE,
                                      &node );
       /* format                                                */
       renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE,
                                      &node );
-      update   = 1;
+      update   = TRUE;
     }
 
     /* if we changed the current renderer for the glyph image format */
     }
 
     /* if we changed the current renderer for the glyph image format */
   }
 
 
   }
 
 
-  /* documentation is in ftoutln.h */
+  /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( void )
   FT_Vector_Transform( FT_Vector*        vector,
                        const FT_Matrix*  matrix )
   {
 
   FT_EXPORT_DEF( void )
   FT_Vector_Transform( FT_Vector*        vector,
                        const FT_Matrix*  matrix )
   {
-    FT_Pos xz, yz;
+    FT_Pos  xz, yz;
 
 
     if ( !vector || !matrix )
 
 
     if ( !vector || !matrix )
       }
     }
 
       }
     }
 
-    if ( xmin == 32768 )
+    if ( xmin == 32768L )
       return FT_ORIENTATION_TRUETYPE;
 
     ray_y[0] = ( xmin_ymin * 3 + xmin_ymax     ) >> 2;
       return FT_ORIENTATION_TRUETYPE;
 
     ray_y[0] = ( xmin_ymin * 3 + xmin_ymax     ) >> 2;
index d63f191..236d9a6 100644 (file)
@@ -5,7 +5,7 @@
 /*    FreeType API for checking patented TrueType bytecode instructions    */
 /*    (body).                                                              */
 /*                                                                         */
 /*    FreeType API for checking patented TrueType bytecode instructions    */
 /*    (body).                                                              */
 /*                                                                         */
-/*  Copyright 2007 by David Turner.                                        */
+/*  Copyright 2007, 2008 by David Turner.                                  */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
     }
 
   Exit:
     }
 
   Exit:
+    FT_UNUSED( error );
     FT_FRAME_EXIT();
     return result;
   }
     FT_FRAME_EXIT();
     return result;
   }
                               FT_ULong  tag )
   {
     FT_Stream              stream = face->stream;
                               FT_ULong  tag )
   {
     FT_Stream              stream = face->stream;
-    FT_Error               error;
+    FT_Error               error = FT_Err_Ok;
     FT_Service_SFNT_Table  service;
     FT_Bool                result = FALSE;
 
     FT_Service_SFNT_Table  service;
     FT_Bool                result = FALSE;
 
 
     if ( service )
     {
 
     if ( service )
     {
-      FT_ULong  offset, size;
+      FT_UInt   i = 0;
+      FT_ULong  tag_i = 0, offset_i, length_i;
 
 
+      for ( i = 0; !error && tag_i != tag ; i++ )
+        error = service->table_info( face, i,
+                                     &tag_i, &offset_i, &length_i );
 
 
-      error = service->table_info( face, tag, &offset, &size );
       if ( error                    ||
       if ( error                    ||
-           FT_STREAM_SEEK( offset ) )
+           FT_STREAM_SEEK( offset_i ) )
         goto Exit;
 
         goto Exit;
 
-      result = _tt_check_patents_in_range( stream, size );
+      result = _tt_check_patents_in_range( stream, length_i );
     }
 
   Exit:
     }
 
   Exit:
   FT_Face_SetUnpatentedHinting( FT_Face  face,
                                 FT_Bool  value )
   {
   FT_Face_SetUnpatentedHinting( FT_Face  face,
                                 FT_Bool  value )
   {
-    FT_Bool  result = 0;
+    FT_Bool  result = FALSE;
 
 
 #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
 
 
 #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
index 9e930dd..f9592bb 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for accessing PFR-specific data (body).                 */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType API for accessing PFR-specific data (body).                 */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004 by                                          */
+/*  Copyright 2002, 2003, 2004, 2008 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -46,6 +46,9 @@
     FT_Service_PfrMetrics  service;
 
 
     FT_Service_PfrMetrics  service;
 
 
+    if ( !face )
+      return FT_Err_Invalid_Argument;
+
     service = ft_pfr_check( face );
     if ( service )
     {
     service = ft_pfr_check( face );
     if ( service )
     {
                                     ametrics_x_scale,
                                     ametrics_y_scale );
     }
                                     ametrics_x_scale,
                                     ametrics_y_scale );
     }
-    else if ( face )
+    else
     {
       FT_Fixed  x_scale, y_scale;
 
 
       /* this is not a PFR font */
     {
       FT_Fixed  x_scale, y_scale;
 
 
       /* this is not a PFR font */
-      *aoutline_resolution = face->units_per_EM;
-      *ametrics_resolution = face->units_per_EM;
+      if ( aoutline_resolution )
+        *aoutline_resolution = face->units_per_EM;
+
+      if ( ametrics_resolution )
+        *ametrics_resolution = face->units_per_EM;
 
       x_scale = y_scale = 0x10000L;
       if ( face->size )
 
       x_scale = y_scale = 0x10000L;
       if ( face->size )
         x_scale = face->size->metrics.x_scale;
         y_scale = face->size->metrics.y_scale;
       }
         x_scale = face->size->metrics.x_scale;
         y_scale = face->size->metrics.y_scale;
       }
-      *ametrics_x_scale = x_scale;
-      *ametrics_y_scale = y_scale;
+
+      if ( ametrics_x_scale )
+        *ametrics_x_scale = x_scale;
+
+      if ( ametrics_y_scale )
+        *ametrics_y_scale = y_scale;
+
+      error = FT_Err_Unknown_File_Format;
     }
     }
-    else
-      error = FT_Err_Invalid_Argument;
 
     return error;
   }
 
     return error;
   }
     FT_Service_PfrMetrics  service;
 
 
     FT_Service_PfrMetrics  service;
 
 
+    if ( !face )
+      return FT_Err_Invalid_Argument;
+
     service = ft_pfr_check( face );
     if ( service )
       error = service->get_kerning( face, left, right, avector );
     service = ft_pfr_check( face );
     if ( service )
       error = service->get_kerning( face, left, right, avector );
-    else if ( face )
+    else
       error = FT_Get_Kerning( face, left, right,
                               FT_KERNING_UNSCALED, avector );
       error = FT_Get_Kerning( face, left, right,
                               FT_KERNING_UNSCALED, avector );
-    else
-      error = FT_Err_Invalid_Argument;
 
     return error;
   }
 
     return error;
   }
diff --git a/reactos/lib/3rdparty/freetype/src/base/ftpic.c b/reactos/lib/3rdparty/freetype/src/base/ftpic.c
new file mode 100644 (file)
index 0000000..d5271a9
--- /dev/null
@@ -0,0 +1,54 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftpic.c                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services (body).              */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "basepic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* documentation is in ftpic.h */
+
+  FT_BASE_DEF( FT_Error )
+  ft_pic_container_init( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error error = FT_Err_Ok;
+
+    FT_MEM_SET( pic_container, 0, sizeof(*pic_container) );
+
+    error = ft_base_pic_init( library );
+    if(error)
+      return error;
+
+    return FT_Err_Ok;
+  }
+
+
+  /* Destroy the contents of the container. */
+  FT_BASE_DEF( void )
+  ft_pic_container_destroy( FT_Library library )
+  {
+    ft_base_pic_free( library );
+  }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
index a4f726d..133c2de 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Embedded resource forks accessor (body).                             */
 /*                                                                         */
 /*                                                                         */
 /*    Embedded resource forks accessor (body).                             */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006 by                                          */
+/*  Copyright 2004, 2005, 2006, 2007, 2008, 2009 by                        */
 /*  Masatake YAMATO and Redhat K.K.                                        */
 /*                                                                         */
 /*  FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are     */
 /*  Masatake YAMATO and Redhat K.K.                                        */
 /*                                                                         */
 /*  FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are     */
   }
 
 
   }
 
 
+  static int
+  ft_raccess_sort_ref_by_id( FT_RFork_Ref*  a,
+                             FT_RFork_Ref*  b )
+  {
+    if ( a->res_id < b->res_id )
+      return -1;
+    else if ( a->res_id > b->res_id )
+      return 1;
+    else
+      return 0;
+  }
+
+
   FT_BASE_DEF( FT_Error )
   FT_Raccess_Get_DataOffsets( FT_Library  library,
                               FT_Stream   stream,
   FT_BASE_DEF( FT_Error )
   FT_Raccess_Get_DataOffsets( FT_Library  library,
                               FT_Stream   stream,
                               FT_Long   **offsets,
                               FT_Long    *count )
   {
                               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;
+    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;
+    FT_RFork_Ref  *ref;
 
 
     error = FT_Stream_Seek( stream, map_offset );
 
 
     error = FT_Stream_Seek( stream, map_offset );
         if ( error )
           return error;
 
         if ( error )
           return error;
 
-        if ( FT_NEW_ARRAY( offsets_internal, *count ) )
+        if ( FT_NEW_ARRAY( ref, *count ) )
           return error;
 
         for ( j = 0; j < *count; ++j )
         {
           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_USHORT( ref[j].res_id ) )
+            goto Exit;
+          if ( FT_STREAM_SKIP( 2 ) ) /* resource name */
+            goto Exit;
           if ( FT_READ_LONG( temp ) )
           if ( FT_READ_LONG( temp ) )
-          {
-            FT_FREE( offsets_internal );
-            return error;
-          }
-
-          offsets_internal[j] = rdata_pos + ( temp & 0xFFFFFFL );
+            goto Exit;
+          if ( FT_STREAM_SKIP( 4 ) ) /* mbz */
+            goto Exit;
 
 
-          (void)FT_STREAM_SKIP( 4 ); /* mbz */
+          ref[j].offset = temp & 0xFFFFFFL;
         }
 
         }
 
+        ft_qsort( ref, *count, sizeof ( FT_RFork_Ref ),
+                  ( int(*)(const void*, const void*) )
+                  ft_raccess_sort_ref_by_id );
+
+        if ( FT_NEW_ARRAY( offsets_internal, *count ) )
+          goto Exit;
+
+        /* XXX: duplicated reference ID,
+         *      gap between reference IDs are acceptable?
+         *      further investigation on Apple implementation is needed.
+         */
+        for ( j = 0; j < *count; ++j )
+          offsets_internal[j] = rdata_pos + ref[j].offset;
+
         *offsets = offsets_internal;
         *offsets = offsets_internal;
+        error    = FT_Err_Ok;
 
 
-        return FT_Err_Ok;
+      Exit:
+        FT_FREE( ref );
+        return error;
       }
     }
 
       }
     }
 
   typedef FT_Error
   (*raccess_guess_func)( FT_Library  library,
                          FT_Stream   stream,
   typedef FT_Error
   (*raccess_guess_func)( FT_Library  library,
                          FT_Stream   stream,
-                         char *      base_file_name,
+                         char       *base_file_name,
                          char      **result_file_name,
                          FT_Long    *result_offset );
 
                          char      **result_file_name,
                          FT_Long    *result_offset );
 
   static FT_Error
   raccess_guess_apple_double( FT_Library  library,
                               FT_Stream   stream,
   static FT_Error
   raccess_guess_apple_double( FT_Library  library,
                               FT_Stream   stream,
-                              char *      base_file_name,
+                              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      **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       *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      **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       *base_file_name,
                                    char      **result_file_name,
                                    FT_Long    *result_offset );
 
                                    char      **result_file_name,
                                    FT_Long    *result_offset );
 
+  static FT_Error
+  raccess_guess_darwin_newvfs( 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,
   static FT_Error
   raccess_guess_darwin_hfsplus( FT_Library  library,
                                 FT_Stream   stream,
-                                char *      base_file_name,
+                                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      **result_file_name,
                                 FT_Long    *result_offset );
 
   static FT_Error
   raccess_guess_vfat( FT_Library  library,
                       FT_Stream   stream,
-                      char *      base_file_name,
+                      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      **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       *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      **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       *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      **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       *base_file_name,
                                 char      **result_file_name,
                                 FT_Long    *result_offset );
 
                                 char      **result_file_name,
                                 FT_Long    *result_offset );
 
   static FT_Error
   raccess_guess_apple_generic( FT_Library  library,
                                FT_Stream   stream,
   static FT_Error
   raccess_guess_apple_generic( FT_Library  library,
                                FT_Stream   stream,
-                               char *      base_file_name,
+                               char       *base_file_name,
                                FT_Int32    magic,
                                FT_Long    *result_offset );
 
                                FT_Int32    magic,
                                FT_Long    *result_offset );
 
       raccess_guess_apple_double,
       raccess_guess_apple_single,
       raccess_guess_darwin_ufs_export,
       raccess_guess_apple_double,
       raccess_guess_apple_single,
       raccess_guess_darwin_ufs_export,
+      raccess_guess_darwin_newvfs,
       raccess_guess_darwin_hfsplus,
       raccess_guess_vfat,
       raccess_guess_linux_cap,
       raccess_guess_darwin_hfsplus,
       raccess_guess_vfat,
       raccess_guess_linux_cap,
     for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
     {
       new_names[i] = NULL;
     for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
     {
       new_names[i] = NULL;
-      errors[i] = FT_Stream_Seek( stream, 0 );
+      if ( NULL != stream )
+        errors[i] = FT_Stream_Seek( stream, 0 );
+      else
+        errors[i] = FT_Err_Ok;
+
       if ( errors[i] )
         continue ;
 
       if ( errors[i] )
         continue ;
 
   static FT_Error
   raccess_guess_apple_double( FT_Library  library,
                               FT_Stream   stream,
   static FT_Error
   raccess_guess_apple_double( FT_Library  library,
                               FT_Stream   stream,
-                              char *      base_file_name,
+                              char       *base_file_name,
                               char      **result_file_name,
                               FT_Long    *result_offset )
   {
                               char      **result_file_name,
                               FT_Long    *result_offset )
   {
-    FT_Int32  magic = ( 0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x07 );
+    FT_Int32  magic = ( 0x00 << 24 ) |
+                      ( 0x05 << 16 ) |
+                      ( 0x16 <<  8 ) |
+                        0x07;
 
 
     *result_file_name = NULL;
 
 
     *result_file_name = NULL;
+    if ( NULL == stream )
+      return FT_Err_Cannot_Open_Stream;
+
     return raccess_guess_apple_generic( library, stream, base_file_name,
                                         magic, result_offset );
   }
     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,
   static FT_Error
   raccess_guess_apple_single( FT_Library  library,
                               FT_Stream   stream,
-                              char *      base_file_name,
+                              char       *base_file_name,
                               char      **result_file_name,
                               FT_Long    *result_offset )
   {
                               char      **result_file_name,
                               FT_Long    *result_offset )
   {
-    FT_Int32  magic = (0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x00);
+    FT_Int32  magic = ( 0x00 << 24 ) |
+                      ( 0x05 << 16 ) |
+                      ( 0x16 <<  8 ) |
+                        0x00;
 
 
     *result_file_name = NULL;
 
 
     *result_file_name = NULL;
+    if ( NULL == stream )
+      return FT_Err_Cannot_Open_Stream;
+
     return raccess_guess_apple_generic( library, stream, base_file_name,
                                         magic, result_offset );
   }
     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,
   static FT_Error
   raccess_guess_darwin_ufs_export( FT_Library  library,
                                    FT_Stream   stream,
-                                   char *      base_file_name,
+                                   char       *base_file_name,
                                    char      **result_file_name,
                                    FT_Long    *result_offset )
   {
                                    char      **result_file_name,
                                    FT_Long    *result_offset )
   {
   static FT_Error
   raccess_guess_darwin_hfsplus( FT_Library  library,
                                 FT_Stream   stream,
   static FT_Error
   raccess_guess_darwin_hfsplus( FT_Library  library,
                                 FT_Stream   stream,
-                                char *      base_file_name,
+                                char       *base_file_name,
                                 char      **result_file_name,
                                 FT_Long    *result_offset )
   {
                                 char      **result_file_name,
                                 FT_Long    *result_offset )
   {
 
     memory = library->memory;
 
 
     memory = library->memory;
 
-    if ( base_file_len > FT_INT_MAX )
+    if ( base_file_len + 6 > FT_INT_MAX )
       return FT_Err_Array_Too_Large;
 
     if ( FT_ALLOC( newpath, base_file_len + 6 ) )
       return FT_Err_Array_Too_Large;
 
     if ( FT_ALLOC( newpath, base_file_len + 6 ) )
   }
 
 
   }
 
 
+  static FT_Error
+  raccess_guess_darwin_newvfs( FT_Library  library,
+                               FT_Stream   stream,
+                               char       *base_file_name,
+                               char      **result_file_name,
+                               FT_Long    *result_offset )
+  {
+    /*
+      Only meaningful on systems with Mac OS X (> 10.1).
+     */
+    FT_Error   error;
+    char*      newpath;
+    FT_Memory  memory;
+    FT_Long    base_file_len = ft_strlen( base_file_name );
+
+    FT_UNUSED( stream );
+
+
+    memory = library->memory;
+
+    if ( base_file_len + 18 > FT_INT_MAX )
+      return FT_Err_Array_Too_Large;
+
+    if ( FT_ALLOC( newpath, base_file_len + 18 ) )
+      return error;
+
+    FT_MEM_COPY( newpath, base_file_name, base_file_len );
+    FT_MEM_COPY( newpath + base_file_len, "/..namedfork/rsrc", 18 );
+
+    *result_file_name = newpath;
+    *result_offset    = 0;
+
+    return FT_Err_Ok;
+  }
+
+
   static FT_Error
   raccess_guess_vfat( FT_Library  library,
                       FT_Stream   stream,
   static FT_Error
   raccess_guess_vfat( FT_Library  library,
                       FT_Stream   stream,
-                      char *      base_file_name,
+                      char       *base_file_name,
                       char      **result_file_name,
                       FT_Long    *result_offset )
   {
                       char      **result_file_name,
                       FT_Long    *result_offset )
   {
   static FT_Error
   raccess_guess_linux_cap( FT_Library  library,
                            FT_Stream   stream,
   static FT_Error
   raccess_guess_linux_cap( FT_Library  library,
                            FT_Stream   stream,
-                           char *      base_file_name,
+                           char       *base_file_name,
                            char      **result_file_name,
                            FT_Long    *result_offset )
   {
                            char      **result_file_name,
                            FT_Long    *result_offset )
   {
   static FT_Error
   raccess_guess_linux_double( FT_Library  library,
                               FT_Stream   stream,
   static FT_Error
   raccess_guess_linux_double( FT_Library  library,
                               FT_Stream   stream,
-                              char *      base_file_name,
+                              char       *base_file_name,
                               char      **result_file_name,
                               FT_Long    *result_offset )
   {
                               char      **result_file_name,
                               FT_Long    *result_offset )
   {
   static FT_Error
   raccess_guess_linux_netatalk( FT_Library  library,
                                 FT_Stream   stream,
   static FT_Error
   raccess_guess_linux_netatalk( FT_Library  library,
                                 FT_Stream   stream,
-                                char *      base_file_name,
+                                char       *base_file_name,
                                 char      **result_file_name,
                                 FT_Long    *result_offset )
   {
                                 char      **result_file_name,
                                 FT_Long    *result_offset )
   {
   static FT_Error
   raccess_guess_apple_generic( FT_Library  library,
                                FT_Stream   stream,
   static FT_Error
   raccess_guess_apple_generic( FT_Library  library,
                                FT_Stream   stream,
-                               char *      base_file_name,
+                               char       *base_file_name,
                                FT_Int32    magic,
                                FT_Long    *result_offset )
   {
                                FT_Int32    magic,
                                FT_Long    *result_offset )
   {
         return FT_Err_Ok;
       }
       else
         return FT_Err_Ok;
       }
       else
-        FT_Stream_Skip( stream, 4 + 4 );    /* offset + length */
+      {
+        error = FT_Stream_Skip( stream, 4 + 4 );    /* offset + length */
+        if ( error )
+          return error;
       }
       }
+    }
 
     return FT_Err_Unknown_File_Format;
   }
 
     return FT_Err_Unknown_File_Format;
   }
 
   static FT_Error
   raccess_guess_linux_double_from_file_name( FT_Library  library,
 
   static FT_Error
   raccess_guess_linux_double_from_file_name( FT_Library  library,
-                                             char *      file_name,
+                                             char       *file_name,
                                              FT_Long    *result_offset )
   {
     FT_Open_Args  args2;
                                              FT_Long    *result_offset )
   {
     FT_Open_Args  args2;
                           const char  *insertion )
   {
     char*        new_name;
                           const char  *insertion )
   {
     char*        new_name;
-    char*        tmp;
+    const char*  tmp;
     const char*  slash;
     const char*  slash;
-    unsigned     new_length;
+    size_t       new_length;
     FT_Error     error = FT_Err_Ok;
 
     FT_UNUSED( error );
     FT_Error     error = FT_Err_Ok;
 
     FT_UNUSED( error );
   FT_BASE_DEF( void )
   FT_Raccess_Guess( FT_Library  library,
                     FT_Stream   stream,
   FT_BASE_DEF( void )
   FT_Raccess_Guess( FT_Library  library,
                     FT_Stream   stream,
-                    char*       base_name,
+                    char       *base_name,
                     char      **new_names,
                     FT_Long    *offsets,
                     FT_Error   *errors )
                     char      **new_names,
                     FT_Long    *offsets,
                     FT_Error   *errors )
diff --git a/reactos/lib/3rdparty/freetype/src/base/ftsnames.c b/reactos/lib/3rdparty/freetype/src/base/ftsnames.c
new file mode 100644 (file)
index 0000000..3447888
--- /dev/null
@@ -0,0 +1,94 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftsnames.c                                                             */
+/*                                                                         */
+/*    Simple interface to access SFNT name tables (which are used          */
+/*    to hold font names, copyright info, notices, etc.) (body).           */
+/*                                                                         */
+/*    This is _not_ used to retrieve glyph names!                          */
+/*                                                                         */
+/*  Copyright 1996-2001, 2002, 2009 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_SFNT_NAMES_H
+#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include FT_INTERNAL_STREAM_H
+
+
+#ifdef TT_CONFIG_OPTION_SFNT_NAMES
+
+
+  /* documentation is in ftsnames.h */
+
+  FT_EXPORT_DEF( FT_UInt )
+  FT_Get_Sfnt_Name_Count( FT_Face  face )
+  {
+    return ( face && FT_IS_SFNT( face ) ) ? ((TT_Face)face)->num_names : 0;
+  }
+
+
+  /* documentation is in ftsnames.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Get_Sfnt_Name( FT_Face       face,
+                    FT_UInt       idx,
+                    FT_SfntName  *aname )
+  {
+    FT_Error  error = FT_Err_Invalid_Argument;
+
+
+    if ( aname && face && FT_IS_SFNT( face ) )
+    {
+      TT_Face  ttface = (TT_Face)face;
+
+
+      if ( idx < (FT_UInt)ttface->num_names )
+      {
+        TT_NameEntryRec*  entry = ttface->name_table.names + idx;
+
+
+        /* load name on demand */
+        if ( entry->stringLength > 0 && entry->string == NULL )
+        {
+          FT_Memory  memory = face->memory;
+          FT_Stream  stream = face->stream;
+
+
+          if ( FT_NEW_ARRAY  ( entry->string, entry->stringLength ) ||
+               FT_STREAM_SEEK( entry->stringOffset )                ||
+               FT_STREAM_READ( entry->string, entry->stringLength ) )
+          {
+            FT_FREE( entry->string );
+            entry->stringLength = 0;
+          }
+        }
+
+        aname->platform_id = entry->platformID;
+        aname->encoding_id = entry->encodingID;
+        aname->language_id = entry->languageID;
+        aname->name_id     = entry->nameID;
+        aname->string      = (FT_Byte*)entry->string;
+        aname->string_len  = entry->stringLength;
+
+        error = FT_Err_Ok;
+      }
+    }
+
+    return error;
+  }
+
+
+#endif /* TT_CONFIG_OPTION_SFNT_NAMES */
+
+
+/* END */
index a067a1f..b638599 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    I/O stream support (body).                                           */
 /*                                                                         */
 /*                                                                         */
 /*    I/O stream support (body).                                           */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2004, 2005, 2006 by                         */
+/*  Copyright 2000-2001, 2002, 2004, 2005, 2006, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
     FT_Error  error = FT_Err_Ok;
 
 
     FT_Error  error = FT_Err_Ok;
 
 
-    stream->pos = pos;
-
     if ( stream->read )
     {
       if ( stream->read( stream, pos, 0, 0 ) )
       {
     if ( stream->read )
     {
       if ( stream->read( stream, pos, 0, 0 ) )
       {
-        FT_ERROR(( "FT_Stream_Seek: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+        FT_ERROR(( "FT_Stream_Seek:"
+                   " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                    pos, stream->size ));
 
         error = FT_Err_Invalid_Stream_Operation;
                    pos, stream->size ));
 
         error = FT_Err_Invalid_Stream_Operation;
     /* note that seeking to the first position after the file is valid */
     else if ( pos > stream->size )
     {
     /* note that seeking to the first position after the file is valid */
     else if ( pos > stream->size )
     {
-      FT_ERROR(( "FT_Stream_Seek: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+      FT_ERROR(( "FT_Stream_Seek:"
+                 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                  pos, stream->size ));
 
       error = FT_Err_Invalid_Stream_Operation;
     }
 
                  pos, stream->size ));
 
       error = FT_Err_Invalid_Stream_Operation;
     }
 
+    if ( !error )
+      stream->pos = pos;
+
     return error;
   }
 
     return error;
   }
 
@@ -89,6 +92,9 @@
   FT_Stream_Skip( FT_Stream  stream,
                   FT_Long    distance )
   {
   FT_Stream_Skip( FT_Stream  stream,
                   FT_Long    distance )
   {
+    if ( distance < 0 )
+      return FT_Err_Invalid_Stream_Operation;
+
     return FT_Stream_Seek( stream, (FT_ULong)( stream->pos + distance ) );
   }
 
     return FT_Stream_Seek( stream, (FT_ULong)( stream->pos + distance ) );
   }
 
 
     if ( pos >= stream->size )
     {
 
     if ( pos >= stream->size )
     {
-      FT_ERROR(( "FT_Stream_ReadAt: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+      FT_ERROR(( "FT_Stream_ReadAt:"
+                 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                  pos, stream->size ));
 
       return FT_Err_Invalid_Stream_Operation;
                  pos, stream->size ));
 
       return FT_Err_Invalid_Stream_Operation;
 
     if ( read_bytes < count )
     {
 
     if ( read_bytes < count )
     {
-      FT_ERROR(( "FT_Stream_ReadAt:" ));
-      FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n",
+      FT_ERROR(( "FT_Stream_ReadAt:"
+                 " invalid read; expected %lu bytes, got %lu\n",
                  count, read_bytes ));
 
       error = FT_Err_Invalid_Stream_Operation;
                  count, read_bytes ));
 
       error = FT_Err_Invalid_Stream_Operation;
   FT_Stream_ReleaseFrame( FT_Stream  stream,
                           FT_Byte**  pbytes )
   {
   FT_Stream_ReleaseFrame( FT_Stream  stream,
                           FT_Byte**  pbytes )
   {
-    if ( stream->read )
+    if ( stream && stream->read )
     {
       FT_Memory  memory = stream->memory;
 
     {
       FT_Memory  memory = stream->memory;
 
                                  stream->base, count );
       if ( read_bytes < count )
       {
                                  stream->base, count );
       if ( read_bytes < count )
       {
-        FT_ERROR(( "FT_Stream_EnterFrame:" ));
-        FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n",
+        FT_ERROR(( "FT_Stream_EnterFrame:"
+                   " invalid read; expected %lu bytes, got %lu\n",
                    count, read_bytes ));
 
         FT_FREE( stream->base );
                    count, read_bytes ));
 
         FT_FREE( stream->base );
       if ( stream->pos >= stream->size        ||
            stream->pos + count > stream->size )
       {
       if ( stream->pos >= stream->size        ||
            stream->pos + count > stream->size )
       {
-        FT_ERROR(( "FT_Stream_EnterFrame:" ));
-        FT_ERROR(( " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n",
+        FT_ERROR(( "FT_Stream_EnterFrame:"
+                   " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n",
                    stream->pos, count, stream->size ));
 
         error = FT_Err_Invalid_Stream_Operation;
                    stream->pos, count, stream->size ));
 
         error = FT_Err_Invalid_Stream_Operation;
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
-    FT_ERROR(( "FT_Stream_ReadChar: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+    FT_ERROR(( "FT_Stream_ReadChar:"
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
 
     return 0;
                stream->pos, stream->size ));
 
     return 0;
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
-    FT_ERROR(( "FT_Stream_ReadShort:" ));
-    FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+    FT_ERROR(( "FT_Stream_ReadShort:"
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
 
     return 0;
                stream->pos, stream->size ));
 
     return 0;
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
-    FT_ERROR(( "FT_Stream_ReadShortLE:" ));
-    FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+    FT_ERROR(( "FT_Stream_ReadShortLE:"
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
 
     return 0;
                stream->pos, stream->size ));
 
     return 0;
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
-    FT_ERROR(( "FT_Stream_ReadOffset:" ));
-    FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+    FT_ERROR(( "FT_Stream_ReadOffset:"
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
 
     return 0;
                stream->pos, stream->size ));
 
     return 0;
     return result;
 
   Fail:
     return result;
 
   Fail:
-    FT_ERROR(( "FT_Stream_ReadLong: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
-               stream->pos, stream->size ));
     *error = FT_Err_Invalid_Stream_Operation;
     *error = FT_Err_Invalid_Stream_Operation;
+    FT_ERROR(( "FT_Stream_ReadLong:"
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+               stream->pos, stream->size ));
 
     return 0;
   }
 
     return 0;
   }
     return result;
 
   Fail:
     return result;
 
   Fail:
-    FT_ERROR(( "FT_Stream_ReadLongLE:" ));
-    FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
-               stream->pos, stream->size ));
     *error = FT_Err_Invalid_Stream_Operation;
     *error = FT_Err_Invalid_Stream_Operation;
+    FT_ERROR(( "FT_Stream_ReadLongLE:"
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+               stream->pos, stream->size ));
 
     return 0;
   }
 
     return 0;
   }
   {
     FT_Error  error;
     FT_Bool   frame_accessed = 0;
   {
     FT_Error  error;
     FT_Bool   frame_accessed = 0;
-    FT_Byte*  cursor = stream->cursor;
-
+    FT_Byte*  cursor;
 
     if ( !fields || !stream )
       return FT_Err_Invalid_Argument;
 
 
     if ( !fields || !stream )
       return FT_Err_Invalid_Argument;
 
+    cursor = stream->cursor;
+
     error = FT_Err_Ok;
     do
     {
     error = FT_Err_Ok;
     do
     {
index 8f7e045..0978b0e 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType path stroker (body).                                        */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType path stroker (body).                                        */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006 by                              */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
  /***************************************************************************/
  /***************************************************************************/
 
  /***************************************************************************/
  /***************************************************************************/
 
-  typedef enum
+  typedef enum  FT_StrokeTags_
   {
     FT_STROKE_TAG_ON    = 1,   /* on-curve point  */
     FT_STROKE_TAG_CUBIC = 2,   /* cubic off-point */
   {
     FT_STROKE_TAG_ON    = 1,   /* on-curve point  */
     FT_STROKE_TAG_CUBIC = 2,   /* cubic off-point */
   {
     FT_UInt   old_max = border->max_points;
     FT_UInt   new_max = border->num_points + new_points;
   {
     FT_UInt   old_max = border->max_points;
     FT_UInt   new_max = border->num_points + new_points;
-    FT_Error  error   = 0;
+    FT_Error  error   = FT_Err_Ok;
 
 
     if ( new_max > old_max )
 
 
     if ( new_max > old_max )
 
       border->max_points = cur_max;
     }
 
       border->max_points = cur_max;
     }
+
   Exit:
     return error;
   }
   Exit:
     return error;
   }
     }
 
     border->start   = -1;
     }
 
     border->start   = -1;
-    border->movable = 0;
+    border->movable = FALSE;
   }
 
 
   }
 
 
                            FT_Vector*       to,
                            FT_Bool          movable )
   {
                            FT_Vector*       to,
                            FT_Bool          movable )
   {
-    FT_Error  error = 0;
+    FT_Error  error = FT_Err_Ok;
 
 
     FT_ASSERT( border->start >= 0 );
 
 
     FT_ASSERT( border->start >= 0 );
 
       border->num_points += 2;
     }
 
       border->num_points += 2;
     }
-    border->movable = 0;
+    border->movable = FALSE;
     return error;
   }
 
     return error;
   }
 
 
       border->num_points += 3;
     }
 
       border->num_points += 3;
     }
-    border->movable = 0;
+    border->movable = FALSE;
     return error;
   }
 
     return error;
   }
 
     FT_Angle   total, angle, step, rotate, next, theta;
     FT_Vector  a, b, a2, b2;
     FT_Fixed   length;
     FT_Angle   total, angle, step, rotate, next, theta;
     FT_Vector  a, b, a2, b2;
     FT_Fixed   length;
-    FT_Error   error = 0;
+    FT_Error   error = FT_Err_Ok;
 
 
     /* compute start point */
 
 
     /* compute start point */
   {
     /* close current open path if any ? */
     if ( border->start >= 0 )
   {
     /* close current open path if any ? */
     if ( border->start >= 0 )
-      ft_stroke_border_close( border, 0 );
+      ft_stroke_border_close( border, FALSE );
 
     border->start   = border->num_points;
 
     border->start   = border->num_points;
-    border->movable = 0;
+    border->movable = FALSE;
 
 
-    return ft_stroke_border_lineto( border, to, 0 );
+    return ft_stroke_border_lineto( border, to, FALSE );
   }
 
 
   }
 
 
     border->num_points = 0;
     border->max_points = 0;
     border->start      = -1;
     border->num_points = 0;
     border->max_points = 0;
     border->start      = -1;
-    border->valid      = 0;
+    border->valid      = FALSE;
   }
 
 
   }
 
 
   {
     border->num_points = 0;
     border->start      = -1;
   {
     border->num_points = 0;
     border->start      = -1;
-    border->valid      = 0;
+    border->valid      = FALSE;
   }
 
 
   }
 
 
     border->num_points = 0;
     border->max_points = 0;
     border->start      = -1;
     border->num_points = 0;
     border->max_points = 0;
     border->start      = -1;
-    border->valid      = 0;
+    border->valid      = FALSE;
   }
 
 
   }
 
 
                                FT_UInt         *anum_points,
                                FT_UInt         *anum_contours )
   {
                                FT_UInt         *anum_points,
                                FT_UInt         *anum_contours )
   {
-    FT_Error  error        = 0;
+    FT_Error  error        = FT_Err_Ok;
     FT_UInt   num_points   = 0;
     FT_UInt   num_contours = 0;
 
     FT_UInt   num_points   = 0;
     FT_UInt   num_contours = 0;
 
 
       if ( tags[0] & FT_STROKE_TAG_END )
       {
 
       if ( tags[0] & FT_STROKE_TAG_END )
       {
-        if ( in_contour == 0 )
-          goto Fail;
-
         in_contour = 0;
         num_contours++;
       }
         in_contour = 0;
         num_contours++;
       }
     if ( in_contour != 0 )
       goto Fail;
 
     if ( in_contour != 0 )
       goto Fail;
 
-    border->valid = 1;
+    border->valid = TRUE;
 
   Exit:
     *anum_points   = num_points;
 
   Exit:
     *anum_points   = num_points;
 
     FT_Bool              valid;
     FT_StrokeBorderRec   borders[2];
 
     FT_Bool              valid;
     FT_StrokeBorderRec   borders[2];
-    FT_Memory            memory;
+    FT_Library           library;
 
   } FT_StrokerRec;
 
 
   } FT_StrokerRec;
 
 
     if ( !FT_NEW( stroker ) )
     {
 
     if ( !FT_NEW( stroker ) )
     {
-      stroker->memory = memory;
+      stroker->library = library;
 
       ft_stroke_border_init( &stroker->borders[0], memory );
       ft_stroke_border_init( &stroker->borders[1], memory );
 
       ft_stroke_border_init( &stroker->borders[0], memory );
       ft_stroke_border_init( &stroker->borders[1], memory );
   {
     if ( stroker )
     {
   {
     if ( stroker )
     {
-      FT_Memory  memory = stroker->memory;
+      FT_Memory  memory = stroker->library->memory;
 
 
       ft_stroke_border_done( &stroker->borders[0] );
       ft_stroke_border_done( &stroker->borders[1] );
 
 
 
       ft_stroke_border_done( &stroker->borders[0] );
       ft_stroke_border_done( &stroker->borders[1] );
 
-      stroker->memory = NULL;
+      stroker->library = NULL;
       FT_FREE( stroker );
     }
   }
       FT_FREE( stroker );
     }
   }
   {
     FT_Angle         total, rotate;
     FT_Fixed         radius = stroker->radius;
   {
     FT_Angle         total, rotate;
     FT_Fixed         radius = stroker->radius;
-    FT_Error         error  = 0;
+    FT_Error         error  = FT_Err_Ok;
     FT_StrokeBorder  border = stroker->borders + side;
 
 
     FT_StrokeBorder  border = stroker->borders + side;
 
 
                                     radius,
                                     stroker->angle_in + rotate,
                                     total );
                                     radius,
                                     stroker->angle_in + rotate,
                                     total );
-    border->movable = 0;
+    border->movable = FALSE;
     return error;
   }
 
     return error;
   }
 
                   FT_Angle    angle,
                   FT_Int      side )
   {
                   FT_Angle    angle,
                   FT_Int      side )
   {
-    FT_Error  error  = 0;
+    FT_Error  error = FT_Err_Ok;
 
 
     if ( stroker->line_cap == FT_STROKER_LINECAP_ROUND )
 
 
     if ( stroker->line_cap == FT_STROKER_LINECAP_ROUND )
       delta.x += stroker->center.x + delta2.x;
       delta.y += stroker->center.y + delta2.y;
 
       delta.x += stroker->center.x + delta2.x;
       delta.y += stroker->center.y + delta2.y;
 
-      error = ft_stroke_border_lineto( border, &delta, 0 );
+      error = ft_stroke_border_lineto( border, &delta, FALSE );
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
 
       delta.x += delta2.x + stroker->center.x;
       delta.y += delta2.y + stroker->center.y;
 
       delta.x += delta2.x + stroker->center.x;
       delta.y += delta2.y + stroker->center.y;
 
-      error = ft_stroke_border_lineto( border, &delta, 0 );
+      error = ft_stroke_border_lineto( border, &delta, FALSE );
+    }
+    else if ( stroker->line_cap == FT_STROKER_LINECAP_BUTT )
+    {
+      /* add a butt ending */
+      FT_Vector        delta;
+      FT_Angle         rotate = FT_SIDE_TO_ROTATE( side );
+      FT_Fixed         radius = stroker->radius;
+      FT_StrokeBorder  border = stroker->borders + side;
+
+
+      FT_Vector_From_Polar( &delta, radius, angle + rotate );
+
+      delta.x += stroker->center.x;
+      delta.y += stroker->center.y;
+
+      error = ft_stroke_border_lineto( border, &delta, FALSE );
+      if ( error )
+        goto Exit;
+
+      FT_Vector_From_Polar( &delta, radius, angle - rotate );
+
+      delta.x += stroker->center.x;
+      delta.y += stroker->center.y;
+
+      error = ft_stroke_border_lineto( border, &delta, FALSE );   
     }
 
   Exit:
     }
 
   Exit:
     FT_Angle         phi, theta, rotate;
     FT_Fixed         length, thcos, sigma;
     FT_Vector        delta;
     FT_Angle         phi, theta, rotate;
     FT_Fixed         length, thcos, sigma;
     FT_Vector        delta;
-    FT_Error         error = 0;
+    FT_Error         error = FT_Err_Ok;
 
 
     rotate = FT_SIDE_TO_ROTATE( side );
 
 
     rotate = FT_SIDE_TO_ROTATE( side );
                             stroker->angle_out + rotate );
       delta.x += stroker->center.x;
       delta.y += stroker->center.y;
                             stroker->angle_out + rotate );
       delta.x += stroker->center.x;
       delta.y += stroker->center.y;
-      border->movable = 0;
+      border->movable = FALSE;
     }
     else
     {
     }
     else
     {
       delta.y += stroker->center.y;
     }
 
       delta.y += stroker->center.y;
     }
 
-    error = ft_stroke_border_lineto( border, &delta, 0 );
+    error = ft_stroke_border_lineto( border, &delta, FALSE );
 
     return error;
   }
 
     return error;
   }
 
 
     if ( stroker->line_join == FT_STROKER_LINEJOIN_ROUND )
 
 
     if ( stroker->line_join == FT_STROKER_LINEJOIN_ROUND )
-    {
       error = ft_stroker_arcto( stroker, side );
       error = ft_stroker_arcto( stroker, side );
-    }
     else
     {
       /* this is a mitered or beveled corner */
     else
     {
       /* this is a mitered or beveled corner */
       rotate = FT_SIDE_TO_ROTATE( side );
       miter  = FT_BOOL( stroker->line_join == FT_STROKER_LINEJOIN_MITER );
 
       rotate = FT_SIDE_TO_ROTATE( side );
       miter  = FT_BOOL( stroker->line_join == FT_STROKER_LINEJOIN_MITER );
 
-      theta  = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
+      theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
       if ( theta == FT_ANGLE_PI )
       {
         theta = rotate;
       if ( theta == FT_ANGLE_PI )
       {
         theta = rotate;
       sigma = FT_MulFix( stroker->miter_limit, thcos );
 
       if ( sigma >= 0x10000L )
       sigma = FT_MulFix( stroker->miter_limit, thcos );
 
       if ( sigma >= 0x10000L )
-        miter = 0;
+        miter = FALSE;
 
       if ( miter )  /* this is a miter (broken angle) */
       {
 
       if ( miter )  /* this is a miter (broken angle) */
       {
         delta.x += middle.x;
         delta.y += middle.y;
 
         delta.x += middle.x;
         delta.y += middle.y;
 
-        error = ft_stroke_border_lineto( border, &delta, 0 );
+        error = ft_stroke_border_lineto( border, &delta, FALSE );
         if ( error )
           goto Exit;
 
         if ( error )
           goto Exit;
 
         delta.x += middle.x;
         delta.y += middle.y;
 
         delta.x += middle.x;
         delta.y += middle.y;
 
-        error = ft_stroke_border_lineto( border, &delta, 0 );
+        error = ft_stroke_border_lineto( border, &delta, FALSE );
         if ( error )
           goto Exit;
 
         if ( error )
           goto Exit;
 
         delta.x += stroker->center.x;
         delta.y += stroker->center.y;
 
         delta.x += stroker->center.x;
         delta.y += stroker->center.y;
 
-        error = ft_stroke_border_lineto( border, &delta, 1 );
+        error = ft_stroke_border_lineto( border, &delta, TRUE );
       }
 
       else /* this is a bevel (intersection) */
       }
 
       else /* this is a bevel (intersection) */
         delta.x += stroker->center.x;
         delta.y += stroker->center.y;
 
         delta.x += stroker->center.x;
         delta.y += stroker->center.y;
 
-        error = ft_stroke_border_lineto( border, &delta, 0 );
-        if (error) goto Exit;
+        error = ft_stroke_border_lineto( border, &delta, FALSE );
+        if ( error )
+          goto Exit;
 
         /* now add end point */
         FT_Vector_From_Polar( &delta, stroker->radius,
 
         /* now add end point */
         FT_Vector_From_Polar( &delta, stroker->radius,
         delta.x += stroker->center.x;
         delta.y += stroker->center.y;
 
         delta.x += stroker->center.x;
         delta.y += stroker->center.y;
 
-        error = ft_stroke_border_lineto( border, &delta, 1 );
+        error = ft_stroke_border_lineto( border, &delta, TRUE );
       }
     }
 
       }
     }
 
   static FT_Error
   ft_stroker_process_corner( FT_Stroker  stroker )
   {
   static FT_Error
   ft_stroker_process_corner( FT_Stroker  stroker )
   {
-    FT_Error  error = 0;
+    FT_Error  error = FT_Err_Ok;
     FT_Angle  turn;
     FT_Int    inside_side;
 
     FT_Angle  turn;
     FT_Int    inside_side;
 
 
 
   /* add two points to the left and right borders corresponding to the */
 
 
   /* add two points to the left and right borders corresponding to the */
-  /* start of the subpath..                                            */
+  /* start of the subpath                                              */
   static FT_Error
   ft_stroker_subpath_start( FT_Stroker  stroker,
                             FT_Angle    start_angle )
   static FT_Error
   ft_stroker_subpath_start( FT_Stroker  stroker,
                             FT_Angle    start_angle )
 
     /* save angle for last cap */
     stroker->subpath_angle = start_angle;
 
     /* save angle for last cap */
     stroker->subpath_angle = start_angle;
-    stroker->first_point   = 0;
+    stroker->first_point   = FALSE;
 
   Exit:
     return error;
 
   Exit:
     return error;
   FT_Stroker_LineTo( FT_Stroker  stroker,
                      FT_Vector*  to )
   {
   FT_Stroker_LineTo( FT_Stroker  stroker,
                      FT_Vector*  to )
   {
-    FT_Error         error = 0;
+    FT_Error         error = FT_Err_Ok;
     FT_StrokeBorder  border;
     FT_Vector        delta;
     FT_Angle         angle;
     FT_StrokeBorder  border;
     FT_Vector        delta;
     FT_Angle         angle;
         goto Exit;
     }
 
         goto Exit;
     }
 
-    /* now add a line segment to both the "inside" and "outside" paths */
+    /* now add a line segment to both the `inside' and `outside' paths */
 
     for ( border = stroker->borders, side = 1; side >= 0; side--, border++ )
     {
 
     for ( border = stroker->borders, side = 1; side >= 0; side--, border++ )
     {
       point.x = to->x + delta.x;
       point.y = to->y + delta.y;
 
       point.x = to->x + delta.x;
       point.y = to->y + delta.y;
 
-      error = ft_stroke_border_lineto( border, &point, 1 );
+      error = ft_stroke_border_lineto( border, &point, TRUE );
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
 
                       FT_Vector*  control,
                       FT_Vector*  to )
   {
                       FT_Vector*  control,
                       FT_Vector*  to )
   {
-    FT_Error    error = 0;
+    FT_Error    error = FT_Err_Ok;
     FT_Vector   bez_stack[34];
     FT_Vector*  arc;
     FT_Vector*  limit = bez_stack + 30;
     FT_Angle    start_angle;
     FT_Vector   bez_stack[34];
     FT_Vector*  arc;
     FT_Vector*  limit = bez_stack + 30;
     FT_Angle    start_angle;
-    FT_Bool     first_arc = 1;
+    FT_Bool     first_arc = TRUE;
 
 
     arc    = bez_stack;
 
 
     arc    = bez_stack;
 
       if ( first_arc )
       {
 
       if ( first_arc )
       {
-        first_arc = 0;
+        first_arc = FALSE;
 
         start_angle = angle_in;
 
 
         start_angle = angle_in;
 
                       FT_Vector*  control2,
                       FT_Vector*  to )
   {
                       FT_Vector*  control2,
                       FT_Vector*  to )
   {
-    FT_Error    error = 0;
+    FT_Error    error = FT_Err_Ok;
     FT_Vector   bez_stack[37];
     FT_Vector*  arc;
     FT_Vector*  limit = bez_stack + 32;
     FT_Angle    start_angle;
     FT_Vector   bez_stack[37];
     FT_Vector*  arc;
     FT_Vector*  limit = bez_stack + 32;
     FT_Angle    start_angle;
-    FT_Bool     first_arc = 1;
+    FT_Bool     first_arc = TRUE;
 
 
     arc    = bez_stack;
 
 
     arc    = bez_stack;
 
       if ( first_arc )
       {
 
       if ( first_arc )
       {
-        first_arc = 0;
+        first_arc = FALSE;
 
         /* process corner if necessary */
         start_angle = angle_in;
 
         /* process corner if necessary */
         start_angle = angle_in;
   {
     /* We cannot process the first point, because there is not enough      */
     /* information regarding its corner/cap.  The latter will be processed */
   {
     /* We cannot process the first point, because there is not enough      */
     /* information regarding its corner/cap.  The latter will be processed */
-    /* in the "end_subpath" routine.                                       */
+    /* in the `FT_Stroker_EndSubPath' routine.                             */
     /*                                                                     */
     /*                                                                     */
-    stroker->first_point   = 1;
-    stroker->center        = *to;
-    stroker->subpath_open  = open;
+    stroker->first_point  = TRUE;
+    stroker->center       = *to;
+    stroker->subpath_open = open;
 
 
-    /* record the subpath start point index for each border */
+    /* record the subpath start point for each border */
     stroker->subpath_start = *to;
     stroker->subpath_start = *to;
-    return 0;
+
+    return FT_Err_Ok;
   }
 
 
   }
 
 
   ft_stroker_add_reverse_left( FT_Stroker  stroker,
                                FT_Bool     open )
   {
   ft_stroker_add_reverse_left( FT_Stroker  stroker,
                                FT_Bool     open )
   {
-    FT_StrokeBorder  right  = stroker->borders + 0;
-    FT_StrokeBorder  left   = stroker->borders + 1;
+    FT_StrokeBorder  right = stroker->borders + 0;
+    FT_StrokeBorder  left  = stroker->borders + 1;
     FT_Int           new_points;
     FT_Int           new_points;
-    FT_Error         error  = 0;
+    FT_Error         error = FT_Err_Ok;
 
 
     FT_ASSERT( left->start >= 0 );
 
 
     FT_ASSERT( left->start >= 0 );
       left->num_points   = left->start;
       right->num_points += new_points;
 
       left->num_points   = left->start;
       right->num_points += new_points;
 
-      right->movable = 0;
-      left->movable  = 0;
+      right->movable = FALSE;
+      left->movable  = FALSE;
     }
 
   Exit:
     }
 
   Exit:
   FT_EXPORT_DEF( FT_Error )
   FT_Stroker_EndSubPath( FT_Stroker  stroker )
   {
   FT_EXPORT_DEF( FT_Error )
   FT_Stroker_EndSubPath( FT_Stroker  stroker )
   {
-    FT_Error  error  = 0;
+    FT_Error  error = FT_Err_Ok;
+
 
     if ( stroker->subpath_open )
     {
 
     if ( stroker->subpath_open )
     {
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
 
-      /* add reversed points from "left" to "right" */
-      error = ft_stroker_add_reverse_left( stroker, 1 );
+      /* add reversed points from `left' to `right' */
+      error = ft_stroker_add_reverse_left( stroker, TRUE );
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
 
 
       /* Now end the right subpath accordingly.  The left one is */
       /* rewind and doesn't need further processing.             */
 
       /* Now end the right subpath accordingly.  The left one is */
       /* rewind and doesn't need further processing.             */
-      ft_stroke_border_close( right, 0 );
+      ft_stroke_border_close( right, FALSE );
     }
     else
     {
     }
     else
     {
       }
 
       /* then end our two subpaths */
       }
 
       /* then end our two subpaths */
-      ft_stroke_border_close( stroker->borders + 0, 1 );
-      ft_stroke_border_close( stroker->borders + 1, 0 );
+      ft_stroke_border_close( stroker->borders + 0, TRUE );
+      ft_stroke_border_close( stroker->borders + 1, FALSE );
     }
 
   Exit:
     }
 
   Exit:
       v_control = v_start;
 
       point = outline->points + first;
       v_control = v_start;
 
       point = outline->points + first;
-      tags  = outline->tags  + first;
+      tags  = outline->tags   + first;
       tag   = FT_CURVE_TAG( tags[0] );
 
       /* A contour cannot start with a cubic control point! */
       tag   = FT_CURVE_TAG( tags[0] );
 
       /* A contour cannot start with a cubic control point! */
       first = last + 1;
     }
 
       first = last + 1;
     }
 
-    return 0;
+    return FT_Err_Ok;
 
   Exit:
     return error;
 
   Exit:
     return error;
     return FT_Err_Invalid_Outline;
   }
 
     return FT_Err_Invalid_Outline;
   }
 
-
+/* declare an extern to access ft_outline_glyph_class global allocated 
+   in ftglyph.c, and use the FT_OUTLINE_GLYPH_CLASS_GET macro to access 
+   it when FT_CONFIG_OPTION_PIC is defined */
+#ifndef FT_CONFIG_OPTION_PIC
   extern const FT_Glyph_Class  ft_outline_glyph_class;
   extern const FT_Glyph_Class  ft_outline_glyph_class;
+#endif
+#include "basepic.h"
 
 
   /* documentation is in ftstroke.h */
 
 
   /* documentation is in ftstroke.h */
   {
     FT_Error  error = FT_Err_Invalid_Argument;
     FT_Glyph  glyph = NULL;
   {
     FT_Error  error = FT_Err_Invalid_Argument;
     FT_Glyph  glyph = NULL;
-
+    FT_Library library = stroker->library;
+    FT_UNUSED(library);
 
     if ( pglyph == NULL )
       goto Exit;
 
     glyph = *pglyph;
 
     if ( pglyph == NULL )
       goto Exit;
 
     glyph = *pglyph;
-    if ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class )
+    if ( glyph == NULL || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET )
       goto Exit;
 
     {
       goto Exit;
 
     {
       FT_UInt          num_points, num_contours;
 
 
       FT_UInt          num_points, num_contours;
 
 
-      error = FT_Stroker_ParseOutline( stroker, outline, 0 );
+      error = FT_Stroker_ParseOutline( stroker, outline, FALSE );
       if ( error )
         goto Fail;
 
       if ( error )
         goto Fail;
 
   {
     FT_Error  error = FT_Err_Invalid_Argument;
     FT_Glyph  glyph = NULL;
   {
     FT_Error  error = FT_Err_Invalid_Argument;
     FT_Glyph  glyph = NULL;
-
+    FT_Library library = stroker->library;
+    FT_UNUSED(library);
 
     if ( pglyph == NULL )
       goto Exit;
 
     glyph = *pglyph;
 
     if ( pglyph == NULL )
       goto Exit;
 
     glyph = *pglyph;
-    if ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class )
+    if ( glyph == NULL || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET )
       goto Exit;
 
     {
       goto Exit;
 
     {
           border = FT_STROKER_BORDER_LEFT;
       }
 
           border = FT_STROKER_BORDER_LEFT;
       }
 
-      error = FT_Stroker_ParseOutline( stroker, outline, 0 );
+      error = FT_Stroker_ParseOutline( stroker, outline, FALSE );
       if ( error )
         goto Fail;
 
       if ( error )
         goto Fail;
 
index ff88ce9..326d8e7 100644 (file)
 
 #include <ft2build.h>
 #include FT_SYNTHESIS_H
 
 #include <ft2build.h>
 #include FT_SYNTHESIS_H
+#include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_OUTLINE_H
 #include FT_BITMAP_H
 
 
 #include FT_INTERNAL_OBJECTS_H
 #include FT_OUTLINE_H
 #include FT_BITMAP_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_synth
+
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
   /*************************************************************************/
 
 
   /*************************************************************************/
 
 
-  FT_EXPORT_DEF( FT_Error )
-  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot )
-  {
-    if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP   &&
-         !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
-    {
-      FT_Bitmap  bitmap;
-      FT_Error   error;
-
-
-      FT_Bitmap_New( &bitmap );
-      error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
-      if ( error )
-        return error;
-
-      slot->bitmap = bitmap;
-      slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
-    }
-
-    return FT_Err_Ok;
-  }
-
-
   /* documentation is in ftsynth.h */
 
   FT_EXPORT_DEF( void )
   FT_GlyphSlot_Embolden( FT_GlyphSlot  slot )
   {
     FT_Library  library = slot->library;
   /* documentation is in ftsynth.h */
 
   FT_EXPORT_DEF( void )
   FT_GlyphSlot_Embolden( FT_GlyphSlot  slot )
   {
     FT_Library  library = slot->library;
-    FT_Face     face    = FT_SLOT_FACE( slot );
+    FT_Face     face    = slot->face;
     FT_Error    error;
     FT_Pos      xstr, ystr;
 
     FT_Error    error;
     FT_Pos      xstr, ystr;
 
     }
     else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
     {
     }
     else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
     {
-      xstr = FT_PIX_FLOOR( xstr );
+      /* round to full pixels */
+      xstr &= ~63;
       if ( xstr == 0 )
         xstr = 1 << 6;
       if ( xstr == 0 )
         xstr = 1 << 6;
-      ystr = FT_PIX_FLOOR( ystr );
-
+      ystr &= ~63;
+
+      /*
+       * XXX: overflow check for 16-bit system, for compatibility
+       *      with FT_GlyphSlot_Embolden() since freetype-2.1.10.
+       *      unfortunately, this function return no informations
+       *      about the cause of error.
+       */
+      if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )
+      {
+        FT_TRACE1(( "FT_GlyphSlot_Embolden:" ));
+        FT_TRACE1(( "too strong embolding parameter ystr=%d\n", ystr ));
+        return;
+      }
       error = FT_GlyphSlot_Own_Bitmap( slot );
       if ( error )
         return;
       error = FT_GlyphSlot_Own_Bitmap( slot );
       if ( error )
         return;
     slot->metrics.vertBearingY += ystr;
     slot->metrics.vertAdvance  += ystr;
 
     slot->metrics.vertBearingY += ystr;
     slot->metrics.vertAdvance  += ystr;
 
+    /* XXX: 16-bit overflow case must be excluded before here */
     if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
     if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
-      slot->bitmap_top += ystr >> 6;
+      slot->bitmap_top += (FT_Int)( ystr >> 6 );
   }
 
 
   }
 
 
index f61a3ed..4d06d6d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    ANSI-specific FreeType low-level system interface (body).            */
 /*                                                                         */
 /*                                                                         */
 /*    ANSI-specific FreeType low-level system interface (body).            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2006 by                                     */
+/*  Copyright 1996-2001, 2002, 2006, 2008, 2009 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
     file = STREAM_FILE( stream );
 
 
     file = STREAM_FILE( stream );
 
-    ft_fseek( file, offset, SEEK_SET );
+    if ( stream->pos != offset )
+      ft_fseek( file, offset, SEEK_SET );
 
     return (unsigned long)ft_fread( buffer, 1, count, file );
   }
 
     return (unsigned long)ft_fread( buffer, 1, count, file );
   }
     file = ft_fopen( filepathname, "rb" );
     if ( !file )
     {
     file = ft_fopen( filepathname, "rb" );
     if ( !file )
     {
-      FT_ERROR(( "FT_Stream_Open:" ));
-      FT_ERROR(( " could not open `%s'\n", filepathname ));
+      FT_ERROR(( "FT_Stream_Open:"
+                 " could not open `%s'\n", filepathname ));
 
       return FT_Err_Cannot_Open_Resource;
     }
 
       return FT_Err_Cannot_Open_Resource;
     }
 #ifdef FT_DEBUG_MEMORY
     ft_mem_debug_done( memory );
 #endif
 #ifdef FT_DEBUG_MEMORY
     ft_mem_debug_done( memory );
 #endif
-    memory->free( memory, memory );
+    ft_sfree( memory );
   }
 
 
   }
 
 
index 9f51394..fdf433a 100644 (file)
     val = ( val >= 0 ) ? val : -val;
 
     v1 = (FT_UInt32)val >> 16;
     val = ( val >= 0 ) ? val : -val;
 
     v1 = (FT_UInt32)val >> 16;
-    v2 = (FT_UInt32)val & 0xFFFFL;
+    v2 = (FT_UInt32)(val & 0xFFFFL);
 
 
-    k1 = FT_TRIG_SCALE >> 16;       /* constant */
-    k2 = FT_TRIG_SCALE & 0xFFFFL;   /* constant */
+    k1 = (FT_UInt32)FT_TRIG_SCALE >> 16;       /* constant */
+    k2 = (FT_UInt32)(FT_TRIG_SCALE & 0xFFFFL);   /* constant */
 
     hi   = k1 * v1;
     lo1  = k1 * v2 + k2 * v1;       /* can't overflow */
 
     hi   = k1 * v1;
     lo1  = k1 * v2 + k2 * v1;       /* can't overflow */
@@ -86,7 +86,7 @@
 
     hi  += lo1 >> 16;
     if ( lo1 < lo3 )
 
     hi  += lo1 >> 16;
     if ( lo1 < lo3 )
-      hi += 0x10000UL;
+      hi += (FT_UInt32)0x10000UL;
 
     val  = (FT_Fixed)hi;
 
 
     val  = (FT_Fixed)hi;
 
 
       if ( shift > 0 )
       {
 
       if ( shift > 0 )
       {
-        FT_Int32  half = 1L << ( shift - 1 );
+        FT_Int32  half = (FT_Int32)1L << ( shift - 1 );
 
 
         vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;
 
 
         vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;
index d6e4412..10f578a 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
 #
 
 
-# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007 by
+# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # 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 @@
 #   BASE_EXT_OBJ: A list of base layer extensions, i.e., components found
 #                 in `freetype/src/base' which are not compiled within the
 #                 base layer proper.
 #   BASE_EXT_OBJ: A list of base layer extensions, i.e., components found
 #                 in `freetype/src/base' which are not compiled within the
 #                 base layer proper.
-#
-# BASE_H is defined in freetype.mk to simplify the dependency rules.
 
 
 BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base)
 
 
 BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base)
@@ -35,17 +33,25 @@ BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base)
 # All files listed here should be included in `ftbase.c' (for a `single'
 # build).
 #
 # All files listed here should be included in `ftbase.c' (for a `single'
 # build).
 #
-BASE_SRC := $(BASE_DIR)/ftcalc.c   \
+BASE_SRC := $(BASE_DIR)/ftadvanc.c \
+            $(BASE_DIR)/ftcalc.c   \
             $(BASE_DIR)/ftdbgmem.c \
             $(BASE_DIR)/ftgloadr.c \
             $(BASE_DIR)/ftdbgmem.c \
             $(BASE_DIR)/ftgloadr.c \
-            $(BASE_DIR)/ftnames.c  \
             $(BASE_DIR)/ftobjs.c   \
             $(BASE_DIR)/ftoutln.c  \
             $(BASE_DIR)/ftrfork.c  \
             $(BASE_DIR)/ftobjs.c   \
             $(BASE_DIR)/ftoutln.c  \
             $(BASE_DIR)/ftrfork.c  \
+            $(BASE_DIR)/ftsnames.c \
             $(BASE_DIR)/ftstream.c \
             $(BASE_DIR)/fttrigon.c \
             $(BASE_DIR)/ftutil.c
 
             $(BASE_DIR)/ftstream.c \
             $(BASE_DIR)/fttrigon.c \
             $(BASE_DIR)/ftutil.c
 
+
+ifneq ($(ftmac_c),)
+  BASE_SRC += $(BASE_DIR)/$(ftmac_c)
+endif
+
+BASE_H := $(BASE_DIR)/ftbase.h
+
 # Base layer `extensions' sources
 #
 # An extension is added to the library file as a separate object.  It is
 # Base layer `extensions' sources
 #
 # An extension is added to the library file as a separate object.  It is
@@ -77,13 +83,13 @@ BASE_SRC_S := $(BASE_DIR)/ftbase.c
 
 # Base layer - single object build
 #
 
 # Base layer - single object build
 #
-$(BASE_OBJ_S): $(BASE_SRC_S) $(BASE_SRC) $(FREETYPE_H)
+$(BASE_OBJ_S): $(BASE_SRC_S) $(BASE_SRC) $(FREETYPE_H) $(BASE_H)
        $(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(BASE_SRC_S))
 
 
 # Multiple objects build + extensions
 #
        $(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(BASE_SRC_S))
 
 
 # Multiple objects build + extensions
 #
-$(OBJ_DIR)/%.$O: $(BASE_DIR)/%.c $(FREETYPE_H)
+$(OBJ_DIR)/%.$O: $(BASE_DIR)/%.c $(FREETYPE_H) $(BASE_H)
        $(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
 
 
        $(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
 
 
index 1b64426..561b415 100644 (file)
@@ -114,8 +114,8 @@ FT_BEGIN_HEADER
     union
     {
       char*          atom;
     union
     {
       char*          atom;
-      long           int32;
-      unsigned long  card32;
+      long           l;
+      unsigned long  ul;
 
     } value;             /* Value of the property.  */
 
 
     } value;             /* Value of the property.  */
 
@@ -160,7 +160,7 @@ FT_BEGIN_HEADER
   typedef struct  _hashnode_
   {
     const char*  key;
   typedef struct  _hashnode_
   {
     const char*  key;
-    void*        data;
+    size_t       data;
 
   } _hashnode, *hashnode;
 
 
   } _hashnode, *hashnode;
 
index 74cc2f1..631ec46 100644 (file)
@@ -2,7 +2,7 @@
 
     FreeType font driver for bdf files
 
 
     FreeType font driver for bdf files
 
-    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by
+    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -53,7 +53,7 @@ THE SOFTWARE.
   typedef struct  BDF_CMapRec_
   {
     FT_CMapRec        cmap;
   typedef struct  BDF_CMapRec_
   {
     FT_CMapRec        cmap;
-    FT_UInt           num_encodings;
+    FT_ULong          num_encodings; /* ftobjs.h: FT_CMap->clazz->size */
     BDF_encoding_el*  encodings;
 
   } BDF_CMapRec, *BDF_CMap;
     BDF_encoding_el*  encodings;
 
   } BDF_CMapRec, *BDF_CMap;
@@ -92,8 +92,8 @@ THE SOFTWARE.
   {
     BDF_CMap          cmap      = (BDF_CMap)bdfcmap;
     BDF_encoding_el*  encodings = cmap->encodings;
   {
     BDF_CMap          cmap      = (BDF_CMap)bdfcmap;
     BDF_encoding_el*  encodings = cmap->encodings;
-    FT_UInt           min, max, mid;
-    FT_UInt           result    = 0;
+    FT_ULong          min, max, mid; /* num_encodings */
+    FT_UShort         result    = 0; /* encodings->glyph */
 
 
     min = 0;
 
 
     min = 0;
@@ -101,7 +101,7 @@ THE SOFTWARE.
 
     while ( min < max )
     {
 
     while ( min < max )
     {
-      FT_UInt32  code;
+      FT_ULong  code;
 
 
       mid  = ( min + max ) >> 1;
 
 
       mid  = ( min + max ) >> 1;
@@ -131,9 +131,9 @@ THE SOFTWARE.
   {
     BDF_CMap          cmap      = (BDF_CMap)bdfcmap;
     BDF_encoding_el*  encodings = cmap->encodings;
   {
     BDF_CMap          cmap      = (BDF_CMap)bdfcmap;
     BDF_encoding_el*  encodings = cmap->encodings;
-    FT_UInt           min, max, mid;
-    FT_UInt32         charcode = *acharcode + 1;
-    FT_UInt           result   = 0;
+    FT_ULong          min, max, mid; /* num_encodings */
+    FT_UShort         result   = 0;  /* encodings->glyph */
+    FT_ULong          charcode = *acharcode + 1;
 
 
     min = 0;
 
 
     min = 0;
@@ -141,7 +141,7 @@ THE SOFTWARE.
 
     while ( min < max )
     {
 
     while ( min < max )
     {
-      FT_UInt32  code;
+      FT_ULong  code; /* same as BDF_encoding_el.enc */
 
 
       mid  = ( min + max ) >> 1;
 
 
       mid  = ( min + max ) >> 1;
@@ -169,7 +169,14 @@ THE SOFTWARE.
     }
 
   Exit:
     }
 
   Exit:
-    *acharcode = charcode;
+    if ( charcode > 0xFFFFFFFFUL )
+    {
+      FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%x > 32bit API" ));
+      *acharcode = 0;
+      /* XXX: result should be changed to indicate an overflow error */
+    }
+    else
+      *acharcode = (FT_UInt32)charcode;
     return result;
   }
 
     return result;
   }
 
@@ -181,7 +188,9 @@ THE SOFTWARE.
     bdf_cmap_init,
     bdf_cmap_done,
     bdf_cmap_char_index,
     bdf_cmap_init,
     bdf_cmap_done,
     bdf_cmap_char_index,
-    bdf_cmap_char_next
+    bdf_cmap_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
   };
 
 
   };
 
 
@@ -194,9 +203,8 @@ THE SOFTWARE.
     bdf_font_t*      font   = bdf->bdffont;
     bdf_property_t*  prop;
 
     bdf_font_t*      font   = bdf->bdffont;
     bdf_property_t*  prop;
 
-    int    nn, len;
-    char*  strings[4] = { NULL, NULL, NULL, NULL };
-    int    lengths[4];
+    char*   strings[4] = { NULL, NULL, NULL, NULL };
+    size_t  nn, len, lengths[4];
 
 
     face->style_flags = 0;
 
 
     face->style_flags = 0;
@@ -282,7 +290,7 @@ THE SOFTWARE.
         /* add_style_name and setwidth_name     */
         if ( nn == 0 || nn == 3 )
         {
         /* add_style_name and setwidth_name     */
         if ( nn == 0 || nn == 3 )
         {
-          int  mm;
+          size_t  mm;
 
 
           for ( mm = 0; mm < len; mm++ )
 
 
           for ( mm = 0; mm < len; mm++ )
@@ -302,9 +310,14 @@ THE SOFTWARE.
   FT_CALLBACK_DEF( void )
   BDF_Face_Done( FT_Face  bdfface )         /* BDF_Face */
   {
   FT_CALLBACK_DEF( void )
   BDF_Face_Done( FT_Face  bdfface )         /* BDF_Face */
   {
-    BDF_Face   face   = (BDF_Face)bdfface;
-    FT_Memory  memory = FT_FACE_MEMORY( face );
+    BDF_Face   face = (BDF_Face)bdfface;
+    FT_Memory  memory;
+
+
+    if ( !face )
+      return;
 
 
+    memory = FT_FACE_MEMORY( face );
 
     bdf_free_font( face->bdffont );
 
 
     bdf_free_font( face->bdffont );
 
@@ -419,7 +432,7 @@ THE SOFTWARE.
 
         prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
         if ( prop )
 
         prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
         if ( prop )
-          bsize->width = (FT_Short)( ( prop->value.int32 + 5 ) / 10 );
+          bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 );
         else
           bsize->width = (FT_Short)( bsize->height * 2/3 );
 
         else
           bsize->width = (FT_Short)( bsize->height * 2/3 );
 
@@ -427,21 +440,21 @@ THE SOFTWARE.
         if ( prop )
           /* convert from 722.7 decipoints to 72 points per inch */
           bsize->size =
         if ( prop )
           /* convert from 722.7 decipoints to 72 points per inch */
           bsize->size =
-            (FT_Pos)( ( prop->value.int32 * 64 * 7200 + 36135L ) / 72270L );
+            (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L );
         else
           bsize->size = bsize->width << 6;
 
         prop = bdf_get_font_property( font, "PIXEL_SIZE" );
         if ( prop )
         else
           bsize->size = bsize->width << 6;
 
         prop = bdf_get_font_property( font, "PIXEL_SIZE" );
         if ( prop )
-          bsize->y_ppem = (FT_Short)prop->value.int32 << 6;
+          bsize->y_ppem = (FT_Short)prop->value.l << 6;
 
         prop = bdf_get_font_property( font, "RESOLUTION_X" );
         if ( prop )
 
         prop = bdf_get_font_property( font, "RESOLUTION_X" );
         if ( prop )
-          resolution_x = (FT_Short)prop->value.int32;
+          resolution_x = (FT_Short)prop->value.l;
 
         prop = bdf_get_font_property( font, "RESOLUTION_Y" );
         if ( prop )
 
         prop = bdf_get_font_property( font, "RESOLUTION_Y" );
         if ( prop )
-          resolution_y = (FT_Short)prop->value.int32;
+          resolution_y = (FT_Short)prop->value.l;
 
         if ( bsize->y_ppem == 0 )
         {
 
         if ( bsize->y_ppem == 0 )
         {
@@ -472,7 +485,12 @@ THE SOFTWARE.
           (face->en_table[n]).glyph = (FT_Short)n;
 
           if ( cur[n].encoding == font->default_char )
           (face->en_table[n]).glyph = (FT_Short)n;
 
           if ( cur[n].encoding == font->default_char )
-            face->default_glyph = n;
+          {
+            if ( n < FT_UINT_MAX )
+              face->default_glyph = (FT_UInt)n;
+            else
+              FT_TRACE1(( "idx %d is too large for this system\n", n ));
+          }
         }
       }
 
         }
       }
 
@@ -608,7 +626,7 @@ THE SOFTWARE.
     switch ( req->type )
     {
     case FT_SIZE_REQUEST_TYPE_NOMINAL:
     switch ( req->type )
     {
     case FT_SIZE_REQUEST_TYPE_NOMINAL:
-      if ( height == ( bsize->y_ppem + 32 ) >> 6 )
+      if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
         error = BDF_Err_Ok;
       break;
 
         error = BDF_Err_Ok;
       break;
 
@@ -664,7 +682,10 @@ THE SOFTWARE.
 
     bitmap->rows  = glyph.bbx.height;
     bitmap->width = glyph.bbx.width;
 
     bitmap->rows  = glyph.bbx.height;
     bitmap->width = glyph.bbx.width;
-    bitmap->pitch = glyph.bpr;
+    if ( glyph.bpr > INT_MAX )
+      FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n",
+                   glyph.bpr ));
+    bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */
 
     /* note: we don't allocate a new array to hold the bitmap; */
     /*       we can simply point to it                         */
 
     /* note: we don't allocate a new array to hold the bitmap; */
     /*       we can simply point to it                         */
@@ -736,13 +757,23 @@ THE SOFTWARE.
         break;
 
       case BDF_INTEGER:
         break;
 
       case BDF_INTEGER:
+        if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
+        {
+          FT_TRACE1(( "bdf_get_bdf_property: " ));
+          FT_TRACE1(( "too large integer 0x%x is truncated\n" ));
+        }
         aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
         aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
-        aproperty->u.integer = prop->value.int32;
+        aproperty->u.integer = (FT_Int32)prop->value.l;
         break;
 
       case BDF_CARDINAL:
         break;
 
       case BDF_CARDINAL:
+        if ( prop->value.ul > 0xFFFFFFFFUL )
+        {
+          FT_TRACE1(( "bdf_get_bdf_property: " ));
+          FT_TRACE1(( "too large cardinal 0x%x is truncated\n" ));
+        }
         aproperty->type       = BDF_PROPERTY_TYPE_CARDINAL;
         aproperty->type       = BDF_PROPERTY_TYPE_CARDINAL;
-        aproperty->u.cardinal = prop->value.card32;
+        aproperty->u.cardinal = (FT_UInt32)prop->value.ul;
         break;
 
       default:
         break;
 
       default:
index 86f40ee..db7093b 100644 (file)
@@ -36,6 +36,10 @@ THE SOFTWARE.
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
 
   typedef struct  BDF_encoding_el_
   {
 
   typedef struct  BDF_encoding_el_
   {
index 512cd62..5fa5868 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright 2000 Computing Research Labs, New Mexico State University
 /*
  * Copyright 2000 Computing Research Labs, New Mexico State University
- * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
  *   Francesco Zappa Nardelli
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  *   Francesco Zappa Nardelli
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
 
   static FT_Error
   hash_insert( char*       key,
 
   static FT_Error
   hash_insert( char*       key,
-               void*       data,
+               size_t      data,
                hashtable*  ht,
                FT_Memory   memory )
   {
                hashtable*  ht,
                FT_Memory   memory )
   {
 
 
   static FT_Error
 
 
   static FT_Error
-  _bdf_list_ensure( _bdf_list_t*  list,
-                    int           num_items )
+  _bdf_list_ensure( _bdf_list_t*   list,
+                    unsigned long  num_items ) /* same as _bdf_list_t.used */
   {
     FT_Error  error = BDF_Err_Ok;
 
 
   {
     FT_Error  error = BDF_Err_Ok;
 
 
-    if ( num_items > (int)list->size )
+    if ( num_items > list->size )
     {
     {
-      int        oldsize = list->size;
-      int        newsize = oldsize + ( oldsize >> 1 ) + 4;
-      int        bigsize = FT_INT_MAX / sizeof ( char* );
-      FT_Memory  memory  = list->memory;
+      unsigned long  oldsize = list->size; /* same as _bdf_list_t.size */
+      unsigned long  newsize = oldsize + ( oldsize >> 1 ) + 4;
+      unsigned long  bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) );
+      FT_Memory      memory  = list->memory;
 
 
       if ( oldsize == bigsize )
 
 
       if ( oldsize == bigsize )
   {
     _bdf_line_func_t  cb;
     unsigned long     lineno, buf_size;
   {
     _bdf_line_func_t  cb;
     unsigned long     lineno, buf_size;
-    int               refill, bytes, hold, to_skip;
-    int               start, end, cursor, avail;
+    int               refill, hold, to_skip;
+    ptrdiff_t         bytes, start, end, cursor, avail;
     char*             buf = 0;
     FT_Memory         memory = stream->memory;
     FT_Error          error = BDF_Err_Ok;
     char*             buf = 0;
     FT_Memory         memory = stream->memory;
     FT_Error          error = BDF_Err_Ok;
     {
       if ( refill )
       {
     {
       if ( refill )
       {
-        bytes  = (int)FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor,
-                                         (FT_ULong)(buf_size - cursor) );
+        bytes  = (ptrdiff_t)FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor,
+                                               (FT_ULong)(buf_size - cursor) );
         avail  = cursor + bytes;
         cursor = 0;
         refill = 0;
         avail  = cursor + bytes;
         cursor = 0;
         refill = 0;
                        int          format,
                        bdf_font_t*  font )
   {
                        int          format,
                        bdf_font_t*  font )
   {
-    unsigned long    n;
+    size_t           n;
     bdf_property_t*  p;
     FT_Memory        memory = font->memory;
     FT_Error         error = BDF_Err_Ok;
     bdf_property_t*  p;
     FT_Memory        memory = font->memory;
     FT_Error         error = BDF_Err_Ok;
     p = font->user_props + font->nuser_props;
     FT_ZERO( p );
 
     p = font->user_props + font->nuser_props;
     FT_ZERO( p );
 
-    n = (unsigned long)( ft_strlen( name ) + 1 );
+    n = ft_strlen( name ) + 1;
+    if ( n > FT_ULONG_MAX )
+      return BDF_Err_Invalid_Argument;
 
     if ( FT_NEW_ARRAY( p->name, n ) )
       goto Exit;
 
     if ( FT_NEW_ARRAY( p->name, n ) )
       goto Exit;
 
     n = _num_bdf_properties + font->nuser_props;
 
 
     n = _num_bdf_properties + font->nuser_props;
 
-    error = hash_insert( p->name, (void *)n, &(font->proptbl), memory );
+    error = hash_insert( p->name, n, &(font->proptbl), memory );
     if ( error )
       goto Exit;
 
     if ( error )
       goto Exit;
 
   bdf_get_property( char*        name,
                     bdf_font_t*  font )
   {
   bdf_get_property( char*        name,
                     bdf_font_t*  font )
   {
-    hashnode       hn;
-    unsigned long  propid;
+    hashnode  hn;
+    size_t    propid;
 
 
     if ( name == 0 || *name == 0 )
 
 
     if ( name == 0 || *name == 0 )
     if ( ( hn = hash_lookup( name, &(font->proptbl) ) ) == 0 )
       return 0;
 
     if ( ( hn = hash_lookup( name, &(font->proptbl) ) ) == 0 )
       return 0;
 
-    propid = (unsigned long)hn->data;
+    propid = hn->data;
     if ( propid >= _num_bdf_properties )
       return font->user_props + ( propid - _num_bdf_properties );
 
     if ( propid >= _num_bdf_properties )
       return font->user_props + ( propid - _num_bdf_properties );
 
   _bdf_set_default_spacing( bdf_font_t*     font,
                             bdf_options_t*  opts )
   {
   _bdf_set_default_spacing( bdf_font_t*     font,
                             bdf_options_t*  opts )
   {
-    unsigned long  len;
-    char           name[256];
-    _bdf_list_t    list;
-    FT_Memory      memory;
-    FT_Error       error = BDF_Err_Ok;
+    size_t       len;
+    char         name[256];
+    _bdf_list_t  list;
+    FT_Memory    memory;
+    FT_Error     error = BDF_Err_Ok;
 
 
     if ( font == 0 || font->name == 0 || font->name[0] == 0 )
 
 
     if ( font == 0 || font->name == 0 || font->name[0] == 0 )
 
     font->spacing = opts->font_spacing;
 
 
     font->spacing = opts->font_spacing;
 
-    len = (unsigned long)( ft_strlen( font->name ) + 1 );
+    len = ft_strlen( font->name ) + 1;
     /* Limit ourselves to 256 characters in the font name. */
     if ( len >= 256 )
     {
     /* Limit ourselves to 256 characters in the font name. */
     if ( len >= 256 )
     {
                      char*        name,
                      char*        value )
   {
                      char*        name,
                      char*        value )
   {
-    unsigned long   propid;
+    size_t          propid;
     hashnode        hn;
     bdf_property_t  *prop, *fp;
     FT_Memory       memory = font->memory;
     hashnode        hn;
     bdf_property_t  *prop, *fp;
     FT_Memory       memory = font->memory;
     {
       /* The property already exists in the font, so simply replace */
       /* the value of the property with the current value.          */
     {
       /* The property already exists in the font, so simply replace */
       /* the value of the property with the current value.          */
-      fp = font->props + (unsigned long)hn->data;
+      fp = font->props + hn->data;
 
       switch ( fp->format )
       {
 
       switch ( fp->format )
       {
         break;
 
       case BDF_INTEGER:
         break;
 
       case BDF_INTEGER:
-        fp->value.int32 = _bdf_atol( value, 0, 10 );
+        fp->value.l = _bdf_atol( value, 0, 10 );
         break;
 
       case BDF_CARDINAL:
         break;
 
       case BDF_CARDINAL:
-        fp->value.card32 = _bdf_atoul( value, 0, 10 );
+        fp->value.ul = _bdf_atoul( value, 0, 10 );
         break;
 
       default:
         break;
 
       default:
       font->props_size++;
     }
 
       font->props_size++;
     }
 
-    propid = (unsigned long)hn->data;
+    propid = hn->data;
     if ( propid >= _num_bdf_properties )
       prop = font->user_props + ( propid - _num_bdf_properties );
     else
     if ( propid >= _num_bdf_properties )
       prop = font->user_props + ( propid - _num_bdf_properties );
     else
       break;
 
     case BDF_INTEGER:
       break;
 
     case BDF_INTEGER:
-      fp->value.int32 = _bdf_atol( value, 0, 10 );
+      fp->value.l = _bdf_atol( value, 0, 10 );
       break;
 
     case BDF_CARDINAL:
       break;
 
     case BDF_CARDINAL:
-      fp->value.card32 = _bdf_atoul( value, 0, 10 );
+      fp->value.ul = _bdf_atoul( value, 0, 10 );
       break;
     }
 
       break;
     }
 
     if ( ft_memcmp( name, "COMMENT", 7 ) != 0 ) {
       /* Add the property to the font property table. */
       error = hash_insert( fp->name,
     if ( ft_memcmp( name, "COMMENT", 7 ) != 0 ) {
       /* Add the property to the font property table. */
       error = hash_insert( fp->name,
-                           (void *)font->props_used,
+                           font->props_used,
                            (hashtable *)font->internal,
                            memory );
       if ( error )
                            (hashtable *)font->internal,
                            memory );
       if ( error )
     /* present, and the SPACING property should override the default       */
     /* spacing.                                                            */
     if ( ft_memcmp( name, "DEFAULT_CHAR", 12 ) == 0 )
     /* present, and the SPACING property should override the default       */
     /* spacing.                                                            */
     if ( ft_memcmp( name, "DEFAULT_CHAR", 12 ) == 0 )
-      font->default_char = fp->value.int32;
+      font->default_char = fp->value.l;
     else if ( ft_memcmp( name, "FONT_ASCENT", 11 ) == 0 )
     else if ( ft_memcmp( name, "FONT_ASCENT", 11 ) == 0 )
-      font->font_ascent = fp->value.int32;
+      font->font_ascent = fp->value.l;
     else if ( ft_memcmp( name, "FONT_DESCENT", 12 ) == 0 )
     else if ( ft_memcmp( name, "FONT_DESCENT", 12 ) == 0 )
-      font->font_descent = fp->value.int32;
+      font->font_descent = fp->value.l;
     else if ( ft_memcmp( name, "SPACING", 7 ) == 0 )
     {
     else if ( ft_memcmp( name, "SPACING", 7 ) == 0 )
     {
+      if ( !fp->value.atom )
+      {
+        error = BDF_Err_Invalid_File_Format;
+        goto Exit;
+      }
+
       if ( fp->value.atom[0] == 'p' || fp->value.atom[0] == 'P' )
         font->spacing = BDF_PROPORTIONAL;
       else if ( fp->value.atom[0] == 'm' || fp->value.atom[0] == 'M' )
       if ( fp->value.atom[0] == 'p' || fp->value.atom[0] == 'P' )
         font->spacing = BDF_PROPORTIONAL;
       else if ( fp->value.atom[0] == 'm' || fp->value.atom[0] == 'M' )
       p->memory    = 0;
 
       { /* setup */
       p->memory    = 0;
 
       { /* setup */
-        unsigned long    i;
+        size_t           i;
         bdf_property_t*  prop;
 
 
         bdf_property_t*  prop;
 
 
         for ( i = 0, prop = (bdf_property_t*)_bdf_properties;
               i < _num_bdf_properties; i++, prop++ )
         {
         for ( i = 0, prop = (bdf_property_t*)_bdf_properties;
               i < _num_bdf_properties; i++, prop++ )
         {
-          error = hash_insert( prop->name, (void *)i,
+          error = hash_insert( prop->name, i,
                                &(font->proptbl), memory );
           if ( error )
             goto Exit;
                                &(font->proptbl), memory );
           if ( error )
             goto Exit;
       error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
       if ( error )
         goto Exit;
       error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
       if ( error )
         goto Exit;
+      /* at this point, `p->font' can't be NULL */
       p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1], 0, 10 );
 
       if ( FT_NEW_ARRAY( p->font->props, p->cnt ) )
       p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1], 0, 10 );
 
       if ( FT_NEW_ARRAY( p->font->props, p->cnt ) )
 
     hn = hash_lookup( name, (hashtable *)font->internal );
 
 
     hn = hash_lookup( name, (hashtable *)font->internal );
 
-    return hn ? ( font->props + (unsigned long)hn->data ) : 0;
+    return hn ? ( font->props + hn->data ) : 0;
   }
 
 
   }
 
 
index dfaa274..fe06ae8 100644 (file)
@@ -27,7 +27,7 @@
 FTMODULE_H_COMMANDS += BDF_DRIVER
 
 define BDF_DRIVER
 FTMODULE_H_COMMANDS += BDF_DRIVER
 
 define BDF_DRIVER
-$(OPEN_DRIVER)bdf_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, bdf_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)bdf       $(ECHO_DRIVER_DESC)bdf bitmap fonts$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)bdf       $(ECHO_DRIVER_DESC)bdf bitmap fonts$(ECHO_DRIVER_DONE)
 endef
 
index 25d98e5..6ff1614 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
 #
 
 
-# Copyright (C) 2001, 2002, 2003 by
+# Copyright (C) 2001, 2002, 2003, 2008 by
 # Francesco Zappa Nardelli
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # Francesco Zappa Nardelli
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -29,7 +29,7 @@
 
 # bdf driver directory
 #
 
 # bdf driver directory
 #
-BDF_DIR  := $(SRC_DIR)/bdf
+BDF_DIR := $(SRC_DIR)/bdf
 
 
 BDF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(BDF_DIR))
 
 
 BDF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(BDF_DIR))
@@ -44,7 +44,8 @@ BDF_DRV_SRC := $(BDF_DIR)/bdflib.c \
 # bdf driver headers
 #
 BDF_DRV_H := $(BDF_DIR)/bdf.h \
 # bdf driver headers
 #
 BDF_DRV_H := $(BDF_DIR)/bdf.h \
-             $(BDF_DIR)/bdfdrivr.h
+             $(BDF_DIR)/bdfdrivr.h \
+             $(BDF_DIR)/bdferror.h
 
 # bdf driver object(s)
 #
 
 # bdf driver object(s)
 #
index f2e6229..ebc8871 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType basic cache interface (body).                           */
 /*                                                                         */
 /*                                                                         */
 /*    The FreeType basic cache interface (body).                           */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007 by                              */
+/*  Copyright 2003, 2004, 2005, 2006, 2007, 2009 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 
 #include <ft2build.h>
 
 
 #include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
 #include FT_CACHE_H
 #include "ftcglyph.h"
 #include "ftcimage.h"
 #include "ftcsbits.h"
 #include FT_CACHE_H
 #include "ftcglyph.h"
 #include "ftcimage.h"
 #include "ftcsbits.h"
-#include FT_INTERNAL_MEMORY_H
 
 #include "ftccback.h"
 #include "ftcerror.h"
 
 
 #include "ftccback.h"
 #include "ftcerror.h"
 
+#define FT_COMPONENT  trace_cache
+
 
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
 
 
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
 
 
     error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,
                                     &face );
 
     error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,
                                     &face );
+
+    if ( error || !face )
+      return result;
+
+    if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
+    {
+      FT_TRACE1(( "ftc_basic_family_get_count: too large number of glyphs " ));
+      FT_TRACE1(( "in this face, truncated\n", face->num_glyphs ));
+    }
+
     if ( !error )
     if ( !error )
-      result = face->num_glyphs;
+      result = (FT_UInt)face->num_glyphs;
 
     return result;
   }
 
     return result;
   }
                          FTC_Node       *anode )
   {
     FTC_BasicQueryRec  query;
                          FTC_Node       *anode )
   {
     FTC_BasicQueryRec  query;
-    FTC_INode          node = 0;  /* make compiler happy */
+    FTC_Node           node = 0; /* make compiler happy */
     FT_Error           error;
     FT_UInt32          hash;
 
     FT_Error           error;
     FT_UInt32          hash;
 
     if ( anode )
       *anode  = NULL;
 
     if ( anode )
       *anode  = NULL;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+#if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU )
 
     /*
      *  This one is a major hack used to detect whether we are passed a
      *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
      */
 
     /*
      *  This one is a major hack used to detect whether we are passed a
      *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
      */
-    if ( type->width >= 0x10000 )
+    if ( (FT_ULong)type->width >= 0x10000L )
     {
       FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;
 
     {
       FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;
 
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
     {
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
     {
+      if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )
+      {
+        FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" ));
+        FT_TRACE1(( "0x%x are dropped\n", (type->flags & ~((FT_ULong)FT_UINT_MAX)) ));
+      }
+
       query.attrs.scaler.face_id = type->face_id;
       query.attrs.scaler.width   = type->width;
       query.attrs.scaler.height  = type->height;
       query.attrs.scaler.face_id = type->face_id;
       query.attrs.scaler.width   = type->width;
       query.attrs.scaler.height  = type->height;
-      query.attrs.load_flags     = type->flags;
+      query.attrs.load_flags     = (FT_UInt)type->flags;
     }
 
     query.attrs.scaler.pixel = 1;
     }
 
     query.attrs.scaler.pixel = 1;
     error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
                                hash, gindex,
                                FTC_GQUERY( &query ),
     error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
                                hash, gindex,
                                FTC_GQUERY( &query ),
-                               (FTC_Node*) &node );
+                               &node );
 #endif
     if ( !error )
     {
 #endif
     if ( !error )
     {
 
       if ( anode )
       {
 
       if ( anode )
       {
-        *anode = FTC_NODE( node );
-        FTC_NODE( node )->ref_count++;
+        *anode = node;
+        node->ref_count++;
       }
     }
 
       }
     }
 
                                FTC_Node       *anode )
   {
     FTC_BasicQueryRec  query;
                                FTC_Node       *anode )
   {
     FTC_BasicQueryRec  query;
-    FTC_INode          node = 0;  /* make compiler happy */
+    FTC_Node           node = 0; /* make compiler happy */
     FT_Error           error;
     FT_UInt32          hash;
 
     FT_Error           error;
     FT_UInt32          hash;
 
     if ( anode )
       *anode  = NULL;
 
     if ( anode )
       *anode  = NULL;
 
+    /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */
+    if ( load_flags > FT_UINT_MAX )
+    {
+      FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" ));
+      FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));
+    }
+
     query.attrs.scaler     = scaler[0];
     query.attrs.scaler     = scaler[0];
-    query.attrs.load_flags = load_flags;
+    query.attrs.load_flags = (FT_UInt)load_flags;
 
     hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
 
 
     hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
 
 
       if ( anode )
       {
 
       if ( anode )
       {
-        *anode = FTC_NODE( node );
-        FTC_NODE( node )->ref_count++;
+        *anode = node;
+        node->ref_count++;
       }
     }
 
       }
     }
 
   }
 
 
   }
 
 
-
+  
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
 
   /* yet another backwards-legacy structure */
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
 
   /* yet another backwards-legacy structure */
   {
     FT_Error           error;
     FTC_BasicQueryRec  query;
   {
     FT_Error           error;
     FTC_BasicQueryRec  query;
-    FTC_SNode          node = 0; /* make compiler happy */
+    FTC_Node           node = 0; /* make compiler happy */
     FT_UInt32          hash;
 
 
     FT_UInt32          hash;
 
 
 
     *ansbit = NULL;
 
 
     *ansbit = NULL;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+#if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU )
 
     /*  This one is a major hack used to detect whether we are passed a
      *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
      */
 
     /*  This one is a major hack used to detect whether we are passed a
      *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
      */
-    if ( type->width >= 0x10000 )
+    if ( (FT_ULong)type->width >= 0x10000L )
     {
       FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;
 
     {
       FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;
 
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
     {
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
     {
+      if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )
+      {
+        FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" ));
+        FT_TRACE1(( "0x%x are dropped\n", (type->flags & ~((FT_ULong)FT_UINT_MAX)) ));
+      }
+
       query.attrs.scaler.face_id = type->face_id;
       query.attrs.scaler.width   = type->width;
       query.attrs.scaler.height  = type->height;
       query.attrs.scaler.face_id = type->face_id;
       query.attrs.scaler.width   = type->width;
       query.attrs.scaler.height  = type->height;
-      query.attrs.load_flags     = type->flags;
+      query.attrs.load_flags     = (FT_UInt)type->flags;
     }
 
     query.attrs.scaler.pixel = 1;
     }
 
     query.attrs.scaler.pixel = 1;
                                hash,
                                gindex,
                                FTC_GQUERY( &query ),
                                hash,
                                gindex,
                                FTC_GQUERY( &query ),
-                               (FTC_Node*)&node );
+                               &node );
 #endif
     if ( error )
       goto Exit;
 
 #endif
     if ( error )
       goto Exit;
 
-    *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );
+    *ansbit = FTC_SNODE( node )->sbits +
+              ( gindex - FTC_GNODE( node )->gindex );
 
     if ( anode )
     {
 
     if ( anode )
     {
-      *anode = FTC_NODE( node );
-      FTC_NODE( node )->ref_count++;
+      *anode = node;
+      node->ref_count++;
     }
 
   Exit:
     }
 
   Exit:
   {
     FT_Error           error;
     FTC_BasicQueryRec  query;
   {
     FT_Error           error;
     FTC_BasicQueryRec  query;
-    FTC_SNode          node = 0; /* make compiler happy */
+    FTC_Node           node = 0; /* make compiler happy */
     FT_UInt32          hash;
 
 
     FT_UInt32          hash;
 
 
 
     *ansbit = NULL;
 
 
     *ansbit = NULL;
 
+    /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */
+    if ( load_flags > FT_UINT_MAX )
+    {
+      FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" ));
+      FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));
+    }
+
     query.attrs.scaler     = scaler[0];
     query.attrs.scaler     = scaler[0];
-    query.attrs.load_flags = load_flags;
+    query.attrs.load_flags = (FT_UInt)load_flags;
 
     /* beware, the hash must be the same for all glyph ranges! */
     hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
 
     /* beware, the hash must be the same for all glyph ranges! */
     hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
     if ( error )
       goto Exit;
 
     if ( error )
       goto Exit;
 
-    *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );
+    *ansbit = FTC_SNODE( node )->sbits +
+              ( gindex - FTC_GNODE( node )->gindex );
 
     if ( anode )
     {
 
     if ( anode )
     {
-      *anode = FTC_NODE( node );
-      FTC_NODE( node )->ref_count++;
+      *anode = node;
+      node->ref_count++;
     }
 
   Exit:
     }
 
   Exit:
index f3e699c..463addd 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType internal cache interface (body).                        */
 /*                                                                         */
 /*                                                                         */
 /*    The FreeType internal cache interface (body).                        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -24,6 +24,9 @@
 #include "ftccback.h"
 #include "ftcerror.h"
 
 #include "ftccback.h"
 #include "ftcerror.h"
 
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_cache
+
 
 #define FTC_HASH_MAX_LOAD  2
 #define FTC_HASH_MIN_LOAD  1
 
 #define FTC_HASH_MAX_LOAD  2
 #define FTC_HASH_MIN_LOAD  1
@@ -93,9 +96,9 @@
     for (;;)
     {
       FTC_Node  node, *pnode;
     for (;;)
     {
       FTC_Node  node, *pnode;
-      FT_UInt   p      = cache->p;
-      FT_UInt   mask   = cache->mask;
-      FT_UInt   count  = mask + p + 1;    /* number of buckets */
+      FT_UFast  p      = cache->p;
+      FT_UFast  mask   = cache->mask;
+      FT_UFast  count  = mask + p + 1;    /* number of buckets */
 
 
       /* do we need to shrink the buckets array? */
 
 
       /* do we need to shrink the buckets array? */
       /* do we need to expand the buckets array? */
       else if ( cache->slack > (FT_Long)count * FTC_HASH_SUB_LOAD )
       {
       /* 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;
+        FT_UFast   old_index = p + mask;
         FTC_Node*  pold;
 
 
         FTC_Node*  pold;
 
 
 
       if ( node == NULL )
       {
 
       if ( node == NULL )
       {
-        FT_ERROR(( "ftc_node_hash_unlink: unknown node!\n" ));
+        FT_TRACE0(( "ftc_node_hash_unlink: unknown node\n" ));
         return;
       }
 
         return;
       }
 
     /* find node's cache */
     if ( node->cache_index >= manager->num_caches )
     {
     /* find node's cache */
     if ( node->cache_index >= manager->num_caches )
     {
-      FT_ERROR(( "ftc_node_destroy: invalid node handle\n" ));
+      FT_TRACE0(( "ftc_node_destroy: invalid node handle\n" ));
       return;
     }
 #endif
       return;
     }
 #endif
 #ifdef FT_DEBUG_ERROR
     if ( cache == NULL )
     {
 #ifdef FT_DEBUG_ERROR
     if ( cache == NULL )
     {
-      FT_ERROR(( "ftc_node_destroy: invalid node handle\n" ));
+      FT_TRACE0(( "ftc_node_destroy: invalid node handle\n" ));
       return;
     }
 #endif
       return;
     }
 #endif
 #if 0
     /* check, just in case of general corruption :-) */
     if ( manager->num_nodes == 0 )
 #if 0
     /* check, just in case of general corruption :-) */
     if ( manager->num_nodes == 0 )
-      FT_ERROR(( "ftc_node_destroy: invalid cache node count! = %d\n",
+      FT_TRACE0(( "ftc_node_destroy: invalid cache node count (%d)\n",
                   manager->num_nodes ));
 #endif
   }
                   manager->num_nodes ));
 #endif
   }
     {
       FTC_Manager  manager = cache->manager;
       FT_UFast     i;
     {
       FTC_Manager  manager = cache->manager;
       FT_UFast     i;
-      FT_UInt      count;
+      FT_UFast     count;
 
 
       count = cache->p + cache->mask + 1;
 
 
       count = cache->p + cache->mask + 1;
index 8c0a7c9..2082bc4 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType internal cache interface (specification).                   */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType internal cache interface (specification).                   */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -91,7 +91,7 @@ FT_BEGIN_HEADER
                        FT_Pointer   query,
                        FTC_Cache    cache );
 
                        FT_Pointer   query,
                        FTC_Cache    cache );
 
-  typedef FT_ULong
+  typedef FT_Offset
   (*FTC_Node_WeightFunc)( FTC_Node   node,
                           FTC_Cache  cache );
 
   (*FTC_Node_WeightFunc)( FTC_Node   node,
                           FTC_Cache  cache );
 
@@ -121,7 +121,7 @@ FT_BEGIN_HEADER
     FTC_Node_CompareFunc  node_remove_faceid;
     FTC_Node_FreeFunc     node_free;
 
     FTC_Node_CompareFunc  node_remove_faceid;
     FTC_Node_FreeFunc     node_free;
 
-    FT_UInt               cache_size;
+    FT_Offset             cache_size;
     FTC_Cache_InitFunc    cache_init;
     FTC_Cache_DoneFunc    cache_done;
 
     FTC_Cache_InitFunc    cache_init;
     FTC_Cache_DoneFunc    cache_done;
 
@@ -202,7 +202,7 @@ FT_BEGIN_HEADER
     FTC_Cache             _cache   = FTC_CACHE(cache);                   \
     FT_UInt32             _hash    = (FT_UInt32)(hash);                  \
     FTC_Node_CompareFunc  _nodcomp = (FTC_Node_CompareFunc)(nodecmp);    \
     FTC_Cache             _cache   = FTC_CACHE(cache);                   \
     FT_UInt32             _hash    = (FT_UInt32)(hash);                  \
     FTC_Node_CompareFunc  _nodcomp = (FTC_Node_CompareFunc)(nodecmp);    \
-    FT_UInt               _idx;                                          \
+    FT_UFast              _idx;                                          \
                                                                          \
                                                                          \
     error = 0;                                                           \
                                                                          \
                                                                          \
     error = 0;                                                           \
@@ -246,8 +246,7 @@ FT_BEGIN_HEADER
     error = FTC_Cache_NewNode( _cache, _hash, query, &_node );           \
                                                                          \
   _Ok:                                                                   \
     error = FTC_Cache_NewNode( _cache, _hash, query, &_node );           \
                                                                          \
   _Ok:                                                                   \
-    _pnode = (FTC_Node*)(void*)&(node);                                  \
-    *_pnode = _node;                                                     \
+    node = _node;                                                        \
   FT_END_STMNT
 
 #else /* !FTC_INLINE */
   FT_END_STMNT
 
 #else /* !FTC_INLINE */
index 86e72a7..4d0818d 100644 (file)
@@ -36,7 +36,7 @@
                  FT_Pointer  gquery,
                  FTC_Cache   cache );
 
                  FT_Pointer  gquery,
                  FTC_Cache   cache );
 
-  FT_LOCAL( FT_ULong )
+  FT_LOCAL( FT_Offset )
   ftc_inode_weight( FTC_Node   inode,
                     FTC_Cache  cache );
 
   ftc_inode_weight( FTC_Node   inode,
                     FTC_Cache  cache );
 
@@ -50,7 +50,7 @@
                  FT_Pointer  gquery,
                  FTC_Cache   cache );
 
                  FT_Pointer  gquery,
                  FTC_Cache   cache );
 
-  FT_LOCAL( FT_ULong )
+  FT_LOCAL( FT_Offset )
   ftc_snode_weight( FTC_Node   snode,
                     FTC_Cache  cache );
 
   ftc_snode_weight( FTC_Node   snode,
                     FTC_Cache  cache );
 
index aa59307..a802b05 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType CharMap cache (body)                                        */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType CharMap cache (body)                                        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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 "ftcmanag.h"
 #include FT_INTERNAL_MEMORY_H
 #include FT_INTERNAL_DEBUG_H
 #include "ftcmanag.h"
 #include FT_INTERNAL_MEMORY_H
 #include FT_INTERNAL_DEBUG_H
-#include FT_TRUETYPE_IDS_H
 
 #include "ftccback.h"
 #include "ftcerror.h"
 
 #include "ftccback.h"
 #include "ftcerror.h"
@@ -86,9 +85,9 @@
 #define FTC_CMAP_INDICES_MAX  128
 
   /* compute a query/node hash */
 #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 )       )
+#define FTC_CMAP_HASH( faceid, index, charcode )         \
+          ( FTC_FACE_ID_HASH( faceid ) + 211 * (index) + \
+            ( (charcode) / FTC_CMAP_INDICES_MAX )      )
 
   /* the charmap query */
   typedef struct  FTC_CMapQueryRec_
 
   /* the charmap query */
   typedef struct  FTC_CMapQueryRec_
 
 
   /* compute the weight of a given cmap node */
 
 
   /* compute the weight of a given cmap node */
-  FT_CALLBACK_DEF( FT_ULong )
+  FT_CALLBACK_DEF( FT_Offset )
   ftc_cmap_node_weight( FTC_Node   cnode,
                         FTC_Cache  cache )
   {
   ftc_cmap_node_weight( FTC_Node   cnode,
                         FTC_Cache  cache )
   {
   {
     FTC_Cache         cache = FTC_CACHE( cmap_cache );
     FTC_CMapQueryRec  query;
   {
     FTC_Cache         cache = FTC_CACHE( cmap_cache );
     FTC_CMapQueryRec  query;
-    FTC_CMapNode      node;
+    FTC_Node          node;
     FT_Error          error;
     FT_UInt           gindex = 0;
     FT_UInt32         hash;
     FT_Error          error;
     FT_UInt           gindex = 0;
     FT_UInt32         hash;
+    FT_Int            no_cmap_change = 0;
 
 
 
 
+    if ( cmap_index < 0 )
+    {
+      /* Treat a negative cmap index as a special value, meaning that you */
+      /* don't want to change the FT_Face's character map through this    */
+      /* call.  This can be useful if the face requester callback already */
+      /* sets the face's charmap to the appropriate value.                */
+
+      no_cmap_change = 1;
+      cmap_index     = 0;
+    }
+
     if ( !cache )
     {
     if ( !cache )
     {
-      FT_ERROR(( "FTC_CMapCache_Lookup: bad arguments, returning 0!\n" ));
+      FT_TRACE0(( "FTC_CMapCache_Lookup: bad arguments, returning 0\n" ));
       return 0;
     }
 
       return 0;
     }
 
      *        Adobe Acrobat Reader Pack, named `KozMinProVI-Regular.otf',
      *        which contains more than 5 charmaps.
      */
      *        Adobe Acrobat Reader Pack, named `KozMinProVI-Regular.otf',
      *        which contains more than 5 charmaps.
      */
-    if ( cmap_index >= 16 )
+    if ( cmap_index >= 16 && !no_cmap_change )
     {
       FTC_OldCMapDesc  desc = (FTC_OldCMapDesc) face_id;
 
     {
       FTC_OldCMapDesc  desc = (FTC_OldCMapDesc) face_id;
 
     FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
                           node, error );
 #else
     FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
                           node, error );
 #else
-    error = FTC_Cache_Lookup( cache, hash, &query, (FTC_Node*) &node );
+    error = FTC_Cache_Lookup( cache, hash, &query, &node );
 #endif
     if ( error )
       goto Exit;
 
 #endif
     if ( error )
       goto Exit;
 
-    FT_ASSERT( (FT_UInt)( char_code - node->first ) < FTC_CMAP_INDICES_MAX );
+    FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) <
+                FTC_CMAP_INDICES_MAX );
 
     /* something rotten can happen with rogue clients */
 
     /* something rotten can happen with rogue clients */
-    if ( (FT_UInt)( char_code - node->first >= FTC_CMAP_INDICES_MAX ) )
+    if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >=
+                    FTC_CMAP_INDICES_MAX ) )
       return 0;
 
       return 0;
 
-    gindex = node->indices[char_code - node->first];
+    gindex = FTC_CMAP_NODE( node )->indices[char_code -
+                                            FTC_CMAP_NODE( node )->first];
     if ( gindex == FTC_CMAP_UNKNOWN )
     {
       FT_Face  face;
     if ( gindex == FTC_CMAP_UNKNOWN )
     {
       FT_Face  face;
 
       gindex = 0;
 
 
       gindex = 0;
 
-      error = FTC_Manager_LookupFace( cache->manager, node->face_id, &face );
+      error = FTC_Manager_LookupFace( cache->manager,
+                                      FTC_CMAP_NODE( node )->face_id,
+                                      &face );
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
 
         old  = face->charmap;
         cmap = face->charmaps[cmap_index];
 
         old  = face->charmap;
         cmap = face->charmaps[cmap_index];
 
-        if ( old != cmap )
+        if ( old != cmap && !no_cmap_change )
           FT_Set_Charmap( face, cmap );
 
         gindex = FT_Get_Char_Index( face, char_code );
 
           FT_Set_Charmap( face, cmap );
 
         gindex = FT_Get_Char_Index( face, char_code );
 
-        if ( old != cmap )
+        if ( old != cmap && !no_cmap_change )
           FT_Set_Charmap( face, old );
       }
 
           FT_Set_Charmap( face, old );
       }
 
-      node->indices[char_code - node->first] = (FT_UShort)gindex;
+      FTC_CMAP_NODE( node )->indices[char_code -
+                                     FTC_CMAP_NODE( node )->first]
+        = (FT_UShort)gindex;
     }
 
   Exit:
     }
 
   Exit:
index 5c03abe..2f462a2 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Glyph Image (FT_Glyph) cache (body).                        */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType Glyph Image (FT_Glyph) cache (body).                        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2003, 2004, 2006 by                               */
+/*  Copyright 2000-2001, 2003, 2004, 2006, 2009 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -20,8 +20,6 @@
 #include FT_CACHE_H
 #include "ftcglyph.h"
 #include FT_ERRORS_H
 #include FT_CACHE_H
 #include "ftcglyph.h"
 #include FT_ERRORS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
 
 #include "ftccback.h"
 #include "ftcerror.h"
 
 #include "ftccback.h"
 #include "ftcerror.h"
index 87a4199..c18f9c3 100644 (file)
@@ -277,12 +277,14 @@ FT_BEGIN_HEADER
     FTC_GCache               _gcache   = FTC_GCACHE( cache );               \
     FTC_GQuery               _gquery   = (FTC_GQuery)( query );             \
     FTC_MruNode_CompareFunc  _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
     FTC_GCache               _gcache   = FTC_GCACHE( cache );               \
     FTC_GQuery               _gquery   = (FTC_GQuery)( query );             \
     FTC_MruNode_CompareFunc  _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
+    FTC_MruNode              _mrunode;                                      \
                                                                             \
                                                                             \
     _gquery->gindex = (gindex);                                             \
                                                                             \
     FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare,         \
                                                                             \
                                                                             \
     _gquery->gindex = (gindex);                                             \
                                                                             \
     FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare,         \
-                            _gquery->family, error );                       \
+                            _mrunode, error );                              \
+    _gquery->family = FTC_FAMILY( _mrunode );                               \
     if ( !error )                                                           \
     {                                                                       \
       FTC_Family  _gqfamily = _gquery->family;                              \
     if ( !error )                                                           \
     {                                                                       \
       FTC_Family  _gqfamily = _gquery->family;                              \
@@ -303,11 +305,10 @@ FT_BEGIN_HEADER
 #define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,          \
                                gindex, query, node, error )           \
    FT_BEGIN_STMNT                                                     \
 #define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,          \
                                gindex, query, node, error )           \
    FT_BEGIN_STMNT                                                     \
-     void*  _n = &(node);                                             \
-                                                                      \
                                                                       \
      error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex,    \
                                                                       \
      error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex,    \
-                                FTC_GQUERY( query ), (FTC_Node*)_n ); \
+                                FTC_GQUERY( query ), node );          \
+                                                                      \
    FT_END_STMNT
 
 #endif /* !FTC_INLINE */
    FT_END_STMNT
 
 #endif /* !FTC_INLINE */
index 15d4e80..417daf2 100644 (file)
   }
 
 
   }
 
 
-  FT_LOCAL_DEF( FT_ULong )
+  FT_LOCAL_DEF( FT_Offset )
   ftc_inode_weight( FTC_Node   ftcinode,
                     FTC_Cache  ftccache )
   {
     FTC_INode  inode = (FTC_INode)ftcinode;
   ftc_inode_weight( FTC_Node   ftcinode,
                     FTC_Cache  ftccache )
   {
     FTC_INode  inode = (FTC_INode)ftcinode;
-    FT_ULong   size  = 0;
+    FT_Offset  size  = 0;
     FT_Glyph   glyph = inode->glyph;
 
     FT_UNUSED( ftccache );
     FT_Glyph   glyph = inode->glyph;
 
     FT_UNUSED( ftccache );
 
 #if 0
 
 
 #if 0
 
-  FT_LOCAL_DEF( FT_ULong )
+  FT_LOCAL_DEF( FT_Offset )
   FTC_INode_Weight( FTC_INode  inode )
   {
     return ftc_inode_weight( FTC_NODE( inode ), NULL );
   FTC_INode_Weight( FTC_INode  inode )
   {
     return ftc_inode_weight( FTC_NODE( inode ), NULL );
index 9d7347c..f2a298e 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Cache Manager (body).                                       */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType Cache Manager (body).                                       */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #include "ftccback.h"
 #include "ftcerror.h"
 
 #include "ftccback.h"
 #include "ftcerror.h"
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "cache system does not support PIC yet"
+#endif 
+
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_cache
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_cache
@@ -78,6 +82,8 @@
 
   } FTC_SizeNodeRec, *FTC_SizeNode;
 
 
   } FTC_SizeNodeRec, *FTC_SizeNode;
 
+#define FTC_SIZE_NODE( x ) ( (FTC_SizeNode)( x ) )
+
 
   FT_CALLBACK_DEF( void )
   ftc_size_node_done( FTC_MruNode  ftcnode,
 
   FT_CALLBACK_DEF( void )
   ftc_size_node_done( FTC_MruNode  ftcnode,
                           FTC_Scaler   scaler,
                           FT_Size     *asize )
   {
                           FTC_Scaler   scaler,
                           FT_Size     *asize )
   {
-    FT_Error      error;
-    FTC_SizeNode  node;
+    FT_Error     error;
+    FTC_MruNode  mrunode;
 
 
     if ( asize == NULL )
 
 
     if ( asize == NULL )
-      return FTC_Err_Bad_Argument;
+      return FTC_Err_Invalid_Argument;
 
     *asize = NULL;
 
 
     *asize = NULL;
 
 #ifdef FTC_INLINE
 
     FTC_MRULIST_LOOKUP_CMP( &manager->sizes, scaler, ftc_size_node_compare,
 #ifdef FTC_INLINE
 
     FTC_MRULIST_LOOKUP_CMP( &manager->sizes, scaler, ftc_size_node_compare,
-                            node, error );
+                            mrunode, error );
 
 #else
 
 #else
-    error = FTC_MruList_Lookup( &manager->sizes, scaler, (FTC_MruNode*)&node );
+    error = FTC_MruList_Lookup( &manager->sizes, scaler, &mrunode );
 #endif
 
     if ( !error )
 #endif
 
     if ( !error )
-      *asize = node->size;
+      *asize = FTC_SIZE_NODE( mrunode )->size;
 
     return error;
   }
 
     return error;
   }
 
   } FTC_FaceNodeRec, *FTC_FaceNode;
 
 
   } FTC_FaceNodeRec, *FTC_FaceNode;
 
+#define FTC_FACE_NODE( x ) ( ( FTC_FaceNode )( x ) )
+
 
   FT_CALLBACK_DEF( FT_Error )
   ftc_face_node_init( FTC_MruNode  ftcnode,
 
   FT_CALLBACK_DEF( FT_Error )
   ftc_face_node_init( FTC_MruNode  ftcnode,
                           FTC_FaceID   face_id,
                           FT_Face     *aface )
   {
                           FTC_FaceID   face_id,
                           FT_Face     *aface )
   {
-    FT_Error      error;
-    FTC_FaceNode  node;
+    FT_Error     error;
+    FTC_MruNode  mrunode;
 
 
     if ( aface == NULL )
 
 
     if ( aface == NULL )
-      return FTC_Err_Bad_Argument;
+      return FTC_Err_Invalid_Argument;
 
     *aface = NULL;
 
 
     *aface = NULL;
 
 #ifdef FTC_INLINE
 
     FTC_MRULIST_LOOKUP_CMP( &manager->faces, face_id, ftc_face_node_compare,
 #ifdef FTC_INLINE
 
     FTC_MRULIST_LOOKUP_CMP( &manager->faces, face_id, ftc_face_node_compare,
-                            node, error );
+                            mrunode, error );
 
 #else
 
 #else
-    error = FTC_MruList_Lookup( &manager->faces, face_id, (FTC_MruNode*)&node );
+    error = FTC_MruList_Lookup( &manager->faces, face_id, &mrunode );
 #endif
 
     if ( !error )
 #endif
 
     if ( !error )
-      *aface = node->face;
+      *aface = FTC_FACE_NODE( mrunode )->face;
 
     return error;
   }
 
     return error;
   }
 
 
         if ( (FT_UInt)node->cache_index >= manager->num_caches )
 
 
         if ( (FT_UInt)node->cache_index >= manager->num_caches )
-          FT_ERROR(( "FTC_Manager_Check: invalid node (cache index = %ld\n",
-                     node->cache_index ));
+          FT_TRACE0(( "FTC_Manager_Check: invalid node (cache index = %ld\n",
+                      node->cache_index ));
         else
           weight += cache->clazz.node_weight( node, cache );
 
         else
           weight += cache->clazz.node_weight( node, cache );
 
       } while ( node != first );
 
       if ( weight != manager->cur_weight )
       } while ( node != first );
 
       if ( weight != manager->cur_weight )
-        FT_ERROR(( "FTC_Manager_Check: invalid weight %ld instead of %ld\n",
-                   manager->cur_weight, weight ));
+        FT_TRACE0(( "FTC_Manager_Check: invalid weight %ld instead of %ld\n",
+                    manager->cur_weight, weight ));
     }
 
     /* check circular list */
     }
 
     /* check circular list */
       } while ( node != first );
 
       if ( count != manager->num_nodes )
       } while ( node != first );
 
       if ( count != manager->num_nodes )
-        FT_ERROR((
-          "FTC_Manager_Check: invalid cache node count %d instead of %d\n",
-          manager->num_nodes, count ));
+        FT_TRACE0(( "FTC_Manager_Check:"
+                    " invalid cache node count %d instead of %d\n",
+                    manager->num_nodes, count ));
     }
   }
 
     }
   }
 
 #ifdef FT_DEBUG_ERROR
     FTC_Manager_Check( manager );
 
 #ifdef FT_DEBUG_ERROR
     FTC_Manager_Check( manager );
 
-    FT_ERROR(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
-               manager->cur_weight, manager->max_weight,
-               manager->num_nodes ));
+    FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
+                manager->cur_weight, manager->max_weight,
+                manager->num_nodes ));
 #endif
 
     if ( manager->cur_weight < manager->max_weight || first == NULL )
 #endif
 
     if ( manager->cur_weight < manager->max_weight || first == NULL )
       if ( manager->num_caches >= FTC_MAX_CACHES )
       {
         error = FTC_Err_Too_Many_Caches;
       if ( manager->num_caches >= FTC_MAX_CACHES )
       {
         error = FTC_Err_Too_Many_Caches;
-        FT_ERROR(( "%s: too many registered caches\n",
-                   "FTC_Manager_Register_Cache" ));
+        FT_ERROR(( "FTC_Manager_RegisterCache:"
+                   " too many registered caches\n" ));
         goto Exit;
       }
 
         goto Exit;
       }
 
     }
 
   Exit:
     }
 
   Exit:
-    *acache = cache;
+    if ( acache )
+      *acache = cache;
     return error;
   }
 
     return error;
   }
 
     /* this will remove all FTC_SizeNode that correspond to
      * the face_id as well
      */
     /* this will remove all FTC_SizeNode that correspond to
      * the face_id as well
      */
-    FTC_MruList_RemoveSelection( &manager->faces, NULL, face_id );
+    FTC_MruList_RemoveSelection( &manager->faces,
+                                 (FTC_MruNode_CompareFunc)NULL,
+                                 face_id );
 
     for ( nn = 0; nn < manager->num_caches; nn++ )
       FTC_Cache_RemoveFaceID( manager->caches[nn], face_id );
 
     for ( nn = 0; nn < manager->num_caches; nn++ )
       FTC_Cache_RemoveFaceID( manager->caches[nn], face_id );
index 3a6c625..9944b58 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType MRU support (body).                                         */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType MRU support (body).                                         */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2006 by                                          */
+/*  Copyright 2003, 2004, 2006, 2009 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -46,7 +46,7 @@
         {
           if ( cnode == node )
           {
         {
           if ( cnode == node )
           {
-            fprintf( stderr, "FTC_MruNode_Prepend: invalid action!\n" );
+            fprintf( stderr, "FTC_MruNode_Prepend: invalid action\n" );
             exit( 2 );
           }
           cnode = cnode->next;
             exit( 2 );
           }
           cnode = cnode->next;
@@ -94,7 +94,7 @@
 
         } while ( cnode != first );
 
 
         } while ( cnode != first );
 
-        fprintf( stderr, "FTC_MruNode_Up: invalid action!\n" );
+        fprintf( stderr, "FTC_MruNode_Up: invalid action\n" );
         exit( 2 );
       Ok:
       }
         exit( 2 );
       Ok:
       }
 
         } while ( cnode != first );
 
 
         } while ( cnode != first );
 
-        fprintf( stderr, "FTC_MruNode_Remove: invalid action!\n" );
+        fprintf( stderr, "FTC_MruNode_Remove: invalid action\n" );
         exit( 2 );
       Ok:
       }
         exit( 2 );
       Ok:
       }
index c8f0c6e..5739439 100644 (file)
@@ -107,7 +107,7 @@ FT_BEGIN_HEADER
 
   typedef struct  FTC_MruListClassRec_
   {
 
   typedef struct  FTC_MruListClassRec_
   {
-    FT_UInt                  node_size;
+    FT_Offset                node_size;
     FTC_MruNode_CompareFunc  node_compare;
     FTC_MruNode_InitFunc     node_init;
     FTC_MruNode_ResetFunc    node_reset;
     FTC_MruNode_CompareFunc  node_compare;
     FTC_MruNode_InitFunc     node_init;
     FTC_MruNode_ResetFunc    node_reset;
@@ -163,7 +163,7 @@ FT_BEGIN_HEADER
   FT_BEGIN_STMNT                                                            \
     FTC_MruNode*             _pfirst  = &(list)->nodes;                     \
     FTC_MruNode_CompareFunc  _compare = (FTC_MruNode_CompareFunc)(compare); \
   FT_BEGIN_STMNT                                                            \
     FTC_MruNode*             _pfirst  = &(list)->nodes;                     \
     FTC_MruNode_CompareFunc  _compare = (FTC_MruNode_CompareFunc)(compare); \
-    FTC_MruNode              _first, _node, *_pnode;                        \
+    FTC_MruNode              _first, _node;                                 \
                                                                             \
                                                                             \
     error  = 0;                                                             \
                                                                             \
                                                                             \
     error  = 0;                                                             \
@@ -180,8 +180,7 @@ FT_BEGIN_HEADER
           if ( _node != _first )                                            \
             FTC_MruNode_Up( _pfirst, _node );                               \
                                                                             \
           if ( _node != _first )                                            \
             FTC_MruNode_Up( _pfirst, _node );                               \
                                                                             \
-          _pnode = (FTC_MruNode*)(void*)&(node);                            \
-          *_pnode = _node;                                                  \
+          node = _node;                                                     \
           goto _MruOk;                                                      \
         }                                                                   \
         _node = _node->next;                                                \
           goto _MruOk;                                                      \
         }                                                                   \
         _node = _node->next;                                                \
index 72f139d..60d46aa 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType sbits manager (body).                                       */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType sbits manager (body).                                       */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -26,6 +26,9 @@
 #include "ftccback.h"
 #include "ftcerror.h"
 
 #include "ftccback.h"
 #include "ftcerror.h"
 
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_cache
+
 
   /*************************************************************************/
   /*************************************************************************/
 
   /*************************************************************************/
   /*************************************************************************/
       FT_Int        temp;
       FT_GlyphSlot  slot   = face->glyph;
       FT_Bitmap*    bitmap = &slot->bitmap;
       FT_Int        temp;
       FT_GlyphSlot  slot   = face->glyph;
       FT_Bitmap*    bitmap = &slot->bitmap;
-      FT_Int        xadvance, yadvance;
+      FT_Pos        xadvance, yadvance; /* FT_GlyphSlot->advance.{x|y} */
 
 
       if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
       {
 
 
       if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
       {
-        FT_ERROR(( "%s: glyph loaded didn't return a bitmap!\n",
-                   "ftc_snode_load" ));
+        FT_TRACE0(( "ftc_snode_load:"
+                    " glyph loaded didn't return a bitmap\n" ));
         goto BadGlyph;
       }
 
         goto BadGlyph;
       }
 
   }
 
 
   }
 
 
-  FT_LOCAL_DEF( FT_ULong )
+  FT_LOCAL_DEF( FT_Offset )
   ftc_snode_weight( FTC_Node   ftcsnode,
                     FTC_Cache  cache )
   {
   ftc_snode_weight( FTC_Node   ftcsnode,
                     FTC_Cache  cache )
   {
     FT_UInt    count = snode->count;
     FTC_SBit   sbit  = snode->sbits;
     FT_Int     pitch;
     FT_UInt    count = snode->count;
     FTC_SBit   sbit  = snode->sbits;
     FT_Int     pitch;
-    FT_ULong   size;
+    FT_Offset  size;
 
     FT_UNUSED( cache );
 
 
     FT_UNUSED( cache );
 
 
 #if 0
 
 
 #if 0
 
-  FT_LOCAL_DEF( FT_ULong )
+  FT_LOCAL_DEF( FT_Offset )
   FTC_SNode_Weight( FTC_SNode  snode )
   {
     return ftc_snode_weight( FTC_NODE( snode ), NULL );
   FTC_SNode_Weight( FTC_SNode  snode )
   {
     return ftc_snode_weight( FTC_NODE( snode ), NULL );
index 457dec8..ed75a6a 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
 #
 
 
-# Copyright 2000, 2001, 2003, 2004, 2006 by
+# Copyright 2000, 2001, 2003, 2004, 2006, 2008 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -26,7 +26,7 @@ CACHE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CACHE_DIR))
 #
 CACHE_DRV_SRC := $(CACHE_DIR)/ftcbasic.c \
                  $(CACHE_DIR)/ftccache.c \
 #
 CACHE_DRV_SRC := $(CACHE_DIR)/ftcbasic.c \
                  $(CACHE_DIR)/ftccache.c \
-                 $(CACHE_DIR)/ftccmap.c \
+                 $(CACHE_DIR)/ftccmap.c  \
                  $(CACHE_DIR)/ftcglyph.c \
                  $(CACHE_DIR)/ftcimage.c \
                  $(CACHE_DIR)/ftcmanag.c \
                  $(CACHE_DIR)/ftcglyph.c \
                  $(CACHE_DIR)/ftcimage.c \
                  $(CACHE_DIR)/ftcmanag.c \
@@ -35,12 +35,14 @@ CACHE_DRV_SRC := $(CACHE_DIR)/ftcbasic.c \
 
 # Cache driver headers
 #
 
 # Cache driver headers
 #
-CACHE_DRV_H := $(CACHE_DIR)/ftccback.h \
+CACHE_DRV_H := $(CACHE_DIR)/ftccache.h \
+               $(CACHE_DIR)/ftccback.h \
                $(CACHE_DIR)/ftcerror.h \
                $(CACHE_DIR)/ftcglyph.h \
                $(CACHE_DIR)/ftcimage.h \
                $(CACHE_DIR)/ftcmanag.h \
                $(CACHE_DIR)/ftcerror.h \
                $(CACHE_DIR)/ftcglyph.h \
                $(CACHE_DIR)/ftcimage.h \
                $(CACHE_DIR)/ftcmanag.h \
-               $(CACHE_DIR)/ftcmru.h
+               $(CACHE_DIR)/ftcmru.h   \
+               $(CACHE_DIR)/ftcsbits.h
 
 
 # Cache driver object(s)
 
 
 # Cache driver object(s)
index 6d0bb1b..6705d3c 100644 (file)
@@ -16,7 +16,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) cff ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = cffdrivr cffgload cffload cffobjs cffparse cffcmap ;
+    _sources = cffdrivr cffgload cffload cffobjs cffparse cffcmap cffpic ;
   }
   else
   {
   }
   else
   {
index e6d8954..fccfd44 100644 (file)
@@ -19,6 +19,7 @@
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
+#include "cffpic.c"
 #include "cffdrivr.c"
 #include "cffparse.c"
 #include "cffload.c"
 #include "cffdrivr.c"
 #include "cffparse.c"
 #include "cffload.c"
index fffc5fc..46d603e 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CFF character mapping table (cmap) support (body).                   */
 /*                                                                         */
 /*                                                                         */
 /*    CFF character mapping table (cmap) support (body).                   */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006 by                              */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -65,7 +65,7 @@
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   cff_cmap_encoding_char_next( CFF_CMapStd   cmap,
                                FT_UInt32    *pchar_code )
   {
   cff_cmap_encoding_char_next( CFF_CMapStd   cmap,
                                FT_UInt32    *pchar_code )
   {
   }
 
 
   }
 
 
-  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
-  cff_cmap_encoding_class_rec =
-  {
+  FT_DEFINE_CMAP_CLASS(cff_cmap_encoding_class_rec,
     sizeof ( CFF_CMapStdRec ),
 
     (FT_CMap_InitFunc)     cff_cmap_encoding_init,
     (FT_CMap_DoneFunc)     cff_cmap_encoding_done,
     (FT_CMap_CharIndexFunc)cff_cmap_encoding_char_index,
     sizeof ( CFF_CMapStdRec ),
 
     (FT_CMap_InitFunc)     cff_cmap_encoding_init,
     (FT_CMap_DoneFunc)     cff_cmap_encoding_done,
     (FT_CMap_CharIndexFunc)cff_cmap_encoding_char_index,
-    (FT_CMap_CharNextFunc) cff_cmap_encoding_char_next
-  };
+    (FT_CMap_CharNextFunc) cff_cmap_encoding_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
+  )
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   cff_cmap_unicode_char_next( PS_Unicodes  unicodes,
                               FT_UInt32   *pchar_code )
   {
   cff_cmap_unicode_char_next( PS_Unicodes  unicodes,
                               FT_UInt32   *pchar_code )
   {
   }
 
 
   }
 
 
-  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
-  cff_cmap_unicode_class_rec =
-  {
+  FT_DEFINE_CMAP_CLASS(cff_cmap_unicode_class_rec,
     sizeof ( PS_UnicodesRec ),
 
     (FT_CMap_InitFunc)     cff_cmap_unicode_init,
     (FT_CMap_DoneFunc)     cff_cmap_unicode_done,
     (FT_CMap_CharIndexFunc)cff_cmap_unicode_char_index,
     sizeof ( PS_UnicodesRec ),
 
     (FT_CMap_InitFunc)     cff_cmap_unicode_init,
     (FT_CMap_DoneFunc)     cff_cmap_unicode_done,
     (FT_CMap_CharIndexFunc)cff_cmap_unicode_char_index,
-    (FT_CMap_CharNextFunc) cff_cmap_unicode_char_next
-  };
+    (FT_CMap_CharNextFunc) cff_cmap_unicode_char_next,
 
 
+    NULL, NULL, NULL, NULL, NULL
+  )
 
 /* END */
 
 /* END */
index 3809b85..3f7f67b 100644 (file)
@@ -43,8 +43,7 @@ FT_BEGIN_HEADER
   } CFF_CMapStdRec;
 
 
   } CFF_CMapStdRec;
 
 
-  FT_CALLBACK_TABLE const FT_CMap_ClassRec
-  cff_cmap_encoding_class_rec;
+  FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec)
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -57,8 +56,7 @@ FT_BEGIN_HEADER
 
   /* unicode (synthetic) cmaps */
 
 
   /* unicode (synthetic) cmaps */
 
-  FT_CALLBACK_TABLE const FT_CMap_ClassRec
-  cff_cmap_unicode_class_rec;
+  FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec)
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
index 952e88e..217adf2 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType font driver implementation (body).                          */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_IDS_H
+#include FT_SERVICE_CID_H
 #include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include FT_SERVICE_POSTSCRIPT_INFO_H
 #include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include FT_SERVICE_POSTSCRIPT_INFO_H
+#include FT_SERVICE_POSTSCRIPT_NAME_H
 #include FT_SERVICE_TT_CMAP_H
 
 #include "cffdrivr.h"
 #include "cffgload.h"
 #include "cffload.h"
 #include "cffcmap.h"
 #include FT_SERVICE_TT_CMAP_H
 
 #include "cffdrivr.h"
 #include "cffgload.h"
 #include "cffload.h"
 #include "cffcmap.h"
+#include "cffparse.h"
 
 #include "cfferrs.h"
 
 #include "cfferrs.h"
+#include "cffpic.h"
 
 #include FT_SERVICE_XFREE86_NAME_H
 #include FT_SERVICE_GLYPH_DICT_H
 
 
 #include FT_SERVICE_XFREE86_NAME_H
 #include FT_SERVICE_GLYPH_DICT_H
 
+
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
               FT_UInt       glyph_index,
               FT_Int32      load_flags )
   {
               FT_UInt       glyph_index,
               FT_Int32      load_flags )
   {
-    FT_Error  error;
+    FT_Error       error;
     CFF_GlyphSlot  slot = (CFF_GlyphSlot)cffslot;
     CFF_Size       size = (CFF_Size)cffsize;
 
     CFF_GlyphSlot  slot = (CFF_GlyphSlot)cffslot;
     CFF_Size       size = (CFF_Size)cffsize;
 
     if ( !size )
       load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
 
     if ( !size )
       load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
 
+    /* reset the size object if necessary */
     if ( load_flags & FT_LOAD_NO_SCALE )
       size = NULL;
 
     if ( load_flags & FT_LOAD_NO_SCALE )
       size = NULL;
 
-    /* reset the size object if necessary */
     if ( size )
     {
       /* these two objects must have the same parent */
     if ( size )
     {
       /* these two objects must have the same parent */
   }
 
 
   }
 
 
- /*
-  *  GLYPH DICT SERVICE
-  *
-  */
+  FT_CALLBACK_DEF( FT_Error )
+  cff_get_advances( FT_Face    face,
+                    FT_UInt    start,
+                    FT_UInt    count,
+                    FT_Int32   flags,
+                    FT_Fixed*  advances )
+  {
+    FT_UInt       nn;
+    FT_Error      error = CFF_Err_Ok;
+    FT_GlyphSlot  slot  = face->glyph;
+
+
+    flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
+
+    for ( nn = 0; nn < count; nn++ )
+    {
+      error = Load_Glyph( slot, face->size, start + nn, flags );
+      if ( error )
+        break;
+
+      advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
+                     ? slot->linearVertAdvance
+                     : slot->linearHoriAdvance;
+    }
+
+    return error;
+  }
+
+
+  /*
+   *  GLYPH DICT SERVICE
+   *
+   */
 
   static FT_Error
   cff_get_glyph_name( CFF_Face    face,
 
   static FT_Error
   cff_get_glyph_name( CFF_Face    face,
     FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
     if ( !psnames )
     {
     FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
     if ( !psnames )
     {
-      FT_ERROR(( "cff_get_glyph_name:" ));
-      FT_ERROR(( " cannot get glyph name from CFF & CEF fonts\n" ));
-      FT_ERROR(( "                   " ));
-      FT_ERROR(( " without the `PSNames' module\n" ));
+      FT_ERROR(( "cff_get_glyph_name:"
+                 " cannot get glyph name from CFF & CEF fonts\n"
+                 "                   "
+                 " without the `PSNames' module\n" ));
       error = CFF_Err_Unknown_File_Format;
       goto Exit;
     }
       error = CFF_Err_Unknown_File_Format;
       goto Exit;
     }
     FT_FREE( gname );
     error = CFF_Err_Ok;
 
     FT_FREE( gname );
     error = CFF_Err_Ok;
 
-    Exit:
-      return error;
+  Exit:
+    return error;
   }
 
 
   }
 
 
   }
 
 
   }
 
 
-  static const FT_Service_GlyphDictRec  cff_service_glyph_dict =
-  {
+  FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict,
     (FT_GlyphDict_GetNameFunc)  cff_get_glyph_name,
     (FT_GlyphDict_GetNameFunc)  cff_get_glyph_name,
-    (FT_GlyphDict_NameIndexFunc)cff_get_name_index,
-  };
+    (FT_GlyphDict_NameIndexFunc)cff_get_name_index
+  )
 
 
 
 
- /*
-  *  POSTSCRIPT INFO SERVICE
-  *
-  */
 /*
+   *  POSTSCRIPT INFO SERVICE
+   *
+   */
 
   static FT_Int
   cff_ps_has_glyph_names( FT_Face  face )
 
   static FT_Int
   cff_ps_has_glyph_names( FT_Face  face )
 
     if ( cff && cff->font_info == NULL )
     {
 
     if ( cff && cff->font_info == NULL )
     {
-      CFF_FontRecDict  dict = &cff->top_font.font_dict;
-      PS_FontInfoRec  *font_info;
-      FT_Memory        memory = face->root.memory;
+      CFF_FontRecDict     dict    = &cff->top_font.font_dict;
+      PS_FontInfoRec     *font_info;
+      FT_Memory           memory  = face->root.memory;
+      FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)cff->psnames;
 
 
       if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
 
 
       if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
 
       font_info->version     = cff_index_get_sid_string( &cff->string_index,
                                                          dict->version,
 
       font_info->version     = cff_index_get_sid_string( &cff->string_index,
                                                          dict->version,
-                                                         cff->psnames );
+                                                         psnames );
       font_info->notice      = cff_index_get_sid_string( &cff->string_index,
                                                          dict->notice,
       font_info->notice      = cff_index_get_sid_string( &cff->string_index,
                                                          dict->notice,
-                                                         cff->psnames );
+                                                         psnames );
       font_info->full_name   = cff_index_get_sid_string( &cff->string_index,
                                                          dict->full_name,
       font_info->full_name   = cff_index_get_sid_string( &cff->string_index,
                                                          dict->full_name,
-                                                         cff->psnames );
+                                                         psnames );
       font_info->family_name = cff_index_get_sid_string( &cff->string_index,
                                                          dict->family_name,
       font_info->family_name = cff_index_get_sid_string( &cff->string_index,
                                                          dict->family_name,
-                                                         cff->psnames );
+                                                         psnames );
       font_info->weight      = cff_index_get_sid_string( &cff->string_index,
                                                          dict->weight,
       font_info->weight      = cff_index_get_sid_string( &cff->string_index,
                                                          dict->weight,
-                                                         cff->psnames );
+                                                         psnames );
       font_info->italic_angle        = dict->italic_angle;
       font_info->is_fixed_pitch      = dict->is_fixed_pitch;
       font_info->underline_position  = (FT_Short)dict->underline_position;
       font_info->italic_angle        = dict->italic_angle;
       font_info->is_fixed_pitch      = dict->is_fixed_pitch;
       font_info->underline_position  = (FT_Short)dict->underline_position;
       cff->font_info = font_info;
     }
 
       cff->font_info = font_info;
     }
 
-    *afont_info = *cff->font_info;
+    if ( cff )
+      *afont_info = *cff->font_info;
 
   Fail:
     return error;
   }
 
 
 
   Fail:
     return error;
   }
 
 
-  static const FT_Service_PsInfoRec  cff_service_ps_info =
-  {
+  FT_DEFINE_SERVICE_PSINFOREC(cff_service_ps_info,
     (PS_GetFontInfoFunc)   cff_ps_get_font_info,
     (PS_GetFontInfoFunc)   cff_ps_get_font_info,
+    (PS_GetFontExtraFunc)  NULL,
     (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
     (PS_GetFontPrivateFunc)NULL         /* unsupported with CFF fonts */
     (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
     (PS_GetFontPrivateFunc)NULL         /* unsupported with CFF fonts */
-  };
+  )
+
+
+  /*
+   *  POSTSCRIPT NAME SERVICE
+   *
+   */
+
+  static const char*
+  cff_get_ps_name( CFF_Face  face )
+  {
+    CFF_Font  cff = (CFF_Font)face->extra.data;
+
+
+    return (const char*)cff->font_name;
+  }
+
+
+  FT_DEFINE_SERVICE_PSFONTNAMEREC(cff_service_ps_name,
+    (FT_PsName_GetFunc)cff_get_ps_name
+  )
 
 
   /*
 
 
   /*
   {
     FT_CMap   cmap  = FT_CMAP( charmap );
     FT_Error  error = CFF_Err_Ok;
   {
     FT_CMap   cmap  = FT_CMAP( charmap );
     FT_Error  error = CFF_Err_Ok;
+    FT_Face    face    = FT_CMAP_FACE( cmap );
+    FT_Library library = FT_FACE_LIBRARY( face );
 
 
     cmap_info->language = 0;
 
 
     cmap_info->language = 0;
+    cmap_info->format   = 0;
 
 
-    if ( cmap->clazz != &cff_cmap_encoding_class_rec &&
-         cmap->clazz != &cff_cmap_unicode_class_rec  )
+    if ( cmap->clazz != &FT_CFF_CMAP_ENCODING_CLASS_REC_GET &&
+         cmap->clazz != &FT_CFF_CMAP_UNICODE_CLASS_REC_GET  )
     {
     {
-      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_Module           sfnt    = FT_Get_Module( library, "sfnt" );
       FT_Service_TTCMaps  service =
         (FT_Service_TTCMaps)ft_module_get_service( sfnt,
   }
 
 
   }
 
 
-  static const FT_Service_TTCMapsRec  cff_service_get_cmap_info =
-  {
+  FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info,
     (TT_CMap_Info_GetFunc)cff_get_cmap_info
     (TT_CMap_Info_GetFunc)cff_get_cmap_info
-  };
+  )
+
+
+  /*
+   *  CID INFO SERVICE
+   *
+   */
+  static FT_Error
+  cff_get_ros( CFF_Face      face,
+               const char*  *registry,
+               const char*  *ordering,
+               FT_Int       *supplement )
+  {
+    FT_Error  error = CFF_Err_Ok;
+    CFF_Font  cff   = (CFF_Font)face->extra.data;
+
+
+    if ( cff )
+    {
+      CFF_FontRecDict     dict    = &cff->top_font.font_dict;
+      FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)cff->psnames;
+
+
+      if ( dict->cid_registry == 0xFFFFU )
+      {
+        error = CFF_Err_Invalid_Argument;
+        goto Fail;
+      }
+
+      if ( registry )
+      {
+        if ( cff->registry == NULL )
+          cff->registry = cff_index_get_sid_string( &cff->string_index,
+                                                    dict->cid_registry,
+                                                    psnames );
+        *registry = cff->registry;
+      }
+      
+      if ( ordering )
+      {
+        if ( cff->ordering == NULL )
+          cff->ordering = cff_index_get_sid_string( &cff->string_index,
+                                                    dict->cid_ordering,
+                                                    psnames );
+        *ordering = cff->ordering;
+      }
+
+      /*
+       * XXX: According to Adobe TechNote #5176, the supplement in CFF
+       *      can be a real number. We truncate it to fit public API
+       *      since freetype-2.3.6.
+       */
+      if ( supplement )
+      {
+        if ( dict->cid_supplement < FT_INT_MIN ||
+             dict->cid_supplement > FT_INT_MAX )
+          FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
+                      dict->cid_supplement ));
+        *supplement = (FT_Int)dict->cid_supplement;
+      }
+    }
+      
+  Fail:
+    return error;
+  }
+
+
+  static FT_Error
+  cff_get_is_cid( CFF_Face  face,
+                  FT_Bool  *is_cid )
+  {
+    FT_Error  error = CFF_Err_Ok;
+    CFF_Font  cff   = (CFF_Font)face->extra.data;
+
+
+    *is_cid = 0;
+
+    if ( cff )
+    {
+      CFF_FontRecDict  dict = &cff->top_font.font_dict;
+
+
+      if ( dict->cid_registry != 0xFFFFU )
+        *is_cid = 1;
+    }
+
+    return error;
+  }
+
+
+  static FT_Error
+  cff_get_cid_from_glyph_index( CFF_Face  face,
+                                FT_UInt   glyph_index,
+                                FT_UInt  *cid )
+  {
+    FT_Error  error = CFF_Err_Ok;
+    CFF_Font  cff;
+
+
+    cff = (CFF_Font)face->extra.data;
+
+    if ( cff )
+    {
+      FT_UInt          c;
+      CFF_FontRecDict  dict = &cff->top_font.font_dict;
+
+
+      if ( dict->cid_registry == 0xFFFFU )
+      {
+        error = CFF_Err_Invalid_Argument;
+        goto Fail;
+      }
+
+      if ( glyph_index > cff->num_glyphs )
+      {
+        error = CFF_Err_Invalid_Argument;
+        goto Fail;
+      }
+
+      c = cff->charset.sids[glyph_index];
+
+      if ( cid )
+        *cid = c;
+    }
+
+  Fail:
+    return error;
+  }
+
+
+  FT_DEFINE_SERVICE_CIDREC(cff_service_cid_info,
+    (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
+    (FT_CID_GetIsInternallyCIDKeyedFunc)      cff_get_is_cid,
+    (FT_CID_GetCIDFromGlyphIndexFunc)         cff_get_cid_from_glyph_index
+  )
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
-
-  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
 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
-    { FT_SERVICE_ID_GLYPH_DICT,      &cff_service_glyph_dict },
+  FT_DEFINE_SERVICEDESCREC6(cff_services,
+    FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CFF,
+    FT_SERVICE_ID_POSTSCRIPT_INFO,      &FT_CFF_SERVICE_PS_INFO_GET,
+    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET,
+    FT_SERVICE_ID_GLYPH_DICT,           &FT_CFF_SERVICE_GLYPH_DICT_GET,
+    FT_SERVICE_ID_TT_CMAP,              &FT_CFF_SERVICE_GET_CMAP_INFO_GET,
+    FT_SERVICE_ID_CID,                  &FT_CFF_SERVICE_CID_INFO_GET
+  )
+#else
+  FT_DEFINE_SERVICEDESCREC5(cff_services,
+    FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CFF,
+    FT_SERVICE_ID_POSTSCRIPT_INFO,      &FT_CFF_SERVICE_PS_INFO_GET,
+    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET,
+    FT_SERVICE_ID_TT_CMAP,              &FT_CFF_SERVICE_GET_CMAP_INFO_GET,
+    FT_SERVICE_ID_CID,                  &FT_CFF_SERVICE_CID_INFO_GET
+  )
 #endif
 #endif
-    { FT_SERVICE_ID_TT_CMAP,         &cff_service_get_cmap_info },
-    { NULL, NULL }
-  };
-
 
   FT_CALLBACK_DEF( FT_Module_Interface )
   cff_get_interface( FT_Module    driver,       /* CFF_Driver */
 
   FT_CALLBACK_DEF( FT_Module_Interface )
   cff_get_interface( FT_Module    driver,       /* CFF_Driver */
   {
     FT_Module            sfnt;
     FT_Module_Interface  result;
   {
     FT_Module            sfnt;
     FT_Module_Interface  result;
+    FT_Library           library = driver->library;
+    FT_UNUSED(library);
 
 
 
 
-    result = ft_service_list_lookup( cff_services, module_interface );
+    result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface );
     if ( result != NULL )
       return  result;
 
     if ( result != NULL )
       return  result;
 
 
   /* The FT_DriverInterface structure is defined in ftdriver.h. */
 
 
   /* The FT_DriverInterface structure is defined in ftdriver.h. */
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Driver_ClassRec  cff_driver_class =
-  {
-    /* begin with the FT_Module_Class fields */
-    {
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+#define CFF_SIZE_SELECT cff_size_select
+#else
+#define CFF_SIZE_SELECT 0
+#endif
+
+  FT_DEFINE_DRIVER(cff_driver_class,
       FT_MODULE_FONT_DRIVER       |
       FT_MODULE_DRIVER_SCALABLE   |
       FT_MODULE_DRIVER_HAS_HINTER,
       FT_MODULE_FONT_DRIVER       |
       FT_MODULE_DRIVER_SCALABLE   |
       FT_MODULE_DRIVER_HAS_HINTER,
       cff_driver_init,
       cff_driver_done,
       cff_get_interface,
       cff_driver_init,
       cff_driver_done,
       cff_get_interface,
-    },
 
     /* now the specific driver fields */
     sizeof( TT_FaceRec ),
 
     /* now the specific driver fields */
     sizeof( TT_FaceRec ),
     cff_slot_init,
     cff_slot_done,
 
     cff_slot_init,
     cff_slot_done,
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
+    ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+    ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
     Load_Glyph,
 
     cff_get_kerning,
     0,                      /* FT_Face_AttachFunc      */
 
     Load_Glyph,
 
     cff_get_kerning,
     0,                      /* FT_Face_AttachFunc      */
-    0,                      /* FT_Face_GetAdvancesFunc */
+    cff_get_advances,       /* FT_Face_GetAdvancesFunc */
 
     cff_size_request,
 
 
     cff_size_request,
 
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-    cff_size_select
-#else
-    0                       /* FT_Size_SelectFunc      */
-#endif
-  };
+    CFF_SIZE_SELECT
+  )
 
 
 /* END */
 
 
 /* END */
index 553848c..50e8138 100644 (file)
@@ -27,8 +27,7 @@
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
 
-  FT_CALLBACK_TABLE
-  const FT_Driver_ClassRec  cff_driver_class;
+  FT_DECLARE_DRIVER( cff_driver_class )
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
index d354227..40fa20b 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType Glyph Loader (body).                                        */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType Glyph Loader (body).                                        */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_OUTLINE_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_OUTLINE_H
-#include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 
 #include "cffobjs.h"
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 
 #include "cffobjs.h"
     cff_op_callgsubr,
     cff_op_return,
 
     cff_op_callgsubr,
     cff_op_return,
 
+    /* Type 1 opcodes: invalid but seen in real life */
+    cff_op_hsbw,
+    cff_op_closepath,
+    cff_op_callothersubr,
+    cff_op_pop,
+
     /* do not remove */
     cff_op_max
 
     /* do not remove */
     cff_op_max
 
 #define CFF_COUNT_EXACT        0x40
 #define CFF_COUNT_CLEAR_STACK  0x20
 
 #define CFF_COUNT_EXACT        0x40
 #define CFF_COUNT_CLEAR_STACK  0x20
 
+  /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are  */
+  /* used for checking the width and requested numbers of arguments    */
+  /* only; they are set to zero afterwards                             */
+
+  /* the other two flags are informative only and unused currently     */
 
   static const FT_Byte  cff_argument_counts[] =
   {
 
   static const FT_Byte  cff_argument_counts[] =
   {
 
     1, /* callsubr */
     1,
 
     1, /* callsubr */
     1,
+    0,
+
+    2, /* hsbw */
+    0,
+    0,
     0
   };
 
     0
   };
 
   /*                                                                       */
   /*    glyph   :: The current glyph object.                               */
   /*                                                                       */
   /*                                                                       */
   /*    glyph   :: The current glyph object.                               */
   /*                                                                       */
+  /*    hinting :: Whether hinting is active.                              */
+  /*                                                                       */
   static void
   cff_builder_init( CFF_Builder*   builder,
                     TT_Face        face,
   static void
   cff_builder_init( CFF_Builder*   builder,
                     TT_Face        face,
 
       if ( hinting && size )
       {
 
       if ( hinting && size )
       {
-        builder->hints_globals = size->root.internal;
+        CFF_Internal  internal = (CFF_Internal)size->root.internal;
+
+
+        builder->hints_globals = (void *)internal->topfont;
         builder->hints_funcs   = glyph->root.internal->glyph_hints;
       }
     }
 
         builder->hints_funcs   = glyph->root.internal->glyph_hints;
       }
     }
 
-    if ( size )
-    {
-      builder->scale_x = size->root.metrics.x_scale;
-      builder->scale_y = size->root.metrics.y_scale;
-    }
-
     builder->pos_x = 0;
     builder->pos_y = 0;
 
     builder->pos_x = 0;
     builder->pos_y = 0;
 
   /*    decoder :: A pointer to the glyph builder to initialize.           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    decoder :: A pointer to the glyph builder to initialize.           */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    face    :: The current face object.                                */
+  /*    face      :: The current face object.                              */
   /*                                                                       */
   /*                                                                       */
-  /*    size    :: The current size object.                                */
+  /*    size      :: The current size object.                              */
+  /*                                                                       */
+  /*    slot      :: The current glyph object.                             */
   /*                                                                       */
   /*                                                                       */
-  /*    slot    :: The current glyph object.                               */
+  /*    hinting   :: Whether hinting is active.                            */
+  /*                                                                       */
+  /*    hint_mode :: The hinting mode.                                     */
   /*                                                                       */
   FT_LOCAL_DEF( void )
   cff_decoder_init( CFF_Decoder*    decoder,
   /*                                                                       */
   FT_LOCAL_DEF( void )
   cff_decoder_init( CFF_Decoder*    decoder,
   }
 
 
   }
 
 
-  /* this function is used to select the locals subrs array */
+  /* this function is used to select the subfont */
+  /* and the locals subrs array                  */
   FT_LOCAL_DEF( FT_Error )
   cff_decoder_prepare( CFF_Decoder*  decoder,
   FT_LOCAL_DEF( FT_Error )
   cff_decoder_prepare( CFF_Decoder*  decoder,
+                       CFF_Size      size,
                        FT_UInt       glyph_index )
   {
                        FT_UInt       glyph_index )
   {
-    CFF_Font     cff   = (CFF_Font)decoder->builder.face->extra.data;
-    CFF_SubFont  sub   = &cff->top_font;
-    FT_Error     error = CFF_Err_Ok;
+    CFF_Builder  *builder = &decoder->builder;
+    CFF_Font      cff     = (CFF_Font)builder->face->extra.data;
+    CFF_SubFont   sub     = &cff->top_font;
+    FT_Error      error   = CFF_Err_Ok;
 
 
     /* manage CID fonts */
 
 
     /* manage CID fonts */
-    if ( cff->num_subfonts >= 1 )
+    if ( cff->num_subfonts )
     {
       FT_Byte  fd_index = cff_fd_select_get( &cff->fd_select, glyph_index );
 
     {
       FT_Byte  fd_index = cff_fd_select_get( &cff->fd_select, glyph_index );
 
         goto Exit;
       }
 
         goto Exit;
       }
 
+      FT_TRACE4(( "glyph index %d (subfont %d):\n", glyph_index, fd_index ));
+
       sub = cff->subfonts[fd_index];
       sub = cff->subfonts[fd_index];
+
+      if ( builder->hints_funcs && size )
+      {
+        CFF_Internal  internal = (CFF_Internal)size->root.internal;
+
+
+        /* for CFFs without subfonts, this value has already been set */
+        builder->hints_globals = (void *)internal->subfonts[fd_index];
+      }
     }
     }
+#ifdef FT_DEBUG_LEVEL_TRACE
+    else
+      FT_TRACE4(( "glyph index %d:\n", glyph_index ));
+#endif
 
     decoder->num_locals    = sub->num_local_subrs;
     decoder->locals        = sub->local_subrs;
 
     decoder->num_locals    = sub->num_local_subrs;
     decoder->locals        = sub->local_subrs;
       point->x = x >> 16;
       point->y = y >> 16;
       *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
       point->x = x >> 16;
       point->y = y >> 16;
       *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
-
-      builder->last = *point;
     }
 
     outline->n_points++;
     }
 
     outline->n_points++;
   cff_builder_close_contour( CFF_Builder*  builder )
   {
     FT_Outline*  outline = builder->current;
   cff_builder_close_contour( CFF_Builder*  builder )
   {
     FT_Outline*  outline = builder->current;
+    FT_Int       first;
 
 
     if ( !outline )
       return;
 
 
 
     if ( !outline )
       return;
 
-    /* XXXX: We must not include the last point in the path if it */
-    /*       is located on the first point.                       */
+    first = outline->n_contours <= 1
+            ? 0 : outline->contours[outline->n_contours - 2] + 1;
+
+    /* We must not include the last point in the path if it */
+    /* is located on the first point.                       */
     if ( outline->n_points > 1 )
     {
     if ( outline->n_points > 1 )
     {
-      FT_Int      first   = 0;
       FT_Vector*  p1      = outline->points + first;
       FT_Vector*  p2      = outline->points + outline->n_points - 1;
       FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;
 
 
       FT_Vector*  p1      = outline->points + first;
       FT_Vector*  p2      = outline->points + outline->n_points - 1;
       FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;
 
 
-      if ( outline->n_contours > 1 )
-      {
-        first = outline->contours[outline->n_contours - 2] + 1;
-        p1    = outline->points + first;
-      }
-
       /* `delete' last point only if it coincides with the first    */
       /* point and if it is not a control point (which can happen). */
       if ( p1->x == p2->x && p1->y == p2->y )
       /* `delete' last point only if it coincides with the first    */
       /* point and if it is not a control point (which can happen). */
       if ( p1->x == p2->x && p1->y == p2->y )
     }
 
     if ( outline->n_contours > 0 )
     }
 
     if ( outline->n_contours > 0 )
-      outline->contours[outline->n_contours - 1] =
-        (short)( outline->n_points - 1 );
+    {
+      /* Don't add contours only consisting of one point, i.e., */
+      /* check whether begin point and last point are the same. */
+      if ( first == outline->n_points - 1 )
+      {
+        outline->n_contours--;
+        outline->n_points--;
+      }
+      else
+        outline->contours[outline->n_contours - 1] =
+          (short)( outline->n_points - 1 );
+    }
   }
 
 
   }
 
 
     FT_ULong      charstring_len;
 
 
     FT_ULong      charstring_len;
 
 
+    if ( decoder->seac )
+    {
+      FT_ERROR(( "cff_operator_seac: invalid nested seac\n" ));
+      return CFF_Err_Syntax_Error;
+    }
+
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
     /* Incremental fonts don't necessarily have valid charsets.        */
     /* They use the character code, not the glyph index, in this case. */
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
     /* Incremental fonts don't necessarily have valid charsets.        */
     /* They use the character code, not the glyph index, in this case. */
 
     if ( bchar_index < 0 || achar_index < 0 )
     {
 
     if ( bchar_index < 0 || achar_index < 0 )
     {
-      FT_ERROR(( "cff_operator_seac:" ));
-      FT_ERROR(( " invalid seac character code arguments\n" ));
+      FT_ERROR(( "cff_operator_seac:"
+                 " invalid seac character code arguments\n" ));
       return CFF_Err_Syntax_Error;
     }
 
       return CFF_Err_Syntax_Error;
     }
 
                                 &charstring, &charstring_len );
     if ( !error )
     {
                                 &charstring, &charstring_len );
     if ( !error )
     {
+      /* the seac operator must not be nested */
+      decoder->seac = TRUE;
       error = cff_decoder_parse_charstrings( decoder, charstring,
                                              charstring_len );
       error = cff_decoder_parse_charstrings( decoder, charstring,
                                              charstring_len );
+      decoder->seac = FALSE;
 
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
                                 &charstring, &charstring_len );
     if ( !error )
     {
                                 &charstring, &charstring_len );
     if ( !error )
     {
+      /* the seac operator must not be nested */
+      decoder->seac = TRUE;
       error = cff_decoder_parse_charstrings( decoder, charstring,
                                              charstring_len );
       error = cff_decoder_parse_charstrings( decoder, charstring,
                                              charstring_len );
+      decoder->seac = FALSE;
 
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
     decoder->read_width = 1;
 
     /* compute random seed from stack address of parameter */
     decoder->read_width = 1;
 
     /* compute random seed from stack address of parameter */
-    seed = (FT_Fixed)(char*)&seed           ^
-           (FT_Fixed)(char*)&decoder        ^
-           (FT_Fixed)(char*)&charstring_base;
+    seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed              ^
+                         (FT_PtrDist)(char*)&decoder           ^
+                         (FT_PtrDist)(char*)&charstring_base ) &
+                         FT_ULONG_MAX ) ;
     seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
     if ( seed == 0 )
       seed = 0x7384;
     seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
     if ( seed == 0 )
       seed = 0x7384;
           ip += 2;
         }
         else if ( v < 247 )
           ip += 2;
         }
         else if ( v < 247 )
-          val = (FT_Long)v - 139;
+          val = (FT_Int32)v - 139;
         else if ( v < 251 )
         {
           if ( ip >= limit )
             goto Syntax_Error;
         else if ( v < 251 )
         {
           if ( ip >= limit )
             goto Syntax_Error;
-          val = ( (FT_Long)v - 247 ) * 256 + *ip++ + 108;
+          val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108;
         }
         else if ( v < 255 )
         {
           if ( ip >= limit )
             goto Syntax_Error;
         }
         else if ( v < 255 )
         {
           if ( ip >= limit )
             goto Syntax_Error;
-          val = -( (FT_Long)v - 251 ) * 256 - *ip++ - 108;
+          val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108;
         }
         else
         {
         }
         else
         {
       }
       else
       {
       }
       else
       {
+        /* The specification says that normally arguments are to be taken */
+        /* from the bottom of the stack.  However, this seems not to be   */
+        /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */
+        /* arguments similar to a PS interpreter.                         */
+
         FT_Fixed*  args     = decoder->top;
         FT_Int     num_args = (FT_Int)( args - decoder->stack );
         FT_Int     req_args;
         FT_Fixed*  args     = decoder->top;
         FT_Int     num_args = (FT_Int)( args - decoder->stack );
         FT_Int     req_args;
         case 8:
           op = cff_op_rrcurveto;
           break;
         case 8:
           op = cff_op_rrcurveto;
           break;
+        case 9:
+          op = cff_op_closepath;
+          break;
         case 10:
           op = cff_op_callsubr;
           break;
         case 10:
           op = cff_op_callsubr;
           break;
             case 15:
               op = cff_op_eq;
               break;
             case 15:
               op = cff_op_eq;
               break;
+            case 16:
+              op = cff_op_callothersubr;
+              break;
+            case 17:
+              op = cff_op_pop;
+              break;
             case 18:
               op = cff_op_drop;
               break;
             case 18:
               op = cff_op_drop;
               break;
             }
           }
           break;
             }
           }
           break;
+        case 13:
+          op = cff_op_hsbw;
+          break;
         case 14:
           op = cff_op_endchar;
           break;
         case 14:
           op = cff_op_endchar;
           break;
         default:
           ;
         }
         default:
           ;
         }
+
         if ( op == cff_op_unknown )
           goto Syntax_Error;
 
         if ( op == cff_op_unknown )
           goto Syntax_Error;
 
         req_args = cff_argument_counts[op];
         if ( req_args & CFF_COUNT_CHECK_WIDTH )
         {
         req_args = cff_argument_counts[op];
         if ( req_args & CFF_COUNT_CHECK_WIDTH )
         {
-          args = stack;
-
           if ( num_args > 0 && decoder->read_width )
           {
             /* If `nominal_width' is non-zero, the number is really a      */
           if ( num_args > 0 && decoder->read_width )
           {
             /* If `nominal_width' is non-zero, the number is really a      */
             case cff_op_endchar:
               /* If there is a width specified for endchar, we either have */
               /* 1 argument or 5 arguments.  We like to argue.             */
             case cff_op_endchar:
               /* If there is a width specified for endchar, we either have */
               /* 1 argument or 5 arguments.  We like to argue.             */
-              set_width_ok = ( ( num_args == 5 ) || ( num_args == 1 ) );
+              set_width_ok = ( num_args == 5 ) || ( num_args == 1 );
               break;
 
             default:
               break;
 
             default:
               decoder->glyph_width = decoder->nominal_width +
                                        ( stack[0] >> 16 );
 
               decoder->glyph_width = decoder->nominal_width +
                                        ( stack[0] >> 16 );
 
+              if ( decoder->width_only )
+              {
+                /* we only want the advance width; stop here */
+                break;
+              }
+
               /* Consumed an argument. */
               num_args--;
               /* Consumed an argument. */
               num_args--;
-              args++;
             }
           }
 
             }
           }
 
           req_args            = 0;
         }
 
           req_args            = 0;
         }
 
-        req_args &= 15;
+        req_args &= 0x000F;
         if ( num_args < req_args )
           goto Stack_Underflow;
         args     -= req_args;
         num_args -= req_args;
 
         if ( num_args < req_args )
           goto Stack_Underflow;
         args     -= req_args;
         num_args -= req_args;
 
+        /* At this point, `args' points to the first argument of the  */
+        /* operand in case `req_args' isn't zero.  Otherwise, we have */
+        /* to adjust `args' manually.                                 */
+
+        /* Note that we only pop arguments from the stack which we    */
+        /* really need and can digest so that we can continue in case */
+        /* of superfluous stack elements.                             */
+
         switch ( op )
         {
         case cff_op_hstem:
         switch ( op )
         {
         case cff_op_hstem:
         case cff_op_hstemhm:
         case cff_op_vstemhm:
           /* the number of arguments is always even here */
         case cff_op_hstemhm:
         case cff_op_vstemhm:
           /* the number of arguments is always even here */
-          FT_TRACE4(( op == cff_op_hstem   ? " hstem"   :
-                    ( op == cff_op_vstem   ? " vstem"   :
-                    ( op == cff_op_hstemhm ? " hstemhm" : " vstemhm" ) ) ));
+          FT_TRACE4((
+              op == cff_op_hstem   ? " hstem\n"   :
+            ( op == cff_op_vstem   ? " vstem\n"   :
+            ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) ));
 
           if ( hinter )
             hinter->stems( hinter->hints,
                            ( op == cff_op_hstem || op == cff_op_hstemhm ),
                            num_args / 2,
 
           if ( hinter )
             hinter->stems( hinter->hints,
                            ( op == cff_op_hstem || op == cff_op_hstemhm ),
                            num_args / 2,
-                           args );
+                           args - ( num_args & ~1 ) );
 
           decoder->num_hints += num_args / 2;
           args = stack;
 
           decoder->num_hints += num_args / 2;
           args = stack;
               hinter->stems( hinter->hints,
                              0,
                              num_args / 2,
               hinter->stems( hinter->hints,
                              0,
                              num_args / 2,
-                             args );
+                             args - ( num_args & ~1 ) );
 
             decoder->num_hints += num_args / 2;
           }
 
             decoder->num_hints += num_args / 2;
           }
             FT_UInt maskbyte;
 
 
             FT_UInt maskbyte;
 
 
-            FT_TRACE4(( " " ));
+            FT_TRACE4(( " (maskbytes: " ));
 
             for ( maskbyte = 0;
                   maskbyte < (FT_UInt)(( decoder->num_hints + 7 ) >> 3);
                   maskbyte++, ip++ )
               FT_TRACE4(( "0x%02X", *ip ));
 
             for ( maskbyte = 0;
                   maskbyte < (FT_UInt)(( decoder->num_hints + 7 ) >> 3);
                   maskbyte++, ip++ )
               FT_TRACE4(( "0x%02X", *ip ));
+
+            FT_TRACE4(( ")\n" ));
           }
 #else
           ip += ( decoder->num_hints + 7 ) >> 3;
           }
 #else
           ip += ( decoder->num_hints + 7 ) >> 3;
           break;
 
         case cff_op_rmoveto:
           break;
 
         case cff_op_rmoveto:
-          FT_TRACE4(( " rmoveto" ));
+          FT_TRACE4(( " rmoveto\n" ));
 
           cff_builder_close_contour( builder );
           builder->path_begun = 0;
 
           cff_builder_close_contour( builder );
           builder->path_begun = 0;
-          x   += args[0];
-          y   += args[1];
+          x   += args[-2];
+          y   += args[-1];
           args = stack;
           break;
 
         case cff_op_vmoveto:
           args = stack;
           break;
 
         case cff_op_vmoveto:
-          FT_TRACE4(( " vmoveto" ));
+          FT_TRACE4(( " vmoveto\n" ));
 
           cff_builder_close_contour( builder );
           builder->path_begun = 0;
 
           cff_builder_close_contour( builder );
           builder->path_begun = 0;
-          y   += args[0];
+          y   += args[-1];
           args = stack;
           break;
 
         case cff_op_hmoveto:
           args = stack;
           break;
 
         case cff_op_hmoveto:
-          FT_TRACE4(( " hmoveto" ));
+          FT_TRACE4(( " hmoveto\n" ));
 
           cff_builder_close_contour( builder );
           builder->path_begun = 0;
 
           cff_builder_close_contour( builder );
           builder->path_begun = 0;
-          x   += args[0];
+          x   += args[-1];
           args = stack;
           break;
 
         case cff_op_rlineto:
           args = stack;
           break;
 
         case cff_op_rlineto:
-          FT_TRACE4(( " rlineto" ));
+          FT_TRACE4(( " rlineto\n" ));
 
           if ( cff_builder_start_point ( builder, x, y ) ||
                check_points( builder, num_args / 2 )     )
             goto Fail;
 
 
           if ( cff_builder_start_point ( builder, x, y ) ||
                check_points( builder, num_args / 2 )     )
             goto Fail;
 
-          if ( num_args < 2 || num_args & 1 )
+          if ( num_args < 2 )
             goto Stack_Underflow;
 
             goto Stack_Underflow;
 
-          args = stack;
+          args -= num_args & ~1;
           while ( args < decoder->top )
           {
             x += args[0];
           while ( args < decoder->top )
           {
             x += args[0];
             FT_Int  phase = ( op == cff_op_hlineto );
 
 
             FT_Int  phase = ( op == cff_op_hlineto );
 
 
-            FT_TRACE4(( op == cff_op_hlineto ? " hlineto"
-                                             : " vlineto" ));
+            FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n"
+                                             : " vlineto\n" ));
+
+            if ( num_args < 1 )
+              goto Stack_Underflow;
 
             if ( cff_builder_start_point ( builder, x, y ) ||
                  check_points( builder, num_args )         )
 
             if ( cff_builder_start_point ( builder, x, y ) ||
                  check_points( builder, num_args )         )
           break;
 
         case cff_op_rrcurveto:
           break;
 
         case cff_op_rrcurveto:
-          FT_TRACE4(( " rrcurveto" ));
+          {
+            FT_Int  nargs;
 
 
-          /* check number of arguments; must be a multiple of 6 */
-          if ( num_args % 6 != 0 )
-            goto Stack_Underflow;
 
 
-          if ( cff_builder_start_point ( builder, x, y ) ||
-               check_points( builder, num_args / 2 )     )
-            goto Fail;
+            FT_TRACE4(( " rrcurveto\n" ));
 
 
-          args = stack;
-          while ( args < decoder->top )
-          {
-            x += args[0];
-            y += args[1];
-            cff_builder_add_point( builder, x, y, 0 );
-            x += args[2];
-            y += args[3];
-            cff_builder_add_point( builder, x, y, 0 );
-            x += args[4];
-            y += args[5];
-            cff_builder_add_point( builder, x, y, 1 );
-            args += 6;
+            if ( num_args < 6 )
+              goto Stack_Underflow;
+
+            nargs = num_args - num_args % 6;
+
+            if ( cff_builder_start_point ( builder, x, y ) ||
+                 check_points( builder, nargs / 2 )     )
+              goto Fail;
+
+            args -= nargs;
+            while ( args < decoder->top )
+            {
+              x += args[0];
+              y += args[1];
+              cff_builder_add_point( builder, x, y, 0 );
+              x += args[2];
+              y += args[3];
+              cff_builder_add_point( builder, x, y, 0 );
+              x += args[4];
+              y += args[5];
+              cff_builder_add_point( builder, x, y, 1 );
+              args += 6;
+            }
+            args = stack;
           }
           }
-          args = stack;
           break;
 
         case cff_op_vvcurveto:
           break;
 
         case cff_op_vvcurveto:
-          FT_TRACE4(( " vvcurveto" ));
+          {
+            FT_Int  nargs;
 
 
-          if ( cff_builder_start_point( builder, x, y ) )
-            goto Fail;
 
 
-          args = stack;
-          if ( num_args & 1 )
-          {
-            x += args[0];
-            args++;
-            num_args--;
-          }
+            FT_TRACE4(( " vvcurveto\n" ));
 
 
-          if ( num_args % 4 != 0 )
-            goto Stack_Underflow;
+            if ( num_args < 4 )
+              goto Stack_Underflow;
 
 
-          if ( check_points( builder, 3 * ( num_args / 4 ) ) )
-            goto Fail;
+            /* if num_args isn't of the form 4n or 4n+1, */
+            /* we reduce it to 4n+1                      */
 
 
-          while ( args < decoder->top )
-          {
-            y += args[0];
-            cff_builder_add_point( builder, x, y, 0 );
-            x += args[1];
-            y += args[2];
-            cff_builder_add_point( builder, x, y, 0 );
-            y += args[3];
-            cff_builder_add_point( builder, x, y, 1 );
-            args += 4;
+            nargs = num_args - num_args % 4;
+            if ( num_args - nargs > 0 )
+              nargs += 1;
+
+            if ( cff_builder_start_point( builder, x, y ) )
+              goto Fail;
+
+            args -= nargs;
+
+            if ( nargs & 1 )
+            {
+              x += args[0];
+              args++;
+              nargs--;
+            }
+
+            if ( check_points( builder, 3 * ( nargs / 4 ) ) )
+              goto Fail;
+
+            while ( args < decoder->top )
+            {
+              y += args[0];
+              cff_builder_add_point( builder, x, y, 0 );
+              x += args[1];
+              y += args[2];
+              cff_builder_add_point( builder, x, y, 0 );
+              y += args[3];
+              cff_builder_add_point( builder, x, y, 1 );
+              args += 4;
+            }
+            args = stack;
           }
           }
-          args = stack;
           break;
 
         case cff_op_hhcurveto:
           break;
 
         case cff_op_hhcurveto:
-          FT_TRACE4(( " hhcurveto" ));
+          {
+            FT_Int  nargs;
 
 
-          if ( cff_builder_start_point( builder, x, y ) )
-            goto Fail;
 
 
-          args = stack;
-          if ( num_args & 1 )
-          {
-            y += args[0];
-            args++;
-            num_args--;
-          }
+            FT_TRACE4(( " hhcurveto\n" ));
 
 
-          if ( num_args % 4 != 0 )
-            goto Stack_Underflow;
+            if ( num_args < 4 )
+              goto Stack_Underflow;
 
 
-          if ( check_points( builder, 3 * ( num_args / 4 ) ) )
-            goto Fail;
+            /* if num_args isn't of the form 4n or 4n+1, */
+            /* we reduce it to 4n+1                      */
 
 
-          while ( args < decoder->top )
-          {
-            x += args[0];
-            cff_builder_add_point( builder, x, y, 0 );
-            x += args[1];
-            y += args[2];
-            cff_builder_add_point( builder, x, y, 0 );
-            x += args[3];
-            cff_builder_add_point( builder, x, y, 1 );
-            args += 4;
+            nargs = num_args - num_args % 4;
+            if ( num_args - nargs > 0 )
+              nargs += 1;
+
+            if ( cff_builder_start_point( builder, x, y ) )
+              goto Fail;
+
+            args -= nargs;
+            if ( nargs & 1 )
+            {
+              y += args[0];
+              args++;
+              nargs--;
+            }
+
+            if ( check_points( builder, 3 * ( nargs / 4 ) ) )
+              goto Fail;
+
+            while ( args < decoder->top )
+            {
+              x += args[0];
+              cff_builder_add_point( builder, x, y, 0 );
+              x += args[1];
+              y += args[2];
+              cff_builder_add_point( builder, x, y, 0 );
+              x += args[3];
+              cff_builder_add_point( builder, x, y, 1 );
+              args += 4;
+            }
+            args = stack;
           }
           }
-          args = stack;
           break;
 
         case cff_op_vhcurveto:
         case cff_op_hvcurveto:
           {
             FT_Int  phase;
           break;
 
         case cff_op_vhcurveto:
         case cff_op_hvcurveto:
           {
             FT_Int  phase;
+            FT_Int  nargs;
 
 
 
 
-            FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto"
-                                               : " hvcurveto" ));
+            FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n"
+                                               : " hvcurveto\n" ));
 
             if ( cff_builder_start_point( builder, x, y ) )
               goto Fail;
 
 
             if ( cff_builder_start_point( builder, x, y ) )
               goto Fail;
 
-            args = stack;
-            if ( num_args < 4 || ( num_args % 4 ) > 1 )
+            if ( num_args < 4 )
               goto Stack_Underflow;
 
               goto Stack_Underflow;
 
-            if ( check_points( builder, ( num_args / 4 ) * 3 ) )
+            /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */
+            /* we reduce it to the largest one which fits             */
+
+            nargs = num_args - num_args % 4;
+            if ( num_args - nargs > 0 )
+              nargs += 1;
+
+            args -= nargs;
+            if ( check_points( builder, ( nargs / 4 ) * 3 ) )
               goto Stack_Underflow;
 
             phase = ( op == cff_op_hvcurveto );
 
               goto Stack_Underflow;
 
             phase = ( op == cff_op_hvcurveto );
 
-            while ( num_args >= 4 )
+            while ( nargs >= 4 )
             {
             {
-              num_args -= 4;
+              nargs -= 4;
               if ( phase )
               {
                 x += args[0];
               if ( phase )
               {
                 x += args[0];
                 y += args[2];
                 cff_builder_add_point( builder, x, y, 0 );
                 y += args[3];
                 y += args[2];
                 cff_builder_add_point( builder, x, y, 0 );
                 y += args[3];
-                if ( num_args == 1 )
+                if ( nargs == 1 )
                   x += args[4];
                 cff_builder_add_point( builder, x, y, 1 );
               }
                   x += args[4];
                 cff_builder_add_point( builder, x, y, 1 );
               }
                 y += args[2];
                 cff_builder_add_point( builder, x, y, 0 );
                 x += args[3];
                 y += args[2];
                 cff_builder_add_point( builder, x, y, 0 );
                 x += args[3];
-                if ( num_args == 1 )
+                if ( nargs == 1 )
                   y += args[4];
                 cff_builder_add_point( builder, x, y, 1 );
               }
                   y += args[4];
                 cff_builder_add_point( builder, x, y, 1 );
               }
 
         case cff_op_rlinecurve:
           {
 
         case cff_op_rlinecurve:
           {
-            FT_Int  num_lines = ( num_args - 6 ) / 2;
+            FT_Int  num_lines;
+            FT_Int  nargs;
 
 
 
 
-            FT_TRACE4(( " rlinecurve" ));
+            FT_TRACE4(( " rlinecurve\n" ));
 
 
-            if ( num_args < 8 || ( num_args - 6 ) & 1 )
+            if ( num_args < 8 )
               goto Stack_Underflow;
 
               goto Stack_Underflow;
 
+            nargs     = num_args & ~1;
+            num_lines = ( nargs - 6 ) / 2;
+
             if ( cff_builder_start_point( builder, x, y ) ||
                  check_points( builder, num_lines + 3 )   )
               goto Fail;
 
             if ( cff_builder_start_point( builder, x, y ) ||
                  check_points( builder, num_lines + 3 )   )
               goto Fail;
 
-            args = stack;
+            args -= nargs;
 
             /* first, add the line segments */
             while ( num_lines > 0 )
 
             /* first, add the line segments */
             while ( num_lines > 0 )
 
         case cff_op_rcurveline:
           {
 
         case cff_op_rcurveline:
           {
-            FT_Int  num_curves = ( num_args - 2 ) / 6;
+            FT_Int  num_curves;
+            FT_Int  nargs;
 
 
 
 
-            FT_TRACE4(( " rcurveline" ));
+            FT_TRACE4(( " rcurveline\n" ));
 
 
-            if ( num_args < 8 || ( num_args - 2 ) % 6 )
+            if ( num_args < 8 )
               goto Stack_Underflow;
 
               goto Stack_Underflow;
 
+            nargs      = num_args - 2;
+            nargs      = nargs - nargs % 6 + 2;
+            num_curves = ( nargs - 2 ) / 6;
+
             if ( cff_builder_start_point ( builder, x, y ) ||
             if ( cff_builder_start_point ( builder, x, y ) ||
-                 check_points( builder, num_curves*3 + 2 ) )
+                 check_points( builder, num_curves * 3 + 2 ) )
               goto Fail;
 
               goto Fail;
 
-            args = stack;
+            args -= nargs;
 
             /* first, add the curves */
             while ( num_curves > 0 )
 
             /* first, add the curves */
             while ( num_curves > 0 )
             FT_Pos start_y;
 
 
             FT_Pos start_y;
 
 
-            FT_TRACE4(( " hflex1" ));
-
-            args = stack;
+            FT_TRACE4(( " hflex1\n" ));
 
 
-            /* adding five more points; 4 control points, 1 on-curve point */
-            /* make sure we have enough space for the start point if it    */
+            /* adding five more points: 4 control points, 1 on-curve point */
+            /* -- make sure we have enough space for the start point if it */
             /* needs to be added                                           */
             if ( cff_builder_start_point( builder, x, y ) ||
                  check_points( builder, 6 )               )
               goto Fail;
 
             /* needs to be added                                           */
             if ( cff_builder_start_point( builder, x, y ) ||
                  check_points( builder, 6 )               )
               goto Fail;
 
-            /* Record the starting point's y position for later use */
+            /* record the starting point's y position for later use */
             start_y = y;
 
             /* first control point */
             start_y = y;
 
             /* first control point */
             FT_Pos start_y;
 
 
             FT_Pos start_y;
 
 
-            FT_TRACE4(( " hflex" ));
-
-            args = stack;
+            FT_TRACE4(( " hflex\n" ));
 
             /* adding six more points; 4 control points, 2 on-curve points */
             if ( cff_builder_start_point( builder, x, y ) ||
 
             /* adding six more points; 4 control points, 2 on-curve points */
             if ( cff_builder_start_point( builder, x, y ) ||
 
         case cff_op_flex1:
           {
 
         case cff_op_flex1:
           {
-            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_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_Fixed*  temp;
 
 
 
 
-            FT_TRACE4(( " flex1" ));
+            FT_TRACE4(( " flex1\n" ));
 
             /* adding six more points; 4 control points, 2 on-curve points */
             if ( cff_builder_start_point( builder, x, y ) ||
 
             /* adding six more points; 4 control points, 2 on-curve points */
             if ( cff_builder_start_point( builder, x, y ) ||
             /* XXX: figure out whether this is supposed to be a horizontal */
             /*      or vertical flex; the Type 2 specification is vague... */
 
             /* XXX: figure out whether this is supposed to be a horizontal */
             /*      or vertical flex; the Type 2 specification is vague... */
 
-            args = stack;
+            temp = args;
 
             /* grab up to the last argument */
             for ( count = 5; count > 0; count-- )
             {
 
             /* grab up to the last argument */
             for ( count = 5; count > 0; count-- )
             {
-              dx += args[0];
-              dy += args[1];
-              args += 2;
+              dx += temp[0];
+              dy += temp[1];
+              temp += 2;
             }
 
             }
 
-            /* rewind */
-            args = stack;
-
-            if ( dx < 0 ) dx = -dx;
-            if ( dy < 0 ) dy = -dy;
+            if ( dx < 0 )
+              dx = -dx;
+            if ( dy < 0 )
+              dy = -dy;
 
             /* strange test, but here it is... */
             horizontal = ( dx > dy );
 
             /* strange test, but here it is... */
             horizontal = ( dx > dy );
             {
               x += args[0];
               y += args[1];
             {
               x += args[0];
               y += args[1];
-              cff_builder_add_point( builder, x, y, (FT_Bool)( count == 3 ) );
+              cff_builder_add_point( builder, x, y,
+                                     (FT_Bool)( count == 3 ) );
               args += 2;
             }
 
               args += 2;
             }
 
             FT_UInt  count;
 
 
             FT_UInt  count;
 
 
-            FT_TRACE4(( " flex" ));
+            FT_TRACE4(( " flex\n" ));
 
             if ( cff_builder_start_point( builder, x, y ) ||
                  check_points( builder, 6 )               )
               goto Fail;
 
 
             if ( cff_builder_start_point( builder, x, y ) ||
                  check_points( builder, 6 )               )
               goto Fail;
 
-            args = stack;
             for ( count = 6; count > 0; count-- )
             {
               x += args[0];
             for ( count = 6; count > 0; count-- )
             {
               x += args[0];
           break;
 
         case cff_op_endchar:
           break;
 
         case cff_op_endchar:
-          FT_TRACE4(( " endchar" ));
+          FT_TRACE4(( " endchar\n" ));
 
           /* We are going to emulate the seac operator. */
 
           /* We are going to emulate the seac operator. */
-          if ( num_args == 4 )
+          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,
           {
             /* 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],
-                                       args[1],
-                                       (FT_Int)( args[2] >> 16 ),
-                                       (FT_Int)( args[3] >> 16 ) );
-            args += 4;
+                                       args[-4],
+                                       args[-3],
+                                       (FT_Int)( args[-2] >> 16 ),
+                                       (FT_Int)( args[-1] >> 16 ) );
 
             decoder->glyph_width = glyph_width;
           }
 
             decoder->glyph_width = glyph_width;
           }
           }
 
           /* return now! */
           }
 
           /* return now! */
-          FT_TRACE4(( "\n\n" ));
+          FT_TRACE4(( "\n" ));
           return error;
 
         case cff_op_abs:
           return error;
 
         case cff_op_abs:
-          FT_TRACE4(( " abs" ));
+          FT_TRACE4(( " abs\n" ));
 
           if ( args[0] < 0 )
             args[0] = -args[0];
 
           if ( args[0] < 0 )
             args[0] = -args[0];
           break;
 
         case cff_op_add:
           break;
 
         case cff_op_add:
-          FT_TRACE4(( " add" ));
+          FT_TRACE4(( " add\n" ));
 
           args[0] += args[1];
           args++;
           break;
 
         case cff_op_sub:
 
           args[0] += args[1];
           args++;
           break;
 
         case cff_op_sub:
-          FT_TRACE4(( " sub" ));
+          FT_TRACE4(( " sub\n" ));
 
           args[0] -= args[1];
           args++;
           break;
 
         case cff_op_div:
 
           args[0] -= args[1];
           args++;
           break;
 
         case cff_op_div:
-          FT_TRACE4(( " div" ));
+          FT_TRACE4(( " div\n" ));
 
           args[0] = FT_DivFix( args[0], args[1] );
           args++;
           break;
 
         case cff_op_neg:
 
           args[0] = FT_DivFix( args[0], args[1] );
           args++;
           break;
 
         case cff_op_neg:
-          FT_TRACE4(( " neg" ));
+          FT_TRACE4(( " neg\n" ));
 
           args[0] = -args[0];
           args++;
 
           args[0] = -args[0];
           args++;
             FT_Fixed  Rand;
 
 
             FT_Fixed  Rand;
 
 
-            FT_TRACE4(( " rand" ));
+            FT_TRACE4(( " rand\n" ));
 
             Rand = seed;
             if ( Rand >= 0x8000L )
 
             Rand = seed;
             if ( Rand >= 0x8000L )
           break;
 
         case cff_op_mul:
           break;
 
         case cff_op_mul:
-          FT_TRACE4(( " mul" ));
+          FT_TRACE4(( " mul\n" ));
 
           args[0] = FT_MulFix( args[0], args[1] );
           args++;
           break;
 
         case cff_op_sqrt:
 
           args[0] = FT_MulFix( args[0], args[1] );
           args++;
           break;
 
         case cff_op_sqrt:
-          FT_TRACE4(( " sqrt" ));
+          FT_TRACE4(( " sqrt\n" ));
 
           if ( args[0] > 0 )
           {
 
           if ( args[0] > 0 )
           {
 
         case cff_op_drop:
           /* nothing */
 
         case cff_op_drop:
           /* nothing */
-          FT_TRACE4(( " drop" ));
+          FT_TRACE4(( " drop\n" ));
 
           break;
 
 
           break;
 
             FT_Fixed  tmp;
 
 
             FT_Fixed  tmp;
 
 
-            FT_TRACE4(( " exch" ));
+            FT_TRACE4(( " exch\n" ));
 
             tmp     = args[0];
             args[0] = args[1];
 
             tmp     = args[0];
             args[0] = args[1];
             FT_Int  idx = (FT_Int)( args[0] >> 16 );
 
 
             FT_Int  idx = (FT_Int)( args[0] >> 16 );
 
 
-            FT_TRACE4(( " index" ));
+            FT_TRACE4(( " index\n" ));
 
             if ( idx < 0 )
               idx = 0;
 
             if ( idx < 0 )
               idx = 0;
             FT_Int  idx   = (FT_Int)( args[1] >> 16 );
 
 
             FT_Int  idx   = (FT_Int)( args[1] >> 16 );
 
 
-            FT_TRACE4(( " roll" ));
+            FT_TRACE4(( " roll\n" ));
 
             if ( count <= 0 )
               count = 1;
 
             if ( count <= 0 )
               count = 1;
           break;
 
         case cff_op_dup:
           break;
 
         case cff_op_dup:
-          FT_TRACE4(( " dup" ));
+          FT_TRACE4(( " dup\n" ));
 
           args[1] = args[0];
           args++;
 
           args[1] = args[0];
           args++;
             FT_Int    idx = (FT_Int)( args[1] >> 16 );
 
 
             FT_Int    idx = (FT_Int)( args[1] >> 16 );
 
 
-            FT_TRACE4(( " put" ));
+            FT_TRACE4(( " put\n" ));
 
             if ( idx >= 0 && idx < decoder->len_buildchar )
               decoder->buildchar[idx] = val;
 
             if ( idx >= 0 && idx < decoder->len_buildchar )
               decoder->buildchar[idx] = val;
             FT_Fixed  val = 0;
 
 
             FT_Fixed  val = 0;
 
 
-            FT_TRACE4(( " get" ));
+            FT_TRACE4(( " get\n" ));
 
             if ( idx >= 0 && idx < decoder->len_buildchar )
               val = decoder->buildchar[idx];
 
             if ( idx >= 0 && idx < decoder->len_buildchar )
               val = decoder->buildchar[idx];
           break;
 
         case cff_op_store:
           break;
 
         case cff_op_store:
-          FT_TRACE4(( " store "));
+          FT_TRACE4(( " store\n"));
 
           goto Unimplemented;
 
         case cff_op_load:
 
           goto Unimplemented;
 
         case cff_op_load:
-          FT_TRACE4(( " load" ));
+          FT_TRACE4(( " load\n" ));
 
           goto Unimplemented;
 
         case cff_op_dotsection:
           /* this operator is deprecated and ignored by the parser */
 
           goto Unimplemented;
 
         case cff_op_dotsection:
           /* this operator is deprecated and ignored by the parser */
-          FT_TRACE4(( " dotsection" ));
+          FT_TRACE4(( " dotsection\n" ));
+          break;
+
+        case cff_op_closepath:
+          /* this is an invalid Type 2 operator; however, there        */
+          /* exist fonts which are incorrectly converted from probably */
+          /* Type 1 to CFF, and some parsers seem to accept it         */
+
+          FT_TRACE4(( " closepath (invalid op)\n" ));
+
+          args = stack;
+          break;
+
+        case cff_op_hsbw:
+          /* this is an invalid Type 2 operator; however, there        */
+          /* exist fonts which are incorrectly converted from probably */
+          /* Type 1 to CFF, and some parsers seem to accept it         */
+
+          FT_TRACE4(( " hsbw (invalid op)\n" ));
+
+          decoder->glyph_width = decoder->nominal_width +
+                                   (args[1] >> 16);
+          x    = args[0];
+          y    = 0;
+          args = stack;
+          break;
+
+        case cff_op_callothersubr:
+          /* this is an invalid Type 2 operator; however, there        */
+          /* exist fonts which are incorrectly converted from probably */
+          /* Type 1 to CFF, and some parsers seem to accept it         */
+
+          FT_TRACE4(( " callothersubr (invalid op)\n" ));
+
+          /* don't modify stack; handle the subr as `unknown' so that */
+          /* following `pop' operands use the arguments on stack      */
+          break;
+
+        case cff_op_pop:
+          /* this is an invalid Type 2 operator; however, there        */
+          /* exist fonts which are incorrectly converted from probably */
+          /* Type 1 to CFF, and some parsers seem to accept it         */
+
+          FT_TRACE4(( " pop (invalid op)\n" ));
+
+          args++;
           break;
 
         case cff_op_and:
           break;
 
         case cff_op_and:
             FT_Fixed  cond = args[0] && args[1];
 
 
             FT_Fixed  cond = args[0] && args[1];
 
 
-            FT_TRACE4(( " and" ));
+            FT_TRACE4(( " and\n" ));
 
             args[0] = cond ? 0x10000L : 0;
             args++;
 
             args[0] = cond ? 0x10000L : 0;
             args++;
             FT_Fixed  cond = args[0] || args[1];
 
 
             FT_Fixed  cond = args[0] || args[1];
 
 
-            FT_TRACE4(( " or" ));
+            FT_TRACE4(( " or\n" ));
 
             args[0] = cond ? 0x10000L : 0;
             args++;
 
             args[0] = cond ? 0x10000L : 0;
             args++;
             FT_Fixed  cond = !args[0];
 
 
             FT_Fixed  cond = !args[0];
 
 
-            FT_TRACE4(( " eq" ));
+            FT_TRACE4(( " eq\n" ));
 
             args[0] = cond ? 0x10000L : 0;
             args++;
 
             args[0] = cond ? 0x10000L : 0;
             args++;
             FT_Fixed  cond = ( args[2] <= args[3] );
 
 
             FT_Fixed  cond = ( args[2] <= args[3] );
 
 
-            FT_TRACE4(( " ifelse" ));
+            FT_TRACE4(( " ifelse\n" ));
 
             if ( !cond )
               args[0] = args[1];
 
             if ( !cond )
               args[0] = args[1];
                                       decoder->locals_bias );
 
 
                                       decoder->locals_bias );
 
 
-            FT_TRACE4(( " callsubr(%d)", idx ));
+            FT_TRACE4(( " callsubr(%d)\n", idx ));
 
             if ( idx >= decoder->num_locals )
             {
 
             if ( idx >= decoder->num_locals )
             {
-              FT_ERROR(( "cff_decoder_parse_charstrings:" ));
-              FT_ERROR(( " invalid local subr index\n" ));
+              FT_ERROR(( "cff_decoder_parse_charstrings:"
+                         " invalid local subr index\n" ));
               goto Syntax_Error;
             }
 
               goto Syntax_Error;
             }
 
             if ( !zone->base || zone->limit == zone->base )
             {
               FT_ERROR(( "cff_decoder_parse_charstrings:"
             if ( !zone->base || zone->limit == zone->base )
             {
               FT_ERROR(( "cff_decoder_parse_charstrings:"
-                         " invoking empty subrs!\n" ));
+                         " invoking empty subrs\n" ));
               goto Syntax_Error;
             }
 
               goto Syntax_Error;
             }
 
                                       decoder->globals_bias );
 
 
                                       decoder->globals_bias );
 
 
-            FT_TRACE4(( " callgsubr(%d)", idx ));
+            FT_TRACE4(( " callgsubr(%d)\n", idx ));
 
             if ( idx >= decoder->num_globals )
             {
 
             if ( idx >= decoder->num_globals )
             {
-              FT_ERROR(( "cff_decoder_parse_charstrings:" ));
-              FT_ERROR(( " invalid global subr index\n" ));
+              FT_ERROR(( "cff_decoder_parse_charstrings:"
+                         " invalid global subr index\n" ));
               goto Syntax_Error;
             }
 
               goto Syntax_Error;
             }
 
             if ( !zone->base || zone->limit == zone->base )
             {
               FT_ERROR(( "cff_decoder_parse_charstrings:"
             if ( !zone->base || zone->limit == zone->base )
             {
               FT_ERROR(( "cff_decoder_parse_charstrings:"
-                         " invoking empty subrs!\n" ));
+                         " invoking empty subrs\n" ));
               goto Syntax_Error;
             }
 
               goto Syntax_Error;
             }
 
           break;
 
         case cff_op_return:
           break;
 
         case cff_op_return:
-          FT_TRACE4(( " return" ));
+          FT_TRACE4(( " return\n" ));
 
           if ( decoder->zone <= decoder->zones )
           {
 
           if ( decoder->zone <= decoder->zones )
           {
     return error;
 
   Syntax_Error:
     return error;
 
   Syntax_Error:
-    FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error!" ));
+    FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" ));
     return CFF_Err_Invalid_File_Format;
 
   Stack_Underflow:
     return CFF_Err_Invalid_File_Format;
 
   Stack_Underflow:
-    FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow!" ));
+    FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" ));
     return CFF_Err_Too_Few_Arguments;
 
   Stack_Overflow:
     return CFF_Err_Too_Few_Arguments;
 
   Stack_Overflow:
-    FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!" ));
+    FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" ));
     return CFF_Err_Stack_Overflow;
   }
 
     return CFF_Err_Stack_Overflow;
   }
 
                                   &charstring, &charstring_len );
       if ( !error )
       {
                                   &charstring, &charstring_len );
       if ( !error )
       {
-        error = cff_decoder_prepare( &decoder, glyph_index );
+        error = cff_decoder_prepare( &decoder, size, glyph_index );
         if ( !error )
           error = cff_decoder_parse_charstrings( &decoder,
                                                  charstring,
         if ( !error )
           error = cff_decoder_parse_charstrings( &decoder,
                                                  charstring,
   {
     FT_Error     error;
     CFF_Decoder  decoder;
   {
     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;
+    TT_Face      face = (TT_Face)glyph->root.face;
+    FT_Bool      hinting, force_scaling;
+    CFF_Font     cff  = (CFF_Font)face->extra.data;
 
     FT_Matrix    font_matrix;
     FT_Vector    font_offset;
 
 
 
     FT_Matrix    font_matrix;
     FT_Vector    font_offset;
 
 
+    force_scaling = FALSE;
+
     /* 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 &&
     /* 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 )
+         cff->charset.cids                               )
     {
     {
-      glyph_index = cff_charset_cid_to_gindex( &cff->charset, glyph_index );
-      if ( glyph_index == 0 )
-        return CFF_Err_Invalid_Argument;
+      /* don't handle CID 0 (.notdef) which is directly mapped to GID 0 */
+      if ( glyph_index != 0 )
+      {
+        glyph_index = cff_charset_cid_to_gindex( &cff->charset,
+                                                 glyph_index );
+        if ( glyph_index == 0 )
+          return CFF_Err_Invalid_Argument;
+      }
     }
     else if ( glyph_index >= cff->num_glyphs )
       return CFF_Err_Invalid_Argument;
     }
     else if ( glyph_index >= cff->num_glyphs )
       return CFF_Err_Invalid_Argument;
     if ( load_flags & FT_LOAD_SBITS_ONLY )
       return CFF_Err_Invalid_Argument;
 
     if ( load_flags & FT_LOAD_SBITS_ONLY )
       return CFF_Err_Invalid_Argument;
 
+    /* if we have a CID subfont, use its matrix (which has already */
+    /* been multiplied with the root matrix)                       */
+
+    /* this scaling is only relevant if the PS hinter isn't active */
+    if ( cff->num_subfonts )
+    {
+      FT_Byte  fd_index = cff_fd_select_get( &cff->fd_select,
+                                             glyph_index );
+
+      FT_ULong  top_upm = cff->top_font.font_dict.units_per_em;
+      FT_ULong  sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em;
+
+
+      font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
+      font_offset = cff->subfonts[fd_index]->font_dict.font_offset;
+
+      if ( top_upm != sub_upm )
+      {
+        glyph->x_scale = FT_MulDiv( glyph->x_scale, top_upm, sub_upm );
+        glyph->y_scale = FT_MulDiv( glyph->y_scale, top_upm, sub_upm );
+
+        force_scaling = TRUE;
+      }
+    }
+    else
+    {
+      font_matrix = cff->top_font.font_dict.font_matrix;
+      font_offset = cff->top_font.font_dict.font_offset;
+    }
+
     glyph->root.outline.n_points   = 0;
     glyph->root.outline.n_contours = 0;
 
     glyph->root.outline.n_points   = 0;
     glyph->root.outline.n_contours = 0;
 
       cff_decoder_init( &decoder, face, size, glyph, hinting,
                         FT_LOAD_TARGET_MODE( load_flags ) );
 
       cff_decoder_init( &decoder, face, size, glyph, hinting,
                         FT_LOAD_TARGET_MODE( load_flags ) );
 
+      if ( load_flags & FT_LOAD_ADVANCE_ONLY )
+        decoder.width_only = TRUE;
+
       decoder.builder.no_recurse =
       decoder.builder.no_recurse =
-        (FT_Bool)( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
+        (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE );
 
       /* now load the unscaled outline */
       error = cff_get_glyph_data( face, glyph_index,
                                   &charstring, &charstring_len );
       if ( !error )
       {
 
       /* now load the unscaled outline */
       error = cff_get_glyph_data( face, glyph_index,
                                   &charstring, &charstring_len );
       if ( !error )
       {
-        error = cff_decoder_prepare( &decoder, glyph_index );
+        error = cff_decoder_prepare( &decoder, size, glyph_index );
         if ( !error )
         {
           error = cff_decoder_parse_charstrings( &decoder,
         if ( !error )
         {
           error = cff_decoder_parse_charstrings( &decoder,
 
     if ( !error )
     {
 
     if ( !error )
     {
-      if ( cff->num_subfonts >= 1 )
-      {
-        FT_Byte  fd_index = cff_fd_select_get( &cff->fd_select,
-                                               glyph_index );
-
-
-        font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
-        font_offset = cff->subfonts[fd_index]->font_dict.font_offset;
-      }
-      else
-      {
-        font_matrix = cff->top_font.font_dict.font_matrix;
-        font_offset = cff->top_font.font_dict.font_offset;
-      }
-
       /* Now, set the metrics -- this is rather simple, as   */
       /* the left side bearing is the xMin, and the top side */
       /* bearing the yMax.                                   */
       /* Now, set the metrics -- this is rather simple, as   */
       /* the left side bearing is the xMin, and the top side */
       /* bearing the yMax.                                   */
         glyph->root.linearHoriAdvance           = decoder.glyph_width;
         glyph->root.internal->glyph_transformed = 0;
 
         glyph->root.linearHoriAdvance           = decoder.glyph_width;
         glyph->root.internal->glyph_transformed = 0;
 
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
         has_vertical_info = FT_BOOL( face->vertical_info                   &&
                                      face->vertical.number_Of_VMetrics > 0 &&
         has_vertical_info = FT_BOOL( face->vertical_info                   &&
                                      face->vertical.number_Of_VMetrics > 0 &&
-                                     face->vertical.long_metrics != 0 );
+                                     face->vertical.long_metrics           );
+#else
+        has_vertical_info = FT_BOOL( face->vertical_info                   &&
+                                     face->vertical.number_Of_VMetrics > 0 );
+#endif
 
         /* get the vertical metrics from the vtmx table if we have one */
         if ( has_vertical_info )
 
         /* get the vertical metrics from the vtmx table if we have one */
         if ( has_vertical_info )
 
         glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
 
 
         glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
 
-        /* apply the font matrix */
         if ( !( font_matrix.xx == 0x10000L &&
                 font_matrix.yy == 0x10000L &&
                 font_matrix.xy == 0        &&
         if ( !( font_matrix.xx == 0x10000L &&
                 font_matrix.yy == 0x10000L &&
                 font_matrix.xy == 0        &&
         FT_Vector_Transform( &advance, &font_matrix );
         metrics->vertAdvance = advance.y + font_offset.y;
 
         FT_Vector_Transform( &advance, &font_matrix );
         metrics->vertAdvance = advance.y + font_offset.y;
 
-        if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
+        if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )
         {
           /* scale the outline and the metrics */
           FT_Int       n;
         {
           /* scale the outline and the metrics */
           FT_Int       n;
         metrics->horiBearingY = cbox.yMax;
 
         if ( has_vertical_info )
         metrics->horiBearingY = cbox.yMax;
 
         if ( has_vertical_info )
-          metrics->vertBearingX = -metrics->width / 2;
+          metrics->vertBearingX = metrics->horiBearingX -
+                                    metrics->horiAdvance / 2;
         else
           ft_synthesize_vertical_metrics( metrics,
                                           metrics->vertAdvance );
         else
           ft_synthesize_vertical_metrics( metrics,
                                           metrics->vertAdvance );
index f67864a..956817a 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType Glyph Loader (specification).                               */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -53,12 +53,6 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    current       :: The current glyph outline.                        */
   /*                                                                       */
   /*                                                                       */
   /*    current       :: The current glyph outline.                        */
   /*                                                                       */
-  /*    last          :: The last point position.                          */
-  /*                                                                       */
-  /*    scale_x       :: The horizontal scale (FUnits to sub-pixels).      */
-  /*                                                                       */
-  /*    scale_y       :: The vertical scale (FUnits to sub-pixels).        */
-  /*                                                                       */
   /*    pos_x         :: The horizontal translation (if composite glyph).  */
   /*                                                                       */
   /*    pos_y         :: The vertical translation (if composite glyph).    */
   /*    pos_x         :: The horizontal translation (if composite glyph).  */
   /*                                                                       */
   /*    pos_y         :: The vertical translation (if composite glyph).    */
@@ -92,11 +86,6 @@ FT_BEGIN_HEADER
     FT_Outline*     base;
     FT_Outline*     current;
 
     FT_Outline*     base;
     FT_Outline*     current;
 
-    FT_Vector       last;
-
-    FT_Fixed        scale_x;
-    FT_Fixed        scale_y;
-
     FT_Pos          pos_x;
     FT_Pos          pos_y;
 
     FT_Pos          pos_x;
     FT_Pos          pos_y;
 
@@ -146,6 +135,7 @@ FT_BEGIN_HEADER
     FT_Pos             nominal_width;
 
     FT_Bool            read_width;
     FT_Pos             nominal_width;
 
     FT_Bool            read_width;
+    FT_Bool            width_only;
     FT_Int             num_hints;
     FT_Fixed*          buildchar;
     FT_Int             len_buildchar;
     FT_Int             num_hints;
     FT_Fixed*          buildchar;
     FT_Int             len_buildchar;
@@ -164,6 +154,8 @@ FT_BEGIN_HEADER
 
     FT_Render_Mode     hint_mode;
 
 
     FT_Render_Mode     hint_mode;
 
+    FT_Bool            seac;
+
   } CFF_Decoder;
 
 
   } CFF_Decoder;
 
 
@@ -177,6 +169,7 @@ FT_BEGIN_HEADER
 
   FT_LOCAL( FT_Error )
   cff_decoder_prepare( CFF_Decoder*  decoder,
 
   FT_LOCAL( FT_Error )
   cff_decoder_prepare( CFF_Decoder*  decoder,
+                       CFF_Size      size,
                        FT_UInt       glyph_index );
 
 #if 0  /* unused until we support pure CFF fonts */
                        FT_UInt       glyph_index );
 
 #if 0  /* unused until we support pure CFF fonts */
index dd2f113..64d1395 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType and CFF data/program tables loader (body).                  */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType and CFF data/program tables loader (body).                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -31,6 +31,7 @@
 
 
 #if 1
 
 
 #if 1
+
   static const FT_UShort  cff_isoadobe_charset[229] =
   {
       0,   1,   2,   3,   4,   5,   6,   7,
   static const FT_UShort  cff_isoadobe_charset[229] =
   {
       0,   1,   2,   3,   4,   5,   6,   7,
     363, 364, 365, 366, 367, 368, 369, 370,
     371, 372, 373, 374, 375, 376, 377, 378
   };
     363, 364, 365, 366, 367, 368, 369, 370,
     371, 372, 373, 374, 375, 376, 377, 378
   };
-#endif
+
+#endif /* 1 */
 
 
   FT_LOCAL_DEF( FT_UShort )
   cff_get_standard_encoding( FT_UInt  charcode )
   {
 
 
   FT_LOCAL_DEF( FT_UShort )
   cff_get_standard_encoding( FT_UInt  charcode )
   {
-    return  (FT_UShort)(charcode < 256 ? cff_standard_encoding[charcode] : 0);
+    return (FT_UShort)( charcode < 256 ? cff_standard_encoding[charcode]
+                                       : 0 );
   }
 
 
   }
 
 
   static FT_Error
   cff_index_load_offsets( CFF_Index  idx )
   {
   static FT_Error
   cff_index_load_offsets( CFF_Index  idx )
   {
-    FT_Error   error  = 0;
+    FT_Error   error  = CFF_Err_Ok;
     FT_Stream  stream = idx->stream;
     FT_Memory  memory = stream->memory;
 
     FT_Stream  stream = idx->stream;
     FT_Memory  memory = stream->memory;
 
       old_offset = 1;
       for ( n = 0; n <= idx->count; n++ )
       {
       old_offset = 1;
       for ( n = 0; n <= idx->count; n++ )
       {
+        /* at this point, `idx->offsets' can't be NULL */
         offset = idx->offsets[n];
         if ( !offset )
           offset = old_offset;
         offset = idx->offsets[n];
         if ( !offset )
           offset = old_offset;
   {
     FT_Error   error   = FT_Err_Ok;
     FT_UInt    i;
   {
     FT_Error   error   = FT_Err_Ok;
     FT_UInt    i;
+    FT_Long    j;
     FT_UShort  max_cid = 0;
 
 
     FT_UShort  max_cid = 0;
 
 
     if ( FT_NEW_ARRAY( charset->cids, max_cid ) )
       goto Exit;
 
     if ( FT_NEW_ARRAY( charset->cids, max_cid ) )
       goto Exit;
 
-    for ( i = 0; i < num_glyphs; i++ )
-      charset->cids[charset->sids[i]] = (FT_UShort)i;
+    /* When multiple GIDs map to the same CID, we choose the lowest */
+    /* GID.  This is not described in any spec, but it matches the  */
+    /* behaviour of recent Acroread versions.                       */
+    for ( j = num_glyphs - 1; j >= 0 ; j-- )
+      charset->cids[charset->sids[j]] = (FT_UShort)j;
 
     charset->max_cid    = max_cid;
     charset->num_glyphs = num_glyphs;
 
     charset->max_cid    = max_cid;
     charset->num_glyphs = num_glyphs;
             goto Exit;
 
           for ( j = 1; j < num_glyphs; j++ )
             goto Exit;
 
           for ( j = 1; j < num_glyphs; j++ )
-            charset->sids[j] = FT_GET_USHORT();
+          {
+            FT_UShort sid = FT_GET_USHORT();
+
+
+            /* this constant is given in the CFF specification */
+            if ( sid < 65000L )
+              charset->sids[j] = sid;
+            else
+            {
+              FT_TRACE0(( "cff_charset_load:"
+                          " invalid SID value %d set to zero\n", sid ));
+              charset->sids[j] = 0;
+            }
+          }
 
           FT_FRAME_EXIT();
         }
 
           FT_FRAME_EXIT();
         }
                 goto Exit;
             }
 
                 goto Exit;
             }
 
+            /* check whether the range contains at least one valid glyph; */
+            /* the constant is given in the CFF specification             */
+            if ( glyph_sid >= 65000L ) {
+              FT_ERROR(( "cff_charset_load: invalid SID range\n" ));
+              error = CFF_Err_Invalid_File_Format;
+              goto Exit;
+            }
+
+            /* try to rescue some of the SIDs if `nleft' is too large */
+            if ( nleft > 65000L - 1L || glyph_sid >= 65000L - nleft ) {
+              FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" ));
+              nleft = ( FT_UInt )( 65000L - 1L - glyph_sid );
+            }
+
             /* Fill in the range of sids -- `nleft + 1' glyphs. */
             for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )
               charset->sids[j] = glyph_sid;
             /* Fill in the range of sids -- `nleft + 1' glyphs. */
             for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )
               charset->sids[j] = glyph_sid;
         break;
 
       default:
         break;
 
       default:
-        FT_ERROR(( "cff_charset_load: invalid table format!\n" ));
+        FT_ERROR(( "cff_charset_load: invalid table format\n" ));
         error = CFF_Err_Invalid_File_Format;
         goto Exit;
       }
         error = CFF_Err_Invalid_File_Format;
         goto Exit;
       }
         if ( num_glyphs > 229 )
         {
           FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
         if ( num_glyphs > 229 )
         {
           FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
-                     "predefined charset (Adobe ISO-Latin)!\n" ));
+                     "predefined charset (Adobe ISO-Latin)\n" ));
           error = CFF_Err_Invalid_File_Format;
           goto Exit;
         }
           error = CFF_Err_Invalid_File_Format;
           goto Exit;
         }
         if ( num_glyphs > 166 )
         {
           FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
         if ( num_glyphs > 166 )
         {
           FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
-                     "predefined charset (Adobe Expert)!\n" ));
+                     "predefined charset (Adobe Expert)\n" ));
           error = CFF_Err_Invalid_File_Format;
           goto Exit;
         }
           error = CFF_Err_Invalid_File_Format;
           goto Exit;
         }
         if ( num_glyphs > 87 )
         {
           FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
         if ( num_glyphs > 87 )
         {
           FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
-                     "predefined charset (Adobe Expert Subset)!\n" ));
+                     "predefined charset (Adobe Expert Subset)\n" ));
           error = CFF_Err_Invalid_File_Format;
           goto Exit;
         }
           error = CFF_Err_Invalid_File_Format;
           goto Exit;
         }
         break;
 
       default:
         break;
 
       default:
-        FT_ERROR(( "cff_encoding_load: invalid table format!\n" ));
+        FT_ERROR(( "cff_encoding_load: invalid table format\n" ));
         error = CFF_Err_Invalid_File_Format;
         goto Exit;
       }
         error = CFF_Err_Invalid_File_Format;
         goto Exit;
       }
         break;
 
       default:
         break;
 
       default:
-        FT_ERROR(( "cff_encoding_load: invalid table format!\n" ));
+        FT_ERROR(( "cff_encoding_load: invalid table format\n" ));
         error = CFF_Err_Invalid_File_Format;
         goto Exit;
       }
         error = CFF_Err_Invalid_File_Format;
         goto Exit;
       }
                     CFF_Index    idx,
                     FT_UInt      font_index,
                     FT_Stream    stream,
                     CFF_Index    idx,
                     FT_UInt      font_index,
                     FT_Stream    stream,
-                    FT_ULong     base_offset )
+                    FT_ULong     base_offset,
+                    FT_Library   library )
   {
     FT_Error         error;
     CFF_ParserRec    parser;
   {
     FT_Error         error;
     CFF_ParserRec    parser;
     CFF_Private      priv = &font->private_dict;
 
 
     CFF_Private      priv = &font->private_dict;
 
 
-    cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict );
+    cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict, library );
 
     /* set defaults */
     FT_MEM_ZERO( top, sizeof ( *top ) );
 
     /* set defaults */
     FT_MEM_ZERO( top, sizeof ( *top ) );
     top->cid_ordering        = 0xFFFFU;
     top->cid_font_name       = 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 );
+    error = cff_index_access_element( idx, font_index, &dict, &dict_len );
+    if ( !error )
+      error = cff_parser_run( &parser, dict, dict + dict_len );
 
     cff_index_forget_element( idx, &dict );
 
 
     cff_index_forget_element( idx, &dict );
 
       priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
       priv->blue_scale       = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
 
       priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
       priv->blue_scale       = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
 
-      cff_parser_init( &parser, CFF_CODE_PRIVATE, priv );
+      cff_parser_init( &parser, CFF_CODE_PRIVATE, priv, library );
 
       if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) ||
            FT_FRAME_ENTER( font->font_dict.private_size )                 )
 
       if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) ||
            FT_FRAME_ENTER( font->font_dict.private_size )                 )
 
 
   FT_LOCAL_DEF( FT_Error )
 
 
   FT_LOCAL_DEF( FT_Error )
-  cff_font_load( FT_Stream  stream,
+  cff_font_load( FT_Library library,
+                 FT_Stream  stream,
                  FT_Int     face_index,
                  FT_Int     face_index,
-                 CFF_Font   font )
+                 CFF_Font   font,
+                 FT_Bool    pure_cff )
   {
     static const FT_Frame_Field  cff_header_fields[] =
     {
   {
     static const FT_Frame_Field  cff_header_fields[] =
     {
          font->header_size      < 4 ||
          font->absolute_offsize > 4 )
     {
          font->header_size      < 4 ||
          font->absolute_offsize > 4 )
     {
-      FT_TRACE2(( "[not a CFF font header!]\n" ));
+      FT_TRACE2(( "[not a CFF font header]\n" ));
       error = CFF_Err_Unknown_File_Format;
       goto Exit;
     }
       error = CFF_Err_Unknown_File_Format;
       goto Exit;
     }
                               &font->font_dict_index,
                               face_index,
                               stream,
                               &font->font_dict_index,
                               face_index,
                               stream,
-                              base_offset );
+                              base_offset,
+                              library );
     if ( error )
       goto Exit;
 
     if ( error )
       goto Exit;
 
 
       if ( fd_index.count > CFF_MAX_CID_FONTS )
       {
 
       if ( fd_index.count > CFF_MAX_CID_FONTS )
       {
-        FT_ERROR(( "cff_font_load: FD array too large in CID font\n" ));
+        FT_TRACE0(( "cff_font_load: FD array too large in CID font\n" ));
         goto Fail_CID;
       }
 
         goto Fail_CID;
       }
 
       {
         sub = font->subfonts[idx];
         error = cff_subfont_load( sub, &fd_index, idx,
       {
         sub = font->subfonts[idx];
         error = cff_subfont_load( sub, &fd_index, idx,
-                                  stream, base_offset );
+                                  stream, base_offset, library );
         if ( error )
           goto Fail_CID;
       }
         if ( error )
           goto Fail_CID;
       }
     /* read the charstrings index now */
     if ( dict->charstrings_offset == 0 )
     {
     /* read the charstrings index now */
     if ( dict->charstrings_offset == 0 )
     {
-      FT_ERROR(( "cff_font_load: no charstrings offset!\n" ));
+      FT_ERROR(( "cff_font_load: no charstrings offset\n" ));
       error = CFF_Err_Unknown_File_Format;
       goto Exit;
     }
       error = CFF_Err_Unknown_File_Format;
       goto Exit;
     }
     /* read the Charset and Encoding tables if available */
     if ( font->num_glyphs > 0 )
     {
     /* read the Charset and Encoding tables if available */
     if ( font->num_glyphs > 0 )
     {
-      FT_Bool  invert = FT_BOOL( dict->cid_registry != 0xFFFFU );
+      FT_Bool  invert = FT_BOOL( dict->cid_registry != 0xFFFFU && pure_cff );
 
 
       error = cff_charset_load( &font->charset, font->num_glyphs, stream,
 
 
       error = cff_charset_load( &font->charset, font->num_glyphs, stream,
         if ( error )
           goto Exit;
       }
         if ( error )
           goto Exit;
       }
-      else
-        /* CID-keyed fonts only need CIDs */
-        FT_FREE( font->charset.sids );
     }
 
     /* get the font name (/CIDFontName for CID-keyed fonts, */
     }
 
     /* get the font name (/CIDFontName for CID-keyed fonts, */
       FT_FREE( font->font_info );
     }
 
       FT_FREE( font->font_info );
     }
 
+    FT_FREE( font->registry );
+    FT_FREE( font->ordering );
+
     FT_FREE( font->global_subrs );
     FT_FREE( font->font_name );
   }
     FT_FREE( font->global_subrs );
     FT_FREE( font->font_name );
   }
index 068cbb5..2b313ac 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType & CFF data/program tables loader (specification).           */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType & CFF data/program tables loader (specification).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2007 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2007, 2008 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -58,9 +58,11 @@ FT_BEGIN_HEADER
 
 
   FT_LOCAL( FT_Error )
 
 
   FT_LOCAL( FT_Error )
-  cff_font_load( FT_Stream  stream,
+  cff_font_load( FT_Library library, 
+                 FT_Stream  stream,
                  FT_Int     face_index,
                  FT_Int     face_index,
-                 CFF_Font   font );
+                 CFF_Font   font,
+                 FT_Bool    pure_cff );
 
   FT_LOCAL( void )
   cff_font_done( CFF_Font  font );
 
   FT_LOCAL( void )
   cff_font_done( CFF_Font  font );
index c02cf33..e0966e0 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType objects manager (body).                                     */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType objects manager (body).                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -30,6 +30,7 @@
 #include "cffload.h"
 #include "cffcmap.h"
 #include "cfferrs.h"
 #include "cffload.h"
 #include "cffcmap.h"
 #include "cfferrs.h"
+#include "cffpic.h"
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
@@ -56,7 +57,7 @@
   cff_size_get_globals_funcs( CFF_Size  size )
   {
     CFF_Face          face     = (CFF_Face)size->root.face;
   cff_size_get_globals_funcs( CFF_Size  size )
   {
     CFF_Face          face     = (CFF_Face)size->root.face;
-    CFF_Font          font     = (CFF_FontRec *)face->extra.data;
+    CFF_Font          font     = (CFF_Font)face->extra.data;
     PSHinter_Service  pshinter = (PSHinter_Service)font->pshinter;
     FT_Module         module;
 
     PSHinter_Service  pshinter = (PSHinter_Service)font->pshinter;
     FT_Module         module;
 
   FT_LOCAL_DEF( void )
   cff_size_done( FT_Size  cffsize )        /* CFF_Size */
   {
   FT_LOCAL_DEF( void )
   cff_size_done( FT_Size  cffsize )        /* CFF_Size */
   {
-    CFF_Size  size = (CFF_Size)cffsize;
+    CFF_Size      size     = (CFF_Size)cffsize;
+    CFF_Face      face     = (CFF_Face)size->root.face;
+    CFF_Font      font     = (CFF_Font)face->extra.data;
+    CFF_Internal  internal = (CFF_Internal)cffsize->internal;
 
 
 
 
-    if ( cffsize->internal )
+    if ( internal )
     {
       PSH_Globals_Funcs  funcs;
 
 
       funcs = cff_size_get_globals_funcs( size );
       if ( funcs )
     {
       PSH_Globals_Funcs  funcs;
 
 
       funcs = cff_size_get_globals_funcs( size );
       if ( funcs )
-        funcs->destroy( (PSH_Globals)cffsize->internal );
+      {
+        FT_UInt  i;
+
+
+        funcs->destroy( internal->topfont );
+
+        for ( i = font->num_subfonts; i > 0; i-- )
+          funcs->destroy( internal->subfonts[i - 1] );
+      }
 
 
-      cffsize->internal = 0;
+      /* `internal' is freed by destroy_size (in ftobjs.c) */
     }
   }
 
 
     }
   }
 
 
+  /* CFF and Type 1 private dictionaries have slightly different      */
+  /* structures; we need to synthesize a Type 1 dictionary on the fly */
+
+  static void
+  cff_make_private_dict( CFF_SubFont  subfont,
+                         PS_Private   priv )
+  {
+    CFF_Private  cpriv = &subfont->private_dict;
+    FT_UInt      n, count;
+
+
+    FT_MEM_ZERO( priv, sizeof ( *priv ) );
+
+    count = priv->num_blue_values = cpriv->num_blue_values;
+    for ( n = 0; n < count; n++ )
+      priv->blue_values[n] = (FT_Short)cpriv->blue_values[n];
+
+    count = priv->num_other_blues = cpriv->num_other_blues;
+    for ( n = 0; n < count; n++ )
+      priv->other_blues[n] = (FT_Short)cpriv->other_blues[n];
+
+    count = priv->num_family_blues = cpriv->num_family_blues;
+    for ( n = 0; n < count; n++ )
+      priv->family_blues[n] = (FT_Short)cpriv->family_blues[n];
+
+    count = priv->num_family_other_blues = cpriv->num_family_other_blues;
+    for ( n = 0; n < count; n++ )
+      priv->family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];
+
+    priv->blue_scale = cpriv->blue_scale;
+    priv->blue_shift = (FT_Int)cpriv->blue_shift;
+    priv->blue_fuzz  = (FT_Int)cpriv->blue_fuzz;
+
+    priv->standard_width[0]  = (FT_UShort)cpriv->standard_width;
+    priv->standard_height[0] = (FT_UShort)cpriv->standard_height;
+
+    count = priv->num_snap_widths = cpriv->num_snap_widths;
+    for ( n = 0; n < count; n++ )
+      priv->snap_widths[n] = (FT_Short)cpriv->snap_widths[n];
+
+    count = priv->num_snap_heights = cpriv->num_snap_heights;
+    for ( n = 0; n < count; n++ )
+      priv->snap_heights[n] = (FT_Short)cpriv->snap_heights[n];
+
+    priv->force_bold     = cpriv->force_bold;
+    priv->language_group = cpriv->language_group;
+    priv->lenIV          = cpriv->lenIV;
+  }
+
+
   FT_LOCAL_DEF( FT_Error )
   cff_size_init( FT_Size  cffsize )         /* CFF_Size */
   {
   FT_LOCAL_DEF( FT_Error )
   cff_size_init( FT_Size  cffsize )         /* CFF_Size */
   {
 
     if ( funcs )
     {
 
     if ( funcs )
     {
-      PSH_Globals    globals;
-      CFF_Face       face    = (CFF_Face)cffsize->face;
-      CFF_Font       font    = (CFF_FontRec *)face->extra.data;
-      CFF_SubFont    subfont = &font->top_font;
+      CFF_Face      face     = (CFF_Face)cffsize->face;
+      CFF_Font      font     = (CFF_Font)face->extra.data;
+      CFF_Internal  internal;
 
 
-      CFF_Private    cpriv   = &subfont->private_dict;
       PS_PrivateRec  priv;
       PS_PrivateRec  priv;
+      FT_Memory      memory = cffsize->face->memory;
 
 
+      FT_UInt  i;
 
 
-      /* IMPORTANT: The CFF and Type1 private dictionaries have    */
-      /*            slightly different structures; we need to      */
-      /*            synthetize a type1 dictionary on the fly here. */
-
-      {
-        FT_UInt  n, count;
-
-
-        FT_MEM_ZERO( &priv, sizeof ( priv ) );
-
-        count = priv.num_blue_values = cpriv->num_blue_values;
-        for ( n = 0; n < count; n++ )
-          priv.blue_values[n] = (FT_Short)cpriv->blue_values[n];
-
-        count = priv.num_other_blues = cpriv->num_other_blues;
-        for ( n = 0; n < count; n++ )
-          priv.other_blues[n] = (FT_Short)cpriv->other_blues[n];
 
 
-        count = priv.num_family_blues = cpriv->num_family_blues;
-        for ( n = 0; n < count; n++ )
-          priv.family_blues[n] = (FT_Short)cpriv->family_blues[n];
-
-        count = priv.num_family_other_blues = cpriv->num_family_other_blues;
-        for ( n = 0; n < count; n++ )
-          priv.family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];
-
-        priv.blue_scale = cpriv->blue_scale;
-        priv.blue_shift = (FT_Int)cpriv->blue_shift;
-        priv.blue_fuzz  = (FT_Int)cpriv->blue_fuzz;
+      if ( FT_NEW( internal ) )
+        goto Exit;
 
 
-        priv.standard_width[0]  = (FT_UShort)cpriv->standard_width;
-        priv.standard_height[0] = (FT_UShort)cpriv->standard_height;
+      cff_make_private_dict( &font->top_font, &priv );
+      error = funcs->create( cffsize->face->memory, &priv,
+                             &internal->topfont );
+      if ( error )
+        goto Exit;
 
 
-        count = priv.num_snap_widths = cpriv->num_snap_widths;
-        for ( n = 0; n < count; n++ )
-          priv.snap_widths[n] = (FT_Short)cpriv->snap_widths[n];
+      for ( i = font->num_subfonts; i > 0; i-- )
+      {
+        CFF_SubFont  sub = font->subfonts[i - 1];
 
 
-        count = priv.num_snap_heights = cpriv->num_snap_heights;
-        for ( n = 0; n < count; n++ )
-          priv.snap_heights[n] = (FT_Short)cpriv->snap_heights[n];
 
 
-        priv.force_bold     = cpriv->force_bold;
-        priv.language_group = cpriv->language_group;
-        priv.lenIV          = cpriv->lenIV;
+        cff_make_private_dict( sub, &priv );
+        error = funcs->create( cffsize->face->memory, &priv,
+                               &internal->subfonts[i - 1] );
+        if ( error )
+          goto Exit;
       }
 
       }
 
-      error = funcs->create( cffsize->face->memory, &priv, &globals );
-      if ( !error )
-        cffsize->internal = (FT_Size_Internal)(void*)globals;
+      cffsize->internal = (FT_Size_Internal)(void*)internal;
     }
 
     size->strike_index = 0xFFFFFFFFUL;
 
     }
 
     size->strike_index = 0xFFFFFFFFUL;
 
+  Exit:
     return error;
   }
 
     return error;
   }
 
     funcs = cff_size_get_globals_funcs( cffsize );
 
     if ( funcs )
     funcs = cff_size_get_globals_funcs( cffsize );
 
     if ( funcs )
-      funcs->set_scale( (PSH_Globals)size->internal,
-                        size->metrics.x_scale,
-                        size->metrics.y_scale,
+    {
+      CFF_Face      face     = (CFF_Face)size->face;
+      CFF_Font      font     = (CFF_Font)face->extra.data;
+      CFF_Internal  internal = (CFF_Internal)size->internal;
+
+      FT_ULong  top_upm  = font->top_font.font_dict.units_per_em;
+      FT_UInt   i;
+
+
+      funcs->set_scale( internal->topfont,
+                        size->metrics.x_scale, size->metrics.y_scale,
                         0, 0 );
 
                         0, 0 );
 
+      for ( i = font->num_subfonts; i > 0; i-- )
+      {
+        CFF_SubFont  sub     = font->subfonts[i - 1];
+        FT_ULong     sub_upm = sub->font_dict.units_per_em;
+        FT_Pos       x_scale, y_scale;
+
+
+        if ( top_upm != sub_upm )
+        {
+          x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );
+          y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );
+        }
+        else
+        {
+          x_scale = size->metrics.x_scale;
+          y_scale = size->metrics.y_scale;
+        }
+
+        funcs->set_scale( internal->subfonts[i - 1],
+                          x_scale, y_scale, 0, 0 );
+      }
+    }
+
     return CFF_Err_Ok;
   }
 
     return CFF_Err_Ok;
   }
 
     funcs = cff_size_get_globals_funcs( cffsize );
 
     if ( funcs )
     funcs = cff_size_get_globals_funcs( cffsize );
 
     if ( funcs )
-      funcs->set_scale( (PSH_Globals)size->internal,
-                        size->metrics.x_scale,
-                        size->metrics.y_scale,
+    {
+      CFF_Face      cffface  = (CFF_Face)size->face;
+      CFF_Font      font     = (CFF_Font)cffface->extra.data;
+      CFF_Internal  internal = (CFF_Internal)size->internal;
+
+      FT_ULong  top_upm  = font->top_font.font_dict.units_per_em;
+      FT_UInt   i;
+
+
+      funcs->set_scale( internal->topfont,
+                        size->metrics.x_scale, size->metrics.y_scale,
                         0, 0 );
 
                         0, 0 );
 
+      for ( i = font->num_subfonts; i > 0; i-- )
+      {
+        CFF_SubFont  sub     = font->subfonts[i - 1];
+        FT_ULong     sub_upm = sub->font_dict.units_per_em;
+        FT_Pos       x_scale, y_scale;
+
+
+        if ( top_upm != sub_upm )
+        {
+          x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );
+          y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );
+        }
+        else
+        {
+          x_scale = size->metrics.x_scale;
+          y_scale = size->metrics.y_scale;
+        }
+
+        funcs->set_scale( internal->subfonts[i - 1],
+                          x_scale, y_scale, 0, 0 );
+      }
+    }
+
     return CFF_Err_Ok;
   }
 
     return CFF_Err_Ok;
   }
 
   cff_slot_init( FT_GlyphSlot  slot )
   {
     CFF_Face          face     = (CFF_Face)slot->face;
   cff_slot_init( FT_GlyphSlot  slot )
   {
     CFF_Face          face     = (CFF_Face)slot->face;
-    CFF_Font          font     = (CFF_FontRec *)face->extra.data;
+    CFF_Font          font     = (CFF_Font)face->extra.data;
     PSHinter_Service  pshinter = (PSHinter_Service)font->pshinter;
 
 
     PSHinter_Service  pshinter = (PSHinter_Service)font->pshinter;
 
 
       }
     }
 
       }
     }
 
-    return 0;
+    return CFF_Err_Ok;
   }
 
 
   }
 
 
     FT_String*  result;
 
 
     FT_String*  result;
 
 
-    result = ft_mem_strdup( memory, source, &error );
+    (void)FT_STRDUP( result, source );
+
+    FT_UNUSED( error );
 
     return result;
   }
 
     return result;
   }
     PSHinter_Service    pshinter;
     FT_Bool             pure_cff    = 1;
     FT_Bool             sfnt_format = 0;
     PSHinter_Service    pshinter;
     FT_Bool             pure_cff    = 1;
     FT_Bool             sfnt_format = 0;
+    FT_Library library = cffface->driver->root.library;
 
 
 #if 0
 
 
 #if 0
       goto Bad_Format;
 #else
     sfnt = (SFNT_Service)FT_Get_Module_Interface(
       goto Bad_Format;
 #else
     sfnt = (SFNT_Service)FT_Get_Module_Interface(
-             cffface->driver->root.library, "sfnt" );
+             library, "sfnt" );
     if ( !sfnt )
       goto Bad_Format;
 
     FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
 
     pshinter = (PSHinter_Service)FT_Get_Module_Interface(
     if ( !sfnt )
       goto Bad_Format;
 
     FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
 
     pshinter = (PSHinter_Service)FT_Get_Module_Interface(
-                 cffface->driver->root.library, "pshinter" );
+                 library, "pshinter" );
 #endif
 
     /* create input stream from resource */
 #endif
 
     /* create input stream from resource */
     error = sfnt->init_face( stream, face, face_index, num_params, params );
     if ( !error )
     {
     error = sfnt->init_face( stream, face, face_index, num_params, params );
     if ( !error )
     {
-      if ( face->format_tag != 0x4F54544FL )  /* `OTTO'; OpenType/CFF font */
+      if ( face->format_tag != TTAG_OTTO )  /* `OTTO'; OpenType/CFF font */
       {
         FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
         goto Bad_Format;
       {
         FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
         goto Bad_Format;
         pure_cff = 0;
 
         /* load font directory */
         pure_cff = 0;
 
         /* load font directory */
-        error = sfnt->load_face( stream, face,
-                                 face_index, num_params, params );
+        error = sfnt->load_face( stream, face, 0, num_params, params );
         if ( error )
           goto Exit;
       }
         if ( error )
           goto Exit;
       }
         goto Exit;
 
       face->extra.data = cff;
         goto Exit;
 
       face->extra.data = cff;
-      error = cff_font_load( stream, face_index, cff );
+      error = cff_font_load( library, stream, face_index, cff, pure_cff );
       if ( error )
         goto Exit;
 
       cff->pshinter = pshinter;
       cff->psnames  = (void*)psnames;
 
       if ( error )
         goto Exit;
 
       cff->pshinter = pshinter;
       cff->psnames  = (void*)psnames;
 
+      cffface->face_index = face_index;
+
       /* Complement the root flags with some interesting information. */
       /* Note that this is only necessary for pure CFF and CEF fonts; */
       /* SFNT based fonts use the `name' table instead.               */
       /* Complement the root flags with some interesting information. */
       /* Note that this is only necessary for pure CFF and CEF fonts; */
       /* SFNT based fonts use the `name' table instead.               */
       /* which aren't CID-keyed                               */
       if ( dict->cid_registry == 0xFFFFU && !psnames )
       {
       /* which aren't CID-keyed                               */
       if ( dict->cid_registry == 0xFFFFU && !psnames )
       {
-        FT_ERROR(( "cff_face_init:" ));
-        FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
-        FT_ERROR(( "              " ));
-        FT_ERROR(( " without the `PSNames' module\n" ));
+        FT_ERROR(( "cff_face_init:"
+                   " cannot open CFF & CEF fonts\n"
+                   "              "
+                   " without the `PSNames' module\n" ));
         goto Bad_Format;
       }
 
         goto Bad_Format;
       }
 
+      if ( !dict->units_per_em )
+        dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;
+
+      /* Normalize the font matrix so that `matrix->xx' is 1; the */
+      /* scaling is done with `units_per_em' then (at this point, */
+      /* it already contains the scaling factor, but without      */
+      /* normalization of the matrix).                            */
+      /*                                                          */
+      /* Note that the offsets must be expressed in integer font  */
+      /* units.                                                   */
+
+      {
+        FT_Matrix*  matrix = &dict->font_matrix;
+        FT_Vector*  offset = &dict->font_offset;
+        FT_ULong*   upm    = &dict->units_per_em;
+        FT_Fixed    temp   = FT_ABS( matrix->yy );
+
+
+        if ( temp != 0x10000L )
+        {
+          *upm = FT_DivFix( *upm, temp );
+
+          matrix->xx = FT_DivFix( matrix->xx, temp );
+          matrix->yx = FT_DivFix( matrix->yx, temp );
+          matrix->xy = FT_DivFix( matrix->xy, temp );
+          matrix->yy = FT_DivFix( matrix->yy, temp );
+          offset->x  = FT_DivFix( offset->x,  temp );
+          offset->y  = FT_DivFix( offset->y,  temp );
+        }
+
+        offset->x >>= 16;
+        offset->y >>= 16;
+      }
+
+      for ( i = cff->num_subfonts; i > 0; i-- )
+      {
+        CFF_FontRecDict  sub = &cff->subfonts[i - 1]->font_dict;
+        CFF_FontRecDict  top = &cff->top_font.font_dict;
+
+        FT_Matrix*  matrix;
+        FT_Vector*  offset;
+        FT_ULong*   upm;
+        FT_Fixed    temp;
+
+
+        if ( sub->units_per_em )
+        {
+          FT_Long  scaling;
+
+
+          if ( top->units_per_em > 1 && sub->units_per_em > 1 )
+            scaling = FT_MIN( top->units_per_em, sub->units_per_em );
+          else
+            scaling = 1;
+
+          FT_Matrix_Multiply_Scaled( &top->font_matrix,
+                                     &sub->font_matrix,
+                                     scaling );
+          FT_Vector_Transform_Scaled( &sub->font_offset,
+                                      &top->font_matrix,
+                                      scaling );
+
+          sub->units_per_em = FT_MulDiv( sub->units_per_em,
+                                         top->units_per_em,
+                                         scaling );
+        }
+        else
+        {
+          sub->font_matrix = top->font_matrix;
+          sub->font_offset = top->font_offset;
+
+          sub->units_per_em = top->units_per_em;
+        }
+
+        matrix = &sub->font_matrix;
+        offset = &sub->font_offset;
+        upm    = &sub->units_per_em;
+        temp   = FT_ABS( matrix->yy );
+
+        if ( temp != 0x10000L )
+        {
+          *upm = FT_DivFix( *upm, temp );
+
+          /* if *upm is larger than 100*1000 we divide by 1000 --     */
+          /* this can happen if e.g. there is no top-font FontMatrix  */
+          /* and the subfont FontMatrix already contains the complete */
+          /* scaling for the subfont (see section 5.11 of the PLRM)   */
+
+          /* 100 is a heuristic value */
+
+          if ( *upm > 100L * 1000L )
+            *upm = ( *upm + 500 ) / 1000;
+
+          matrix->xx = FT_DivFix( matrix->xx, temp );
+          matrix->yx = FT_DivFix( matrix->yx, temp );
+          matrix->xy = FT_DivFix( matrix->xy, temp );
+          matrix->yy = FT_DivFix( matrix->yy, temp );
+          offset->x  = FT_DivFix( offset->x,  temp );
+          offset->y  = FT_DivFix( offset->y,  temp );
+        }
+
+        offset->x >>= 16;
+        offset->y >>= 16;
+      }
+
       if ( pure_cff )
       {
         char*  style_name = NULL;
       if ( pure_cff )
       {
         char*  style_name = NULL;
 
         /* compute number of glyphs */
         if ( dict->cid_registry != 0xFFFFU )
 
         /* compute number of glyphs */
         if ( dict->cid_registry != 0xFFFFU )
-          cffface->num_glyphs = dict->cid_count;
+          cffface->num_glyphs = cff->charset.max_cid;
         else
           cffface->num_glyphs = cff->charstrings_index.count;
 
         else
           cffface->num_glyphs = cff->charstrings_index.count;
 
         cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
         cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
 
         cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
         cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
 
-        if ( !dict->units_per_em )
-          dict->units_per_em = 1000;
-
-        cffface->units_per_EM = dict->units_per_em;
+        cffface->units_per_EM = (FT_UShort)( dict->units_per_em );
 
         cffface->ascender  = (FT_Short)( cffface->bbox.yMax );
         cffface->descender = (FT_Short)( cffface->bbox.yMin );
 
         cffface->ascender  = (FT_Short)( cffface->bbox.yMax );
         cffface->descender = (FT_Short)( cffface->bbox.yMin );
         /*                                                                 */
         /* Compute face flags.                                             */
         /*                                                                 */
         /*                                                                 */
         /* Compute face flags.                                             */
         /*                                                                 */
-        flags = FT_FACE_FLAG_SCALABLE   |       /* scalable outlines */
-                FT_FACE_FLAG_HORIZONTAL |       /* horizontal data   */
-                FT_FACE_FLAG_HINTER;            /* has native hinter */
+        flags = (FT_UInt32)( FT_FACE_FLAG_SCALABLE   | /* scalable outlines */
+                             FT_FACE_FLAG_HORIZONTAL | /* horizontal data   */
+                             FT_FACE_FLAG_HINTER );    /* has native hinter */
 
         if ( sfnt_format )
 
         if ( sfnt_format )
-          flags |= FT_FACE_FLAG_SFNT;
+          flags |= (FT_UInt32)FT_FACE_FLAG_SFNT;
 
         /* fixed width font? */
         if ( dict->is_fixed_pitch )
 
         /* fixed width font? */
         if ( dict->is_fixed_pitch )
-          flags |= FT_FACE_FLAG_FIXED_WIDTH;
+          flags |= (FT_UInt32)FT_FACE_FLAG_FIXED_WIDTH;
 
   /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
 #if 0
         /* kerning available? */
         if ( face->kern_pairs )
 
   /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
 #if 0
         /* kerning available? */
         if ( face->kern_pairs )
-          flags |= FT_FACE_FLAG_KERNING;
+          flags |= (FT_UInt32)FT_FACE_FLAG_KERNING;
 #endif
 
         cffface->face_flags = flags;
 #endif
 
         cffface->face_flags = flags;
 
         cffface->style_flags = flags;
       }
 
         cffface->style_flags = flags;
       }
-      else
-      {
-        if ( !dict->units_per_em )
-          dict->units_per_em = face->root.units_per_EM;
-      }
-
-      /* handle font matrix settings in subfonts (if any) */
-      for ( i = cff->num_subfonts; i > 0; i-- )
-      {
-        CFF_FontRecDict  sub = &cff->subfonts[i - 1]->font_dict;
-        CFF_FontRecDict  top = &cff->top_font.font_dict;
 
 
 
 
-        if ( sub->units_per_em )
-        {
-          FT_Matrix  scale;
-
-
-          scale.xx = scale.yy = (FT_Fixed)FT_DivFix( top->units_per_em,
-                                                     sub->units_per_em );
-          scale.xy = scale.yx = 0;
-
-          FT_Matrix_Multiply( &scale, &sub->font_matrix );
-          FT_Vector_Transform( &sub->font_offset, &scale );
-        }
-        else
-        {
-          sub->font_matrix = top->font_matrix;
-          sub->font_offset = top->font_offset;
-        }
-      }
-
 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
       /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
 #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           */
+      /* has unset this flag because of the 3.0 `post' table.          */
       if ( dict->cid_registry == 0xFFFFU )
         cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
 #endif
 
       if ( dict->cid_registry == 0xFFFFU )
         cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
 #endif
 
+      if ( dict->cid_registry != 0xFFFFU && pure_cff )
+        cffface->face_flags |= FT_FACE_FLAG_CID_KEYED;
+
+
       /*******************************************************************/
       /*                                                                 */
       /* Compute char maps.                                              */
       /*                                                                 */
 
       /*******************************************************************/
       /*                                                                 */
       /* Compute char maps.                                              */
       /*                                                                 */
 
-      /* Try to synthetize a Unicode charmap if there is none available */
+      /* Try to synthesize a Unicode charmap if there is none available */
       /* already.  If an OpenType font contains a Unicode "cmap", we    */
       /* will use it, whatever be in the CFF part of the file.          */
       {
       /* already.  If an OpenType font contains a Unicode "cmap", we    */
       /* will use it, whatever be in the CFF part of the file.          */
       {
         if ( pure_cff && cff->top_font.font_dict.cid_registry != 0xFFFFU )
           goto Exit;
 
         if ( pure_cff && cff->top_font.font_dict.cid_registry != 0xFFFFU )
           goto Exit;
 
-        /* we didn't find a Unicode charmap -- synthetize one */
+        /* we didn't find a Unicode charmap -- synthesize one */
         cmaprec.face        = cffface;
         cmaprec.platform_id = 3;
         cmaprec.encoding_id = 1;
         cmaprec.face        = cffface;
         cmaprec.platform_id = 3;
         cmaprec.encoding_id = 1;
 
         nn = (FT_UInt)cffface->num_charmaps;
 
 
         nn = (FT_UInt)cffface->num_charmaps;
 
-        FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL );
+        FT_CMap_New( &FT_CFF_CMAP_UNICODE_CLASS_REC_GET, NULL, &cmaprec, NULL );
 
         /* if no Unicode charmap was previously selected, select this one */
         if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps )
 
         /* if no Unicode charmap was previously selected, select this one */
         if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps )
           {
             cmaprec.encoding_id = TT_ADOBE_ID_STANDARD;
             cmaprec.encoding    = FT_ENCODING_ADOBE_STANDARD;
           {
             cmaprec.encoding_id = TT_ADOBE_ID_STANDARD;
             cmaprec.encoding    = FT_ENCODING_ADOBE_STANDARD;
-            clazz               = &cff_cmap_encoding_class_rec;
+            clazz               = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET;
           }
           else if ( encoding->offset == 1 )
           {
             cmaprec.encoding_id = TT_ADOBE_ID_EXPERT;
             cmaprec.encoding    = FT_ENCODING_ADOBE_EXPERT;
           }
           else if ( encoding->offset == 1 )
           {
             cmaprec.encoding_id = TT_ADOBE_ID_EXPERT;
             cmaprec.encoding    = FT_ENCODING_ADOBE_EXPERT;
-            clazz               = &cff_cmap_encoding_class_rec;
+            clazz               = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET;
           }
           else
           {
             cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM;
             cmaprec.encoding    = FT_ENCODING_ADOBE_CUSTOM;
           }
           else
           {
             cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM;
             cmaprec.encoding    = FT_ENCODING_ADOBE_CUSTOM;
-            clazz               = &cff_cmap_encoding_class_rec;
+            clazz               = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET;
           }
 
           FT_CMap_New( clazz, NULL, &cmaprec, NULL );
           }
 
           FT_CMap_New( clazz, NULL, &cmaprec, NULL );
   FT_LOCAL_DEF( void )
   cff_face_done( FT_Face  cffface )         /* CFF_Face */
   {
   FT_LOCAL_DEF( void )
   cff_face_done( FT_Face  cffface )         /* CFF_Face */
   {
-    CFF_Face      face   = (CFF_Face)cffface;
-    FT_Memory     memory = cffface->memory;
-    SFNT_Service  sfnt   = (SFNT_Service)face->sfnt;
+    CFF_Face      face = (CFF_Face)cffface;
+    FT_Memory     memory;
+    SFNT_Service  sfnt;
+
+
+    if ( !face )
+      return;
 
 
+    memory = cffface->memory;
+    sfnt   = (SFNT_Service)face->sfnt;
 
     if ( sfnt )
       sfnt->done_face( face );
 
     if ( sfnt )
       sfnt->done_face( face );
index f18b5d9..3c81cee 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType objects manager (specification).                            */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType objects manager (specification).                            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -25,6 +25,7 @@
 #include "cfftypes.h"
 #include FT_INTERNAL_TRUETYPE_TYPES_H
 #include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include "cfftypes.h"
 #include FT_INTERNAL_TRUETYPE_TYPES_H
 #include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
 
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
@@ -53,8 +54,8 @@ FT_BEGIN_HEADER
   /*                                                                       */
   typedef struct  CFF_SizeRec_
   {
   /*                                                                       */
   typedef struct  CFF_SizeRec_
   {
-    FT_SizeRec       root;
-    FT_ULong         strike_index;    /* 0xFFFFFFFF to indicate invalid */
+    FT_SizeRec  root;
+    FT_ULong    strike_index;    /* 0xFFFFFFFF to indicate invalid */
 
   } CFF_SizeRec, *CFF_Size;
 
 
   } CFF_SizeRec, *CFF_Size;
 
@@ -80,6 +81,21 @@ FT_BEGIN_HEADER
   } CFF_GlyphSlotRec, *CFF_GlyphSlot;
 
 
   } CFF_GlyphSlotRec, *CFF_GlyphSlot;
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    CFF_Internal                                                       */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The interface to the `internal' field of `FT_Size'.                */
+  /*                                                                       */
+  typedef struct  CFF_InternalRec_
+  {
+    PSH_Globals  topfont;
+    PSH_Globals  subfonts[CFF_MAX_CID_FONTS];
+
+  } CFF_InternalRec, *CFF_Internal;
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
index 41af6a3..947ec9d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CFF token stream parser (body)                                       */
 /*                                                                         */
 /*                                                                         */
 /*    CFF token stream parser (body)                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2007 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #include <ft2build.h>
 #include "cffparse.h"
 #include FT_INTERNAL_STREAM_H
 #include <ft2build.h>
 #include "cffparse.h"
 #include FT_INTERNAL_STREAM_H
+#include FT_INTERNAL_DEBUG_H
 
 #include "cfferrs.h"
 
 #include "cfferrs.h"
+#include "cffpic.h"
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
 #define FT_COMPONENT  trace_cffparse
 
 
 #define FT_COMPONENT  trace_cffparse
 
 
-  enum
-  {
-    cff_kind_none = 0,
-    cff_kind_num,
-    cff_kind_fixed,
-    cff_kind_fixed_thousand,
-    cff_kind_string,
-    cff_kind_bool,
-    cff_kind_delta,
-    cff_kind_callback,
-
-    cff_kind_max  /* do not remove */
-  };
-
-
-  /* now generate handlers for the most simple fields */
-  typedef FT_Error  (*CFF_Field_Reader)( CFF_Parser  parser );
-
-  typedef struct  CFF_Field_Handler_
-  {
-    int               kind;
-    int               code;
-    FT_UInt           offset;
-    FT_Byte           size;
-    CFF_Field_Reader  reader;
-    FT_UInt           array_max;
-    FT_UInt           count_offset;
-
-  } CFF_Field_Handler;
 
 
   FT_LOCAL_DEF( void )
   cff_parser_init( CFF_Parser  parser,
                    FT_UInt     code,
 
 
   FT_LOCAL_DEF( void )
   cff_parser_init( CFF_Parser  parser,
                    FT_UInt     code,
-                   void*       object )
+                   void*       object,
+                   FT_Library  library)
   {
     FT_MEM_ZERO( parser, sizeof ( *parser ) );
 
     parser->top         = parser->stack;
     parser->object_code = code;
     parser->object      = object;
   {
     FT_MEM_ZERO( parser, sizeof ( *parser ) );
 
     parser->top         = parser->stack;
     parser->object_code = code;
     parser->object      = object;
+    parser->library     = library;
   }
 
 
   }
 
 
   }
 
 
   }
 
 
+  static const FT_Long power_tens[] =
+  {
+    1L,
+    10L,
+    100L,
+    1000L,
+    10000L,
+    100000L,
+    1000000L,
+    10000000L,
+    100000000L,
+    1000000000L
+  };
+
+
   /* read a real */
   static FT_Fixed
   cff_parse_real( FT_Byte*  start,
                   FT_Byte*  limit,
   /* read a real */
   static FT_Fixed
   cff_parse_real( FT_Byte*  start,
                   FT_Byte*  limit,
-                  FT_Int    power_ten )
+                  FT_Long   power_ten,
+                  FT_Long*  scaling )
   {
   {
-    FT_Byte*  p    = start;
-    FT_Long   num, divider, result, exponent;
-    FT_Int    sign = 0, exponent_sign = 0;
+    FT_Byte*  p = start;
     FT_UInt   nib;
     FT_UInt   phase;
 
     FT_UInt   nib;
     FT_UInt   phase;
 
+    FT_Long   result, number, rest, exponent;
+    FT_Int    sign = 0, exponent_sign = 0;
+    FT_Long   exponent_add, integer_length, fraction_length;
+
+
+    if ( scaling )
+      *scaling  = 0;
+
+    result = 0;
+
+    number   = 0;
+    rest     = 0;
+    exponent = 0;
 
 
-    result  = 0;
-    num     = 0;
-    divider = 1;
+    exponent_add    = 0;
+    integer_length  = 0;
+    fraction_length = 0;
 
 
-    /* first of all, read the integer part */
+    FT_UNUSED( rest );
+
+    /* First of all, read the integer part. */
     phase = 4;
 
     for (;;)
     phase = 4;
 
     for (;;)
 
         /* Make sure we don't read past the end. */
         if ( p >= limit )
 
         /* Make sure we don't read past the end. */
         if ( p >= limit )
-          goto Bad;
+          goto Exit;
       }
 
       /* Get the nibble. */
       }
 
       /* Get the nibble. */
       else if ( nib > 9 )
         break;
       else
       else if ( nib > 9 )
         break;
       else
-        result = result * 10 + nib;
+      {
+        /* Increase exponent if we can't add the digit. */
+        if ( number >= 0xCCCCCCCL )
+          exponent_add++;
+        /* Skip leading zeros. */
+        else if ( nib || number )
+        {
+          integer_length++;
+          number = number * 10 + nib;
+        }
+      }
     }
 
     }
 
-    /* read decimal part, if any */
+    /* Read fraction part, if any. */
     if ( nib == 0xa )
       for (;;)
       {
     if ( nib == 0xa )
       for (;;)
       {
 
           /* Make sure we don't read past the end. */
           if ( p >= limit )
 
           /* Make sure we don't read past the end. */
           if ( p >= limit )
-            goto Bad;
+            goto Exit;
         }
 
         /* Get the nibble. */
         }
 
         /* Get the nibble. */
         if ( nib >= 10 )
           break;
 
         if ( nib >= 10 )
           break;
 
-        if ( divider < 10000000L )
+        /* Skip leading zeros if possible. */
+        if ( !nib && !number )
+          exponent_add--;
+        /* Only add digit if we don't overflow. */
+        else if ( number < 0xCCCCCCCL && fraction_length < 9 )
         {
         {
-          num      = num * 10 + nib;
-          divider *= 10;
+          fraction_length++;
+          number = number * 10 + nib;
         }
       }
 
         }
       }
 
-    /* read exponent, if any */
+    /* Read exponent, if any. */
     if ( nib == 12 )
     {
       exponent_sign = 1;
     if ( nib == 12 )
     {
       exponent_sign = 1;
 
     if ( nib == 11 )
     {
 
     if ( nib == 11 )
     {
-      exponent = 0;
-
       for (;;)
       {
       for (;;)
       {
-        /* If we entered this iteration with phase == 4, we need */
-        /* to read a new byte.                                   */
+        /* If we entered this iteration with phase == 4, */
+        /* we need to read a new byte.                   */
         if ( phase )
         {
           p++;
 
           /* Make sure we don't read past the end. */
           if ( p >= limit )
         if ( phase )
         {
           p++;
 
           /* Make sure we don't read past the end. */
           if ( p >= limit )
-            goto Bad;
+            goto Exit;
         }
 
         /* Get the nibble. */
         }
 
         /* Get the nibble. */
           break;
 
         exponent = exponent * 10 + nib;
           break;
 
         exponent = exponent * 10 + nib;
+
+        /* Arbitrarily limit exponent. */
+        if ( exponent > 1000 )
+          goto Exit;
       }
 
       if ( exponent_sign )
         exponent = -exponent;
       }
 
       if ( exponent_sign )
         exponent = -exponent;
-
-      power_ten += (FT_Int)exponent;
     }
 
     }
 
-    /* raise to power of ten if needed */
-    while ( power_ten > 0 )
+    /* We don't check `power_ten' and `exponent_add'. */
+    exponent += power_ten + exponent_add;
+
+    if ( scaling )
     {
     {
-      result = result * 10;
-      num    = num * 10;
+      /* Only use `fraction_length'. */
+      fraction_length += integer_length;
+      exponent        += integer_length;
 
 
-      power_ten--;
-    }
+      if ( fraction_length <= 5 )
+      {
+        if ( number > 0x7FFFL )
+        {
+          result   = FT_DivFix( number, 10 );
+          *scaling = exponent - fraction_length + 1;
+        }
+        else
+        {
+          if ( exponent > 0 )
+          {
+            FT_Long  new_fraction_length, shift;
 
 
-    while ( power_ten < 0 )
-    {
-      result  = result / 10;
-      divider = divider * 10;
 
 
-      power_ten++;
+            /* Make `scaling' as small as possible. */
+            new_fraction_length = FT_MIN( exponent, 5 );
+            exponent           -= new_fraction_length;
+            shift               = new_fraction_length - fraction_length;
+
+            number *= power_tens[shift];
+            if ( number > 0x7FFFL )
+            {
+              number   /= 10;
+              exponent += 1;
+            }
+          }
+          else
+            exponent -= fraction_length;
+
+          result   = number << 16;
+          *scaling = exponent;
+        }
+      }
+      else
+      {
+        if ( ( number / power_tens[fraction_length - 5] ) > 0x7FFFL )
+        {
+          result   = FT_DivFix( number, power_tens[fraction_length - 4] );
+          *scaling = exponent - 4;
+        }
+        else
+        {
+          result   = FT_DivFix( number, power_tens[fraction_length - 5] );
+          *scaling = exponent - 5;
+        }
+      }
     }
     }
+    else
+    {
+      integer_length  += exponent;
+      fraction_length -= exponent;
+
+      /* Check for overflow and underflow. */
+      if ( FT_ABS( integer_length ) > 5 )
+        goto Exit;
+
+      /* Remove non-significant digits. */
+      if ( integer_length < 0 ) {
+        number          /= power_tens[-integer_length];
+        fraction_length += integer_length;
+      }
+
+      /* Convert into 16.16 format. */
+      if ( fraction_length > 0 )
+      {
+        if ( ( number / power_tens[fraction_length] ) > 0x7FFFL )
+          goto Exit;
+
+        result = FT_DivFix( number, power_tens[fraction_length] );
+      }
+      else
+      {
+        number *= power_tens[-fraction_length];
 
 
-    /* Move the integer part into the high 16 bits. */
-    result <<= 16;
+        if ( number > 0x7FFFL )
+          goto Exit;
 
 
-    /* Place the decimal part into the low 16 bits. */
-    if ( num )
-      result |= FT_DivFix( num, divider );
+        result = number << 16;
+      }
+    }
 
     if ( sign )
       result = -result;
 
   Exit:
     return result;
 
     if ( sign )
       result = -result;
 
   Exit:
     return result;
-
-  Bad:
-    result = 0;
-    goto Exit;
   }
 
 
   }
 
 
   static FT_Long
   cff_parse_num( FT_Byte**  d )
   {
   static FT_Long
   cff_parse_num( FT_Byte**  d )
   {
-    return ( **d == 30 ? ( cff_parse_real   ( d[0], d[1], 0 ) >> 16 )
-                       :   cff_parse_integer( d[0], d[1] ) );
+    return **d == 30 ? ( cff_parse_real( d[0], d[1], 0, NULL ) >> 16 )
+                     :   cff_parse_integer( d[0], d[1] );
   }
 
 
   }
 
 
   static FT_Fixed
   cff_parse_fixed( FT_Byte**  d )
   {
   static FT_Fixed
   cff_parse_fixed( FT_Byte**  d )
   {
-    return ( **d == 30 ? cff_parse_real   ( d[0], d[1], 0 )
-                       : cff_parse_integer( d[0], d[1] ) << 16 );
+    return **d == 30 ? cff_parse_real( d[0], d[1], 0, NULL )
+                     : cff_parse_integer( d[0], d[1] ) << 16;
   }
 
   }
 
+
   /* read a floating point number, either integer or real, */
   /* read a floating point number, either integer or real, */
-  /* but return 1000 times the number read in.             */
+  /* but return `10^scaling' times the number read in      */
+  static FT_Fixed
+  cff_parse_fixed_scaled( FT_Byte**  d,
+                          FT_Long    scaling )
+  {
+    return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
+                     : ( cff_parse_integer( d[0], d[1] ) *
+                           power_tens[scaling] ) << 16;
+  }
+
+
+  /* read a floating point number, either integer or real,     */
+  /* and return it as precise as possible -- `scaling' returns */
+  /* the scaling factor (as a power of 10)                     */
   static FT_Fixed
   static FT_Fixed
-  cff_parse_fixed_thousand( FT_Byte**  d )
+  cff_parse_fixed_dynamic( FT_Byte**  d,
+                           FT_Long*   scaling )
   {
   {
-    return **d ==
-      30 ? cff_parse_real     ( d[0], d[1], 3 )
-         : (FT_Fixed)FT_MulFix( cff_parse_integer( d[0], d[1] ) << 16, 1000 );
+    FT_ASSERT( scaling );
+
+    if ( **d == 30 )
+      return cff_parse_real( d[0], d[1], 0, scaling );
+    else
+    {
+      FT_Long  number;
+      FT_Int   integer_length;
+
+
+      number = cff_parse_integer( d[0], d[1] );
+
+      if ( number > 0x7FFFL )
+      {
+        for ( integer_length = 5; integer_length < 10; integer_length++ )
+          if ( number < power_tens[integer_length] )
+            break;
+
+        if ( ( number / power_tens[integer_length - 5] ) > 0x7FFFL )
+        {
+          *scaling = integer_length - 4;
+          return FT_DivFix( number, power_tens[integer_length - 4] );
+        }
+        else
+        {
+          *scaling = integer_length - 5;
+          return FT_DivFix( number, power_tens[integer_length - 5] );
+        }
+      }
+      else
+      {
+        *scaling = 0;
+        return number << 16;
+      }
+    }
   }
 
   }
 
+
   static FT_Error
   cff_parse_font_matrix( CFF_Parser  parser )
   {
     CFF_FontRecDict  dict   = (CFF_FontRecDict)parser->object;
     FT_Matrix*       matrix = &dict->font_matrix;
     FT_Vector*       offset = &dict->font_offset;
   static FT_Error
   cff_parse_font_matrix( CFF_Parser  parser )
   {
     CFF_FontRecDict  dict   = (CFF_FontRecDict)parser->object;
     FT_Matrix*       matrix = &dict->font_matrix;
     FT_Vector*       offset = &dict->font_offset;
-    FT_UShort*       upm    = &dict->units_per_em;
+    FT_ULong*        upm    = &dict->units_per_em;
     FT_Byte**        data   = parser->stack;
     FT_Byte**        data   = parser->stack;
-    FT_Error         error;
-    FT_Fixed         temp;
+    FT_Error         error  = CFF_Err_Stack_Underflow;
 
 
 
 
-    error = CFF_Err_Stack_Underflow;
-
     if ( parser->top >= parser->stack + 6 )
     {
     if ( parser->top >= parser->stack + 6 )
     {
-      matrix->xx = cff_parse_fixed_thousand( data++ );
-      matrix->yx = cff_parse_fixed_thousand( data++ );
-      matrix->xy = cff_parse_fixed_thousand( data++ );
-      matrix->yy = cff_parse_fixed_thousand( data++ );
-      offset->x  = cff_parse_fixed_thousand( data++ );
-      offset->y  = cff_parse_fixed_thousand( data   );
+      FT_Long  scaling;
 
 
-      temp = FT_ABS( matrix->yy );
 
 
-      *upm = (FT_UShort)FT_DivFix( 0x10000L, FT_DivFix( temp, 1000 ) );
+      error = CFF_Err_Ok;
+
+      /* We expect a well-formed font matrix, this is, the matrix elements */
+      /* `xx' and `yy' are of approximately the same magnitude.  To avoid  */
+      /* loss of precision, we use the magnitude of element `xx' to scale  */
+      /* all other elements.  The scaling factor is then contained in the  */
+      /* `units_per_em' value.                                             */
 
 
-      if ( temp != 0x10000L )
+      matrix->xx = cff_parse_fixed_dynamic( data++, &scaling );
+
+      scaling = -scaling;
+
+      if ( scaling < 0 || scaling > 9 )
       {
       {
-        matrix->xx = FT_DivFix( matrix->xx, temp );
-        matrix->yx = FT_DivFix( matrix->yx, temp );
-        matrix->xy = FT_DivFix( matrix->xy, temp );
-        matrix->yy = FT_DivFix( matrix->yy, temp );
-        offset->x  = FT_DivFix( offset->x,  temp );
-        offset->y  = FT_DivFix( offset->y,  temp );
+        /* Return default matrix in case of unlikely values. */
+        matrix->xx = 0x10000L;
+        matrix->yx = 0;
+        matrix->yx = 0;
+        matrix->yy = 0x10000L;
+        offset->x  = 0;
+        offset->y  = 0;
+        *upm       = 1;
+
+        goto Exit;
       }
 
       }
 
-      /* note that the offsets must be expressed in integer font units */
-      offset->x >>= 16;
-      offset->y >>= 16;
+      matrix->yx = cff_parse_fixed_scaled( data++, scaling );
+      matrix->xy = cff_parse_fixed_scaled( data++, scaling );
+      matrix->yy = cff_parse_fixed_scaled( data++, scaling );
+      offset->x  = cff_parse_fixed_scaled( data++, scaling );
+      offset->y  = cff_parse_fixed_scaled( data,   scaling );
 
 
-      error = CFF_Err_Ok;
+      *upm = power_tens[scaling];
     }
 
     }
 
+  Exit:
     return error;
   }
 
     return error;
   }
 
     {
       dict->cid_registry   = (FT_UInt)cff_parse_num ( data++ );
       dict->cid_ordering   = (FT_UInt)cff_parse_num ( data++ );
     {
       dict->cid_registry   = (FT_UInt)cff_parse_num ( data++ );
       dict->cid_ordering   = (FT_UInt)cff_parse_num ( data++ );
-      dict->cid_supplement = (FT_ULong)cff_parse_num( data );
+      if ( **data == 30 )
+        FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
+      dict->cid_supplement = cff_parse_num( data );
+      if ( dict->cid_supplement < 0 )
+        FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
+                   dict->cid_supplement ));
       error = CFF_Err_Ok;
     }
 
       error = CFF_Err_Ok;
     }
 
 #define CFF_FIELD_DELTA( code, name, max ) \
           CFF_FIELD( code, name, cff_kind_delta )
 
 #define CFF_FIELD_DELTA( code, name, max ) \
           CFF_FIELD( code, name, cff_kind_delta )
 
+#define CFFCODE_TOPDICT  0x1000
+#define CFFCODE_PRIVATE  0x2000
+
+#ifndef FT_CONFIG_OPTION_PIC
+
 #define CFF_FIELD_CALLBACK( code, name ) \
           {                              \
             cff_kind_callback,           \
 #define CFF_FIELD_CALLBACK( code, name ) \
           {                              \
             cff_kind_callback,           \
           FT_FIELD_OFFSET( num_ ## name )  \
         },
 
           FT_FIELD_OFFSET( num_ ## name )  \
         },
 
-#define CFFCODE_TOPDICT  0x1000
-#define CFFCODE_PRIVATE  0x2000
-
   static const CFF_Field_Handler  cff_field_handlers[] =
   {
 
   static const CFF_Field_Handler  cff_field_handlers[] =
   {
 
   };
 
 
   };
 
 
+#else /* FT_CONFIG_OPTION_PIC */
+
+  void FT_Destroy_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler* clazz)
+  {
+    FT_Memory memory = library->memory;
+    if ( clazz )
+      FT_FREE( clazz );
+  }
+
+  FT_Error FT_Create_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler** output_class)
+  {
+    CFF_Field_Handler*  clazz;
+    FT_Error          error;
+    FT_Memory memory = library->memory;
+    int i=0;
+
+#undef CFF_FIELD
+#undef CFF_FIELD_DELTA
+#undef CFF_FIELD_CALLBACK
+#define CFF_FIELD_CALLBACK( code, name ) i++;
+#define CFF_FIELD( code, name, kind ) i++;
+#define CFF_FIELD_DELTA( code, name, max ) i++;
+
+#include "cfftoken.h"
+    i++;/*{ 0, 0, 0, 0, 0, 0, 0 }*/
+
+    if ( FT_ALLOC( clazz, sizeof(CFF_Field_Handler)*i ) )
+      return error;
+
+    i=0;
+#undef CFF_FIELD
+#undef CFF_FIELD_DELTA
+#undef CFF_FIELD_CALLBACK
+
+#define CFF_FIELD_CALLBACK( code_, name_ )                                   \
+    clazz[i].kind = cff_kind_callback;                                       \
+    clazz[i].code = code_ | CFFCODE;                                         \
+    clazz[i].offset = 0;                                                     \
+    clazz[i].size = 0;                                                       \
+    clazz[i].reader = cff_parse_ ## name_;                                   \
+    clazz[i].array_max = 0;                                                  \
+    clazz[i].count_offset = 0;                                               \
+    i++;
+
+#undef  CFF_FIELD
+#define CFF_FIELD( code_, name_, kind_ )                                     \
+    clazz[i].kind = kind_;                                                   \
+    clazz[i].code = code_ | CFFCODE;                                         \
+    clazz[i].offset = FT_FIELD_OFFSET( name_ );                              \
+    clazz[i].size = FT_FIELD_SIZE( name_ );                                  \
+    clazz[i].reader = 0;                                                     \
+    clazz[i].array_max = 0;                                                  \
+    clazz[i].count_offset = 0;                                               \
+    i++;                                                                     \
+
+#undef  CFF_FIELD_DELTA
+#define CFF_FIELD_DELTA( code_, name_, max_ )                                \
+    clazz[i].kind = cff_kind_delta;                                          \
+    clazz[i].code = code_ | CFFCODE;                                         \
+    clazz[i].offset = FT_FIELD_OFFSET( name_ );                              \
+    clazz[i].size = FT_FIELD_SIZE_DELTA( name_ );                            \
+    clazz[i].reader = 0;                                                     \
+    clazz[i].array_max = max_;                                               \
+    clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ );                \
+    i++;
+
+#include "cfftoken.h"
+
+    clazz[i].kind = 0;
+    clazz[i].code = 0;
+    clazz[i].offset = 0;
+    clazz[i].size = 0;
+    clazz[i].reader = 0;
+    clazz[i].array_max = 0;
+    clazz[i].count_offset = 0;
+
+    *output_class = clazz;
+    return FT_Err_Ok;
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
   FT_LOCAL_DEF( FT_Error )
   cff_parser_run( CFF_Parser  parser,
                   FT_Byte*    start,
                   FT_Byte*    limit )
   {
   FT_LOCAL_DEF( FT_Error )
   cff_parser_run( CFF_Parser  parser,
                   FT_Byte*    start,
                   FT_Byte*    limit )
   {
-    FT_Byte*  p     = start;
-    FT_Error  error = CFF_Err_Ok;
+    FT_Byte*    p       = start;
+    FT_Error    error   = CFF_Err_Ok;
+    FT_Library  library = parser->library;
+    FT_UNUSED(library);
 
 
     parser->top    = parser->stack;
 
 
     parser->top    = parser->stack;
         }
         code = code | parser->object_code;
 
         }
         code = code | parser->object_code;
 
-        for ( field = cff_field_handlers; field->kind; field++ )
+        for ( field = FT_CFF_FIELD_HANDLERS_GET; field->kind; field++ )
         {
           if ( field->code == (FT_Int)code )
           {
         {
           if ( field->code == (FT_Int)code )
           {
               goto Store_Number;
 
             case cff_kind_fixed_thousand:
               goto Store_Number;
 
             case cff_kind_fixed_thousand:
-              val = cff_parse_fixed_thousand( parser->stack );
+              val = cff_parse_fixed_scaled( parser->stack, 3 );
 
             Store_Number:
               switch ( field->size )
 
             Store_Number:
               switch ( field->size )
index 8f3fa58..7e2c00a 100644 (file)
@@ -36,6 +36,7 @@ FT_BEGIN_HEADER
 
   typedef struct  CFF_ParserRec_
   {
 
   typedef struct  CFF_ParserRec_
   {
+    FT_Library library;
     FT_Byte*   start;
     FT_Byte*   limit;
     FT_Byte*   cursor;
     FT_Byte*   start;
     FT_Byte*   limit;
     FT_Byte*   cursor;
@@ -52,7 +53,8 @@ FT_BEGIN_HEADER
   FT_LOCAL( void )
   cff_parser_init( CFF_Parser  parser,
                    FT_UInt     code,
   FT_LOCAL( void )
   cff_parser_init( CFF_Parser  parser,
                    FT_UInt     code,
-                   void*       object );
+                   void*       object,
+                   FT_Library  library);
 
   FT_LOCAL( FT_Error )
   cff_parser_run( CFF_Parser  parser,
 
   FT_LOCAL( FT_Error )
   cff_parser_run( CFF_Parser  parser,
@@ -60,6 +62,37 @@ FT_BEGIN_HEADER
                   FT_Byte*    limit );
 
 
                   FT_Byte*    limit );
 
 
+  enum
+  {
+    cff_kind_none = 0,
+    cff_kind_num,
+    cff_kind_fixed,
+    cff_kind_fixed_thousand,
+    cff_kind_string,
+    cff_kind_bool,
+    cff_kind_delta,
+    cff_kind_callback,
+
+    cff_kind_max  /* do not remove */
+  };
+
+
+  /* now generate handlers for the most simple fields */
+  typedef FT_Error  (*CFF_Field_Reader)( CFF_Parser  parser );
+
+  typedef struct  CFF_Field_Handler_
+  {
+    int               kind;
+    int               code;
+    FT_UInt           offset;
+    FT_Byte           size;
+    CFF_Field_Reader  reader;
+    FT_UInt           array_max;
+    FT_UInt           count_offset;
+
+  } CFF_Field_Handler;
+
+
 FT_END_HEADER
 
 
 FT_END_HEADER
 
 
diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffpic.c b/reactos/lib/3rdparty/freetype/src/cff/cffpic.c
new file mode 100644 (file)
index 0000000..568956d
--- /dev/null
@@ -0,0 +1,99 @@
+/***************************************************************************/
+/*                                                                         */
+/*  cffpic.c                                                               */
+/*                                                                         */
+/*    The FreeType position independent code services for cff module.      */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "cffpic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from cffdrivr.c */
+  FT_Error FT_Create_Class_cff_services( FT_Library, FT_ServiceDescRec**);
+  void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*);
+  void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*);
+  void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*);
+  void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*);
+  void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*);
+  void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*);
+
+  /* forward declaration of PIC init functions from cffparse.c */
+  FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**);
+  void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*);
+
+  /* forward declaration of PIC init functions from cffcmap.c */
+  void FT_Init_Class_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*);
+  void FT_Init_Class_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*);
+
+  void
+  cff_driver_class_pic_free(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory memory = library->memory;
+    if ( pic_container->cff )
+    {
+      CffModulePIC* container = (CffModulePIC*)pic_container->cff;
+      if(container->cff_services)
+        FT_Destroy_Class_cff_services(library, container->cff_services);
+      container->cff_services = NULL;
+      if(container->cff_field_handlers)
+        FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers);
+      container->cff_field_handlers = NULL;
+      FT_FREE( container );
+      pic_container->cff = NULL;
+    }
+  }
+
+  FT_Error
+  cff_driver_class_pic_init(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    CffModulePIC* container;
+    FT_Memory memory = library->memory;
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->cff = container;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    error = FT_Create_Class_cff_services(library, &container->cff_services);
+    if(error) 
+      goto Exit;
+    error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers);
+    if(error) 
+      goto Exit;
+    FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info);
+    FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict);
+    FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name);
+    FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info);
+    FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info);
+    FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec);
+    FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec);
+Exit:
+    if(error)
+      cff_driver_class_pic_free(library);
+    return error;
+  }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffpic.h b/reactos/lib/3rdparty/freetype/src/cff/cffpic.h
new file mode 100644 (file)
index 0000000..e29d068
--- /dev/null
@@ -0,0 +1,80 @@
+/***************************************************************************/
+/*                                                                         */
+/*  cffpic.h                                                               */
+/*                                                                         */
+/*    The FreeType position independent code services for cff module.      */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __CFFPIC_H__
+#define __CFFPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_CFF_SERVICE_PS_INFO_GET         cff_service_ps_info
+#define FT_CFF_SERVICE_GLYPH_DICT_GET      cff_service_glyph_dict
+#define FT_CFF_SERVICE_PS_NAME_GET         cff_service_ps_name
+#define FT_CFF_SERVICE_GET_CMAP_INFO_GET   cff_service_get_cmap_info
+#define FT_CFF_SERVICE_CID_INFO_GET        cff_service_cid_info
+#define FT_CFF_SERVICES_GET                cff_services
+#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
+#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET  cff_cmap_unicode_class_rec
+#define FT_CFF_FIELD_HANDLERS_GET          cff_field_handlers
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include FT_SERVICE_GLYPH_DICT_H
+#include "cffparse.h"
+#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_TT_CMAP_H
+#include FT_SERVICE_CID_H
+
+  typedef struct CffModulePIC_
+  {
+    FT_ServiceDescRec* cff_services;
+    CFF_Field_Handler* cff_field_handlers;
+    FT_Service_PsInfoRec cff_service_ps_info;
+    FT_Service_GlyphDictRec cff_service_glyph_dict;
+    FT_Service_PsFontNameRec cff_service_ps_name;
+    FT_Service_TTCMapsRec  cff_service_get_cmap_info;
+    FT_Service_CIDRec  cff_service_cid_info;
+    FT_CMap_ClassRec cff_cmap_encoding_class_rec;
+    FT_CMap_ClassRec cff_cmap_unicode_class_rec;
+  } CffModulePIC;
+
+#define GET_PIC(lib)                       ((CffModulePIC*)((lib)->pic_container.cff))
+#define FT_CFF_SERVICE_PS_INFO_GET         (GET_PIC(library)->cff_service_ps_info)
+#define FT_CFF_SERVICE_GLYPH_DICT_GET      (GET_PIC(library)->cff_service_glyph_dict)
+#define FT_CFF_SERVICE_PS_NAME_GET         (GET_PIC(library)->cff_service_ps_name)
+#define FT_CFF_SERVICE_GET_CMAP_INFO_GET   (GET_PIC(library)->cff_service_get_cmap_info)
+#define FT_CFF_SERVICE_CID_INFO_GET        (GET_PIC(library)->cff_service_cid_info)
+#define FT_CFF_SERVICES_GET                (GET_PIC(library)->cff_services)
+#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET (GET_PIC(library)->cff_cmap_encoding_class_rec)
+#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET  (GET_PIC(library)->cff_cmap_unicode_class_rec)
+#define FT_CFF_FIELD_HANDLERS_GET          (GET_PIC(library)->cff_field_handlers)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __CFFPIC_H__ */
+
+
+/* END */
index 306e5aa..df92e9a 100644 (file)
@@ -5,7 +5,7 @@
 /*    Basic OpenType/CFF type definitions and interface (specification     */
 /*    only).                                                               */
 /*                                                                         */
 /*    Basic OpenType/CFF type definitions and interface (specification     */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2006, 2007 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -114,7 +114,7 @@ FT_BEGIN_HEADER
     FT_Int     paint_type;
     FT_Int     charstring_type;
     FT_Matrix  font_matrix;
     FT_Int     paint_type;
     FT_Int     charstring_type;
     FT_Matrix  font_matrix;
-    FT_UShort  units_per_em;
+    FT_ULong   units_per_em;  /* temporarily used as scaling value also */
     FT_Vector  font_offset;
     FT_ULong   unique_id;
     FT_BBox    font_bbox;
     FT_Vector  font_offset;
     FT_ULong   unique_id;
     FT_BBox    font_bbox;
@@ -130,7 +130,7 @@ FT_BEGIN_HEADER
     /* these should only be used for the top-level font dictionary */
     FT_UInt    cid_registry;
     FT_UInt    cid_ordering;
     /* 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_supplement;
 
     FT_Long    cid_font_version;
     FT_Long    cid_font_revision;
 
     FT_Long    cid_font_version;
     FT_Long    cid_font_revision;
@@ -259,6 +259,10 @@ FT_BEGIN_HEADER
     /* since version 2.3.0 */
     PS_FontInfoRec*  font_info;   /* font info dictionary */
 
     /* since version 2.3.0 */
     PS_FontInfoRec*  font_info;   /* font info dictionary */
 
+    /* since version 2.3.6 */
+    FT_String*       registry;
+    FT_String*       ordering;
+      
   } CFF_FontRec, *CFF_Font;
 
 
   } CFF_FontRec, *CFF_Font;
 
 
index 0474e37..ef1391c 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += CFF_DRIVER
 
 define CFF_DRIVER
 FTMODULE_H_COMMANDS += CFF_DRIVER
 
 define CFF_DRIVER
-$(OPEN_DRIVER)cff_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, cff_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)cff       $(ECHO_DRIVER_DESC)OpenType fonts with extension *.otf$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)cff       $(ECHO_DRIVER_DESC)OpenType fonts with extension *.otf$(ECHO_DRIVER_DONE)
 endef
 
index 8bec6e1..f59035f 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 Glyph Loader (body).                                 */
 /*                                                                         */
 /*                                                                         */
 /*    CID-keyed Type1 Glyph Loader (body).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,6 +22,7 @@
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_OUTLINE_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_OUTLINE_H
+#include FT_INTERNAL_CALC_H
 
 #include "ciderrs.h"
 
 
 #include "ciderrs.h"
 
     FT_ULong       glyph_length = 0;
     PSAux_Service  psaux        = (PSAux_Service)face->psaux;
 
     FT_ULong       glyph_length = 0;
     PSAux_Service  psaux        = (PSAux_Service)face->psaux;
 
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+    FT_Incremental_InterfaceRec *inc =
+                                  face->root.internal->incremental_interface;
+#endif
+
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     /* For incremental fonts get the character data using */
     /* the callback function.                             */
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     /* For incremental fonts get the character data using */
     /* the callback function.                             */
-    if ( face->root.internal->incremental_interface )
+    if ( inc )
     {
       FT_Data  glyph_data;
 
 
     {
       FT_Data  glyph_data;
 
 
-      error = face->root.internal->incremental_interface->funcs->get_glyph_data(
-                face->root.internal->incremental_interface->object,
-                glyph_index,
-                &glyph_data );
+      error = inc->funcs->get_glyph_data( inc->object,
+                                          glyph_index, &glyph_data );
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
 
       if ( glyph_data.length != 0 )
       {
         glyph_length = glyph_data.length - cid->fd_bytes;
       if ( glyph_data.length != 0 )
       {
         glyph_length = glyph_data.length - cid->fd_bytes;
-        FT_ALLOC( charstring, glyph_length );
+        (void)FT_ALLOC( charstring, glyph_length );
         if ( !error )
           ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
                      glyph_length );
       }
 
         if ( !error )
           ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
                      glyph_length );
       }
 
-      face->root.internal->incremental_interface->funcs->free_glyph_data(
-                face->root.internal->incremental_interface->object,
-                &glyph_data );
+      inc->funcs->free_glyph_data( inc->object, &glyph_data );
 
       if ( error )
         goto Exit;
 
       if ( error )
         goto Exit;
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     /* Incremental fonts can optionally override the metrics. */
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     /* Incremental fonts can optionally override the metrics. */
-    if ( !error                                                              &&
-         face->root.internal->incremental_interface                          &&
-         face->root.internal->incremental_interface->funcs->get_glyph_metrics )
+    if ( !error && inc && inc->funcs->get_glyph_metrics )
     {
       FT_Incremental_MetricsRec  metrics;
 
 
     {
       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;
-      error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
-                face->root.internal->incremental_interface->object,
-                glyph_index, FALSE, &metrics );
-      decoder->builder.left_bearing.x = metrics.bearing_x;
-      decoder->builder.left_bearing.y = metrics.bearing_y;
-      decoder->builder.advance.x      = metrics.advance;
+      metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
+      metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
+      metrics.advance   = FIXED_TO_INT( decoder->builder.advance.x );
+
+      error = inc->funcs->get_glyph_metrics( inc->object,
+                                             glyph_index, FALSE, &metrics );
+
+      decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
+      decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
+      decoder->builder.advance.x      = INT_TO_FIXED( metrics.advance );
       decoder->builder.advance.y      = 0;
     }
 
       decoder->builder.advance.y      = 0;
     }
 
       /* ignore the error if one occurred - skip to next glyph */
     }
 
       /* ignore the error if one occurred - skip to next glyph */
     }
 
-    *max_advance = decoder.builder.advance.x;
+    *max_advance = FIXED_TO_INT( decoder.builder.advance.x );
 
     psaux->t1_decoder_funcs->done( &decoder );
 
 
     psaux->t1_decoder_funcs->done( &decoder );
 
       FT_Slot_Internal  internal = cidglyph->internal;
 
 
       FT_Slot_Internal  internal = cidglyph->internal;
 
 
-      cidglyph->metrics.horiBearingX = decoder.builder.left_bearing.x;
-      cidglyph->metrics.horiAdvance  = decoder.builder.advance.x;
+      cidglyph->metrics.horiBearingX =
+        FIXED_TO_INT( decoder.builder.left_bearing.x );
+      cidglyph->metrics.horiAdvance =
+        FIXED_TO_INT( decoder.builder.advance.x );
 
       internal->glyph_matrix      = font_matrix;
       internal->glyph_delta       = font_offset;
 
       internal->glyph_matrix      = font_matrix;
       internal->glyph_delta       = font_offset;
 
 
       /* copy the _unscaled_ advance width */
 
 
       /* copy the _unscaled_ advance width */
-      metrics->horiAdvance                  = decoder.builder.advance.x;
-      cidglyph->linearHoriAdvance           = decoder.builder.advance.x;
+      metrics->horiAdvance =
+        FIXED_TO_INT( decoder.builder.advance.x );
+      cidglyph->linearHoriAdvance =
+        FIXED_TO_INT( decoder.builder.advance.x );
       cidglyph->internal->glyph_transformed = 0;
 
       /* make up vertical ones */
       cidglyph->internal->glyph_transformed = 0;
 
       /* make up vertical ones */
index 9ed8cee..3bb3594 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 font loader (body).                                  */
 /*                                                                         */
 /*                                                                         */
 /*    CID-keyed Type1 font loader (body).                                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
       object = (FT_Byte*)&cid->font_info;
       break;
 
       object = (FT_Byte*)&cid->font_info;
       break;
 
+    case T1_FIELD_LOCATION_FONT_EXTRA:
+      object = (FT_Byte*)&face->font_extra;
+      break;
+
     case T1_FIELD_LOCATION_BBOX:
       object = (FT_Byte*)&cid->font_bbox;
       break;
     case T1_FIELD_LOCATION_BBOX:
       object = (FT_Byte*)&cid->font_bbox;
       break;
 
         if ( parser->num_dict < 0 )
         {
 
         if ( parser->num_dict < 0 )
         {
-          FT_ERROR(( "cid_load_keyword: invalid use of `%s'!\n",
+          FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n",
                      keyword->ident ));
           error = CID_Err_Syntax_Error;
           goto Exit;
                      keyword->ident ));
           error = CID_Err_Syntax_Error;
           goto Exit;
   }
 
 
   }
 
 
+  /* by mistake, `expansion_factor' appears both in PS_PrivateRec */
+  /* and CID_FaceDictRec (both are public header files and can't  */
+  /* changed); we simply copy the value                           */
+
+  FT_CALLBACK_DEF( FT_Error )
+  parse_expansion_factor( CID_Face     face,
+                          CID_Parser*  parser )
+  {
+    CID_FaceDict  dict;
+
+
+    if ( parser->num_dict >= 0 )
+    {
+      dict = face->cid.font_dicts + parser->num_dict;
+
+      dict->expansion_factor              = cid_parser_to_fixed( parser, 0 );
+      dict->private_dict.expansion_factor = dict->expansion_factor;
+    }
+
+    return CID_Err_Ok;
+  }
+
+
   static
   const T1_FieldRec  cid_field_records[] =
   {
 
 #include "cidtoken.h"
 
   static
   const T1_FieldRec  cid_field_records[] =
   {
 
 #include "cidtoken.h"
 
-    T1_FIELD_CALLBACK( "FDArray",    parse_fd_array, 0 )
-    T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix, 0 )
+    T1_FIELD_CALLBACK( "FDArray",         parse_fd_array, 0 )
+    T1_FIELD_CALLBACK( "FontMatrix",      parse_font_matrix, 0 )
+    T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
 
     { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
   };
 
     { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
   };
index 1b3bfbf..9647d87 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID objects manager (body).                                          */
 /*                                                                         */
 /*                                                                         */
 /*    CID objects manager (body).                                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   FT_LOCAL_DEF( void )
   cid_face_done( FT_Face  cidface )         /* CID_Face */
   {
   FT_LOCAL_DEF( void )
   cid_face_done( FT_Face  cidface )         /* CID_Face */
   {
-    CID_Face   face = (CID_Face)cidface;
-    FT_Memory  memory;
+    CID_Face      face = (CID_Face)cidface;
+    FT_Memory     memory;
+    CID_FaceInfo  cid;
+    PS_FontInfo   info;
 
 
 
 
-    if ( face )
-    {
-      CID_FaceInfo  cid  = &face->cid;
-      PS_FontInfo   info = &cid->font_info;
+    if ( !face )
+      return;
 
 
+    cid    = &face->cid;
+    info   = &cid->font_info;
+    memory = cidface->memory;
 
 
-      memory = cidface->memory;
+    /* release subrs */
+    if ( face->subrs )
+    {
+      FT_Int  n;
 
 
-      /* release subrs */
-      if ( face->subrs )
+
+      for ( n = 0; n < cid->num_dicts; n++ )
       {
       {
-        FT_Int  n;
+        CID_Subrs  subr = face->subrs + n;
 
 
 
 
-        for ( n = 0; n < cid->num_dicts; n++ )
+        if ( subr->code )
         {
         {
-          CID_Subrs  subr = face->subrs + n;
-
-
-          if ( subr->code )
-          {
-            FT_FREE( subr->code[0] );
-            FT_FREE( subr->code );
-          }
+          FT_FREE( subr->code[0] );
+          FT_FREE( subr->code );
         }
         }
-
-        FT_FREE( face->subrs );
       }
 
       }
 
-      /* release FontInfo strings */
-      FT_FREE( info->version );
-      FT_FREE( info->notice );
-      FT_FREE( info->full_name );
-      FT_FREE( info->family_name );
-      FT_FREE( info->weight );
+      FT_FREE( face->subrs );
+    }
 
 
-      /* release font dictionaries */
-      FT_FREE( cid->font_dicts );
-      cid->num_dicts = 0;
+    /* release FontInfo strings */
+    FT_FREE( info->version );
+    FT_FREE( info->notice );
+    FT_FREE( info->full_name );
+    FT_FREE( info->family_name );
+    FT_FREE( info->weight );
 
 
-      /* release other strings */
-      FT_FREE( cid->cid_font_name );
-      FT_FREE( cid->registry );
-      FT_FREE( cid->ordering );
+    /* release font dictionaries */
+    FT_FREE( cid->font_dicts );
+    cid->num_dicts = 0;
 
 
-      cidface->family_name = 0;
-      cidface->style_name  = 0;
+    /* release other strings */
+    FT_FREE( cid->cid_font_name );
+    FT_FREE( cid->registry );
+    FT_FREE( cid->ordering );
 
 
-      FT_FREE( face->binary_data );
-      FT_FREE( face->cid_stream );
-    }
+    cidface->family_name = 0;
+    cidface->style_name  = 0;
+
+    FT_FREE( face->binary_data );
+    FT_FREE( face->cid_stream );
   }
 
 
   }
 
 
       goto Exit;
 
     /* check the face index */
       goto Exit;
 
     /* check the face index */
+    /* XXX: handle CID fonts with more than a single face */
     if ( face_index != 0 )
     {
       FT_ERROR(( "cid_face_init: invalid face index\n" ));
     if ( face_index != 0 )
     {
       FT_ERROR(( "cid_face_init: invalid face index\n" ));
index bb87afc..efed618 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 parser (body).                                       */
 /*                                                                         */
 /*                                                                         */
 /*    CID-keyed Type1 parser (body).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,7 +18,6 @@
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_STREAM_H
 
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_STREAM_H
 
     /* `StartData' or `/sfnts'                      */
     {
       FT_Byte   buffer[256 + 10];
     /* `StartData' or `/sfnts'                      */
     {
       FT_Byte   buffer[256 + 10];
-      FT_Int    read_len = 256 + 10;
+      FT_Long   read_len = 256 + 10; /* same as signed FT_Stream->size */
       FT_Byte*  p        = buffer;
 
 
       FT_Byte*  p        = buffer;
 
 
-      for ( offset = (FT_ULong)FT_STREAM_POS(); ; offset += 256 )
+      for ( offset = FT_STREAM_POS(); ; offset += 256 )
       {
       {
-        FT_Int  stream_len;
+        FT_Long  stream_len; /* same as signed FT_Stream->size */
 
 
         stream_len = stream->size - FT_STREAM_POS();
 
 
         stream_len = stream->size - FT_STREAM_POS();
index 5c5a729..3a2d225 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID driver interface (body).                                         */
 /*                                                                         */
 /*                                                                         */
 /*    CID driver interface (body).                                         */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #include "cidriver.h"
 #include "cidgload.h"
 #include FT_INTERNAL_DEBUG_H
 #include "cidriver.h"
 #include "cidgload.h"
 #include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
 
 #include "ciderrs.h"
 
 #include FT_SERVICE_POSTSCRIPT_NAME_H
 #include FT_SERVICE_XFREE86_NAME_H
 #include FT_SERVICE_POSTSCRIPT_INFO_H
 
 #include "ciderrs.h"
 
 #include FT_SERVICE_POSTSCRIPT_NAME_H
 #include FT_SERVICE_XFREE86_NAME_H
 #include FT_SERVICE_POSTSCRIPT_INFO_H
+#include FT_SERVICE_CID_H
+
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
 #define FT_COMPONENT  trace_ciddriver
 
 
 #define FT_COMPONENT  trace_ciddriver
 
 
- /*
-  *  POSTSCRIPT NAME SERVICE
-  *
-  */
 /*
+   *  POSTSCRIPT NAME SERVICE
+   *
+   */
 
   static const char*
   cid_get_postscript_name( CID_Face  face )
 
   static const char*
   cid_get_postscript_name( CID_Face  face )
   };
 
 
   };
 
 
- /*
-  *  POSTSCRIPT INFO SERVICE
-  *
-  */
 /*
+   *  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;
 
   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;
+
+    return CID_Err_Ok;
   }
 
   }
 
+  static FT_Error
+  cid_ps_get_font_extra( FT_Face          face,
+                        PS_FontExtraRec*  afont_extra )
+  {
+    *afont_extra = ((CID_Face)face)->font_extra;
+
+    return CID_Err_Ok;
+  }
 
   static const FT_Service_PsInfoRec  cid_service_ps_info =
   {
     (PS_GetFontInfoFunc)   cid_ps_get_font_info,
 
   static const FT_Service_PsInfoRec  cid_service_ps_info =
   {
     (PS_GetFontInfoFunc)   cid_ps_get_font_info,
+    (PS_GetFontExtraFunc)  cid_ps_get_font_extra,
     (PS_HasGlyphNamesFunc) NULL,        /* unsupported with CID fonts */
     (PS_GetFontPrivateFunc)NULL         /* unsupported                */
   };
 
 
     (PS_HasGlyphNamesFunc) NULL,        /* unsupported with CID fonts */
     (PS_GetFontPrivateFunc)NULL         /* unsupported                */
   };
 
 
- /*
-  *  SERVICE LIST
-  *
-  */
+  /*
+   *  CID INFO SERVICE
+   *
+   */
+  static FT_Error
+  cid_get_ros( CID_Face      face,
+               const char*  *registry,
+               const char*  *ordering,
+               FT_Int       *supplement )
+  {
+    CID_FaceInfo  cid = &face->cid;
+
+
+    if ( registry )
+      *registry = cid->registry;
+      
+    if ( ordering )
+      *ordering = cid->ordering;
+
+    if ( supplement )
+      *supplement = cid->supplement;
+      
+    return CID_Err_Ok;
+  }
+
+
+  static FT_Error
+  cid_get_is_cid( CID_Face  face,
+                  FT_Bool  *is_cid )
+  {
+    FT_Error  error = CID_Err_Ok;
+    FT_UNUSED( face );
+
+
+    if ( is_cid )
+      *is_cid = 1; /* cid driver is only used for CID keyed fonts */
+
+    return error;
+  }
+
+
+  static FT_Error
+  cid_get_cid_from_glyph_index( CID_Face  face,
+                                FT_UInt   glyph_index,
+                                FT_UInt  *cid )
+  {
+    FT_Error  error = CID_Err_Ok;
+    FT_UNUSED( face );
+
+
+    if ( cid )
+      *cid = glyph_index; /* identity mapping */
+
+    return error;
+  }
+
+
+  static const FT_Service_CIDRec  cid_service_cid_info =
+  {
+     (FT_CID_GetRegistryOrderingSupplementFunc)cid_get_ros,
+     (FT_CID_GetIsInternallyCIDKeyedFunc)      cid_get_is_cid,
+     (FT_CID_GetCIDFromGlyphIndexFunc)         cid_get_cid_from_glyph_index
+  };
+
+
+  /*
+   *  SERVICE LIST
+   *
+   */
 
   static const FT_ServiceDescRec  cid_services[] =
   {
 
   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_XF86_NAME,            FT_XF86_FORMAT_CID },
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
     { FT_SERVICE_ID_POSTSCRIPT_INFO,      &cid_service_ps_info },
     { FT_SERVICE_ID_POSTSCRIPT_INFO,      &cid_service_ps_info },
+    { FT_SERVICE_ID_CID,                  &cid_service_cid_info },
     { NULL, NULL }
   };
 
     { NULL, NULL }
   };
 
index d5a80f6..c7f424b 100644 (file)
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
 
   FT_CALLBACK_TABLE
   const FT_Driver_ClassRec  t1cid_driver_class;
 
   FT_CALLBACK_TABLE
   const FT_Driver_ClassRec  t1cid_driver_class;
index ad5bbb2..94a3657 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID token definitions (specification only).                          */
 /*                                                                         */
 /*                                                                         */
 /*    CID token definitions (specification only).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2006 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   T1_FIELD_NUM   ( "UnderlinePosition",  underline_position,  0 )
   T1_FIELD_NUM   ( "UnderlineThickness", underline_thickness, 0 )
 
   T1_FIELD_NUM   ( "UnderlinePosition",  underline_position,  0 )
   T1_FIELD_NUM   ( "UnderlineThickness", underline_thickness, 0 )
 
+#undef  FT_STRUCTURE
+#define FT_STRUCTURE  PS_FontExtraRec
+#undef  T1CODE
+#define T1CODE        T1_FIELD_LOCATION_FONT_EXTRA
+
+  T1_FIELD_NUM   ( "FSType",             fs_type,             0 )
+
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  CID_FaceDictRec
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  CID_FaceDictRec
@@ -62,7 +69,6 @@
   T1_FIELD_NUM  ( "SubrCount",          num_subrs,           0 )
   T1_FIELD_NUM  ( "lenBuildCharArray",  len_buildchar,       0 )
   T1_FIELD_FIXED( "ForceBoldThreshold", forcebold_threshold, 0 )
   T1_FIELD_NUM  ( "SubrCount",          num_subrs,           0 )
   T1_FIELD_NUM  ( "lenBuildCharArray",  len_buildchar,       0 )
   T1_FIELD_FIXED( "ForceBoldThreshold", forcebold_threshold, 0 )
-  T1_FIELD_FIXED( "ExpansionFactor",    expansion_factor,    0 )
   T1_FIELD_FIXED( "StrokeWidth",        stroke_width,        0 )
 
 
   T1_FIELD_FIXED( "StrokeWidth",        stroke_width,        0 )
 
 
@@ -92,6 +98,9 @@
   T1_FIELD_NUM_TABLE ( "StemSnapH",        snap_widths,        12, 0 )
   T1_FIELD_NUM_TABLE ( "StemSnapV",        snap_heights,       12, 0 )
 
   T1_FIELD_NUM_TABLE ( "StemSnapH",        snap_widths,        12, 0 )
   T1_FIELD_NUM_TABLE ( "StemSnapV",        snap_heights,       12, 0 )
 
+  T1_FIELD_BOOL      ( "ForceBold",        force_bold,          0 )
+
+
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  FT_BBox
 #undef  T1CODE
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  FT_BBox
 #undef  T1CODE
index 41e5a68..ce30bfd 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += TYPE1CID_DRIVER
 
 define TYPE1CID_DRIVER
 FTMODULE_H_COMMANDS += TYPE1CID_DRIVER
 
 define TYPE1CID_DRIVER
-$(OPEN_DRIVER)t1cid_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, t1cid_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)cid       $(ECHO_DRIVER_DESC)Postscript CID-keyed fonts, no known extension$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)cid       $(ECHO_DRIVER_DESC)Postscript CID-keyed fonts, no known extension$(ECHO_DRIVER_DONE)
 endef
 
index 6cca658..3d10031 100644 (file)
 
   static void
   gxv_bsln_LookupValue_validate( FT_UShort            glyph,
 
   static void
   gxv_bsln_LookupValue_validate( FT_UShort            glyph,
-                                 GXV_LookupValueDesc  value,
+                                 GXV_LookupValueCPtr  value_p,
                                  GXV_Validator        valid )
   {
                                  GXV_Validator        valid )
   {
-    FT_UShort   v = value.u;
+    FT_UShort   v = value_p->u;
     FT_UShort*  ctlPoints;
 
     FT_UNUSED( glyph );
     FT_UShort*  ctlPoints;
 
     FT_UNUSED( glyph );
 
   static GXV_LookupValueDesc
   gxv_bsln_LookupFmt4_transit( FT_UShort            relative_gindex,
 
   static GXV_LookupValueDesc
   gxv_bsln_LookupFmt4_transit( FT_UShort            relative_gindex,
-                               GXV_LookupValueDesc  base_value,
+                               GXV_LookupValueCPtr  base_value_p,
                                FT_Bytes             lookuptbl_limit,
                                GXV_Validator        valid )
   {
                                FT_Bytes             lookuptbl_limit,
                                GXV_Validator        valid )
   {
     GXV_LookupValueDesc  value;
 
     /* XXX: check range ? */
     GXV_LookupValueDesc  value;
 
     /* XXX: check range ? */
-    offset = (FT_UShort)( base_value.u +
+    offset = (FT_UShort)( base_value_p->u +
                           ( relative_gindex * sizeof ( FT_UShort ) ) );
 
     p     = valid->lookuptbl_head + offset;
                           ( relative_gindex * sizeof ( FT_UShort ) ) );
 
     p     = valid->lookuptbl_head + offset;
index 82fd6b3..de7ce6f 100644 (file)
@@ -4,7 +4,8 @@
 /*                                                                         */
 /*    TrueTypeGX/AAT common tables validation (body).                      */
 /*                                                                         */
 /*                                                                         */
 /*    TrueTypeGX/AAT common tables validation (body).                      */
 /*                                                                         */
-/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
+/*  Copyright 2004, 2005, 2009                                             */
+/*  by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
                              FT_UShort*  b )
   {
     if ( *a < *b )
                              FT_UShort*  b )
   {
     if ( *a < *b )
-      return ( -1 );
+      return -1;
     else if ( *a > *b )
     else if ( *a > *b )
-      return ( 1 );
+      return 1;
     else
     else
-      return ( 0 );
+      return 0;
   }
 
 
   }
 
 
                             FT_ULong*  b )
   {
     if ( *a < *b )
                             FT_ULong*  b )
   {
     if ( *a < *b )
-      return ( -1 );
+      return -1;
     else if ( *a > *b )
     else if ( *a > *b )
-      return ( 1 );
+      return 1;
     else
     else
-      return ( 0 );
+      return 0;
   }
 
 
   }
 
 
             if ( UNITSIZE != CORRECTSIZE )                             \
             {                                                          \
               FT_ERROR(( "unitSize=%d differs from"                    \
             if ( UNITSIZE != CORRECTSIZE )                             \
             {                                                          \
               FT_ERROR(( "unitSize=%d differs from"                    \
-                         "expected unitSize=%d"                        \
-                         "in LookupTable %s",                          \
+                         " expected unitSize=%d"                       \
+                         " in LookupTable %s\n",                       \
                           UNITSIZE, CORRECTSIZE, FORMAT ));            \
               if ( UNITSIZE != 0 && NUNITS != 0 )                      \
               {                                                        \
                           UNITSIZE, CORRECTSIZE, FORMAT ));            \
               if ( UNITSIZE != 0 && NUNITS != 0 )                      \
               {                                                        \
       }
 
       value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
       }
 
       value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
-      valid->lookupval_func( i, value, valid );
+      valid->lookupval_func( i, &value, valid );
     }
 
     valid->subtable_length = p - table;
     }
 
     valid->subtable_length = p - table;
       }
 
       for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
       }
 
       for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
-        valid->lookupval_func( gid, value, valid );
+        valid->lookupval_func( gid, &value, valid );
     }
 
     gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, valid );
     }
 
     gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, valid );
       for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
       {
         value = valid->lookupfmt4_trans( (FT_UShort)( gid - firstGlyph ),
       for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
       {
         value = valid->lookupfmt4_trans( (FT_UShort)( gid - firstGlyph ),
-                                         base_value,
+                                         &base_value,
                                          limit,
                                          valid );
 
                                          limit,
                                          valid );
 
-        valid->lookupval_func( gid, value, valid );
+        valid->lookupval_func( gid, &value, valid );
       }
     }
 
       }
     }
 
       }
       prev_glyph = glyph;
 
       }
       prev_glyph = glyph;
 
-      valid->lookupval_func( glyph, value, valid );
+      valid->lookupval_func( glyph, &value, valid );
     }
 
     gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, valid );
     }
 
     gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, valid );
     {
       GXV_LIMIT_CHECK( 2 );
       value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
     {
       GXV_LIMIT_CHECK( 2 );
       value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
-      valid->lookupval_func( (FT_UShort)( firstGlyph + i ), value, valid );
+      valid->lookupval_func( (FT_UShort)( firstGlyph + i ), &value, valid );
     }
 
     valid->subtable_length = p - table;
     }
 
     valid->subtable_length = p - table;
       if ( NULL != valid->statetable.entry_validate_func )
         valid->statetable.entry_validate_func( state,
                                                flags,
       if ( NULL != valid->statetable.entry_validate_func )
         valid->statetable.entry_validate_func( state,
                                                flags,
-                                               glyphOffset,
+                                               &glyphOffset,
                                                statetable_table,
                                                statetable_limit,
                                                valid );
                                                statetable_table,
                                                statetable_limit,
                                                valid );
 
   static void
   gxv_XClassTable_lookupval_validate( FT_UShort            glyph,
 
   static void
   gxv_XClassTable_lookupval_validate( FT_UShort            glyph,
-                                      GXV_LookupValueDesc  value,
+                                      GXV_LookupValueCPtr  value_p,
                                       GXV_Validator        valid )
   {
     FT_UNUSED( glyph );
 
                                       GXV_Validator        valid )
   {
     FT_UNUSED( glyph );
 
-    if ( value.u >= valid->xstatetable.nClasses )
+    if ( value_p->u >= valid->xstatetable.nClasses )
       FT_INVALID_DATA;
       FT_INVALID_DATA;
-    if ( value.u > valid->xstatetable.maxClassID )
-      valid->xstatetable.maxClassID = value.u;
+    if ( value_p->u > valid->xstatetable.maxClassID )
+      valid->xstatetable.maxClassID = value_p->u;
   }
 
 
   }
 
 
   */
   static GXV_LookupValueDesc
   gxv_XClassTable_lookupfmt4_transit( FT_UShort            relative_gindex,
   */
   static GXV_LookupValueDesc
   gxv_XClassTable_lookupfmt4_transit( FT_UShort            relative_gindex,
-                                      GXV_LookupValueDesc  base_value,
+                                      GXV_LookupValueCPtr  base_value_p,
                                       FT_Bytes             lookuptbl_limit,
                                       GXV_Validator        valid )
   {
                                       FT_Bytes             lookuptbl_limit,
                                       GXV_Validator        valid )
   {
     GXV_LookupValueDesc  value;
 
     /* XXX: check range? */
     GXV_LookupValueDesc  value;
 
     /* XXX: check range? */
-    offset = (FT_UShort)( base_value.u +
+    offset = (FT_UShort)( base_value_p->u +
                           relative_gindex * sizeof ( FT_UShort ) );
 
     p     = valid->lookuptbl_head + offset;
                           relative_gindex * sizeof ( FT_UShort ) );
 
     p     = valid->lookuptbl_head + offset;
       if ( NULL != valid->xstatetable.entry_validate_func )
         valid->xstatetable.entry_validate_func( state,
                                                 flags,
       if ( NULL != valid->xstatetable.entry_validate_func )
         valid->xstatetable.entry_validate_func( state,
                                                 flags,
-                                                glyphOffset,
+                                                &glyphOffset,
                                                 xstatetable_table,
                                                 xstatetable_limit,
                                                 valid );
                                                 xstatetable_table,
                                                 xstatetable_limit,
                                                 valid );
index 0128eca..404c07f 100644 (file)
@@ -79,6 +79,8 @@ FT_BEGIN_HEADER
 
   } GXV_LookupValueDesc;
 
 
   } GXV_LookupValueDesc;
 
+  typedef const GXV_LookupValueDesc* GXV_LookupValueCPtr;
+
   typedef enum  GXV_LookupValue_SignSpec_
   {
     GXV_LOOKUPVALUE_UNSIGNED = 0,
   typedef enum  GXV_LookupValue_SignSpec_
   {
     GXV_LOOKUPVALUE_UNSIGNED = 0,
@@ -89,12 +91,12 @@ FT_BEGIN_HEADER
 
   typedef void
   (*GXV_Lookup_Value_Validate_Func)( FT_UShort            glyph,
 
   typedef void
   (*GXV_Lookup_Value_Validate_Func)( FT_UShort            glyph,
-                                     GXV_LookupValueDesc  value,
+                                     GXV_LookupValueCPtr  value_p,
                                      GXV_Validator        valid );
 
   typedef GXV_LookupValueDesc
   (*GXV_Lookup_Fmt4_Transit_Func)( FT_UShort            relative_gindex,
                                      GXV_Validator        valid );
 
   typedef GXV_LookupValueDesc
   (*GXV_Lookup_Fmt4_Transit_Func)( FT_UShort            relative_gindex,
-                                   GXV_LookupValueDesc  base_value,
+                                   GXV_LookupValueCPtr  base_value_p,
                                    FT_Bytes             lookuptbl_limit,
                                    GXV_Validator        valid );
 
                                    FT_Bytes             lookuptbl_limit,
                                    GXV_Validator        valid );
 
@@ -134,6 +136,7 @@ FT_BEGIN_HEADER
 
   } GXV_StateTable_GlyphOffsetDesc;
 
 
   } GXV_StateTable_GlyphOffsetDesc;
 
+  typedef const GXV_StateTable_GlyphOffsetDesc* GXV_StateTable_GlyphOffsetCPtr;
 
   typedef void
   (*GXV_StateTable_Subtable_Setup_Func)( FT_UShort      table_size,
 
   typedef void
   (*GXV_StateTable_Subtable_Setup_Func)( FT_UShort      table_size,
@@ -149,7 +152,7 @@ FT_BEGIN_HEADER
   (*GXV_StateTable_Entry_Validate_Func)(
      FT_Byte                         state,
      FT_UShort                       flags,
   (*GXV_StateTable_Entry_Validate_Func)(
      FT_Byte                         state,
      FT_UShort                       flags,
-     GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+     GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
      FT_Bytes                        statetable_table,
      FT_Bytes                        statetable_limit,
      GXV_Validator                   valid );
      FT_Bytes                        statetable_table,
      FT_Bytes                        statetable_limit,
      GXV_Validator                   valid );
@@ -175,6 +178,8 @@ FT_BEGIN_HEADER
 
   typedef GXV_StateTable_GlyphOffsetDesc  GXV_XStateTable_GlyphOffsetDesc;
 
 
   typedef GXV_StateTable_GlyphOffsetDesc  GXV_XStateTable_GlyphOffsetDesc;
 
+  typedef const GXV_XStateTable_GlyphOffsetDesc* GXV_XStateTable_GlyphOffsetCPtr;
+
   typedef void
   (*GXV_XStateTable_Subtable_Setup_Func)( FT_ULong       table_size,
                                           FT_ULong       classTable,
   typedef void
   (*GXV_XStateTable_Subtable_Setup_Func)( FT_ULong       table_size,
                                           FT_ULong       classTable,
@@ -189,7 +194,7 @@ FT_BEGIN_HEADER
   (*GXV_XStateTable_Entry_Validate_Func)(
      FT_UShort                       state,
      FT_UShort                       flags,
   (*GXV_XStateTable_Entry_Validate_Func)(
      FT_UShort                       state,
      FT_UShort                       flags,
-     GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+     GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
      FT_Bytes                        xstatetable_table,
      FT_Bytes                        xstatetable_limit,
      GXV_Validator                   valid );
      FT_Bytes                        xstatetable_table,
      FT_Bytes                        xstatetable_limit,
      GXV_Validator                   valid );
@@ -275,11 +280,11 @@ FT_BEGIN_HEADER
 
 #else /* !FT_DEBUG_LEVEL_TRACE */
 
 
 #else /* !FT_DEBUG_LEVEL_TRACE */
 
-#define GXV_INIT                do ; while ( 0 )
-#define GXV_NAME_ENTER( name )  do ; while ( 0 )
-#define GXV_EXIT                do ; while ( 0 )
+#define GXV_INIT                do { } while ( 0 )
+#define GXV_NAME_ENTER( name )  do { } while ( 0 )
+#define GXV_EXIT                do { } while ( 0 )
 
 
-#define GXV_TRACE( s )          do ; while ( 0 )
+#define GXV_TRACE( s )          do { } while ( 0 )
 
 #endif  /* !FT_DEBUG_LEVEL_TRACE */
 
 
 #endif  /* !FT_DEBUG_LEVEL_TRACE */
 
index d7c6ad1..002fec6 100644 (file)
@@ -4,7 +4,8 @@
 /*                                                                         */
 /*    TrueTypeGX/AAT feat table validation (body).                         */
 /*                                                                         */
 /*                                                                         */
 /*    TrueTypeGX/AAT feat table validation (body).                         */
 /*                                                                         */
-/*  Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
+/*  Copyright 2004, 2005, 2008 by                                          */
+/*  suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -59,7 +60,7 @@
 #define GXV_FEAT_DATA( field )  GXV_TABLE_DATA( feat, field )
 
 
 #define GXV_FEAT_DATA( field )  GXV_TABLE_DATA( feat, field )
 
 
-  typedef enum
+  typedef enum  GXV_FeatureFlagsMask_
   {
     GXV_FEAT_MASK_EXCLUSIVE_SETTINGS = 0x8000U,
     GXV_FEAT_MASK_DYNAMIC_DEFAULT    = 0x4000,
   {
     GXV_FEAT_MASK_EXCLUSIVE_SETTINGS = 0x8000U,
     GXV_FEAT_MASK_DYNAMIC_DEFAULT    = 0x4000,
 
     FT_UShort  feature;
     FT_UShort  nSettings;
 
     FT_UShort  feature;
     FT_UShort  nSettings;
-    FT_UInt    settingTable;
+    FT_ULong   settingTable;
     FT_UShort  featureFlags;
 
     FT_Bool    exclusive;
     FT_UShort  featureFlags;
 
     FT_Bool    exclusive;
index 29bf840..e14f946 100644 (file)
 
   static void
   gxv_just_pcTable_LookupValue_entry_validate( FT_UShort            glyph,
 
   static void
   gxv_just_pcTable_LookupValue_entry_validate( FT_UShort            glyph,
-                                               GXV_LookupValueDesc  value,
+                                               GXV_LookupValueCPtr  value_p,
                                                GXV_Validator        valid )
   {
     FT_UNUSED( glyph );
 
                                                GXV_Validator        valid )
   {
     FT_UNUSED( glyph );
 
-    if ( value.u > GXV_JUST_DATA( pc_offset_max ) )
-      GXV_JUST_DATA( pc_offset_max ) = value.u;
-    if ( value.u < GXV_JUST_DATA( pc_offset_max ) )
-      GXV_JUST_DATA( pc_offset_min ) = value.u;
+    if ( value_p->u > GXV_JUST_DATA( pc_offset_max ) )
+      GXV_JUST_DATA( pc_offset_max ) = value_p->u;
+    if ( value_p->u < GXV_JUST_DATA( pc_offset_max ) )
+      GXV_JUST_DATA( pc_offset_min ) = value_p->u;
   }
 
 
   }
 
 
   gxv_just_classTable_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
   gxv_just_classTable_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_UShort  currentClass;
 
     FT_UNUSED( state );
     FT_UShort  currentClass;
 
     FT_UNUSED( state );
-    FT_UNUSED( glyphOffset );
+    FT_UNUSED( glyphOffset_p );
     FT_UNUSED( table );
     FT_UNUSED( limit );
     FT_UNUSED( valid );
     FT_UNUSED( table );
     FT_UNUSED( limit );
     FT_UNUSED( valid );
 
   static void
   gxv_just_wdcTable_LookupValue_validate( FT_UShort            glyph,
 
   static void
   gxv_just_wdcTable_LookupValue_validate( FT_UShort            glyph,
-                                          GXV_LookupValueDesc  value,
+                                          GXV_LookupValueCPtr  value_p,
                                           GXV_Validator        valid )
   {
     FT_UNUSED( glyph );
 
                                           GXV_Validator        valid )
   {
     FT_UNUSED( glyph );
 
-    if ( value.u > GXV_JUST_DATA( wdc_offset_max ) )
-      GXV_JUST_DATA( wdc_offset_max ) = value.u;
-    if ( value.u < GXV_JUST_DATA( wdc_offset_min ) )
-      GXV_JUST_DATA( wdc_offset_min ) = value.u;
+    if ( value_p->u > GXV_JUST_DATA( wdc_offset_max ) )
+      GXV_JUST_DATA( wdc_offset_max ) = value_p->u;
+    if ( value_p->u < GXV_JUST_DATA( wdc_offset_min ) )
+      GXV_JUST_DATA( wdc_offset_min ) = value_p->u;
   }
 
 
   }
 
 
   {
     FT_Bytes           p     = table;
     FT_Bytes           limit = 0;
   {
     FT_Bytes           p     = table;
     FT_Bytes           limit = 0;
-    FT_UInt            table_size;
+    FT_Offset          table_size;
 
     GXV_ValidatorRec   validrec;
     GXV_Validator      valid = &validrec;
 
     GXV_ValidatorRec   validrec;
     GXV_Validator      valid = &validrec;
index bfb405f..2137db8 100644 (file)
   gxv_kern_subtable_fmt1_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
   gxv_kern_subtable_fmt1_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_UShort  kernValue;
 
     FT_UNUSED( state );
     FT_UShort  kernValue;
 
     FT_UNUSED( state );
-    FT_UNUSED( glyphOffset );
+    FT_UNUSED( glyphOffset_p );
 
 
     push        = (FT_UShort)( ( flags >> 15 ) & 1      );
 
 
     push        = (FT_UShort)( ( flags >> 15 ) & 1      );
index 48821ea..f14fa5b 100644 (file)
 
   static void
   gxv_lcar_LookupValue_validate( FT_UShort            glyph,
 
   static void
   gxv_lcar_LookupValue_validate( FT_UShort            glyph,
-                                 GXV_LookupValueDesc  value,
+                                 GXV_LookupValueCPtr  value_p,
                                  GXV_Validator        valid )
   {
                                  GXV_Validator        valid )
   {
-    FT_Bytes   p     = valid->root->base + value.u;
+    FT_Bytes   p     = valid->root->base + value_p->u;
     FT_Bytes   limit = valid->root->limit;
     FT_UShort  count;
     FT_Short   partial;
     FT_Bytes   limit = valid->root->limit;
     FT_UShort  count;
     FT_Short   partial;
 
   static GXV_LookupValueDesc
   gxv_lcar_LookupFmt4_transit( FT_UShort            relative_gindex,
 
   static GXV_LookupValueDesc
   gxv_lcar_LookupFmt4_transit( FT_UShort            relative_gindex,
-                               GXV_LookupValueDesc  base_value,
+                               GXV_LookupValueCPtr  base_value_p,
                                FT_Bytes             lookuptbl_limit,
                                GXV_Validator        valid )
   {
                                FT_Bytes             lookuptbl_limit,
                                GXV_Validator        valid )
   {
     FT_UNUSED( lookuptbl_limit );
 
     /* XXX: check range? */
     FT_UNUSED( lookuptbl_limit );
 
     /* XXX: check range? */
-    offset = (FT_UShort)( base_value.u +
+    offset = (FT_UShort)( base_value_p->u +
                           relative_gindex * sizeof ( FT_UShort ) );
     p      = valid->root->base + offset;
     limit  = valid->root->limit;
                           relative_gindex * sizeof ( FT_UShort ) );
     p      = valid->root->base + offset;
     limit  = valid->root->limit;
index 466584e..d912a8f 100644 (file)
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
 
   FT_EXPORT_VAR( const FT_Module_Class )  gxv_module_class;
 
 
   FT_EXPORT_VAR( const FT_Module_Class )  gxv_module_class;
 
index 6fb71b9..0aa0663 100644 (file)
@@ -42,7 +42,7 @@
   gxv_mort_feature_validate( GXV_mort_feature  f,
                              GXV_Validator     valid )
   {
   gxv_mort_feature_validate( GXV_mort_feature  f,
                              GXV_Validator     valid )
   {
-    if ( f->featureType > gxv_feat_registry_length )
+    if ( f->featureType >= gxv_feat_registry_length )
     {
       GXV_TRACE(( "featureType %d is out of registered range, "
                   "setting %d is unchecked\n",
     {
       GXV_TRACE(( "featureType %d is out of registered range, "
                   "setting %d is unchecked\n",
 
 
   /*
 
 
   /*
-   * nFeatureFlags is typed to FT_UInt to accept that in
+   * nFeatureFlags is typed to FT_ULong to accept that in
    * mort (typed FT_UShort) and morx (typed FT_ULong).
    */
   FT_LOCAL_DEF( void )
   gxv_mort_featurearray_validate( FT_Bytes       table,
                                   FT_Bytes       limit,
    * mort (typed FT_UShort) and morx (typed FT_ULong).
    */
   FT_LOCAL_DEF( void )
   gxv_mort_featurearray_validate( FT_Bytes       table,
                                   FT_Bytes       limit,
-                                  FT_UInt        nFeatureFlags,
+                                  FT_ULong       nFeatureFlags,
                                   GXV_Validator  valid )
   {
     FT_Bytes  p = table;
                                   GXV_Validator  valid )
   {
     FT_Bytes  p = table;
-    FT_UInt   i;
+    FT_ULong  i;
 
     GXV_mort_featureRec  f = GXV_MORT_FEATURE_OFF;
 
 
     GXV_mort_featureRec  f = GXV_MORT_FEATURE_OFF;
 
index 1d64e69..1e5a1f5 100644 (file)
@@ -54,7 +54,7 @@
   FT_LOCAL( void )
   gxv_mort_featurearray_validate( FT_Bytes       table,
                                   FT_Bytes       limit,
   FT_LOCAL( void )
   gxv_mort_featurearray_validate( FT_Bytes       table,
                                   FT_Bytes       limit,
-                                  FT_UInt        nFeatureFlags,
+                                  FT_ULong       nFeatureFlags,
                                   GXV_Validator  valid );
 
   FT_LOCAL( void )
                                   GXV_Validator  valid );
 
   FT_LOCAL( void )
index 0902056..0453062 100644 (file)
@@ -64,7 +64,7 @@
   gxv_mort_subtable_type0_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
   gxv_mort_subtable_type0_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
@@ -80,7 +80,7 @@
     FT_UNUSED( limit );
 
     FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] ); /* for the non-debugging */
     FT_UNUSED( limit );
 
     FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] ); /* for the non-debugging */
-    FT_UNUSED( glyphOffset );                    /* case                  */
+    FT_UNUSED( glyphOffset_p );                  /* case                  */
 
 
     markFirst   = (FT_UShort)( ( flags >> 15 ) & 1 );
 
 
     markFirst   = (FT_UShort)( ( flags >> 15 ) & 1 );
@@ -91,7 +91,7 @@
     verb     = (FT_UShort)( flags & 0x000F );
 
     GXV_TRACE(( "  IndicScript MorphRule for glyphOffset 0x%04x",
     verb     = (FT_UShort)( flags & 0x000F );
 
     GXV_TRACE(( "  IndicScript MorphRule for glyphOffset 0x%04x",
-                glyphOffset.u ));
+                glyphOffset_p->u ));
     GXV_TRACE(( " markFirst=%01d", markFirst ));
     GXV_TRACE(( " dontAdvance=%01d", dontAdvance ));
     GXV_TRACE(( " markLast=%01d", markLast ));
     GXV_TRACE(( " markFirst=%01d", markFirst ));
     GXV_TRACE(( " dontAdvance=%01d", dontAdvance ));
     GXV_TRACE(( " markLast=%01d", markLast ));
index 0575b12..696d850 100644 (file)
   gxv_mort_subtable_type1_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
   gxv_mort_subtable_type1_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     dontAdvance   = (FT_UShort)( ( flags >> 14 ) & 1      );
     reserved      = (FT_Short)(    flags         & 0x3FFF );
 
     dontAdvance   = (FT_UShort)( ( flags >> 14 ) & 1      );
     reserved      = (FT_Short)(    flags         & 0x3FFF );
 
-    markOffset    = (FT_Short)( glyphOffset.ul >> 16 );
-    currentOffset = (FT_Short)( glyphOffset.ul       );
+    markOffset    = (FT_Short)( glyphOffset_p->ul >> 16 );
+    currentOffset = (FT_Short)( glyphOffset_p->ul       );
 
     if ( 0 < reserved )
     {
 
     if ( 0 < reserved )
     {
 
       if ( dst_gid > valid->face->num_glyphs )
       {
 
       if ( dst_gid > valid->face->num_glyphs )
       {
-        GXV_TRACE(( "substTable include toolarge gid[%d]=%d >"
+        GXV_TRACE(( "substTable include too large gid[%d]=%d >"
                     " max defined gid #%d\n",
                     i, dst_gid, valid->face->num_glyphs ));
         if ( valid->root->level >= FT_VALIDATE_PARANOID )
                     " max defined gid #%d\n",
                     i, dst_gid, valid->face->num_glyphs ));
         if ( valid->root->level >= FT_VALIDATE_PARANOID )
index f19d15d..6f77cf3 100644 (file)
   gxv_mort_subtable_type2_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
   gxv_mort_subtable_type2_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_UShort offset;
 
     FT_UNUSED( state );
     FT_UShort offset;
 
     FT_UNUSED( state );
-    FT_UNUSED( glyphOffset );
+    FT_UNUSED( glyphOffset_p );
     FT_UNUSED( limit );
 
 
     FT_UNUSED( limit );
 
 
index a04bc1e..8347098 100644 (file)
 
   static void
   gxv_mort_subtable_type4_lookupval_validate( FT_UShort            glyph,
 
   static void
   gxv_mort_subtable_type4_lookupval_validate( FT_UShort            glyph,
-                                              GXV_LookupValueDesc  value,
+                                              GXV_LookupValueCPtr  value_p,
                                               GXV_Validator        valid )
   {
     FT_UNUSED( glyph );
 
                                               GXV_Validator        valid )
   {
     FT_UNUSED( glyph );
 
-    gxv_glyphid_validate( value.u, valid );
+    gxv_glyphid_validate( value_p->u, valid );
   }
 
   /*
   }
 
   /*
@@ -78,7 +78,7 @@
   static GXV_LookupValueDesc
   gxv_mort_subtable_type4_lookupfmt4_transit(
     FT_UShort            relative_gindex,
   static GXV_LookupValueDesc
   gxv_mort_subtable_type4_lookupfmt4_transit(
     FT_UShort            relative_gindex,
-    GXV_LookupValueDesc  base_value,
+    GXV_LookupValueCPtr  base_value_p,
     FT_Bytes             lookuptbl_limit,
     GXV_Validator        valid )
   {
     FT_Bytes             lookuptbl_limit,
     GXV_Validator        valid )
   {
@@ -88,7 +88,7 @@
     GXV_LookupValueDesc  value;
 
     /* XXX: check range? */
     GXV_LookupValueDesc  value;
 
     /* XXX: check range? */
-    offset = (FT_UShort)( base_value.u +
+    offset = (FT_UShort)( base_value_p->u +
                           relative_gindex * sizeof ( FT_UShort ) );
 
     p     = valid->lookuptbl_head + offset;
                           relative_gindex * sizeof ( FT_UShort ) );
 
     p     = valid->lookuptbl_head + offset;
index a7cabc3..ec0bcb6 100644 (file)
   gxv_mort_subtable_type5_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
   gxv_mort_subtable_type5_entry_validate(
     FT_Byte                         state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     currentInsertCount   = (FT_Byte)( ( flags >> 5 ) & 0x1F   );
     markedInsertCount    = (FT_Byte)(   flags        & 0x001F );
 
     currentInsertCount   = (FT_Byte)( ( flags >> 5 ) & 0x1F   );
     markedInsertCount    = (FT_Byte)(   flags        & 0x001F );
 
-    currentInsertList    = (FT_UShort)( glyphOffset.ul >> 16 );
-    markedInsertList     = (FT_UShort)( glyphOffset.ul       );
+    currentInsertList    = (FT_UShort)( glyphOffset->ul >> 16 );
+    markedInsertList     = (FT_UShort)( glyphOffset->ul       );
 
     if ( 0 != currentInsertList && 0 != currentInsertCount )
     {
 
     if ( 0 != currentInsertList && 0 != currentInsertCount )
     {
index 849d5e9..f8ba5b9 100644 (file)
@@ -4,7 +4,8 @@
 /*                                                                         */
 /*    TrueTypeGX/AAT morx table validation (body).                         */
 /*                                                                         */
 /*                                                                         */
 /*    TrueTypeGX/AAT morx table validation (body).                         */
 /*                                                                         */
-/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */
+/*  Copyright 2005, 2008 by                                                */
+/*  suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -68,8 +69,8 @@
       FT_ULong  length;
       FT_ULong  coverage;
       FT_ULong  subFeatureFlags;
       FT_ULong  length;
       FT_ULong  coverage;
       FT_ULong  subFeatureFlags;
-      FT_UInt   type;
-      FT_UInt   rest;
+      FT_ULong  type;
+      FT_ULong  rest;
 
 
       GXV_LIMIT_CHECK( 4 + 4 + 4 );
 
 
       GXV_LIMIT_CHECK( 4 + 4 + 4 );
     gxv_mort_featurearray_validate( p, limit, nFeatureFlags, valid );
     p += valid->subtable_length;
 
     gxv_mort_featurearray_validate( p, limit, nFeatureFlags, valid );
     p += valid->subtable_length;
 
-    if ( nSubtables >= 0x10000 )
+    if ( nSubtables >= 0x10000L )
       FT_INVALID_DATA;
 
     gxv_morx_subtables_validate( p, table + chainLength,
       FT_INVALID_DATA;
 
     gxv_morx_subtables_validate( p, table + chainLength,
index ca92b6c..0159c5a 100644 (file)
@@ -42,7 +42,7 @@
   gxv_morx_subtable_type0_entry_validate(
     FT_UShort                        state,
     FT_UShort                        flags,
   gxv_morx_subtable_type0_entry_validate(
     FT_UShort                        state,
     FT_UShort                        flags,
-    GXV_XStateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_XStateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                         table,
     FT_Bytes                         limit,
     GXV_Validator                    valid )
     FT_Bytes                         table,
     FT_Bytes                         limit,
     GXV_Validator                    valid )
@@ -54,7 +54,7 @@
     FT_UShort  verb;
 
     FT_UNUSED( state );
     FT_UShort  verb;
 
     FT_UNUSED( state );
-    FT_UNUSED( glyphOffset );
+    FT_UNUSED( glyphOffset_p );
     FT_UNUSED( table );
     FT_UNUSED( limit );
 
     FT_UNUSED( table );
     FT_UNUSED( limit );
 
index 331d4cc..e1c162f 100644 (file)
   gxv_morx_subtable_type1_entry_validate(
     FT_UShort                       state,
     FT_UShort                       flags,
   gxv_morx_subtable_type1_entry_validate(
     FT_UShort                       state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
 
     reserved = (FT_UShort)( flags & 0x3FFF );
 
 
     reserved = (FT_UShort)( flags & 0x3FFF );
 
-    markIndex    = (FT_Short)( glyphOffset.ul >> 16 );
-    currentIndex = (FT_Short)( glyphOffset.ul       );
+    markIndex    = (FT_Short)( glyphOffset_p->ul >> 16 );
+    currentIndex = (FT_Short)( glyphOffset_p->ul       );
 
     GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",
                 setMark, dontAdvance ));
 
     GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",
                 setMark, dontAdvance ));
 
   static void
   gxv_morx_subtable_type1_LookupValue_validate( FT_UShort            glyph,
 
   static void
   gxv_morx_subtable_type1_LookupValue_validate( FT_UShort            glyph,
-                                                GXV_LookupValueDesc  value,
+                                                GXV_LookupValueCPtr  value_p,
                                                 GXV_Validator        valid )
   {
     FT_UNUSED( glyph ); /* for the non-debugging case */
 
                                                 GXV_Validator        valid )
   {
     FT_UNUSED( glyph ); /* for the non-debugging case */
 
-    GXV_TRACE(( "morx subtable type1 subst.: %d -> %d\n", glyph, value.u ));
+    GXV_TRACE(( "morx subtable type1 subst.: %d -> %d\n", glyph, value_p->u ));
 
 
-    if ( value.u > valid->face->num_glyphs )
+    if ( value_p->u > valid->face->num_glyphs )
       FT_INVALID_GLYPH_ID;
   }
 
       FT_INVALID_GLYPH_ID;
   }
 
   static GXV_LookupValueDesc
   gxv_morx_subtable_type1_LookupFmt4_transit(
     FT_UShort            relative_gindex,
   static GXV_LookupValueDesc
   gxv_morx_subtable_type1_LookupFmt4_transit(
     FT_UShort            relative_gindex,
-    GXV_LookupValueDesc  base_value,
+    GXV_LookupValueCPtr  base_value_p,
     FT_Bytes             lookuptbl_limit,
     GXV_Validator        valid )
   {
     FT_Bytes             lookuptbl_limit,
     GXV_Validator        valid )
   {
     GXV_LookupValueDesc  value;
 
     /* XXX: check range? */
     GXV_LookupValueDesc  value;
 
     /* XXX: check range? */
-    offset = (FT_UShort)( base_value.u +
+    offset = (FT_UShort)( base_value_p->u +
                           relative_gindex * sizeof ( FT_UShort ) );
 
     p     = valid->lookuptbl_head + offset;
                           relative_gindex * sizeof ( FT_UShort ) );
 
     p     = valid->lookuptbl_head + offset;
index 5cad516..b4bb335 100644 (file)
   gxv_morx_subtable_type2_entry_validate(
     FT_UShort                       state,
     FT_UShort                       flags,
   gxv_morx_subtable_type2_entry_validate(
     FT_UShort                       state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     performAction  = (FT_UShort)( ( flags >> 13 ) & 1 );
 
     reserved       = (FT_UShort)( flags & 0x1FFF );
     performAction  = (FT_UShort)( ( flags >> 13 ) & 1 );
 
     reserved       = (FT_UShort)( flags & 0x1FFF );
-    ligActionIndex = glyphOffset.u;
+    ligActionIndex = glyphOffset_p->u;
 
     if ( reserved > 0 )
       GXV_TRACE(( "  reserved 14bit is non-zero\n" ));
 
     if ( reserved > 0 )
       GXV_TRACE(( "  reserved 14bit is non-zero\n" ));
index d911561..5e3a164 100644 (file)
   gxv_morx_subtable_type5_entry_validate(
     FT_UShort                       state,
     FT_UShort                       flags,
   gxv_morx_subtable_type5_entry_validate(
     FT_UShort                       state,
     FT_UShort                       flags,
-    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
+    GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     FT_Bytes                        table,
     FT_Bytes                        limit,
     GXV_Validator                   valid )
     currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F   );
     markedInsertCount  = (FT_Byte)(   flags        & 0x001F );
 
     currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F   );
     markedInsertCount  = (FT_Byte)(   flags        & 0x001F );
 
-    currentInsertList = (FT_Byte)  ( glyphOffset.ul >> 16 );
-    markedInsertList  = (FT_UShort)( glyphOffset.ul       );
+    currentInsertList = (FT_Byte)  ( glyphOffset_p->ul >> 16 );
+    markedInsertList  = (FT_UShort)( glyphOffset_p->ul       );
 
     if ( currentInsertList && 0 != currentInsertCount )
       gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
 
     if ( currentInsertList && 0 != currentInsertCount )
       gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
index 8d6fe66..e125060 100644 (file)
 
   static void
   gxv_opbd_LookupValue_validate( FT_UShort            glyph,
 
   static void
   gxv_opbd_LookupValue_validate( FT_UShort            glyph,
-                                 GXV_LookupValueDesc  value,
+                                 GXV_LookupValueCPtr  value_p,
                                  GXV_Validator        valid )
   {
     /* offset in LookupTable is measured from the head of opbd table */
                                  GXV_Validator        valid )
   {
     /* offset in LookupTable is measured from the head of opbd table */
-    FT_Bytes   p     = valid->root->base + value.u;
+    FT_Bytes   p     = valid->root->base + value_p->u;
     FT_Bytes   limit = valid->root->limit;
     FT_Short   delta_value;
     int        i;
 
 
     FT_Bytes   limit = valid->root->limit;
     FT_Short   delta_value;
     int        i;
 
 
-    if ( value.u < GXV_OPBD_DATA( valueOffset_min ) )
-      GXV_OPBD_DATA( valueOffset_min ) = value.u;
+    if ( value_p->u < GXV_OPBD_DATA( valueOffset_min ) )
+      GXV_OPBD_DATA( valueOffset_min ) = value_p->u;
 
     for ( i = 0; i < 4; i++ )
     {
 
     for ( i = 0; i < 4; i++ )
     {
 
   static GXV_LookupValueDesc
   gxv_opbd_LookupFmt4_transit( FT_UShort            relative_gindex,
 
   static GXV_LookupValueDesc
   gxv_opbd_LookupFmt4_transit( FT_UShort            relative_gindex,
-                               GXV_LookupValueDesc  base_value,
+                               GXV_LookupValueCPtr  base_value_p,
                                FT_Bytes             lookuptbl_limit,
                                GXV_Validator        valid )
   {
                                FT_Bytes             lookuptbl_limit,
                                GXV_Validator        valid )
   {
     FT_UNUSED( valid );
 
     /* XXX: check range? */
     FT_UNUSED( valid );
 
     /* XXX: check range? */
-    value.u = (FT_UShort)( base_value.u +
+    value.u = (FT_UShort)( base_value_p->u +
                            relative_gindex * 4 * sizeof ( FT_Short ) );
 
     return value;
                            relative_gindex * 4 * sizeof ( FT_Short ) );
 
     return value;
index 010eeda..66c3ab7 100644 (file)
 
   static void
   gxv_prop_LookupValue_validate( FT_UShort            glyph,
 
   static void
   gxv_prop_LookupValue_validate( FT_UShort            glyph,
-                                 GXV_LookupValueDesc  value,
+                                 GXV_LookupValueCPtr  value_p,
                                  GXV_Validator        valid )
   {
                                  GXV_Validator        valid )
   {
-    gxv_prop_property_validate( value.u, glyph, valid );
+    gxv_prop_property_validate( value_p->u, glyph, valid );
   }
 
 
   }
 
 
 
   static GXV_LookupValueDesc
   gxv_prop_LookupFmt4_transit( FT_UShort            relative_gindex,
 
   static GXV_LookupValueDesc
   gxv_prop_LookupFmt4_transit( FT_UShort            relative_gindex,
-                               GXV_LookupValueDesc  base_value,
+                               GXV_LookupValueCPtr  base_value_p,
                                FT_Bytes             lookuptbl_limit,
                                GXV_Validator        valid )
   {
                                FT_Bytes             lookuptbl_limit,
                                GXV_Validator        valid )
   {
     GXV_LookupValueDesc  value;
 
     /* XXX: check range? */
     GXV_LookupValueDesc  value;
 
     /* XXX: check range? */
-    offset = (FT_UShort)( base_value.u +
+    offset = (FT_UShort)( base_value_p->u +
                           relative_gindex * sizeof( FT_UShort ) );
     p      = valid->lookuptbl_head + offset;
     limit  = lookuptbl_limit;
                           relative_gindex * sizeof( FT_UShort ) );
     p      = valid->lookuptbl_head + offset;
     limit  = lookuptbl_limit;
index 432ee4e..df3fd15 100644 (file)
   {
     FT_Bytes          p = table;
     FT_Bytes          limit = 0;
   {
     FT_Bytes          p = table;
     FT_Bytes          limit = 0;
-    FT_UInt           table_size;
+    FT_Offset         table_size;
 
     GXV_ValidatorRec  validrec;
     GXV_Validator     valid = &validrec;
 
     GXV_ValidatorRec  validrec;
     GXV_Validator     valid = &validrec;
index 44ef94a..9fd098e 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += GXVALID_MODULE
 
 define GXVALID_MODULE
 FTMODULE_H_COMMANDS += GXVALID_MODULE
 
 define GXVALID_MODULE
-$(OPEN_DRIVER)gxv_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, gxv_module_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)gxvalid   $(ECHO_DRIVER_DESC)TrueTypeGX/AAT validation module$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)gxvalid   $(ECHO_DRIVER_DESC)TrueTypeGX/AAT validation module$(ECHO_DRIVER_DONE)
 endef
 
index 36f6a43..c53f9dd 100644 (file)
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: adler32.c,v 1.5 2007/06/01 06:56:17 wl Exp $ */
+/* @(#) $Id$ */
 
 #include "zlib.h"
 
 
 #include "zlib.h"
 
index af2022d..6f0c515 100644 (file)
@@ -8,7 +8,7 @@
 /*  parse compressed PCF fonts, as found with many X11 server              */
 /*  distributions.                                                         */
 /*                                                                         */
 /*  parse compressed PCF fonts, as found with many X11 server              */
 /*  distributions.                                                         */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006 by                              */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2009 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -25,7 +25,7 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_GZIP_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_GZIP_H
-#include <string.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
 
 
 #include FT_MODULE_ERRORS_H
 
 
 #include FT_MODULE_ERRORS_H
 
 #ifdef FT_CONFIG_OPTION_USE_ZLIB
 
 
 #ifdef FT_CONFIG_OPTION_USE_ZLIB
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "gzip code does not support PIC yet"
+#endif 
+
 #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
 
 #include <zlib.h>
 #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
 
 #include <zlib.h>
@@ -54,7 +58,9 @@
  /* original ZLib.                                                   */
 
 #define NO_DUMMY_DECL
  /* original ZLib.                                                   */
 
 #define NO_DUMMY_DECL
-#define MY_ZCALLOC
+#ifndef USE_ZLIB_ZCALLOC
+#define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutils.c */
+#endif
 
 #include "zlib.h"
 
 
 #include "zlib.h"
 
   }
 
 
   }
 
 
-#ifndef FT_CONFIG_OPTION_SYSTEM_ZLIB
+#if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )
 
   local voidpf
   zcalloc ( voidpf    opaque,
 
   local voidpf
   zcalloc ( voidpf    opaque,
     ft_gzip_free( (FT_Memory)opaque, ptr );
   }
 
     ft_gzip_free( (FT_Memory)opaque, ptr );
   }
 
-#endif /* !SYSTEM_ZLIB */
+#endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */
 
 
 /***************************************************************************/
 
 
 /***************************************************************************/
       if ( error )
         result = 0;
 
       if ( error )
         result = 0;
 
-      FT_Stream_Seek( stream, old_pos );
+      (void)FT_Stream_Seek( stream, old_pos );
     }
 
     return result;
     }
 
     return result;
index 3c39aca..ef53652 100644 (file)
@@ -366,6 +366,9 @@ z_streamp z             /* for messages */
     if (r == Z_DATA_ERROR)
       z->msg = (char*)"oversubscribed distance tree";
     else if (r == Z_BUF_ERROR) {
     if (r == Z_DATA_ERROR)
       z->msg = (char*)"oversubscribed distance tree";
     else if (r == Z_BUF_ERROR) {
+#if 0
+    {
+#endif
 #ifdef PKZIP_BUG_WORKAROUND
       r = Z_OK;
     }
 #ifdef PKZIP_BUG_WORKAROUND
       r = Z_OK;
     }
index 3ccc3a6..3abf0ba 100644 (file)
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: zconf.h,v 1.4 2007/06/01 06:56:17 wl Exp $ */
+/* @(#) $Id$ */
 
 #ifndef _ZCONF_H
 #define _ZCONF_H
 
 #ifndef _ZCONF_H
 #define _ZCONF_H
 #  define MSDOS
 #endif
 
 #  define MSDOS
 #endif
 
+/* WinCE doesn't have errno.h */
+#ifdef _WIN32_WCE
+#  define NO_ERRNO_H
+#endif
+
+
 /*
  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
  * than 64k bytes at a time (needed on systems with 16-bit int).
 /*
  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
  * than 64k bytes at a time (needed on systems with 16-bit int).
index 5ed2da0..7ad0c1f 100644 (file)
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: zutil.c,v 1.3 2006/04/29 07:31:16 wl Exp $ */
+/* @(#) $Id$ */
 
 #include "zutil.h"
 
 
 #include "zutil.h"
 
@@ -49,7 +49,7 @@ void zmemzero(dest, len)
 }
 #endif
 
 }
 #endif
 
-#ifdef __TURBOC__
+#if defined( MSDOS ) && defined( __TURBOC__ ) && !defined( MY_ZCALLOC )
 #if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
 /* Small and medium model in Turbo C are for now limited to near allocation
  * with reduced MAX_WBITS and MAX_MEM_LEVEL
 #if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
 /* Small and medium model in Turbo C are for now limited to near allocation
  * with reduced MAX_WBITS and MAX_MEM_LEVEL
@@ -126,10 +126,10 @@ void  zcfree (voidpf opaque, voidpf ptr)
     Assert(0, "zcfree: ptr not found");
 }
 #endif
     Assert(0, "zcfree: ptr not found");
 }
 #endif
-#endif /* __TURBOC__ */
+#endif /* MSDOS && __TURBOC__ */
 
 
 
 
-#if defined(M_I86) && !defined(__32BIT__)
+#if defined(M_I86) && !defined(__32BIT__) && !defined( MY_ZCALLOC )
 /* Microsoft C in 16-bit mode */
 
 #  define MY_ZCALLOC
 /* Microsoft C in 16-bit mode */
 
 #  define MY_ZCALLOC
index 8e3c69a..c9688cd 100644 (file)
@@ -8,7 +8,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
    subject to change. Applications should only use zlib.h.
  */
 
-/* @(#) $Id: zutil.h,v 1.6 2007/06/01 06:56:17 wl Exp $ */
+/* @(#) $Id$ */
 
 #ifndef _Z_UTIL_H
 #define _Z_UTIL_H
 
 #ifndef _Z_UTIL_H
 #define _Z_UTIL_H
index 45fbf7b..4f601a1 100644 (file)
@@ -8,7 +8,7 @@
 /*  be used to parse compressed PCF fonts, as found with many X11 server   */
 /*  distributions.                                                         */
 /*                                                                         */
 /*  be used to parse compressed PCF fonts, as found with many X11 server   */
 /*  distributions.                                                         */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006 by                                          */
+/*  Copyright 2004, 2005, 2006, 2009 by                                    */
 /*  Albert Chin-A-Young.                                                   */
 /*                                                                         */
 /*  Based on code in src/gzip/ftgzip.c, Copyright 2004 by                  */
 /*  Albert Chin-A-Young.                                                   */
 /*                                                                         */
 /*  Based on code in src/gzip/ftgzip.c, Copyright 2004 by                  */
@@ -27,8 +27,7 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_LZW_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_LZW_H
-#include <string.h>
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
 
 
 #include FT_MODULE_ERRORS_H
 
 
 #include FT_MODULE_ERRORS_H
 
 #ifdef FT_CONFIG_OPTION_USE_LZW
 
 
 #ifdef FT_CONFIG_OPTION_USE_LZW
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "lzw code does not support PIC yet"
+#endif 
+
 #include "ftzopen.h"
 
 
 #include "ftzopen.h"
 
 
index fc78315..8bc65c8 100644 (file)
@@ -8,7 +8,7 @@
 /*  be used to parse compressed PCF fonts, as found with many X11 server   */
 /*  distributions.                                                         */
 /*                                                                         */
 /*  be used to parse compressed PCF fonts, as found with many X11 server   */
 /*  distributions.                                                         */
 /*                                                                         */
-/*  Copyright 2005, 2006, 2007 by David Turner.                            */
+/*  Copyright 2005, 2006, 2007, 2009 by David Turner.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
     {
       FT_Memory  memory = state->memory;
       FT_Error   error;
     {
       FT_Memory  memory = state->memory;
       FT_Error   error;
-      FT_UInt    old_size = state->stack_size;
-      FT_UInt    new_size = old_size;
+      FT_Offset  old_size = state->stack_size;
+      FT_Offset  new_size = old_size;
 
       new_size = new_size + ( new_size >> 1 ) + 4;
 
 
       new_size = new_size + ( new_size >> 1 ) + 4;
 
 
           while ( code >= 256U )
           {
 
           while ( code >= 256U )
           {
+            if ( !state->prefix )
+              goto Eof;
+
             FTLZW_STACK_PUSH( state->suffix[code - 256] );
             code = state->prefix[code - 256];
           }
             FTLZW_STACK_PUSH( state->suffix[code - 256] );
             code = state->prefix[code - 256];
           }
index 9788114..f7d2936 100644 (file)
@@ -8,7 +8,7 @@
 /*  be used to parse compressed PCF fonts, as found with many X11 server   */
 /*  distributions.                                                         */
 /*                                                                         */
 /*  be used to parse compressed PCF fonts, as found with many X11 server   */
 /*  distributions.                                                         */
 /*                                                                         */
-/*  Copyright 2005, 2006, 2007 by David Turner.                            */
+/*  Copyright 2005, 2006, 2007, 2008 by David Turner.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -46,7 +46,7 @@
 #define LZW_MASK( n )     ( ( 1U << (n) ) - 1U )
 
 
 #define LZW_MASK( n )     ( ( 1U << (n) ) - 1U )
 
 
-  typedef enum
+  typedef enum  FT_LzwPhase_
   {
     FT_LZW_PHASE_START = 0,
     FT_LZW_PHASE_CODE,
   {
     FT_LZW_PHASE_START = 0,
     FT_LZW_PHASE_CODE,
    *    `free_ent', `num_bits' cannot grow larger than `max_bits'.
    */
 
    *    `free_ent', `num_bits' cannot grow larger than `max_bits'.
    */
 
-  typedef struct  _FT_LzwStateRec
+  typedef struct  FT_LzwStateRec_
   {
     FT_LzwPhase  phase;
     FT_Int       in_eof;
   {
     FT_LzwPhase  phase;
     FT_Int       in_eof;
     FT_Int       buf_offset;
     FT_Int       buf_size;
     FT_Bool      buf_clear;
     FT_Int       buf_offset;
     FT_Int       buf_size;
     FT_Bool      buf_clear;
-    FT_Int       buf_total;
+    FT_Offset    buf_total;
 
     FT_UInt      max_bits;    /* max code bits, from file header   */
     FT_Int       block_mode;  /* block mode flag, from file header */
 
     FT_UInt      max_bits;    /* max code bits, from file header   */
     FT_Int       block_mode;  /* block mode flag, from file header */
 
     FT_Byte*     stack;       /* character stack */
     FT_UInt      stack_top;
 
     FT_Byte*     stack;       /* character stack */
     FT_UInt      stack_top;
-    FT_UInt      stack_size;
+    FT_Offset    stack_size;
     FT_Byte      stack_0[FT_LZW_DEFAULT_STACK_SIZE]; /* minimize heap alloc */
 
     FT_Stream    source;      /* source stream */
     FT_Byte      stack_0[FT_LZW_DEFAULT_STACK_SIZE]; /* minimize heap alloc */
 
     FT_Stream    source;      /* source stream */
index 35a14c6..b457143 100644 (file)
@@ -16,7 +16,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) otvalid ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = otvbase otvcommn otvgdef otvgpos otvgsub otvjstf otvmod ;
+    _sources = otvbase otvcommn otvgdef otvgpos otvgsub otvjstf otvmod otvmath ;
   }
   else
   {
   }
   else
   {
index aa4db04..9cadde5 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += OTVALID_MODULE
 
 define OTVALID_MODULE
 FTMODULE_H_COMMANDS += OTVALID_MODULE
 
 define OTVALID_MODULE
-$(OPEN_DRIVER)otv_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, otv_module_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)otvalid   $(ECHO_DRIVER_DESC)OpenType validation module$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)otvalid   $(ECHO_DRIVER_DESC)OpenType validation module$(ECHO_DRIVER_DONE)
 endef
 
index 2f85f60..d5c2b75 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType validator for OpenType tables (body only).                  */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType validator for OpenType tables (body only).                  */
 /*                                                                         */
-/*  Copyright 2004 by                                                      */
+/*  Copyright 2004, 2007 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -25,6 +25,7 @@
 #include "otvgpos.c"
 #include "otvgsub.c"
 #include "otvjstf.c"
 #include "otvgpos.c"
 #include "otvgsub.c"
 #include "otvjstf.c"
+#include "otvmath.c"
 #include "otvmod.c"
 
 /* END */
 #include "otvmod.c"
 
 /* END */
index 38f030f..eb99b9c 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType table validation (specification only).                      */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType table validation (specification only).                      */
 /*                                                                         */
-/*  Copyright 2004 by                                                      */
+/*  Copyright 2004, 2008 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -42,6 +42,7 @@ FT_BEGIN_HEADER
   otv_GDEF_validate( FT_Bytes      table,
                      FT_Bytes      gsub,
                      FT_Bytes      gpos,
   otv_GDEF_validate( FT_Bytes      table,
                      FT_Bytes      gsub,
                      FT_Bytes      gpos,
+                     FT_UInt       glyph_count,
                      FT_Validator  valid );
 
   FT_LOCAL( void )
                      FT_Validator  valid );
 
   FT_LOCAL( void )
@@ -63,6 +64,11 @@ FT_BEGIN_HEADER
                      FT_UInt       glyph_count,
                      FT_Validator  valid );
 
                      FT_UInt       glyph_count,
                      FT_Validator  valid );
 
+  FT_LOCAL( void )
+  otv_MATH_validate( FT_Bytes      table,
+                     FT_UInt       glyph_count,
+                     FT_Validator  ftvalid );
+
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index 8ad2238..d742d2d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType BASE table validation (body).                               */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType BASE table validation (body).                               */
 /*                                                                         */
-/*  Copyright 2004 by                                                      */
+/*  Copyright 2004, 2007 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -62,7 +62,7 @@
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
     OTV_LIMIT_CHECK( 6 );
 
     if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
     OTV_LIMIT_CHECK( 6 );
 
     if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
 
     table_size = 6;
 
 
     table_size = 6;
 
index d94e4f3..a4f885b 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType common tables validation (body).                            */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType common tables validation (body).                            */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006 by                                          */
+/*  Copyright 2004, 2005, 2006, 2007 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
   FT_LOCAL_DEF( void )
   otv_Coverage_validate( FT_Bytes       table,
 
   FT_LOCAL_DEF( void )
   otv_Coverage_validate( FT_Bytes       table,
-                         OTV_Validator  valid )
+                         OTV_Validator  valid,
+                         FT_Int         expected_count )
   {
     FT_Bytes  p = table;
     FT_UInt   CoverageFormat;
   {
     FT_Bytes  p = table;
     FT_UInt   CoverageFormat;
+    FT_UInt   total = 0;
 
 
     OTV_NAME_ENTER( "Coverage" );
 
 
     OTV_NAME_ENTER( "Coverage" );
@@ -57,6 +59,7 @@
     case 1:     /* CoverageFormat1 */
       {
         FT_UInt  GlyphCount;
     case 1:     /* CoverageFormat1 */
       {
         FT_UInt  GlyphCount;
+        FT_UInt  i;
 
 
         GlyphCount = FT_NEXT_USHORT( p );
 
 
         GlyphCount = FT_NEXT_USHORT( p );
         OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
 
         OTV_LIMIT_CHECK( GlyphCount * 2 );        /* GlyphArray */
         OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
 
         OTV_LIMIT_CHECK( GlyphCount * 2 );        /* GlyphArray */
+
+        for ( i = 0; i < GlyphCount; ++i )
+        {
+          FT_UInt  gid;
+
+
+          gid = FT_NEXT_USHORT( p );
+          if ( gid >= valid->glyph_count )
+            FT_INVALID_GLYPH_ID;
+        }
+
+        total = GlyphCount;
       }
       break;
 
     case 2:     /* CoverageFormat2 */
       {
         FT_UInt  n, RangeCount;
       }
       break;
 
     case 2:     /* CoverageFormat2 */
       {
         FT_UInt  n, RangeCount;
-        FT_UInt  Start, End, StartCoverageIndex, total = 0, last = 0;
+        FT_UInt  Start, End, StartCoverageIndex, last = 0;
 
 
         RangeCount = FT_NEXT_USHORT( p );
 
 
         RangeCount = FT_NEXT_USHORT( p );
           if ( Start > End || StartCoverageIndex != total )
             FT_INVALID_DATA;
 
           if ( Start > End || StartCoverageIndex != total )
             FT_INVALID_DATA;
 
+          if ( End >= valid->glyph_count )
+            FT_INVALID_GLYPH_ID;
+
           if ( n > 0 && Start <= last )
             FT_INVALID_DATA;
 
           if ( n > 0 && Start <= last )
             FT_INVALID_DATA;
 
       FT_INVALID_FORMAT;
     }
 
       FT_INVALID_FORMAT;
     }
 
-    /* no need to check glyph indices used as input to coverage tables */
-    /* since even invalid glyph indices return a meaningful result     */
+    /* Generally, a coverage table offset has an associated count field.  */
+    /* The number of glyphs in the table should match this field.  If     */
+    /* there is no associated count, a value of -1 tells us not to check. */
+    if ( expected_count != -1 && (FT_UInt)expected_count != total )
+      FT_INVALID_DATA;
 
     OTV_EXIT;
   }
 
     OTV_EXIT;
   }
     {
     case 1:     /* ClassDefFormat1 */
       {
     {
     case 1:     /* ClassDefFormat1 */
       {
+        FT_UInt  StartGlyph;
         FT_UInt  GlyphCount;
 
 
         FT_UInt  GlyphCount;
 
 
-        p += 2;         /* skip StartGlyph */
-
-        OTV_LIMIT_CHECK( 2 );
+        OTV_LIMIT_CHECK( 4 );
 
 
+        StartGlyph = FT_NEXT_USHORT( p );
         GlyphCount = FT_NEXT_USHORT( p );
 
         OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
 
         OTV_LIMIT_CHECK( GlyphCount * 2 );    /* ClassValueArray */
         GlyphCount = FT_NEXT_USHORT( p );
 
         OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
 
         OTV_LIMIT_CHECK( GlyphCount * 2 );    /* ClassValueArray */
+
+        if ( StartGlyph + GlyphCount - 1 >= valid->glyph_count )
+          FT_INVALID_GLYPH_ID;
       }
       break;
 
       }
       break;
 
           if ( Start > End || ( n > 0 && Start <= last ) )
             FT_INVALID_DATA;
 
           if ( Start > End || ( n > 0 && Start <= last ) )
             FT_INVALID_DATA;
 
+          if ( End >= valid->glyph_count )
+            FT_INVALID_GLYPH_ID;
+
           last = End;
         }
       }
           last = End;
         }
       }
     EndSize     = FT_NEXT_USHORT( p );
     DeltaFormat = FT_NEXT_USHORT( p );
 
     EndSize     = FT_NEXT_USHORT( p );
     DeltaFormat = FT_NEXT_USHORT( p );
 
-    if ( DeltaFormat < 1 || DeltaFormat > 3 || EndSize < StartSize )
+    if ( DeltaFormat < 1 || DeltaFormat > 3 )
+      FT_INVALID_FORMAT;
+
+    if ( EndSize < StartSize )
       FT_INVALID_DATA;
 
     count = EndSize - StartSize + 1;
       FT_INVALID_DATA;
 
     count = EndSize - StartSize + 1;
 
     OTV_TRACE(( " (type %d)\n", LookupType ));
 
 
     OTV_TRACE(( " (type %d)\n", LookupType ));
 
-    if ( LookupType == 0 || LookupType >= valid->type_count )
+    if ( LookupType == 0 || LookupType > valid->type_count )
       FT_INVALID_DATA;
 
     validate = valid->type_funcs[LookupType - 1];
       FT_INVALID_DATA;
 
     validate = valid->type_funcs[LookupType - 1];
 
     OTV_TRACE(( " (Count = %d)\n", Count ));
 
 
     OTV_TRACE(( " (Count = %d)\n", Count ));
 
-    otv_Coverage_validate( table + Coverage, valid );
+    otv_Coverage_validate( table + Coverage, valid, Count );
 
     OTV_LIMIT_CHECK( Count * 2 );
 
 
     OTV_LIMIT_CHECK( Count * 2 );
 
       FT_INVALID_DATA;
 
     OTV_LIMIT_CHECK( ( Count1 - 1 ) * 2 + Count2 * 4 );
       FT_INVALID_DATA;
 
     OTV_LIMIT_CHECK( ( Count1 - 1 ) * 2 + Count2 * 4 );
+    p += ( Count1 - 1 ) * 2;
 
     for ( ; Count2 > 0; Count2-- )
     {
 
     for ( ; Count2 > 0; Count2-- )
     {
 
     OTV_TRACE(( " (ClassSetCount = %d)\n", ClassSetCount ));
 
 
     OTV_TRACE(( " (ClassSetCount = %d)\n", ClassSetCount ));
 
-    otv_Coverage_validate( table + Coverage, valid );
+    otv_Coverage_validate( table + Coverage, valid, -1 );
     otv_ClassDef_validate( table + ClassDef, valid );
 
     OTV_LIMIT_CHECK( ClassSetCount * 2 );
     otv_ClassDef_validate( table + ClassDef, valid );
 
     OTV_LIMIT_CHECK( ClassSetCount * 2 );
     OTV_LIMIT_CHECK( GlyphCount * 2 + Count * 4 );
 
     for ( count1 = GlyphCount; count1 > 0; count1-- )
     OTV_LIMIT_CHECK( GlyphCount * 2 + Count * 4 );
 
     for ( count1 = GlyphCount; count1 > 0; count1-- )
-      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid );
+      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );
 
     for ( ; Count > 0; Count-- )
     {
 
     for ( ; Count > 0; Count-- )
     {
 
     OTV_TRACE(( " (ChainClassSetCount = %d)\n", ChainClassSetCount ));
 
 
     OTV_TRACE(( " (ChainClassSetCount = %d)\n", ChainClassSetCount ));
 
-    otv_Coverage_validate( table + Coverage, valid );
+    otv_Coverage_validate( table + Coverage, valid, -1 );
 
     otv_ClassDef_validate( table + BacktrackClassDef,  valid );
     otv_ClassDef_validate( table + InputClassDef, valid );
 
     otv_ClassDef_validate( table + BacktrackClassDef,  valid );
     otv_ClassDef_validate( table + InputClassDef, valid );
     OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 );
 
     for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- )
     OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 );
 
     for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- )
-      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid );
+      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );
 
     InputGlyphCount = FT_NEXT_USHORT( p );
 
 
     InputGlyphCount = FT_NEXT_USHORT( p );
 
     OTV_LIMIT_CHECK( InputGlyphCount * 2 + 2 );
 
     for ( count1 = InputGlyphCount; count1 > 0; count1-- )
     OTV_LIMIT_CHECK( InputGlyphCount * 2 + 2 );
 
     for ( count1 = InputGlyphCount; count1 > 0; count1-- )
-      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid );
+      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );
 
     LookaheadGlyphCount = FT_NEXT_USHORT( p );
 
 
     LookaheadGlyphCount = FT_NEXT_USHORT( p );
 
     OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 );
 
     for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- )
     OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 );
 
     for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- )
-      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid );
+      otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );
 
     count2 = FT_NEXT_USHORT( p );
 
 
     count2 = FT_NEXT_USHORT( p );
 
index be6ac69..898887f 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType common tables validation (specification).                   */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType common tables validation (specification).                   */
 /*                                                                         */
-/*  Copyright 2004, 2005 by                                                */
+/*  Copyright 2004, 2005, 2007, 2009 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -85,27 +85,27 @@ FT_BEGIN_HEADER
               FT_INVALID_TOO_SHORT;                  \
           FT_END_STMNT
 
               FT_INVALID_TOO_SHORT;                  \
           FT_END_STMNT
 
-#define OTV_SIZE_CHECK( _size )                                        \
-          FT_BEGIN_STMNT                                               \
-            if ( _size > 0 && _size < table_size )                     \
-            {                                                          \
-              if ( valid->root->level == FT_VALIDATE_PARANOID )        \
-                FT_INVALID_OFFSET;                                     \
-              else                                                     \
-              {                                                        \
-                /* strip off `const' */                                \
-                FT_Byte*  pp = (FT_Byte*)_size ## _p;                  \
-                                                                       \
-                                                                       \
-                FT_TRACE3(( "\n"                                       \
-                            "Invalid offset to optional table `%s'!\n" \
-                            "Set to zero.\n"                           \
-                            "\n", #_size ));                           \
-                                                                       \
-                /* always assume 16bit entities */                     \
-                _size = pp[0] = pp[1] = 0;                             \
-              }                                                        \
-            }                                                          \
+#define OTV_SIZE_CHECK( _size )                                     \
+          FT_BEGIN_STMNT                                            \
+            if ( _size > 0 && _size < table_size )                  \
+            {                                                       \
+              if ( valid->root->level == FT_VALIDATE_PARANOID )     \
+                FT_INVALID_OFFSET;                                  \
+              else                                                  \
+              {                                                     \
+                /* strip off `const' */                             \
+                FT_Byte*  pp = (FT_Byte*)_size ## _p;               \
+                                                                    \
+                                                                    \
+                FT_TRACE3(( "\n"                                    \
+                            "Invalid offset to optional table `%s'" \
+                            " set to zero.\n"                       \
+                            "\n", #_size ));                        \
+                                                                    \
+                /* always assume 16bit entities */                  \
+                _size = pp[0] = pp[1] = 0;                          \
+              }                                                     \
+            }                                                       \
           FT_END_STMNT
 
 
           FT_END_STMNT
 
 
@@ -192,12 +192,12 @@ FT_BEGIN_HEADER
             valid->func[2]       = OTV_FUNC( z ); \
           FT_END_STMNT
 
             valid->func[2]       = OTV_FUNC( z ); \
           FT_END_STMNT
 
-#define OTV_INIT                do ; while ( 0 )
-#define OTV_ENTER               do ; while ( 0 )
-#define OTV_NAME_ENTER( name )  do ; while ( 0 )
-#define OTV_EXIT                do ; while ( 0 )
+#define OTV_INIT                do { } while ( 0 )
+#define OTV_ENTER               do { } while ( 0 )
+#define OTV_NAME_ENTER( name )  do { } while ( 0 )
+#define OTV_EXIT                do { } while ( 0 )
 
 
-#define OTV_TRACE( s )          do ; while ( 0 )
+#define OTV_TRACE( s )          do { } while ( 0 )
 
 #endif  /* !FT_DEBUG_LEVEL_TRACE */
 
 
 #endif  /* !FT_DEBUG_LEVEL_TRACE */
 
@@ -215,7 +215,8 @@ FT_BEGIN_HEADER
 
   FT_LOCAL( void )
   otv_Coverage_validate( FT_Bytes       table,
 
   FT_LOCAL( void )
   otv_Coverage_validate( FT_Bytes       table,
-                         OTV_Validator  valid );
+                         OTV_Validator  valid,
+                         FT_Int         expected_count );
 
   /* return first covered glyph */
   FT_LOCAL( FT_UInt )
 
   /* return first covered glyph */
   FT_LOCAL( FT_UInt )
index 7d24902..3633ad0 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType GDEF table validation (body).                               */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType GDEF table validation (body).                               */
 /*                                                                         */
-/*  Copyright 2004, 2005 by                                                */
+/*  Copyright 2004, 2005, 2007 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -61,7 +61,7 @@
 
     OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
 
 
     OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
 
-    otv_Coverage_validate( Coverage, valid );
+    otv_Coverage_validate( Coverage, valid, GlyphCount );
     if ( GlyphCount != otv_Coverage_get_count( Coverage ) )
       FT_INVALID_DATA;
 
     if ( GlyphCount != otv_Coverage_get_count( Coverage ) )
       FT_INVALID_DATA;
 
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
   /*************************************************************************/
   /*************************************************************************/
 
   /*************************************************************************/
   /*************************************************************************/
 
+  /* sets valid->glyph_count */
+
   FT_LOCAL_DEF( void )
   otv_GDEF_validate( FT_Bytes      table,
                      FT_Bytes      gsub,
                      FT_Bytes      gpos,
   FT_LOCAL_DEF( void )
   otv_GDEF_validate( FT_Bytes      table,
                      FT_Bytes      gsub,
                      FT_Bytes      gpos,
+                     FT_UInt       glyph_count,
                      FT_Validator  ftvalid )
   {
     OTV_ValidatorRec  validrec;
                      FT_Validator  ftvalid )
   {
     OTV_ValidatorRec  validrec;
     else
       table_size = 10;              /* OpenType < 1.2  */
 
     else
       table_size = 10;              /* OpenType < 1.2  */
 
+    valid->glyph_count = glyph_count;
+
     OTV_OPTIONAL_OFFSET( GlyphClassDef );
     OTV_SIZE_CHECK( GlyphClassDef );
     if ( GlyphClassDef )
     OTV_OPTIONAL_OFFSET( GlyphClassDef );
     OTV_SIZE_CHECK( GlyphClassDef );
     if ( GlyphClassDef )
index ed34705..49b4618 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType GPOS table validation (body).                               */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType GPOS table validation (body).                               */
 /*                                                                         */
-/*  Copyright 2002, 2004, 2005, 2006 by                                    */
+/*  Copyright 2002, 2004, 2005, 2006, 2007, 2008 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
     Array1     = FT_NEXT_USHORT( p );
     Array2     = FT_NEXT_USHORT( p );
 
     Array1     = FT_NEXT_USHORT( p );
     Array2     = FT_NEXT_USHORT( p );
 
-    otv_Coverage_validate( table + Coverage1, valid );
-    otv_Coverage_validate( table + Coverage2, valid );
+    otv_Coverage_validate( table + Coverage1, valid, -1 );
+    otv_Coverage_validate( table + Coverage2, valid, -1 );
 
     otv_MarkArray_validate( table + Array1, valid );
 
 
     otv_MarkArray_validate( table + Array1, valid );
 
 #endif
 
     if ( format >= 0x100 )
 #endif
 
     if ( format >= 0x100 )
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
 
     for ( count = 4; count > 0; count-- )
     {
 
     for ( count = 4; count > 0; count-- )
     {
     {
       if ( format & 1 )
       {
     {
       if ( format & 1 )
       {
-        FT_UInt   table_size;
+        FT_PtrDist  table_size;
 
         OTV_OPTIONAL_TABLE( device );
 
 
         OTV_OPTIONAL_TABLE( device );
 
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
         Coverage    = FT_NEXT_USHORT( p );
         ValueFormat = FT_NEXT_USHORT( p );
 
         Coverage    = FT_NEXT_USHORT( p );
         ValueFormat = FT_NEXT_USHORT( p );
 
-        otv_Coverage_validate( table + Coverage, valid );
+        otv_Coverage_validate( table + Coverage, valid, -1 );
         otv_ValueRecord_validate( p, ValueFormat, valid ); /* Value */
       }
       break;
         otv_ValueRecord_validate( p, ValueFormat, valid ); /* Value */
       }
       break;
 
         len_value = otv_value_length( ValueFormat );
 
 
         len_value = otv_value_length( ValueFormat );
 
-        otv_Coverage_validate( table + Coverage, valid );
+        otv_Coverage_validate( table + Coverage, valid, ValueCount );
 
         OTV_LIMIT_CHECK( ValueCount * len_value );
 
 
         OTV_LIMIT_CHECK( ValueCount * len_value );
 
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
 
         OTV_TRACE(( " (PairSetCount = %d)\n", PairSetCount ));
 
 
         OTV_TRACE(( " (PairSetCount = %d)\n", PairSetCount ));
 
-        otv_Coverage_validate( table + Coverage, valid );
+        otv_Coverage_validate( table + Coverage, valid, -1 );
 
         OTV_LIMIT_CHECK( PairSetCount * 2 );
 
 
         OTV_LIMIT_CHECK( PairSetCount * 2 );
 
         len_value1 = otv_value_length( ValueFormat1 );
         len_value2 = otv_value_length( ValueFormat2 );
 
         len_value1 = otv_value_length( ValueFormat1 );
         len_value2 = otv_value_length( ValueFormat2 );
 
-        otv_Coverage_validate( table + Coverage, valid );
+        otv_Coverage_validate( table + Coverage, valid, -1 );
         otv_ClassDef_validate( table + ClassDef1, valid );
         otv_ClassDef_validate( table + ClassDef2, valid );
 
         otv_ClassDef_validate( table + ClassDef1, valid );
         otv_ClassDef_validate( table + ClassDef2, valid );
 
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
 
         OTV_TRACE(( " (EntryExitCount = %d)\n", EntryExitCount ));
 
 
         OTV_TRACE(( " (EntryExitCount = %d)\n", EntryExitCount ));
 
-        otv_Coverage_validate( table + Coverage, valid );
+        otv_Coverage_validate( table + Coverage, valid, EntryExitCount );
 
         OTV_LIMIT_CHECK( EntryExitCount * 4 );
 
 
         OTV_LIMIT_CHECK( EntryExitCount * 4 );
 
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
   /*************************************************************************/
   /*************************************************************************/
 
   /*************************************************************************/
   /*************************************************************************/
 
-  /* sets valid->extra2 (0) */
+  /* UNDOCUMENTED (in OpenType 1.5):              */
+  /* BaseRecord tables can contain NULL pointers. */
+
+  /* sets valid->extra2 (1) */
 
   static void
   otv_MarkBasePos_validate( FT_Bytes       table,
 
   static void
   otv_MarkBasePos_validate( FT_Bytes       table,
     switch ( PosFormat )
     {
     case 1:
     switch ( PosFormat )
     {
     case 1:
-      valid->extra2 = 0;
+      valid->extra2 = 1;
       OTV_NEST2( MarkBasePosFormat1, BaseArray );
       OTV_RUN( table, valid );
       break;
 
     default:
       OTV_NEST2( MarkBasePosFormat1, BaseArray );
       OTV_RUN( table, valid );
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
     {
     case 1:     /* ExtensionPosFormat1 */
       {
     {
     case 1:     /* ExtensionPosFormat1 */
       {
-        FT_UInt            ExtensionLookupType, ExtensionOffset;
+        FT_UInt            ExtensionLookupType;
+        FT_ULong           ExtensionOffset;
         OTV_Validate_Func  validate;
 
 
         OTV_Validate_Func  validate;
 
 
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
     OTV_LIMIT_CHECK( 10 );
 
     if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
     OTV_LIMIT_CHECK( 10 );
 
     if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
 
     ScriptList  = FT_NEXT_USHORT( p );
     FeatureList = FT_NEXT_USHORT( p );
 
     ScriptList  = FT_NEXT_USHORT( p );
     FeatureList = FT_NEXT_USHORT( p );
index 91dae0b..ed499d1 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType GSUB table validation (body).                               */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType GSUB table validation (body).                               */
 /*                                                                         */
-/*  Copyright 2004, 2005 by                                                */
+/*  Copyright 2004, 2005, 2007 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -68,7 +68,7 @@
         Coverage     = table + FT_NEXT_USHORT( p );
         DeltaGlyphID = FT_NEXT_SHORT( p );
 
         Coverage     = table + FT_NEXT_USHORT( p );
         DeltaGlyphID = FT_NEXT_SHORT( p );
 
-        otv_Coverage_validate( Coverage, valid );
+        otv_Coverage_validate( Coverage, valid, -1 );
 
         idx = otv_Coverage_get_first( Coverage ) + DeltaGlyphID;
         if ( idx < 0 )
 
         idx = otv_Coverage_get_first( Coverage ) + DeltaGlyphID;
         if ( idx < 0 )
 
         OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
 
 
         OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
 
-        otv_Coverage_validate( table + Coverage, valid );
+        otv_Coverage_validate( table + Coverage, valid, GlyphCount );
 
         OTV_LIMIT_CHECK( GlyphCount * 2 );
 
         /* Substitute */
         for ( ; GlyphCount > 0; GlyphCount-- )
           if ( FT_NEXT_USHORT( p ) >= valid->glyph_count )
 
         OTV_LIMIT_CHECK( GlyphCount * 2 );
 
         /* Substitute */
         for ( ; GlyphCount > 0; GlyphCount-- )
           if ( FT_NEXT_USHORT( p ) >= valid->glyph_count )
-            FT_INVALID_DATA;
+            FT_INVALID_GLYPH_ID;
       }
       break;
 
     default:
       }
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
     {
     case 1:     /* ExtensionSubstFormat1 */
       {
     {
     case 1:     /* ExtensionSubstFormat1 */
       {
-        FT_UInt            ExtensionLookupType, ExtensionOffset;
+        FT_UInt            ExtensionLookupType;
+        FT_ULong           ExtensionOffset;
         OTV_Validate_Func  validate;
 
 
         OTV_Validate_Func  validate;
 
 
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
 
       OTV_TRACE(( " (BacktrackGlyphCount = %d)\n", BacktrackGlyphCount ));
 
 
       OTV_TRACE(( " (BacktrackGlyphCount = %d)\n", BacktrackGlyphCount ));
 
-      otv_Coverage_validate( Coverage, valid );
+      otv_Coverage_validate( Coverage, valid, -1 );
 
       OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 );
 
       for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- )
 
       OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 );
 
       for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- )
-        otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid );
+        otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );
 
       LookaheadGlyphCount = FT_NEXT_USHORT( p );
 
 
       LookaheadGlyphCount = FT_NEXT_USHORT( p );
 
       OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 );
 
       for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- )
       OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 );
 
       for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- )
-        otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid );
+        otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 );
 
       GlyphCount = FT_NEXT_USHORT( p );
 
 
       GlyphCount = FT_NEXT_USHORT( p );
 
       break;
 
     default:
       break;
 
     default:
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
     }
 
     OTV_EXIT;
     }
 
     OTV_EXIT;
     OTV_LIMIT_CHECK( 10 );
 
     if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
     OTV_LIMIT_CHECK( 10 );
 
     if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
 
     ScriptList  = FT_NEXT_USHORT( p );
     FeatureList = FT_NEXT_USHORT( p );
 
     ScriptList  = FT_NEXT_USHORT( p );
     FeatureList = FT_NEXT_USHORT( p );
index 80b8dd6..a616a23 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType JSTF table validation (body).                               */
 /*                                                                         */
 /*                                                                         */
 /*    OpenType JSTF table validation (body).                               */
 /*                                                                         */
-/*  Copyright 2004 by                                                      */
+/*  Copyright 2004, 2007 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
     OTV_LIMIT_CHECK( 6 );
 
     if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
     OTV_LIMIT_CHECK( 6 );
 
     if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
-      FT_INVALID_DATA;
+      FT_INVALID_FORMAT;
 
     JstfScriptCount = FT_NEXT_USHORT( p );
 
 
     JstfScriptCount = FT_NEXT_USHORT( p );
 
diff --git a/reactos/lib/3rdparty/freetype/src/otvalid/otvmath.c b/reactos/lib/3rdparty/freetype/src/otvalid/otvmath.c
new file mode 100644 (file)
index 0000000..50ed10c
--- /dev/null
@@ -0,0 +1,452 @@
+/***************************************************************************/
+/*                                                                         */
+/*  otvmath.c                                                              */
+/*                                                                         */
+/*    OpenType MATH table validation (body).                               */
+/*                                                                         */
+/*  Copyright 2007, 2008 by                                                */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  Written by George Williams.                                            */
+/*                                                                         */
+/*  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 "otvalid.h"
+#include "otvcommn.h"
+#include "otvgpos.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_otvmath
+
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                  MATH TYPOGRAPHIC CONSTANTS                   *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  static void
+  otv_MathConstants_validate( FT_Bytes       table,
+                              OTV_Validator  valid )
+  {
+    FT_Bytes  p = table;
+    FT_UInt   i;
+    FT_UInt   table_size;
+
+    OTV_OPTIONAL_TABLE( DeviceTableOffset );
+
+
+    OTV_NAME_ENTER( "MathConstants" );
+
+    /* 56 constants, 51 have device tables */
+    OTV_LIMIT_CHECK( 2 * ( 56 + 51 ) );
+    table_size = 2 * ( 56 + 51 );
+
+    p += 4 * 2;                 /* First 4 constants have no device tables */
+    for ( i = 0; i < 51; ++i )
+    {
+      p += 2;                                            /* skip the value */
+      OTV_OPTIONAL_OFFSET( DeviceTableOffset );
+      OTV_SIZE_CHECK( DeviceTableOffset );
+      if ( DeviceTableOffset )
+        otv_Device_validate( table + DeviceTableOffset, valid );
+    }
+
+    OTV_EXIT;
+  }
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                   MATH ITALICS CORRECTION                     *****/
+  /*****                 MATH TOP ACCENT ATTACHMENT                    *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  static void
+  otv_MathItalicsCorrectionInfo_validate( FT_Bytes       table,
+                                          OTV_Validator  valid,
+                                          FT_Int         isItalic )
+  {
+    FT_Bytes  p = table;
+    FT_UInt   i, cnt, table_size ;
+
+    OTV_OPTIONAL_TABLE( Coverage );
+    OTV_OPTIONAL_TABLE( DeviceTableOffset );
+
+    FT_UNUSED( isItalic );  /* only used if tracing is active */
+
+
+    OTV_NAME_ENTER( isItalic ? "MathItalicsCorrectionInfo"
+                             : "MathTopAccentAttachment" );
+
+    OTV_LIMIT_CHECK( 4 );
+
+    OTV_OPTIONAL_OFFSET( Coverage );
+    cnt = FT_NEXT_USHORT( p );
+
+    OTV_LIMIT_CHECK( 4 * cnt );
+    table_size = 4 + 4 * cnt;
+
+    OTV_SIZE_CHECK( Coverage );
+    otv_Coverage_validate( table + Coverage, valid, cnt );
+
+    for ( i = 0; i < cnt; ++i )
+    {
+      p += 2;                                            /* Skip the value */
+      OTV_OPTIONAL_OFFSET( DeviceTableOffset );
+      OTV_SIZE_CHECK( DeviceTableOffset );
+      if ( DeviceTableOffset )
+        otv_Device_validate( table + DeviceTableOffset, valid );
+    }
+
+    OTV_EXIT;
+  }
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                           MATH KERNING                        *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  static void
+  otv_MathKern_validate( FT_Bytes       table,
+                         OTV_Validator  valid )
+  {
+    FT_Bytes  p = table;
+    FT_UInt   i, cnt, table_size;
+
+    OTV_OPTIONAL_TABLE( DeviceTableOffset );
+
+
+    /* OTV_NAME_ENTER( "MathKern" );*/
+
+    OTV_LIMIT_CHECK( 2 );
+
+    cnt = FT_NEXT_USHORT( p );
+
+    OTV_LIMIT_CHECK( 4 * cnt + 2 );
+    table_size = 4 + 4 * cnt;
+
+    /* Heights */
+    for ( i = 0; i < cnt; ++i )
+    {
+      p += 2;                                            /* Skip the value */
+      OTV_OPTIONAL_OFFSET( DeviceTableOffset );
+      OTV_SIZE_CHECK( DeviceTableOffset );
+      if ( DeviceTableOffset )
+        otv_Device_validate( table + DeviceTableOffset, valid );
+    }
+
+    /* One more Kerning value */
+    for ( i = 0; i < cnt + 1; ++i )
+    {
+      p += 2;                                            /* Skip the value */
+      OTV_OPTIONAL_OFFSET( DeviceTableOffset );
+      OTV_SIZE_CHECK( DeviceTableOffset );
+      if ( DeviceTableOffset )
+        otv_Device_validate( table + DeviceTableOffset, valid );
+    }
+
+    OTV_EXIT;
+  }
+
+
+  static void
+  otv_MathKernInfo_validate( FT_Bytes       table,
+                             OTV_Validator  valid )
+  {
+    FT_Bytes  p = table;
+    FT_UInt   i, j, cnt, table_size;
+
+    OTV_OPTIONAL_TABLE( Coverage );
+    OTV_OPTIONAL_TABLE( MKRecordOffset );
+
+
+    OTV_NAME_ENTER( "MathKernInfo" );
+
+    OTV_LIMIT_CHECK( 4 );
+
+    OTV_OPTIONAL_OFFSET( Coverage );
+    cnt = FT_NEXT_USHORT( p );
+
+    OTV_LIMIT_CHECK( 8 * cnt );
+    table_size = 4 + 8 * cnt;
+
+    OTV_SIZE_CHECK( Coverage );
+    otv_Coverage_validate( table + Coverage, valid, cnt );
+
+    for ( i = 0; i < cnt; ++i )
+    {
+      for ( j = 0; j < 4; ++j )
+      {
+        OTV_OPTIONAL_OFFSET( MKRecordOffset );
+        OTV_SIZE_CHECK( MKRecordOffset );
+        if ( MKRecordOffset )
+          otv_MathKern_validate( table + MKRecordOffset, valid );
+      }
+    }
+
+    OTV_EXIT;
+  }
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                         MATH GLYPH INFO                       *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  static void
+  otv_MathGlyphInfo_validate( FT_Bytes       table,
+                              OTV_Validator  valid )
+  {
+    FT_Bytes  p = table;
+    FT_UInt   MathItalicsCorrectionInfo, MathTopAccentAttachment;
+    FT_UInt   ExtendedShapeCoverage, MathKernInfo;
+
+
+    OTV_NAME_ENTER( "MathGlyphInfo" );
+
+    OTV_LIMIT_CHECK( 8 );
+
+    MathItalicsCorrectionInfo = FT_NEXT_USHORT( p );
+    MathTopAccentAttachment   = FT_NEXT_USHORT( p );
+    ExtendedShapeCoverage     = FT_NEXT_USHORT( p );
+    MathKernInfo              = FT_NEXT_USHORT( p );
+
+    if ( MathItalicsCorrectionInfo )
+      otv_MathItalicsCorrectionInfo_validate(
+        table + MathItalicsCorrectionInfo, valid, TRUE );
+
+    /* Italic correction and Top Accent Attachment have the same format */
+    if ( MathTopAccentAttachment )
+      otv_MathItalicsCorrectionInfo_validate(
+        table + MathTopAccentAttachment, valid, FALSE );
+
+    if ( ExtendedShapeCoverage ) {
+      OTV_NAME_ENTER( "ExtendedShapeCoverage" );
+      otv_Coverage_validate( table + ExtendedShapeCoverage, valid, -1 );
+      OTV_EXIT;
+    }
+
+    if ( MathKernInfo )
+      otv_MathKernInfo_validate( table + MathKernInfo, valid );
+
+    OTV_EXIT;
+  }
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                    MATH GLYPH CONSTRUCTION                    *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  static void
+  otv_GlyphAssembly_validate( FT_Bytes       table,
+                              OTV_Validator  valid )
+  {
+    FT_Bytes  p = table;
+    FT_UInt   pcnt, table_size;
+    FT_UInt   i;
+
+    OTV_OPTIONAL_TABLE( DeviceTableOffset );
+
+
+    /* OTV_NAME_ENTER( "GlyphAssembly" ); */
+
+    OTV_LIMIT_CHECK( 6 );
+
+    p += 2;                           /* Skip the Italics Correction value */
+    OTV_OPTIONAL_OFFSET( DeviceTableOffset );
+    pcnt = FT_NEXT_USHORT( p );
+
+    OTV_LIMIT_CHECK( 8 * pcnt );
+    table_size = 6 + 8 * pcnt;
+
+    OTV_SIZE_CHECK( DeviceTableOffset );
+    if ( DeviceTableOffset )
+      otv_Device_validate( table + DeviceTableOffset, valid );
+
+    for ( i = 0; i < pcnt; ++i )
+    {
+      FT_UInt  gid;
+
+
+      gid = FT_NEXT_USHORT( p );
+      if ( gid >= valid->glyph_count )
+        FT_INVALID_GLYPH_ID;
+      p += 2*4;             /* skip the Start, End, Full, and Flags fields */
+    }
+
+    /* OTV_EXIT; */
+  }
+
+
+  static void
+  otv_MathGlyphConstruction_validate( FT_Bytes       table,
+                                      OTV_Validator  valid )
+  {
+    FT_Bytes  p = table;
+    FT_UInt   vcnt, table_size;
+    FT_UInt   i;
+
+    OTV_OPTIONAL_TABLE( GlyphAssembly );
+
+
+    /* OTV_NAME_ENTER( "MathGlyphConstruction" ); */
+
+    OTV_LIMIT_CHECK( 4 );
+
+    OTV_OPTIONAL_OFFSET( GlyphAssembly );
+    vcnt = FT_NEXT_USHORT( p );
+
+    OTV_LIMIT_CHECK( 4 * vcnt );
+    table_size = 4 + 4 * vcnt;
+
+    for ( i = 0; i < vcnt; ++i )
+    {
+      FT_UInt  gid;
+
+
+      gid = FT_NEXT_USHORT( p );
+      if ( gid >= valid->glyph_count )
+        FT_INVALID_GLYPH_ID;
+      p += 2;                          /* skip the size */
+    }
+
+    OTV_SIZE_CHECK( GlyphAssembly );
+    if ( GlyphAssembly )
+      otv_GlyphAssembly_validate( table+GlyphAssembly, valid );
+
+    /* OTV_EXIT; */
+  }
+
+
+  static void
+  otv_MathVariants_validate( FT_Bytes       table,
+                             OTV_Validator  valid )
+  {
+    FT_Bytes  p = table;
+    FT_UInt   vcnt, hcnt, i, table_size;
+
+    OTV_OPTIONAL_TABLE( VCoverage );
+    OTV_OPTIONAL_TABLE( HCoverage );
+    OTV_OPTIONAL_TABLE( Offset );
+
+
+    OTV_NAME_ENTER( "MathVariants" );
+
+    OTV_LIMIT_CHECK( 10 );
+
+    p += 2;                       /* Skip the MinConnectorOverlap constant */
+    OTV_OPTIONAL_OFFSET( VCoverage );
+    OTV_OPTIONAL_OFFSET( HCoverage );
+    vcnt = FT_NEXT_USHORT( p );
+    hcnt = FT_NEXT_USHORT( p );
+
+    OTV_LIMIT_CHECK( 2 * vcnt + 2 * hcnt );
+    table_size = 10 + 2 * vcnt + 2 * hcnt;
+
+    OTV_SIZE_CHECK( VCoverage );
+    if ( VCoverage )
+      otv_Coverage_validate( table + VCoverage, valid, vcnt );
+
+    OTV_SIZE_CHECK( HCoverage );
+    if ( HCoverage )
+      otv_Coverage_validate( table + HCoverage, valid, hcnt );
+
+    for ( i = 0; i < vcnt; ++i )
+    {
+      OTV_OPTIONAL_OFFSET( Offset );
+      OTV_SIZE_CHECK( Offset );
+      otv_MathGlyphConstruction_validate( table + Offset, valid );
+    }
+
+    for ( i = 0; i < hcnt; ++i )
+    {
+      OTV_OPTIONAL_OFFSET( Offset );
+      OTV_SIZE_CHECK( Offset );
+      otv_MathGlyphConstruction_validate( table + Offset, valid );
+    }
+
+    OTV_EXIT;
+  }
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                          MATH TABLE                           *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /* sets valid->glyph_count */
+
+  FT_LOCAL_DEF( void )
+  otv_MATH_validate( FT_Bytes      table,
+                     FT_UInt       glyph_count,
+                     FT_Validator  ftvalid )
+  {
+    OTV_ValidatorRec  validrec;
+    OTV_Validator     valid = &validrec;
+    FT_Bytes          p     = table;
+    FT_UInt           MathConstants, MathGlyphInfo, MathVariants;
+
+
+    valid->root = ftvalid;
+
+    FT_TRACE3(( "validating MATH table\n" ));
+    OTV_INIT;
+
+    OTV_LIMIT_CHECK( 10 );
+
+    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
+      FT_INVALID_FORMAT;
+
+    MathConstants = FT_NEXT_USHORT( p );
+    MathGlyphInfo = FT_NEXT_USHORT( p );
+    MathVariants  = FT_NEXT_USHORT( p );
+
+    valid->glyph_count = glyph_count;
+
+    otv_MathConstants_validate( table + MathConstants,
+                                valid );
+    otv_MathGlyphInfo_validate( table + MathGlyphInfo,
+                                valid );
+    otv_MathVariants_validate ( table + MathVariants,
+                                valid );
+
+    FT_TRACE4(( "\n" ));
+  }
+
+
+/* END */
index 157272f..3248564 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType's OpenType validation module implementation (body).         */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType's OpenType validation module implementation (body).         */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006 by                                          */
+/*  Copyright 2004, 2005, 2006, 2007, 2008 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
     FT_Byte* volatile         gpos;
     FT_Byte* volatile         gsub;
     FT_Byte* volatile         jstf;
     FT_Byte* volatile         gpos;
     FT_Byte* volatile         gsub;
     FT_Byte* volatile         jstf;
+    FT_Byte* volatile         math;
     FT_ULong                  len_base, len_gdef, len_gpos, len_gsub, len_jstf;
     FT_ULong                  len_base, len_gdef, len_gpos, len_gsub, len_jstf;
+    FT_ULong                  len_math;
+    FT_UInt                   num_glyphs = (FT_UInt)face->num_glyphs;
     FT_ValidatorRec volatile  valid;
 
 
     FT_ValidatorRec volatile  valid;
 
 
-    base     = gdef     = gpos     = gsub     = jstf     = NULL;
-    len_base = len_gdef = len_gpos = len_gsub = len_jstf = 0;
+    base     = gdef     = gpos     = gsub     = jstf     = math     = NULL;
+    len_base = len_gdef = len_gpos = len_gsub = len_jstf = len_math = 0;
+
+    /*
+     * XXX: OpenType tables cannot handle 32-bit glyph index,
+     *      although broken TrueType can have 32-bit glyph index.
+     */
+    if ( face->num_glyphs > 0xFFFFL )
+    {
+      FT_TRACE1(( "otv_validate: Invalid glyphs index (0x0000FFFF - 0x%08x) ",
+                  face->num_glyphs ));
+      FT_TRACE1(( "are not handled by OpenType tables\n" ));
+      num_glyphs = 0xFFFF;
+    }
 
     /* load tables */
 
 
     /* load tables */
 
         goto Exit;
     }
 
         goto Exit;
     }
 
+    if ( ot_flags & FT_VALIDATE_MATH )
+    {
+      error = otv_load_table( face, TTAG_MATH, &math, &len_math );
+      if ( error )
+        goto Exit;
+    }
+
     /* validate tables */
 
     if ( base )
     /* validate tables */
 
     if ( base )
     {
       ft_validator_init( &valid, gpos, gpos + len_gpos, FT_VALIDATE_DEFAULT );
       if ( ft_setjmp( valid.jump_buffer ) == 0 )
     {
       ft_validator_init( &valid, gpos, gpos + len_gpos, FT_VALIDATE_DEFAULT );
       if ( ft_setjmp( valid.jump_buffer ) == 0 )
-        otv_GPOS_validate( gpos, face->num_glyphs, &valid );
+        otv_GPOS_validate( gpos, num_glyphs, &valid );
       error = valid.error;
       if ( error )
         goto Exit;
       error = valid.error;
       if ( error )
         goto Exit;
     {
       ft_validator_init( &valid, gsub, gsub + len_gsub, FT_VALIDATE_DEFAULT );
       if ( ft_setjmp( valid.jump_buffer ) == 0 )
     {
       ft_validator_init( &valid, gsub, gsub + len_gsub, FT_VALIDATE_DEFAULT );
       if ( ft_setjmp( valid.jump_buffer ) == 0 )
-        otv_GSUB_validate( gsub, face->num_glyphs, &valid );
+        otv_GSUB_validate( gsub, num_glyphs, &valid );
       error = valid.error;
       if ( error )
         goto Exit;
       error = valid.error;
       if ( error )
         goto Exit;
     {
       ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT );
       if ( ft_setjmp( valid.jump_buffer ) == 0 )
     {
       ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT );
       if ( ft_setjmp( valid.jump_buffer ) == 0 )
-        otv_GDEF_validate( gdef, gsub, gpos, &valid );
+        otv_GDEF_validate( gdef, gsub, gpos, num_glyphs, &valid );
       error = valid.error;
       if ( error )
         goto Exit;
       error = valid.error;
       if ( error )
         goto Exit;
     {
       ft_validator_init( &valid, jstf, jstf + len_jstf, FT_VALIDATE_DEFAULT );
       if ( ft_setjmp( valid.jump_buffer ) == 0 )
     {
       ft_validator_init( &valid, jstf, jstf + len_jstf, FT_VALIDATE_DEFAULT );
       if ( ft_setjmp( valid.jump_buffer ) == 0 )
-        otv_JSTF_validate( jstf, gsub, gpos, face->num_glyphs, &valid );
+        otv_JSTF_validate( jstf, gsub, gpos, num_glyphs, &valid );
+      error = valid.error;
+      if ( error )
+        goto Exit;
+    }
+
+    if ( math )
+    {
+      ft_validator_init( &valid, math, math + len_math, FT_VALIDATE_DEFAULT );
+      if ( ft_setjmp( valid.jump_buffer ) == 0 )
+        otv_MATH_validate( math, num_glyphs, &valid );
       error = valid.error;
       if ( error )
         goto Exit;
       error = valid.error;
       if ( error )
         goto Exit;
       FT_FREE( gsub );
       FT_FREE( jstf );
     }
       FT_FREE( gsub );
       FT_FREE( jstf );
     }
+    {
+      FT_Memory  memory = FT_FACE_MEMORY( face );
+
+
+      FT_FREE( math );                 /* Can't return this as API is frozen */
+    }
 
     return error;
   }
 
     return error;
   }
index 1bfc189..573b2a0 100644 (file)
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
 
   FT_EXPORT_VAR( const FT_Module_Class )  otv_module_class;
 
 
   FT_EXPORT_VAR( const FT_Module_Class )  otv_module_class;
 
index 48f1233..53bd41e 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
 #
 
 
-# Copyright 2004 by
+# Copyright 2004, 2007 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -31,14 +31,15 @@ OTV_DRV_SRC := $(OTV_DIR)/otvbase.c  \
                $(OTV_DIR)/otvgpos.c  \
                $(OTV_DIR)/otvgsub.c  \
                $(OTV_DIR)/otvjstf.c  \
                $(OTV_DIR)/otvgpos.c  \
                $(OTV_DIR)/otvgsub.c  \
                $(OTV_DIR)/otvjstf.c  \
+               $(OTV_DIR)/otvmath.c  \
                $(OTV_DIR)/otvmod.c
 
 # OTV driver headers
 #
                $(OTV_DIR)/otvmod.c
 
 # OTV driver headers
 #
-OTV_DRV_H := $(OTV_DIR)/otvalid.h \
-             $(OTV_DIR)/otverror.h  \
+OTV_DRV_H := $(OTV_DIR)/otvalid.h  \
              $(OTV_DIR)/otvcommn.h \
              $(OTV_DIR)/otvcommn.h \
-             $(OTV_DIR)/otvgpos.h \
+             $(OTV_DIR)/otverror.h \
+             $(OTV_DIR)/otvgpos.h  \
              $(OTV_DIR)/otvmod.h
 
 
              $(OTV_DIR)/otvmod.h
 
 
index 0c51cd6..df383ff 100644 (file)
@@ -27,7 +27,7 @@
 FTMODULE_H_COMMANDS += PCF_DRIVER
 
 define PCF_DRIVER
 FTMODULE_H_COMMANDS += PCF_DRIVER
 
 define PCF_DRIVER
-$(OPEN_DRIVER)pcf_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, pcf_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)pcf       $(ECHO_DRIVER_DESC)pcf bitmap fonts$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)pcf       $(ECHO_DRIVER_DESC)pcf bitmap fonts$(ECHO_DRIVER_DONE)
 endef
 
index 9d2d8e0..1cd56c1 100644 (file)
@@ -72,8 +72,8 @@ FT_BEGIN_HEADER
     union
     {
       FT_String*  atom;
     union
     {
       FT_String*  atom;
-      FT_Long     integer;
-      FT_ULong    cardinal;
+      FT_Long     l;
+      FT_ULong    ul;
 
     } value;
 
 
     } value;
 
index c0f0e49..b34e542 100644 (file)
@@ -2,7 +2,7 @@
 
     FreeType font driver for pcf files
 
 
     FreeType font driver for pcf files
 
-    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 by
+    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -111,7 +111,7 @@ THE SOFTWARE.
 
     while ( min < max )
     {
 
     while ( min < max )
     {
-      FT_UInt32  code;
+      FT_ULong  code;
 
 
       mid  = ( min + max ) >> 1;
 
 
       mid  = ( min + max ) >> 1;
@@ -140,7 +140,7 @@ THE SOFTWARE.
     PCF_CMap      cmap      = (PCF_CMap)pcfcmap;
     PCF_Encoding  encodings = cmap->encodings;
     FT_UInt       min, max, mid;
     PCF_CMap      cmap      = (PCF_CMap)pcfcmap;
     PCF_Encoding  encodings = cmap->encodings;
     FT_UInt       min, max, mid;
-    FT_UInt32     charcode  = *acharcode + 1;
+    FT_ULong      charcode  = *acharcode + 1;
     FT_UInt       result    = 0;
 
 
     FT_UInt       result    = 0;
 
 
@@ -149,7 +149,7 @@ THE SOFTWARE.
 
     while ( min < max )
     {
 
     while ( min < max )
     {
-      FT_UInt32  code;
+      FT_ULong  code;
 
 
       mid  = ( min + max ) >> 1;
 
 
       mid  = ( min + max ) >> 1;
@@ -175,7 +175,14 @@ THE SOFTWARE.
     }
 
   Exit:
     }
 
   Exit:
-    *acharcode = charcode;
+    if ( charcode > 0xFFFFFFFFUL )
+    {
+      FT_TRACE1(( "pcf_cmap_char_next: charcode 0x%x > 32bit API" ));
+      *acharcode = 0;
+      /* XXX: result should be changed to indicate an overflow error */
+    }
+    else
+      *acharcode = (FT_UInt32)charcode;
     return result;
   }
 
     return result;
   }
 
@@ -187,17 +194,24 @@ THE SOFTWARE.
     pcf_cmap_init,
     pcf_cmap_done,
     pcf_cmap_char_index,
     pcf_cmap_init,
     pcf_cmap_done,
     pcf_cmap_char_index,
-    pcf_cmap_char_next
+    pcf_cmap_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
   };
 
 
   FT_CALLBACK_DEF( void )
   PCF_Face_Done( FT_Face  pcfface )         /* PCF_Face */
   {
   };
 
 
   FT_CALLBACK_DEF( void )
   PCF_Face_Done( FT_Face  pcfface )         /* PCF_Face */
   {
-    PCF_Face   face   = (PCF_Face)pcfface;
-    FT_Memory  memory = FT_FACE_MEMORY( face );
+    PCF_Face   face = (PCF_Face)pcfface;
+    FT_Memory  memory;
 
 
 
 
+    if ( !face )
+      return;
+
+    memory = FT_FACE_MEMORY( face );
+
     FT_FREE( face->encodings );
     FT_FREE( face->metrics );
 
     FT_FREE( face->encodings );
     FT_FREE( face->metrics );
 
@@ -259,17 +273,26 @@ THE SOFTWARE.
     error = pcf_load_font( stream, face );
     if ( error )
     {
     error = pcf_load_font( stream, face );
     if ( error )
     {
-      FT_Error  error2;
+      PCF_Face_Done( pcfface );
 
 
+#if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \
+    defined( FT_CONFIG_OPTION_USE_LZW )
 
 
-      PCF_Face_Done( pcfface );
+#ifdef FT_CONFIG_OPTION_USE_ZLIB
+      {
+        FT_Error  error2;
 
 
-      /* this didn't work, try gzip support! */
-      error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream );
-      if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature )
-        goto Fail;
 
 
-      error = error2;
+        /* this didn't work, try gzip support! */
+        error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream );
+        if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature )
+          goto Fail;
+
+        error = error2;
+      }
+#endif /* FT_CONFIG_OPTION_USE_ZLIB */
+
+#ifdef FT_CONFIG_OPTION_USE_LZW
       if ( error )
       {
         FT_Error  error3;
       if ( error )
       {
         FT_Error  error3;
@@ -281,29 +304,26 @@ THE SOFTWARE.
           goto Fail;
 
         error = error3;
           goto Fail;
 
         error = error3;
-        if ( error )
-          goto Fail;
+      }
+#endif /* FT_CONFIG_OPTION_USE_LZW */
 
 
-        face->gzip_source = stream;
-        pcfface->stream   = &face->gzip_stream;
+      if ( error )
+        goto Fail;
 
 
-        stream = pcfface->stream;
+      face->gzip_source = stream;
+      pcfface->stream   = &face->gzip_stream;
 
 
-        error = pcf_load_font( stream, face );
-        if ( error )
-          goto Fail;
-      }
-      else
-      {
-        face->gzip_source = stream;
-        pcfface->stream   = &face->gzip_stream;
+      stream = pcfface->stream;
+
+      error = pcf_load_font( stream, face );
+      if ( error )
+        goto Fail;
 
 
-        stream = pcfface->stream;
+#else /* !(FT_CONFIG_OPTION_USE_ZLIB || FT_CONFIG_OPTION_USE_LZW) */
 
 
-        error = pcf_load_font( stream, face );
-        if ( error )
-          goto Fail;
-      }
+      goto Fail;
+
+#endif
     }
 
     /* set up charmap */
     }
 
     /* set up charmap */
@@ -402,7 +422,7 @@ THE SOFTWARE.
     switch ( req->type )
     {
     case FT_SIZE_REQUEST_TYPE_NOMINAL:
     switch ( req->type )
     {
     case FT_SIZE_REQUEST_TYPE_NOMINAL:
-      if ( height == ( bsize->y_ppem + 32 ) >> 6 )
+      if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
         error = PCF_Err_Ok;
       break;
 
         error = PCF_Err_Ok;
       break;
 
@@ -431,11 +451,11 @@ THE SOFTWARE.
                   FT_Int32      load_flags )
   {
     PCF_Face    face   = (PCF_Face)FT_SIZE_FACE( size );
                   FT_Int32      load_flags )
   {
     PCF_Face    face   = (PCF_Face)FT_SIZE_FACE( size );
-    FT_Stream   stream = face->root.stream;
+    FT_Stream   stream;
     FT_Error    error  = PCF_Err_Ok;
     FT_Bitmap*  bitmap = &slot->bitmap;
     PCF_Metric  metric;
     FT_Error    error  = PCF_Err_Ok;
     FT_Bitmap*  bitmap = &slot->bitmap;
     PCF_Metric  metric;
-    int         bytes;
+    FT_Offset   bytes;
 
     FT_UNUSED( load_flags );
 
 
     FT_UNUSED( load_flags );
 
@@ -448,6 +468,8 @@ THE SOFTWARE.
       goto Exit;
     }
 
       goto Exit;
     }
 
+    stream = face->root.stream;
+
     if ( glyph_index > 0 )
       glyph_index--;
 
     if ( glyph_index > 0 )
       glyph_index--;
 
@@ -563,12 +585,17 @@ THE SOFTWARE.
       }
       else
       {
       }
       else
       {
+        if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
+        {
+          FT_TRACE1(( "pcf_get_bdf_property: " ));
+          FT_TRACE1(( "too large integer 0x%x is truncated\n" ));
+        }
         /* Apparently, the PCF driver loads all properties as signed integers!
          * This really doesn't seem to be a problem, because this is
          * sufficient for any meaningful values.
          */
         aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
         /* Apparently, the PCF driver loads all properties as signed integers!
          * This really doesn't seem to be a problem, because this is
          * sufficient for any meaningful values.
          */
         aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
-        aproperty->u.integer = prop->value.integer;
+        aproperty->u.integer = (FT_Int32)prop->value.l;
       }
       return 0;
     }
       }
       return 0;
     }
index 7ddf697..a81d730 100644 (file)
@@ -33,6 +33,10 @@ THE SOFTWARE.
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  pcf_driver_class;
 
 FT_END_HEADER
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  pcf_driver_class;
 
 FT_END_HEADER
index b9123cf..08becf9 100644 (file)
@@ -2,7 +2,7 @@
 
     FreeType font driver for pcf fonts
 
 
     FreeType font driver for pcf fonts
 
-  Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by
+  Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
   Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
   Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -32,7 +32,6 @@ THE SOFTWARE.
 #include FT_INTERNAL_OBJECTS_H
 
 #include "pcf.h"
 #include FT_INTERNAL_OBJECTS_H
 
 #include "pcf.h"
-#include "pcfdrivr.h"
 #include "pcfread.h"
 
 #include "pcferror.h"
 #include "pcfread.h"
 
 #include "pcferror.h"
@@ -48,7 +47,7 @@ THE SOFTWARE.
 #define FT_COMPONENT  trace_pcfread
 
 
 #define FT_COMPONENT  trace_pcfread
 
 
-#if defined( FT_DEBUG_LEVEL_TRACE )
+#ifdef FT_DEBUG_LEVEL_TRACE
   static const char* const  tableNames[] =
   {
     "prop", "accl", "mtrcs", "bmps", "imtrcs",
   static const char* const  tableNames[] =
   {
     "prop", "accl", "mtrcs", "bmps", "imtrcs",
@@ -152,7 +151,7 @@ THE SOFTWARE.
         break;
     }
 
         break;
     }
 
-#if defined( FT_DEBUG_LEVEL_TRACE )
+#ifdef FT_DEBUG_LEVEL_TRACE
 
     {
       FT_UInt      i, j;
 
     {
       FT_UInt      i, j;
@@ -290,13 +289,13 @@ THE SOFTWARE.
   static FT_Error
   pcf_seek_to_table_type( FT_Stream  stream,
                           PCF_Table  tables,
   static FT_Error
   pcf_seek_to_table_type( FT_Stream  stream,
                           PCF_Table  tables,
-                          FT_Int     ntables,
+                          FT_ULong   ntables, /* same as PCF_Toc->count */
                           FT_ULong   type,
                           FT_ULong  *aformat,
                           FT_ULong  *asize )
   {
     FT_Error  error = PCF_Err_Invalid_File_Format;
                           FT_ULong   type,
                           FT_ULong  *aformat,
                           FT_ULong  *asize )
   {
     FT_Error  error = PCF_Err_Invalid_File_Format;
-    FT_Int    i;
+    FT_ULong  i;
 
 
     for ( i = 0; i < ntables; i++ )
 
 
     for ( i = 0; i < ntables; i++ )
@@ -328,10 +327,10 @@ THE SOFTWARE.
 
   static FT_Bool
   pcf_has_table_type( PCF_Table  tables,
 
   static FT_Bool
   pcf_has_table_type( PCF_Table  tables,
-                      FT_Int     ntables,
+                      FT_ULong   ntables, /* same as PCF_Toc->count */
                       FT_ULong   type )
   {
                       FT_ULong   type )
   {
-    FT_Int  i;
+    FT_ULong  i;
 
 
     for ( i = 0; i < ntables; i++ )
 
 
     for ( i = 0; i < ntables; i++ )
@@ -400,7 +399,7 @@ THE SOFTWARE.
   {
     PCF_ParseProperty  props      = 0;
     PCF_Property       properties;
   {
     PCF_ParseProperty  props      = 0;
     PCF_Property       properties;
-    FT_UInt            nprops, i;
+    FT_ULong           nprops, i;
     FT_ULong           format, size;
     FT_Error           error;
     FT_Memory          memory     = FT_FACE(face)->memory;
     FT_ULong           format, size;
     FT_Error           error;
     FT_Memory          memory     = FT_FACE(face)->memory;
@@ -434,7 +433,10 @@ THE SOFTWARE.
     if ( error )
       goto Bail;
 
     if ( error )
       goto Bail;
 
-    FT_TRACE4(( "  nprop = %d\n", nprops ));
+    FT_TRACE4(( "  nprop = %d (truncate %d props)\n",
+                (int)nprops, nprops - (int)nprops ));
+
+    nprops = (int)nprops;
 
     /* rough estimate */
     if ( nprops > size / PCF_PROPERTY_SIZE )
 
     /* rough estimate */
     if ( nprops > size / PCF_PROPERTY_SIZE )
@@ -443,7 +445,7 @@ THE SOFTWARE.
       goto Bail;
     }
 
       goto Bail;
     }
 
-    face->nprops = nprops;
+    face->nprops = (int)nprops;
 
     if ( FT_NEW_ARRAY( props, nprops ) )
       goto Bail;
 
     if ( FT_NEW_ARRAY( props, nprops ) )
       goto Bail;
@@ -470,7 +472,11 @@ THE SOFTWARE.
     if ( nprops & 3 )
     {
       i = 4 - ( nprops & 3 );
     if ( nprops & 3 )
     {
       i = 4 - ( nprops & 3 );
-      FT_Stream_Skip( stream, i );
+      if ( FT_STREAM_SKIP( i ) )
+      {
+        error = PCF_Err_Invalid_Stream_Skip;
+        goto Bail;
+      }
     }
 
     if ( PCF_BYTE_ORDER( format ) == MSBFirst )
     }
 
     if ( PCF_BYTE_ORDER( format ) == MSBFirst )
@@ -539,9 +545,9 @@ THE SOFTWARE.
       }
       else
       {
       }
       else
       {
-        properties[i].value.integer = props[i].value;
+        properties[i].value.l = props[i].value;
 
 
-        FT_TRACE4(( " %d\n", properties[i].value.integer ));
+        FT_TRACE4(( " %d\n", properties[i].value.l ));
       }
     }
 
       }
     }
 
@@ -623,7 +629,7 @@ THE SOFTWARE.
     metrics = face->metrics;
     for ( i = 0; i < nmetrics; i++ )
     {
     metrics = face->metrics;
     for ( i = 0; i < nmetrics; i++ )
     {
-      pcf_get_metric( stream, format, metrics + i );
+      error = pcf_get_metric( stream, format, metrics + i );
 
       metrics[i].bits = 0;
 
 
       metrics[i].bits = 0;
 
@@ -658,7 +664,7 @@ THE SOFTWARE.
     FT_Long*   offsets;
     FT_Long    bitmapSizes[GLYPHPADOPTIONS];
     FT_ULong   format, size;
     FT_Long*   offsets;
     FT_Long    bitmapSizes[GLYPHPADOPTIONS];
     FT_ULong   format, size;
-    int        nbitmaps, i, sizebitmaps = 0;
+    FT_ULong   nbitmaps, i, sizebitmaps = 0;
 
 
     error = pcf_seek_to_table_type( stream,
 
 
     error = pcf_seek_to_table_type( stream,
@@ -689,7 +695,8 @@ THE SOFTWARE.
 
     FT_TRACE4(( "  number of bitmaps: %d\n", nbitmaps ));
 
 
     FT_TRACE4(( "  number of bitmaps: %d\n", nbitmaps ));
 
-    if ( nbitmaps != face->nmetrics )
+    /* XXX: PCF_Face->nmetrics is singed FT_Long, see pcf.h */
+    if ( face->nmetrics < 0 || nbitmaps != ( FT_ULong )face->nmetrics )
       return PCF_Err_Invalid_File_Format;
 
     if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
       return PCF_Err_Invalid_File_Format;
 
     if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
@@ -735,8 +742,8 @@ THE SOFTWARE.
       if ( ( offsets[i] < 0 )              ||
            ( (FT_ULong)offsets[i] > size ) )
       {
       if ( ( offsets[i] < 0 )              ||
            ( (FT_ULong)offsets[i] > size ) )
       {
-        FT_ERROR(( "pcf_get_bitmaps:"));
-        FT_ERROR(( " invalid offset to bitmap data of glyph %d\n", i ));
+        FT_TRACE0(( "pcf_get_bitmaps:"
+                    " invalid offset to bitmap data of glyph %d\n", i ));
       }
       else
         face->metrics[i].bits = stream->pos + offsets[i];
       }
       else
         face->metrics[i].bits = stream->pos + offsets[i];
@@ -989,9 +996,9 @@ THE SOFTWARE.
 
     PCF_Property  prop;
 
 
     PCF_Property  prop;
 
-    int    nn, len;
-    char*  strings[4] = { NULL, NULL, NULL, NULL };
-    int    lengths[4];
+    size_t  nn, len;
+    char*   strings[4] = { NULL, NULL, NULL, NULL };
+    size_t  lengths[4];
 
 
     face->style_flags = 0;
 
 
     face->style_flags = 0;
@@ -1073,7 +1080,7 @@ THE SOFTWARE.
         /* add_style_name and setwidth_name     */
         if ( nn == 0 || nn == 3 )
         {
         /* add_style_name and setwidth_name     */
         if ( nn == 0 || nn == 3 )
         {
-          int  mm;
+          size_t  mm;
 
 
           for ( mm = 0; mm < len; mm++ )
 
 
           for ( mm = 0; mm < len; mm++ )
@@ -1198,7 +1205,7 @@ THE SOFTWARE.
 
         prop = pcf_find_property( face, "AVERAGE_WIDTH" );
         if ( prop )
 
         prop = pcf_find_property( face, "AVERAGE_WIDTH" );
         if ( prop )
-          bsize->width = (FT_Short)( ( prop->value.integer + 5 ) / 10 );
+          bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 );
         else
           bsize->width = (FT_Short)( bsize->height * 2/3 );
 
         else
           bsize->width = (FT_Short)( bsize->height * 2/3 );
 
@@ -1206,19 +1213,19 @@ THE SOFTWARE.
         if ( prop )
           /* convert from 722.7 decipoints to 72 points per inch */
           bsize->size =
         if ( prop )
           /* convert from 722.7 decipoints to 72 points per inch */
           bsize->size =
-            (FT_Pos)( ( prop->value.integer * 64 * 7200 + 36135L ) / 72270L );
+            (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L );
 
         prop = pcf_find_property( face, "PIXEL_SIZE" );
         if ( prop )
 
         prop = pcf_find_property( face, "PIXEL_SIZE" );
         if ( prop )
-          bsize->y_ppem = (FT_Short)prop->value.integer << 6;
+          bsize->y_ppem = (FT_Short)prop->value.l << 6;
 
         prop = pcf_find_property( face, "RESOLUTION_X" );
         if ( prop )
 
         prop = pcf_find_property( face, "RESOLUTION_X" );
         if ( prop )
-          resolution_x = (FT_Short)prop->value.integer;
+          resolution_x = (FT_Short)prop->value.l;
 
         prop = pcf_find_property( face, "RESOLUTION_Y" );
         if ( prop )
 
         prop = pcf_find_property( face, "RESOLUTION_Y" );
         if ( prop )
-          resolution_y = (FT_Short)prop->value.integer;
+          resolution_y = (FT_Short)prop->value.l;
 
         if ( bsize->y_ppem == 0 )
         {
 
         if ( bsize->y_ppem == 0 )
         {
index 67ddbe8..b91274f 100644 (file)
@@ -42,9 +42,9 @@ in this Software without prior written authorization from The Open Group.
 
   FT_LOCAL_DEF( void )
   BitOrderInvert( unsigned char*  buf,
 
   FT_LOCAL_DEF( void )
   BitOrderInvert( unsigned char*  buf,
-                  int             nbytes )
+                  size_t          nbytes )
   {
   {
-    for ( ; --nbytes >= 0; buf++ )
+    for ( ; nbytes > 0; nbytes--, buf++ )
     {
       unsigned int  val = *buf;
 
     {
       unsigned int  val = *buf;
 
@@ -64,7 +64,7 @@ in this Software without prior written authorization from The Open Group.
 
   FT_LOCAL_DEF( void )
   TwoByteSwap( unsigned char*  buf,
 
   FT_LOCAL_DEF( void )
   TwoByteSwap( unsigned char*  buf,
-               int             nbytes )
+               size_t          nbytes )
   {
     unsigned char  c;
 
   {
     unsigned char  c;
 
@@ -83,7 +83,7 @@ in this Software without prior written authorization from The Open Group.
 
   FT_LOCAL_DEF( void )
   FourByteSwap( unsigned char*  buf,
 
   FT_LOCAL_DEF( void )
   FourByteSwap( unsigned char*  buf,
-                int             nbytes )
+                size_t          nbytes )
   {
     unsigned char  c;
 
   {
     unsigned char  c;
 
index 1557be3..ce10fb5 100644 (file)
@@ -37,15 +37,15 @@ FT_BEGIN_HEADER
 
   FT_LOCAL( void )
   BitOrderInvert( unsigned char*  buf,
 
   FT_LOCAL( void )
   BitOrderInvert( unsigned char*  buf,
-                  int             nbytes );
+                  size_t          nbytes );
 
   FT_LOCAL( void )
   TwoByteSwap( unsigned char*  buf,
 
   FT_LOCAL( void )
   TwoByteSwap( unsigned char*  buf,
-               int             nbytes );
+               size_t          nbytes );
 
   FT_LOCAL( void )
   FourByteSwap( unsigned char*  buf,
 
   FT_LOCAL( void )
   FourByteSwap( unsigned char*  buf,
-                int             nbytes );
+                size_t          nbytes );
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index 1ad4ba8..7864152 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
 #
 
 
-# Copyright (C) 2000, 2001, 2003 by
+# Copyright (C) 2000, 2001, 2003, 2008 by
 # Francesco Zappa Nardelli
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # Francesco Zappa Nardelli
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -35,15 +35,14 @@ PCF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PCF_DIR))
 
 # pcf driver sources (i.e., C files)
 #
 
 # pcf driver sources (i.e., C files)
 #
-PCF_DRV_SRC := $(PCF_DIR)/pcfread.c  \
-               $(PCF_DIR)/pcfdrivr.c \
+PCF_DRV_SRC := $(PCF_DIR)/pcfdrivr.c \
+               $(PCF_DIR)/pcfread.c  \
                $(PCF_DIR)/pcfutil.c
 
 # pcf driver headers
 #
                $(PCF_DIR)/pcfutil.c
 
 # pcf driver headers
 #
-PCF_DRV_H := $(PCF_DIR)/pcf.h      \
-             $(PCF_DIR)/pcfdrivr.h \
-             $(PCF_DIR)/pcfutil.h  \
+PCF_DRV_H := $(PCF_DRV_SRC:%.c=%.h) \
+             $(PCF_DIR)/pcf.h       \
              $(PCF_DIR)/pcferror.h
 
 # pcf driver object(s)
              $(PCF_DIR)/pcferror.h
 
 # pcf driver object(s)
index 53ab34a..8d1d28a 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += PFR_DRIVER
 
 define PFR_DRIVER
 FTMODULE_H_COMMANDS += PFR_DRIVER
 
 define PFR_DRIVER
-$(OPEN_DRIVER)pfr_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, pfr_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)pfr       $(ECHO_DRIVER_DESC)PFR/TrueDoc font files with extension *.pfr$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)pfr       $(ECHO_DRIVER_DESC)PFR/TrueDoc font files with extension *.pfr$(ECHO_DRIVER_DONE)
 endef
 
index c8faee0..9c8f9ed 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR cmap handling (body).                                   */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType PFR cmap handling (body).                                   */
 /*                                                                         */
-/*  Copyright 2002, 2007 by                                                */
+/*  Copyright 2002, 2007, 2009 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,7 +18,8 @@
 
 #include "pfrcmap.h"
 #include "pfrobjs.h"
 
 #include "pfrcmap.h"
 #include "pfrobjs.h"
-#include FT_INTERNAL_DEBUG_H
+
+#include "pfrerror.h"
 
 
   FT_CALLBACK_DEF( FT_Error )
 
 
   FT_CALLBACK_DEF( FT_Error )
@@ -87,7 +88,7 @@
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   pfr_cmap_char_next( PFR_CMap    cmap,
                       FT_UInt32  *pchar_code )
   {
   pfr_cmap_char_next( PFR_CMap    cmap,
                       FT_UInt32  *pchar_code )
   {
     (FT_CMap_InitFunc)     pfr_cmap_init,
     (FT_CMap_DoneFunc)     pfr_cmap_done,
     (FT_CMap_CharIndexFunc)pfr_cmap_char_index,
     (FT_CMap_InitFunc)     pfr_cmap_init,
     (FT_CMap_DoneFunc)     pfr_cmap_done,
     (FT_CMap_CharIndexFunc)pfr_cmap_char_index,
-    (FT_CMap_CharNextFunc) pfr_cmap_char_next
+    (FT_CMap_CharNextFunc) pfr_cmap_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
   };
 
 
   };
 
 
index 4020672..15cca98 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR driver interface (body).                                */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType PFR driver interface (body).                                */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2006 by                                    */
+/*  Copyright 2002, 2003, 2004, 2006, 2008 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
                    FT_Pos   *anadvance )
   {
     PFR_Face  face  = (PFR_Face)pfrface;
                    FT_Pos   *anadvance )
   {
     PFR_Face  face  = (PFR_Face)pfrface;
-    FT_Error  error = PFR_Err_Bad_Argument;
+    FT_Error  error = PFR_Err_Invalid_Argument;
 
 
     *anadvance = 0;
 
 
     *anadvance = 0;
+
+    if ( !gindex )
+      goto Exit;
+
+    gindex--;
+
     if ( face )
     {
       PFR_PhyFont  phys = &face->phy_font;
     if ( face )
     {
       PFR_PhyFont  phys = &face->phy_font;
@@ -82,6 +88,7 @@
       }
     }
 
       }
     }
 
+  Exit:
     return error;
   }
 
     return error;
   }
 
index 36f1205..da0a1aa 100644 (file)
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
 
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  pfr_driver_class;
 
 
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  pfr_driver_class;
 
index 3bb1733..6fe6e42 100644 (file)
 
     if ( org_count + count > glyph->max_subs )
     {
 
     if ( org_count + count > glyph->max_subs )
     {
-      FT_UInt  new_max = ( org_count + count + 3 ) & -4;
+      FT_UInt  new_max = ( org_count + count + 3 ) & (FT_UInt)-4;
 
 
       if ( FT_RENEW_ARRAY( glyph->subs, glyph->max_subs, new_max ) )
 
 
       if ( FT_RENEW_ARRAY( glyph->subs, glyph->max_subs, new_max ) )
index 1ee2c1f..bc5c035 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR loader (body).                                          */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType PFR loader (body).                                          */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2007 by                              */
+/*  Copyright 2002, 2003, 2004, 2005, 2007, 2009 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
   Too_Short:
     error = PFR_Err_Invalid_Table;
 
   Too_Short:
     error = PFR_Err_Invalid_Table;
-    FT_ERROR(( "pfr_extra_item_load_bitmap_info: invalid bitmap info table\n" ));
+    FT_ERROR(( "pfr_extra_item_load_bitmap_info:"
+               " invalid bitmap info table\n" ));
     goto Exit;
   }
 
     goto Exit;
   }
 
 
   Too_Short:
     error = PFR_Err_Invalid_Table;
 
   Too_Short:
     error = PFR_Err_Invalid_Table;
-    FT_ERROR(( "pfr_exta_item_load_stem_snaps: invalid stem snaps table\n" ));
+    FT_ERROR(( "pfr_exta_item_load_stem_snaps:"
+               " invalid stem snaps table\n" ));
     goto Exit;
   }
 
     goto Exit;
   }
 
     FT_FREE( item );
 
     error = PFR_Err_Invalid_Table;
     FT_FREE( item );
 
     error = PFR_Err_Invalid_Table;
-    FT_ERROR(( "pfr_extra_item_load_kerning_pairs: "
-               "invalid kerning pairs table\n" ));
+    FT_ERROR(( "pfr_extra_item_load_kerning_pairs:"
+               " invalid kerning pairs table\n" ));
     goto Exit;
   }
 
     goto Exit;
   }
 
   {
     FT_Error   error;
     FT_Memory  memory = stream->memory;
   {
     FT_Error   error;
     FT_Memory  memory = stream->memory;
-    FT_UInt    flags, num_aux;
+    FT_UInt    flags;
+    FT_ULong   num_aux;
     FT_Byte*   p;
     FT_Byte*   limit;
 
     FT_Byte*   p;
     FT_Byte*   limit;
 
index 180446d..56d617d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR object methods (body).                                  */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType PFR object methods (body).                                  */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007 by                        */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by                  */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   FT_LOCAL_DEF( void )
   pfr_face_done( FT_Face  pfrface )     /* PFR_Face */
   {
   FT_LOCAL_DEF( void )
   pfr_face_done( FT_Face  pfrface )     /* PFR_Face */
   {
-    PFR_Face   face   = (PFR_Face)pfrface;
-    FT_Memory  memory = pfrface->driver->root.memory;
+    PFR_Face   face = (PFR_Face)pfrface;
+    FT_Memory  memory;
 
 
 
 
+    if ( !face )
+      return;
+
+    memory = pfrface->driver->root.memory;
+
     /* we don't want dangling pointers */
     pfrface->family_name = NULL;
     pfrface->style_name  = NULL;
     /* we don't want dangling pointers */
     pfrface->family_name = NULL;
     pfrface->style_name  = NULL;
index 45ff666..8a38bec 100644 (file)
                                        &xpos, &ypos,
                                        &xsize, &ysize,
                                        &advance, &format );
                                        &xpos, &ypos,
                                        &xsize, &ysize,
                                        &advance, &format );
+
+      /*
+       * XXX: on 16bit system, we return an error for huge bitmap
+       *      which causes a size truncation, because truncated
+       *      size properties makes bitmap glyph broken.
+       */
+      if ( xpos > FT_INT_MAX || ( ypos + ysize ) > FT_INT_MAX )
+      {
+        FT_TRACE1(( "pfr_slot_load_bitmap:" ));
+        FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n",
+                     xpos, ypos ));
+        error = PFR_Err_Invalid_Pixel_Size;
+      }
+
       if ( !error )
       {
         glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
 
         /* Set up glyph bitmap and metrics */
       if ( !error )
       {
         glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
 
         /* Set up glyph bitmap and metrics */
+
+        /* XXX: needs casts to fit FT_Bitmap.{width|rows|pitch} */
         glyph->root.bitmap.width      = (FT_Int)xsize;
         glyph->root.bitmap.rows       = (FT_Int)ysize;
         glyph->root.bitmap.width      = (FT_Int)xsize;
         glyph->root.bitmap.rows       = (FT_Int)ysize;
-        glyph->root.bitmap.pitch      = (FT_Long)( xsize + 7 ) >> 3;
+        glyph->root.bitmap.pitch      = (FT_Int)( xsize + 7 ) >> 3;
         glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
 
         glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
 
-        glyph->root.metrics.width        = (FT_Long)xsize << 6;
-        glyph->root.metrics.height       = (FT_Long)ysize << 6;
+        /* XXX: needs casts to fit FT_Glyph_Metrics.{width|height} */
+        glyph->root.metrics.width        = (FT_Pos)xsize << 6;
+        glyph->root.metrics.height       = (FT_Pos)ysize << 6;
         glyph->root.metrics.horiBearingX = xpos << 6;
         glyph->root.metrics.horiBearingY = ypos << 6;
         glyph->root.metrics.horiAdvance  = FT_PIX_ROUND( ( advance >> 2 ) );
         glyph->root.metrics.horiBearingX = xpos << 6;
         glyph->root.metrics.horiBearingY = ypos << 6;
         glyph->root.metrics.horiAdvance  = FT_PIX_ROUND( ( advance >> 2 ) );
         glyph->root.metrics.vertBearingY = 0;
         glyph->root.metrics.vertAdvance  = size->root.metrics.height;
 
         glyph->root.metrics.vertBearingY = 0;
         glyph->root.metrics.vertAdvance  = size->root.metrics.height;
 
-        glyph->root.bitmap_left = xpos;
-        glyph->root.bitmap_top  = ypos + ysize;
+        /* XXX: needs casts fit FT_GlyphSlotRec.bitmap_{left|top} */
+        glyph->root.bitmap_left = (FT_Int)xpos;
+        glyph->root.bitmap_top  = (FT_Int)(ypos + ysize);
 
         /* Allocate and read bitmap data */
         {
 
         /* Allocate and read bitmap data */
         {
index c0ae042..9183108 100644 (file)
@@ -200,7 +200,7 @@ FT_BEGIN_HEADER
     FT_Byte       flags;
     FT_Short      base_adj;
     FT_UInt       pair_size;
     FT_Byte       flags;
     FT_Short      base_adj;
     FT_UInt       pair_size;
-    FT_UInt32     offset;
+    FT_Offset     offset;
     FT_UInt32     pair1;
     FT_UInt32     pair2;
 
     FT_UInt32     pair1;
     FT_UInt32     pair2;
 
@@ -252,7 +252,7 @@ FT_BEGIN_HEADER
     FT_UInt            blue_scale;
 
     FT_UInt            num_chars;
     FT_UInt            blue_scale;
 
     FT_UInt            num_chars;
-    FT_UInt32          chars_offset;
+    FT_Offset          chars_offset;
     PFR_Char           chars;
 
     FT_UInt            num_kern_pairs;
     PFR_Char           chars;
 
     FT_UInt            num_kern_pairs;
@@ -260,7 +260,7 @@ FT_BEGIN_HEADER
     PFR_KernItem*      kern_items_tail;
 
     /* not part of the spec, but used during load */
     PFR_KernItem*      kern_items_tail;
 
     /* not part of the spec, but used during load */
-    FT_UInt32          bct_offset;
+    FT_Long            bct_offset;
     FT_Byte*           cursor;
 
   } PFR_PhyFontRec, *PFR_PhyFont;
     FT_Byte*           cursor;
 
   } PFR_PhyFontRec, *PFR_PhyFont;
index 0528fe6..91a17e2 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    AFM parser (body).                                                   */
 /*                                                                         */
 /*                                                                         */
 /*    AFM parser (body).                                                   */
 /*                                                                         */
-/*  Copyright 2006, 2007 by                                                */
+/*  Copyright 2006, 2007, 2008, 2009 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,7 +18,6 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
 
 #include "afmparse.h"
 #include "psconv.h"
 
 #include "afmparse.h"
 #include "psconv.h"
   FT_LOCAL_DEF( FT_Int )
   afm_parser_read_vals( AFM_Parser  parser,
                         AFM_Value   vals,
   FT_LOCAL_DEF( FT_Int )
   afm_parser_read_vals( AFM_Parser  parser,
                         AFM_Value   vals,
-                        FT_Int      n )
+                        FT_UInt     n )
   {
     AFM_Stream  stream = parser->stream;
     char*       str;
   {
     AFM_Stream  stream = parser->stream;
     char*       str;
-    FT_Int      i;
+    FT_UInt     i;
 
 
     if ( n > AFM_MAX_ARGUMENTS )
 
 
     if ( n > AFM_MAX_ARGUMENTS )
 
     for ( i = 0; i < n; i++ )
     {
 
     for ( i = 0; i < n; i++ )
     {
-      FT_UInt    len;
+      FT_Offset  len;
       AFM_Value  val = vals + i;
 
 
       AFM_Value  val = vals + i;
 
 
   FT_LOCAL_DEF( char* )
   afm_parser_next_key( AFM_Parser  parser,
                        FT_Bool     line,
   FT_LOCAL_DEF( char* )
   afm_parser_next_key( AFM_Parser  parser,
                        FT_Bool     line,
-                       FT_UInt*    len )
+                       FT_Offset*  len )
   {
     AFM_Stream  stream = parser->stream;
     char*       key    = 0;  /* make stupid compiler happy */
   {
     AFM_Stream  stream = parser->stream;
     char*       key    = 0;  /* make stupid compiler happy */
     }
 
     if ( len )
     }
 
     if ( len )
-      *len = ( key ) ? AFM_STREAM_KEY_LEN( stream, key )
+      *len = ( key ) ? (FT_Offset)AFM_STREAM_KEY_LEN( stream, key )
                      : 0;
 
     return key;
                      : 0;
 
     return key;
 
   static AFM_Token
   afm_tokenize( const char*  key,
 
   static AFM_Token
   afm_tokenize( const char*  key,
-                FT_UInt      len )
+                FT_Offset    len )
   {
     int  n;
 
   {
     int  n;
 
     AFM_FontInfo   fi = parser->FontInfo;
     AFM_TrackKern  tk;
     char*          key;
     AFM_FontInfo   fi = parser->FontInfo;
     AFM_TrackKern  tk;
     char*          key;
-    FT_UInt        len;
+    FT_Offset      len;
     int            n = -1;
 
 
     int            n = -1;
 
 
     FT_ULong  index2 = KERN_INDEX( kp2->index1, kp2->index2 );
 
 
     FT_ULong  index2 = KERN_INDEX( kp2->index1, kp2->index2 );
 
 
-    return (int)( index1 - index2 );
+    if ( index1 > index2 )
+      return 1;
+    else if ( index1 < index2 )
+      return -1;
+    else
+      return 0;
   }
 
 
   }
 
 
     AFM_FontInfo  fi = parser->FontInfo;
     AFM_KernPair  kp;
     char*         key;
     AFM_FontInfo  fi = parser->FontInfo;
     AFM_KernPair  kp;
     char*         key;
-    FT_UInt       len;
+    FT_Offset     len;
     int           n = -1;
 
 
     int           n = -1;
 
 
   static FT_Error
   afm_parse_kern_data( AFM_Parser  parser )
   {
   static FT_Error
   afm_parse_kern_data( AFM_Parser  parser )
   {
-    FT_Error  error;
-    char*     key;
-    FT_UInt   len;
+    FT_Error   error;
+    char*      key;
+    FT_Offset  len;
 
 
     while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
 
 
     while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
                            FT_UInt     n,
                            AFM_Token   end_section )
   {
                            FT_UInt     n,
                            AFM_Token   end_section )
   {
-    char*    key;
-    FT_UInt  len;
+    char*      key;
+    FT_Offset  len;
 
 
     while ( n-- > 0 )
 
 
     while ( n-- > 0 )
     AFM_FontInfo  fi     = parser->FontInfo;
     FT_Error      error  = PSaux_Err_Syntax_Error;
     char*         key;
     AFM_FontInfo  fi     = parser->FontInfo;
     FT_Error      error  = PSaux_Err_Syntax_Error;
     char*         key;
-    FT_UInt       len;
+    FT_Offset     len;
     FT_Int        metrics_sets = 0;
 
 
     FT_Int        metrics_sets = 0;
 
 
index c2fce75..de2a530 100644 (file)
@@ -71,13 +71,13 @@ FT_BEGIN_HEADER
   FT_LOCAL( FT_Int )
   afm_parser_read_vals( AFM_Parser  parser,
                         AFM_Value   vals,
   FT_LOCAL( FT_Int )
   afm_parser_read_vals( AFM_Parser  parser,
                         AFM_Value   vals,
-                        FT_Int      n );
+                        FT_UInt     n );
 
   /* read the next key from the next line or column */
   FT_LOCAL( char* )
   afm_parser_next_key( AFM_Parser  parser,
                        FT_Bool     line,
 
   /* read the next key from the next line or column */
   FT_LOCAL( char* )
   afm_parser_next_key( AFM_Parser  parser,
                        FT_Bool     line,
-                       FT_UInt*    len );
+                       FT_Offset*  len );
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
index 5431522..42bf6f5 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += PSAUX_MODULE
 
 define PSAUX_MODULE
 FTMODULE_H_COMMANDS += PSAUX_MODULE
 
 define PSAUX_MODULE
-$(OPEN_DRIVER)psaux_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, psaux_module_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)psaux     $(ECHO_DRIVER_DESC)Postscript Type 1 & Type 2 helper module$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)psaux     $(ECHO_DRIVER_DESC)Postscript Type 1 & Type 2 helper module$(ECHO_DRIVER_DONE)
 endef
 
index 92ac056..35e042d 100644 (file)
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
 
   FT_EXPORT_VAR( const FT_Module_Class )  psaux_driver_class;
 
 
   FT_EXPORT_VAR( const FT_Module_Class )  psaux_driver_class;
 
index 3bbeab6..1531d8f 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Some convenience conversions (body).                                 */
 /*                                                                         */
 /*                                                                         */
 /*    Some convenience conversions (body).                                 */
 /*                                                                         */
-/*  Copyright 2006 by                                                      */
+/*  Copyright 2006, 2008, 2009 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 #include <ft2build.h>
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 
 #include <ft2build.h>
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
 
 #include "psconv.h"
 
 #include "psconv.h"
-#include "psobjs.h"
 #include "psauxerr.h"
 
 
 #include "psauxerr.h"
 
 
         if ( c < 0 || c >= 10 )
           break;
 
         if ( c < 0 || c >= 10 )
           break;
 
-        if ( divider < 10000000L )
+        if ( !integral && power_ten > 0 )
         {
         {
+          power_ten--;
           decimal = decimal * 10 + c;
           decimal = decimal * 10 + c;
-          divider *= 10;
+        }
+        else
+        {
+          if ( divider < 10000000L )
+          {
+            decimal = decimal * 10 + c;
+            divider *= 10;
+          }
         }
       }
     }
         }
       }
     }
   PS_Conv_StringDecode( FT_Byte**  cursor,
                         FT_Byte*   limit,
                         FT_Byte*   buffer,
   PS_Conv_StringDecode( FT_Byte**  cursor,
                         FT_Byte*   limit,
                         FT_Byte*   buffer,
-                        FT_UInt    n )
+                        FT_Offset  n )
   {
     FT_Byte*  p;
     FT_UInt   r = 0;
   {
     FT_Byte*  p;
     FT_UInt   r = 0;
   PS_Conv_ASCIIHexDecode( FT_Byte**  cursor,
                           FT_Byte*   limit,
                           FT_Byte*   buffer,
   PS_Conv_ASCIIHexDecode( FT_Byte**  cursor,
                           FT_Byte*   limit,
                           FT_Byte*   buffer,
-                          FT_UInt    n )
+                          FT_Offset  n )
   {
     FT_Byte*  p;
     FT_UInt   r   = 0;
   {
     FT_Byte*  p;
     FT_UInt   r   = 0;
   PS_Conv_EexecDecode( FT_Byte**   cursor,
                        FT_Byte*    limit,
                        FT_Byte*    buffer,
   PS_Conv_EexecDecode( FT_Byte**   cursor,
                        FT_Byte*    limit,
                        FT_Byte*    buffer,
-                       FT_UInt     n,
+                       FT_Offset   n,
                        FT_UShort*  seed )
   {
     FT_Byte*  p;
                        FT_UShort*  seed )
   {
     FT_Byte*  p;
index e511241..84854ba 100644 (file)
@@ -46,20 +46,20 @@ FT_BEGIN_HEADER
   PS_Conv_StringDecode( FT_Byte**  cursor,
                         FT_Byte*   limit,
                         FT_Byte*   buffer,
   PS_Conv_StringDecode( FT_Byte**  cursor,
                         FT_Byte*   limit,
                         FT_Byte*   buffer,
-                        FT_UInt    n );
+                        FT_Offset  n );
 #endif
 
   FT_LOCAL( FT_UInt )
   PS_Conv_ASCIIHexDecode( FT_Byte**  cursor,
                           FT_Byte*   limit,
                           FT_Byte*   buffer,
 #endif
 
   FT_LOCAL( FT_UInt )
   PS_Conv_ASCIIHexDecode( FT_Byte**  cursor,
                           FT_Byte*   limit,
                           FT_Byte*   buffer,
-                          FT_UInt    n );
+                          FT_Offset  n );
 
   FT_LOCAL( FT_UInt )
   PS_Conv_EexecDecode( FT_Byte**   cursor,
                        FT_Byte*    limit,
                        FT_Byte*    buffer,
 
   FT_LOCAL( FT_UInt )
   PS_Conv_EexecDecode( FT_Byte**   cursor,
                        FT_Byte*    limit,
                        FT_Byte*    buffer,
-                       FT_UInt     n,
+                       FT_Offset   n,
                        FT_UShort*  seed );
 
 
                        FT_UShort*  seed );
 
 
index 9570856..fe8398a 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auxiliary functions for PostScript fonts (body).                     */
 /*                                                                         */
 /*                                                                         */
 /*    Auxiliary functions for PostScript fonts (body).                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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_POSTSCRIPT_AUX_H
 #include FT_INTERNAL_DEBUG_H
 #include <ft2build.h>
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 #include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_CALC_H
 
 #include "psobjs.h"
 #include "psconv.h"
 
 #include "psobjs.h"
 #include "psconv.h"
                 void*       object,
                 FT_PtrDist  length )
   {
                 void*       object,
                 FT_PtrDist  length )
   {
-    if ( idx < 0 || idx > table->max_elems )
+    if ( idx < 0 || idx >= table->max_elems )
     {
       FT_ERROR(( "ps_table_add: invalid index\n" ));
       return PSaux_Err_Invalid_Argument;
     }
 
     {
       FT_ERROR(( "ps_table_add: invalid index\n" ));
       return PSaux_Err_Invalid_Argument;
     }
 
+    if ( length < 0 )
+    {
+      FT_ERROR(( "ps_table_add: invalid length\n" ));
+      return PSaux_Err_Invalid_Argument;
+    }
+
     /* grow the base block if needed */
     if ( table->cursor + length > table->capacity )
     {
       FT_Error   error;
     /* grow the base block if needed */
     if ( table->cursor + length > table->capacity )
     {
       FT_Error   error;
-      FT_Offset  new_size  = table->capacity;
+      FT_Offset  new_size = table->capacity;
       FT_Long    in_offset;
 
 
       FT_Long    in_offset;
 
 
           /* skip octal escape or ignore backslash */
           for ( i = 0; i < 3 && cur < limit; ++i )
           {
           /* skip octal escape or ignore backslash */
           for ( i = 0; i < 3 && cur < limit; ++i )
           {
-            if ( ! IS_OCTAL_DIGIT( *cur ) )
+            if ( !IS_OCTAL_DIGIT( *cur ) )
               break;
 
             ++cur;
               break;
 
             ++cur;
       cur++;
       if ( cur >= limit || *cur != '>' )             /* >> */
       {
       cur++;
       if ( cur >= limit || *cur != '>' )             /* >> */
       {
-        FT_ERROR(( "ps_parser_skip_PS_token: "
-                   "unexpected closing delimiter `>'\n" ));
+        FT_ERROR(( "ps_parser_skip_PS_token:"
+                   " unexpected closing delimiter `>'\n" ));
         error = PSaux_Err_Invalid_File_Format;
         goto Exit;
       }
         error = PSaux_Err_Invalid_File_Format;
         goto Exit;
       }
   Exit:
     if ( cur == parser->cursor )
     {
   Exit:
     if ( cur == parser->cursor )
     {
-      FT_ERROR(( "ps_parser_skip_PS_token: "
-                 "current token is `%c', which is self-delimiting "
-                 "but invalid at this point\n",
+      FT_ERROR(( "ps_parser_skip_PS_token:"
+                 " current token is `%c' which is self-delimiting\n"
+                 "                        "
+                 " but invalid at this point\n",
                  *cur ));
 
       error = PSaux_Err_Invalid_File_Format;
                  *cur ));
 
       error = PSaux_Err_Invalid_File_Format;
           }
           else
           {
           }
           else
           {
-            FT_ERROR(( "ps_parser_load_field: expected a name or string "
-                       "but found token of type %d instead\n",
+            FT_ERROR(( "ps_parser_load_field:"
+                       " expected a name or string\n"
+                       "                     "
+                       " but found token of type %d instead\n",
                        token.type ));
             error = PSaux_Err_Invalid_File_Format;
             goto Exit;
                        token.type ));
             error = PSaux_Err_Invalid_File_Format;
             goto Exit;
 
           if ( result < 0 )
           {
 
           if ( result < 0 )
           {
-            FT_ERROR(( "ps_parser_load_field: "
-                       "expected four integers in bounding box\n" ));
+            FT_ERROR(( "ps_parser_load_field:"
+                       " expected four integers in bounding box\n" ));
             error = PSaux_Err_Invalid_File_Format;
             goto Exit;
           }
             error = PSaux_Err_Invalid_File_Format;
             goto Exit;
           }
     old_cursor = parser->cursor;
     old_limit  = parser->limit;
 
     old_cursor = parser->cursor;
     old_limit  = parser->limit;
 
-    /* we store the elements count if necessary */
-    if ( field->type != T1_FIELD_TYPE_BBOX )
+    /* we store the elements count if necessary;           */
+    /* we further assume that `count_offset' can't be zero */
+    if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
       *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
         (FT_Byte)num_elements;
 
       *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
         (FT_Byte)num_elements;
 
   FT_LOCAL_DEF( FT_Error )
   ps_parser_to_bytes( PS_Parser  parser,
                       FT_Byte*   bytes,
   FT_LOCAL_DEF( FT_Error )
   ps_parser_to_bytes( PS_Parser  parser,
                       FT_Byte*   bytes,
-                      FT_Long    max_bytes,
+                      FT_Offset  max_bytes,
                       FT_Long*   pnum_bytes,
                       FT_Bool    delimiters )
   {
                       FT_Long*   pnum_bytes,
                       FT_Bool    delimiters )
   {
         builder->hints_funcs = glyph->internal->glyph_hints;
     }
 
         builder->hints_funcs = glyph->internal->glyph_hints;
     }
 
-    if ( size )
-    {
-      builder->scale_x = size->metrics.x_scale;
-      builder->scale_y = size->metrics.y_scale;
-    }
-
     builder->pos_x = 0;
     builder->pos_y = 0;
 
     builder->pos_x = 0;
     builder->pos_y = 0;
 
       FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points;
 
 
       FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points;
 
 
-      if ( builder->shift )
-      {
-        x >>= 16;
-        y >>= 16;
-      }
-      point->x = x;
-      point->y = y;
+      point->x = FIXED_TO_INT( x );
+      point->y = FIXED_TO_INT( y );
       *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
       *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
-
-      builder->last = *point;
     }
     outline->n_points++;
   }
     }
     outline->n_points++;
   }
   t1_builder_close_contour( T1_Builder  builder )
   {
     FT_Outline*  outline = builder->current;
   t1_builder_close_contour( T1_Builder  builder )
   {
     FT_Outline*  outline = builder->current;
+    FT_Int       first;
 
 
     if ( !outline )
       return;
 
 
 
     if ( !outline )
       return;
 
-    /* XXXX: We must not include the last point in the path if it */
-    /*       is located on the first point.                       */
+    first = outline->n_contours <= 1
+            ? 0 : outline->contours[outline->n_contours - 2] + 1;
+
+    /* We must not include the last point in the path if it */
+    /* is located on the first point.                       */
     if ( outline->n_points > 1 )
     {
     if ( outline->n_points > 1 )
     {
-      FT_Int      first   = 0;
       FT_Vector*  p1      = outline->points + first;
       FT_Vector*  p2      = outline->points + outline->n_points - 1;
       FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;
 
 
       FT_Vector*  p1      = outline->points + first;
       FT_Vector*  p2      = outline->points + outline->n_points - 1;
       FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;
 
 
-      if ( outline->n_contours > 1 )
-      {
-        first = outline->contours[outline->n_contours - 2] + 1;
-        p1    = outline->points + first;
-      }
-
       /* `delete' last point only if it coincides with the first */
       /* point and it is not a control point (which can happen). */
       if ( p1->x == p2->x && p1->y == p2->y )
       /* `delete' last point only if it coincides with the first */
       /* point and it is not a control point (which can happen). */
       if ( p1->x == p2->x && p1->y == p2->y )
     }
 
     if ( outline->n_contours > 0 )
     }
 
     if ( outline->n_contours > 0 )
-      outline->contours[outline->n_contours - 1] =
-        (short)( outline->n_points - 1 );
+    {
+      /* Don't add contours only consisting of one point, i.e.,  */
+      /* check whether the first and the last point is the same. */
+      if ( first == outline->n_points - 1 )
+      {
+        outline->n_contours--;
+        outline->n_points--;
+      }
+      else
+        outline->contours[outline->n_contours - 1] =
+          (short)( outline->n_points - 1 );
+    }
   }
 
 
   }
 
 
index c2cbf2c..e380c60 100644 (file)
@@ -111,7 +111,7 @@ FT_BEGIN_HEADER
   FT_LOCAL( FT_Error )
   ps_parser_to_bytes( PS_Parser  parser,
                       FT_Byte*   bytes,
   FT_LOCAL( FT_Error )
   ps_parser_to_bytes( PS_Parser  parser,
                       FT_Byte*   bytes,
-                      FT_Long    max_bytes,
+                      FT_Offset  max_bytes,
                       FT_Long*   pnum_bytes,
                       FT_Bool    delimiters );
 
                       FT_Long*   pnum_bytes,
                       FT_Bool    delimiters );
 
index 2934686..f933e4d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 character map support (body).                                 */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 character map support (body).                                 */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2006 by                                          */
+/*  Copyright 2002, 2003, 2006, 2007 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -95,7 +95,7 @@
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   t1_cmap_std_char_next( T1_CMapStd   cmap,
                          FT_UInt32   *pchar_code )
   {
   t1_cmap_std_char_next( T1_CMapStd   cmap,
                          FT_UInt32   *pchar_code )
   {
     (FT_CMap_InitFunc)     t1_cmap_standard_init,
     (FT_CMap_DoneFunc)     t1_cmap_std_done,
     (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,
     (FT_CMap_InitFunc)     t1_cmap_standard_init,
     (FT_CMap_DoneFunc)     t1_cmap_std_done,
     (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,
-    (FT_CMap_CharNextFunc) t1_cmap_std_char_next
+    (FT_CMap_CharNextFunc) t1_cmap_std_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
   };
 
 
   };
 
 
     (FT_CMap_InitFunc)     t1_cmap_expert_init,
     (FT_CMap_DoneFunc)     t1_cmap_std_done,
     (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,
     (FT_CMap_InitFunc)     t1_cmap_expert_init,
     (FT_CMap_DoneFunc)     t1_cmap_std_done,
     (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,
-    (FT_CMap_CharNextFunc) t1_cmap_std_char_next
+    (FT_CMap_CharNextFunc) t1_cmap_std_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
   };
 
 
   };
 
 
 
 
     cmap->first   = encoding->code_first;
 
 
     cmap->first   = encoding->code_first;
-    cmap->count   = (FT_UInt)( encoding->code_last - cmap->first + 1 );
+    cmap->count   = (FT_UInt)( encoding->code_last - cmap->first );
     cmap->indices = encoding->char_index;
 
     FT_ASSERT( cmap->indices != NULL );
     cmap->indices = encoding->char_index;
 
     FT_ASSERT( cmap->indices != NULL );
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   t1_cmap_custom_char_next( T1_CMapCustom  cmap,
                             FT_UInt32     *pchar_code )
   {
   t1_cmap_custom_char_next( T1_CMapCustom  cmap,
                             FT_UInt32     *pchar_code )
   {
     (FT_CMap_InitFunc)     t1_cmap_custom_init,
     (FT_CMap_DoneFunc)     t1_cmap_custom_done,
     (FT_CMap_CharIndexFunc)t1_cmap_custom_char_index,
     (FT_CMap_InitFunc)     t1_cmap_custom_init,
     (FT_CMap_DoneFunc)     t1_cmap_custom_done,
     (FT_CMap_CharIndexFunc)t1_cmap_custom_char_index,
-    (FT_CMap_CharNextFunc) t1_cmap_custom_char_next
+    (FT_CMap_CharNextFunc) t1_cmap_custom_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
   };
 
 
   };
 
 
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   t1_cmap_unicode_char_next( PS_Unicodes  unicodes,
                              FT_UInt32   *pchar_code )
   {
   t1_cmap_unicode_char_next( PS_Unicodes  unicodes,
                              FT_UInt32   *pchar_code )
   {
     (FT_CMap_InitFunc)     t1_cmap_unicode_init,
     (FT_CMap_DoneFunc)     t1_cmap_unicode_done,
     (FT_CMap_CharIndexFunc)t1_cmap_unicode_char_index,
     (FT_CMap_InitFunc)     t1_cmap_unicode_init,
     (FT_CMap_DoneFunc)     t1_cmap_unicode_done,
     (FT_CMap_CharIndexFunc)t1_cmap_unicode_char_index,
-    (FT_CMap_CharNextFunc) t1_cmap_unicode_char_next
+    (FT_CMap_CharNextFunc) t1_cmap_unicode_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
   };
 
 
   };
 
 
index f790643..b3245a6 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript Type 1 decoding routines (body).                          */
 /*                                                                         */
 /*                                                                         */
 /*    PostScript Type 1 decoding routines (body).                          */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -17,6 +17,7 @@
 
 
 #include <ft2build.h>
 
 
 #include <ft2build.h>
+#include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 #include FT_OUTLINE_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 #include FT_OUTLINE_H
       FT_String*  name = (FT_String*)decoder->glyph_names[n];
 
 
       FT_String*  name = (FT_String*)decoder->glyph_names[n];
 
 
-      if ( name && name[0] == glyph_name[0]  &&
+      if ( name                               &&
+           name[0] == glyph_name[0]           &&
            ft_strcmp( name, glyph_name ) == 0 )
         return n;
     }
            ft_strcmp( name, glyph_name ) == 0 )
         return n;
     }
 #endif
     FT_Vector    left_bearing, advance;
 
 #endif
     FT_Vector    left_bearing, advance;
 
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+    T1_Face      face  = (T1_Face)decoder->builder.face;
+#endif     
+
+
+    if ( decoder->seac )
+    {
+      FT_ERROR(( "t1operator_seac: invalid nested seac\n" ));
+      return PSaux_Err_Syntax_Error;
+    }
 
     /* seac weirdness */
     adx += decoder->builder.left_bearing.x;
 
     /* seac weirdness */
     adx += decoder->builder.left_bearing.x;
     /* include an encoding.  How can we deal with these?    */
     if ( decoder->glyph_names == 0 )
     {
     /* include an encoding.  How can we deal with these?    */
     if ( decoder->glyph_names == 0 )
     {
-      FT_ERROR(( "t1operator_seac:" ));
-      FT_ERROR(( " glyph names table not available in this font!\n" ));
+      FT_ERROR(( "t1operator_seac:"
+                 " glyph names table not available in this font\n" ));
       return PSaux_Err_Syntax_Error;
     }
 
       return PSaux_Err_Syntax_Error;
     }
 
-    bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar );
-    achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar );
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+    if ( face->root.internal->incremental_interface )
+    {
+      /* the caller must handle the font encoding also */
+      bchar_index = bchar;
+      achar_index = achar;
+    }
+    else
+#endif
+    {
+      bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar );
+      achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar );
+    }
 
     if ( bchar_index < 0 || achar_index < 0 )
     {
 
     if ( bchar_index < 0 || achar_index < 0 )
     {
-      FT_ERROR(( "t1operator_seac:" ));
-      FT_ERROR(( " invalid seac character code arguments\n" ));
+      FT_ERROR(( "t1operator_seac:"
+                 " invalid seac character code arguments\n" ));
       return PSaux_Err_Syntax_Error;
     }
 
       return PSaux_Err_Syntax_Error;
     }
 
       /* subglyph 1 = accent character */
       subg->index = achar_index;
       subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
       /* subglyph 1 = accent character */
       subg->index = achar_index;
       subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
-      subg->arg1  = (FT_Int)( adx - asb );
-      subg->arg2  = (FT_Int)ady;
+      subg->arg1  = (FT_Int)FIXED_TO_INT( adx - asb );
+      subg->arg2  = (FT_Int)FIXED_TO_INT( ady );
 
       /* set up remaining glyph fields */
       glyph->num_subglyphs = 2;
 
       /* set up remaining glyph fields */
       glyph->num_subglyphs = 2;
 
     FT_GlyphLoader_Prepare( decoder->builder.loader );  /* prepare loader */
 
 
     FT_GlyphLoader_Prepare( decoder->builder.loader );  /* prepare loader */
 
+    /* the seac operator must not be nested */
+    decoder->seac = TRUE;
     error = t1_decoder_parse_glyph( decoder, bchar_index );
     error = t1_decoder_parse_glyph( decoder, bchar_index );
+    decoder->seac = FALSE;
     if ( error )
       goto Exit;
 
     if ( error )
       goto Exit;
 
 
     /* Now load `achar' on top of */
     /* the base outline           */
 
     /* Now load `achar' on top of */
     /* the base outline           */
+
+    /* the seac operator must not be nested */
+    decoder->seac = TRUE;
     error = t1_decoder_parse_glyph( decoder, achar_index );
     error = t1_decoder_parse_glyph( decoder, achar_index );
+    decoder->seac = FALSE;
     if ( error )
       goto Exit;
 
     if ( error )
       goto Exit;
 
     FT_Pos           x, y, orig_x, orig_y;
     FT_Int           known_othersubr_result_cnt   = 0;
     FT_Int           unknown_othersubr_result_cnt = 0;
     FT_Pos           x, y, orig_x, orig_y;
     FT_Int           known_othersubr_result_cnt   = 0;
     FT_Int           unknown_othersubr_result_cnt = 0;
+    FT_Bool          large_int;
+    FT_Fixed         seed;
 
     T1_Hints_Funcs   hinter;
 
 
     T1_Hints_Funcs   hinter;
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+    FT_Bool          bol = TRUE;
+#endif
+
 
     /* we don't want to touch the source code -- use macro trick */
 #define start_point    t1_builder_start_point
 
     /* we don't want to touch the source code -- use macro trick */
 #define start_point    t1_builder_start_point
 #define add_contour    t1_builder_add_contour
 #define close_contour  t1_builder_close_contour
 
 #define add_contour    t1_builder_add_contour
 #define close_contour  t1_builder_close_contour
 
+
+    /* compute random seed from stack address of parameter */
+    seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed              ^
+                         (FT_PtrDist)(char*)&decoder           ^
+                         (FT_PtrDist)(char*)&charstring_base ) &
+                         FT_ULONG_MAX ) ;
+    seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
+    if ( seed == 0 )
+      seed = 0x7384;
+
     /* First of all, initialize the decoder */
     decoder->top  = decoder->stack;
     decoder->zone = decoder->zones;
     /* First of all, initialize the decoder */
     decoder->top  = decoder->stack;
     decoder->zone = decoder->zones;
     /* a font that reads BuildCharArray without setting */
     /* its values first is buggy, but ...               */
     FT_ASSERT( ( decoder->len_buildchar == 0 ) ==
     /* a font that reads BuildCharArray without setting */
     /* its values first is buggy, but ...               */
     FT_ASSERT( ( decoder->len_buildchar == 0 ) ==
-               ( decoder->buildchar == NULL ) );
+               ( decoder->buildchar == NULL )  );
 
     if ( decoder->len_buildchar > 0 )
 
     if ( decoder->len_buildchar > 0 )
-      memset( &decoder->buildchar[0],
-              0,
-              sizeof( decoder->buildchar[0] ) *
-                decoder->len_buildchar );
+      ft_memset( &decoder->buildchar[0],
+                 0,
+                 sizeof( decoder->buildchar[0] ) * decoder->len_buildchar );
 
 
-    FT_TRACE4(( "\nStart charstring\n" ));
+    FT_TRACE4(( "\n"
+                "Start charstring\n" ));
 
     zone->base           = charstring_base;
     limit = zone->limit  = charstring_base + charstring_len;
 
     zone->base           = charstring_base;
     limit = zone->limit  = charstring_base + charstring_len;
     if ( hinter )
       hinter->open( hinter->hints );
 
     if ( hinter )
       hinter->open( hinter->hints );
 
+    large_int = FALSE;
+
     /* now, execute loop */
     while ( ip < limit )
     {
       FT_Long*     top   = decoder->top;
       T1_Operator  op    = op_none;
     /* now, execute loop */
     while ( ip < limit )
     {
       FT_Long*     top   = decoder->top;
       T1_Operator  op    = op_none;
-      FT_Long      value = 0;
+      FT_Int32     value = 0;
 
 
       FT_ASSERT( known_othersubr_result_cnt == 0   ||
                  unknown_othersubr_result_cnt == 0 );
 
 
 
       FT_ASSERT( known_othersubr_result_cnt == 0   ||
                  unknown_othersubr_result_cnt == 0 );
 
-      FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
+#ifdef FT_DEBUG_LEVEL_TRACE
+      if ( bol )
+      {
+        FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
+        bol = FALSE;
+      }
+#endif
 
       /*********************************************************************/
       /*                                                                   */
 
       /*********************************************************************/
       /*                                                                   */
       case 12:
         if ( ip > limit )
         {
       case 12:
         if ( ip > limit )
         {
-          FT_ERROR(( "t1_decoder_parse_charstrings: "
-                     "invalid escape (12+EOF)\n" ));
+          FT_ERROR(( "t1_decoder_parse_charstrings:"
+                     " invalid escape (12+EOF)\n" ));
           goto Syntax_Error;
         }
 
           goto Syntax_Error;
         }
 
           break;
 
         default:
           break;
 
         default:
-          FT_ERROR(( "t1_decoder_parse_charstrings: "
-                     "invalid escape (12+%d)\n",
+          FT_ERROR(( "t1_decoder_parse_charstrings:"
+                     " invalid escape (12+%d)\n",
                      ip[-1] ));
           goto Syntax_Error;
         }
                      ip[-1] ));
           goto Syntax_Error;
         }
       case 255:    /* four bytes integer */
         if ( ip + 4 > limit )
         {
       case 255:    /* four bytes integer */
         if ( ip + 4 > limit )
         {
-          FT_ERROR(( "t1_decoder_parse_charstrings: "
-                     "unexpected EOF in integer\n" ));
+          FT_ERROR(( "t1_decoder_parse_charstrings:"
+                     " unexpected EOF in integer\n" ));
           goto Syntax_Error;
         }
 
           goto Syntax_Error;
         }
 
-        value = (FT_Int32)( ((FT_Long)ip[0] << 24) |
-                            ((FT_Long)ip[1] << 16) |
-                            ((FT_Long)ip[2] << 8 ) |
-                                      ip[3] );
+        value = (FT_Int32)( ( (FT_Long)ip[0] << 24 ) |
+                            ( (FT_Long)ip[1] << 16 ) |
+                            ( (FT_Long)ip[2] << 8  ) |
+                                       ip[3]         );
         ip += 4;
         ip += 4;
+
+        /* According to the specification, values > 32000 or < -32000 must */
+        /* be followed by a `div' operator to make the result be in the    */
+        /* range [-32000;32000].  We expect that the second argument of    */
+        /* `div' is not a large number.  Additionally, we don't handle     */
+        /* stuff like `<large1> <large2> <num> div <num> div' or           */
+        /* <large1> <large2> <num> div div'.  This is probably not allowed */
+        /* anyway.                                                         */
+        if ( value > 32000 || value < -32000 )
+        {
+          if ( large_int )
+          {
+            FT_ERROR(( "t1_decoder_parse_charstrings:"
+                       " no `div' after large integer\n" ));
+          }
+          else
+            large_int = TRUE;
+        }
+        else
+        {
+          if ( !large_int )
+            value <<= 16;
+        }
+
         break;
 
       default:
         if ( ip[-1] >= 32 )
         {
           if ( ip[-1] < 247 )
         break;
 
       default:
         if ( ip[-1] >= 32 )
         {
           if ( ip[-1] < 247 )
-            value = (FT_Long)ip[-1] - 139;
+            value = (FT_Int32)ip[-1] - 139;
           else
           {
             if ( ++ip > limit )
             {
           else
           {
             if ( ++ip > limit )
             {
-              FT_ERROR(( "t1_decoder_parse_charstrings: " ));
-              FT_ERROR(( "unexpected EOF in integer\n" ));
+              FT_ERROR(( "t1_decoder_parse_charstrings:"
+                         " unexpected EOF in integer\n" ));
               goto Syntax_Error;
             }
 
             if ( ip[-2] < 251 )
               goto Syntax_Error;
             }
 
             if ( ip[-2] < 251 )
-              value =  ( ( (FT_Long)ip[-2] - 247 ) << 8 ) + ip[-1] + 108;
+              value =  ( ( (FT_Int32)ip[-2] - 247 ) << 8 ) + ip[-1] + 108;
             else
             else
-              value = -( ( ( (FT_Long)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 );
+              value = -( ( ( (FT_Int32)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 );
           }
           }
+
+          if ( !large_int )
+            value <<= 16;
         }
         else
         {
         }
         else
         {
-          FT_ERROR(( "t1_decoder_parse_charstrings: "
-                     "invalid byte (%d)\n", ip[-1] ));
+          FT_ERROR(( "t1_decoder_parse_charstrings:"
+                     " invalid byte (%d)\n", ip[-1] ));
           goto Syntax_Error;
         }
       }
           goto Syntax_Error;
         }
       }
         }
       }
 
         }
       }
 
+      if ( large_int && !( op == op_none || op == op_div ) )
+      {
+        FT_ERROR(( "t1_decoder_parse_charstrings:"
+                   " no `div' after large integer\n" ));
+
+        large_int = FALSE;
+      }
+
       /*********************************************************************/
       /*                                                                   */
       /*  Push value on stack, or process operator                         */
       /*********************************************************************/
       /*                                                                   */
       /*  Push value on stack, or process operator                         */
       {
         if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
         {
       {
         if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
         {
-          FT_ERROR(( "t1_decoder_parse_charstrings: stack overflow!\n" ));
+          FT_ERROR(( "t1_decoder_parse_charstrings: stack overflow\n" ));
           goto Syntax_Error;
         }
 
           goto Syntax_Error;
         }
 
-        FT_TRACE4(( " %ld", value ));
+#ifdef FT_DEBUG_LEVEL_TRACE
+        if ( large_int )
+          FT_TRACE4(( " %ld", value ));
+        else
+          FT_TRACE4(( " %ld", (FT_Int32)( value >> 16 ) ));
+#endif
 
         *top++       = value;
         decoder->top = top;
 
         *top++       = value;
         decoder->top = top;
         FT_Int  arg_cnt;
 
 
         FT_Int  arg_cnt;
 
 
-        FT_TRACE4(( " callothersubr" ));
+#ifdef FT_DEBUG_LEVEL_TRACE
+        FT_TRACE4(( " callothersubr\n" ));
+        bol = TRUE;
+#endif
 
         if ( top - decoder->stack < 2 )
           goto Stack_Underflow;
 
         top -= 2;
 
 
         if ( top - decoder->stack < 2 )
           goto Stack_Underflow;
 
         top -= 2;
 
-        subr_no = (FT_Int)top[1];
-        arg_cnt = (FT_Int)top[0];
+        subr_no = (FT_Int)( top[1] >> 16 );
+        arg_cnt = (FT_Int)( top[0] >> 16 );
 
         /***********************************************************/
         /*                                                         */
 
         /***********************************************************/
         /*                                                         */
           if ( decoder->flex_state       == 0 ||
                decoder->num_flex_vectors != 7 )
           {
           if ( decoder->flex_state       == 0 ||
                decoder->num_flex_vectors != 7 )
           {
-            FT_ERROR(( "t1_decoder_parse_charstrings: "
-                       "unexpected flex end\n" ));
+            FT_ERROR(( "t1_decoder_parse_charstrings:"
+                       " unexpected flex end\n" ));
             goto Syntax_Error;
           }
 
             goto Syntax_Error;
           }
 
 
           if ( hinter )
             hinter->reset( hinter->hints, builder->current->n_points );
 
           if ( hinter )
             hinter->reset( hinter->hints, builder->current->n_points );
-
           break;
 
         case 12:
           break;
 
         case 12:
 
             if ( !blend )
             {
 
             if ( !blend )
             {
-              FT_ERROR(( "t1_decoder_parse_charstrings: " ));
-              FT_ERROR(( "unexpected multiple masters operator!\n" ));
+              FT_ERROR(( "t1_decoder_parse_charstrings:"
+                         " unexpected multiple masters operator\n" ));
               goto Syntax_Error;
             }
 
             num_points = (FT_UInt)subr_no - 13 + ( subr_no == 18 );
             if ( arg_cnt != (FT_Int)( num_points * blend->num_designs ) )
             {
               goto Syntax_Error;
             }
 
             num_points = (FT_UInt)subr_no - 13 + ( subr_no == 18 );
             if ( arg_cnt != (FT_Int)( num_points * blend->num_designs ) )
             {
-              FT_ERROR(( "t1_decoder_parse_charstrings: " ));
-              FT_ERROR(( "incorrect number of mm arguments\n" ));
+              FT_ERROR(( "t1_decoder_parse_charstrings:"
+                         " incorrect number of multiple masters arguments\n" ));
               goto Syntax_Error;
             }
 
               goto Syntax_Error;
             }
 
             break;
           }
 
             break;
           }
 
-#ifdef CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS
-
-          /* We cannot yet enable these since currently  */
-          /* our T1 stack stores integers which lack the */
-          /* precision to express the values             */
-
         case 19:
           /* <idx> 1 19 callothersubr                             */
           /* => replace elements starting from index cvi( <idx> ) */
         case 19:
           /* <idx> 1 19 callothersubr                             */
           /* => replace elements starting from index cvi( <idx> ) */
             if ( arg_cnt != 1 || blend == NULL )
               goto Unexpected_OtherSubr;
 
             if ( arg_cnt != 1 || blend == NULL )
               goto Unexpected_OtherSubr;
 
-            idx = top[0];
+            idx = (FT_Int)( top[0] >> 16 );
 
 
-            if ( idx < 0                                                 ||
-                 idx + blend->num_designs > decoder->face->len_buildchar )
+            if ( idx < 0                                           ||
+                 idx + blend->num_designs > decoder->len_buildchar )
               goto Unexpected_OtherSubr;
 
               goto Unexpected_OtherSubr;
 
-            memcpy( &decoder->buildchar[idx],
-                    blend->weight_vector,
-                    blend->num_designs *
-                      sizeof( blend->weight_vector[ 0 ] ) );
+            ft_memcpy( &decoder->buildchar[idx],
+                       blend->weight_vector,
+                       blend->num_designs *
+                         sizeof( blend->weight_vector[0] ) );
           }
           break;
 
           }
           break;
 
           if ( arg_cnt != 2 )
             goto Unexpected_OtherSubr;
 
           if ( arg_cnt != 2 )
             goto Unexpected_OtherSubr;
 
-          top[0] *= top[1]; /* XXX (over|under)flow */
+          top[0] = FT_MulFix( top[0], top[1] );
 
           known_othersubr_result_cnt = 1;
           break;
 
           known_othersubr_result_cnt = 1;
           break;
           if ( arg_cnt != 2 || top[1] == 0 )
             goto Unexpected_OtherSubr;
 
           if ( arg_cnt != 2 || top[1] == 0 )
             goto Unexpected_OtherSubr;
 
-          top[0] /= top[1]; /* XXX (over|under)flow */
+          top[0] = FT_DivFix( top[0], top[1] );
 
           known_othersubr_result_cnt = 1;
           break;
 
 
           known_othersubr_result_cnt = 1;
           break;
 
-#endif /* CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS */
-
         case 24:
         case 24:
-          /* <val> <idx> 2 24 callothersubr              */
-          /* => set BuildCharArray[cvi( <idx> )] = <val> */
+          /* <val> <idx> 2 24 callothersubr               */
+          /* ==> set BuildCharArray[cvi( <idx> )] = <val> */
           {
             FT_Int    idx;
             PS_Blend  blend = decoder->blend;
 
           {
             FT_Int    idx;
             PS_Blend  blend = decoder->blend;
 
+
             if ( arg_cnt != 2 || blend == NULL )
               goto Unexpected_OtherSubr;
 
             if ( arg_cnt != 2 || blend == NULL )
               goto Unexpected_OtherSubr;
 
-            idx = top[1];
+            idx = (FT_Int)( top[1] >> 16 );
 
             if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
               goto Unexpected_OtherSubr;
 
             if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
               goto Unexpected_OtherSubr;
           break;
 
         case 25:
           break;
 
         case 25:
-          /* <idx> 1 25 callothersubr pop       */
-          /* => push BuildCharArray[cvi( idx )] */
-          /*    onto T1 stack                   */
+          /* <idx> 1 25 callothersubr pop        */
+          /* ==> push BuildCharArray[cvi( idx )] */
+          /*     onto T1 stack                   */
           {
             FT_Int    idx;
             PS_Blend  blend = decoder->blend;
 
           {
             FT_Int    idx;
             PS_Blend  blend = decoder->blend;
 
+
             if ( arg_cnt != 1 || blend == NULL )
               goto Unexpected_OtherSubr;
 
             if ( arg_cnt != 1 || blend == NULL )
               goto Unexpected_OtherSubr;
 
-            idx = top[0];
+            idx = (FT_Int)( top[0] >> 16 );
 
             if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
               goto Unexpected_OtherSubr;
 
             if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
               goto Unexpected_OtherSubr;
           /* <val> mark <idx> ==> set BuildCharArray[cvi( <idx> )] = <val>, */
           /*                      leave mark on T1 stack                    */
           /* <val> <idx>      ==> set BuildCharArray[cvi( <idx> )] = <val>  */
           /* <val> mark <idx> ==> set BuildCharArray[cvi( <idx> )] = <val>, */
           /*                      leave mark on T1 stack                    */
           /* <val> <idx>      ==> set BuildCharArray[cvi( <idx> )] = <val>  */
-          XXX who has left his mark on the (PostScript) stack ?;
+          XXX which routine has left its mark on the (PostScript) stack?;
           break;
 #endif
 
         case 27:
           /* <res1> <res2> <val1> <val2> 4 27 callothersubr pop */
           break;
 #endif
 
         case 27:
           /* <res1> <res2> <val1> <val2> 4 27 callothersubr pop */
-          /* ==> push <res1> onto T1 stack if <val1> <= <val2>,  */
+          /* ==> push <res1> onto T1 stack if <val1> <= <val2>, */
           /*     otherwise push <res2>                          */
           if ( arg_cnt != 4 )
             goto Unexpected_OtherSubr;
           /*     otherwise push <res2>                          */
           if ( arg_cnt != 4 )
             goto Unexpected_OtherSubr;
           known_othersubr_result_cnt = 1;
           break;
 
           known_othersubr_result_cnt = 1;
           break;
 
-#ifdef CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS
         case 28:
           /* 0 28 callothersubr pop                               */
           /* => push random value from interval [0, 1) onto stack */
           if ( arg_cnt != 0 )
             goto Unexpected_OtherSubr;
 
         case 28:
           /* 0 28 callothersubr pop                               */
           /* => push random value from interval [0, 1) onto stack */
           if ( arg_cnt != 0 )
             goto Unexpected_OtherSubr;
 
-          top[0] = FT_rand();
+          {
+            FT_Fixed  Rand;
+
+
+            Rand = seed;
+            if ( Rand >= 0x8000L )
+              Rand++;
+
+            top[0] = Rand;
+
+            seed = FT_MulFix( seed, 0x10000L - seed );
+            if ( seed == 0 )
+              seed += 0x2873;
+          }
+
           known_othersubr_result_cnt = 1;
           break;
           known_othersubr_result_cnt = 1;
           break;
-#endif
 
         default:
 
         default:
-          FT_ERROR(( "t1_decoder_parse_charstrings: "
-                     "unknown othersubr [%d %d], wish me luck!\n",
+          FT_ERROR(( "t1_decoder_parse_charstrings:"
+                     " unknown othersubr [%d %d], wish me luck\n",
                      arg_cnt, subr_no ));
           unknown_othersubr_result_cnt = arg_cnt;
           break;
 
         Unexpected_OtherSubr:
                      arg_cnt, subr_no ));
           unknown_othersubr_result_cnt = arg_cnt;
           break;
 
         Unexpected_OtherSubr:
-          FT_ERROR(( "t1_decoder_parse_charstrings: "
-                     "invalid othersubr [%d %d]!\n", arg_cnt, subr_no ));
+          FT_ERROR(( "t1_decoder_parse_charstrings:"
+                     " invalid othersubr [%d %d]\n", arg_cnt, subr_no ));
           goto Syntax_Error;
         }
 
           goto Syntax_Error;
         }
 
 
         default:
           if ( top - decoder->stack != num_args )
 
         default:
           if ( top - decoder->stack != num_args )
-            FT_TRACE0(( "t1_decoder_parse_charstrings: "
-                        "too much operands on the stack "
-                        "(seen %d, expected %d)\n",
+            FT_TRACE0(( "t1_decoder_parse_charstrings:"
+                        " too much operands on the stack"
+                        " (seen %d, expected %d)\n",
                         top - decoder->stack, num_args ));
             break;
         }
                         top - decoder->stack, num_args ));
             break;
         }
         switch ( op )
         {
         case op_endchar:
         switch ( op )
         {
         case op_endchar:
-          FT_TRACE4(( " endchar" ));
+          FT_TRACE4(( " endchar\n" ));
 
           close_contour( builder );
 
           /* close hints recording session */
           if ( hinter )
           {
 
           close_contour( builder );
 
           /* close hints recording session */
           if ( hinter )
           {
-            if (hinter->close( hinter->hints, builder->current->n_points ))
+            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,
               goto Syntax_Error;
 
             /* apply hints to the loaded glyph outline now */
             hinter->apply( hinter->hints,
                            builder->current,
-                           (PSH_Globals) builder->hints_globals,
+                           (PSH_Globals)builder->hints_globals,
                            decoder->hint_mode );
           }
 
           /* add current outline to the glyph slot */
           FT_GlyphLoader_Add( builder->loader );
 
                            decoder->hint_mode );
           }
 
           /* add current outline to the glyph slot */
           FT_GlyphLoader_Add( builder->loader );
 
-          FT_TRACE4(( "\n" ));
-
           /* the compiler should optimize away this empty loop but ... */
 
 #ifdef FT_DEBUG_LEVEL_TRACE
           /* the compiler should optimize away this empty loop but ... */
 
 #ifdef FT_DEBUG_LEVEL_TRACE
           builder->advance.x       = top[1];
           builder->advance.y       = 0;
 
           builder->advance.x       = top[1];
           builder->advance.y       = 0;
 
-          orig_x = builder->last.x = x = builder->pos_x + top[0];
-          orig_y = builder->last.y = y = builder->pos_y;
+          orig_x = x = builder->pos_x + top[0];
+          orig_y = y = builder->pos_y;
 
           FT_UNUSED( orig_y );
 
 
           FT_UNUSED( orig_y );
 
           break;
 
         case op_seac:
           break;
 
         case op_seac:
-          /* return immediately after the processing */
-          return t1operator_seac( decoder, top[0], top[1], top[2],
-                                           (FT_Int)top[3], (FT_Int)top[4] );
+          return t1operator_seac( decoder,
+                                  top[0],
+                                  top[1],
+                                  top[2],
+                                  (FT_Int)( top[3] >> 16 ),
+                                  (FT_Int)( top[4] >> 16 ) );
 
         case op_sbw:
           FT_TRACE4(( " sbw" ));
 
         case op_sbw:
           FT_TRACE4(( " sbw" ));
           builder->advance.x       = top[2];
           builder->advance.y       = top[3];
 
           builder->advance.x       = top[2];
           builder->advance.y       = top[3];
 
-          builder->last.x = x = builder->pos_x + top[0];
-          builder->last.y = y = builder->pos_y + top[1];
+          x = builder->pos_x + top[0];
+          y = builder->pos_y + top[1];
 
           /* the `metrics_only' indicates that we only want to compute */
           /* the glyph's metrics (lsb + advance width), not load the   */
 
           /* the `metrics_only' indicates that we only want to compute */
           /* the glyph's metrics (lsb + advance width), not load the   */
         case op_closepath:
           FT_TRACE4(( " closepath" ));
 
         case op_closepath:
           FT_TRACE4(( " closepath" ));
 
-          close_contour( builder );
-          if ( !( builder->parse_state == T1_Parse_Have_Path   ||
-                  builder->parse_state == T1_Parse_Have_Moveto ) )
-            goto Syntax_Error;
+          /* if there is no path, `closepath' is a no-op */
+          if ( builder->parse_state == T1_Parse_Have_Path   ||
+               builder->parse_state == T1_Parse_Have_Moveto )
+            close_contour( builder );
+
           builder->parse_state = T1_Parse_Have_Width;
           break;
 
           builder->parse_state = T1_Parse_Have_Width;
           break;
 
           break;
 
         case op_rrcurveto:
           break;
 
         case op_rrcurveto:
-          FT_TRACE4(( " rcurveto" ));
+          FT_TRACE4(( " rrcurveto" ));
 
           if ( start_point( builder, x, y ) ||
                check_points( builder, 3 )   )
 
           if ( start_point( builder, x, y ) ||
                check_points( builder, 3 )   )
         case op_div:
           FT_TRACE4(( " div" ));
 
         case op_div:
           FT_TRACE4(( " div" ));
 
-          if ( top[1] )
-          {
-            *top = top[0] / top[1];
-            ++top;
-          }
-          else
-          {
-            FT_ERROR(( "t1_decoder_parse_charstrings: division by 0\n" ));
-            goto Syntax_Error;
-          }
+          /* if `large_int' is set, we divide unscaled numbers; */
+          /* otherwise, we divide numbers in 16.16 format --    */
+          /* in both cases, it is the same operation            */
+          *top = FT_DivFix( top[0], top[1] );
+          ++top;
+
+          large_int = FALSE;
           break;
 
         case op_callsubr:
           break;
 
         case op_callsubr:
 
             FT_TRACE4(( " callsubr" ));
 
 
             FT_TRACE4(( " callsubr" ));
 
-            idx = (FT_Int)top[0];
+            idx = (FT_Int)( top[0] >> 16 );
             if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs )
             {
             if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs )
             {
-              FT_ERROR(( "t1_decoder_parse_charstrings: "
-                         "invalid subrs index\n" ));
+              FT_ERROR(( "t1_decoder_parse_charstrings:"
+                         " invalid subrs index\n" ));
               goto Syntax_Error;
             }
 
             if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
             {
               goto Syntax_Error;
             }
 
             if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
             {
-              FT_ERROR(( "t1_decoder_parse_charstrings: "
-                         "too many nested subrs\n" ));
+              FT_ERROR(( "t1_decoder_parse_charstrings:"
+                         " too many nested subrs\n" ));
               goto Syntax_Error;
             }
 
               goto Syntax_Error;
             }
 
 
             if ( !zone->base )
             {
 
             if ( !zone->base )
             {
-              FT_ERROR(( "t1_decoder_parse_charstrings: "
-                         "invoking empty subrs!\n" ));
+              FT_ERROR(( "t1_decoder_parse_charstrings:"
+                         " invoking empty subrs\n" ));
               goto Syntax_Error;
             }
 
               goto Syntax_Error;
             }
 
 
           if ( unknown_othersubr_result_cnt == 0 )
           {
 
           if ( unknown_othersubr_result_cnt == 0 )
           {
-            FT_ERROR(( "t1_decoder_parse_charstrings: "
-                       "no more operands for othersubr!\n" ));
+            FT_ERROR(( "t1_decoder_parse_charstrings:"
+                       " no more operands for othersubr\n" ));
             goto Syntax_Error;
           }
 
             goto Syntax_Error;
           }
 
 
           if ( zone <= decoder->zones )
           {
 
           if ( zone <= decoder->zones )
           {
-            FT_ERROR(( "t1_decoder_parse_charstrings: unexpected return\n" ));
+            FT_ERROR(( "t1_decoder_parse_charstrings:"
+                       " unexpected return\n" ));
             goto Syntax_Error;
           }
 
             goto Syntax_Error;
           }
 
             /* top[0] += builder->left_bearing.y; */
             hinter->stem( hinter->hints, 1, top );
           }
             /* top[0] += builder->left_bearing.y; */
             hinter->stem( hinter->hints, 1, top );
           }
-
           break;
 
         case op_hstem3:
           break;
 
         case op_hstem3:
           /* record horizontal counter-controlled hints */
           if ( hinter )
             hinter->stem3( hinter->hints, 1, top );
           /* record horizontal counter-controlled hints */
           if ( hinter )
             hinter->stem3( hinter->hints, 1, top );
-
           break;
 
         case op_vstem:
           FT_TRACE4(( " vstem" ));
 
           break;
 
         case op_vstem:
           FT_TRACE4(( " vstem" ));
 
-          /* record vertical  hint */
+          /* record vertical hint */
           if ( hinter )
           {
             top[0] += orig_x;
             hinter->stem( hinter->hints, 0, top );
           }
           if ( hinter )
           {
             top[0] += orig_x;
             hinter->stem( hinter->hints, 0, top );
           }
-
           break;
 
         case op_vstem3:
           break;
 
         case op_vstem3:
           /* known_othersubr_result_cnt != 0 is already handled above */
           if ( decoder->flex_state != 1 )
           {
           /* known_othersubr_result_cnt != 0 is already handled above */
           if ( decoder->flex_state != 1 )
           {
-            FT_ERROR(( "t1_decoder_parse_charstrings: " ));
-            FT_ERROR(( "unexpected `setcurrentpoint'\n" ));
-
+            FT_ERROR(( "t1_decoder_parse_charstrings:"
+                       " unexpected `setcurrentpoint'\n" ));
             goto Syntax_Error;
           }
           else
             goto Syntax_Error;
           }
           else
           break;
 
         default:
           break;
 
         default:
-          FT_ERROR(( "t1_decoder_parse_charstrings: "
-                     "unhandled opcode %d\n", op ));
+          FT_ERROR(( "t1_decoder_parse_charstrings:"
+                     " unhandled opcode %d\n", op ));
           goto Syntax_Error;
         }
 
           goto Syntax_Error;
         }
 
 
         decoder->top = top;
 
 
         decoder->top = top;
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+        FT_TRACE4(( "\n" ));
+        bol = TRUE;
+#endif
+
       } /* general operator processing */
 
     } /* while ip < limit */
       } /* general operator processing */
 
     } /* while ip < limit */
       FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
       if ( !psnames )
       {
       FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
       if ( !psnames )
       {
-        FT_ERROR(( "t1_decoder_init: " ));
-        FT_ERROR(( "the `psnames' module is not available\n" ));
+        FT_ERROR(( "t1_decoder_init:"
+                   " the `psnames' module is not available\n" ));
         return PSaux_Err_Unimplemented_Feature;
       }
 
         return PSaux_Err_Unimplemented_Feature;
       }
 
index 769dcc4..779f1b0 100644 (file)
@@ -16,7 +16,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) pshinter ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = pshrec pshglob pshalgo pshmod ;
+    _sources = pshrec pshglob pshalgo pshmod pshpic ;
   }
   else
   {
   }
   else
   {
index cd171d0..ed24eb7 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += PSHINTER_MODULE
 
 define PSHINTER_MODULE
 FTMODULE_H_COMMANDS += PSHINTER_MODULE
 
 define PSHINTER_MODULE
-$(OPEN_DRIVER)pshinter_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, pshinter_module_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)pshinter  $(ECHO_DRIVER_DESC)Postscript hinter module$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)pshinter  $(ECHO_DRIVER_DESC)Postscript hinter module$(ECHO_DRIVER_DONE)
 endef
 
index 505d95c..417dcee 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript hinting algorithm (body).                                 */
 /*                                                                         */
 /*                                                                         */
 /*    PostScript hinting algorithm (body).                                 */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 by                  */
+/*  Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used        */
 
     if ( idx >= table->max_hints )
     {
 
     if ( idx >= table->max_hints )
     {
-      FT_ERROR(( "psh_hint_table_record: invalid hint index %d\n", idx ));
+      FT_TRACE0(( "psh_hint_table_record: invalid hint index %d\n", idx ));
       return;
     }
 
       return;
     }
 
     if ( table->num_hints < table->max_hints )
       table->sort_global[table->num_hints++] = hint;
     else
     if ( table->num_hints < table->max_hints )
       table->sort_global[table->num_hints++] = hint;
     else
-      FT_ERROR(( "psh_hint_table_record: too many sorted hints!  BUG!\n" ));
+      FT_TRACE0(( "psh_hint_table_record: too many sorted hints!  BUG!\n" ));
   }
 
 
   }
 
 
       FT_UInt  idx;
 
 
       FT_UInt  idx;
 
 
-      FT_ERROR(( "psh_hint_table_init: missing/incorrect hint masks!\n" ));
+      FT_TRACE0(( "psh_hint_table_init: missing/incorrect hint masks\n" ));
 
       count = table->max_hints;
       for ( idx = 0; idx < count; idx++ )
 
       count = table->max_hints;
       for ( idx = 0; idx < count; idx++ )
           {
             hint2 = sort[0];
             if ( psh_hint_overlap( hint, hint2 ) )
           {
             hint2 = sort[0];
             if ( psh_hint_overlap( hint, hint2 ) )
-              FT_ERROR(( "psh_hint_table_activate_mask:"
-                         " found overlapping hints\n" ))
+              FT_TRACE0(( "psh_hint_table_activate_mask:"
+                          " found overlapping hints\n" ))
           }
 #else
           count2 = 0;
           }
 #else
           count2 = 0;
             if ( count < table->max_hints )
               table->sort[count++] = hint;
             else
             if ( count < table->max_hints )
               table->sort[count++] = hint;
             else
-              FT_ERROR(( "psh_hint_tableactivate_mask:"
-                         " too many active hints\n" ));
+              FT_TRACE0(( "psh_hint_tableactivate_mask:"
+                          " too many active hints\n" ));
           }
         }
       }
           }
         }
       }
 
 #ifdef DEBUG_ZONES
 
 
 #ifdef DEBUG_ZONES
 
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
 
   static void
   psh_print_zone( PSH_Zone  zone )
 
   static void
   psh_print_zone( PSH_Zone  zone )
       FT_Fixed  x_scale = dim_x->scale_mult;
       FT_Fixed  y_scale = dim_y->scale_mult;
 
       FT_Fixed  x_scale = dim_x->scale_mult;
       FT_Fixed  y_scale = dim_y->scale_mult;
 
+      FT_Fixed  old_x_scale = x_scale;
+      FT_Fixed  old_y_scale = y_scale;
+
       FT_Fixed  scaled;
       FT_Fixed  fitted;
 
       FT_Fixed  scaled;
       FT_Fixed  fitted;
 
+      FT_Bool  rescale = FALSE;
+
 
       scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
       fitted = FT_PIX_ROUND( scaled );
 
       if ( fitted != 0 && scaled != fitted )
       {
 
       scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
       fitted = FT_PIX_ROUND( scaled );
 
       if ( fitted != 0 && scaled != fitted )
       {
+        rescale = TRUE;
+
         y_scale = FT_MulDiv( y_scale, fitted, scaled );
 
         if ( fitted < scaled )
         y_scale = FT_MulDiv( y_scale, fitted, scaled );
 
         if ( fitted < scaled )
 
         psh_globals_set_scale( glyph->globals, x_scale, y_scale, 0, 0 );
       }
 
         psh_globals_set_scale( glyph->globals, x_scale, y_scale, 0, 0 );
       }
-    }
-
-    glyph->do_horz_hints = 1;
-    glyph->do_vert_hints = 1;
-
-    glyph->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
-                                       hint_mode == FT_RENDER_MODE_LCD  );
 
 
-    glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO  ||
-                                       hint_mode == FT_RENDER_MODE_LCD_V );
+      glyph->do_horz_hints = 1;
+      glyph->do_vert_hints = 1;
 
 
-    glyph->do_stem_adjust   = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );
+      glyph->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
+                                         hint_mode == FT_RENDER_MODE_LCD  );
 
 
-    for ( dimension = 0; dimension < 2; dimension++ )
-    {
-      /* load outline coordinates into glyph */
-      psh_glyph_load_points( glyph, dimension );
-
-      /* compute local extrema */
-      psh_glyph_compute_extrema( glyph );
-
-      /* compute aligned stem/hints positions */
-      psh_hint_table_align_hints( &glyph->hint_tables[dimension],
-                                  glyph->globals,
-                                  dimension,
-                                  glyph );
+      glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO  ||
+                                         hint_mode == FT_RENDER_MODE_LCD_V );
 
 
-      /* 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 );
+      glyph->do_stem_adjust   = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );
 
 
-      /* save hinted coordinates back to outline */
-      psh_glyph_save_points( glyph, dimension );
+      for ( dimension = 0; dimension < 2; dimension++ )
+      {
+        /* load outline coordinates into glyph */
+        psh_glyph_load_points( glyph, dimension );
+
+        /* compute local extrema */
+        psh_glyph_compute_extrema( glyph );
+
+        /* compute aligned stem/hints positions */
+        psh_hint_table_align_hints( &glyph->hint_tables[dimension],
+                                    glyph->globals,
+                                    dimension,
+                                    glyph );
+
+        /* 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 );
+
+        /* save hinted coordinates back to outline */
+        psh_glyph_save_points( glyph, dimension );
+
+        if ( rescale )
+          psh_globals_set_scale( glyph->globals,
+                                 old_x_scale, old_y_scale, 0, 0 );
+      }
     }
 
   Exit:
     }
 
   Exit:
index f68de71..1a248a7 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript hinting algorithm (specification).                        */
 /*                                                                         */
 /*                                                                         */
 /*    PostScript hinting algorithm (specification).                        */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003 by                                          */
+/*  Copyright 2001, 2002, 2003, 2008 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -32,7 +32,7 @@ FT_BEGIN_HEADER
   typedef struct PSH_HintRec_*  PSH_Hint;
 
   /* hint bit-flags */
   typedef struct PSH_HintRec_*  PSH_Hint;
 
   /* hint bit-flags */
-  typedef enum
+  typedef enum  PSH_Hint_Flags_
   {
     PSH_HINT_GHOST  = PS_HINT_FLAG_GHOST,
     PSH_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM,
   {
     PSH_HINT_GHOST  = PS_HINT_FLAG_GHOST,
     PSH_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM,
index 8e3f193..b35a2a9 100644 (file)
@@ -19,6 +19,7 @@
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
+#include "pshpic.c"
 #include "pshrec.c"
 #include "pshglob.c"
 #include "pshalgo.c"
 #include "pshrec.c"
 #include "pshglob.c"
 #include "pshalgo.c"
index 4eb3d91..91da5d7 100644 (file)
@@ -20,6 +20,7 @@
 #include FT_INTERNAL_OBJECTS_H
 #include "pshrec.h"
 #include "pshalgo.h"
 #include FT_INTERNAL_OBJECTS_H
 #include "pshrec.h"
 #include "pshalgo.h"
+#include "pshpic.h"
 
 
   /* the Postscript Hinter module structure */
 
 
   /* the Postscript Hinter module structure */
   }
 
 
   }
 
 
-  static
-  const PSHinter_Interface  pshinter_interface =
-  {
+  FT_DEFINE_PSHINTER_INTERFACE(pshinter_interface,
     pshinter_get_globals_funcs,
     pshinter_get_t1_funcs,
     pshinter_get_t2_funcs
     pshinter_get_globals_funcs,
     pshinter_get_t1_funcs,
     pshinter_get_t2_funcs
-  };
+  )
 
 
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Module_Class  pshinter_module_class =
-  {
+  FT_DEFINE_MODULE(pshinter_module_class,
+
     0,
     sizeof ( PS_Hinter_ModuleRec ),
     "pshinter",
     0x10000L,
     0x20000L,
 
     0,
     sizeof ( PS_Hinter_ModuleRec ),
     "pshinter",
     0x10000L,
     0x20000L,
 
-    &pshinter_interface,            /* module-specific interface */
+    &FTPSHINTER_INTERFACE_GET,            /* module-specific interface */
 
     (FT_Module_Constructor)ps_hinter_init,
     (FT_Module_Destructor) ps_hinter_done,
     (FT_Module_Requester)  0        /* no additional interface for now */
 
     (FT_Module_Constructor)ps_hinter_init,
     (FT_Module_Destructor) ps_hinter_done,
     (FT_Module_Requester)  0        /* no additional interface for now */
-  };
-
+  )
 
 /* END */
 
 /* END */
index 1a91025..0ae7e96 100644 (file)
@@ -27,7 +27,7 @@
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
 
-  FT_EXPORT_VAR( const FT_Module_Class )  pshinter_module_class;
+  FT_DECLARE_MODULE( pshinter_module_class )
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
diff --git a/reactos/lib/3rdparty/freetype/src/pshinter/pshpic.c b/reactos/lib/3rdparty/freetype/src/pshinter/pshpic.c
new file mode 100644 (file)
index 0000000..51a0879
--- /dev/null
@@ -0,0 +1,67 @@
+/***************************************************************************/
+/*                                                                         */
+/*  pshpic.c                                                               */
+/*                                                                         */
+/*    The FreeType position independent code services for pshinter module. */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "pshpic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from pshmod.c */
+  void FT_Init_Class_pshinter_interface( FT_Library, PSHinter_Interface*);
+
+  void
+  pshinter_module_class_pic_free( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory memory = library->memory;
+    if ( pic_container->pshinter )
+    {
+      FT_FREE( pic_container->pshinter );
+      pic_container->pshinter = NULL;
+    }
+  }
+
+  FT_Error
+  pshinter_module_class_pic_init( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    PSHinterPIC*  container;
+    FT_Memory memory = library->memory;
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->pshinter = container;
+    
+    /* add call to initialization function when you add new scripts */
+    FT_Init_Class_pshinter_interface(library, &container->pshinter_interface);
+
+/*Exit:*/
+    if(error)
+      pshinter_module_class_pic_free(library);
+    return error;
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/pshinter/pshpic.h b/reactos/lib/3rdparty/freetype/src/pshinter/pshpic.h
new file mode 100644 (file)
index 0000000..3555d8e
--- /dev/null
@@ -0,0 +1,53 @@
+/***************************************************************************/
+/*                                                                         */
+/*  pshpic.h                                                               */
+/*                                                                         */
+/*    The FreeType position independent code services for pshinter module. */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __PSHPIC_H__
+#define __PSHPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FTPSHINTER_INTERFACE_GET        pshinter_interface
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+
+  typedef struct PSHinterPIC_
+  {
+    PSHinter_Interface pshinter_interface;
+  } PSHinterPIC;
+
+#define GET_PIC(lib)                    ((PSHinterPIC*)((lib)->pic_container.autofit))
+#define FTPSHINTER_INTERFACE_GET        (GET_PIC(library)->pshinter_interface)
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __PSHPIC_H__ */
+
+
+/* END */
index 2a885ef..0910cc5 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PostScript hints recorder (body).                           */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType PostScript hints recorder (body).                           */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003, 2004, 2007 by                              */
+/*  Copyright 2001, 2002, 2003, 2004, 2007, 2009 by                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -20,6 +20,8 @@
 #include FT_FREETYPE_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_FREETYPE_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_CALC_H
+
 #include "pshrec.h"
 #include "pshalgo.h"
 
 #include "pshrec.h"
 #include "pshalgo.h"
 
@@ -62,7 +64,7 @@
   {
     FT_UInt   old_max = table->max_hints;
     FT_UInt   new_max = count;
   {
     FT_UInt   old_max = table->max_hints;
     FT_UInt   new_max = count;
-    FT_Error  error   = 0;
+    FT_Error  error   = PSH_Err_Ok;
 
 
     if ( new_max > old_max )
 
 
     if ( new_max > old_max )
@@ -81,7 +83,7 @@
                        FT_Memory      memory,
                        PS_Hint       *ahint )
   {
                        FT_Memory      memory,
                        PS_Hint       *ahint )
   {
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
     FT_UInt   count;
     PS_Hint   hint = 0;
 
     FT_UInt   count;
     PS_Hint   hint = 0;
 
   {
     FT_UInt   old_max = ( mask->max_bits + 7 ) >> 3;
     FT_UInt   new_max = ( count          + 7 ) >> 3;
   {
     FT_UInt   old_max = ( mask->max_bits + 7 ) >> 3;
     FT_UInt   new_max = ( count          + 7 ) >> 3;
-    FT_Error  error   = 0;
+    FT_Error  error   = PSH_Err_Ok;
 
 
     if ( new_max > old_max )
 
 
     if ( new_max > old_max )
                    FT_Int     idx,
                    FT_Memory  memory )
   {
                    FT_Int     idx,
                    FT_Memory  memory )
   {
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
     FT_Byte*  p;
 
 
     FT_Byte*  p;
 
 
   {
     FT_UInt   old_max = table->max_masks;
     FT_UInt   new_max = count;
   {
     FT_UInt   old_max = table->max_masks;
     FT_UInt   new_max = count;
-    FT_Error  error   = 0;
+    FT_Error  error   = PSH_Err_Ok;
 
 
     if ( new_max > old_max )
 
 
     if ( new_max > old_max )
                        PS_Mask       *amask )
   {
     FT_UInt   count;
                        PS_Mask       *amask )
   {
     FT_UInt   count;
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
     PS_Mask   mask  = 0;
 
 
     PS_Mask   mask  = 0;
 
 
                       FT_Memory      memory,
                       PS_Mask       *amask )
   {
                       FT_Memory      memory,
                       PS_Mask       *amask )
   {
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
     FT_UInt   count;
     PS_Mask   mask;
 
     FT_UInt   count;
     PS_Mask   mask;
 
                           FT_UInt         bit_count,
                           FT_Memory       memory )
   {
                           FT_UInt         bit_count,
                           FT_Memory       memory )
   {
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
     PS_Mask   mask;
 
 
     PS_Mask   mask;
 
 
                        FT_Memory      memory )
   {
     FT_UInt   temp;
                        FT_Memory      memory )
   {
     FT_UInt   temp;
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
 
 
     /* swap index1 and index2 so that index1 < index2 */
 
 
     /* swap index1 and index2 so that index1 < index2 */
       table->num_masks--;
     }
     else
       table->num_masks--;
     }
     else
-      FT_ERROR(( "ps_mask_table_merge: ignoring invalid indices (%d,%d)\n",
-                 index1, index2 ));
+      FT_TRACE0(( "ps_mask_table_merge: ignoring invalid indices (%d,%d)\n",
+                  index1, index2 ));
 
   Exit:
     return error;
 
   Exit:
     return error;
                            FT_Memory      memory )
   {
     FT_Int    index1, index2;
                            FT_Memory      memory )
   {
     FT_Int    index1, index2;
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
 
 
     for ( index1 = table->num_masks - 1; index1 > 0; index1-- )
 
 
     for ( index1 = table->num_masks - 1; index1 > 0; index1-- )
                              FT_UInt       idx,
                              FT_Memory     memory )
   {
                              FT_UInt       idx,
                              FT_Memory     memory )
   {
-    PS_Mask  mask;
-    FT_Error  error = 0;
+    PS_Mask   mask;
+    FT_Error  error = PSH_Err_Ok;
 
 
     /* get last hint mask */
 
 
     /* get last hint mask */
                               FT_UInt         end_point,
                               FT_Memory       memory )
   {
                               FT_UInt         end_point,
                               FT_Memory       memory )
   {
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
 
 
     /* reset current mask, if any */
 
 
     /* reset current mask, if any */
                            FT_Memory     memory,
                            FT_Int       *aindex )
   {
                            FT_Memory     memory,
                            FT_Int       *aindex )
   {
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
     FT_UInt   flags = 0;
 
 
     FT_UInt   flags = 0;
 
 
                             FT_Int        hint3,
                             FT_Memory     memory )
   {
                             FT_Int        hint3,
                             FT_Memory     memory )
   {
-    FT_Error  error   = 0;
+    FT_Error  error   = PSH_Err_Ok;
     FT_UInt   count   = dim->counters.num_masks;
     PS_Mask   counter = dim->counters.masks;
 
     FT_UInt   count   = dim->counters.num_masks;
     PS_Mask   counter = dim->counters.masks;
 
     ps_dimension_done( &hints->dimension[0], memory );
     ps_dimension_done( &hints->dimension[1], memory );
 
     ps_dimension_done( &hints->dimension[0], memory );
     ps_dimension_done( &hints->dimension[1], memory );
 
-    hints->error  = 0;
+    hints->error  = PSH_Err_Ok;
     hints->memory = 0;
   }
 
     hints->memory = 0;
   }
 
   {
     FT_MEM_ZERO( hints, sizeof ( *hints ) );
     hints->memory = memory;
   {
     FT_MEM_ZERO( hints, sizeof ( *hints ) );
     hints->memory = memory;
-    return 0;
+    return PSH_Err_Ok;
   }
 
 
   }
 
 
     {
     case PS_HINT_TYPE_1:
     case PS_HINT_TYPE_2:
     {
     case PS_HINT_TYPE_1:
     case PS_HINT_TYPE_2:
-      hints->error     = 0;
+      hints->error     = PSH_Err_Ok;
       hints->hint_type = hint_type;
 
       ps_dimension_init( &hints->dimension[0] );
       hints->hint_type = hint_type;
 
       ps_dimension_init( &hints->dimension[0] );
       hints->error     = PSH_Err_Invalid_Argument;
       hints->hint_type = hint_type;
 
       hints->error     = PSH_Err_Invalid_Argument;
       hints->hint_type = hint_type;
 
-      FT_ERROR(( "ps_hints_open: invalid charstring type!\n" ));
+      FT_TRACE0(( "ps_hints_open: invalid charstring type\n" ));
       break;
     }
   }
       break;
     }
   }
       /* limit "dimension" to 0..1 */
       if ( dimension < 0 || dimension > 1 )
       {
       /* limit "dimension" to 0..1 */
       if ( dimension < 0 || dimension > 1 )
       {
-        FT_ERROR(( "ps_hints_stem: invalid dimension (%d) used\n",
-                   dimension ));
+        FT_TRACE0(( "ps_hints_stem: invalid dimension (%d) used\n",
+                    dimension ));
         dimension = ( dimension != 0 );
       }
 
         dimension = ( dimension != 0 );
       }
 
         }
 
       default:
         }
 
       default:
-        FT_ERROR(( "ps_hints_stem: called with invalid hint type (%d)\n",
-                   hints->hint_type ));
+        FT_TRACE0(( "ps_hints_stem: called with invalid hint type (%d)\n",
+                    hints->hint_type ));
         break;
       }
     }
         break;
       }
     }
 
   /* add one Type1 counter stem to the current hints table */
   static void
 
   /* add one Type1 counter stem to the current hints table */
   static void
-  ps_hints_t1stem3( PS_Hints  hints,
-                    FT_Int    dimension,
-                    FT_Long*  stems )
+  ps_hints_t1stem3( PS_Hints   hints,
+                    FT_Int     dimension,
+                    FT_Fixed*  stems )
   {
   {
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
 
 
     if ( !hints->error )
 
 
     if ( !hints->error )
       /* limit "dimension" to 0..1 */
       if ( dimension < 0 || dimension > 1 )
       {
       /* limit "dimension" to 0..1 */
       if ( dimension < 0 || dimension > 1 )
       {
-        FT_ERROR(( "ps_hints_t1stem3: invalid dimension (%d) used\n",
-                   dimension ));
+        FT_TRACE0(( "ps_hints_t1stem3: invalid dimension (%d) used\n",
+                    dimension ));
         dimension = ( dimension != 0 );
       }
 
         dimension = ( dimension != 0 );
       }
 
         /* add the three stems to our hints/masks table */
         for ( count = 0; count < 3; count++, stems += 2 )
         {
         /* add the three stems to our hints/masks table */
         for ( count = 0; count < 3; count++, stems += 2 )
         {
-          error = ps_dimension_add_t1stem(
-                    dim, (FT_Int)stems[0], (FT_Int)stems[1],
-                    memory, &idx[count] );
+          error = ps_dimension_add_t1stem( dim,
+                                           (FT_Int)FIXED_TO_INT( stems[0] ),
+                                           (FT_Int)FIXED_TO_INT( stems[1] ),
+                                           memory, &idx[count] );
           if ( error )
             goto Fail;
         }
           if ( error )
             goto Fail;
         }
       }
       else
       {
       }
       else
       {
-        FT_ERROR(( "ps_hints_t1stem3: called with invalid hint type!\n" ));
+        FT_ERROR(( "ps_hints_t1stem3: called with invalid hint type\n" ));
         error = PSH_Err_Invalid_Argument;
         goto Fail;
       }
         error = PSH_Err_Invalid_Argument;
         goto Fail;
       }
   ps_hints_t1reset( PS_Hints  hints,
                     FT_UInt   end_point )
   {
   ps_hints_t1reset( PS_Hints  hints,
                     FT_UInt   end_point )
   {
-    FT_Error  error = 0;
+    FT_Error  error = PSH_Err_Ok;
 
 
     if ( !hints->error )
 
 
     if ( !hints->error )
       /* check bit count; must be equal to current total hint count */
       if ( bit_count !=  count1 + count2 )
       {
       /* check bit count; must be equal to current total hint count */
       if ( bit_count !=  count1 + count2 )
       {
-        FT_ERROR(( "ps_hints_t2mask: "
-                   "called with invalid bitcount %d (instead of %d)\n",
+        FT_TRACE0(( "ps_hints_t2mask:"
+                    " called with invalid bitcount %d (instead of %d)\n",
                    bit_count, count1 + count2 ));
 
         /* simply ignore the operator */
                    bit_count, count1 + count2 ));
 
         /* simply ignore the operator */
       /* check bit count, must be equal to current total hint count */
       if ( bit_count !=  count1 + count2 )
       {
       /* check bit count, must be equal to current total hint count */
       if ( bit_count !=  count1 + count2 )
       {
-        FT_ERROR(( "ps_hints_t2counter: "
-                   "called with invalid bitcount %d (instead of %d)\n",
+        FT_TRACE0(( "ps_hints_t2counter:"
+                    " called with invalid bitcount %d (instead of %d)\n",
                    bit_count, count1 + count2 ));
 
         /* simply ignore the operator */
                    bit_count, count1 + count2 ));
 
         /* simply ignore the operator */
   }
 
   static void
   }
 
   static void
-  t1_hints_stem( T1_Hints  hints,
-                 FT_Int    dimension,
-                 FT_Long*  coords )
+  t1_hints_stem( T1_Hints   hints,
+                 FT_Int     dimension,
+                 FT_Fixed*  coords )
   {
   {
-    ps_hints_stem( (PS_Hints)hints, dimension, 1, coords );
+    FT_Pos  stems[2];
+
+
+    stems[0] = FIXED_TO_INT( coords[0] );
+    stems[1] = FIXED_TO_INT( coords[1] );
+
+    ps_hints_stem( (PS_Hints)hints, dimension, 1, stems );
   }
 
 
   }
 
 
       for ( n = 0; n < count * 2; n++ )
       {
         y       += coords[n];
       for ( n = 0; n < count * 2; n++ )
       {
         y       += coords[n];
-        stems[n] = ( y + 0x8000L ) >> 16;
+        stems[n] = FIXED_TO_INT( y );
       }
 
       /* compute lengths */
       }
 
       /* compute lengths */
index f7ef900..dcb3197 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Postscript (Type1/Type2) hints recorder (specification).             */
 /*                                                                         */
 /*                                                                         */
 /*    Postscript (Type1/Type2) hints recorder (specification).             */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003, 2006 by                                    */
+/*  Copyright 2001, 2002, 2003, 2006, 2008 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -52,7 +52,7 @@ FT_BEGIN_HEADER
   typedef struct PS_HintRec_*  PS_Hint;
 
   /* hint types */
   typedef struct PS_HintRec_*  PS_Hint;
 
   /* hint types */
-  typedef enum
+  typedef enum  PS_Hint_Type_
   {
     PS_HINT_TYPE_1 = 1,
     PS_HINT_TYPE_2 = 2
   {
     PS_HINT_TYPE_1 = 1,
     PS_HINT_TYPE_2 = 2
@@ -61,7 +61,7 @@ FT_BEGIN_HEADER
 
 
   /* hint flags */
 
 
   /* hint flags */
-  typedef enum
+  typedef enum  PS_Hint_Flags_
   {
     PS_HINT_FLAG_GHOST  = 1,
     PS_HINT_FLAG_BOTTOM = 2
   {
     PS_HINT_FLAG_GHOST  = 1,
     PS_HINT_FLAG_BOTTOM = 2
index d85c1e9..06c0dda 100644 (file)
@@ -16,7 +16,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) psnames ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = psmodule ;
+    _sources = psmodule pspic ;
   }
   else
   {
   }
   else
   {
index a93063b..a6e9082 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += PSNAMES_MODULE
 
 define PSNAMES_MODULE
 FTMODULE_H_COMMANDS += PSNAMES_MODULE
 
 define PSNAMES_MODULE
-$(OPEN_DRIVER)psnames_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, psnames_module_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)psnames   $(ECHO_DRIVER_DESC)Postscript & Unicode Glyph name handling$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)psnames   $(ECHO_DRIVER_DESC)Postscript & Unicode Glyph name handling$(ECHO_DRIVER_DONE)
 endef
 
index 8d8c476..3518850 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PSNames module implementation (body).                                */
 /*                                                                         */
 /*                                                                         */
 /*    PSNames module implementation (body).                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #include "pstables.h"
 
 #include "psnamerr.h"
 #include "pstables.h"
 
 #include "psnamerr.h"
+#include "pspic.h"
 
 
 
 
-#ifndef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES
+#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
 
 
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 
 
 #define VARIANT_BIT         0x80000000UL
 
 
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 
 
 #define VARIANT_BIT         0x80000000UL
-#define BASE_GLYPH( code )  ( (code) & ~VARIANT_BIT )
+#define BASE_GLYPH( code )  ( (FT_UInt32)( (code) & ~VARIANT_BIT ) )
 
 
   /* Return the Unicode value corresponding to a given glyph.  Note that */
 
 
   /* Return the Unicode value corresponding to a given glyph.  Note that */
@@ -57,7 +58,7 @@
       /*      `uniXXXXYYYYZZZZ'...                                   */
 
       FT_Int       count;
       /*      `uniXXXXYYYYZZZZ'...                                   */
 
       FT_Int       count;
-      FT_ULong     value = 0;
+      FT_UInt32    value = 0;
       const char*  p     = glyph_name + 3;
 
 
       const char*  p     = glyph_name + 3;
 
 
@@ -92,7 +93,7 @@
         if ( *p == '\0' )
           return value;
         if ( *p == '.' )
         if ( *p == '\0' )
           return value;
         if ( *p == '.' )
-          return value | VARIANT_BIT;
+          return (FT_UInt32)( value | VARIANT_BIT );
       }
     }
 
       }
     }
 
     if ( glyph_name[0] == 'u' )
     {
       FT_Int       count;
     if ( glyph_name[0] == 'u' )
     {
       FT_Int       count;
-      FT_ULong     value = 0;
+      FT_UInt32    value = 0;
       const char*  p     = glyph_name + 1;
 
 
       const char*  p     = glyph_name + 1;
 
 
         if ( *p == '\0' )
           return value;
         if ( *p == '.' )
         if ( *p == '\0' )
           return value;
         if ( *p == '.' )
-          return value | VARIANT_BIT;
+          return (FT_UInt32)( value | VARIANT_BIT );
       }
     }
 
       }
     }
 
 
       /* now look up the glyph in the Adobe Glyph List */
       if ( !dot )
 
       /* now look up the glyph in the Adobe Glyph List */
       if ( !dot )
-        return ft_get_adobe_glyph_index( glyph_name, p );
+        return (FT_UInt32)ft_get_adobe_glyph_index( glyph_name, p );
       else
       else
-        return ft_get_adobe_glyph_index( glyph_name, dot ) | VARIANT_BIT;
+        return (FT_UInt32)( ft_get_adobe_glyph_index( glyph_name, dot ) |
+                            VARIANT_BIT );
     }
   }
 
     }
   }
 
 
     /* sort base glyphs before glyph variants */
     if ( unicode1 == unicode2 )
 
     /* sort base glyphs before glyph variants */
     if ( unicode1 == unicode2 )
-      return map1->unicode - map2->unicode;
+    {
+      if ( map1->unicode > map2->unicode )
+        return 1;
+      else if ( map1->unicode < map2->unicode )
+        return -1;
+      else
+        return 0;
+    }
     else
     else
-      return unicode1 - unicode2;
+    {
+      if ( unicode1 > unicode2 )
+        return 1;
+      else if ( unicode1 < unicode2 )
+        return -1;
+      else
+        return 0;
+    }
+  }
+
+
+  /* support for extra glyphs not handled (well) in AGL; */
+  /* we add extra mappings for them if necessary         */
+
+#define EXTRA_GLYPH_LIST_SIZE  10
+
+  static const FT_UInt32  ft_extra_glyph_unicodes[EXTRA_GLYPH_LIST_SIZE] =
+  {
+    /* WGL 4 */
+    0x0394,
+    0x03A9,
+    0x2215,
+    0x00AD,
+    0x02C9,
+    0x03BC,
+    0x2219,
+    0x00A0,
+    /* Romanian */
+    0x021A,
+    0x021B
+  };
+
+  static const char  ft_extra_glyph_names[] =
+  {
+    'D','e','l','t','a',0,
+    'O','m','e','g','a',0,
+    'f','r','a','c','t','i','o','n',0,
+    'h','y','p','h','e','n',0,
+    'm','a','c','r','o','n',0,
+    'm','u',0,
+    'p','e','r','i','o','d','c','e','n','t','e','r','e','d',0,
+    's','p','a','c','e',0,
+    'T','c','o','m','m','a','a','c','c','e','n','t',0,
+    't','c','o','m','m','a','a','c','c','e','n','t',0
+  };
+
+  static const FT_Int
+  ft_extra_glyph_name_offsets[EXTRA_GLYPH_LIST_SIZE] =
+  {
+     0,
+     6,
+    12,
+    21,
+    28,
+    35,
+    38,
+    53,
+    59,
+    72
+  };
+
+
+  static void
+  ps_check_extra_glyph_name( const char*  gname,
+                             FT_UInt      glyph,
+                             FT_UInt*     extra_glyphs,
+                             FT_UInt     *states )
+  {
+    FT_UInt  n;
+
+
+    for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
+    {
+      if ( ft_strcmp( ft_extra_glyph_names +
+                        ft_extra_glyph_name_offsets[n], gname ) == 0 )
+      {
+        if ( states[n] == 0 )
+        {
+          /* mark this extra glyph as a candidate for the cmap */
+          states[n]     = 1;
+          extra_glyphs[n] = glyph;
+        }
+
+        return;
+      }
+    }
+  }
+
+
+  static void
+  ps_check_extra_glyph_unicode( FT_UInt32  uni_char,
+                                FT_UInt   *states )
+  {
+    FT_UInt  n;
+
+
+    for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
+    {
+      if ( uni_char == ft_extra_glyph_unicodes[n] )
+      {
+        /* disable this extra glyph from being added to the cmap */
+        states[n] = 2;
+
+        return;
+      }
+    }
   }
 
 
   }
 
 
   {
     FT_Error  error;
 
   {
     FT_Error  error;
 
+    FT_UInt  extra_glyph_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+    FT_UInt  extra_glyphs[EXTRA_GLYPH_LIST_SIZE];
+
 
     /* we first allocate the table */
     table->num_maps = 0;
     table->maps     = 0;
 
 
     /* we first allocate the table */
     table->num_maps = 0;
     table->maps     = 0;
 
-    if ( !FT_NEW_ARRAY( table->maps, num_glyphs ) )
+    if ( !FT_NEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
     {
       FT_UInt     n;
       FT_UInt     count;
     {
       FT_UInt     n;
       FT_UInt     count;
 
         if ( gname )
         {
 
         if ( gname )
         {
+          ps_check_extra_glyph_name( gname, n,
+                                     extra_glyphs, extra_glyph_list_states );
           uni_char = ps_unicode_value( gname );
 
           if ( BASE_GLYPH( uni_char ) != 0 )
           {
           uni_char = ps_unicode_value( gname );
 
           if ( BASE_GLYPH( uni_char ) != 0 )
           {
+            ps_check_extra_glyph_unicode( uni_char,
+                                          extra_glyph_list_states );
             map->unicode     = uni_char;
             map->glyph_index = n;
             map++;
             map->unicode     = uni_char;
             map->glyph_index = n;
             map++;
         }
       }
 
         }
       }
 
+      for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
+      {
+        if ( extra_glyph_list_states[n] == 1 )
+        {
+          /* This glyph name has an additional representation. */
+          /* Add it to the cmap.                               */
+
+          map->unicode     = ft_extra_glyph_unicodes[n];
+          map->glyph_index = extra_glyphs[n];
+          map++;
+        }
+      }
+
       /* now compress the table a bit */
       count = (FT_UInt)( map - table->maps );
 
       /* now compress the table a bit */
       count = (FT_UInt)( map - table->maps );
 
   }
 
 
   }
 
 
-  static FT_ULong
+  static FT_UInt32
   ps_unicodes_char_next( PS_Unicodes  table,
                          FT_UInt32   *unicode )
   {
   ps_unicodes_char_next( PS_Unicodes  table,
                          FT_UInt32   *unicode )
   {
   }
 
 
   }
 
 
-  static
-  const FT_Service_PsCMapsRec  pscmaps_interface =
-  {
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-
+  FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface, 
     (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,
 
     (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,
 
+    (PS_Macintosh_NameFunc)    ps_get_macintosh_name,
+    (PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
+
+    t1_standard_encoding,
+    t1_expert_encoding
+  )
+
 #else
 
 #else
 
+  FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface, 
     0,
     0,
     0,
     0,
 
     0,
     0,
     0,
     0,
 
-#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
-
     (PS_Macintosh_NameFunc)    ps_get_macintosh_name,
     (PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
 
     t1_standard_encoding,
     t1_expert_encoding
     (PS_Macintosh_NameFunc)    ps_get_macintosh_name,
     (PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
 
     t1_standard_encoding,
     t1_expert_encoding
-  };
+  )
+
+#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
+
+
+  FT_DEFINE_SERVICEDESCREC1(pscmaps_services, 
+    FT_SERVICE_ID_POSTSCRIPT_CMAPS, &FT_PSCMAPS_INTERFACE_GET
+  )
 
 
 
 
-  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 )
   {
 
 
   static FT_Pointer
   psnames_get_service( FT_Module    module,
                        const char*  service_id )
   {
-    FT_UNUSED( module );
+    FT_Library library = module->library;
+    FT_UNUSED(library);
 
 
-    return ft_service_list_lookup( pscmaps_services, service_id );
+    return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id );
   }
 
   }
 
-#endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */
+#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
 
 
 
 
+#ifndef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
+#define PUT_PS_NAMES_SERVICE(a) 0
+#else
+#define PUT_PS_NAMES_SERVICE(a) a
+#endif
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Module_Class  psnames_module_class =
-  {
+  FT_DEFINE_MODULE(psnames_module_class,
+  
     0,  /* this is not a font driver, nor a renderer */
     sizeof ( FT_ModuleRec ),
 
     0,  /* this is not a font driver, nor a renderer */
     sizeof ( FT_ModuleRec ),
 
     0x10000L,   /* driver version                      */
     0x20000L,   /* driver requires FreeType 2 or above */
 
     0x10000L,   /* driver version                      */
     0x20000L,   /* driver requires FreeType 2 or above */
 
-#ifdef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES
-    0,
+    PUT_PS_NAMES_SERVICE((void*)&FT_PSCMAPS_INTERFACE_GET),   /* module specific interface */
     (FT_Module_Constructor)0,
     (FT_Module_Destructor) 0,
     (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
-  };
+    (FT_Module_Requester)  PUT_PS_NAMES_SERVICE(psnames_get_service)
+  )
+
 
 
 /* END */
 
 
 /* END */
index 232fdfb..28fa148 100644 (file)
@@ -27,7 +27,7 @@
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
 
-  FT_EXPORT_VAR( const FT_Module_Class )  psnames_module_class;
+  FT_DECLARE_MODULE( psnames_module_class )
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
index d6ed998..1ede225 100644 (file)
@@ -19,6 +19,7 @@
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
+#include "pspic.c"
 #include "psmodule.c"
 
 
 #include "psmodule.c"
 
 
diff --git a/reactos/lib/3rdparty/freetype/src/psnames/pspic.c b/reactos/lib/3rdparty/freetype/src/psnames/pspic.c
new file mode 100644 (file)
index 0000000..ed7dadd
--- /dev/null
@@ -0,0 +1,77 @@
+/***************************************************************************/
+/*                                                                         */
+/*  pspic.c                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services for psnames module.  */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "pspic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from psmodule.c */
+  FT_Error FT_Create_Class_pscmaps_services( FT_Library, FT_ServiceDescRec**);
+  void FT_Destroy_Class_pscmaps_services( FT_Library, FT_ServiceDescRec*);
+  void FT_Init_Class_pscmaps_interface( FT_Library, FT_Service_PsCMapsRec*);
+
+  void
+  psnames_module_class_pic_free(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory memory = library->memory;
+    if ( pic_container->psnames )
+    {
+      PSModulePIC* container = (PSModulePIC*)pic_container->psnames;
+      if(container->pscmaps_services)
+        FT_Destroy_Class_pscmaps_services(library, container->pscmaps_services);
+      container->pscmaps_services = NULL;
+      FT_FREE( container );
+      pic_container->psnames = NULL;
+    }
+  }
+
+  FT_Error
+  psnames_module_class_pic_init(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    PSModulePIC* container;
+    FT_Memory memory = library->memory;
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->psnames = container;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    error = FT_Create_Class_pscmaps_services(library, &container->pscmaps_services);
+    if(error) 
+      goto Exit;
+    FT_Init_Class_pscmaps_interface(library, &container->pscmaps_interface);
+    
+Exit:
+    if(error)
+      psnames_module_class_pic_free(library);
+    return error;
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/psnames/pspic.h b/reactos/lib/3rdparty/freetype/src/psnames/pspic.h
new file mode 100644 (file)
index 0000000..75a14fd
--- /dev/null
@@ -0,0 +1,54 @@
+/***************************************************************************/
+/*                                                                         */
+/*  pspic.h                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services for psnames module.  */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __PSPIC_H__
+#define __PSPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_PSCMAPS_SERVICES_GET     pscmaps_services
+#define FT_PSCMAPS_INTERFACE_GET    pscmaps_interface
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+
+  typedef struct PSModulePIC_
+  {
+    FT_ServiceDescRec* pscmaps_services;
+    FT_Service_PsCMapsRec pscmaps_interface;
+  } PSModulePIC;
+
+#define GET_PIC(lib)                ((PSModulePIC*)((lib)->pic_container.psnames))
+#define FT_PSCMAPS_SERVICES_GET     (GET_PIC(library)->pscmaps_services)
+#define FT_PSCMAPS_INTERFACE_GET    (GET_PIC(library)->pscmaps_interface)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __PSPIC_H__ */
+
+
+/* END */
index cc40ef7..1521e9c 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript glyph names.                                              */
 /*                                                                         */
 /*                                                                         */
 /*    PostScript glyph names.                                              */
 /*                                                                         */
-/*  Copyright 2005 by                                                      */
+/*  Copyright 2005, 2008 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
    *  The lookup function to get the Unicode value for a given string
    *  is defined below the table.
    */
    *  The lookup function to get the Unicode value for a given string
    *  is defined below the table.
    */
-  static const unsigned char  ft_adobe_glyph_list[54791] =
+
+#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
+
+  static const unsigned char  ft_adobe_glyph_list[54791L] =
   {
       0, 52,  0,106,  2,167,  3, 63,  4,220,  6,125,  9,143, 10, 23,
      11,137, 12,199, 14,246, 15, 87, 16,233, 17,219, 18,104, 19, 88,
   {
       0, 52,  0,106,  2,167,  3, 63,  4,220,  6,125,  9,143, 10, 23,
      11,137, 12,199, 14,246, 15, 87, 16,233, 17,219, 18,104, 19, 88,
     return 0;
   }
 
     return 0;
   }
 
+#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
+
 
 /* END */
 
 /* END */
index f6e4251..4f60e87 100644 (file)
@@ -16,7 +16,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) raster ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = ftraster ftrend1 ;
+    _sources = ftraster ftrend1 rastpic ;
   }
   else
   {
   }
   else
   {
index c5dbd50..f04b540 100644 (file)
@@ -5,7 +5,7 @@
 /*    Miscellaneous macros for stand-alone rasterizer (specification       */
 /*    only).                                                               */
 /*                                                                         */
 /*    Miscellaneous macros for stand-alone rasterizer (specification       */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 2005 by                                                      */
+/*  Copyright 2005, 2009 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used        */
@@ -27,7 +27,8 @@
 #ifndef __FTMISC_H__
 #define __FTMISC_H__
 
 #ifndef __FTMISC_H__
 #define __FTMISC_H__
 
-#include <string.h> /* memset */
+  /* memset */
+#include FT_CONFIG_STANDARD_LIBRARY_H
 
 #define FT_BEGIN_HEADER
 #define FT_END_HEADER
 
 #define FT_BEGIN_HEADER
 #define FT_END_HEADER
               (FT_ULong)_x4         )
 
 
               (FT_ULong)_x4         )
 
 
+  /* from include/freetype2/ftsystem.h */
+
+  typedef struct FT_MemoryRec_*  FT_Memory;
+
+  typedef void* (*FT_Alloc_Func)( FT_Memory  memory,
+                                  long       size );
+
+  typedef void (*FT_Free_Func)( FT_Memory  memory,
+                                void*      block );
+
+  typedef void* (*FT_Realloc_Func)( FT_Memory  memory,
+                                    long       cur_size,
+                                    long       new_size,
+                                    void*      block );
+
+  typedef struct FT_MemoryRec_
+  {
+    void*            user;
+
+    FT_Alloc_Func    alloc;
+    FT_Free_Func     free;
+    FT_Realloc_Func  realloc;
+
+  } FT_MemoryRec;
+
   /* from src/ftcalc.c */
 
 #include <inttypes.h>
   /* from src/ftcalc.c */
 
 #include <inttypes.h>
index 4cfca4e..23ad592 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType glyph rasterizer (body).                                */
 /*                                                                         */
 /*                                                                         */
 /*    The FreeType glyph rasterizer (body).                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2005, 2007 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 #ifdef _STANDALONE_
 
 
 #ifdef _STANDALONE_
 
+#define FT_CONFIG_STANDARD_LIBRARY_H  <stdlib.h>
+
+#include <string.h>           /* for memset */
+
 #include "ftmisc.h"
 #include "ftimage.h"
 
 #include "ftmisc.h"
 #include "ftimage.h"
 
@@ -58,6 +62,8 @@
 #include "ftraster.h"
 #include FT_INTERNAL_CALC_H   /* for FT_MulDiv only */
 
 #include "ftraster.h"
 #include FT_INTERNAL_CALC_H   /* for FT_MulDiv only */
 
+#include "rastpic.h"
+
 #endif /* !_STANDALONE_ */
 
 
 #endif /* !_STANDALONE_ */
 
 
   /*       profile is simply an array of scanline intersections on a given */
   /*       dimension.  A profile's main attributes are                     */
   /*                                                                       */
   /*       profile is simply an array of scanline intersections on a given */
   /*       dimension.  A profile's main attributes are                     */
   /*                                                                       */
-  /*       o its scanline position boundaries, i.e. `Ymin' and `Ymax'.     */
+  /*       o its scanline position boundaries, i.e. `Ymin' and `Ymax'      */
   /*                                                                       */
   /*       o an array of intersection coordinates for each scanline        */
   /*                                                                       */
   /*       o an array of intersection coordinates for each scanline        */
-  /*         between `Ymin' and `Ymax'.                                    */
+  /*         between `Ymin' and `Ymax'                                     */
   /*                                                                       */
   /*       o a direction, indicating whether it was built going `up' or    */
   /*                                                                       */
   /*       o a direction, indicating whether it was built going `up' or    */
-  /*         `down', as this is very important for filling rules.          */
+  /*         `down', as this is very important for filling rules           */
+  /*                                                                       */
+  /*       o its drop-out mode                                             */
   /*                                                                       */
   /*   2 - Sweeping the target map's scanlines in order to compute segment */
   /*       `spans' which are then filled.  Additionally, this pass         */
   /*                                                                       */
   /*   2 - Sweeping the target map's scanlines in order to compute segment */
   /*       `spans' which are then filled.  Additionally, this pass         */
   /*   built from the bottom of the render pool, used as a stack.  The     */
   /*   following graphics shows the profile list under construction:       */
   /*                                                                       */
   /*   built from the bottom of the render pool, used as a stack.  The     */
   /*   following graphics shows the profile list under construction:       */
   /*                                                                       */
-  /*     ____________________________________________________________ _ _  */
-  /*    |         |                   |         |                 |        */
-  /*    | profile | coordinates for   | profile | coordinates for |-->     */
-  /*    |    1    |  profile 1        |    2    |  profile 2      |-->     */
-  /*    |_________|___________________|_________|_________________|__ _ _  */
+  /*     __________________________________________________________ _ _    */
+  /*    |         |                 |         |                 |          */
+  /*    | profile | coordinates for | profile | coordinates for |-->       */
+  /*    |    1    |  profile 1      |    2    |  profile 2      |-->       */
+  /*    |_________|_________________|_________|_________________|__ _ _    */
   /*                                                                       */
   /*                                                                       */
-  /*    ^                                                         ^        */
-  /*    |                                                         |        */
-  /*  start of render pool                                       top       */
+  /*    ^                                                       ^          */
+  /*    |                                                       |          */
+  /* start of render pool                                      top         */
   /*                                                                       */
   /*   The top of the profile stack is kept in the `top' variable.         */
   /*                                                                       */
   /*                                                                       */
   /*   The top of the profile stack is kept in the `top' variable.         */
   /*                                                                       */
   /*************************************************************************/
 
   /* define DEBUG_RASTER if you want to compile a debugging version */
   /*************************************************************************/
 
   /* define DEBUG_RASTER if you want to compile a debugging version */
-#define xxxDEBUG_RASTER
+/* #define DEBUG_RASTER */
 
 
-  /* undefine FT_RASTER_OPTION_ANTI_ALIASING if you do not want to support */
-  /* 5-levels anti-aliasing                                                */
-#ifdef FT_CONFIG_OPTION_5_GRAY_LEVELS
-#define FT_RASTER_OPTION_ANTI_ALIASING
-#endif
+  /* define FT_RASTER_OPTION_ANTI_ALIASING if you want to support */
+  /* 5-levels anti-aliasing                                       */
+/* #define FT_RASTER_OPTION_ANTI_ALIASING */
 
   /* The size of the two-lines intermediate bitmap used */
   /* for anti-aliasing, in bytes.                       */
 
   /* The size of the two-lines intermediate bitmap used */
   /* for anti-aliasing, in bytes.                       */
   /* Disable the tracing mechanism for simplicity -- developers can      */
   /* activate it easily by redefining these two macros.                  */
 #ifndef FT_ERROR
   /* Disable the tracing mechanism for simplicity -- developers can      */
   /* activate it easily by redefining these two macros.                  */
 #ifndef FT_ERROR
-#define FT_ERROR( x )  do ; while ( 0 )     /* nothing */
+#define FT_ERROR( x )  do { } while ( 0 )     /* nothing */
 #endif
 
 #ifndef FT_TRACE
 #endif
 
 #ifndef FT_TRACE
-#define FT_TRACE( x )   do ; while ( 0 )    /* nothing */
-#define FT_TRACE1( x )  do ; while ( 0 )    /* nothing */
-#define FT_TRACE6( x )  do ; while ( 0 )    /* nothing */
+#define FT_TRACE( x )   do { } while ( 0 )    /* nothing */
+#define FT_TRACE1( x )  do { } while ( 0 )    /* nothing */
+#define FT_TRACE6( x )  do { } while ( 0 )    /* nothing */
 #endif
 
 #define Raster_Err_None          0
 #endif
 
 #define Raster_Err_None          0
 #define Raster_Err_Invalid      -4
 #define Raster_Err_Unsupported  -5
 
 #define Raster_Err_Invalid      -4
 #define Raster_Err_Unsupported  -5
 
-#define ft_memset   memset
+#define ft_memset  memset
+
+#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, raster_new_, \
+                                raster_reset_, raster_set_mode_,    \
+                                raster_render_, raster_done_ )      \
+          const FT_Raster_Funcs class_ =                            \
+          {                                                         \
+            glyph_format_,                                          \
+            raster_new_,                                            \
+            raster_reset_,                                          \
+            raster_set_mode_,                                       \
+            raster_render_,                                         \
+            raster_done_                                            \
+         };
 
 
-#else /* _STANDALONE_ */
+#else /* !_STANDALONE_ */
 
 
 #include FT_INTERNAL_OBJECTS_H
 
 
 #include FT_INTERNAL_OBJECTS_H
 #define Raster_Err_Unsupported  Raster_Err_Cannot_Render_Glyph
 
 
 #define Raster_Err_Unsupported  Raster_Err_Cannot_Render_Glyph
 
 
-#endif /* _STANDALONE_ */
+#endif /* !_STANDALONE_ */
 
 
 #ifndef FT_MEM_SET
 
 
 #ifndef FT_MEM_SET
   } TPoint;
 
 
   } TPoint;
 
 
-  typedef enum  TFlow_
-  {
-    Flow_None = 0,
-    Flow_Up   = 1,
-    Flow_Down = -1
-
-  } TFlow;
+  /* values for the `flags' bit field */
+#define Flow_Up           0x8
+#define Overshoot_Top     0x10
+#define Overshoot_Bottom  0x20
 
 
   /* States of each line, arc, and profile */
 
 
   /* States of each line, arc, and profile */
 
   struct  TProfile_
   {
 
   struct  TProfile_
   {
-    FT_F26Dot6  X;           /* current coordinate during sweep        */
-    PProfile    link;        /* link to next profile - various purpose */
-    PLong       offset;      /* start of profile's data in render pool */
-    int         flow;        /* Profile orientation: Asc/Descending    */
-    long        height;      /* profile's height in scanlines          */
-    long        start;       /* profile's starting scanline            */
-
-    unsigned    countL;      /* number of lines to step before this    */
-                             /* profile becomes drawable               */
-
-    PProfile    next;        /* next profile in same contour, used     */
-                             /* during drop-out control                */
+    FT_F26Dot6  X;           /* current coordinate during sweep          */
+    PProfile    link;        /* link to next profile (various purposes)  */
+    PLong       offset;      /* start of profile's data in render pool   */
+    unsigned    flags;       /* Bit 0-2: drop-out mode                   */
+                             /* Bit 3: profile orientation (up/down)     */
+                             /* Bit 4: is top profile?                   */
+                             /* Bit 5: is bottom profile?                */
+    long        height;      /* profile's height in scanlines            */
+    long        start;       /* profile's starting scanline              */
+
+    unsigned    countL;      /* number of lines to step before this      */
+                             /* profile becomes drawable                 */
+
+    PProfile    next;        /* next profile in same contour, used       */
+                             /* during drop-out control                  */
   };
 
   typedef PProfile   TProfileList;
   };
 
   typedef PProfile   TProfileList;
 #define RAS_VARS       /* void */
 #define RAS_VAR        /* void */
 
 #define RAS_VARS       /* void */
 #define RAS_VAR        /* void */
 
-#define FT_UNUSED_RASTER  do ; while ( 0 )
+#define FT_UNUSED_RASTER  do { } while ( 0 )
 
 
 
 
-#else /* FT_STATIC_RASTER */
+#else /* !FT_STATIC_RASTER */
 
 
 #define RAS_ARGS       PWorker    worker,
 
 
 #define RAS_ARGS       PWorker    worker,
 #define FT_UNUSED_RASTER  FT_UNUSED( worker )
 
 
 #define FT_UNUSED_RASTER  FT_UNUSED( worker )
 
 
-#endif /* FT_STATIC_RASTER */
+#endif /* !FT_STATIC_RASTER */
 
 
 
 
-  typedef struct TWorker_   TWorker, *PWorker;
+  typedef struct TWorker_  TWorker, *PWorker;
 
 
   /* prototypes used for sweep function dispatch */
 
 
   /* prototypes used for sweep function dispatch */
 #define FRAC( x )     ( (x) & ( ras.precision - 1 ) )
 #define SCALED( x )   ( ( (x) << ras.scale_shift ) - ras.precision_half )
 
 #define FRAC( x )     ( (x) & ( ras.precision - 1 ) )
 #define SCALED( x )   ( ( (x) << ras.scale_shift ) - ras.precision_half )
 
-  /* Note that I have moved the location of some fields in the */
-  /* structure to ensure that the most used variables are used */
-  /* at the top.  Thus, their offset can be coded with less    */
-  /* opcodes, and it results in a smaller executable.          */
+#define IS_BOTTOM_OVERSHOOT( x )  ( CEILING( x ) - x >= ras.precision_half )
+#define IS_TOP_OVERSHOOT( x )     ( x - FLOOR( x ) >= ras.precision_half )
+
+  /* The most used variables are positioned at the top of the structure. */
+  /* Thus, their offset can be coded with less opcodes, resulting in a   */
+  /* smaller executable.                                                 */
 
   struct  TWorker_
   {
 
   struct  TWorker_
   {
-    Int       precision_bits;       /* precision related variables         */
-    Int       precision;
-    Int       precision_half;
-    Long      precision_mask;
-    Int       precision_shift;
-    Int       precision_step;
-    Int       precision_jitter;
-
-    Int       scale_shift;          /* == precision_shift   for bitmaps    */
+    Int         precision_bits;     /* precision related variables         */
+    Int         precision;
+    Int         precision_half;
+    Long        precision_mask;
+    Int         precision_shift;
+    Int         precision_step;
+    Int         precision_jitter;
+
+    Int         scale_shift;        /* == precision_shift   for bitmaps    */
                                     /* == precision_shift+1 for pixmaps    */
 
                                     /* == precision_shift+1 for pixmaps    */
 
-    PLong     buff;                 /* The profiles buffer                 */
-    PLong     sizeBuff;             /* Render pool size                    */
-    PLong     maxBuff;              /* Profiles buffer size                */
-    PLong     top;                  /* Current cursor in buffer            */
+    PLong       buff;               /* The profiles buffer                 */
+    PLong       sizeBuff;           /* Render pool size                    */
+    PLong       maxBuff;            /* Profiles buffer size                */
+    PLong       top;                /* Current cursor in buffer            */
 
 
-    FT_Error  error;
+    FT_Error    error;
 
 
-    Int       numTurns;             /* number of Y-turns in outline        */
+    Int         numTurns;           /* number of Y-turns in outline        */
 
 
-    TPoint*   arc;                  /* current Bezier arc pointer          */
+    TPoint*     arc;                /* current Bezier arc pointer          */
 
 
-    UShort    bWidth;               /* target bitmap width                 */
-    PByte     bTarget;              /* target bitmap buffer                */
-    PByte     gTarget;              /* target pixmap buffer                */
+    UShort      bWidth;             /* target bitmap width                 */
+    PByte       bTarget;            /* target bitmap buffer                */
+    PByte       gTarget;            /* target pixmap buffer                */
 
 
-    Long      lastX, lastY, minY, maxY;
+    Long        lastX, lastY;
+    Long        minY, maxY;
 
 
-    UShort    num_Profs;            /* current number of profiles          */
+    UShort      num_Profs;          /* current number of profiles          */
 
 
-    Bool      fresh;                /* signals a fresh new profile which   */
-                                    /* 'start' field must be completed     */
-    Bool      joint;                /* signals that the last arc ended     */
+    Bool        fresh;              /* signals a fresh new profile which   */
+                                    /* `start' field must be completed     */
+    Bool        joint;              /* signals that the last arc ended     */
                                     /* exactly on a scanline.  Allows      */
                                     /* removal of doublets                 */
                                     /* exactly on a scanline.  Allows      */
                                     /* removal of doublets                 */
-    PProfile  cProfile;             /* current profile                     */
-    PProfile  fProfile;             /* head of linked list of profiles     */
-    PProfile  gProfile;             /* contour's first profile in case     */
+    PProfile    cProfile;           /* current profile                     */
+    PProfile    fProfile;           /* head of linked list of profiles     */
+    PProfile    gProfile;           /* contour's first profile in case     */
                                     /* of impact                           */
 
                                     /* of impact                           */
 
-    TStates   state;                /* rendering state                     */
+    TStates     state;              /* rendering state                     */
 
     FT_Bitmap   target;             /* description of target bit/pixmap    */
     FT_Outline  outline;
 
 
     FT_Bitmap   target;             /* description of target bit/pixmap    */
     FT_Outline  outline;
 
-    Long      traceOfs;             /* current offset in target bitmap     */
-    Long      traceG;               /* current offset in target pixmap     */
+    Long        traceOfs;           /* current offset in target bitmap     */
+    Long        traceG;             /* current offset in target pixmap     */
 
 
-    Short     traceIncr;            /* sweep's increment in target bitmap  */
+    Short       traceIncr;          /* sweep's increment in target bitmap  */
 
 
-    Short     gray_min_x;           /* current min x during gray rendering */
-    Short     gray_max_x;           /* current max x during gray rendering */
+    Short       gray_min_x;         /* current min x during gray rendering */
+    Short       gray_max_x;         /* current max x during gray rendering */
 
     /* dispatch variables */
 
 
     /* dispatch variables */
 
     Function_Sweep_Span*  Proc_Sweep_Drop;
     Function_Sweep_Step*  Proc_Sweep_Step;
 
     Function_Sweep_Span*  Proc_Sweep_Drop;
     Function_Sweep_Step*  Proc_Sweep_Step;
 
-    Byte      dropOutControl;       /* current drop_out control method     */
+    Byte        dropOutControl;     /* current drop_out control method     */
 
 
-    Bool      second_pass;          /* indicates whether a horizontal pass */
+    Bool        second_pass;        /* indicates whether a horizontal pass */
                                     /* should be performed to control      */
                                     /* drop-out accurately when calling    */
                                     /* Render_Glyph.  Note that there is   */
                                     /* no horizontal pass during gray      */
                                     /* rendering.                          */
 
                                     /* should be performed to control      */
                                     /* drop-out accurately when calling    */
                                     /* Render_Glyph.  Note that there is   */
                                     /* no horizontal pass during gray      */
                                     /* rendering.                          */
 
-    TPoint    arcs[3 * MaxBezier + 1]; /* The Bezier stack                 */
+    TPoint      arcs[3 * MaxBezier + 1]; /* The Bezier stack               */
 
 
-    TBand     band_stack[16];       /* band stack used for sub-banding     */
-    Int       band_top;             /* band stack top                      */
+    TBand       band_stack[16];     /* band stack used for sub-banding     */
+    Int         band_top;           /* band stack top                      */
 
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
 
 
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
 
-    Byte*     grays;
+    Byte*       grays;
 
 
-    Byte      gray_lines[RASTER_GRAY_LINES];
+    Byte        gray_lines[RASTER_GRAY_LINES];
                                 /* Intermediate table used to render the   */
                                 /* graylevels pixmaps.                     */
                                 /* gray_lines is a buffer holding two      */
                                 /* monochrome scanlines                    */
 
                                 /* Intermediate table used to render the   */
                                 /* graylevels pixmaps.                     */
                                 /* gray_lines is a buffer holding two      */
                                 /* monochrome scanlines                    */
 
-    Short     gray_width;       /* width in bytes of one monochrome        */
+    Short       gray_width;     /* width in bytes of one monochrome        */
                                 /* intermediate scanline of gray_lines.    */
                                 /* Each gray pixel takes 2 bits long there */
 
                                 /* intermediate scanline of gray_lines.    */
                                 /* Each gray pixel takes 2 bits long there */
 
   };
 
 
   };
 
 
-  typedef struct TRaster_
+  typedef struct  TRaster_
   {
   {
-    char*     buffer;
-    long      buffer_size;
-    void*     memory;
-    PWorker   worker;
-    Byte      grays[5];
-    Short     gray_width;
+    char*    buffer;
+    long     buffer_size;
+    void*    memory;
+    PWorker  worker;
+    Byte     grays[5];
+    Short    gray_width;
 
   } TRaster, *PRaster;
 
 #ifdef FT_STATIC_RASTER
 
 
   } TRaster, *PRaster;
 
 #ifdef FT_STATIC_RASTER
 
-  static TWorker   cur_ras;
+  static TWorker  cur_ras;
 #define ras  cur_ras
 
 #define ras  cur_ras
 
-#else
+#else /* !FT_STATIC_RASTER */
 
 #define ras  (*worker)
 
 
 #define ras  (*worker)
 
-#endif /* FT_STATIC_RASTER */
+#endif /* !FT_STATIC_RASTER */
+
 
 
+#ifdef FT_RASTER_OPTION_ANTI_ALIASING
 
 
-static const char  count_table[256] =
-{
-  0 , 1 , 1 , 2 , 1 , 2 , 2 , 3 , 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4,
-  1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
-  1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
-  2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
-  1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
-  2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
-  2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
-  3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
-  1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 , 2 , 3 , 3 , 4 , 3 , 4 , 4 , 5,
-  2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
-  2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
-  3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
-  2 , 3 , 3 , 4 , 3 , 4 , 4 , 5 , 3 , 4 , 4 , 5 , 4 , 5 , 5 , 6,
-  3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
-  3 , 4 , 4 , 5 , 4 , 5 , 5 , 6 , 4 , 5 , 5 , 6 , 5 , 6 , 6 , 7,
-  4 , 5 , 5 , 6 , 5 , 6 , 6 , 7 , 5 , 6 , 6 , 7 , 6 , 7 , 7 , 8 };
+  /* A lookup table used to quickly count set bits in four gray 2x2 */
+  /* cells.  The values of the table have been produced with the    */
+  /* following code:                                                */
+  /*                                                                */
+  /*   for ( i = 0; i < 256; i++ )                                  */
+  /*   {                                                            */
+  /*     l = 0;                                                     */
+  /*     j = i;                                                     */
+  /*                                                                */
+  /*     for ( c = 0; c < 4; c++ )                                  */
+  /*     {                                                          */
+  /*       l <<= 4;                                                 */
+  /*                                                                */
+  /*       if ( j & 0x80 ) l++;                                     */
+  /*       if ( j & 0x40 ) l++;                                     */
+  /*                                                                */
+  /*       j = ( j << 2 ) & 0xFF;                                   */
+  /*     }                                                          */
+  /*     printf( "0x%04X", l );                                     */
+  /*   }                                                            */
+  /*                                                                */
+
+  static const short  count_table[256] =
+  {
+    0x0000, 0x0001, 0x0001, 0x0002, 0x0010, 0x0011, 0x0011, 0x0012,
+    0x0010, 0x0011, 0x0011, 0x0012, 0x0020, 0x0021, 0x0021, 0x0022,
+    0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112,
+    0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122,
+    0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112,
+    0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122,
+    0x0200, 0x0201, 0x0201, 0x0202, 0x0210, 0x0211, 0x0211, 0x0212,
+    0x0210, 0x0211, 0x0211, 0x0212, 0x0220, 0x0221, 0x0221, 0x0222,
+    0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012,
+    0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022,
+    0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
+    0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
+    0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
+    0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
+    0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212,
+    0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222,
+    0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012,
+    0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022,
+    0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
+    0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
+    0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
+    0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
+    0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212,
+    0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222,
+    0x2000, 0x2001, 0x2001, 0x2002, 0x2010, 0x2011, 0x2011, 0x2012,
+    0x2010, 0x2011, 0x2011, 0x2012, 0x2020, 0x2021, 0x2021, 0x2022,
+    0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112,
+    0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122,
+    0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112,
+    0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122,
+    0x2200, 0x2201, 0x2201, 0x2202, 0x2210, 0x2211, 0x2211, 0x2212,
+    0x2210, 0x2211, 0x2211, 0x2212, 0x2220, 0x2221, 0x2221, 0x2222
+  };
+
+#endif /* FT_RASTER_OPTION_ANTI_ALIASING */
 
 
 
 
 
 
@@ -579,7 +644,7 @@ static const char  count_table[256] =
   /*    Set_High_Precision                                                 */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Set_High_Precision                                                 */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Sets precision variables according to param flag.                  */
+  /*    Set precision variables according to param flag.                   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    High :: Set to True for high precision (typically for ppem < 18),  */
   /*                                                                       */
   /* <Input>                                                               */
   /*    High :: Set to True for high precision (typically for ppem < 18),  */
@@ -590,9 +655,9 @@ static const char  count_table[256] =
   {
     if ( High )
     {
   {
     if ( High )
     {
-      ras.precision_bits   = 10;
-      ras.precision_step   = 128;
-      ras.precision_jitter = 24;
+      ras.precision_bits   = 12;
+      ras.precision_step   = 256;
+      ras.precision_jitter = 50;
     }
     else
     {
     }
     else
     {
@@ -616,17 +681,21 @@ static const char  count_table[256] =
   /*    New_Profile                                                        */
   /*                                                                       */
   /* <Description>                                                         */
   /*    New_Profile                                                        */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Creates a new profile in the render pool.                          */
+  /*    Create a new profile in the render pool.                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    aState :: The state/orientation of the new profile.                */
+  /*    aState    :: The state/orientation of the new profile.             */
+  /*                                                                       */
+  /*    overshoot :: Whether the profile's unrounded start position        */
+  /*                 differs by at least a half pixel.                     */
   /*                                                                       */
   /* <Return>                                                              */
   /*   SUCCESS on success.  FAILURE in case of overflow or of incoherent   */
   /*   profile.                                                            */
   /*                                                                       */
   static Bool
   /*                                                                       */
   /* <Return>                                                              */
   /*   SUCCESS on success.  FAILURE in case of overflow or of incoherent   */
   /*   profile.                                                            */
   /*                                                                       */
   static Bool
-  New_Profile( RAS_ARGS TStates  aState )
+  New_Profile( RAS_ARGS TStates  aState,
+                        Bool     overshoot )
   {
     if ( !ras.fProfile )
     {
   {
     if ( !ras.fProfile )
     {
@@ -641,30 +710,36 @@ static const char  count_table[256] =
       return FAILURE;
     }
 
       return FAILURE;
     }
 
+    ras.cProfile->flags  = 0;
+    ras.cProfile->start  = 0;
+    ras.cProfile->height = 0;
+    ras.cProfile->offset = ras.top;
+    ras.cProfile->link   = (PProfile)0;
+    ras.cProfile->next   = (PProfile)0;
+    ras.cProfile->flags  = ras.dropOutControl;
+
     switch ( aState )
     {
     case Ascending_State:
     switch ( aState )
     {
     case Ascending_State:
-      ras.cProfile->flow = Flow_Up;
+      ras.cProfile->flags |= Flow_Up;
+      if ( overshoot )
+        ras.cProfile->flags |= Overshoot_Bottom;
+
       FT_TRACE6(( "New ascending profile = %lx\n", (long)ras.cProfile ));
       break;
 
     case Descending_State:
       FT_TRACE6(( "New ascending profile = %lx\n", (long)ras.cProfile ));
       break;
 
     case Descending_State:
-      ras.cProfile->flow = Flow_Down;
+      if ( overshoot )
+        ras.cProfile->flags |= Overshoot_Top;
       FT_TRACE6(( "New descending profile = %lx\n", (long)ras.cProfile ));
       break;
 
     default:
       FT_TRACE6(( "New descending profile = %lx\n", (long)ras.cProfile ));
       break;
 
     default:
-      FT_ERROR(( "New_Profile: invalid profile direction!\n" ));
+      FT_ERROR(( "New_Profile: invalid profile direction\n" ));
       ras.error = Raster_Err_Invalid;
       return FAILURE;
     }
 
       ras.error = Raster_Err_Invalid;
       return FAILURE;
     }
 
-    ras.cProfile->start  = 0;
-    ras.cProfile->height = 0;
-    ras.cProfile->offset = ras.top;
-    ras.cProfile->link   = (PProfile)0;
-    ras.cProfile->next   = (PProfile)0;
-
     if ( !ras.gProfile )
       ras.gProfile = ras.cProfile;
 
     if ( !ras.gProfile )
       ras.gProfile = ras.cProfile;
 
@@ -682,13 +757,17 @@ static const char  count_table[256] =
   /*    End_Profile                                                        */
   /*                                                                       */
   /* <Description>                                                         */
   /*    End_Profile                                                        */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Finalizes the current profile.                                     */
+  /*    Finalize the current profile.                                      */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    overshoot :: Whether the profile's unrounded end position differs  */
+  /*                 by at least a half pixel.                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*    SUCCESS on success.  FAILURE in case of overflow or incoherency.   */
   /*                                                                       */
   static Bool
   /*                                                                       */
   /* <Return>                                                              */
   /*    SUCCESS on success.  FAILURE in case of overflow or incoherency.   */
   /*                                                                       */
   static Bool
-  End_Profile( RAS_ARG )
+  End_Profile( RAS_ARGS Bool  overshoot )
   {
     Long      h;
     PProfile  oldProfile;
   {
     Long      h;
     PProfile  oldProfile;
@@ -698,7 +777,7 @@ static const char  count_table[256] =
 
     if ( h < 0 )
     {
 
     if ( h < 0 )
     {
-      FT_ERROR(( "End_Profile: negative height encountered!\n" ));
+      FT_ERROR(( "End_Profile: negative height encountered\n" ));
       ras.error = Raster_Err_Neg_Height;
       return FAILURE;
     }
       ras.error = Raster_Err_Neg_Height;
       return FAILURE;
     }
@@ -708,15 +787,24 @@ static const char  count_table[256] =
       FT_TRACE6(( "Ending profile %lx, start = %ld, height = %ld\n",
                   (long)ras.cProfile, ras.cProfile->start, h ));
 
       FT_TRACE6(( "Ending profile %lx, start = %ld, height = %ld\n",
                   (long)ras.cProfile, ras.cProfile->start, h ));
 
-      oldProfile           = ras.cProfile;
       ras.cProfile->height = h;
       ras.cProfile->height = h;
-      ras.cProfile         = (PProfile)ras.top;
+      if ( overshoot )
+      {
+        if ( ras.cProfile->flags & Flow_Up )
+          ras.cProfile->flags |= Overshoot_Top;
+        else
+          ras.cProfile->flags |= Overshoot_Bottom;
+      }
+
+      oldProfile   = ras.cProfile;
+      ras.cProfile = (PProfile)ras.top;
 
 
-      ras.top             += AlignProfileSize;
+      ras.top += AlignProfileSize;
 
       ras.cProfile->height = 0;
       ras.cProfile->offset = ras.top;
 
       ras.cProfile->height = 0;
       ras.cProfile->offset = ras.top;
-      oldProfile->next     = ras.cProfile;
+
+      oldProfile->next = ras.cProfile;
       ras.num_Profs++;
     }
 
       ras.num_Profs++;
     }
 
@@ -739,7 +827,7 @@ static const char  count_table[256] =
   /*    Insert_Y_Turn                                                      */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Insert_Y_Turn                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Inserts a salient into the sorted list placed on top of the render */
+  /*    Insert a salient into the sorted list placed on top of the render  */
   /*    pool.                                                              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    pool.                                                              */
   /*                                                                       */
   /* <Input>                                                               */
@@ -794,7 +882,7 @@ static const char  count_table[256] =
   /*    Finalize_Profile_Table                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Finalize_Profile_Table                                             */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Adjusts all links in the profiles list.                            */
+  /*    Adjust all links in the profiles list.                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*    SUCCESS on success.  FAILURE in case of overflow.                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*    SUCCESS on success.  FAILURE in case of overflow.                  */
@@ -808,10 +896,10 @@ static const char  count_table[256] =
 
 
     n = ras.num_Profs;
 
 
     n = ras.num_Profs;
+    p = ras.fProfile;
 
 
-    if ( n > 1 )
+    if ( n > 1 && p )
     {
     {
-      p = ras.fProfile;
       while ( n > 0 )
       {
         if ( n > 1 )
       while ( n > 0 )
       {
         if ( n > 1 )
@@ -819,23 +907,21 @@ static const char  count_table[256] =
         else
           p->link = NULL;
 
         else
           p->link = NULL;
 
-        switch ( p->flow )
+        if ( p->flags & Flow_Up )
+        {
+          bottom = (Int)p->start;
+          top    = (Int)( p->start + p->height - 1 );
+        }
+        else
         {
         {
-        case Flow_Down:
           bottom     = (Int)( p->start - p->height + 1 );
           top        = (Int)p->start;
           p->start   = bottom;
           p->offset += p->height - 1;
           bottom     = (Int)( p->start - p->height + 1 );
           top        = (Int)p->start;
           p->start   = bottom;
           p->offset += p->height - 1;
-          break;
-
-        case Flow_Up:
-        default:
-          bottom = (Int)p->start;
-          top    = (Int)( p->start + p->height - 1 );
         }
 
         }
 
-        if ( Insert_Y_Turn( RAS_VARS bottom )   ||
-             Insert_Y_Turn( RAS_VARS top + 1 )  )
+        if ( Insert_Y_Turn( RAS_VARS bottom )  ||
+             Insert_Y_Turn( RAS_VARS top + 1 ) )
           return FAILURE;
 
         p = p->link;
           return FAILURE;
 
         p = p->link;
@@ -855,7 +941,7 @@ static const char  count_table[256] =
   /*    Split_Conic                                                        */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Split_Conic                                                        */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Subdivides one conic Bezier into two joint sub-arcs in the Bezier  */
+  /*    Subdivide one conic Bezier into two joint sub-arcs in the Bezier   */
   /*    stack.                                                             */
   /*                                                                       */
   /* <Input>                                                               */
   /*    stack.                                                             */
   /*                                                                       */
   /* <Input>                                                               */
@@ -894,7 +980,7 @@ static const char  count_table[256] =
   /*    Split_Cubic                                                        */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Split_Cubic                                                        */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Subdivides a third-order Bezier arc into two joint sub-arcs in the */
+  /*    Subdivide a third-order Bezier arc into two joint sub-arcs in the  */
   /*    Bezier stack.                                                      */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Bezier stack.                                                      */
   /*                                                                       */
   /* <Note>                                                                */
@@ -936,7 +1022,7 @@ static const char  count_table[256] =
   /*    Line_Up                                                            */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Line_Up                                                            */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Computes the x-coordinates of an ascending line segment and stores */
+  /*    Compute the x-coordinates of an ascending line segment and store   */
   /*    them in the render pool.                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    them in the render pool.                                           */
   /*                                                                       */
   /* <Input>                                                               */
@@ -1075,8 +1161,8 @@ static const char  count_table[256] =
   /*    Line_Down                                                          */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Line_Down                                                          */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Computes the x-coordinates of an descending line segment and       */
-  /*    stores them in the render pool.                                    */
+  /*    Compute the x-coordinates of an descending line segment and store  */
+  /*    them in the render pool.                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    x1   :: The x-coordinate of the segment's start point.             */
   /*                                                                       */
   /* <Input>                                                               */
   /*    x1   :: The x-coordinate of the segment's start point.             */
@@ -1126,7 +1212,7 @@ static const char  count_table[256] =
   /*    Bezier_Up                                                          */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Bezier_Up                                                          */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Computes the x-coordinates of an ascending Bezier arc and stores   */
+  /*    Compute the x-coordinates of an ascending Bezier arc and store     */
   /*    them in the render pool.                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    them in the render pool.                                           */
   /*                                                                       */
   /* <Input>                                                               */
@@ -1227,7 +1313,7 @@ static const char  count_table[256] =
         }
         else
         {
         }
         else
         {
-          *top++ = arc[degree].x + FMulDiv( arc[0].x-arc[degree].x,
+          *top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,
                                             e - y1, y2 - y1 );
           arc -= degree;
           e   += ras.precision;
                                             e - y1, y2 - y1 );
           arc -= degree;
           e   += ras.precision;
@@ -1259,7 +1345,7 @@ static const char  count_table[256] =
   /*    Bezier_Down                                                        */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Bezier_Down                                                        */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Computes the x-coordinates of an descending Bezier arc and stores  */
+  /*    Compute the x-coordinates of an descending Bezier arc and store    */
   /*    them in the render pool.                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    them in the render pool.                                           */
   /*                                                                       */
   /* <Input>                                                               */
@@ -1308,7 +1394,7 @@ static const char  count_table[256] =
   /*    Line_To                                                            */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Line_To                                                            */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Injects a new line segment and adjusts Profiles list.              */
+  /*    Inject a new line segment and adjust the Profiles list.            */
   /*                                                                       */
   /* <Input>                                                               */
   /*   x :: The x-coordinate of the segment's end point (its start point   */
   /*                                                                       */
   /* <Input>                                                               */
   /*   x :: The x-coordinate of the segment's end point (its start point   */
@@ -1332,13 +1418,15 @@ static const char  count_table[256] =
     case Unknown_State:
       if ( y > ras.lastY )
       {
     case Unknown_State:
       if ( y > ras.lastY )
       {
-        if ( New_Profile( RAS_VARS Ascending_State ) )
+        if ( New_Profile( RAS_VARS Ascending_State,
+                                   IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
           return FAILURE;
       }
       else
       {
         if ( y < ras.lastY )
           return FAILURE;
       }
       else
       {
         if ( y < ras.lastY )
-          if ( New_Profile( RAS_VARS Descending_State ) )
+          if ( New_Profile( RAS_VARS Descending_State,
+                                     IS_TOP_OVERSHOOT( ras.lastY ) ) )
             return FAILURE;
       }
       break;
             return FAILURE;
       }
       break;
@@ -1346,8 +1434,9 @@ static const char  count_table[256] =
     case Ascending_State:
       if ( y < ras.lastY )
       {
     case Ascending_State:
       if ( y < ras.lastY )
       {
-        if ( End_Profile( RAS_VAR )                   ||
-             New_Profile( RAS_VARS Descending_State ) )
+        if ( End_Profile( RAS_VARS IS_TOP_OVERSHOOT( ras.lastY ) ) ||
+             New_Profile( RAS_VARS Descending_State,
+                                   IS_TOP_OVERSHOOT( ras.lastY ) ) )
           return FAILURE;
       }
       break;
           return FAILURE;
       }
       break;
@@ -1355,8 +1444,9 @@ static const char  count_table[256] =
     case Descending_State:
       if ( y > ras.lastY )
       {
     case Descending_State:
       if ( y > ras.lastY )
       {
-        if ( End_Profile( RAS_VAR )                  ||
-             New_Profile( RAS_VARS Ascending_State ) )
+        if ( End_Profile( RAS_VARS IS_BOTTOM_OVERSHOOT( ras.lastY ) ) ||
+             New_Profile( RAS_VARS Ascending_State,
+                                   IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
           return FAILURE;
       }
       break;
           return FAILURE;
       }
       break;
@@ -1371,13 +1461,13 @@ static const char  count_table[256] =
     {
     case Ascending_State:
       if ( Line_Up( RAS_VARS ras.lastX, ras.lastY,
     {
     case Ascending_State:
       if ( Line_Up( RAS_VARS ras.lastX, ras.lastY,
-                    x, y, ras.minY, ras.maxY ) )
+                             x, y, ras.minY, ras.maxY ) )
         return FAILURE;
       break;
 
     case Descending_State:
       if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,
         return FAILURE;
       break;
 
     case Descending_State:
       if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,
-                      x, y, ras.minY, ras.maxY ) )
+                               x, y, ras.minY, ras.maxY ) )
         return FAILURE;
       break;
 
         return FAILURE;
       break;
 
@@ -1398,7 +1488,7 @@ static const char  count_table[256] =
   /*    Conic_To                                                           */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Conic_To                                                           */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Injects a new conic arc and adjusts the profile list.              */
+  /*    Inject a new conic arc and adjust the profile list.                */
   /*                                                                       */
   /* <Input>                                                               */
   /*   cx :: The x-coordinate of the arc's new control point.              */
   /*                                                                       */
   /* <Input>                                                               */
   /*   cx :: The x-coordinate of the arc's new control point.              */
@@ -1428,8 +1518,10 @@ static const char  count_table[256] =
     ras.arc      = ras.arcs;
     ras.arc[2].x = ras.lastX;
     ras.arc[2].y = ras.lastY;
     ras.arc      = ras.arcs;
     ras.arc[2].x = ras.lastX;
     ras.arc[2].y = ras.lastY;
-    ras.arc[1].x = cx; ras.arc[1].y = cy;
-    ras.arc[0].x = x;  ras.arc[0].y = y;
+    ras.arc[1].x = cx;
+    ras.arc[1].y = cy;
+    ras.arc[0].x = x;
+    ras.arc[0].y = y;
 
     do
     {
 
     do
     {
@@ -1469,13 +1561,17 @@ static const char  count_table[256] =
         state_bez = y1 < y3 ? Ascending_State : Descending_State;
         if ( ras.state != state_bez )
         {
         state_bez = y1 < y3 ? Ascending_State : Descending_State;
         if ( ras.state != state_bez )
         {
+          Bool  o = state_bez == Ascending_State ? IS_BOTTOM_OVERSHOOT( y1 )
+                                                 : IS_TOP_OVERSHOOT( y1 );
+
+
           /* finalize current profile if any */
           /* finalize current profile if any */
-          if ( ras.state != Unknown_State   &&
-               End_Profile( RAS_VAR ) )
+          if ( ras.state != Unknown_State &&
+               End_Profile( RAS_VARS o )  )
             goto Fail;
 
           /* create a new profile */
             goto Fail;
 
           /* create a new profile */
-          if ( New_Profile( RAS_VARS state_bez ) )
+          if ( New_Profile( RAS_VARS state_bez, o ) )
             goto Fail;
         }
 
             goto Fail;
         }
 
@@ -1508,7 +1604,7 @@ static const char  count_table[256] =
   /*    Cubic_To                                                           */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Cubic_To                                                           */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Injects a new cubic arc and adjusts the profile list.              */
+  /*    Inject a new cubic arc and adjust the profile list.                */
   /*                                                                       */
   /* <Input>                                                               */
   /*   cx1 :: The x-coordinate of the arc's first new control point.       */
   /*                                                                       */
   /* <Input>                                                               */
   /*   cx1 :: The x-coordinate of the arc's first new control point.       */
@@ -1544,9 +1640,12 @@ static const char  count_table[256] =
     ras.arc      = ras.arcs;
     ras.arc[3].x = ras.lastX;
     ras.arc[3].y = ras.lastY;
     ras.arc      = ras.arcs;
     ras.arc[3].x = ras.lastX;
     ras.arc[3].y = ras.lastY;
-    ras.arc[2].x = cx1; ras.arc[2].y = cy1;
-    ras.arc[1].x = cx2; ras.arc[1].y = cy2;
-    ras.arc[0].x = x;   ras.arc[0].y = y;
+    ras.arc[2].x = cx1;
+    ras.arc[2].y = cy1;
+    ras.arc[1].x = cx2;
+    ras.arc[1].y = cy2;
+    ras.arc[0].x = x;
+    ras.arc[0].y = y;
 
     do
     {
 
     do
     {
@@ -1598,11 +1697,16 @@ static const char  count_table[256] =
         /* detect a change of direction */
         if ( ras.state != state_bez )
         {
         /* detect a change of direction */
         if ( ras.state != state_bez )
         {
-          if ( ras.state != Unknown_State   &&
-               End_Profile( RAS_VAR ) )
+          Bool  o = state_bez == Ascending_State ? IS_BOTTOM_OVERSHOOT( y1 )
+                                                 : IS_TOP_OVERSHOOT( y1 );
+
+
+          /* finalize current profile if any */
+          if ( ras.state != Unknown_State &&
+               End_Profile( RAS_VARS o )  )
             goto Fail;
 
             goto Fail;
 
-          if ( New_Profile( RAS_VARS state_bez ) )
+          if ( New_Profile( RAS_VARS state_bez, o ) )
             goto Fail;
         }
 
             goto Fail;
         }
 
@@ -1646,7 +1750,7 @@ static const char  count_table[256] =
   /*    Decompose_Curve                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Decompose_Curve                                                    */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Scans the outline arrays in order to emit individual segments and  */
+  /*    Scan the outline arrays in order to emit individual segments and   */
   /*    Beziers by calling Line_To() and Bezier_To().  It handles all      */
   /*    weird cases, like when the first point is off the curve, or when   */
   /*    there are simply no `on' points in the contour!                    */
   /*    Beziers by calling Line_To() and Bezier_To().  It handles all      */
   /*    weird cases, like when the first point is off the curve, or when   */
   /*    there are simply no `on' points in the contour!                    */
@@ -1695,8 +1799,13 @@ static const char  count_table[256] =
     v_control = v_start;
 
     point = points + first;
     v_control = v_start;
 
     point = points + first;
-    tags  = ras.outline.tags  + first;
-    tag   = FT_CURVE_TAG( tags[0] );
+    tags  = ras.outline.tags + first;
+
+    /* set scan mode if necessary */
+    if ( tags[0] & FT_CURVE_TAG_HAS_SCANMODE )
+      ras.dropOutControl = (Byte)tags[0] >> 5;
+
+    tag = FT_CURVE_TAG( tags[0] );
 
     /* A contour cannot start with a cubic control point! */
     if ( tag == FT_CURVE_TAG_CUBIC )
 
     /* A contour cannot start with a cubic control point! */
     if ( tag == FT_CURVE_TAG_CUBIC )
@@ -1867,7 +1976,7 @@ static const char  count_table[256] =
   /*    Convert_Glyph                                                      */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Convert_Glyph                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Converts a glyph into a series of segments and arcs and makes a    */
+  /*    Convert a glyph into a series of segments and arcs and make a      */
   /*    profiles list with them.                                           */
   /*                                                                       */
   /* <Input>                                                               */
   /*    profiles list with them.                                           */
   /*                                                                       */
   /* <Input>                                                               */
@@ -1902,27 +2011,36 @@ static const char  count_table[256] =
 
     for ( i = 0; i < ras.outline.n_contours; i++ )
     {
 
     for ( i = 0; i < ras.outline.n_contours; i++ )
     {
+      Bool  o;
+
+
       ras.state    = Unknown_State;
       ras.gProfile = NULL;
 
       if ( Decompose_Curve( RAS_VARS (unsigned short)start,
       ras.state    = Unknown_State;
       ras.gProfile = NULL;
 
       if ( Decompose_Curve( RAS_VARS (unsigned short)start,
-                            ras.outline.contours[i],
-                            flipped ) )
+                                     ras.outline.contours[i],
+                                     flipped ) )
         return FAILURE;
 
       start = ras.outline.contours[i] + 1;
 
         return FAILURE;
 
       start = ras.outline.contours[i] + 1;
 
-      /* We must now see whether the extreme arcs join or not */
+      /* we must now check whether the extreme arcs join or not */
       if ( FRAC( ras.lastY ) == 0 &&
            ras.lastY >= ras.minY  &&
            ras.lastY <= ras.maxY  )
       if ( FRAC( ras.lastY ) == 0 &&
            ras.lastY >= ras.minY  &&
            ras.lastY <= ras.maxY  )
-        if ( ras.gProfile && ras.gProfile->flow == ras.cProfile->flow )
+        if ( ras.gProfile                        &&
+             ( ras.gProfile->flags & Flow_Up ) ==
+               ( ras.cProfile->flags & Flow_Up ) )
           ras.top--;
         /* Note that ras.gProfile can be nil if the contour was too small */
         /* to be drawn.                                                   */
 
       lastProfile = ras.cProfile;
           ras.top--;
         /* Note that ras.gProfile can be nil if the contour was too small */
         /* to be drawn.                                                   */
 
       lastProfile = ras.cProfile;
-      if ( End_Profile( RAS_VAR ) )
+      if ( ras.cProfile->flags & Flow_Up )
+        o = IS_TOP_OVERSHOOT( ras.lastY );
+      else
+        o = IS_BOTTOM_OVERSHOOT( ras.lastY );
+      if ( End_Profile( RAS_VARS o ) )
         return FAILURE;
 
       /* close the `next profile in contour' linked list */
         return FAILURE;
 
       /* close the `next profile in contour' linked list */
@@ -2042,7 +2160,7 @@ static const char  count_table[256] =
     while ( current )
     {
       current->X       = *current->offset;
     while ( current )
     {
       current->X       = *current->offset;
-      current->offset += current->flow;
+      current->offset += current->flags & Flow_Up ? 1 : -1;
       current->height--;
       current = current->link;
     }
       current->height--;
       current = current->link;
     }
@@ -2148,8 +2266,10 @@ static const char  count_table[256] =
       f1 = (Byte)  ( 0xFF >> ( e1 & 7 ) );
       f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
 
       f1 = (Byte)  ( 0xFF >> ( e1 & 7 ) );
       f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
 
-      if ( ras.gray_min_x > c1 ) ras.gray_min_x = (short)c1;
-      if ( ras.gray_max_x < c2 ) ras.gray_max_x = (short)c2;
+      if ( ras.gray_min_x > c1 )
+        ras.gray_min_x = (short)c1;
+      if ( ras.gray_max_x < c2 )
+        ras.gray_max_x = (short)c2;
 
       target = ras.bTarget + ras.traceOfs + c1;
       c2 -= c1;
 
       target = ras.bTarget + ras.traceOfs + c1;
       c2 -= c1;
@@ -2182,38 +2302,63 @@ static const char  count_table[256] =
                                 PProfile    left,
                                 PProfile    right )
   {
                                 PProfile    left,
                                 PProfile    right )
   {
-    Long   e1, e2;
+    Long   e1, e2, pxl;
     Short  c1, f1;
 
 
     /* Drop-out control */
 
     Short  c1, f1;
 
 
     /* Drop-out control */
 
-    e1 = CEILING( x1 );
-    e2 = FLOOR  ( x2 );
+    /*   e2            x2                    x1           e1   */
+    /*                                                         */
+    /*                 ^                     |                 */
+    /*                 |                     |                 */
+    /*   +-------------+---------------------+------------+    */
+    /*                 |                     |                 */
+    /*                 |                     v                 */
+    /*                                                         */
+    /* pixel         contour              contour       pixel  */
+    /* center                                           center */
+
+    /* drop-out mode    scan conversion rules (as defined in OpenType) */
+    /* --------------------------------------------------------------- */
+    /*  0                1, 2, 3                                       */
+    /*  1                1, 2, 4                                       */
+    /*  2                1, 2                                          */
+    /*  3                same as mode 2                                */
+    /*  4                1, 2, 5                                       */
+    /*  5                1, 2, 6                                       */
+    /*  6, 7             same as mode 2                                */
+
+    e1  = CEILING( x1 );
+    e2  = FLOOR  ( x2 );
+    pxl = e1;
 
     if ( e1 > e2 )
     {
 
     if ( e1 > e2 )
     {
+      Int  dropOutControl = left->flags & 7;
+
+
       if ( e1 == e2 + ras.precision )
       {
       if ( e1 == e2 + ras.precision )
       {
-        switch ( ras.dropOutControl )
+        switch ( dropOutControl )
         {
         {
-        case 1:
-          e1 = e2;
+        case 0: /* simple drop-outs including stubs */
+          pxl = e2;
           break;
 
           break;
 
-        case 4:
-          e1 = CEILING( (x1 + x2 + 1) / 2 );
+        case 4: /* smart drop-outs including stubs */
+          pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
           break;
 
           break;
 
-        case 2:
-        case 5:
-          /* Drop-out Control Rule #4 */
+        case 1: /* simple drop-outs excluding stubs */
+        case 5: /* smart drop-outs excluding stubs  */
+
+          /* Drop-out Control Rules #4 and #6 */
 
 
-          /* The spec is not very clear regarding rule #4.  It      */
-          /* presents a method that is way too costly to implement  */
-          /* while the general idea seems to get rid of `stubs'.    */
+          /* The specification neither provides an exact definition */
+          /* of a `stub' nor gives exact rules to exclude them.     */
           /*                                                        */
           /*                                                        */
-          /* Here, we only get rid of stubs recognized if:          */
+          /* Here the constraints we use to recognize a stub.       */
           /*                                                        */
           /*  upper stub:                                           */
           /*                                                        */
           /*                                                        */
           /*  upper stub:                                           */
           /*                                                        */
@@ -2227,59 +2372,64 @@ static const char  count_table[256] =
           /*   - P_Left is the successor of P_Right in that contour */
           /*   - y is the bottom of P_Left                          */
           /*                                                        */
           /*   - P_Left is the successor of P_Right in that contour */
           /*   - y is the bottom of P_Left                          */
           /*                                                        */
+          /* We draw a stub if the following constraints are met.   */
+          /*                                                        */
+          /*   - for an upper or lower stub, there is top or bottom */
+          /*     overshoot, respectively                            */
+          /*   - the covered interval is greater or equal to a half */
+          /*     pixel                                              */
+
+          /* upper stub test */
+          if ( left->next == right                &&
+               left->height <= 0                  &&
+               !( left->flags & Overshoot_Top   &&
+                  x2 - x1 >= ras.precision_half ) )
+            return;
 
 
-          /* FIXXXME: uncommenting this line solves the disappearing */
-          /*          bit problem in the `7' of verdana 10pts, but   */
-          /*          makes a new one in the `C' of arial 14pts      */
-
-#if 0
-          if ( x2 - x1 < ras.precision_half )
-#endif
-          {
-            /* upper stub test */
-            if ( left->next == right && left->height <= 0 )
-              return;
-
-            /* lower stub test */
-            if ( right->next == left && left->start == y )
-              return;
-          }
-
-          /* check that the rightmost pixel isn't set */
-
-          e1 = TRUNC( e1 );
-
-          c1 = (Short)( e1 >> 3 );
-          f1 = (Short)( e1 &  7 );
-
-          if ( e1 >= 0 && e1 < ras.bWidth                      &&
-               ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
+          /* lower stub test */
+          if ( right->next == left                 &&
+               left->start == y                    &&
+               !( left->flags & Overshoot_Bottom &&
+                  x2 - x1 >= ras.precision_half  ) )
             return;
 
             return;
 
-          if ( ras.dropOutControl == 2 )
-            e1 = e2;
+          if ( dropOutControl == 1 )
+            pxl = e2;
           else
           else
-            e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
-
+            pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
           break;
 
           break;
 
-        default:
-          return;  /* unsupported mode */
+        default: /* modes 2, 3, 6, 7 */
+          return;  /* no drop-out control */
         }
         }
+
+        /* check that the other pixel isn't set */
+        e1 = pxl == e1 ? e2 : e1;
+
+        e1 = TRUNC( e1 );
+
+        c1 = (Short)( e1 >> 3 );
+        f1 = (Short)( e1 &  7 );
+
+        if ( e1 >= 0 && e1 < ras.bWidth                      &&
+             ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
+          return;
       }
       else
         return;
     }
 
       }
       else
         return;
     }
 
-    e1 = TRUNC( e1 );
+    e1 = TRUNC( pxl );
 
     if ( e1 >= 0 && e1 < ras.bWidth )
     {
       c1 = (Short)( e1 >> 3 );
       f1 = (Short)( e1 & 7 );
 
 
     if ( e1 >= 0 && e1 < ras.bWidth )
     {
       c1 = (Short)( e1 >> 3 );
       f1 = (Short)( e1 & 7 );
 
-      if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
-      if ( ras.gray_max_x < c1 ) ras.gray_max_x = c1;
+      if ( ras.gray_min_x > c1 )
+        ras.gray_min_x = c1;
+      if ( ras.gray_max_x < c1 )
+        ras.gray_max_x = c1;
 
       ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 );
     }
 
       ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 );
     }
@@ -2363,74 +2513,88 @@ static const char  count_table[256] =
                                   PProfile    left,
                                   PProfile    right )
   {
                                   PProfile    left,
                                   PProfile    right )
   {
-    Long   e1, e2;
+    Long   e1, e2, pxl;
     PByte  bits;
     Byte   f1;
 
 
     /* During the horizontal sweep, we only take care of drop-outs */
 
     PByte  bits;
     Byte   f1;
 
 
     /* During the horizontal sweep, we only take care of drop-outs */
 
-    e1 = CEILING( x1 );
-    e2 = FLOOR  ( x2 );
+    /* e1     +       <-- pixel center */
+    /*        |                        */
+    /* x1  ---+-->    <-- contour      */
+    /*        |                        */
+    /*        |                        */
+    /* x2  <--+---    <-- contour      */
+    /*        |                        */
+    /*        |                        */
+    /* e2     +       <-- pixel center */
+
+    e1  = CEILING( x1 );
+    e2  = FLOOR  ( x2 );
+    pxl = e1;
 
     if ( e1 > e2 )
     {
 
     if ( e1 > e2 )
     {
+      Int  dropOutControl = left->flags & 7;
+
+
       if ( e1 == e2 + ras.precision )
       {
       if ( e1 == e2 + ras.precision )
       {
-        switch ( ras.dropOutControl )
+        switch ( dropOutControl )
         {
         {
-        case 1:
-          e1 = e2;
+        case 0: /* simple drop-outs including stubs */
+          pxl = e2;
           break;
 
           break;
 
-        case 4:
-          e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+        case 4: /* smart drop-outs including stubs */
+          pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
           break;
 
           break;
 
-        case 2:
-        case 5:
-
-          /* Drop-out Control Rule #4 */
-
-          /* The spec is not very clear regarding rule #4.  It      */
-          /* presents a method that is way too costly to implement  */
-          /* while the general idea seems to get rid of `stubs'.    */
-          /*                                                        */
+        case 1: /* simple drop-outs excluding stubs */
+        case 5: /* smart drop-outs excluding stubs  */
+          /* see Vertical_Sweep_Drop for details */
 
           /* rightmost stub test */
 
           /* rightmost stub test */
-          if ( left->next == right && left->height <= 0 )
+          if ( left->next == right                &&
+               left->height <= 0                  &&
+               !( left->flags & Overshoot_Top   &&
+                  x2 - x1 >= ras.precision_half ) )
             return;
 
           /* leftmost stub test */
             return;
 
           /* leftmost stub test */
-          if ( right->next == left && left->start == y )
+          if ( right->next == left                 &&
+               left->start == y                    &&
+               !( left->flags & Overshoot_Bottom &&
+                  x2 - x1 >= ras.precision_half  ) )
             return;
 
             return;
 
-          /* check that the rightmost pixel isn't set */
-
-          e1 = TRUNC( e1 );
+          if ( dropOutControl == 1 )
+            pxl = e2;
+          else
+            pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+          break;
 
 
-          bits = ras.bTarget + ( y >> 3 );
-          f1   = (Byte)( 0x80 >> ( y & 7 ) );
+        default: /* modes 2, 3, 6, 7 */
+          return;  /* no drop-out control */
+        }
 
 
-          bits -= e1 * ras.target.pitch;
-          if ( ras.target.pitch > 0 )
-            bits += ( ras.target.rows - 1 ) * ras.target.pitch;
+        /* check that the other pixel isn't set */
+        e1 = pxl == e1 ? e2 : e1;
 
 
-          if ( e1 >= 0              &&
-               e1 < ras.target.rows &&
-               *bits & f1 )
-            return;
+        e1 = TRUNC( e1 );
 
 
-          if ( ras.dropOutControl == 2 )
-            e1 = e2;
-          else
-            e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+        bits = ras.bTarget + ( y >> 3 );
+        f1   = (Byte)( 0x80 >> ( y & 7 ) );
 
 
-          break;
+        bits -= e1 * ras.target.pitch;
+        if ( ras.target.pitch > 0 )
+          bits += ( ras.target.rows - 1 ) * ras.target.pitch;
 
 
-        default:
-          return;  /* unsupported mode */
-        }
+        if ( e1 >= 0              &&
+             e1 < ras.target.rows &&
+             *bits & f1           )
+          return;
       }
       else
         return;
       }
       else
         return;
@@ -2439,7 +2603,7 @@ static const char  count_table[256] =
     bits = ras.bTarget + ( y >> 3 );
     f1   = (Byte)( 0x80 >> ( y & 7 ) );
 
     bits = ras.bTarget + ( y >> 3 );
     f1   = (Byte)( 0x80 >> ( y & 7 ) );
 
-    e1 = TRUNC( e1 );
+    e1 = TRUNC( pxl );
 
     if ( e1 >= 0 && e1 < ras.target.rows )
     {
 
     if ( e1 >= 0 && e1 < ras.target.rows )
     {
@@ -2509,10 +2673,10 @@ static const char  count_table[256] =
   static void
   Vertical_Gray_Sweep_Step( RAS_ARG )
   {
   static void
   Vertical_Gray_Sweep_Step( RAS_ARG )
   {
-    Int    c1, c2;
-    PByte  pix, bit, bit2;
-    char*  count = (char*)count_table;
-    Byte*  grays;
+    Int     c1, c2;
+    PByte   pix, bit, bit2;
+    short*  count = (short*)count_table;
+    Byte*   grays;
 
 
     ras.traceOfs += ras.gray_width;
 
 
     ras.traceOfs += ras.gray_width;
@@ -2524,10 +2688,10 @@ static const char  count_table[256] =
 
       if ( ras.gray_max_x >= 0 )
       {
 
       if ( ras.gray_max_x >= 0 )
       {
-        Long   last_pixel = ras.target.width - 1;
-        Int    last_cell  = last_pixel >> 2;
-        Int    last_bit   = last_pixel & 3;
-        Bool   over       = 0;
+        Long  last_pixel = ras.target.width - 1;
+        Int   last_cell  = last_pixel >> 2;
+        Int   last_bit   = last_pixel & 3;
+        Bool  over       = 0;
 
 
         if ( ras.gray_max_x >= last_cell && last_bit != 3 )
 
 
         if ( ras.gray_max_x >= last_cell && last_bit != 3 )
@@ -2539,8 +2703,8 @@ static const char  count_table[256] =
         if ( ras.gray_min_x < 0 )
           ras.gray_min_x = 0;
 
         if ( ras.gray_min_x < 0 )
           ras.gray_min_x = 0;
 
-        bit   = ras.bTarget + ras.gray_min_x;
-        bit2  = bit + ras.gray_width;
+        bit  = ras.bTarget + ras.gray_min_x;
+        bit2 = bit + ras.gray_width;
 
         c1 = ras.gray_max_x - ras.gray_min_x;
 
 
         c1 = ras.gray_max_x - ras.gray_min_x;
 
@@ -2625,32 +2789,30 @@ static const char  count_table[256] =
 
 
     /* During the horizontal sweep, we only take care of drop-outs */
 
 
     /* During the horizontal sweep, we only take care of drop-outs */
+
     e1 = CEILING( x1 );
     e2 = FLOOR  ( x2 );
 
     if ( e1 > e2 )
     {
     e1 = CEILING( x1 );
     e2 = FLOOR  ( x2 );
 
     if ( e1 > e2 )
     {
+      Int  dropOutControl = left->flags & 7;
+
+
       if ( e1 == e2 + ras.precision )
       {
       if ( e1 == e2 + ras.precision )
       {
-        switch ( ras.dropOutControl )
+        switch ( dropOutControl )
         {
         {
-        case 1:
+        case 0: /* simple drop-outs including stubs */
           e1 = e2;
           break;
 
           e1 = e2;
           break;
 
-        case 4:
-          e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+        case 4: /* smart drop-outs including stubs */
+          e1 = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
           break;
 
           break;
 
-        case 2:
-        case 5:
-
-          /* Drop-out Control Rule #4 */
-
-          /* The spec is not very clear regarding rule #4.  It      */
-          /* presents a method that is way too costly to implement  */
-          /* while the general idea seems to get rid of `stubs'.    */
-          /*                                                        */
+        case 1: /* simple drop-outs excluding stubs */
+        case 5: /* smart drop-outs excluding stubs  */
+          /* see Vertical_Sweep_Drop for details */
 
           /* rightmost stub test */
           if ( left->next == right && left->height <= 0 )
 
           /* rightmost stub test */
           if ( left->next == right && left->height <= 0 )
@@ -2660,15 +2822,15 @@ static const char  count_table[256] =
           if ( right->next == left && left->start == y )
             return;
 
           if ( right->next == left && left->start == y )
             return;
 
-          if ( ras.dropOutControl == 2 )
+          if ( dropOutControl == 1 )
             e1 = e2;
           else
             e1 = e2;
           else
-            e1 = CEILING( ( x1 + x2 + 1 ) / 2 );
+            e1 = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
 
           break;
 
 
           break;
 
-        default:
-          return;  /* unsupported mode */
+        default: /* modes 2, 3, 6, 7 */
+          return;  /* no drop-out control */
         }
       }
       else
         }
       }
       else
@@ -2720,7 +2882,7 @@ static const char  count_table[256] =
     TProfileList  draw_left, draw_right;
 
 
     TProfileList  draw_left, draw_right;
 
 
-    /* Init empty linked lists */
+    /* initialize empty linked lists */
 
     Init_Linked( &waiting );
 
 
     Init_Linked( &waiting );
 
@@ -2740,8 +2902,10 @@ static const char  count_table[256] =
       bottom = (Short)P->start;
       top    = (Short)( P->start + P->height - 1 );
 
       bottom = (Short)P->start;
       top    = (Short)( P->start + P->height - 1 );
 
-      if ( min_Y > bottom ) min_Y = bottom;
-      if ( max_Y < top    ) max_Y = top;
+      if ( min_Y > bottom )
+        min_Y = bottom;
+      if ( max_Y < top )
+        max_Y = top;
 
       P->X = 0;
       InsNew( &waiting, P );
 
       P->X = 0;
       InsNew( &waiting, P );
@@ -2749,18 +2913,18 @@ static const char  count_table[256] =
       P = Q;
     }
 
       P = Q;
     }
 
-    /* Check the Y-turns */
+    /* check the Y-turns */
     if ( ras.numTurns == 0 )
     {
       ras.error = Raster_Err_Invalid;
       return FAILURE;
     }
 
     if ( ras.numTurns == 0 )
     {
       ras.error = Raster_Err_Invalid;
       return FAILURE;
     }
 
-    /* Now inits the sweep */
+    /* now initialize the sweep */
 
     ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y );
 
 
     ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y );
 
-    /* Then compute the distance of each profile from min_Y */
+    /* then compute the distance of each profile from min_Y */
 
     P = waiting;
 
 
     P = waiting;
 
@@ -2770,18 +2934,18 @@ static const char  count_table[256] =
       P = P->link;
     }
 
       P = P->link;
     }
 
-    /* Let's go */
+    /* let's go */
 
     y        = min_Y;
     y_height = 0;
 
 
     y        = min_Y;
     y_height = 0;
 
-    if ( ras.numTurns > 0 &&
+    if ( ras.numTurns > 0                     &&
          ras.sizeBuff[-ras.numTurns] == min_Y )
       ras.numTurns--;
 
     while ( ras.numTurns > 0 )
     {
          ras.sizeBuff[-ras.numTurns] == min_Y )
       ras.numTurns--;
 
     while ( ras.numTurns > 0 )
     {
-      /* look in the waiting list for new activations */
+      /* check waiting list for new activations */
 
       P = waiting;
 
 
       P = waiting;
 
@@ -2793,22 +2957,16 @@ static const char  count_table[256] =
         {
           DelOld( &waiting, P );
 
         {
           DelOld( &waiting, P );
 
-          switch ( P->flow )
-          {
-          case Flow_Up:
+          if ( P->flags & Flow_Up )
             InsNew( &draw_left,  P );
             InsNew( &draw_left,  P );
-            break;
-
-          case Flow_Down:
+          else
             InsNew( &draw_right, P );
             InsNew( &draw_right, P );
-            break;
-          }
         }
 
         P = Q;
       }
 
         }
 
         P = Q;
       }
 
-      /* Sort the drawing lists */
+      /* sort the drawing lists */
 
       Sort( &draw_left );
       Sort( &draw_right );
 
       Sort( &draw_left );
       Sort( &draw_right );
@@ -2818,7 +2976,7 @@ static const char  count_table[256] =
 
       while ( y < y_change )
       {
 
       while ( y < y_change )
       {
-        /* Let's trace */
+        /* let's trace */
 
         dropouts = 0;
 
 
         dropouts = 0;
 
@@ -2837,22 +2995,28 @@ static const char  count_table[256] =
             x2 = xs;
           }
 
             x2 = xs;
           }
 
-          if ( x2 - x1 <= ras.precision )
-          {
-            e1 = FLOOR( x1 );
-            e2 = CEILING( x2 );
+          e1 = FLOOR( x1 );
+          e2 = CEILING( x2 );
 
 
-            if ( ras.dropOutControl != 0                 &&
-                 ( e1 > e2 || e2 == e1 + ras.precision ) )
+          if ( x2 - x1 <= ras.precision &&
+               e1 != x1 && e2 != x2     )
+          {
+            if ( e1 > e2 || e2 == e1 + ras.precision )
             {
             {
-              /* a drop out was detected */
+              Int  dropOutControl = P_Left->flags & 7;
+
+
+              if ( dropOutControl != 2 )
+              {
+                /* a drop-out was detected */
 
 
-              P_Left ->X = x1;
-              P_Right->X = x2;
+                P_Left ->X = x1;
+                P_Right->X = x2;
 
 
-              /* mark profile for drop-out processing */
-              P_Left->countL = 1;
-              dropouts++;
+                /* mark profile for drop-out processing */
+                P_Left->countL = 1;
+                dropouts++;
+              }
 
               goto Skip_To_Next;
             }
 
               goto Skip_To_Next;
             }
@@ -2866,9 +3030,9 @@ static const char  count_table[256] =
           P_Right = P_Right->link;
         }
 
           P_Right = P_Right->link;
         }
 
-        /* now perform the dropouts _after_ the span drawing -- */
-        /* drop-outs processing has been moved out of the loop  */
-        /* for performance tuning                               */
+        /* handle drop-outs _after_ the span drawing --       */
+        /* drop-out processing has been moved out of the loop */
+        /* for performance tuning                             */
         if ( dropouts > 0 )
           goto Scan_DropOuts;
 
         if ( dropouts > 0 )
           goto Scan_DropOuts;
 
@@ -2885,7 +3049,7 @@ static const char  count_table[256] =
         }
       }
 
         }
       }
 
-      /* Now finalize the profiles that needs it */
+      /* now finalize the profiles that need it */
 
       P = draw_left;
       while ( P )
 
       P = draw_left;
       while ( P )
@@ -2906,7 +3070,7 @@ static const char  count_table[256] =
       }
     }
 
       }
     }
 
-    /* for gray-scaling, flushes the bitmap scanline cache */
+    /* for gray-scaling, flush the bitmap scanline cache */
     while ( y <= max_Y )
     {
       ras.Proc_Sweep_Step( RAS_VAR );
     while ( y <= max_Y )
     {
       ras.Proc_Sweep_Step( RAS_VAR );
@@ -2949,7 +3113,7 @@ static const char  count_table[256] =
   /*    Render_Single_Pass                                                 */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Render_Single_Pass                                                 */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Performs one sweep with sub-banding.                               */
+  /*    Perform one sweep with sub-banding.                                */
   /*                                                                       */
   /* <Input>                                                               */
   /*    flipped :: If set, flip the direction of the outline.              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    flipped :: If set, flip the direction of the outline.              */
@@ -3024,7 +3188,7 @@ static const char  count_table[256] =
   /*    Render_Glyph                                                       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Render_Glyph                                                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Renders a glyph in a bitmap.  Sub-banding if needed.               */
+  /*    Render a glyph in a bitmap.  Sub-banding if needed.                */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
@@ -3036,14 +3200,24 @@ static const char  count_table[256] =
 
 
     Set_High_Precision( RAS_VARS ras.outline.flags &
 
 
     Set_High_Precision( RAS_VARS ras.outline.flags &
-                        FT_OUTLINE_HIGH_PRECISION );
-    ras.scale_shift    = ras.precision_shift;
-    /* Drop-out mode 2 is hard-coded since this is the only mode used */
-    /* on Windows platforms.  Using other modes, as specified by the  */
-    /* font, results in misplaced pixels.                             */
-    ras.dropOutControl = 2;
-    ras.second_pass    = (FT_Byte)( !( ras.outline.flags &
-                                       FT_OUTLINE_SINGLE_PASS ) );
+                                 FT_OUTLINE_HIGH_PRECISION );
+    ras.scale_shift = ras.precision_shift;
+
+    if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
+      ras.dropOutControl = 2;
+    else
+    {
+      if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
+        ras.dropOutControl = 4;
+      else
+        ras.dropOutControl = 0;
+
+      if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
+        ras.dropOutControl += 1;
+    }
+
+    ras.second_pass = (FT_Byte)( !( ras.outline.flags &
+                                    FT_OUTLINE_SINGLE_PASS ) );
 
     /* Vertical Sweep */
     ras.Proc_Sweep_Init = Vertical_Sweep_Init;
 
     /* Vertical Sweep */
     ras.Proc_Sweep_Init = Vertical_Sweep_Init;
@@ -3062,7 +3236,7 @@ static const char  count_table[256] =
       return error;
 
     /* Horizontal Sweep */
       return error;
 
     /* Horizontal Sweep */
-    if ( ras.second_pass && ras.dropOutControl != 0 )
+    if ( ras.second_pass && ras.dropOutControl != 2 )
     {
       ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
       ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
     {
       ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
       ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
@@ -3083,14 +3257,13 @@ static const char  count_table[256] =
 
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
 
 
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
 
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
   /*    Render_Gray_Glyph                                                  */
   /*                                                                       */
   /* <Description>                                                         */
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
   /*    Render_Gray_Glyph                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Renders a glyph with grayscaling.  Sub-banding if needed.          */
+  /*    Render a glyph with grayscaling.  Sub-banding if needed.           */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
@@ -3103,13 +3276,23 @@ static const char  count_table[256] =
 
 
     Set_High_Precision( RAS_VARS ras.outline.flags &
 
 
     Set_High_Precision( RAS_VARS ras.outline.flags &
-                        FT_OUTLINE_HIGH_PRECISION );
-    ras.scale_shift    = ras.precision_shift + 1;
-    /* Drop-out mode 2 is hard-coded since this is the only mode used */
-    /* on Windows platforms.  Using other modes, as specified by the  */
-    /* font, results in misplaced pixels.                             */
-    ras.dropOutControl = 2;
-    ras.second_pass    = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS );
+                                 FT_OUTLINE_HIGH_PRECISION );
+    ras.scale_shift = ras.precision_shift + 1;
+
+    if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
+      ras.dropOutControl = 2;
+    else
+    {
+      if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
+        ras.dropOutControl = 4;
+      else
+        ras.dropOutControl = 0;
+
+      if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
+        ras.dropOutControl += 1;
+    }
+
+    ras.second_pass = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS );
 
     /* Vertical Sweep */
 
 
     /* Vertical Sweep */
 
@@ -3137,7 +3320,7 @@ static const char  count_table[256] =
       return error;
 
     /* Horizontal Sweep */
       return error;
 
     /* Horizontal Sweep */
-    if ( ras.second_pass && ras.dropOutControl != 0 )
+    if ( ras.second_pass && ras.dropOutControl != 2 )
     {
       ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
       ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span;
     {
       ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
       ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span;
@@ -3172,8 +3355,6 @@ static const char  count_table[256] =
   static void
   ft_black_init( PRaster  raster )
   {
   static void
   ft_black_init( PRaster  raster )
   {
-    FT_UNUSED( raster );
-
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
     FT_UInt  n;
 
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
     FT_UInt  n;
 
@@ -3183,7 +3364,8 @@ static const char  count_table[256] =
       raster->grays[n] = n * 255 / 4;
 
     raster->gray_width = RASTER_GRAY_LINES / 2;
       raster->grays[n] = n * 255 / 4;
 
     raster->gray_width = RASTER_GRAY_LINES / 2;
-
+#else
+    FT_UNUSED( raster );
 #endif
   }
 
 #endif
   }
 
@@ -3196,7 +3378,7 @@ static const char  count_table[256] =
 
 
   static int
 
 
   static int
-  ft_black_new( void*      memory,
+  ft_black_new( void*       memory,
                 FT_Raster  *araster )
   {
      static TRaster  the_raster;
                 FT_Raster  *araster )
   {
      static TRaster  the_raster;
@@ -3254,9 +3436,9 @@ static const char  count_table[256] =
 
 
   static void
 
 
   static void
-  ft_black_reset( PRaster   raster,
-                  char*     pool_base,
-                  long      pool_size )
+  ft_black_reset( PRaster  raster,
+                  char*    pool_base,
+                  long     pool_size )
   {
     if ( raster )
     {
   {
     if ( raster )
     {
@@ -3281,9 +3463,9 @@ static const char  count_table[256] =
 
 
   static void
 
 
   static void
-  ft_black_set_mode( PRaster            raster,
-                     unsigned long      mode,
-                     const char*        palette )
+  ft_black_set_mode( PRaster        raster,
+                     unsigned long  mode,
+                     const char*    palette )
   {
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
 
   {
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
 
@@ -3319,14 +3501,18 @@ static const char  count_table[256] =
     if ( !raster || !raster->buffer || !raster->buffer_size )
       return Raster_Err_Not_Ini;
 
     if ( !raster || !raster->buffer || !raster->buffer_size )
       return Raster_Err_Not_Ini;
 
+    if ( !outline )
+      return Raster_Err_Invalid;
+
     /* return immediately if the outline is empty */
     if ( outline->n_points == 0 || outline->n_contours <= 0 )
       return Raster_Err_None;
 
     /* return immediately if the outline is empty */
     if ( outline->n_points == 0 || outline->n_contours <= 0 )
       return Raster_Err_None;
 
-    if ( !outline || !outline->contours || !outline->points )
+    if ( !outline->contours || !outline->points )
       return Raster_Err_Invalid;
 
       return Raster_Err_Invalid;
 
-    if ( outline->n_points != outline->contours[outline->n_contours - 1] + 1 )
+    if ( outline->n_points !=
+           outline->contours[outline->n_contours - 1] + 1 )
       return Raster_Err_Invalid;
 
     worker = raster->worker;
       return Raster_Err_Invalid;
 
     worker = raster->worker;
@@ -3335,35 +3521,43 @@ static const char  count_table[256] =
     if ( params->flags & FT_RASTER_FLAG_DIRECT )
       return Raster_Err_Unsupported;
 
     if ( params->flags & FT_RASTER_FLAG_DIRECT )
       return Raster_Err_Unsupported;
 
-    if ( !target_map || !target_map->buffer )
+    if ( !target_map )
       return Raster_Err_Invalid;
 
       return Raster_Err_Invalid;
 
-    ras.outline  = *outline;
-    ras.target   = *target_map;
+    /* nothing to do */
+    if ( !target_map->width || !target_map->rows )
+      return Raster_Err_None;
+
+    if ( !target_map->buffer )
+      return Raster_Err_Invalid;
 
 
-    worker->buff        = (PLong) raster->buffer;
-    worker->sizeBuff    = worker->buff +
-                            raster->buffer_size / sizeof ( Long );
+    ras.outline = *outline;
+    ras.target  = *target_map;
+
+    worker->buff       = (PLong) raster->buffer;
+    worker->sizeBuff   = worker->buff +
+                           raster->buffer_size / sizeof ( Long );
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
-    worker->grays       = raster->grays;
-    worker->gray_width  = raster->gray_width;
+    worker->grays      = raster->grays;
+    worker->gray_width = raster->gray_width;
+
+    FT_MEM_ZERO( worker->gray_lines, worker->gray_width * 2 );
 #endif
 
 #endif
 
-    return ( params->flags & FT_RASTER_FLAG_AA )
-               ? Render_Gray_Glyph( RAS_VAR )
-               : Render_Glyph( RAS_VAR ) );
+    return ( params->flags & FT_RASTER_FLAG_AA )
+           ? Render_Gray_Glyph( RAS_VAR )
+           : Render_Glyph( RAS_VAR );
   }
 
 
   }
 
 
-  const FT_Raster_Funcs  ft_standard_raster =
-  {
+  FT_DEFINE_RASTER_FUNCS( ft_standard_raster,
     FT_GLYPH_FORMAT_OUTLINE,
     (FT_Raster_New_Func)     ft_black_new,
     (FT_Raster_Reset_Func)   ft_black_reset,
     (FT_Raster_Set_Mode_Func)ft_black_set_mode,
     (FT_Raster_Render_Func)  ft_black_render,
     (FT_Raster_Done_Func)    ft_black_done
     FT_GLYPH_FORMAT_OUTLINE,
     (FT_Raster_New_Func)     ft_black_new,
     (FT_Raster_Reset_Func)   ft_black_reset,
     (FT_Raster_Set_Mode_Func)ft_black_set_mode,
     (FT_Raster_Render_Func)  ft_black_render,
     (FT_Raster_Done_Func)    ft_black_done
-  };
+  )
 
 
 /* END */
 
 
 /* END */
index 3cc8d07..1ed8af6 100644 (file)
@@ -21,6 +21,7 @@
 #include FT_OUTLINE_H
 #include "ftrend1.h"
 #include "ftraster.h"
 #include FT_OUTLINE_H
 #include "ftrend1.h"
 #include "ftraster.h"
+#include "rastpic.h"
 
 #include "rasterrs.h"
 
 
 #include "rasterrs.h"
 
     }
 
     /* check rendering mode */
     }
 
     /* check rendering mode */
+#ifndef FT_CONFIG_OPTION_PIC
     if ( mode != FT_RENDER_MODE_MONO )
     {
       /* raster1 is only capable of producing monochrome bitmaps */
     if ( mode != FT_RENDER_MODE_MONO )
     {
       /* raster1 is only capable of producing monochrome bitmaps */
       if ( render->clazz == &ft_raster5_renderer_class )
         return Raster_Err_Cannot_Render_Glyph;
     }
       if ( render->clazz == &ft_raster5_renderer_class )
         return Raster_Err_Cannot_Render_Glyph;
     }
+#else /* FT_CONFIG_OPTION_PIC */
+    /* When PIC is enabled, we cannot get to the class object      */
+    /* so instead we check the final character in the class name   */
+    /* ("raster5" or "raster1"). Yes this is a hack.               */
+    /* The "correct" thing to do is have different render function */
+    /* for each of the classes.                                    */
+    if ( mode != FT_RENDER_MODE_MONO )
+    {
+      /* raster1 is only capable of producing monochrome bitmaps */
+      if ( render->clazz->root.module_name[6] == '1' )
+        return Raster_Err_Cannot_Render_Glyph;
+    }
+    else
+    {
+      /* raster5 is only capable of producing 5-gray-levels bitmaps */
+      if ( render->clazz->root.module_name[6] == '5' )
+        return Raster_Err_Cannot_Render_Glyph;
+    }
+#endif /* FT_CONFIG_OPTION_PIC */
 
     outline = &slot->outline;
 
 
     outline = &slot->outline;
 
   }
 
 
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Renderer_Class  ft_raster1_renderer_class =
-  {
-    {
+  FT_DEFINE_RENDERER(ft_raster1_renderer_class,
+    
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       (FT_Module_Constructor)ft_raster1_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
       (FT_Module_Constructor)ft_raster1_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
-    },
+    ,
 
     FT_GLYPH_FORMAT_OUTLINE,
 
 
     FT_GLYPH_FORMAT_OUTLINE,
 
     (FT_Renderer_GetCBoxFunc)  ft_raster1_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_raster1_set_mode,
 
     (FT_Renderer_GetCBoxFunc)  ft_raster1_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_raster1_set_mode,
 
-    (FT_Raster_Funcs*)    &ft_standard_raster
-  };
+    (FT_Raster_Funcs*)    &FT_STANDARD_RASTER_GET
+  )
 
 
   /* This renderer is _NOT_ part of the default modules; you will need */
   /* to register it by hand in your application.  It should only be    */
   /* used for backwards-compatibility with FT 1.x anyway.              */
   /*                                                                   */
 
 
   /* This renderer is _NOT_ part of the default modules; you will need */
   /* to register it by hand in your application.  It should only be    */
   /* used for backwards-compatibility with FT 1.x anyway.              */
   /*                                                                   */
-  FT_CALLBACK_TABLE_DEF
-  const FT_Renderer_Class  ft_raster5_renderer_class =
-  {
-    {
+  FT_DEFINE_RENDERER(ft_raster5_renderer_class,
+  
+    
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       (FT_Module_Constructor)ft_raster1_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
       (FT_Module_Constructor)ft_raster1_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
-    },
+    ,
 
     FT_GLYPH_FORMAT_OUTLINE,
 
 
     FT_GLYPH_FORMAT_OUTLINE,
 
     (FT_Renderer_GetCBoxFunc)  ft_raster1_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_raster1_set_mode,
 
     (FT_Renderer_GetCBoxFunc)  ft_raster1_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_raster1_set_mode,
 
-    (FT_Raster_Funcs*)    &ft_standard_raster
-  };
+    (FT_Raster_Funcs*)    &FT_STANDARD_RASTER_GET
+  )
 
 
 /* END */
 
 
 /* END */
index 76e9a5f..4cf1286 100644 (file)
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
 
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_raster1_renderer_class;
+  FT_DECLARE_RENDERER( ft_raster1_renderer_class )
 
   /* this renderer is _NOT_ part of the default modules, you'll need */
   /* to register it by hand in your application.  It should only be  */
   /* used for backwards-compatibility with FT 1.x anyway.            */
   /*                                                                 */
 
   /* this renderer is _NOT_ part of the default modules, you'll need */
   /* to register it by hand in your application.  It should only be  */
   /* used for backwards-compatibility with FT 1.x anyway.            */
   /*                                                                 */
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_raster5_renderer_class;
+  FT_DECLARE_RENDERER( ft_raster5_renderer_class )
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
index 59c737b..cbff5df 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += RASTER_MODULE
 
 define RASTER_MODULE
 FTMODULE_H_COMMANDS += RASTER_MODULE
 
 define RASTER_MODULE
-$(OPEN_DRIVER)ft_raster1_renderer_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Renderer_Class, ft_raster1_renderer_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)raster    $(ECHO_DRIVER_DESC)monochrome bitmap renderer$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)raster    $(ECHO_DRIVER_DESC)monochrome bitmap renderer$(ECHO_DRIVER_DONE)
 endef
 
index f13a67a..1202a11 100644 (file)
@@ -19,6 +19,7 @@
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
+#include "rastpic.c"
 #include "ftraster.c"
 #include "ftrend1.c"
 
 #include "ftraster.c"
 #include "ftrend1.c"
 
diff --git a/reactos/lib/3rdparty/freetype/src/raster/rastpic.c b/reactos/lib/3rdparty/freetype/src/raster/rastpic.c
new file mode 100644 (file)
index 0000000..3c26487
--- /dev/null
@@ -0,0 +1,89 @@
+/***************************************************************************/
+/*                                                                         */
+/*  rastpic.c                                                              */
+/*                                                                         */
+/*    The FreeType position independent code services for raster module.   */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "rastpic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from ftraster.c */
+  void FT_Init_Class_ft_standard_raster(FT_Raster_Funcs*);
+
+  void
+  ft_raster1_renderer_class_pic_free(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory memory = library->memory;
+    if ( pic_container->raster )
+    {
+      RasterPIC* container = (RasterPIC*)pic_container->raster;
+      if(--container->ref_count)
+        return;
+      FT_FREE( container );
+      pic_container->raster = NULL;
+    }
+  }
+
+
+  FT_Error
+  ft_raster1_renderer_class_pic_init(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    RasterPIC* container;
+    FT_Memory memory = library->memory;
+
+    /* since this function also serve raster5 renderer, 
+       it implements reference counting */
+    if(pic_container->raster)
+    {
+      ((RasterPIC*)pic_container->raster)->ref_count++;
+      return error;
+    }
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->raster = container;
+    container->ref_count = 1;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    FT_Init_Class_ft_standard_raster(&container->ft_standard_raster);
+/*Exit:*/
+    if(error)
+      ft_raster1_renderer_class_pic_free(library);
+    return error;
+  }
+
+  /* re-route these init and free functions to the above functions */
+  FT_Error ft_raster5_renderer_class_pic_init(FT_Library library)
+  {
+    return ft_raster1_renderer_class_pic_init(library);
+  }
+  void ft_raster5_renderer_class_pic_free(FT_Library library)
+  {
+    ft_raster1_renderer_class_pic_free(library);
+  }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/raster/rastpic.h b/reactos/lib/3rdparty/freetype/src/raster/rastpic.h
new file mode 100644 (file)
index 0000000..dcd82b8
--- /dev/null
@@ -0,0 +1,50 @@
+/***************************************************************************/
+/*                                                                         */
+/*  rastpic.h                                                              */
+/*                                                                         */
+/*    The FreeType position independent code services for raster module.   */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __RASTPIC_H__
+#define __RASTPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_STANDARD_RASTER_GET     ft_standard_raster
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+  typedef struct RasterPIC_
+  {
+    int ref_count;
+    FT_Raster_Funcs ft_standard_raster;
+  } RasterPIC;
+
+#define GET_PIC(lib)               ((RasterPIC*)((lib)->pic_container.raster))
+#define FT_STANDARD_RASTER_GET     (GET_PIC(library)->ft_standard_raster)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __RASTPIC_H__ */
+
+
+/* END */
index 0dc8782..9703b12 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
 #
 
 
-# Copyright 1996-2000, 2001, 2003 by
+# Copyright 1996-2000, 2001, 2003, 2008, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
index 6b8a401..cb20b1b 100644 (file)
@@ -16,7 +16,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) sfnt ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = sfobjs sfdriver ttcmap ttpost ttload ttsbit ttkern ttbdf ;
+    _sources = sfobjs sfdriver ttcmap ttmtx ttpost ttload ttsbit ttkern ttbdf sfntpic ;
   }
   else
   {
   }
   else
   {
index d339138..95fd6a3 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += SFNT_MODULE
 
 define SFNT_MODULE
 FTMODULE_H_COMMANDS += SFNT_MODULE
 
 define SFNT_MODULE
-$(OPEN_DRIVER)sfnt_module_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Module_Class, sfnt_module_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)sfnt      $(ECHO_DRIVER_DESC)helper module for TrueType & OpenType formats$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)sfnt      $(ECHO_DRIVER_DESC)helper module for TrueType & OpenType formats$(ECHO_DRIVER_DONE)
 endef
 
index ff7840e..abda74f 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
 #
 
 
-# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007 by
+# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -37,8 +37,11 @@ SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c   \
 
 # SFNT driver headers
 #
 
 # SFNT driver headers
 #
-SFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h) \
-              $(SFNT_DIR)/sferrors.h
+# Note that ttsbit0.c gets #included by ttsbit.c.
+#
+SFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h)  \
+              $(SFNT_DIR)/sferrors.h \
+              $(SFNT_DIR)/ttsbit0.c
 
 
 # SFNT driver object(s)
 
 
 # SFNT driver object(s)
index 5ba22a6..1d157b7 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level SFNT driver interface (body).                             */
 /*                                                                         */
 /*                                                                         */
 /*    High-level SFNT driver interface (body).                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 
 #include <ft2build.h>
 
 
 #include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_SFNT_H
 #include FT_INTERNAL_OBJECTS_H
 
 #include "sfdriver.h"
 #include "ttload.h"
 #include "sfobjs.h"
 #include FT_INTERNAL_SFNT_H
 #include FT_INTERNAL_OBJECTS_H
 
 #include "sfdriver.h"
 #include "ttload.h"
 #include "sfobjs.h"
+#include "sfntpic.h"
 
 #include "sferrors.h"
 
 
 #include "sferrors.h"
 
 #include FT_SERVICE_SFNT_H
 #include FT_SERVICE_TT_CMAP_H
 
 #include FT_SERVICE_SFNT_H
 #include FT_SERVICE_TT_CMAP_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_sfdriver
+
 
  /*
   *  SFNT TABLE SERVICE
 
  /*
   *  SFNT TABLE SERVICE
   sfnt_table_info( TT_Face    face,
                    FT_UInt    idx,
                    FT_ULong  *tag,
   sfnt_table_info( TT_Face    face,
                    FT_UInt    idx,
                    FT_ULong  *tag,
+                   FT_ULong  *offset,
                    FT_ULong  *length )
   {
                    FT_ULong  *length )
   {
-    if ( !tag || !length )
+    if ( !tag || !offset || !length )
       return SFNT_Err_Invalid_Argument;
 
     if ( idx >= face->num_tables )
       return SFNT_Err_Table_Missing;
 
     *tag    = face->dir_tables[idx].Tag;
       return SFNT_Err_Invalid_Argument;
 
     if ( idx >= face->num_tables )
       return SFNT_Err_Table_Missing;
 
     *tag    = face->dir_tables[idx].Tag;
+    *offset = face->dir_tables[idx].Offset;
     *length = face->dir_tables[idx].Length;
 
     return SFNT_Err_Ok;
   }
 
 
     *length = face->dir_tables[idx].Length;
 
     return SFNT_Err_Ok;
   }
 
 
-  static const FT_Service_SFNT_TableRec  sfnt_service_sfnt_table =
-  {
+  FT_DEFINE_SERVICE_SFNT_TABLEREC(sfnt_service_sfnt_table,
     (FT_SFNT_TableLoadFunc)tt_face_load_any,
     (FT_SFNT_TableGetFunc) get_sfnt_table,
     (FT_SFNT_TableInfoFunc)sfnt_table_info
     (FT_SFNT_TableLoadFunc)tt_face_load_any,
     (FT_SFNT_TableGetFunc) get_sfnt_table,
     (FT_SFNT_TableInfoFunc)sfnt_table_info
-  };
+  )
 
 
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
 
 
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
   }
 
 
   }
 
 
-  static const FT_Service_GlyphDictRec  sfnt_service_glyph_dict =
+  static FT_UInt
+  sfnt_get_name_index( TT_Face     face,
+                       FT_String*  glyph_name )
   {
   {
+    FT_Face   root = &face->root;
+    FT_UInt   i, max_gid = FT_UINT_MAX;
+
+
+    if ( root->num_glyphs < 0 )
+      return 0;
+    else if ( ( FT_ULong ) root->num_glyphs < FT_UINT_MAX )
+      max_gid = ( FT_UInt ) root->num_glyphs;
+    else
+      FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
+         FT_UINT_MAX, root->num_glyphs ));
+
+    for ( i = 0; i < max_gid; i++ )
+    {
+      FT_String*  gname;
+      FT_Error    error = tt_face_get_ps_name( face, i, &gname );
+
+
+      if ( error )
+        continue;
+
+      if ( !ft_strcmp( glyph_name, gname ) )
+        return i;
+    }
+
+    return 0;
+  }
+
+
+  FT_DEFINE_SERVICE_GLYPHDICTREC(sfnt_service_glyph_dict,
     (FT_GlyphDict_GetNameFunc)  sfnt_get_glyph_name,
     (FT_GlyphDict_GetNameFunc)  sfnt_get_glyph_name,
-    (FT_GlyphDict_NameIndexFunc)NULL
-  };
+    (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index
+  )
 
 #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
 
 
 #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
 
     return result;
   }
 
     return result;
   }
 
-  static const FT_Service_PsFontNameRec  sfnt_service_ps_name =
-  {
+  FT_DEFINE_SERVICE_PSFONTNAMEREC(sfnt_service_ps_name,
     (FT_PsName_GetFunc)sfnt_get_ps_name
     (FT_PsName_GetFunc)sfnt_get_ps_name
-  };
+  )
 
 
   /*
    *  TT CMAP INFO
    */
 
 
   /*
    *  TT CMAP INFO
    */
-  static const FT_Service_TTCMapsRec  tt_service_get_cmap_info =
-  {
+  FT_DEFINE_SERVICE_TTCMAPSREC(tt_service_get_cmap_info,
     (TT_CMap_Info_GetFunc)tt_get_cmap_info
     (TT_CMap_Info_GetFunc)tt_get_cmap_info
-  };
+  )
 
 
 #ifdef TT_CONFIG_OPTION_BDF
 
 
 #ifdef TT_CONFIG_OPTION_BDF
   }
 
 
   }
 
 
-  static const FT_Service_BDFRec  sfnt_service_bdf =
-  {
+  FT_DEFINE_SERVICE_BDFRec(sfnt_service_bdf,
     (FT_BDF_GetCharsetIdFunc) sfnt_get_charset_id,
     (FT_BDF_GetCharsetIdFunc) sfnt_get_charset_id,
-    (FT_BDF_GetPropertyFunc)  tt_face_find_bdf_prop,
-  };
+    (FT_BDF_GetPropertyFunc)  tt_face_find_bdf_prop
+  )
 
 #endif /* TT_CONFIG_OPTION_BDF */
 
 
 #endif /* TT_CONFIG_OPTION_BDF */
 
    *  SERVICE LIST
    */
 
    *  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
-#ifdef TT_CONFIG_OPTION_BDF
-    { FT_SERVICE_ID_BDF,                  &sfnt_service_bdf },
+#if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF
+  FT_DEFINE_SERVICEDESCREC5(sfnt_services,
+    FT_SERVICE_ID_SFNT_TABLE,           &FT_SFNT_SERVICE_SFNT_TABLE_GET,
+    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET,
+    FT_SERVICE_ID_GLYPH_DICT,           &FT_SFNT_SERVICE_GLYPH_DICT_GET,
+    FT_SERVICE_ID_BDF,                  &FT_SFNT_SERVICE_BDF_GET,
+    FT_SERVICE_ID_TT_CMAP,              &FT_TT_SERVICE_GET_CMAP_INFO_GET
+  )
+#elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+  FT_DEFINE_SERVICEDESCREC4(sfnt_services,
+    FT_SERVICE_ID_SFNT_TABLE,           &FT_SFNT_SERVICE_SFNT_TABLE_GET,
+    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET,
+    FT_SERVICE_ID_GLYPH_DICT,           &FT_SFNT_SERVICE_GLYPH_DICT_GET,
+    FT_SERVICE_ID_TT_CMAP,              &FT_TT_SERVICE_GET_CMAP_INFO_GET
+  )
+#elif defined TT_CONFIG_OPTION_BDF
+  FT_DEFINE_SERVICEDESCREC4(sfnt_services,
+    FT_SERVICE_ID_SFNT_TABLE,           &FT_SFNT_SERVICE_SFNT_TABLE_GET,
+    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET,
+    FT_SERVICE_ID_BDF,                  &FT_SFNT_SERVICE_BDF_GET,
+    FT_SERVICE_ID_TT_CMAP,              &FT_TT_SERVICE_GET_CMAP_INFO_GET
+  )
+#else
+  FT_DEFINE_SERVICEDESCREC3(sfnt_services,
+    FT_SERVICE_ID_SFNT_TABLE,           &FT_SFNT_SERVICE_SFNT_TABLE_GET,
+    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET,
+    FT_SERVICE_ID_TT_CMAP,              &FT_TT_SERVICE_GET_CMAP_INFO_GET
+  )
 #endif
 #endif
-    { FT_SERVICE_ID_TT_CMAP,              &tt_service_get_cmap_info },
-
-    { NULL, NULL }
-  };
 
 
   FT_CALLBACK_DEF( FT_Module_Interface )
   sfnt_get_interface( FT_Module    module,
                       const char*  module_interface )
   {
 
 
   FT_CALLBACK_DEF( FT_Module_Interface )
   sfnt_get_interface( FT_Module    module,
                       const char*  module_interface )
   {
+    FT_Library           library = module->library;
+    FT_UNUSED(library);
     FT_UNUSED( module );
 
     FT_UNUSED( module );
 
-    return ft_service_list_lookup( sfnt_services, module_interface );
+    return ft_service_list_lookup( FT_SFNT_SERVICES_GET, module_interface );
   }
 
 
   }
 
 
 
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+#define PUT_EMBEDDED_BITMAPS(a) a 
+#else
+#define PUT_EMBEDDED_BITMAPS(a) 0 
+#endif
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+#define PUT_PS_NAMES(a) a 
+#else
+#define PUT_PS_NAMES(a) 0 
+#endif
 
 
-  static
-  const SFNT_Interface  sfnt_interface =
-  {
+  FT_DEFINE_SFNT_INTERFACE(sfnt_interface,
     tt_face_goto_table,
 
     sfnt_init_face,
     tt_face_goto_table,
 
     sfnt_init_face,
 
     tt_face_load_any,
 
 
     tt_face_load_any,
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    tt_face_load_sfnt_header_stub,
-    tt_face_load_directory_stub,
-#endif
+    tt_face_load_sfnt_header_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+    tt_face_load_directory_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
     tt_face_load_head,
     tt_face_load_hhea,
 
     tt_face_load_head,
     tt_face_load_hhea,
     tt_face_load_name,
     tt_face_free_name,
 
     tt_face_load_name,
     tt_face_free_name,
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    tt_face_load_hdmx_stub,
-    tt_face_free_hdmx_stub,
-#endif
+    tt_face_load_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+    tt_face_free_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
     tt_face_load_kern,
     tt_face_load_gasp,
     tt_face_load_pclt,
 
 
     tt_face_load_kern,
     tt_face_load_gasp,
     tt_face_load_pclt,
 
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
     /* see `ttload.h' */
     /* see `ttload.h' */
-    tt_face_load_bhed,
-#else
-    0,
-#endif
+    PUT_EMBEDDED_BITMAPS(tt_face_load_bhed),
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    tt_face_set_sbit_strike_stub,
-    tt_face_load_sbit_stub,
+    tt_face_set_sbit_strike_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+    tt_face_load_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
-    tt_find_sbit_image,
-    tt_load_sbit_metrics,
-#endif
+    tt_find_sbit_image, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+    tt_load_sbit_metrics, /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-    tt_face_load_sbit_image,
-#else
-    0,
-#endif
+    PUT_EMBEDDED_BITMAPS(tt_face_load_sbit_image),
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    tt_face_free_sbit_stub,
-#endif
+    tt_face_free_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
     /* see `ttpost.h' */
     /* see `ttpost.h' */
-    tt_face_get_ps_name,
-    tt_face_free_ps_names,
-#else
-    0,
-    0,
-#endif
+    PUT_PS_NAMES(tt_face_get_ps_name),
+    PUT_PS_NAMES(tt_face_free_ps_names),
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    tt_face_load_charmap_stub,
-    tt_face_free_charmap_stub,
-#endif
+    tt_face_load_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+    tt_face_free_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
     /* since version 2.1.8 */
 
 
     /* since version 2.1.8 */
 
     tt_face_load_font_dir,
     tt_face_load_hmtx,
 
     tt_face_load_font_dir,
     tt_face_load_hmtx,
 
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
     /* see `ttsbit.h' and `sfnt.h' */
     /* see `ttsbit.h' and `sfnt.h' */
-    tt_face_load_eblc,
-    tt_face_free_eblc,
+    PUT_EMBEDDED_BITMAPS(tt_face_load_eblc),
+    PUT_EMBEDDED_BITMAPS(tt_face_free_eblc),
 
 
-    tt_face_set_sbit_strike,
-    tt_face_load_strike_metrics,
-#else
-    0,
-    0,
-    0,
-    0,
-#endif
+    PUT_EMBEDDED_BITMAPS(tt_face_set_sbit_strike),
+    PUT_EMBEDDED_BITMAPS(tt_face_load_strike_metrics),
 
     tt_face_get_metrics
 
     tt_face_get_metrics
-  };
+  )
 
 
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Module_Class  sfnt_module_class =
-  {
+  FT_DEFINE_MODULE(sfnt_module_class,
+  
     0,  /* not a font driver or renderer */
     sizeof( FT_ModuleRec ),
 
     0,  /* not a font driver or renderer */
     sizeof( FT_ModuleRec ),
 
     0x10000L,   /* driver version 1.0                     */
     0x20000L,   /* driver requires FreeType 2.0 or higher */
 
     0x10000L,   /* driver version 1.0                     */
     0x20000L,   /* driver requires FreeType 2.0 or higher */
 
-    (const void*)&sfnt_interface,  /* module specific interface */
+    (const void*)&FT_SFNT_INTERFACE_GET,  /* module specific interface */
 
     (FT_Module_Constructor)0,
     (FT_Module_Destructor) 0,
     (FT_Module_Requester)  sfnt_get_interface
 
     (FT_Module_Constructor)0,
     (FT_Module_Destructor) 0,
     (FT_Module_Requester)  sfnt_get_interface
-  };
+  )
 
 
 /* END */
 
 
 /* END */
index 92db796..5de25d5 100644 (file)
@@ -27,7 +27,7 @@
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
 
-  FT_EXPORT_VAR( const FT_Module_Class )  sfnt_module_class;
+  FT_DECLARE_MODULE( sfnt_module_class )
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
index 45a820b..fc507b4 100644 (file)
@@ -19,6 +19,7 @@
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
+#include "sfntpic.c"
 #include "ttload.c"
 #include "ttmtx.c"
 #include "ttcmap.c"
 #include "ttload.c"
 #include "ttmtx.c"
 #include "ttcmap.c"
diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.c b/reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.c
new file mode 100644 (file)
index 0000000..fd3cf4e
--- /dev/null
@@ -0,0 +1,101 @@
+/***************************************************************************/
+/*                                                                         */
+/*  sfntpic.c                                                              */
+/*                                                                         */
+/*    The FreeType position independent code services for sfnt module.     */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "sfntpic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from sfdriver.c */
+  FT_Error FT_Create_Class_sfnt_services( FT_Library, FT_ServiceDescRec**);
+  void FT_Destroy_Class_sfnt_services( FT_Library, FT_ServiceDescRec*);
+  void FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec*);
+  void FT_Init_Class_sfnt_interface( FT_Library, SFNT_Interface*);
+  void FT_Init_Class_sfnt_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*);
+  void FT_Init_Class_sfnt_service_ps_name( FT_Library, FT_Service_PsFontNameRec*);
+  void FT_Init_Class_tt_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*);
+  void FT_Init_Class_sfnt_service_sfnt_table( FT_Service_SFNT_TableRec*);
+
+  /* forward declaration of PIC init functions from ttcmap.c */
+  FT_Error FT_Create_Class_tt_cmap_classes( FT_Library, TT_CMap_Class**);
+  void FT_Destroy_Class_tt_cmap_classes( FT_Library, TT_CMap_Class*);
+
+  void
+  sfnt_module_class_pic_free(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory memory = library->memory;
+    if ( pic_container->sfnt )
+    {
+      sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt;
+      if(container->sfnt_services)
+        FT_Destroy_Class_sfnt_services(library, container->sfnt_services);
+      container->sfnt_services = NULL;
+      if(container->tt_cmap_classes)
+        FT_Destroy_Class_tt_cmap_classes(library, container->tt_cmap_classes);
+      container->tt_cmap_classes = NULL;
+      FT_FREE( container );
+      pic_container->sfnt = NULL;
+    }
+  }
+
+
+  FT_Error
+  sfnt_module_class_pic_init(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    sfntModulePIC* container;
+    FT_Memory memory = library->memory;
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->sfnt = container;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    error = FT_Create_Class_sfnt_services(library, &container->sfnt_services);
+    if(error) 
+      goto Exit;
+    error = FT_Create_Class_tt_cmap_classes(library, &container->tt_cmap_classes);
+    if(error) 
+      goto Exit;
+    FT_Init_Class_sfnt_service_glyph_dict(library, &container->sfnt_service_glyph_dict);
+    FT_Init_Class_sfnt_service_ps_name(library, &container->sfnt_service_ps_name);
+    FT_Init_Class_tt_service_get_cmap_info(library, &container->tt_service_get_cmap_info);
+    FT_Init_Class_sfnt_service_sfnt_table(&container->sfnt_service_sfnt_table);
+#ifdef TT_CONFIG_OPTION_BDF
+    FT_Init_Class_sfnt_service_bdf(&container->sfnt_service_bdf);
+#endif
+    FT_Init_Class_sfnt_interface(library, &container->sfnt_interface);
+
+Exit:
+    if(error)
+      sfnt_module_class_pic_free(library);
+    return error;
+  }
+
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.h b/reactos/lib/3rdparty/freetype/src/sfnt/sfntpic.h
new file mode 100644 (file)
index 0000000..6943b42
--- /dev/null
@@ -0,0 +1,88 @@
+/***************************************************************************/
+/*                                                                         */
+/*  sfntpic.h                                                              */
+/*                                                                         */
+/*    The FreeType position independent code services for sfnt module.     */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __SFNTPIC_H__
+#define __SFNTPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+ #ifndef FT_CONFIG_OPTION_PIC
+#define FT_SFNT_SERVICES_GET             sfnt_services
+#define FT_SFNT_SERVICE_GLYPH_DICT_GET   sfnt_service_glyph_dict
+#define FT_SFNT_SERVICE_PS_NAME_GET      sfnt_service_ps_name
+#define FT_TT_SERVICE_GET_CMAP_INFO_GET  tt_service_get_cmap_info
+#define FT_SFNT_SERVICES_GET             sfnt_services
+#define FT_TT_CMAP_CLASSES_GET           tt_cmap_classes
+#define FT_SFNT_SERVICE_SFNT_TABLE_GET   sfnt_service_sfnt_table
+#define FT_SFNT_SERVICE_BDF_GET          sfnt_service_bdf
+#define FT_SFNT_INTERFACE_GET            sfnt_interface
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+/* some include files required for members of sfntModulePIC */
+#include FT_SERVICE_GLYPH_DICT_H
+#include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_SFNT_H
+#include FT_SERVICE_TT_CMAP_H
+#ifdef TT_CONFIG_OPTION_BDF
+#include "ttbdf.h"
+#include FT_SERVICE_BDF_H
+#endif
+#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_STREAM_H
+#include FT_INTERNAL_SFNT_H
+#include "ttcmap.h"
+
+typedef struct sfntModulePIC_
+  {
+    FT_ServiceDescRec* sfnt_services;
+    FT_Service_GlyphDictRec sfnt_service_glyph_dict;
+    FT_Service_PsFontNameRec  sfnt_service_ps_name;
+    FT_Service_TTCMapsRec  tt_service_get_cmap_info;
+    TT_CMap_Class* tt_cmap_classes;
+    FT_Service_SFNT_TableRec sfnt_service_sfnt_table;
+#ifdef TT_CONFIG_OPTION_BDF
+    FT_Service_BDFRec sfnt_service_bdf;
+#endif
+    SFNT_Interface sfnt_interface;
+  } sfntModulePIC;
+
+#define GET_PIC(lib)                      ((sfntModulePIC*)((lib)->pic_container.sfnt))
+#define FT_SFNT_SERVICES_GET              (GET_PIC(library)->sfnt_services)
+#define FT_SFNT_SERVICE_GLYPH_DICT_GET    (GET_PIC(library)->sfnt_service_glyph_dict)
+#define FT_SFNT_SERVICE_PS_NAME_GET       (GET_PIC(library)->sfnt_service_ps_name)
+#define FT_TT_SERVICE_GET_CMAP_INFO_GET   (GET_PIC(library)->tt_service_get_cmap_info)
+#define FT_SFNT_SERVICES_GET              (GET_PIC(library)->sfnt_services)
+#define FT_TT_CMAP_CLASSES_GET            (GET_PIC(library)->tt_cmap_classes)
+#define FT_SFNT_SERVICE_SFNT_TABLE_GET    (GET_PIC(library)->sfnt_service_sfnt_table)
+#define FT_SFNT_SERVICE_BDF_GET           (GET_PIC(library)->sfnt_service_bdf)
+#define FT_SFNT_INTERFACE_GET             (GET_PIC(library)->sfnt_interface)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+/* */
+
+FT_END_HEADER
+
+#endif /* __SFNTPIC_H__ */
+
+
+/* END */
index cc90110..cef3cd9 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    SFNT object management (base).                                       */
 /*                                                                         */
 /*                                                                         */
 /*    SFNT object management (base).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   /*                                                                       */
   /*    nameid :: The name id of the name record to return.                */
   /*                                                                       */
   /*                                                                       */
   /*    nameid :: The name id of the name record to return.                */
   /*                                                                       */
+  /* <InOut>                                                               */
+  /*    name   :: The address of a string pointer.  NULL if no name is     */
+  /*              present.                                                 */
+  /*                                                                       */
   /* <Return>                                                              */
   /* <Return>                                                              */
-  /*    Character string.  NULL if no name is present.                     */
+  /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   /*                                                                       */
-  static FT_String*
-  tt_face_get_name( TT_Face    face,
-                    FT_UShort  nameid )
+  static FT_Error
+  tt_face_get_name( TT_Face      face,
+                    FT_UShort    nameid,
+                    FT_String**  name )
   {
     FT_Memory         memory = face->root.memory;
   {
     FT_Memory         memory = face->root.memory;
+    FT_Error          error  = SFNT_Err_Ok;
     FT_String*        result = NULL;
     FT_UShort         n;
     TT_NameEntryRec*  rec;
     FT_String*        result = NULL;
     FT_UShort         n;
     TT_NameEntryRec*  rec;
     TT_NameEntry_ConvertFunc  convert;
 
 
     TT_NameEntry_ConvertFunc  convert;
 
 
+    FT_ASSERT( name );
+
     rec = face->name_table.names;
     for ( n = 0; n < face->num_names; n++, rec++ )
     {
     rec = face->name_table.names;
     for ( n = 0; n < face->num_names; n++, rec++ )
     {
     {
       if ( rec->string == NULL )
       {
     {
       if ( rec->string == NULL )
       {
-        FT_Error   error  = SFNT_Err_Ok;
         FT_Stream  stream = face->name_table.stream;
 
         FT_Stream  stream = face->name_table.stream;
 
-        FT_UNUSED( error );
-
 
         if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||
              FT_STREAM_SEEK( rec->stringOffset )              ||
 
         if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||
              FT_STREAM_SEEK( rec->stringOffset )              ||
     }
 
   Exit:
     }
 
   Exit:
-    return result;
+    *name = result;
+    return error;
   }
 
 
   }
 
 
   sfnt_find_encoding( int  platform_id,
                       int  encoding_id )
   {
   sfnt_find_encoding( int  platform_id,
                       int  encoding_id )
   {
-    typedef struct  TEncoding
+    typedef struct  TEncoding_
     {
       int          platform_id;
       int          encoding_id;
     {
       int          platform_id;
       int          encoding_id;
     if ( FT_READ_ULONG( tag ) )
       return error;
 
     if ( FT_READ_ULONG( tag ) )
       return error;
 
-    if ( tag != 0x00010000UL                      &&
-         tag != TTAG_ttcf                         &&
-         tag != FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) &&
-         tag != TTAG_true                         &&
-         tag != 0x00020000UL                      )
+    if ( tag != 0x00010000UL &&
+         tag != TTAG_ttcf    &&
+         tag != TTAG_OTTO    &&
+         tag != TTAG_true    &&
+         tag != TTAG_typ1    &&
+         tag != 0x00020000UL )
       return SFNT_Err_Unknown_File_Format;
 
     face->ttc_header.tag = TTAG_ttcf;
       return SFNT_Err_Unknown_File_Format;
 
     face->ttc_header.tag = TTAG_ttcf;
       face->ttc_header.version = 1 << 16;
       face->ttc_header.count   = 1;
 
       face->ttc_header.version = 1 << 16;
       face->ttc_header.count   = 1;
 
-      if ( FT_NEW( face->ttc_header.offsets) )
+      if ( FT_NEW( face->ttc_header.offsets ) )
         return error;
 
       face->ttc_header.offsets[0] = offset;
         return error;
 
       face->ttc_header.offsets[0] = offset;
       face_index = 0;
 
     if ( face_index >= face->ttc_header.count )
       face_index = 0;
 
     if ( face_index >= face->ttc_header.count )
-        return SFNT_Err_Bad_Argument;
+      return SFNT_Err_Invalid_Argument;
 
     if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )
       return error;
 
     if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )
       return error;
     if ( error )
       return error;
 
     if ( error )
       return error;
 
-    face->root.num_faces = face->ttc_header.count;
+    face->root.num_faces  = face->ttc_header.count;
+    face->root.face_index = face_index;
 
     return error;
   }
 
     return error;
   }
     FT_TRACE3(( "\n" ));                                      \
   } while ( 0 )
 
     FT_TRACE3(( "\n" ));                                      \
   } while ( 0 )
 
+#define GET_NAME( id, field )                                 \
+  do {                                                        \
+    error = tt_face_get_name( face, TT_NAME_ID_##id, field ); \
+    if ( error )                                              \
+      goto Exit;                                              \
+  } while ( 0 )
+
 
   FT_LOCAL_DEF( FT_Error )
   sfnt_load_face( FT_Stream      stream,
 
   FT_LOCAL_DEF( FT_Error )
   sfnt_load_face( FT_Stream      stream,
                   FT_Int         num_params,
                   FT_Parameter*  params )
   {
                   FT_Int         num_params,
                   FT_Parameter*  params )
   {
-    FT_Error      error, psnames_error;
+    FT_Error      error;
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+    FT_Error      psnames_error;
+#endif
     FT_Bool       has_outline;
     FT_Bool       is_apple_sbit;
 
     FT_Bool       has_outline;
     FT_Bool       is_apple_sbit;
 
     /* don't check for errors                            */
     LOAD_( name );
     LOAD_( post );
     /* don't check for errors                            */
     LOAD_( name );
     LOAD_( post );
+
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
     psnames_error = error;
     psnames_error = error;
+#endif
 
     /* do not load the metrics headers and tables if this is an Apple */
     /* sbit font file                                                 */
 
     /* do not load the metrics headers and tables if this is an Apple */
     /* sbit font file                                                 */
 
         face->os2.version = 0xFFFFU;
       }
 
         face->os2.version = 0xFFFFU;
       }
-
     }
 
     /* the optional tables */
 
     }
 
     /* the optional tables */
 
-    /* embedded bitmap support. */
+    /* embedded bitmap support */
     if ( sfnt->load_eblc )
     {
       LOAD_( eblc );
       if ( error )
       {
     if ( sfnt->load_eblc )
     {
       LOAD_( eblc );
       if ( error )
       {
-        /* return an error if this font file has no outlines */
-        if ( error == SFNT_Err_Table_Missing && has_outline )
+        /* a font which contains neither bitmaps nor outlines is */
+        /* still valid (although rather useless in most cases);  */
+        /* however, you can find such stripped fonts in PDFs     */
+        if ( error == SFNT_Err_Table_Missing )
           error = SFNT_Err_Ok;
         else
           goto Exit;
           error = SFNT_Err_Ok;
         else
           goto Exit;
     LOAD_( gasp );
     LOAD_( kern );
 
     LOAD_( gasp );
     LOAD_( kern );
 
-    error = SFNT_Err_Ok;
-
     face->root.num_glyphs = face->max_profile.numGlyphs;
 
     face->root.num_glyphs = face->max_profile.numGlyphs;
 
-    face->root.family_name = tt_face_get_name( face,
-                                               TT_NAME_ID_PREFERRED_FAMILY );
-    if ( !face->root.family_name )
-      face->root.family_name = tt_face_get_name( face,
-                                                 TT_NAME_ID_FONT_FAMILY );
+    /* Bit 8 of the `fsSelection' field in the `OS/2' table denotes  */
+    /* a WWS-only font face.  `WWS' stands for `weight', width', and */
+    /* `slope', a term used by Microsoft's Windows Presentation      */
+    /* Foundation (WPF).  This flag has been introduced in version   */
+    /* 1.5 of the OpenType specification (May 2008).                 */
 
 
-    face->root.style_name = tt_face_get_name( face,
-                                              TT_NAME_ID_PREFERRED_SUBFAMILY );
-    if ( !face->root.style_name )
-      face->root.style_name  = tt_face_get_name( face,
-                                                 TT_NAME_ID_FONT_SUBFAMILY );
+    if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
+    {
+      GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
+      if ( !face->root.family_name )
+        GET_NAME( FONT_FAMILY, &face->root.family_name );
+
+      GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
+      if ( !face->root.style_name )
+        GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
+    }
+    else
+    {
+      GET_NAME( WWS_FAMILY, &face->root.family_name );
+      if ( !face->root.family_name )
+        GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
+      if ( !face->root.family_name )
+        GET_NAME( FONT_FAMILY, &face->root.family_name );
+
+      GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
+      if ( !face->root.style_name )
+        GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
+      if ( !face->root.style_name )
+        GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
+    }
 
     /* now set up root fields */
     {
 
     /* now set up root fields */
     {
-      FT_Face    root = &face->root;
-      FT_Int32   flags = root->face_flags;
+      FT_Face  root  = &face->root;
+      FT_Long  flags = root->face_flags;
 
 
       /*********************************************************************/
 
 
       /*********************************************************************/
                FT_FACE_FLAG_HORIZONTAL;   /* horizontal data   */
 
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
                FT_FACE_FLAG_HORIZONTAL;   /* horizontal data   */
 
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-      if ( psnames_error == SFNT_Err_Ok &&
+      if ( psnames_error == SFNT_Err_Ok               &&
            face->postscript.FormatType != 0x00030000L )
         flags |= FT_FACE_FLAG_GLYPH_NAMES;
 #endif
            face->postscript.FormatType != 0x00030000L )
         flags |= FT_FACE_FLAG_GLYPH_NAMES;
 #endif
       /*                                                                   */
       /* Compute style flags.                                              */
       /*                                                                   */
       /*                                                                   */
       /* Compute style flags.                                              */
       /*                                                                   */
+
       flags = 0;
       if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
       {
       flags = 0;
       if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
       {
-        /* we have an OS/2 table; use the `fsSelection' field */
-        if ( face->os2.fsSelection & 1 )
+        /* We have an OS/2 table; use the `fsSelection' field.  Bit 9 */
+        /* indicates an oblique font face.  This flag has been        */
+        /* introduced in version 1.5 of the OpenType specification.   */
+
+        if ( face->os2.fsSelection & 512 )       /* bit 9 */
+          flags |= FT_STYLE_FLAG_ITALIC;
+        else if ( face->os2.fsSelection & 1 )    /* bit 0 */
           flags |= FT_STYLE_FLAG_ITALIC;
 
           flags |= FT_STYLE_FLAG_ITALIC;
 
-        if ( face->os2.fsSelection & 32 )
+        if ( face->os2.fsSelection & 32 )        /* bit 5 */
           flags |= FT_STYLE_FLAG_BOLD;
       }
       else
       {
         /* this is an old Mac font, use the header field */
           flags |= FT_STYLE_FLAG_BOLD;
       }
       else
       {
         /* this is an old Mac font, use the header field */
+
         if ( face->header.Mac_Style & 1 )
           flags |= FT_STYLE_FLAG_BOLD;
 
         if ( face->header.Mac_Style & 1 )
           flags |= FT_STYLE_FLAG_BOLD;
 
         }
       }
 
         }
       }
 
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+      /*
+       *  Now allocate the root array of FT_Bitmap_Size records and
+       *  populate them.  Unfortunately, it isn't possible to indicate bit
+       *  depths in the FT_Bitmap_Size record.  This is a design error.
+       */
+      {
+        FT_UInt  i, count;
+
+
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
+        count = face->sbit_num_strikes;
+#else
+        count = (FT_UInt)face->num_sbit_strikes;
+#endif
+
+        if ( count > 0 )
+        {
+          FT_Memory        memory   = face->root.stream->memory;
+          FT_UShort        em_size  = face->header.Units_Per_EM;
+          FT_Short         avgwidth = face->os2.xAvgCharWidth;
+          FT_Size_Metrics  metrics;
+
+
+          if ( em_size == 0 || face->os2.version == 0xFFFFU )
+          {
+            avgwidth = 0;
+            em_size = 1;
+          }
+
+          if ( FT_NEW_ARRAY( root->available_sizes, count ) )
+            goto Exit;
+
+          for ( i = 0; i < count; i++ )
+          {
+            FT_Bitmap_Size*  bsize = root->available_sizes + i;
+
+
+            error = sfnt->load_strike_metrics( face, i, &metrics );
+            if ( error )
+              goto Exit;
+
+            bsize->height = (FT_Short)( metrics.height >> 6 );
+            bsize->width = (FT_Short)(
+                ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
+
+            bsize->x_ppem = metrics.x_ppem << 6;
+            bsize->y_ppem = metrics.y_ppem << 6;
+
+            /* assume 72dpi */
+            bsize->size   = metrics.y_ppem << 6;
+          }
+
+          root->face_flags     |= FT_FACE_FLAG_FIXED_SIZES;
+          root->num_fixed_sizes = (FT_Int)count;
+        }
+      }
+
+#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+
+      /* a font with no bitmaps and no outlines is scalable; */
+      /* it has only empty glyphs then                       */
+      if ( !FT_HAS_FIXED_SIZES( root ) && !FT_IS_SCALABLE( root ) )
+        root->face_flags |= FT_FACE_FLAG_SCALABLE;
+
 
       /*********************************************************************/
       /*                                                                   */
       /*  Set up metrics.                                                  */
       /*                                                                   */
 
       /*********************************************************************/
       /*                                                                   */
       /*  Set up metrics.                                                  */
       /*                                                                   */
-      if ( has_outline == TRUE )
+      if ( FT_IS_SCALABLE( root ) )
       {
         /* XXX What about if outline header is missing */
         /*     (e.g. sfnt wrapped bitmap)?             */
       {
         /* XXX What about if outline header is missing */
         /*     (e.g. sfnt wrapped bitmap)?             */
         /* this computation is based on various versions of Times New Roman */
         if ( face->horizontal.Line_Gap == 0 )
           root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 );
         /* this computation is based on various versions of Times New Roman */
         if ( face->horizontal.Line_Gap == 0 )
           root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 );
-#endif
+#endif /* 0 */
 
 #if 0
 
 #if 0
-
         /* some fonts have the OS/2 "sTypoAscender", "sTypoDescender" & */
         /* "sTypoLineGap" fields set to 0, like ARIALNB.TTF             */
         if ( face->os2.version != 0xFFFFU && root->ascender )
         /* some fonts have the OS/2 "sTypoAscender", "sTypoDescender" & */
         /* "sTypoLineGap" fields set to 0, like ARIALNB.TTF             */
         if ( face->os2.version != 0xFFFFU && root->ascender )
           if ( height > root->height )
             root->height = height;
         }
           if ( height > root->height )
             root->height = height;
         }
-
 #endif /* 0 */
 
 #endif /* 0 */
 
-        root->max_advance_width   = face->horizontal.advance_Width_Max;
-
-        root->max_advance_height  = (FT_Short)( face->vertical_info
-                                      ? face->vertical.advance_Height_Max
-                                      : root->height );
+        root->max_advance_width  = face->horizontal.advance_Width_Max;
+        root->max_advance_height = (FT_Short)( face->vertical_info
+                                     ? face->vertical.advance_Height_Max
+                                     : root->height );
 
 
-        root->underline_position  = face->postscript.underlinePosition;
+        /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */
+        /* Adjust underline position from top edge to centre of     */
+        /* stroke to convert TrueType meaning to FreeType meaning.  */
+        root->underline_position  = face->postscript.underlinePosition -
+                                    face->postscript.underlineThickness / 2;
         root->underline_thickness = face->postscript.underlineThickness;
       }
 
         root->underline_thickness = face->postscript.underlineThickness;
       }
 
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
-      /*
-       *  Now allocate the root array of FT_Bitmap_Size records and
-       *  populate them.  Unfortunately, it isn't possible to indicate bit
-       *  depths in the FT_Bitmap_Size record.  This is a design error.
-       */
-      {
-        FT_UInt  i, count;
-
-
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
-        count = face->sbit_num_strikes;
-#else
-        count = (FT_UInt)face->num_sbit_strikes;
-#endif
-
-        if ( count > 0 )
-        {
-          FT_Memory        memory   = face->root.stream->memory;
-          FT_UShort        em_size  = face->header.Units_Per_EM;
-          FT_Short         avgwidth = face->os2.xAvgCharWidth;
-          FT_Size_Metrics  metrics;
-
-
-          if ( em_size == 0 || face->os2.version == 0xFFFFU )
-          {
-            avgwidth = 0;
-            em_size = 1;
-          }
-
-          if ( FT_NEW_ARRAY( root->available_sizes, count ) )
-            goto Exit;
-
-          for ( i = 0; i < count; i++ )
-          {
-            FT_Bitmap_Size*  bsize = root->available_sizes + i;
-
-
-            error = sfnt->load_strike_metrics( face, i, &metrics );
-            if ( error )
-              goto Exit;
-
-            bsize->height = (FT_Short)( metrics.height >> 6 );
-            bsize->width = (FT_Short)(
-                ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
-
-            bsize->x_ppem = metrics.x_ppem << 6;
-            bsize->y_ppem = metrics.y_ppem << 6;
-
-            /* assume 72dpi */
-            bsize->size   = metrics.y_ppem << 6;
-          }
-
-          root->face_flags     |= FT_FACE_FLAG_FIXED_SIZES;
-          root->num_fixed_sizes = (FT_Int)count;
-        }
-      }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
     }
 
   Exit:
     }
 
   Exit:
 
 #undef LOAD_
 #undef LOADM_
 
 #undef LOAD_
 #undef LOADM_
+#undef GET_NAME
 
 
   FT_LOCAL_DEF( void )
   sfnt_done_face( TT_Face  face )
   {
 
 
   FT_LOCAL_DEF( void )
   sfnt_done_face( TT_Face  face )
   {
-    FT_Memory     memory = face->root.memory;
-    SFNT_Service  sfnt   = (SFNT_Service)face->sfnt;
+    FT_Memory     memory;
+    SFNT_Service  sfnt;
+
 
 
+    if ( !face )
+      return;
+
+    memory = face->root.memory;
+    sfnt   = (SFNT_Service)face->sfnt;
 
     if ( sfnt )
     {
 
     if ( sfnt )
     {
     }
 
     /* freeing the horizontal metrics */
     }
 
     /* freeing the horizontal metrics */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
     {
       FT_Stream  stream = FT_FACE_STREAM( face );
 
     {
       FT_Stream  stream = FT_FACE_STREAM( face );
 
     face->gasp.numRanges = 0;
 
     /* freeing the name table */
     face->gasp.numRanges = 0;
 
     /* freeing the name table */
-    sfnt->free_name( face );
+    if ( sfnt )
+      sfnt->free_name( face );
 
     /* freeing family and style name */
     FT_FREE( face->root.family_name );
 
     /* freeing family and style name */
     FT_FREE( face->root.family_name );
index 6c95387..206cece 100644 (file)
@@ -84,7 +84,7 @@
       FT_Byte*   p           = bdf->table;
       FT_UInt    version     = FT_NEXT_USHORT( p );
       FT_UInt    num_strikes = FT_NEXT_USHORT( p );
       FT_Byte*   p           = bdf->table;
       FT_UInt    version     = FT_NEXT_USHORT( p );
       FT_UInt    num_strikes = FT_NEXT_USHORT( p );
-      FT_UInt32  strings     = FT_NEXT_ULONG ( p );
+      FT_ULong   strings     = FT_NEXT_ULONG ( p );
       FT_UInt    count;
       FT_Byte*   strike;
 
       FT_UInt    count;
       FT_Byte*   strike;
 
                          const char*       property_name,
                          BDF_PropertyRec  *aprop )
   {
                          const char*       property_name,
                          BDF_PropertyRec  *aprop )
   {
-    TT_BDF    bdf   = &face->bdf;
-    FT_Size   size  = FT_FACE(face)->size;
-    FT_Error  error = 0;
-    FT_Byte*  p;
-    FT_UInt   count;
-    FT_Byte*  strike;
-    FT_UInt   property_len;
+    TT_BDF     bdf   = &face->bdf;
+    FT_Size    size  = FT_FACE(face)->size;
+    FT_Error   error = 0;
+    FT_Byte*   p;
+    FT_UInt    count;
+    FT_Byte*   strike;
+    FT_Offset  property_len;
 
 
     aprop->type = BDF_PROPERTY_TYPE_NONE;
 
 
     aprop->type = BDF_PROPERTY_TYPE_NONE;
index 2da4336..26ea83c 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType character mapping table (cmap) support (body).              */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType character mapping table (cmap) support (body).              */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007 by                        */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by            */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -25,6 +25,7 @@
 #include FT_INTERNAL_STREAM_H
 #include "ttload.h"
 #include "ttcmap.h"
 #include FT_INTERNAL_STREAM_H
 #include "ttload.h"
 #include "ttcmap.h"
+#include "sfntpic.h"
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
 
 #define TT_PEEK_SHORT   FT_PEEK_SHORT
 #define TT_PEEK_USHORT  FT_PEEK_USHORT
 
 #define TT_PEEK_SHORT   FT_PEEK_SHORT
 #define TT_PEEK_USHORT  FT_PEEK_USHORT
+#define TT_PEEK_UINT24  FT_PEEK_UOFF3
 #define TT_PEEK_LONG    FT_PEEK_LONG
 #define TT_PEEK_ULONG   FT_PEEK_ULONG
 
 #define TT_NEXT_SHORT   FT_NEXT_SHORT
 #define TT_NEXT_USHORT  FT_NEXT_USHORT
 #define TT_PEEK_LONG    FT_PEEK_LONG
 #define TT_PEEK_ULONG   FT_PEEK_ULONG
 
 #define TT_NEXT_SHORT   FT_NEXT_SHORT
 #define TT_NEXT_USHORT  FT_NEXT_USHORT
+#define TT_NEXT_UINT24  FT_NEXT_UOFF3
 #define TT_NEXT_LONG    FT_NEXT_LONG
 #define TT_NEXT_ULONG   FT_NEXT_ULONG
 
 #define TT_NEXT_LONG    FT_NEXT_LONG
 #define TT_NEXT_ULONG   FT_NEXT_ULONG
 
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap0_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
   tt_cmap0_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
     FT_UInt    gindex   = 0;
 
 
     FT_UInt    gindex   = 0;
 
 
-    table += 6;  /* go to glyph ids */
+    table += 6;  /* go to glyph IDs */
     while ( ++charcode < 256 )
     {
       gindex = table[charcode];
     while ( ++charcode < 256 )
     {
       gindex = table[charcode];
     FT_Byte*  p = cmap->data + 4;
 
 
     FT_Byte*  p = cmap->data + 4;
 
 
-    cmap_info->format = 0;
+    cmap_info->format   = 0;
     cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
 
     return SFNT_Err_Ok;
   }
 
 
     cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
 
     return SFNT_Err_Ok;
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const TT_CMap_ClassRec  tt_cmap0_class_rec =
-  {
-    {
+  FT_DEFINE_TT_CMAP(tt_cmap0_class_rec,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap0_char_index,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap0_char_index,
-      (FT_CMap_CharNextFunc) tt_cmap0_char_next
-    },
+      (FT_CMap_CharNextFunc) tt_cmap0_char_next,
+
+      NULL, NULL, NULL, NULL, NULL
+    ,
     0,
     (TT_CMap_ValidateFunc)   tt_cmap0_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap0_get_info
     0,
     (TT_CMap_ValidateFunc)   tt_cmap0_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap0_get_info
-  };
+  )
 
 #endif /* TT_CONFIG_CMAP_FORMAT_0 */
 
 
 #endif /* TT_CONFIG_CMAP_FORMAT_0 */
 
   /*   language    4              USHORT          Mac language code        */
   /*   keys        6              USHORT[256]     sub-header keys          */
   /*   subs        518            SUBHEAD[NSUBS]  sub-headers array        */
   /*   language    4              USHORT          Mac language code        */
   /*   keys        6              USHORT[256]     sub-header keys          */
   /*   subs        518            SUBHEAD[NSUBS]  sub-headers array        */
-  /*   glyph_ids   518+NSUB*8     USHORT[]        glyph id array           */
+  /*   glyph_ids   518+NSUB*8     USHORT[]        glyph ID array           */
   /*                                                                       */
   /* The `keys' table is used to map charcode high-bytes to sub-headers.   */
   /* The value of `NSUBS' is the number of sub-headers defined in the      */
   /*                                                                       */
   /* The `keys' table is used to map charcode high-bytes to sub-headers.   */
   /* The value of `NSUBS' is the number of sub-headers defined in the      */
   /*                                                                       */
   /* * The value of `offset' is read.  This is a _byte_ distance from the  */
   /*   location of the `offset' field itself into a slice of the           */
   /*                                                                       */
   /* * The value of `offset' is read.  This is a _byte_ distance from the  */
   /*   location of the `offset' field itself into a slice of the           */
-  /*   `glyph_ids' table.  Let's call it `slice' (it's a USHORT[] too).    */
+  /*   `glyph_ids' table.  Let's call it `slice' (it is a USHORT[] too).   */
   /*                                                                       */
   /* * The value `slice[char.lo - first]' is read.  If it is 0, there is   */
   /*   no glyph for the charcode.  Otherwise, the value of `delta' is      */
   /*   added to it (modulo 65536) to form a new glyph index.               */
   /*                                                                       */
   /* It is up to the validation routine to check that all offsets fall     */
   /*                                                                       */
   /* * The value `slice[char.lo - first]' is read.  If it is 0, there is   */
   /*   no glyph for the charcode.  Otherwise, the value of `delta' is      */
   /*   added to it (modulo 65536) to form a new glyph index.               */
   /*                                                                       */
   /* It is up to the validation routine to check that all offsets fall     */
-  /* within the glyph ids table (and not within the `subs' table itself or */
+  /* within the glyph IDs table (and not within the `subs' table itself or */
   /* outside of the CMap).                                                 */
   /*                                                                       */
 
   /* outside of the CMap).                                                 */
   /*                                                                       */
 
     FT_UInt   n, max_subs;
     FT_Byte*  keys;                         /* keys table */
     FT_Byte*  subs;                         /* sub-headers */
     FT_UInt   n, max_subs;
     FT_Byte*  keys;                         /* keys table */
     FT_Byte*  subs;                         /* sub-headers */
-    FT_Byte*  glyph_ids;                    /* glyph id array */
+    FT_Byte*  glyph_ids;                    /* glyph ID array */
 
 
     if ( table + length > valid->limit || length < 6 + 512 )
 
 
     if ( table + length > valid->limit || length < 6 + 512 )
       delta      = TT_NEXT_SHORT( p );
       offset     = TT_NEXT_USHORT( p );
 
       delta      = TT_NEXT_SHORT( p );
       offset     = TT_NEXT_USHORT( p );
 
+      /* many Dynalab fonts have empty sub-headers */
+      if ( code_count == 0 )
+        continue;
+
       /* check range within 0..255 */
       if ( valid->level >= FT_VALIDATE_PARANOID )
       {
       /* check range within 0..255 */
       if ( valid->level >= FT_VALIDATE_PARANOID )
       {
         if ( ids < glyph_ids || ids + code_count*2 > table + length )
           FT_INVALID_OFFSET;
 
         if ( ids < glyph_ids || ids + code_count*2 > table + length )
           FT_INVALID_OFFSET;
 
-        /* check glyph ids */
+        /* check glyph IDs */
         if ( valid->level >= FT_VALIDATE_TIGHT )
         {
           FT_Byte*  limit = p + code_count * 2;
         if ( valid->level >= FT_VALIDATE_TIGHT )
         {
           FT_Byte*  limit = p + code_count * 2;
         sub = subs;  /* jump to first sub-header */
 
         /* check that the sub-header for this byte is 0, which */
         sub = subs;  /* jump to first sub-header */
 
         /* check that the sub-header for this byte is 0, which */
-        /* indicates that it's really a valid one-byte value   */
+        /* indicates that it is really a valid one-byte value  */
         /* Otherwise, return 0                                 */
         /*                                                     */
         p += char_lo * 2;
         /* Otherwise, return 0                                 */
         /*                                                     */
         p += char_lo * 2;
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap2_char_next( TT_CMap     cmap,
                       FT_UInt32  *pcharcode )
   {
   tt_cmap2_char_next( TT_CMap     cmap,
                       FT_UInt32  *pcharcode )
   {
     FT_Byte*  p = cmap->data + 4;
 
 
     FT_Byte*  p = cmap->data + 4;
 
 
-    cmap_info->format = 2;
+    cmap_info->format   = 2;
     cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
 
     return SFNT_Err_Ok;
   }
 
 
     cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
 
     return SFNT_Err_Ok;
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const TT_CMap_ClassRec  tt_cmap2_class_rec =
-  {
-    {
+  FT_DEFINE_TT_CMAP(tt_cmap2_class_rec,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap2_char_index,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap2_char_index,
-      (FT_CMap_CharNextFunc) tt_cmap2_char_next
-    },
+      (FT_CMap_CharNextFunc) tt_cmap2_char_next,
+
+      NULL, NULL, NULL, NULL, NULL
+    ,
     2,
     (TT_CMap_ValidateFunc)   tt_cmap2_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap2_get_info
     2,
     (TT_CMap_ValidateFunc)   tt_cmap2_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap2_get_info
-  };
+  )
 
 #endif /* TT_CONFIG_CMAP_FORMAT_2 */
 
 
 #endif /* TT_CONFIG_CMAP_FORMAT_2 */
 
   /*                                                  each segment; can be */
   /*                                                  zero                 */
   /*                                                                       */
   /*                                                  each segment; can be */
   /*                                                  zero                 */
   /*                                                                       */
-  /*   glyphIds      16+NUM_SEGS*8  USHORT[]          array of glyph id    */
+  /*   glyphIds      16+NUM_SEGS*8  USHORT[]          array of glyph ID    */
   /*                                                  ranges               */
   /*                                                                       */
   /* Character codes are modelled by a series of ordered (increasing)      */
   /* intervals called segments.  Each segment has start and end codes,     */
   /* provided by the `startCount' and `endCount' arrays.  Segments must    */
   /*                                                  ranges               */
   /*                                                                       */
   /* Character codes are modelled by a series of ordered (increasing)      */
   /* intervals called segments.  Each segment has start and end codes,     */
   /* provided by the `startCount' and `endCount' arrays.  Segments must    */
-  /* not be overlapping and the last segment should always contain the     */
-  /* `0xFFFF' endCount.                                                    */
+  /* not overlap, and the last segment should always contain the value     */
+  /* 0xFFFF for `endCount'.                                                */
   /*                                                                       */
   /* The fields `searchRange', `entrySelector' and `rangeShift' are better */
   /* ignored (they are traces of over-engineering in the TrueType          */
   /*                                                                       */
   /* The fields `searchRange', `entrySelector' and `rangeShift' are better */
   /* ignored (they are traces of over-engineering in the TrueType          */
   /* charcode within the segment is obtained by adding the value of        */
   /* `idDelta' directly to the charcode, modulo 65536.                     */
   /*                                                                       */
   /* charcode within the segment is obtained by adding the value of        */
   /* `idDelta' directly to the charcode, modulo 65536.                     */
   /*                                                                       */
-  /* Otherwise, a glyph index is taken from the glyph ids sub-array for    */
+  /* Otherwise, a glyph index is taken from the glyph IDs sub-array for    */
   /* the segment, and the value of `idDelta' is added to it.               */
   /*                                                                       */
   /*                                                                       */
   /* the segment, and the value of `idDelta' is added to it.               */
   /*                                                                       */
   /*                                                                       */
-  /* Finally, note that certain fonts contain invalid charmaps that        */
-  /* contain end=0xFFFF, start=0xFFFF, delta=0x0001, offset=0xFFFF at the  */
-  /* of their charmaps (e.g. opens___.ttf which comes with OpenOffice.org) */
-  /* we need special code to deal with them correctly...                   */
+  /* Finally, note that a lot of fonts contain an invalid last segment,    */
+  /* where `start' and `end' are correctly set to 0xFFFF but both `delta'  */
+  /* and `offset' are incorrect (e.g., `opens___.ttf' which comes with     */
+  /* OpenOffice.org).  We need special code to deal with them correctly.   */
   /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_4
   /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_4
 
     p                  = table + 6;
     cmap->num_ranges   = FT_PEEK_USHORT( p ) >> 1;
 
     p                  = table + 6;
     cmap->num_ranges   = FT_PEEK_USHORT( p ) >> 1;
-    cmap->cur_charcode = 0xFFFFFFFFUL;
+    cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;
     cmap->cur_gindex   = 0;
 
     return SFNT_Err_Ok;
     cmap->cur_gindex   = 0;
 
     return SFNT_Err_Ok;
       p     += num_ranges * 2;
       offset = FT_PEEK_USHORT( p );
 
       p     += num_ranges * 2;
       offset = FT_PEEK_USHORT( p );
 
+      /* some fonts have an incorrect last segment; */
+      /* we have to catch it                        */
+      if ( range_index     >= num_ranges - 1 &&
+           cmap->cur_start == 0xFFFFU        &&
+           cmap->cur_end   == 0xFFFFU        )
+      {
+        TT_Face   face  = (TT_Face)cmap->cmap.cmap.charmap.face;
+        FT_Byte*  limit = face->cmap_table + face->cmap_size;
+
+
+        if ( offset && p + offset + 2 > limit )
+        {
+          cmap->cur_delta = 1;
+          offset          = 0;
+        }
+      }
+
       if ( offset != 0xFFFFU )
       {
         cmap->cur_values = offset ? p + offset : NULL;
       if ( offset != 0xFFFFU )
       {
         cmap->cur_values = offset ? p + offset : NULL;
     if ( cmap->cur_charcode >= 0xFFFFUL )
       goto Fail;
 
     if ( cmap->cur_charcode >= 0xFFFFUL )
       goto Fail;
 
-    charcode = cmap->cur_charcode + 1;
+    charcode = (FT_UInt)cmap->cur_charcode + 1;
 
     if ( charcode < cmap->cur_start )
       charcode = cmap->cur_start;
 
     if ( charcode < cmap->cur_start )
       charcode = cmap->cur_start;
     }
 
   Fail:
     }
 
   Fail:
-    cmap->cur_charcode = 0xFFFFFFFFUL;
+    cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;
     cmap->cur_gindex   = 0;
   }
 
     cmap->cur_gindex   = 0;
   }
 
     /*                                                             */
     if ( valid->level >= FT_VALIDATE_PARANOID )
     {
     /*                                                             */
     if ( valid->level >= FT_VALIDATE_PARANOID )
     {
-      /* check the values of 'searchRange', 'entrySelector', 'rangeShift' */
+      /* check the values of `searchRange', `entrySelector', `rangeShift' */
       FT_UInt  search_range   = TT_NEXT_USHORT( p );
       FT_UInt  entry_selector = TT_NEXT_USHORT( p );
       FT_UInt  range_shift    = TT_NEXT_USHORT( p );
       FT_UInt  search_range   = TT_NEXT_USHORT( p );
       FT_UInt  entry_selector = TT_NEXT_USHORT( p );
       FT_UInt  range_shift    = TT_NEXT_USHORT( p );
     offsets   = deltas  + num_segs * 2;
     glyph_ids = offsets + num_segs * 2;
 
     offsets   = deltas  + num_segs * 2;
     glyph_ids = offsets + num_segs * 2;
 
-    /* check last segment, its end count must be FFFF */
+    /* check last segment; its end count value must be 0xFFFF */
     if ( valid->level >= FT_VALIDATE_PARANOID )
     {
       p = ends + ( num_segs - 1 ) * 2;
     if ( valid->level >= FT_VALIDATE_PARANOID )
     {
       p = ends + ( num_segs - 1 ) * 2;
     }
 
     {
     }
 
     {
-      FT_UInt  start, end, offset, n;
-      FT_UInt  last_start = 0, last_end = 0;
-      FT_Int   delta;
+      FT_UInt   start, end, offset, n;
+      FT_UInt   last_start = 0, last_end = 0;
+      FT_Int    delta;
       FT_Byte*  p_start   = starts;
       FT_Byte*  p_end     = ends;
       FT_Byte*  p_delta   = deltas;
       FT_Byte*  p_start   = starts;
       FT_Byte*  p_end     = ends;
       FT_Byte*  p_delta   = deltas;
         if ( start > end )
           FT_INVALID_DATA;
 
         if ( start > end )
           FT_INVALID_DATA;
 
-        /* this test should be performed at default validation level;  */
-        /* unfortunately, some popular Asian fonts present overlapping */
-        /* ranges in their charmaps                                    */
-        /*                                                             */
+        /* this test should be performed at default validation level; */
+        /* unfortunately, some popular Asian fonts have overlapping   */
+        /* ranges in their charmaps                                   */
+        /*                                                            */
         if ( start <= last_end && n > 0 )
         {
           if ( valid->level >= FT_VALIDATE_TIGHT )
         if ( start <= last_end && n > 0 )
         {
           if ( valid->level >= FT_VALIDATE_TIGHT )
           else
           {
             /* allow overlapping segments, provided their start points */
           else
           {
             /* allow overlapping segments, provided their start points */
-            /* and end points, respectively, are in ascending order.   */
+            /* and end points, respectively, are in ascending order    */
             /*                                                         */
             if ( last_start > start || last_end > end )
               error |= TT_CMAP_FLAG_UNSORTED;
             /*                                                         */
             if ( last_start > start || last_end > end )
               error |= TT_CMAP_FLAG_UNSORTED;
 
         if ( offset && offset != 0xFFFFU )
         {
 
         if ( offset && offset != 0xFFFFU )
         {
-          p += offset;  /* start of glyph id array */
+          p += offset;  /* start of glyph ID array */
 
 
-          /* check that we point within the glyph ids table only */
+          /* check that we point within the glyph IDs table only */
           if ( valid->level >= FT_VALIDATE_TIGHT )
           {
             if ( p < glyph_ids                                ||
                  p + ( end - start + 1 ) * 2 > table + length )
               FT_INVALID_DATA;
           }
           if ( valid->level >= FT_VALIDATE_TIGHT )
           {
             if ( p < glyph_ids                                ||
                  p + ( end - start + 1 ) * 2 > table + length )
               FT_INVALID_DATA;
           }
-          else
+          /* Some fonts handle the last segment incorrectly.  In */
+          /* theory, 0xFFFF might point to an ordinary glyph --  */
+          /* a cmap 4 is versatile and could be used for any     */
+          /* encoding, not only Unicode.  However, reality shows */
+          /* that far too many fonts are sloppy and incorrectly  */
+          /* set all fields but `start' and `end' for the last   */
+          /* segment if it contains only a single character.     */
+          /*                                                     */
+          /* We thus omit the test here, delaying it to the      */
+          /* routines which actually access the cmap.            */
+          else if ( n != num_segs - 1                       ||
+                    !( start == 0xFFFFU && end == 0xFFFFU ) )
           {
             if ( p < glyph_ids                              ||
                  p + ( end - start + 1 ) * 2 > valid->limit )
           {
             if ( p < glyph_ids                              ||
                  p + ( end - start + 1 ) * 2 > valid->limit )
         }
         else if ( offset == 0xFFFFU )
         {
         }
         else if ( offset == 0xFFFFU )
         {
-          /* Some fonts (erroneously?) use a range offset of 0xFFFF */
+          /* some fonts (erroneously?) use a range offset of 0xFFFF */
           /* to mean missing glyph in cmap table                    */
           /*                                                        */
           /* to mean missing glyph in cmap table                    */
           /*                                                        */
-          if ( valid->level >= FT_VALIDATE_PARANOID                     ||
-               n != num_segs - 1                                        ||
-               !( start == 0xFFFFU && end == 0xFFFFU && delta == 0x1U ) )
+          if ( valid->level >= FT_VALIDATE_PARANOID    ||
+               n != num_segs - 1                       ||
+               !( start == 0xFFFFU && end == 0xFFFFU ) )
             FT_INVALID_DATA;
         }
 
             FT_INVALID_DATA;
         }
 
 
 
   static FT_UInt
 
 
   static FT_UInt
-  tt_cmap4_char_map_linear( TT_CMap   cmap,
-                            FT_UInt*  pcharcode,
-                            FT_Bool   next )
+  tt_cmap4_char_map_linear( TT_CMap     cmap,
+                            FT_UInt32*  pcharcode,
+                            FT_Bool     next )
   {
     FT_UInt    num_segs2, start, end, offset;
     FT_Int     delta;
   {
     FT_UInt    num_segs2, start, end, offset;
     FT_Int     delta;
           p      += num_segs2;
           offset  = TT_PEEK_USHORT( p );
 
           p      += num_segs2;
           offset  = TT_PEEK_USHORT( p );
 
+          /* some fonts have an incorrect last segment; */
+          /* we have to catch it                        */
+          if ( i >= num_segs - 1                  &&
+               start == 0xFFFFU && end == 0xFFFFU )
+          {
+            TT_Face   face  = (TT_Face)cmap->cmap.charmap.face;
+            FT_Byte*  limit = face->cmap_table + face->cmap_size;
+
+
+            if ( offset && p + offset + 2 > limit )
+            {
+              delta  = 1;
+              offset = 0;
+            }
+          }
+
           if ( offset == 0xFFFFU )
             continue;
 
           if ( offset == 0xFFFFU )
             continue;
 
 
 
   static FT_UInt
 
 
   static FT_UInt
-  tt_cmap4_char_map_binary( TT_CMap   cmap,
-                            FT_UInt*  pcharcode,
-                            FT_Bool   next )
+  tt_cmap4_char_map_binary( TT_CMap     cmap,
+                            FT_UInt32*  pcharcode,
+                            FT_Bool     next )
   {
     FT_UInt   num_segs2, start, end, offset;
     FT_Int    delta;
     FT_UInt   max, min, mid, num_segs;
   {
     FT_UInt   num_segs2, start, end, offset;
     FT_Int    delta;
     FT_UInt   max, min, mid, num_segs;
-    FT_UInt   charcode = *pcharcode;
+    FT_UInt   charcode = (FT_UInt)*pcharcode;
     FT_UInt   gindex   = 0;
     FT_Byte*  p;
 
     FT_UInt   gindex   = 0;
     FT_Byte*  p;
 
         p     += num_segs2;
         offset = TT_PEEK_USHORT( p );
 
         p     += num_segs2;
         offset = TT_PEEK_USHORT( p );
 
+        /* some fonts have an incorrect last segment; */
+        /* we have to catch it                        */
+        if ( mid >= num_segs - 1                &&
+             start == 0xFFFFU && end == 0xFFFFU )
+        {
+          TT_Face   face  = (TT_Face)cmap->cmap.charmap.face;
+          FT_Byte*  limit = face->cmap_table + face->cmap_size;
+
+
+          if ( offset && p + offset + 2 > limit )
+          {
+            delta  = 1;
+            offset = 0;
+          }
+        }
+
         /* search the first segment containing `charcode' */
         if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPING )
         {
         /* search the first segment containing `charcode' */
         if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPING )
         {
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap4_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
   tt_cmap4_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
     FT_Byte*  p = cmap->data + 4;
 
 
     FT_Byte*  p = cmap->data + 4;
 
 
-    cmap_info->format = 4;
+    cmap_info->format   = 4;
     cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
 
     return SFNT_Err_Ok;
   }
 
 
     cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
 
     return SFNT_Err_Ok;
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const TT_CMap_ClassRec  tt_cmap4_class_rec =
-  {
-    {
+  FT_DEFINE_TT_CMAP(tt_cmap4_class_rec,
       sizeof ( TT_CMap4Rec ),
       (FT_CMap_InitFunc)     tt_cmap4_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap4_char_index,
       sizeof ( TT_CMap4Rec ),
       (FT_CMap_InitFunc)     tt_cmap4_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap4_char_index,
-      (FT_CMap_CharNextFunc) tt_cmap4_char_next
-    },
+      (FT_CMap_CharNextFunc) tt_cmap4_char_next,
+
+      NULL, NULL, NULL, NULL, NULL
+    ,
     4,
     (TT_CMap_ValidateFunc)   tt_cmap4_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap4_get_info
     4,
     (TT_CMap_ValidateFunc)   tt_cmap4_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap4_get_info
-  };
+  )
 
 #endif /* TT_CONFIG_CMAP_FORMAT_4 */
 
 
 #endif /* TT_CONFIG_CMAP_FORMAT_4 */
 
   /*                                                                       */
   /*   first        6              USHORT           first segment code     */
   /*   count        8              USHORT           segment size in chars  */
   /*                                                                       */
   /*   first        6              USHORT           first segment code     */
   /*   count        8              USHORT           segment size in chars  */
-  /*   glyphIds     10             USHORT[count]    glyph ids              */
+  /*   glyphIds     10             USHORT[count]    glyph IDs              */
   /*                                                                       */
   /* A very simplified segment mapping.                                    */
   /*                                                                       */
   /*                                                                       */
   /* A very simplified segment mapping.                                    */
   /*                                                                       */
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap6_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
   tt_cmap6_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
     FT_Byte*  p = cmap->data + 4;
 
 
     FT_Byte*  p = cmap->data + 4;
 
 
-    cmap_info->format = 6;
+    cmap_info->format   = 6;
     cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
 
     return SFNT_Err_Ok;
   }
 
 
     cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
 
     return SFNT_Err_Ok;
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const TT_CMap_ClassRec  tt_cmap6_class_rec =
-  {
-    {
+  FT_DEFINE_TT_CMAP(tt_cmap6_class_rec,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap6_char_index,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap6_char_index,
-      (FT_CMap_CharNextFunc) tt_cmap6_char_next
-    },
+      (FT_CMap_CharNextFunc) tt_cmap6_char_next,
+
+      NULL, NULL, NULL, NULL, NULL
+    ,
     6,
     (TT_CMap_ValidateFunc)   tt_cmap6_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap6_get_info
     6,
     (TT_CMap_ValidateFunc)   tt_cmap6_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap6_get_info
-  };
+  )
 
 #endif /* TT_CONFIG_CMAP_FORMAT_6 */
 
 
 #endif /* TT_CONFIG_CMAP_FORMAT_6 */
 
   /*****                                                               *****/
   /*****                          FORMAT 8                             *****/
   /*****                                                               *****/
   /*****                                                               *****/
   /*****                          FORMAT 8                             *****/
   /*****                                                               *****/
-  /***** It's hard to completely understand what the OpenType spec     *****/
+  /***** It is hard to completely understand what the OpenType spec    *****/
   /***** says about this format, but here is my conclusion.            *****/
   /*****                                                               *****/
   /***** The purpose of this format is to easily map UTF-16 text to    *****/
   /***** says about this format, but here is my conclusion.            *****/
   /*****                                                               *****/
   /***** The purpose of this format is to easily map UTF-16 text to    *****/
   /*****     `char_hi' and `char_lo' must be in the Surrogates Area.   *****/
   /*****      Area.                                                    *****/
   /*****                                                               *****/
   /*****     `char_hi' and `char_lo' must be in the Surrogates Area.   *****/
   /*****      Area.                                                    *****/
   /*****                                                               *****/
-  /***** The 'is32' table embedded in the charmap indicates whether a  *****/
+  /***** The `is32' table embedded in the charmap indicates whether a  *****/
   /***** given 16-bit value is in the surrogates area or not.          *****/
   /*****                                                               *****/
   /***** So, for any given `char_code', we can assert the following:   *****/
   /***** given 16-bit value is in the surrogates area or not.          *****/
   /*****                                                               *****/
   /***** So, for any given `char_code', we can assert the following:   *****/
   /*   is32        12             BYTE[8192]  32-bitness bitmap            */
   /*   count       8204           ULONG       number of groups             */
   /*                                                                       */
   /*   is32        12             BYTE[8192]  32-bitness bitmap            */
   /*   count       8204           ULONG       number of groups             */
   /*                                                                       */
-  /* This header is followed by 'count' groups of the following format:    */
+  /* This header is followed by `count' groups of the following format:    */
   /*                                                                       */
   /*   start       0              ULONG       first charcode               */
   /*   end         4              ULONG       last charcode                */
   /*                                                                       */
   /*   start       0              ULONG       first charcode               */
   /*   end         4              ULONG       last charcode                */
-  /*   startId     8              ULONG       start glyph id for the group */
+  /*   startId     8              ULONG       start glyph ID for the group */
   /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_8
   /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_8
       FT_INVALID_TOO_SHORT;
 
     length = TT_NEXT_ULONG( p );
       FT_INVALID_TOO_SHORT;
 
     length = TT_NEXT_ULONG( p );
-    if ( table + length > valid->limit || length < 8208 )
+    if ( length > (FT_UInt32)( valid->limit - table ) || length < 8192 + 16 )
       FT_INVALID_TOO_SHORT;
 
     is32       = table + 12;
       FT_INVALID_TOO_SHORT;
 
     is32       = table + 12;
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap8_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
   tt_cmap8_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
     FT_Byte*  p = cmap->data + 8;
 
 
     FT_Byte*  p = cmap->data + 8;
 
 
-    cmap_info->format = 8;
+    cmap_info->format   = 8;
     cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
 
     return SFNT_Err_Ok;
   }
 
 
     cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
 
     return SFNT_Err_Ok;
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const TT_CMap_ClassRec  tt_cmap8_class_rec =
-  {
-    {
+  FT_DEFINE_TT_CMAP(tt_cmap8_class_rec,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap8_char_index,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap8_char_index,
-      (FT_CMap_CharNextFunc) tt_cmap8_char_next
-    },
+      (FT_CMap_CharNextFunc) tt_cmap8_char_next,
+
+      NULL, NULL, NULL, NULL, NULL
+    ,
     8,
     (TT_CMap_ValidateFunc)   tt_cmap8_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap8_get_info
     8,
     (TT_CMap_ValidateFunc)   tt_cmap8_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap8_get_info
-  };
+  )
 
 #endif /* TT_CONFIG_CMAP_FORMAT_8 */
 
 
 #endif /* TT_CONFIG_CMAP_FORMAT_8 */
 
     p      = table + 16;
     count  = TT_NEXT_ULONG( p );
 
     p      = table + 16;
     count  = TT_NEXT_ULONG( p );
 
-    if ( table + length > valid->limit || length < 20 + count * 2 )
+    if ( length > (FT_ULong)( valid->limit - table ) ||
+         length < 20 + count * 2                     )
       FT_INVALID_TOO_SHORT;
 
     /* check glyph indices */
       FT_INVALID_TOO_SHORT;
 
     /* check glyph indices */
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap10_char_next( TT_CMap     cmap,
                        FT_UInt32  *pchar_code )
   {
   tt_cmap10_char_next( TT_CMap     cmap,
                        FT_UInt32  *pchar_code )
   {
     FT_Byte*  p = cmap->data + 8;
 
 
     FT_Byte*  p = cmap->data + 8;
 
 
-    cmap_info->format = 10;
+    cmap_info->format   = 10;
     cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
 
     return SFNT_Err_Ok;
   }
 
 
     cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
 
     return SFNT_Err_Ok;
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const TT_CMap_ClassRec  tt_cmap10_class_rec =
-  {
-    {
+  FT_DEFINE_TT_CMAP(tt_cmap10_class_rec,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap10_char_index,
       sizeof ( TT_CMapRec ),
 
       (FT_CMap_InitFunc)     tt_cmap_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap10_char_index,
-      (FT_CMap_CharNextFunc) tt_cmap10_char_next
-    },
+      (FT_CMap_CharNextFunc) tt_cmap10_char_next,
+
+      NULL, NULL, NULL, NULL, NULL
+    ,
     10,
     (TT_CMap_ValidateFunc)   tt_cmap10_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap10_get_info
     10,
     (TT_CMap_ValidateFunc)   tt_cmap10_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap10_get_info
-  };
+  )
 
 #endif /* TT_CONFIG_CMAP_FORMAT_10 */
 
 
 #endif /* TT_CONFIG_CMAP_FORMAT_10 */
 
   /*                                                                       */
   /*   start       0          ULONG      first charcode                    */
   /*   end         4          ULONG      last charcode                     */
   /*                                                                       */
   /*   start       0          ULONG      first charcode                    */
   /*   end         4          ULONG      last charcode                     */
-  /*   startId     8          ULONG      start glyph id for the group      */
+  /*   startId     8          ULONG      start glyph ID for the group      */
   /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_12
   /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_12
     p          = table + 12;
     num_groups = TT_NEXT_ULONG( p );
 
     p          = table + 12;
     num_groups = TT_NEXT_ULONG( p );
 
-    if ( table + length > valid->limit || length < 16 + 12 * num_groups )
+    if ( length > (FT_ULong)( valid->limit - table ) ||
+         length < 16 + 12 * num_groups               )
       FT_INVALID_TOO_SHORT;
 
     /* check groups, they must be in increasing order */
       FT_INVALID_TOO_SHORT;
 
     /* check groups, they must be in increasing order */
 
         if ( gindex )
         {
 
         if ( gindex )
         {
-          cmap->cur_charcode = char_code;
+          cmap->cur_charcode = char_code;;
           cmap->cur_gindex   = gindex;
           cmap->cur_group    = n;
 
           cmap->cur_gindex   = gindex;
           cmap->cur_group    = n;
 
   }
 
 
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap12_char_next( TT_CMap     cmap,
                        FT_UInt32  *pchar_code )
   {
   tt_cmap12_char_next( TT_CMap     cmap,
                        FT_UInt32  *pchar_code )
   {
       if ( cmap12->valid )
       {
         gindex = cmap12->cur_gindex;
       if ( cmap12->valid )
       {
         gindex = cmap12->cur_gindex;
+
+        /* XXX: check cur_charcode overflow is expected */
         if ( gindex )
         if ( gindex )
-          *pchar_code = cmap12->cur_charcode;
+          *pchar_code = (FT_UInt32)cmap12->cur_charcode;
       }
       else
         gindex = 0;
       }
       else
         gindex = 0;
     else
       gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 );
 
     else
       gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 );
 
-    return gindex;
+    /* XXX: check gindex overflow is expected */
+    return (FT_UInt32)gindex;
   }
 
 
   }
 
 
     FT_Byte*  p = cmap->data + 8;
 
 
     FT_Byte*  p = cmap->data + 8;
 
 
-    cmap_info->format = 12;
+    cmap_info->format   = 12;
     cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
 
     return SFNT_Err_Ok;
   }
 
 
     cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
 
     return SFNT_Err_Ok;
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const TT_CMap_ClassRec  tt_cmap12_class_rec =
-  {
-    {
+  FT_DEFINE_TT_CMAP(tt_cmap12_class_rec,
       sizeof ( TT_CMap12Rec ),
 
       (FT_CMap_InitFunc)     tt_cmap12_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap12_char_index,
       sizeof ( TT_CMap12Rec ),
 
       (FT_CMap_InitFunc)     tt_cmap12_init,
       (FT_CMap_DoneFunc)     NULL,
       (FT_CMap_CharIndexFunc)tt_cmap12_char_index,
-      (FT_CMap_CharNextFunc) tt_cmap12_char_next
-    },
+      (FT_CMap_CharNextFunc) tt_cmap12_char_next,
+
+      NULL, NULL, NULL, NULL, NULL
+    ,
     12,
     (TT_CMap_ValidateFunc)   tt_cmap12_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap12_get_info
     12,
     (TT_CMap_ValidateFunc)   tt_cmap12_validate,
     (TT_CMap_Info_GetFunc)   tt_cmap12_get_info
-  };
-
+  )
 
 #endif /* TT_CONFIG_CMAP_FORMAT_12 */
 
 
 
 #endif /* TT_CONFIG_CMAP_FORMAT_12 */
 
 
-  static const TT_CMap_Class  tt_cmap_classes[] =
-  {
-#ifdef TT_CONFIG_CMAP_FORMAT_0
-    &tt_cmap0_class_rec,
-#endif
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                          FORMAT 13                            *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
 
 
-#ifdef TT_CONFIG_CMAP_FORMAT_2
-    &tt_cmap2_class_rec,
-#endif
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME        OFFSET     TYPE       DESCRIPTION                       */
+  /*                                                                       */
+  /*   format      0          USHORT     must be 13                        */
+  /*   reserved    2          USHORT     reserved                          */
+  /*   length      4          ULONG      length in bytes                   */
+  /*   language    8          ULONG      Mac language code                 */
+  /*   count       12         ULONG      number of groups                  */
+  /*               16                                                      */
+  /*                                                                       */
+  /* This header is followed by `count' groups of the following format:    */
+  /*                                                                       */
+  /*   start       0          ULONG      first charcode                    */
+  /*   end         4          ULONG      last charcode                     */
+  /*   glyphId     8          ULONG      glyph ID for the whole group      */
+  /*                                                                       */
 
 
-#ifdef TT_CONFIG_CMAP_FORMAT_4
-    &tt_cmap4_class_rec,
-#endif
+#ifdef TT_CONFIG_CMAP_FORMAT_13
 
 
-#ifdef TT_CONFIG_CMAP_FORMAT_6
-    &tt_cmap6_class_rec,
-#endif
+  typedef struct  TT_CMap13Rec_
+  {
+    TT_CMapRec  cmap;
+    FT_Bool     valid;
+    FT_ULong    cur_charcode;
+    FT_UInt     cur_gindex;
+    FT_ULong    cur_group;
+    FT_ULong    num_groups;
 
 
-#ifdef TT_CONFIG_CMAP_FORMAT_8
-    &tt_cmap8_class_rec,
-#endif
+  } TT_CMap13Rec, *TT_CMap13;
 
 
-#ifdef TT_CONFIG_CMAP_FORMAT_10
-    &tt_cmap10_class_rec,
-#endif
 
 
-#ifdef TT_CONFIG_CMAP_FORMAT_12
-    &tt_cmap12_class_rec,
-#endif
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap13_init( TT_CMap13  cmap,
+                  FT_Byte*   table )
+  {
+    cmap->cmap.data  = table;
 
 
-    NULL,
-  };
+    table           += 12;
+    cmap->num_groups = FT_PEEK_ULONG( table );
 
 
+    cmap->valid      = 0;
 
 
-  /* parse the `cmap' table and build the corresponding TT_CMap objects */
-  /* in the current face                                                */
-  /*                                                                    */
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_build_cmaps( TT_Face  face )
+    return SFNT_Err_Ok;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap13_validate( FT_Byte*      table,
+                      FT_Validator  valid )
   {
   {
-    FT_Byte*           table = face->cmap_table;
-    FT_Byte*           limit = table + face->cmap_size;
-    FT_UInt volatile   num_cmaps;
-    FT_Byte* volatile  p     = table;
+    FT_Byte*   p;
+    FT_ULong   length;
+    FT_ULong   num_groups;
 
 
 
 
-    if ( p + 4 > limit )
-      return SFNT_Err_Invalid_Table;
+    if ( table + 16 > valid->limit )
+      FT_INVALID_TOO_SHORT;
 
 
-    /* only recognize format 0 */
-    if ( TT_NEXT_USHORT( p ) != 0 )
-    {
-      p -= 2;
-      FT_ERROR(( "tt_face_build_cmaps: unsupported `cmap' table format = %d\n",
-                 TT_PEEK_USHORT( p ) ));
-      return SFNT_Err_Invalid_Table;
-    }
+    p      = table + 4;
+    length = TT_NEXT_ULONG( p );
 
 
-    num_cmaps = TT_NEXT_USHORT( p );
+    p          = table + 12;
+    num_groups = TT_NEXT_ULONG( p );
 
 
-    for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
-    {
-      FT_CharMapRec  charmap;
-      FT_UInt32      offset;
+    if ( length > (FT_ULong)( valid->limit - table ) ||
+         length < 16 + 12 * num_groups               )
+      FT_INVALID_TOO_SHORT;
 
 
+    /* check groups, they must be in increasing order */
+    {
+      FT_ULong  n, start, end, glyph_id, last = 0;
 
 
-      charmap.platform_id = TT_NEXT_USHORT( p );
-      charmap.encoding_id = TT_NEXT_USHORT( p );
-      charmap.face        = FT_FACE( face );
-      charmap.encoding    = FT_ENCODING_NONE;  /* will be filled later */
-      offset              = TT_NEXT_ULONG( p );
 
 
-      if ( offset && offset <= face->cmap_size - 2 )
+      for ( n = 0; n < num_groups; n++ )
       {
       {
-        FT_Byte* volatile              cmap   = table + offset;
-        volatile FT_UInt               format = TT_PEEK_USHORT( cmap );
-        const TT_CMap_Class* volatile  pclazz = tt_cmap_classes;
-        TT_CMap_Class volatile         clazz;
+        start    = TT_NEXT_ULONG( p );
+        end      = TT_NEXT_ULONG( p );
+        glyph_id = TT_NEXT_ULONG( p );
 
 
+        if ( start > end )
+          FT_INVALID_DATA;
 
 
-        for ( ; *pclazz; pclazz++ )
+        if ( n > 0 && start <= last )
+          FT_INVALID_DATA;
+
+        if ( valid->level >= FT_VALIDATE_TIGHT )
         {
         {
-          clazz = *pclazz;
-          if ( clazz->format == format )
-          {
-            volatile TT_ValidatorRec  valid;
-            volatile FT_Error         error = SFNT_Err_Ok;
+          if ( glyph_id >= TT_VALID_GLYPH_COUNT( valid ) )
+            FT_INVALID_GLYPH_ID;
+        }
 
 
+        last = end;
+      }
+    }
 
 
-            ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
-                               FT_VALIDATE_DEFAULT );
+    return SFNT_Err_Ok;
+  }
 
 
-            valid.num_glyphs = (FT_UInt)face->max_profile.numGlyphs;
 
 
-            if ( ft_setjmp(
-              *((ft_jmp_buf*)&FT_VALIDATOR( &valid )->jump_buffer) ) == 0 )
-            {
-              /* validate this cmap sub-table */
-              error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );
-            }
+  /* search the index of the charcode next to cmap->cur_charcode */
+  /* cmap->cur_group should be set up properly by caller         */
+  /*                                                             */
+  static void
+  tt_cmap13_next( TT_CMap13  cmap )
+  {
+    FT_Byte*  p;
+    FT_ULong  start, end, glyph_id, char_code;
+    FT_ULong  n;
+    FT_UInt   gindex;
 
 
-            if ( valid.validator.error == 0 )
-            {
-              FT_CMap  ttcmap;
 
 
+    if ( cmap->cur_charcode >= 0xFFFFFFFFUL )
+      goto Fail;
 
 
-              if ( !FT_CMap_New( (FT_CMap_Class)clazz,
-                                 cmap, &charmap, &ttcmap ) )
-              {
-                /* it is simpler to directly set `flags' than adding */
-                /* a parameter to FT_CMap_New                        */
-                ((TT_CMap)ttcmap)->flags = (FT_Int)error;
-              }
-            }
-            else
-            {
-              FT_ERROR(( "tt_face_build_cmaps:" ));
-              FT_ERROR(( " broken cmap sub-table ignored!\n" ));
-            }
-            break;
-          }
+    char_code = cmap->cur_charcode + 1;
+
+    n = cmap->cur_group;
+
+    for ( n = cmap->cur_group; n < cmap->num_groups; n++ )
+    {
+      p        = cmap->cmap.data + 16 + 12 * n;
+      start    = TT_NEXT_ULONG( p );
+      end      = TT_NEXT_ULONG( p );
+      glyph_id = TT_PEEK_ULONG( p );
+
+      if ( char_code < start )
+        char_code = start;
+
+      if ( char_code <= end )
+      {
+        gindex = (FT_UInt)glyph_id;
+
+        if ( gindex )
+        {
+          cmap->cur_charcode = char_code;;
+          cmap->cur_gindex   = gindex;
+          cmap->cur_group    = n;
+
+          return;
+        }
+      }
+    }
+
+  Fail:
+    cmap->valid = 0;
+  }
+
+
+  static FT_UInt
+  tt_cmap13_char_map_binary( TT_CMap     cmap,
+                             FT_UInt32*  pchar_code,
+                             FT_Bool     next )
+  {
+    FT_UInt    gindex     = 0;
+    FT_Byte*   p          = cmap->data + 12;
+    FT_UInt32  num_groups = TT_PEEK_ULONG( p );
+    FT_UInt32  char_code  = *pchar_code;
+    FT_UInt32  start, end;
+    FT_UInt32  max, min, mid;
+
+
+    if ( !num_groups )
+      return 0;
+
+    /* make compiler happy */
+    mid = num_groups;
+    end = 0xFFFFFFFFUL;
+
+    if ( next )
+      char_code++;
+
+    min = 0;
+    max = num_groups;
+
+    /* binary search */
+    while ( min < max )
+    {
+      mid = ( min + max ) >> 1;
+      p   = cmap->data + 16 + 12 * mid;
+
+      start = TT_NEXT_ULONG( p );
+      end   = TT_NEXT_ULONG( p );
+
+      if ( char_code < start )
+        max = mid;
+      else if ( char_code > end )
+        min = mid + 1;
+      else
+      {
+        gindex = (FT_UInt)TT_PEEK_ULONG( p );
+
+        break;
+      }
+    }
+
+    if ( next )
+    {
+      TT_CMap13  cmap13 = (TT_CMap13)cmap;
+
+
+      /* if `char_code' is not in any group, then `mid' is */
+      /* the group nearest to `char_code'                  */
+      /*                                                   */
+
+      if ( char_code > end )
+      {
+        mid++;
+        if ( mid == num_groups )
+          return 0;
+      }
+
+      cmap13->valid        = 1;
+      cmap13->cur_charcode = char_code;
+      cmap13->cur_group    = mid;
+
+      if ( !gindex )
+      {
+        tt_cmap13_next( cmap13 );
+
+        if ( cmap13->valid )
+          gindex = cmap13->cur_gindex;
+      }
+      else
+        cmap13->cur_gindex = gindex;
+
+      if ( gindex )
+        *pchar_code = cmap13->cur_charcode;
+    }
+
+    return gindex;
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt )
+  tt_cmap13_char_index( TT_CMap    cmap,
+                        FT_UInt32  char_code )
+  {
+    return tt_cmap13_char_map_binary( cmap, &char_code, 0 );
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt32 )
+  tt_cmap13_char_next( TT_CMap     cmap,
+                       FT_UInt32  *pchar_code )
+  {
+    TT_CMap13  cmap13 = (TT_CMap13)cmap;
+    FT_UInt    gindex;
+
+
+    if ( cmap13->cur_charcode >= 0xFFFFFFFFUL )
+      return 0;
+
+    /* no need to search */
+    if ( cmap13->valid && cmap13->cur_charcode == *pchar_code )
+    {
+      tt_cmap13_next( cmap13 );
+      if ( cmap13->valid )
+      {
+        gindex = cmap13->cur_gindex;
+        if ( gindex )
+          *pchar_code = cmap13->cur_charcode;
+      }
+      else
+        gindex = 0;
+    }
+    else
+      gindex = tt_cmap13_char_map_binary( cmap, pchar_code, 1 );
+
+    return gindex;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap13_get_info( TT_CMap       cmap,
+                      TT_CMapInfo  *cmap_info )
+  {
+    FT_Byte*  p = cmap->data + 8;
+
+
+    cmap_info->format   = 13;
+    cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
+
+    return SFNT_Err_Ok;
+  }
+
+
+  FT_CALLBACK_TABLE_DEF
+  const TT_CMap_ClassRec  tt_cmap13_class_rec =
+  {
+    {
+      sizeof ( TT_CMap13Rec ),
+
+      (FT_CMap_InitFunc)     tt_cmap13_init,
+      (FT_CMap_DoneFunc)     NULL,
+      (FT_CMap_CharIndexFunc)tt_cmap13_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap13_char_next,
+
+      NULL, NULL, NULL, NULL, NULL
+    },
+    13,
+    (TT_CMap_ValidateFunc)   tt_cmap13_validate,
+    (TT_CMap_Info_GetFunc)   tt_cmap13_get_info
+  };
+
+#endif /* TT_CONFIG_CMAP_FORMAT_13 */
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                           FORMAT 14                           *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME         OFFSET  TYPE    DESCRIPTION                            */
+  /*                                                                       */
+  /*   format         0     USHORT  must be 14                             */
+  /*   length         2     ULONG   table length in bytes                  */
+  /*   numSelector    6     ULONG   number of variation sel. records       */
+  /*                                                                       */
+  /* Followed by numSelector records, each of which looks like             */
+  /*                                                                       */
+  /*   varSelector    0     UINT24  Unicode codepoint of sel.              */
+  /*   defaultOff     3     ULONG   offset to a default UVS table          */
+  /*                                describing any variants to be found in */
+  /*                                the normal Unicode subtable.           */
+  /*   nonDefOff      7     ULONG   offset to a non-default UVS table      */
+  /*                                describing any variants not in the     */
+  /*                                standard cmap, with GIDs here          */
+  /* (either offset may be 0 NULL)                                         */
+  /*                                                                       */
+  /* Selectors are sorted by code point.                                   */
+  /*                                                                       */
+  /* A default Unicode Variation Selector (UVS) subtable is just a list of */
+  /* ranges of code points which are to be found in the standard cmap.  No */
+  /* glyph IDs (GIDs) here.                                                */
+  /*                                                                       */
+  /*   numRanges      0     ULONG   number of ranges following             */
+  /*                                                                       */
+  /* A range looks like                                                    */
+  /*                                                                       */
+  /*   uniStart       0     UINT24  code point of the first character in   */
+  /*                                this range                             */
+  /*   additionalCnt  3     UBYTE   count of additional characters in this */
+  /*                                range (zero means a range of a single  */
+  /*                                character)                             */
+  /*                                                                       */
+  /* Ranges are sorted by `uniStart'.                                      */
+  /*                                                                       */
+  /* A non-default Unicode Variation Selector (UVS) subtable is a list of  */
+  /* mappings from codepoint to GID.                                       */
+  /*                                                                       */
+  /*   numMappings    0     ULONG   number of mappings                     */
+  /*                                                                       */
+  /* A range looks like                                                    */
+  /*                                                                       */
+  /*   uniStart       0     UINT24  code point of the first character in   */
+  /*                                this range                             */
+  /*   GID            3     USHORT  and its GID                            */
+  /*                                                                       */
+  /* Ranges are sorted by `uniStart'.                                      */
+
+#ifdef TT_CONFIG_CMAP_FORMAT_14
+
+  typedef struct  TT_CMap14Rec_
+  {
+    TT_CMapRec  cmap;
+    FT_ULong    num_selectors;
+
+    /* This array is used to store the results of various
+     * cmap 14 query functions.  The data is overwritten
+     * on each call to these functions.
+     */
+    FT_UInt32   max_results;
+    FT_UInt32*  results;
+    FT_Memory   memory;
+
+  } TT_CMap14Rec, *TT_CMap14;
+
+
+  FT_CALLBACK_DEF( void )
+  tt_cmap14_done( TT_CMap14  cmap )
+  {
+    FT_Memory  memory = cmap->memory;
+
+
+    cmap->max_results = 0;
+    if ( memory != NULL && cmap->results != NULL )
+      FT_FREE( cmap->results );
+  }
+
+
+  static FT_Error
+  tt_cmap14_ensure( TT_CMap14  cmap,
+                    FT_UInt32  num_results,
+                    FT_Memory  memory )
+  {
+    FT_UInt32 old_max = cmap->max_results;
+    FT_Error  error   = 0;
+
+
+    if ( num_results > cmap->max_results )
+    {
+       cmap->memory = memory;
+
+       if ( FT_QRENEW_ARRAY( cmap->results, old_max, num_results ) )
+         return error;
+
+       cmap->max_results = num_results;
+    }
+
+    return error;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap14_init( TT_CMap14  cmap,
+                  FT_Byte*   table )
+  {
+    cmap->cmap.data = table;
+
+    table               += 6;
+    cmap->num_selectors = FT_PEEK_ULONG( table );
+    cmap->max_results   = 0;
+    cmap->results       = NULL;
+
+    return SFNT_Err_Ok;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap14_validate( FT_Byte*      table,
+                      FT_Validator  valid )
+  {
+    FT_Byte*  p             = table + 2;
+    FT_ULong  length        = TT_NEXT_ULONG( p );
+    FT_ULong  num_selectors = TT_NEXT_ULONG( p );
+
+
+    if ( length > (FT_ULong)( valid->limit - table ) ||
+         length < 10 + 11 * num_selectors            )
+      FT_INVALID_TOO_SHORT;
+
+    /* check selectors, they must be in increasing order */
+    {
+      /* we start lastVarSel at 1 because a variant selector value of 0
+       * isn't valid.
+       */
+      FT_ULong  n, lastVarSel = 1;
+
+
+      for ( n = 0; n < num_selectors; n++ )
+      {
+        FT_ULong  varSel    = TT_NEXT_UINT24( p );
+        FT_ULong  defOff    = TT_NEXT_ULONG( p );
+        FT_ULong  nondefOff = TT_NEXT_ULONG( p );
+
+
+        if ( defOff >= length || nondefOff >= length )
+          FT_INVALID_TOO_SHORT;
+
+        if ( varSel < lastVarSel )
+          FT_INVALID_DATA;
+
+        lastVarSel = varSel + 1;
+
+        /* check the default table (these glyphs should be reached     */
+        /* through the normal Unicode cmap, no GIDs, just check order) */
+        if ( defOff != 0 )
+        {
+          FT_Byte*  defp      = table + defOff;
+          FT_ULong  numRanges = TT_NEXT_ULONG( defp );
+          FT_ULong  i;
+          FT_ULong  lastBase  = 0;
+
+
+          if ( defp + numRanges * 4 > valid->limit )
+            FT_INVALID_TOO_SHORT;
+
+          for ( i = 0; i < numRanges; ++i )
+          {
+            FT_ULong  base = TT_NEXT_UINT24( defp );
+            FT_ULong  cnt  = FT_NEXT_BYTE( defp );
+
+
+            if ( base + cnt >= 0x110000UL )              /* end of Unicode */
+              FT_INVALID_DATA;
+
+            if ( base < lastBase )
+              FT_INVALID_DATA;
+
+            lastBase = base + cnt + 1U;
+          }
+        }
+
+        /* and the non-default table (these glyphs are specified here) */
+        if ( nondefOff != 0 ) {
+          FT_Byte*  ndp         = table + nondefOff;
+          FT_ULong  numMappings = TT_NEXT_ULONG( ndp );
+          FT_ULong  i, lastUni = 0;
+
+
+          if ( numMappings * 4 > (FT_ULong)( valid->limit - ndp ) )
+            FT_INVALID_TOO_SHORT;
+
+          for ( i = 0; i < numMappings; ++i )
+          {
+            FT_ULong  uni = TT_NEXT_UINT24( ndp );
+            FT_ULong  gid = TT_NEXT_USHORT( ndp );
+
+
+            if ( uni >= 0x110000UL )                     /* end of Unicode */
+              FT_INVALID_DATA;
+
+            if ( uni < lastUni )
+              FT_INVALID_DATA;
+
+            lastUni = uni + 1U;
+
+            if ( valid->level >= FT_VALIDATE_TIGHT    &&
+                 gid >= TT_VALID_GLYPH_COUNT( valid ) )
+              FT_INVALID_GLYPH_ID;
+          }
+        }
+      }
+    }
+
+    return SFNT_Err_Ok;
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt )
+  tt_cmap14_char_index( TT_CMap    cmap,
+                        FT_UInt32  char_code )
+  {
+    FT_UNUSED( cmap );
+    FT_UNUSED( char_code );
+
+    /* This can't happen */
+    return 0;
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt32 )
+  tt_cmap14_char_next( TT_CMap     cmap,
+                       FT_UInt32  *pchar_code )
+  {
+    FT_UNUSED( cmap );
+
+    /* This can't happen */
+    *pchar_code = 0;
+    return 0;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap14_get_info( TT_CMap       cmap,
+                      TT_CMapInfo  *cmap_info )
+  {
+    FT_UNUSED( cmap );
+
+    cmap_info->format   = 14;
+    /* subtable 14 does not define a language field */
+    cmap_info->language = 0xFFFFFFFFUL;
+
+    return SFNT_Err_Ok;
+  }
+
+
+  static FT_UInt
+  tt_cmap14_char_map_def_binary( FT_Byte    *base,
+                                 FT_UInt32   char_code )
+  {
+    FT_UInt32  numRanges = TT_PEEK_ULONG( base );
+    FT_UInt32  max, min;
+
+
+    min = 0;
+    max = numRanges;
+
+    base += 4;
+
+    /* binary search */
+    while ( min < max )
+    {
+      FT_UInt32  mid   = ( min + max ) >> 1;
+      FT_Byte*   p     = base + 4 * mid;
+      FT_ULong   start = TT_NEXT_UINT24( p );
+      FT_UInt    cnt   = FT_NEXT_BYTE( p );
+
+
+      if ( char_code < start )
+        max = mid;
+      else if ( char_code > start+cnt )
+        min = mid + 1;
+      else
+        return TRUE;
+    }
+
+    return FALSE;
+  }
+
+
+  static FT_UInt
+  tt_cmap14_char_map_nondef_binary( FT_Byte    *base,
+                                    FT_UInt32   char_code )
+  {
+    FT_UInt32  numMappings = TT_PEEK_ULONG( base );
+    FT_UInt32  max, min;
+
+
+    min = 0;
+    max = numMappings;
+
+    base += 4;
+
+    /* binary search */
+    while ( min < max )
+    {
+      FT_UInt32  mid = ( min + max ) >> 1;
+      FT_Byte*   p   = base + 5 * mid;
+      FT_UInt32  uni = (FT_UInt32)TT_NEXT_UINT24( p );
+
+
+      if ( char_code < uni )
+        max = mid;
+      else if ( char_code > uni )
+        min = mid + 1;
+      else
+        return TT_PEEK_USHORT( p );
+    }
+
+    return 0;
+  }
+
+
+  static FT_Byte*
+  tt_cmap14_find_variant( FT_Byte    *base,
+                          FT_UInt32   variantCode )
+  {
+    FT_UInt32  numVar = TT_PEEK_ULONG( base );
+    FT_UInt32  max, min;
+
+
+    min = 0;
+    max = numVar;
+
+    base += 4;
+
+    /* binary search */
+    while ( min < max )
+    {
+      FT_UInt32  mid    = ( min + max ) >> 1;
+      FT_Byte*   p      = base + 11 * mid;
+      FT_ULong   varSel = TT_NEXT_UINT24( p );
+
+
+      if ( variantCode < varSel )
+        max = mid;
+      else if ( variantCode > varSel )
+        min = mid + 1;
+      else
+        return p;
+    }
+
+    return NULL;
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt )
+  tt_cmap14_char_var_index( TT_CMap    cmap,
+                            TT_CMap    ucmap,
+                            FT_UInt32  charcode,
+                            FT_UInt32  variantSelector)
+  {
+    FT_Byte*  p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
+    FT_ULong  defOff;
+    FT_ULong  nondefOff;
+
+
+    if ( !p )
+      return 0;
+
+    defOff    = TT_NEXT_ULONG( p );
+    nondefOff = TT_PEEK_ULONG( p );
+
+    if ( defOff != 0                                                    &&
+         tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )
+    {
+      /* This is the default variant of this charcode.  GID not stored */
+      /* here; stored in the normal Unicode charmap instead.           */
+      return ucmap->cmap.clazz->char_index( &ucmap->cmap, charcode );
+    }
+
+    if ( nondefOff != 0 )
+      return tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
+                                               charcode );
+
+    return 0;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Int )
+  tt_cmap14_char_var_isdefault( TT_CMap    cmap,
+                                FT_UInt32  charcode,
+                                FT_UInt32  variantSelector )
+  {
+    FT_Byte*  p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
+    FT_ULong  defOff;
+    FT_ULong  nondefOff;
+
+
+    if ( !p )
+      return -1;
+
+    defOff    = TT_NEXT_ULONG( p );
+    nondefOff = TT_NEXT_ULONG( p );
+
+    if ( defOff != 0                                                    &&
+         tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )
+      return 1;
+
+    if ( nondefOff != 0                                            &&
+         tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
+                                           charcode ) != 0         )
+      return 0;
+
+    return -1;
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt32* )
+  tt_cmap14_variants( TT_CMap    cmap,
+                      FT_Memory  memory )
+  {
+    TT_CMap14   cmap14 = (TT_CMap14)cmap;
+    FT_UInt32   count  = cmap14->num_selectors;
+    FT_Byte*    p      = cmap->data + 10;
+    FT_UInt32*  result;
+    FT_UInt32   i;
+
+
+    if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
+      return NULL;
+
+    result = cmap14->results;
+    for ( i = 0; i < count; ++i )
+    {
+      result[i] = (FT_UInt32)TT_NEXT_UINT24( p );
+      p        += 8;
+    }
+    result[i] = 0;
+
+    return result;
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt32 * )
+  tt_cmap14_char_variants( TT_CMap    cmap,
+                           FT_Memory  memory,
+                           FT_UInt32  charCode )
+  {
+    TT_CMap14   cmap14 = (TT_CMap14)  cmap;
+    FT_UInt32   count  = cmap14->num_selectors;
+    FT_Byte*    p      = cmap->data + 10;
+    FT_UInt32*  q;
+
+
+    if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
+      return NULL;
+
+    for ( q = cmap14->results; count > 0; --count )
+    {
+      FT_UInt32  varSel    = TT_NEXT_UINT24( p );
+      FT_ULong   defOff    = TT_NEXT_ULONG( p );
+      FT_ULong   nondefOff = TT_NEXT_ULONG( p );
+
+
+      if ( ( defOff != 0                                               &&
+             tt_cmap14_char_map_def_binary( cmap->data + defOff,
+                                            charCode )                 ) ||
+           ( nondefOff != 0                                            &&
+             tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
+                                               charCode ) != 0         ) )
+      {
+        q[0] = varSel;
+        q++;
+      }
+    }
+    q[0] = 0;
+
+    return cmap14->results;
+  }
+
+
+  static FT_UInt
+  tt_cmap14_def_char_count( FT_Byte  *p )
+  {
+    FT_UInt32  numRanges = (FT_UInt32)TT_NEXT_ULONG( p );
+    FT_UInt    tot       = 0;
+
+
+    p += 3;  /* point to the first `cnt' field */
+    for ( ; numRanges > 0; numRanges-- )
+    {
+      tot += 1 + p[0];
+      p   += 4;
+    }
+
+    return tot;
+  }
+
+
+  static FT_UInt32*
+  tt_cmap14_get_def_chars( TT_CMap     cmap,
+                           FT_Byte*    p,
+                           FT_Memory   memory )
+  {
+    TT_CMap14   cmap14 = (TT_CMap14) cmap;
+    FT_UInt32   numRanges;
+    FT_UInt     cnt;
+    FT_UInt32*  q;
+
+
+    cnt       = tt_cmap14_def_char_count( p );
+    numRanges = (FT_UInt32)TT_NEXT_ULONG( p );
+
+    if ( tt_cmap14_ensure( cmap14, ( cnt + 1 ), memory ) )
+      return NULL;
+
+    for ( q = cmap14->results; numRanges > 0; --numRanges )
+    {
+      FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p );
+
+
+      cnt = FT_NEXT_BYTE( p ) + 1;
+      do
+      {
+        q[0]  = uni;
+        uni  += 1;
+        q    += 1;
+      } while ( --cnt != 0 );
+    }
+    q[0] = 0;
+
+    return cmap14->results;
+  }
+
+
+  static FT_UInt32*
+  tt_cmap14_get_nondef_chars( TT_CMap     cmap,
+                              FT_Byte    *p,
+                              FT_Memory   memory )
+  {
+    TT_CMap14   cmap14 = (TT_CMap14) cmap;
+    FT_UInt32   numMappings;
+    FT_UInt     i;
+    FT_UInt32  *ret;
+
+
+    numMappings = (FT_UInt32)TT_NEXT_ULONG( p );
+
+    if ( tt_cmap14_ensure( cmap14, ( numMappings + 1 ), memory ) )
+      return NULL;
+
+    ret = cmap14->results;
+    for ( i = 0; i < numMappings; ++i )
+    {
+      ret[i] = (FT_UInt32)TT_NEXT_UINT24( p );
+      p += 2;
+    }
+    ret[i] = 0;
+
+    return ret;
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt32 * )
+  tt_cmap14_variant_chars( TT_CMap    cmap,
+                           FT_Memory  memory,
+                           FT_UInt32  variantSelector )
+  {
+    FT_Byte    *p  = tt_cmap14_find_variant( cmap->data + 6,
+                                             variantSelector );
+    FT_UInt32  *ret;
+    FT_Int      i;
+    FT_ULong    defOff;
+    FT_ULong    nondefOff;
+
+
+    if ( !p )
+      return NULL;
+
+    defOff    = TT_NEXT_ULONG( p );
+    nondefOff = TT_NEXT_ULONG( p );
+
+    if ( defOff == 0 && nondefOff == 0 )
+      return NULL;
+
+    if ( defOff == 0 )
+      return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,
+                                         memory );
+    else if ( nondefOff == 0 )
+      return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
+                                      memory );
+    else
+    {
+      /* Both a default and a non-default glyph set?  That's probably not */
+      /* good font design, but the spec allows for it...                  */
+      TT_CMap14  cmap14 = (TT_CMap14) cmap;
+      FT_UInt32  numRanges;
+      FT_UInt32  numMappings;
+      FT_UInt32  duni;
+      FT_UInt32  dcnt;
+      FT_UInt32  nuni;
+      FT_Byte*   dp;
+      FT_UInt    di, ni, k;
+
+
+      p  = cmap->data + nondefOff;
+      dp = cmap->data + defOff;
+
+      numMappings = (FT_UInt32)TT_NEXT_ULONG( p );
+      dcnt        = tt_cmap14_def_char_count( dp );
+      numRanges   = (FT_UInt32)TT_NEXT_ULONG( dp );
+
+      if ( numMappings == 0 )
+        return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
+                                        memory );
+      if ( dcnt == 0 )
+        return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,
+                                           memory );
+
+      if ( tt_cmap14_ensure( cmap14, ( dcnt + numMappings + 1 ), memory ) )
+        return NULL;
+
+      ret  = cmap14->results;
+      duni = (FT_UInt32)TT_NEXT_UINT24( dp );
+      dcnt = FT_NEXT_BYTE( dp );
+      di   = 1;
+      nuni = (FT_UInt32)TT_NEXT_UINT24( p );
+      p   += 2;
+      ni   = 1;
+      i    = 0;
+
+      for ( ;; )
+      {
+        if ( nuni > duni + dcnt )
+        {
+          for ( k = 0; k <= dcnt; ++k )
+            ret[i++] = duni + k;
+
+          ++di;
+
+          if ( di > numRanges )
+            break;
+
+          duni = (FT_UInt32)TT_NEXT_UINT24( dp );
+          dcnt = FT_NEXT_BYTE( dp );
+        }
+        else
+        {
+          if ( nuni < duni )
+            ret[i++] = nuni;
+          /* If it is within the default range then ignore it -- */
+          /* that should not have happened                       */
+          ++ni;
+          if ( ni > numMappings )
+            break;
+
+          nuni = (FT_UInt32)TT_NEXT_UINT24( p );
+          p += 2;
+        }
+      }
+
+      if ( ni <= numMappings )
+      {
+        /* If we get here then we have run out of all default ranges.   */
+        /* We have read one non-default mapping which we haven't stored */
+        /* and there may be others that need to be read.                */
+        ret[i++] = nuni;
+        while ( ni < numMappings )
+        {
+          ret[i++] = (FT_UInt32)TT_NEXT_UINT24( p );
+          p += 2;
+          ++ni;
+        }
+      }
+      else if ( di <= numRanges )
+      {
+        /* If we get here then we have run out of all non-default     */
+        /* mappings.  We have read one default range which we haven't */
+        /* stored and there may be others that need to be read.       */
+        for ( k = 0; k <= dcnt; ++k )
+          ret[i++] = duni + k;
+
+        while ( di < numRanges )
+        {
+          duni = (FT_UInt32)TT_NEXT_UINT24( dp );
+          dcnt = FT_NEXT_BYTE( dp );
+
+          for ( k = 0; k <= dcnt; ++k )
+            ret[i++] = duni + k;
+          ++di;
+        }
+      }
+
+      ret[i] = 0;
+
+      return ret;
+    }
+  }
+
+
+  FT_DEFINE_TT_CMAP(tt_cmap14_class_rec,
+      sizeof ( TT_CMap14Rec ),
+
+      (FT_CMap_InitFunc)     tt_cmap14_init,
+      (FT_CMap_DoneFunc)     tt_cmap14_done,
+      (FT_CMap_CharIndexFunc)tt_cmap14_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap14_char_next,
+
+      /* Format 14 extension functions */
+      (FT_CMap_CharVarIndexFunc)    tt_cmap14_char_var_index,
+      (FT_CMap_CharVarIsDefaultFunc)tt_cmap14_char_var_isdefault,
+      (FT_CMap_VariantListFunc)     tt_cmap14_variants,
+      (FT_CMap_CharVariantListFunc) tt_cmap14_char_variants,
+      (FT_CMap_VariantCharListFunc) tt_cmap14_variant_chars
+    ,
+    14,
+    (TT_CMap_ValidateFunc)tt_cmap14_validate,
+    (TT_CMap_Info_GetFunc)tt_cmap14_get_info
+  )
+
+#endif /* TT_CONFIG_CMAP_FORMAT_14 */
+
+
+#ifndef FT_CONFIG_OPTION_PIC
+
+  static const TT_CMap_Class  tt_cmap_classes[] =
+  {
+#define TTCMAPCITEM(a) &a,
+#include "ttcmapc.h"
+    NULL,
+  };
+
+#else /*FT_CONFIG_OPTION_PIC*/
+
+  void FT_Destroy_Class_tt_cmap_classes(FT_Library library, TT_CMap_Class* clazz)
+  {
+    FT_Memory memory = library->memory;
+    if ( clazz )
+      FT_FREE( clazz );
+  }
+
+  FT_Error FT_Create_Class_tt_cmap_classes(FT_Library library, TT_CMap_Class** output_class)
+  {
+    TT_CMap_Class*  clazz;
+    TT_CMap_ClassRec* recs;
+    FT_Error          error;
+    FT_Memory memory = library->memory;
+    int i = 0;
+
+#define TTCMAPCITEM(a) i++;
+#include "ttcmapc.h"
+
+    /* allocate enough space for both the pointers +terminator and the class instances */
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*(i+1)+sizeof(TT_CMap_ClassRec)*i ) )
+      return error;
+
+    /* the location of the class instances follows the array of pointers */
+    recs = (TT_CMap_ClassRec*) (((char*)clazz)+(sizeof(*clazz)*(i+1))); 
+    i=0;
+
+#undef TTCMAPCITEM
+#define TTCMAPCITEM(a)           \
+    FT_Init_Class_##a(&recs[i]); \
+    clazz[i] = &recs[i];         \
+    i++;
+#include "ttcmapc.h"
+
+    clazz[i] = NULL;
+
+    *output_class = clazz;
+    return FT_Err_Ok;
+  }
+
+#endif /*FT_CONFIG_OPTION_PIC*/
+
+
+  /* parse the `cmap' table and build the corresponding TT_CMap objects */
+  /* in the current face                                                */
+  /*                                                                    */
+  FT_LOCAL_DEF( FT_Error )
+  tt_face_build_cmaps( TT_Face  face )
+  {
+    FT_Byte*           table = face->cmap_table;
+    FT_Byte*           limit = table + face->cmap_size;
+    FT_UInt volatile   num_cmaps;
+    FT_Byte* volatile  p     = table;
+    FT_Library         library = FT_FACE_LIBRARY(face);
+    FT_UNUSED(library);
+
+
+    if ( p + 4 > limit )
+      return SFNT_Err_Invalid_Table;
+
+    /* only recognize format 0 */
+    if ( TT_NEXT_USHORT( p ) != 0 )
+    {
+      p -= 2;
+      FT_ERROR(( "tt_face_build_cmaps:"
+                 " unsupported `cmap' table format = %d\n",
+                 TT_PEEK_USHORT( p ) ));
+      return SFNT_Err_Invalid_Table;
+    }
+
+    num_cmaps = TT_NEXT_USHORT( p );
+
+    for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
+    {
+      FT_CharMapRec  charmap;
+      FT_UInt32      offset;
+
+
+      charmap.platform_id = TT_NEXT_USHORT( p );
+      charmap.encoding_id = TT_NEXT_USHORT( p );
+      charmap.face        = FT_FACE( face );
+      charmap.encoding    = FT_ENCODING_NONE;  /* will be filled later */
+      offset              = TT_NEXT_ULONG( p );
+
+      if ( offset && offset <= face->cmap_size - 2 )
+      {
+        FT_Byte* volatile              cmap   = table + offset;
+        volatile FT_UInt               format = TT_PEEK_USHORT( cmap );
+        const TT_CMap_Class* volatile  pclazz = FT_TT_CMAP_CLASSES_GET;
+        TT_CMap_Class volatile         clazz;
+
+
+        for ( ; *pclazz; pclazz++ )
+        {
+          clazz = *pclazz;
+          if ( clazz->format == format )
+          {
+            volatile TT_ValidatorRec  valid;
+            volatile FT_Error         error = SFNT_Err_Ok;
+
+
+            ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
+                               FT_VALIDATE_DEFAULT );
+
+            valid.num_glyphs = (FT_UInt)face->max_profile.numGlyphs;
+
+            if ( ft_setjmp(
+              *((ft_jmp_buf*)&FT_VALIDATOR( &valid )->jump_buffer) ) == 0 )
+            {
+              /* validate this cmap sub-table */
+              error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );
+            }
+
+            if ( valid.validator.error == 0 )
+            {
+              FT_CMap  ttcmap;
+
+
+              /* It might make sense to store the single variation selector */
+              /* cmap somewhere special.  But it would have to be in the    */
+              /* public FT_FaceRec, and we can't change that.               */
+
+              if ( !FT_CMap_New( (FT_CMap_Class)clazz,
+                                 cmap, &charmap, &ttcmap ) )
+              {
+                /* it is simpler to directly set `flags' than adding */
+                /* a parameter to FT_CMap_New                        */
+                ((TT_CMap)ttcmap)->flags = (FT_Int)error;
+              }
+            }
+            else
+            {
+              FT_TRACE0(( "tt_face_build_cmaps:"
+                          " broken cmap sub-table ignored\n" ));
+            }
+            break;
+          }
+        }
+
+        if ( *pclazz == NULL )
+        {
+          FT_TRACE0(( "tt_face_build_cmaps:"
+                      " unsupported cmap sub-table ignored\n" ));
         }
       }
     }
         }
       }
     }
index a10a3e2..15a4a21 100644 (file)
@@ -55,6 +55,46 @@ FT_BEGIN_HEADER
 
   } TT_CMap_ClassRec;
 
 
   } TT_CMap_ClassRec;
 
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_TT_CMAP(class_, size_, init_, done_, char_index_,          \
+    char_next_, char_var_index_, char_var_default_, variant_list_,           \
+    charvariant_list_,variantchar_list_,                                     \
+    format_, validate_, get_cmap_info_)                                      \
+  FT_CALLBACK_TABLE_DEF                                                      \
+  const TT_CMap_ClassRec class_ =                                            \
+  {                                                                          \
+    {size_, init_, done_, char_index_,                                       \
+     char_next_, char_var_index_, char_var_default_, variant_list_,          \
+     charvariant_list_, variantchar_list_},                                  \
+    format_, validate_, get_cmap_info_                                       \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_TT_CMAP(class_, size_, init_, done_, char_index_,          \
+    char_next_, char_var_index_, char_var_default_, variant_list_,           \
+    charvariant_list_,variantchar_list_,                                     \
+    format_, validate_, get_cmap_info_)                                      \
+  void                                                                       \
+  FT_Init_Class_##class_( TT_CMap_ClassRec*  clazz )                         \
+  {                                                                          \
+    clazz->clazz.size = size_;                                               \
+    clazz->clazz.init = init_;                                               \
+    clazz->clazz.done = done_;                                               \
+    clazz->clazz.char_index = char_index_;                                   \
+    clazz->clazz.char_next = char_next_;                                     \
+    clazz->clazz.char_var_index = char_var_index_;                           \
+    clazz->clazz.char_var_default = char_var_default_;                       \
+    clazz->clazz.variant_list = variant_list_;                               \
+    clazz->clazz.charvariant_list = charvariant_list_;                       \
+    clazz->clazz.variantchar_list = variantchar_list_;                       \
+    clazz->format = format_;                                                 \
+    clazz->validate = validate_;                                             \
+    clazz->get_cmap_info = get_cmap_info_;                                   \
+  } 
+
+#endif /* FT_CONFIG_OPTION_PIC */ 
 
   typedef struct  TT_ValidatorRec_
   {
 
   typedef struct  TT_ValidatorRec_
   {
diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttcmapc.h b/reactos/lib/3rdparty/freetype/src/sfnt/ttcmapc.h
new file mode 100644 (file)
index 0000000..4c9c6a5
--- /dev/null
@@ -0,0 +1,55 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ttcmapc.h                                                              */
+/*                                                                         */
+/*    TT CMAP classes definitions (specification only).                    */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifdef TT_CONFIG_CMAP_FORMAT_0
+    TTCMAPCITEM(tt_cmap0_class_rec)
+#endif
+
+#ifdef TT_CONFIG_CMAP_FORMAT_2
+    TTCMAPCITEM(tt_cmap2_class_rec)
+#endif
+
+#ifdef TT_CONFIG_CMAP_FORMAT_4
+    TTCMAPCITEM(tt_cmap4_class_rec)
+#endif
+
+#ifdef TT_CONFIG_CMAP_FORMAT_6
+    TTCMAPCITEM(tt_cmap6_class_rec)
+#endif
+
+#ifdef TT_CONFIG_CMAP_FORMAT_8
+    TTCMAPCITEM(tt_cmap8_class_rec)
+#endif
+
+#ifdef TT_CONFIG_CMAP_FORMAT_10
+    TTCMAPCITEM(tt_cmap10_class_rec)
+#endif
+
+#ifdef TT_CONFIG_CMAP_FORMAT_12
+    TTCMAPCITEM(tt_cmap12_class_rec)
+#endif
+
+#ifdef TT_CONFIG_CMAP_FORMAT_13
+    TTCMAPCITEM(tt_cmap13_class_rec)
+#endif
+
+#ifdef TT_CONFIG_CMAP_FORMAT_14
+    TTCMAPCITEM(tt_cmap14_class_rec)
+#endif
+
+  /* END */
index 28e52c3..c154080 100644 (file)
@@ -5,7 +5,7 @@
 /*    Load the basic TrueType kerning table.  This doesn't handle          */
 /*    kerning data within the GPOS table at the moment.                    */
 /*                                                                         */
 /*    Load the basic TrueType kerning table.  This doesn't handle          */
 /*    kerning data within the GPOS table at the moment.                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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 "ttkern.h"
 #include FT_INTERNAL_STREAM_H
 #include FT_TRUETYPE_TAGS_H
 #include "ttkern.h"
-#include "ttload.h"
 
 #include "sferrors.h"
 
 
 #include "sferrors.h"
 
 
     if ( table_size < 4 )  /* the case of a malformed table */
     {
 
     if ( table_size < 4 )  /* the case of a malformed table */
     {
-      FT_ERROR(( "kerning table is too small - ignored\n" ));
+      FT_ERROR(( "tt_face_load_kern:"
+                 " kerning table is too small - ignored\n" ));
       error = SFNT_Err_Table_Missing;
       goto Exit;
     }
 
     if ( FT_FRAME_EXTRACT( table_size, face->kern_table ) )
     {
       error = SFNT_Err_Table_Missing;
       goto Exit;
     }
 
     if ( FT_FRAME_EXTRACT( table_size, face->kern_table ) )
     {
-      FT_ERROR(( "could not extract kerning table\n" ));
+      FT_ERROR(( "tt_face_load_kern:"
+                 " could not extract kerning table\n" ));
       goto Exit;
     }
 
       goto Exit;
     }
 
@@ -86,7 +87,7 @@
     {
       FT_UInt    num_pairs, length, coverage;
       FT_Byte*   p_next;
     {
       FT_UInt    num_pairs, length, coverage;
       FT_Byte*   p_next;
-      FT_UInt32  mask = 1UL << nn;
+      FT_UInt32  mask = (FT_UInt32)1UL << nn;
 
 
       if ( p + 6 > p_limit )
 
 
       if ( p + 6 > p_limit )
 
       p_next += length;
 
 
       p_next += length;
 
+      if ( p_next > p_limit )  /* handle broken table */
+        p_next = p_limit;
+
       /* only use horizontal kerning tables */
       if ( ( coverage & ~8 ) != 0x0001 ||
            p + 8 > p_limit             )
       /* only use horizontal kerning tables */
       if ( ( coverage & ~8 ) != 0x0001 ||
            p + 8 > p_limit             )
       num_pairs = FT_NEXT_USHORT( p );
       p        += 6;
 
       num_pairs = FT_NEXT_USHORT( p );
       p        += 6;
 
-      if ( p + 6 * num_pairs > p_limit )
-        goto NextTable;
+      if ( ( p_next - p ) / 6 < (int)num_pairs ) /* handle broken count */
+        num_pairs = (FT_UInt)( ( p_next - p ) / 6 );
 
       avail |= mask;
 
 
       avail |= mask;
 
        */
       if ( num_pairs > 0 )
       {
        */
       if ( num_pairs > 0 )
       {
-        FT_UInt  count;
-        FT_UInt  old_pair;
+        FT_ULong  count;
+        FT_ULong  old_pair;
 
 
         old_pair = FT_NEXT_ULONG( p );
 
 
         old_pair = FT_NEXT_ULONG( p );
     FT_Int    result = 0;
     FT_UInt   count, mask = 1;
     FT_Byte*  p       = face->kern_table;
     FT_Int    result = 0;
     FT_UInt   count, mask = 1;
     FT_Byte*  p       = face->kern_table;
+    FT_Byte*  p_limit = p + face->kern_table_size;
 
 
     p   += 4;
     mask = 0x0001;
 
 
 
     p   += 4;
     mask = 0x0001;
 
-    for ( count = face->num_kern_tables; count > 0; count--, mask <<= 1 )
+    for ( count = face->num_kern_tables;
+          count > 0 && p + 6 <= p_limit;
+          count--, mask <<= 1 )
     {
       FT_Byte* base     = p;
       FT_Byte* next     = base;
       FT_UInt  version  = FT_NEXT_USHORT( p );
       FT_UInt  length   = FT_NEXT_USHORT( p );
       FT_UInt  coverage = FT_NEXT_USHORT( p );
     {
       FT_Byte* base     = p;
       FT_Byte* next     = base;
       FT_UInt  version  = FT_NEXT_USHORT( p );
       FT_UInt  length   = FT_NEXT_USHORT( p );
       FT_UInt  coverage = FT_NEXT_USHORT( p );
+      FT_UInt  num_pairs;
       FT_Int   value    = 0;
 
       FT_UNUSED( version );
       FT_Int   value    = 0;
 
       FT_UNUSED( version );
 
       next = base + length;
 
 
       next = base + length;
 
+      if ( next > p_limit )  /* handle broken table */
+        next = p_limit;
+
       if ( ( face->kern_avail_bits & mask ) == 0 )
         goto NextTable;
 
       if ( p + 8 > next )
         goto NextTable;
 
       if ( ( face->kern_avail_bits & mask ) == 0 )
         goto NextTable;
 
       if ( p + 8 > next )
         goto NextTable;
 
+      num_pairs = FT_NEXT_USHORT( p );
+      p        += 6;
+
+      if ( ( next - p ) / 6 < (int)num_pairs )  /* handle broken count  */
+        num_pairs = (FT_UInt)( ( next - p ) / 6 );
+
       switch ( coverage >> 8 )
       {
       case 0:
         {
       switch ( coverage >> 8 )
       {
       case 0:
         {
-          FT_UInt   num_pairs = FT_NEXT_USHORT( p );
-          FT_ULong  key0      = TT_KERN_INDEX( left_glyph, right_glyph );
-
+          FT_ULong  key0 = TT_KERN_INDEX( left_glyph, right_glyph );
 
 
-          p += 6;
 
           if ( face->kern_order_bits & mask )   /* binary search */
           {
 
           if ( face->kern_order_bits & mask )   /* binary search */
           {
index abe0278..f08f640 100644 (file)
@@ -5,7 +5,7 @@
 /*    Load the basic TrueType tables, i.e., tables that can be either in   */
 /*    TTF or OTF fonts (body).                                             */
 /*                                                                         */
 /*    Load the basic TrueType tables, i.e., tables that can be either in   */
 /*    TTF or OTF fonts (body).                                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -58,6 +58,9 @@
   {
     TT_Table  entry;
     TT_Table  limit;
   {
     TT_Table  entry;
     TT_Table  limit;
+#ifdef FT_DEBUG_LEVEL_TRACE
+    FT_Bool   zero_length = FALSE;
+#endif
 
 
     FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
 
 
     FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
 
     for ( ; entry < limit; entry++ )
     {
 
     for ( ; entry < limit; entry++ )
     {
-      /* For compatibility with Windows, we consider 0-length */
-      /* tables the same as missing tables.                   */
-      if ( entry->Tag == tag && entry->Length != 0 )
-      {
-        FT_TRACE4(( "found table.\n" ));
-        return entry;
+      /* For compatibility with Windows, we consider    */
+      /* zero-length tables the same as missing tables. */
+      if ( entry->Tag == tag ) {
+        if ( entry->Length != 0 )
+        {
+          FT_TRACE4(( "found table.\n" ));
+          return entry;
+        }
+#ifdef FT_DEBUG_LEVEL_TRACE
+        zero_length = TRUE;
+#endif
       }
     }
 
       }
     }
 
-    FT_TRACE4(( "could not find table!\n" ));
-    return 0;
+#ifdef FT_DEBUG_LEVEL_TRACE
+    if ( zero_length )
+      FT_TRACE4(( "ignoring empty table\n" ));
+    else
+      FT_TRACE4(( "could not find table\n" ));
+#endif
+
+    return NULL;
   }
 
 
   }
 
 
         *length = table->Length;
 
       if ( FT_STREAM_SEEK( table->Offset ) )
         *length = table->Length;
 
       if ( FT_STREAM_SEEK( table->Offset ) )
-       goto Exit;
+        goto Exit;
     }
     else
       error = SFNT_Err_Table_Missing;
     }
     else
       error = SFNT_Err_Table_Missing;
   }
 
 
   }
 
 
-  /* Here, we                                                              */
-  /*                                                                       */
-  /* - check that `num_tables' is valid                                    */
-  /* - look for a `head' table, check its size, and parse it to check      */
-  /*   whether its `magic' field is correctly set                          */
-  /*                                                                       */
-  /* When checking directory entries, ignore the tables `glyx' and `locx'  */
-  /* which are hacked-out versions of `glyf' and `loca' in some PostScript */
-  /* Type 42 fonts, and which are generally invalid.                       */
-  /*                                                                       */
+  /* Here, we                                                         */
+  /*                                                                  */
+  /* - check that `num_tables' is valid (and adjust it if necessary)  */
+  /*                                                                  */
+  /* - look for a `head' table, check its size, and parse it to check */
+  /*   whether its `magic' field is correctly set                     */
+  /*                                                                  */
+  /* - errors (except errors returned by stream handling)             */
+  /*                                                                  */
+  /*     SFNT_Err_Unknown_File_Format:                                */
+  /*       no table is defined in directory, it is not sfnt-wrapped   */
+  /*       data                                                       */
+  /*     SFNT_Err_Table_Missing:                                      */
+  /*       table directory is valid, but essential tables             */
+  /*       (head/bhed/SING) are missing                               */
+  /*                                                                  */
   static FT_Error
   check_table_dir( SFNT_Header  sfnt,
                    FT_Stream    stream )
   {
   static FT_Error
   check_table_dir( SFNT_Header  sfnt,
                    FT_Stream    stream )
   {
-    FT_Error        error;
-    FT_UInt         nn;
-    FT_UInt         has_head = 0, has_sing = 0, has_meta = 0;
-    FT_ULong        offset = sfnt->offset + 12;
-
-    const FT_ULong  glyx_tag = FT_MAKE_TAG( 'g', 'l', 'y', 'x' );
-    const FT_ULong  locx_tag = FT_MAKE_TAG( 'l', 'o', 'c', 'x' );
+    FT_Error  error;
+    FT_UInt   nn, valid_entries = 0;
+    FT_UInt   has_head = 0, has_sing = 0, has_meta = 0;
+    FT_ULong  offset = sfnt->offset + 12;
 
     static const FT_Frame_Field  table_dir_entry_fields[] =
     {
 
     static const FT_Frame_Field  table_dir_entry_fields[] =
     {
     };
 
 
     };
 
 
-    if ( sfnt->num_tables == 0                         ||
-         offset + sfnt->num_tables * 16 > stream->size )
-      return SFNT_Err_Unknown_File_Format;
-
     if ( FT_STREAM_SEEK( offset ) )
     if ( FT_STREAM_SEEK( offset ) )
-      return error;
+      goto Exit;
 
     for ( nn = 0; nn < sfnt->num_tables; nn++ )
     {
 
     for ( nn = 0; nn < sfnt->num_tables; nn++ )
     {
 
 
       if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) )
 
 
       if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) )
-        return error;
+      {
+        nn--;
+        FT_TRACE2(( "check_table_dir:"
+                    " can read only %d table%s in font (instead of %d)\n",
+                    nn, nn == 1 ? "" : "s", sfnt->num_tables ));
+        sfnt->num_tables = nn;
+        break;
+      }
 
 
-      if ( table.Offset + table.Length > stream->size &&
-           table.Tag != glyx_tag                      &&
-           table.Tag != locx_tag                      )
-        return SFNT_Err_Unknown_File_Format;
+      /* we ignore invalid tables */
+      if ( table.Offset + table.Length > stream->size )
+      {
+        FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn ));
+        continue;
+      }
+      else
+        valid_entries++;
 
       if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )
       {
 
       if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )
       {
          *
          */
         if ( table.Length < 0x36 )
          *
          */
         if ( table.Length < 0x36 )
-          return SFNT_Err_Unknown_File_Format;
+        {
+          FT_TRACE2(( "check_table_dir: `head' table too small\n" ));
+          error = SFNT_Err_Table_Missing;
+          goto Exit;
+        }
 
         if ( FT_STREAM_SEEK( table.Offset + 12 ) ||
              FT_READ_ULONG( magic )              )
 
         if ( FT_STREAM_SEEK( table.Offset + 12 ) ||
              FT_READ_ULONG( magic )              )
-          return error;
+          goto Exit;
 
         if ( magic != 0x5F0F3CF5UL )
 
         if ( magic != 0x5F0F3CF5UL )
-          return SFNT_Err_Unknown_File_Format;
+        {
+          FT_TRACE2(( "check_table_dir:"
+                      " no magic number found in `head' table\n"));
+          error = SFNT_Err_Table_Missing;
+          goto Exit;
+        }
 
         if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )
 
         if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )
-          return error;
+          goto Exit;
       }
       else if ( table.Tag == TTAG_SING )
         has_sing = 1;
       }
       else if ( table.Tag == TTAG_SING )
         has_sing = 1;
         has_meta = 1;
     }
 
         has_meta = 1;
     }
 
+    sfnt->num_tables = valid_entries;
+
+    if ( sfnt->num_tables == 0 )
+    {
+      FT_TRACE2(( "check_table_dir: no tables found\n" ));
+      error = SFNT_Err_Unknown_File_Format;
+      goto Exit;
+    }
+
     /* if `sing' and `meta' tables are present, there is no `head' table */
     if ( has_head || ( has_sing && has_meta ) )
     /* if `sing' and `meta' tables are present, there is no `head' table */
     if ( has_head || ( has_sing && has_meta ) )
-      return SFNT_Err_Ok;
+    {
+      error = SFNT_Err_Ok;
+      goto Exit;
+    }
     else
     else
-      return SFNT_Err_Unknown_File_Format;
+    {
+      FT_TRACE2(( "check_table_dir:" ));
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+      FT_TRACE2(( " neither `head', `bhed', nor `sing' table found\n" ));
+#else
+      FT_TRACE2(( " neither `head' nor `sing' table found\n" ));
+#endif
+      error = SFNT_Err_Table_Missing;
+    }
+
+  Exit:
+    return error;
   }
 
 
   }
 
 
     FT_Error        error;
     FT_Memory       memory = stream->memory;
     TT_TableRec*    entry;
     FT_Error        error;
     FT_Memory       memory = stream->memory;
     TT_TableRec*    entry;
-    TT_TableRec*    limit;
+    FT_Int          nn;
 
     static const FT_Frame_Field  offset_table_fields[] =
     {
 
     static const FT_Frame_Field  offset_table_fields[] =
     {
 
     if ( FT_READ_ULONG( sfnt.format_tag )                    ||
          FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) )
 
     if ( FT_READ_ULONG( sfnt.format_tag )                    ||
          FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) )
-      return error;
+      goto Exit;
 
     /* many fonts don't have these fields set correctly */
 #if 0
 
     /* many fonts don't have these fields set correctly */
 #if 0
 
     /* load the table directory */
 
 
     /* load the table directory */
 
-    FT_TRACE2(( "-- Tables count:   %12u\n",  sfnt.num_tables ));
-    FT_TRACE2(( "-- Format version: %08lx\n", sfnt.format_tag ));
+    FT_TRACE2(( "-- Number of tables: %10u\n",    sfnt.num_tables ));
+    FT_TRACE2(( "-- Format version:   0x%08lx\n", sfnt.format_tag ));
 
     /* check first */
     error = check_table_dir( &sfnt, stream );
     if ( error )
     {
 
     /* check first */
     error = check_table_dir( &sfnt, stream );
     if ( error )
     {
-      FT_TRACE2(( "tt_face_load_font_dir: invalid table directory!\n" ));
+      FT_TRACE2(( "tt_face_load_font_dir:"
+                  " invalid table directory for TrueType\n" ));
 
 
-      return error;
+      goto Exit;
     }
 
     face->num_tables = sfnt.num_tables;
     face->format_tag = sfnt.format_tag;
 
     if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )
     }
 
     face->num_tables = sfnt.num_tables;
     face->format_tag = sfnt.format_tag;
 
     if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )
-      return error;
+      goto Exit;
 
     if ( FT_STREAM_SEEK( sfnt.offset + 12 )       ||
          FT_FRAME_ENTER( face->num_tables * 16L ) )
 
     if ( FT_STREAM_SEEK( sfnt.offset + 12 )       ||
          FT_FRAME_ENTER( face->num_tables * 16L ) )
-      return error;
+      goto Exit;
 
     entry = face->dir_tables;
 
     entry = face->dir_tables;
-    limit = entry + face->num_tables;
 
 
-    for ( ; entry < limit; entry++ )
+    for ( nn = 0; nn < sfnt.num_tables; nn++ )
     {
       entry->Tag      = FT_GET_TAG4();
       entry->CheckSum = FT_GET_ULONG();
       entry->Offset   = FT_GET_LONG();
       entry->Length   = FT_GET_LONG();
 
     {
       entry->Tag      = FT_GET_TAG4();
       entry->CheckSum = FT_GET_ULONG();
       entry->Offset   = FT_GET_LONG();
       entry->Length   = FT_GET_LONG();
 
-      FT_TRACE2(( "  %c%c%c%c  -  %08lx  -  %08lx\n",
-                  (FT_Char)( entry->Tag >> 24 ),
-                  (FT_Char)( entry->Tag >> 16 ),
-                  (FT_Char)( entry->Tag >> 8  ),
-                  (FT_Char)( entry->Tag       ),
-                  entry->Offset,
-                  entry->Length ));
+      /* ignore invalid tables */
+      if ( entry->Offset + entry->Length > stream->size )
+        continue;
+      else
+      {
+        FT_TRACE2(( "  %c%c%c%c  -  %08lx  -  %08lx\n",
+                    (FT_Char)( entry->Tag >> 24 ),
+                    (FT_Char)( entry->Tag >> 16 ),
+                    (FT_Char)( entry->Tag >> 8  ),
+                    (FT_Char)( entry->Tag       ),
+                    entry->Offset,
+                    entry->Length ));
+        entry++;
+      }
     }
 
     FT_FRAME_EXIT();
 
     FT_TRACE2(( "table directory loaded\n\n" ));
 
     }
 
     FT_FRAME_EXIT();
 
     FT_TRACE2(( "table directory loaded\n\n" ));
 
+  Exit:
     return error;
   }
 
     return error;
   }
 
 
       if ( maxProfile->maxFunctionDefs == 0 )
         maxProfile->maxFunctionDefs = 64;
 
       if ( maxProfile->maxFunctionDefs == 0 )
         maxProfile->maxFunctionDefs = 64;
+
+      /* we add 4 phantom points later */
+      if ( maxProfile->maxTwilightPoints > ( 0xFFFFU - 4 ) )
+      {
+        FT_TRACE0(( "tt_face_load_maxp:"
+                    " too much twilight points in `maxp' table;\n"
+                    "                  "
+                    " some glyphs might be rendered incorrectly\n" ));
+
+        maxProfile->maxTwilightPoints = 0xFFFFU - 4;
+      }
     }
 
     FT_TRACE3(( "numGlyphs: %u\n", maxProfile->numGlyphs ));
     }
 
     FT_TRACE3(( "numGlyphs: %u\n", maxProfile->numGlyphs ));
 
     if ( storage_start > storage_limit )
     {
 
     if ( storage_start > storage_limit )
     {
-      FT_ERROR(( "invalid `name' table\n" ));
+      FT_ERROR(( "tt_face_load_name: invalid `name' table\n" ));
       error = SFNT_Err_Name_Table_Missing;
       goto Exit;
     }
       error = SFNT_Err_Name_Table_Missing;
       goto Exit;
     }
index 286bd0c..53e6ac7 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Load the metrics tables common to TTF and OTF fonts (body).          */
 /*                                                                         */
 /*                                                                         */
 /*    Load the metrics tables common to TTF and OTF fonts (body).          */
 /*                                                                         */
-/*  Copyright 2006, 2007 by                                                */
+/*  Copyright 2006, 2007, 2008, 2009 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -60,7 +60,7 @@
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_hmtx( TT_Face    face,
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_hmtx( TT_Face    face,
@@ -97,7 +97,7 @@
     return error;
   }
 
     return error;
   }
 
-#else /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_hmtx( TT_Face    face,
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_hmtx( TT_Face    face,
 
     if ( num_shorts < 0 )
     {
 
     if ( num_shorts < 0 )
     {
-      FT_ERROR(( "%cmtx has more metrics than glyphs.\n" ));
+      FT_TRACE0(( "tt_face_load_hmtx:"
+                  " %cmtx has more metrics than glyphs.\n",
+                  vertical ? "v" : "h" ));
 
       /* Adobe simply ignores this problem.  So we shall do the same. */
 #if 0
 
       /* Adobe simply ignores this problem.  So we shall do the same. */
 #if 0
     return error;
   }
 
     return error;
   }
 
-#endif /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
   /*************************************************************************/
 
 
   /*************************************************************************/
   /*                                                                       */
   /*    advance :: The advance width resp. advance height.                 */
   /*                                                                       */
   /*                                                                       */
   /*    advance :: The advance width resp. advance height.                 */
   /*                                                                       */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_get_metrics( TT_Face     face,
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_get_metrics( TT_Face     face,
     return SFNT_Err_Ok;
   }
 
     return SFNT_Err_Ok;
   }
 
-#else /* OLD_INTERNALS */
+#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_get_metrics( TT_Face     face,
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_get_metrics( TT_Face     face,
   {
     void*           v = &face->vertical;
     void*           h = &face->horizontal;
   {
     void*           v = &face->vertical;
     void*           h = &face->horizontal;
-    TT_HoriHeader*  header = vertical ? (TT_HoriHeader*)v : h;
+    TT_HoriHeader*  header = vertical ? (TT_HoriHeader*)v
+                                      : (TT_HoriHeader*)h;
     TT_LongMetrics  longs_m;
     FT_UShort       k = header->number_Of_HMetrics;
 
     TT_LongMetrics  longs_m;
     FT_UShort       k = header->number_Of_HMetrics;
 
     return SFNT_Err_Ok;
   }
 
     return SFNT_Err_Ok;
   }
 
-#endif /* !OPTIMIZE_MEMORY || OLD_INTERNALS */
+#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
 /* END */
 
 
 /* END */
index 1e61636..aa0bf1e 100644 (file)
@@ -5,7 +5,7 @@
 /*    Postcript name table processing for TrueType and OpenType fonts      */
 /*    (body).                                                              */
 /*                                                                         */
 /*    Postcript name table processing for TrueType and OpenType fonts      */
 /*    (body).                                                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2006, 2007 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -29,7 +29,6 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_TRUETYPE_TAGS_H
 #include "ttpost.h"
 #include FT_INTERNAL_STREAM_H
 #include FT_TRUETYPE_TAGS_H
 #include "ttpost.h"
-#include "ttload.h"
 
 #include "sferrors.h"
 
 
 #include "sferrors.h"
 
    /* table of Mac names.  Thus, it is possible to build a version of */
    /* FreeType without the Type 1 driver & PSNames module.            */
 
    /* table of Mac names.  Thus, it is possible to build a version of */
    /* FreeType without the Type 1 driver & PSNames module.            */
 
-#define MAC_NAME( x )  tt_post_default_names[x]
+#define MAC_NAME( x )  ( (FT_String*)tt_post_default_names[x] )
 
   /* the 258 default Mac PS glyph names */
 
 
   /* the 258 default Mac PS glyph names */
 
-  static const FT_String*  tt_post_default_names[258] =
+  static const FT_String* const  tt_post_default_names[258] =
   {
     /*   0 */
     ".notdef", ".null", "CR", "space", "exclam",
   {
     /*   0 */
     ".notdef", ".null", "CR", "space", "exclam",
   /*    tt_face_get_ps_name                                                */
   /*                                                                       */
   /* <Description>                                                         */
   /*    tt_face_get_ps_name                                                */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Gets the PostScript glyph name of a glyph.                         */
+  /*    Get the PostScript glyph name of a glyph.                          */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the parent face.                             */
   /*                                                                       */
   /*    idx    :: The glyph index.                                         */
   /*                                                                       */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the parent face.                             */
   /*                                                                       */
   /*    idx    :: The glyph index.                                         */
   /*                                                                       */
+  /* <InOut>                                                               */
   /*    PSname :: The address of a string pointer.  Will be NULL in case   */
   /*              of error, otherwise it is a pointer to the glyph name.   */
   /*                                                                       */
   /*    PSname :: The address of a string pointer.  Will be NULL in case   */
   /*              of error, otherwise it is a pointer to the glyph name.   */
   /*                                                                       */
                        FT_UInt      idx,
                        FT_String**  PSname )
   {
                        FT_UInt      idx,
                        FT_String**  PSname )
   {
-    FT_Error         error;
-    TT_Post_Names    names;
-    FT_Fixed         format;
+    FT_Error       error;
+    TT_Post_Names  names;
+    FT_Fixed       format;
 
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
     FT_Service_PsCMaps  psnames;
 
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
     FT_Service_PsCMaps  psnames;
index eff49da..833bb2a 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (body).                */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (body).                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
    *  Alas, the memory-optimized sbit loader can't be used when implementing
    *  the `old internals' hack
    */
    *  Alas, the memory-optimized sbit loader can't be used when implementing
    *  the `old internals' hack
    */
-#if !defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
 
 #include "ttsbit0.c"
 
 
 #include "ttsbit0.c"
 
-#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
+#else /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
@@ -83,7 +83,8 @@
              FT_Int      line_bits,
              FT_Bool     byte_padded,
              FT_Int      x_offset,
              FT_Int      line_bits,
              FT_Bool     byte_padded,
              FT_Int      x_offset,
-             FT_Int      y_offset )
+             FT_Int      y_offset,
+             FT_Int      source_height )
   {
     FT_Byte*   line_buff;
     FT_Int     line_incr;
   {
     FT_Byte*   line_buff;
     FT_Int     line_incr;
     acc    = 0;  /* clear accumulator   */
     loaded = 0;  /* no bits were loaded */
 
     acc    = 0;  /* clear accumulator   */
     loaded = 0;  /* no bits were loaded */
 
-    for ( height = target->rows; height > 0; height-- )
+    for ( height = source_height; height > 0; height-- )
     {
       FT_Byte*  cur   = line_buff;        /* current write cursor          */
       FT_Int    count = line_bits;        /* # of bits to extract per line */
     {
       FT_Byte*  cur   = line_buff;        /* current write cursor          */
       FT_Int    count = line_bits;        /* # of bits to extract per line */
       break;
 
     case 5:
       break;
 
     case 5:
-      error = Load_SBit_Const_Metrics( range, stream )   ||
-              Load_SBit_Range_Codes( range, stream, 0 );
+      error = Load_SBit_Const_Metrics( range, stream );
+      if ( !error )
+        error = Load_SBit_Range_Codes( range, stream, 0 );
       break;
 
     default:
       break;
 
     default:
     if ( version     != 0x00020000L ||
          num_strikes >= 0x10000L    )
     {
     if ( version     != 0x00020000L ||
          num_strikes >= 0x10000L    )
     {
-      FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version!\n" ));
+      FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" ));
       error = SFNT_Err_Invalid_File_Format;
 
       goto Exit;
       error = SFNT_Err_Invalid_File_Format;
 
       goto Exit;
       Found:
         /* return successfully! */
         *arange  = range;
       Found:
         /* return successfully! */
         *arange  = range;
-        return 0;
+        return SFNT_Err_Ok;
       }
     }
 
       }
     }
 
       /* the sbit blitter doesn't make a difference between pixmap */
       /* depths.                                                   */
       blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes,
       /* the sbit blitter doesn't make a difference between pixmap */
       /* depths.                                                   */
       blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes,
-                 x_offset * pix_bits, y_offset );
+                 x_offset * pix_bits, y_offset, metrics->height );
 
       FT_FRAME_EXIT();
     }
 
       FT_FRAME_EXIT();
     }
                                range->image_format, metrics, stream );
 
     case 8:  /* compound format */
                                range->image_format, metrics, stream );
 
     case 8:  /* compound format */
-      FT_Stream_Skip( stream, 1L );
+      if ( FT_STREAM_SKIP( 1L ) )
+      {
+        error = SFNT_Err_Invalid_Stream_Skip;
+        goto Exit;
+      }
       /* fallthrough */
 
     case 9:
       /* fallthrough */
 
     case 9:
     return error;
   }
 
     return error;
   }
 
-#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
+#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
 /* END */
 
 
 /* END */
index c6067c0..7ea2af1 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (specification).       */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (specification).       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -45,7 +45,7 @@ FT_BEGIN_HEADER
                                FT_ULong          strike_index,
                                FT_Size_Metrics*  metrics );
 
                                FT_ULong          strike_index,
                                FT_Size_Metrics*  metrics );
 
-#if defined FT_CONFIG_OPTION_OLD_INTERNALS
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   FT_LOCAL( FT_Error )
   tt_find_sbit_image( TT_Face          face,
                       FT_UInt          glyph_index,
   FT_LOCAL( FT_Error )
   tt_find_sbit_image( TT_Face          face,
                       FT_UInt          glyph_index,
index f8adc64..38bcf21 100644 (file)
@@ -5,7 +5,7 @@
 /*    TrueType and OpenType embedded bitmap support (body).                */
 /*    This is a heap-optimized version.                                    */
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (body).                */
 /*    This is a heap-optimized version.                                    */
 /*                                                                         */
-/*  Copyright 2005, 2006, 2007 by                                          */
+/*  Copyright 2005, 2006, 2007, 2008, 2009 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #define FT_COMPONENT  trace_ttsbit
 
 
 #define FT_COMPONENT  trace_ttsbit
 
 
-    static const FT_Frame_Field  tt_sbit_line_metrics_fields[] =
-    {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  TT_SBit_LineMetricsRec
-
-      /* no FT_FRAME_START */
-        FT_FRAME_CHAR( ascender ),
-        FT_FRAME_CHAR( descender ),
-        FT_FRAME_BYTE( max_width ),
-
-        FT_FRAME_CHAR( caret_slope_numerator ),
-        FT_FRAME_CHAR( caret_slope_denominator ),
-        FT_FRAME_CHAR( caret_offset ),
-
-        FT_FRAME_CHAR( min_origin_SB ),
-        FT_FRAME_CHAR( min_advance_SB ),
-        FT_FRAME_CHAR( max_before_BL ),
-        FT_FRAME_CHAR( min_after_BL ),
-        FT_FRAME_CHAR( pads[0] ),
-        FT_FRAME_CHAR( pads[1] ),
-      FT_FRAME_END
-    };
-
-    static const FT_Frame_Field  tt_strike_start_fields[] =
-    {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  TT_SBit_StrikeRec
-
-      /* no FT_FRAME_START */
-        FT_FRAME_ULONG( ranges_offset ),
-        FT_FRAME_SKIP_LONG,
-        FT_FRAME_ULONG( num_ranges ),
-        FT_FRAME_ULONG( color_ref ),
-      FT_FRAME_END
-    };
-
-    static const FT_Frame_Field  tt_strike_end_fields[] =
-    {
-      /* no FT_FRAME_START */
-        FT_FRAME_USHORT( start_glyph ),
-        FT_FRAME_USHORT( end_glyph ),
-        FT_FRAME_BYTE  ( x_ppem ),
-        FT_FRAME_BYTE  ( y_ppem ),
-        FT_FRAME_BYTE  ( bit_depth ),
-        FT_FRAME_CHAR  ( flags ),
-      FT_FRAME_END
-    };
-
-
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_eblc( TT_Face    face,
                      FT_Stream  stream )
   {
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_eblc( TT_Face    face,
                      FT_Stream  stream )
   {
-    FT_Error   error  = SFNT_Err_Ok;
-    FT_Fixed   version;
-    FT_ULong   num_strikes, table_size;
-    FT_Byte*   p;
-    FT_Byte*   p_limit;
-    FT_UInt    count;
+    FT_Error  error = SFNT_Err_Ok;
+    FT_Fixed  version;
+    FT_ULong  num_strikes, table_size;
+    FT_Byte*  p;
+    FT_Byte*  p_limit;
+    FT_UInt   count;
 
 
     face->sbit_num_strikes = 0;
 
 
     face->sbit_num_strikes = 0;
 
     if ( table_size < 8 )
     {
 
     if ( table_size < 8 )
     {
-      FT_ERROR(( "%s: table too short!\n", "tt_face_load_sbit_strikes" ));
+      FT_ERROR(( "tt_face_load_sbit_strikes: table too short\n" ));
       error = SFNT_Err_Invalid_File_Format;
       goto Exit;
     }
       error = SFNT_Err_Invalid_File_Format;
       goto Exit;
     }
 
     if ( version != 0x00020000UL || num_strikes >= 0x10000UL )
     {
 
     if ( version != 0x00020000UL || num_strikes >= 0x10000UL )
     {
-      FT_ERROR(( "%s: invalid table version!\n",
-                 "tt_face_load_sbit_strikes" ));
+      FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" ));
       error = SFNT_Err_Invalid_File_Format;
       goto Fail;
     }
       error = SFNT_Err_Invalid_File_Format;
       goto Fail;
     }
                                FT_ULong          strike_index,
                                FT_Size_Metrics*  metrics )
   {
                                FT_ULong          strike_index,
                                FT_Size_Metrics*  metrics )
   {
-    FT_Byte*         strike;
+    FT_Byte*  strike;
 
 
     if ( strike_index >= (FT_ULong)face->sbit_num_strikes )
 
 
     if ( strike_index >= (FT_ULong)face->sbit_num_strikes )
   }
 
 
   }
 
 
-  typedef struct
+  typedef struct  TT_SBitDecoderRec_
   {
     TT_Face          face;
     FT_Stream        stream;
   {
     TT_Face          face;
     FT_Stream        stream;
     if ( p + 5 > limit )
       goto Fail;
 
     if ( p + 5 > limit )
       goto Fail;
 
-    if ( !decoder->metrics_loaded )
-    {
-      metrics->height       = p[0];
-      metrics->width        = p[1];
-      metrics->horiBearingX = (FT_Char)p[2];
-      metrics->horiBearingY = (FT_Char)p[3];
-      metrics->horiAdvance  = p[4];
-    }
+    metrics->height       = p[0];
+    metrics->width        = p[1];
+    metrics->horiBearingX = (FT_Char)p[2];
+    metrics->horiBearingY = (FT_Char)p[3];
+    metrics->horiAdvance  = p[4];
 
     p += 5;
     if ( big )
 
     p += 5;
     if ( big )
       if ( p + 3 > limit )
         goto Fail;
 
       if ( p + 3 > limit )
         goto Fail;
 
-      if ( !decoder->metrics_loaded )
-      {
-        metrics->vertBearingX = (FT_Char)p[0];
-        metrics->vertBearingY = (FT_Char)p[1];
-        metrics->vertAdvance  = p[2];
-      }
+      metrics->vertBearingX = (FT_Char)p[0];
+      metrics->vertBearingY = (FT_Char)p[1];
+      metrics->vertAdvance  = p[2];
 
       p += 3;
     }
 
     decoder->metrics_loaded = 1;
     *pp = p;
 
       p += 3;
     }
 
     decoder->metrics_loaded = 1;
     *pp = p;
-    return 0;
+    return SFNT_Err_Ok;
 
   Fail:
     return SFNT_Err_Invalid_Argument;
 
   Fail:
     return SFNT_Err_Invalid_Argument;
         if ( w > 0 )
           wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) );
 
         if ( w > 0 )
           wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) );
 
-        /* all bits read and there are ( x_pos + w ) bits to be written */
+        /* all bits read and there are `x_pos + w' bits to be written */
 
         write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
 
 
         write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
 
   }
 
 
   }
 
 
+  /*
+   * Load a bit-aligned bitmap (with pointer `p') into a line-aligned bitmap
+   * (with pointer `write').  In the example below, the width is 3 pixel,
+   * and `x_pos' is 1 pixel.
+   *
+   *       p                               p+1
+   *     |                               |                               |
+   *     | 7   6   5   4   3   2   1   0 | 7   6   5   4   3   2   1   0 |...
+   *     |                               |                               |
+   *       +-------+   +-------+   +-------+ ...
+   *           .           .           .
+   *           .           .           .
+   *           v           .           .
+   *       +-------+       .           .
+   * |                               | .
+   * | 7   6   5   4   3   2   1   0 | .
+   * |                               | .
+   *   write               .           .
+   *                       .           .
+   *                       v           .
+   *                   +-------+       .
+   *             |                               |
+   *             | 7   6   5   4   3   2   1   0 |
+   *             |                               |
+   *               write+1             .
+   *                                   .
+   *                                   v
+   *                               +-------+
+   *                         |                               |
+   *                         | 7   6   5   4   3   2   1   0 |
+   *                         |                               |
+   *                           write+2
+   *
+   */
+
   static FT_Error
   tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder  decoder,
                                     FT_Byte*        p,
   static FT_Error
   tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder  decoder,
                                     FT_Byte*        p,
     }
 
     /* now do the blit */
     }
 
     /* now do the blit */
+
+    /* adjust `line' to point to the first byte of the bitmap */
     line  += y_pos * pitch + ( x_pos >> 3 );
     x_pos &= 7;
 
     line  += y_pos * pitch + ( x_pos >> 3 );
     x_pos &= 7;
 
     for ( h = height; h > 0; h--, line += pitch )
     {
       FT_Byte*  write = line;
     for ( h = height; h > 0; h--, line += pitch )
     {
       FT_Byte*  write = line;
-      FT_Int    w = width;
+      FT_Int    w     = width;
 
 
 
 
+      /* handle initial byte (in target bitmap) specially if necessary */
       if ( x_pos )
       {
         w = ( width < 8 - x_pos ) ? width : 8 - x_pos;
 
       if ( x_pos )
       {
         w = ( width < 8 - x_pos ) ? width : 8 - x_pos;
 
-        if ( nbits < w )
+        if ( h == height )
         {
         {
-          rval  |= *p++;
+          rval  = *p++;
+          nbits = x_pos;
+        }
+        else if ( nbits < w )
+        {
+          if ( p < limit )
+            rval |= *p++;
           nbits += 8 - w;
         }
         else
           nbits += 8 - w;
         }
         else
           nbits  -= w;
         }
 
           nbits  -= w;
         }
 
-        *write++ |= ( ( rval >> nbits ) & 0xFF ) & ~( 0xFF << w );
+        *write++ |= ( ( rval >> nbits ) & 0xFF ) &
+                    ( ~( 0xFF << w ) << ( 8 - w - x_pos ) );
         rval    <<= 8;
 
         w = width - w;
       }
 
         rval    <<= 8;
 
         w = width - w;
       }
 
+      /* handle medial bytes */
       for ( ; w >= 8; w -= 8 )
       {
         rval     |= *p++;
       for ( ; w >= 8; w -= 8 )
       {
         rval     |= *p++;
         rval <<= 8;
       }
 
         rval <<= 8;
       }
 
+      /* handle final byte if necessary */
       if ( w > 0 )
       {
         if ( nbits < w )
         {
       if ( w > 0 )
       {
         if ( nbits < w )
         {
-          rval   |= *p++;
+          if ( p < limit )
+            rval |= *p++;
           *write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );
           nbits  += 8 - w;
 
           *write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );
           nbits  += 8 - w;
 
     FT_Error  error = SFNT_Err_Ok;
     FT_UInt   num_components, nn;
 
     FT_Error  error = SFNT_Err_Ok;
     FT_UInt   num_components, nn;
 
+    FT_Char  horiBearingX = decoder->metrics->horiBearingX;
+    FT_Char  horiBearingY = decoder->metrics->horiBearingY;
+    FT_Byte  horiAdvance  = decoder->metrics->horiAdvance;
+    FT_Char  vertBearingX = decoder->metrics->vertBearingX;
+    FT_Char  vertBearingY = decoder->metrics->vertBearingY;
+    FT_Byte  vertAdvance  = decoder->metrics->vertAdvance;
+
 
     if ( p + 2 > limit )
       goto Fail;
 
     if ( p + 2 > limit )
       goto Fail;
     if ( p + 4 * num_components > limit )
       goto Fail;
 
     if ( p + 4 * num_components > limit )
       goto Fail;
 
+    if ( !decoder->bitmap_allocated )
+    {
+      error = tt_sbit_decoder_alloc_bitmap( decoder );
+      if ( error )
+        goto Exit;
+    }
+
     for ( nn = 0; nn < num_components; nn++ )
     {
       FT_UInt  gindex = FT_NEXT_USHORT( p );
     for ( nn = 0; nn < num_components; nn++ )
     {
       FT_UInt  gindex = FT_NEXT_USHORT( p );
         break;
     }
 
         break;
     }
 
+    decoder->metrics->horiBearingX = horiBearingX;
+    decoder->metrics->horiBearingY = horiBearingY;
+    decoder->metrics->horiAdvance  = horiAdvance;
+    decoder->metrics->vertBearingX = vertBearingX;
+    decoder->metrics->vertBearingY = vertBearingY;
+    decoder->metrics->vertAdvance  = vertAdvance;
+    decoder->metrics->width        = (FT_UInt)decoder->bitmap->width;
+    decoder->metrics->height       = (FT_UInt)decoder->bitmap->rows;
+
   Exit:
     return error;
 
   Exit:
     return error;
 
index 8a792df..a8496aa 100644 (file)
@@ -16,7 +16,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) smooth ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = ftgrays ftsmooth ;
+    _sources = ftgrays ftsmooth ftspic ;
   }
   else
   {
   }
   else
   {
index 5a4a544..4a4d375 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    A new `perfect' anti-aliasing renderer (body).                       */
 /*                                                                         */
 /*                                                                         */
 /*    A new `perfect' anti-aliasing renderer (body).                       */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007 by                   */
+/*  Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 #define FT_COMPONENT  trace_smooth
 
 
 #define FT_COMPONENT  trace_smooth
 
 
+#ifdef _STANDALONE_
 
 
 
 
-#ifdef _STANDALONE_
+  /* define this to dump debugging information */
+/* #define FT_DEBUG_LEVEL_TRACE */
+
 
 
-#include <string.h>             /* for ft_memcpy() */
+#ifdef FT_DEBUG_LEVEL_TRACE
+#include <stdio.h>
+#include <stdarg.h>
+#endif
+
+#include <string.h>
 #include <setjmp.h>
 #include <limits.h>
 #define FT_UINT_MAX  UINT_MAX
 #include <setjmp.h>
 #include <limits.h>
 #define FT_UINT_MAX  UINT_MAX
 #include "ftimage.h"
 #include "ftgrays.h"
 
 #include "ftimage.h"
 #include "ftgrays.h"
 
+
   /* This macro is used to indicate that a function parameter is unused. */
   /* Its purpose is simply to reduce compiler warnings.  Note also that  */
   /* simply defining it as `(void)x' doesn't avoid warnings with certain */
   /* ANSI compilers (e.g. LCC).                                          */
 #define FT_UNUSED( x )  (x) = (x)
 
   /* This macro is used to indicate that a function parameter is unused. */
   /* Its purpose is simply to reduce compiler warnings.  Note also that  */
   /* simply defining it as `(void)x' doesn't avoid warnings with certain */
   /* ANSI compilers (e.g. LCC).                                          */
 #define FT_UNUSED( x )  (x) = (x)
 
-  /* Disable the tracing mechanism for simplicity -- developers can      */
-  /* activate it easily by redefining these two macros.                  */
+
+  /* we only use level 5 & 7 tracing messages; cf. ftdebug.h */
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+  void
+  FT_Message( const char*  fmt,
+              ... )
+  {
+    va_list  ap;
+
+
+    va_start( ap, fmt );
+    vfprintf( stderr, fmt, ap );
+    va_end( ap );
+  }
+
+  /* we don't handle tracing levels in stand-alone mode; */
+#ifndef FT_TRACE5
+#define FT_TRACE5( varformat )  FT_Message varformat
+#endif
+#ifndef FT_TRACE7
+#define FT_TRACE7( varformat )  FT_Message varformat
+#endif
 #ifndef FT_ERROR
 #ifndef FT_ERROR
-#define FT_ERROR( x )  do ; while ( 0 )     /* nothing */
+#define FT_ERROR( varformat )   FT_Message varformat
 #endif
 
 #endif
 
-#ifndef FT_TRACE
-#define FT_TRACE( x )  do ; while ( 0 )     /* nothing */
-#endif
+#else /* !FT_DEBUG_LEVEL_TRACE */
+
+#define FT_TRACE5( x )  do { } while ( 0 )     /* nothing */
+#define FT_TRACE7( x )  do { } while ( 0 )     /* nothing */
+#define FT_ERROR( x )   do { } while ( 0 )     /* nothing */
+
+#endif /* !FT_DEBUG_LEVEL_TRACE */
+
+
+#define FT_DEFINE_OUTLINE_FUNCS( class_,               \
+                                 move_to_, line_to_,   \
+                                 conic_to_, cubic_to_, \
+                                 shift_, delta_ )      \
+          static const FT_Outline_Funcs class_ =       \
+          {                                            \
+            move_to_,                                  \
+            line_to_,                                  \
+            conic_to_,                                 \
+            cubic_to_,                                 \
+            shift_,                                    \
+            delta_                                     \
+         };
+                                          
+#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_,            \
+                                raster_new_, raster_reset_,       \
+                                raster_set_mode_, raster_render_, \
+                                raster_done_ )                    \
+          const FT_Raster_Funcs class_ =                          \
+          {                                                       \
+            glyph_format_,                                        \
+            raster_new_,                                          \
+            raster_reset_,                                        \
+            raster_set_mode_,                                     \
+            raster_render_,                                       \
+            raster_done_                                          \
+         };
 
 #else /* !_STANDALONE_ */
 
 
 #else /* !_STANDALONE_ */
 
+
 #include <ft2build.h>
 #include "ftgrays.h"
 #include FT_INTERNAL_OBJECTS_H
 #include <ft2build.h>
 #include "ftgrays.h"
 #include FT_INTERNAL_OBJECTS_H
 
 #include "ftsmerrs.h"
 
 
 #include "ftsmerrs.h"
 
-#define ErrRaster_Invalid_Mode     Smooth_Err_Cannot_Render_Glyph
-#define ErrRaster_Invalid_Outline  Smooth_Err_Invalid_Outline
-#define ErrRaster_Memory_Overflow  Smooth_Err_Out_Of_Memory
-#define ErrRaster_Invalid_Argument Smooth_Err_Bad_Argument
+#include "ftspic.h"
 
 
-#endif /* !_STANDALONE_ */
+#define ErrRaster_Invalid_Mode      Smooth_Err_Cannot_Render_Glyph
+#define ErrRaster_Invalid_Outline   Smooth_Err_Invalid_Outline
+#define ErrRaster_Memory_Overflow   Smooth_Err_Out_Of_Memory
+#define ErrRaster_Invalid_Argument  Smooth_Err_Invalid_Argument
 
 
+#endif /* !_STANDALONE_ */
 
 #ifndef FT_MEM_SET
 #define FT_MEM_SET( d, s, c )  ft_memset( d, s, c )
 
 #ifndef FT_MEM_SET
 #define FT_MEM_SET( d, s, c )  ft_memset( d, s, c )
 #define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )
 #endif
 
 #define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )
 #endif
 
-  /* define this to dump debugging information */
-#define xxxDEBUG_GRAYS
-
-
   /* as usual, for the speed hungry :-) */
 
 #ifndef FT_STATIC_RASTER
 
   /* as usual, for the speed hungry :-) */
 
 #ifndef FT_STATIC_RASTER
 
-
 #define RAS_ARG   PWorker  worker
 #define RAS_ARG_  PWorker  worker,
 
 #define RAS_VAR   worker
 #define RAS_VAR_  worker,
 
 #define RAS_ARG   PWorker  worker
 #define RAS_ARG_  PWorker  worker,
 
 #define RAS_VAR   worker
 #define RAS_VAR_  worker,
 
-#define ras       (*worker)
-
-
 #else /* FT_STATIC_RASTER */
 
 #else /* FT_STATIC_RASTER */
 
-
 #define RAS_ARG   /* empty */
 #define RAS_ARG_  /* empty */
 #define RAS_VAR   /* empty */
 #define RAS_VAR_  /* empty */
 
 #define RAS_ARG   /* empty */
 #define RAS_ARG_  /* empty */
 #define RAS_VAR   /* empty */
 #define RAS_VAR_  /* empty */
 
-  static TWorker  ras;
-
-
 #endif /* FT_STATIC_RASTER */
 
 
 #endif /* FT_STATIC_RASTER */
 
 
   /* need to define them to "float" or "double" when experimenting with   */
   /* new algorithms                                                       */
 
   /* need to define them to "float" or "double" when experimenting with   */
   /* new algorithms                                                       */
 
-  typedef int   TCoord;   /* integer scanline/pixel coordinate */
+  typedef long  TCoord;   /* integer scanline/pixel coordinate */
   typedef long  TPos;     /* sub-pixel coordinate              */
 
   /* determine the type used to store cell areas.  This normally takes at */
   typedef long  TPos;     /* sub-pixel coordinate              */
 
   /* determine the type used to store cell areas.  This normally takes at */
 
   typedef struct  TCell_
   {
 
   typedef struct  TCell_
   {
-    int    x;
-    int    cover;
+    TPos   x;     /* same with TWorker.ex */
+    TCoord cover; /* same with TWorker.cover */
     TArea  area;
     PCell  next;
 
     TArea  area;
     PCell  next;
 
     TPos    count_ex, count_ey;
 
     TArea   area;
     TPos    count_ex, count_ey;
 
     TArea   area;
-    int     cover;
+    TCoord  cover;
     int     invalid;
 
     PCell   cells;
     int     invalid;
 
     PCell   cells;
-    int     max_cells;
-    int     num_cells;
+    FT_PtrDist  max_cells;
+    FT_PtrDist  num_cells;
 
     TCoord  cx, cy;
     TPos    x,  y;
 
     TCoord  cx, cy;
     TPos    x,  y;
     long        buffer_size;
 
     PCell*     ycells;
     long        buffer_size;
 
     PCell*     ycells;
-    int        ycount;
+    TPos       ycount;
 
   } TWorker, *PWorker;
 
 
 
   } TWorker, *PWorker;
 
 
+#ifndef FT_STATIC_RASTER
+#define ras  (*worker)
+#else
+  static TWorker  ras;
+#endif
+
+
   typedef struct TRaster_
   {
     void*    buffer;
   typedef struct TRaster_
   {
     void*    buffer;
   gray_find_cell( RAS_ARG )
   {
     PCell  *pcell, cell;
   gray_find_cell( RAS_ARG )
   {
     PCell  *pcell, cell;
-    int     x = ras.ex;
+    TPos    x = ras.ex;
 
 
 
 
-    if ( x > ras.max_ex )
-      x = ras.max_ex;
+    if ( x > ras.count_ex )
+      x = ras.count_ex;
 
     pcell = &ras.ycells[ras.ey];
     for (;;)
 
     pcell = &ras.ycells[ras.ey];
     for (;;)
                                  TPos    x2,
                                  TCoord  y2 )
   {
                                  TPos    x2,
                                  TCoord  y2 )
   {
-    TCoord  ex1, ex2, fx1, fx2, delta;
+    TCoord  ex1, ex2, fx1, fx2, delta, mod, lift, rem;
     long    p, first, dx;
     long    p, first, dx;
-    int     incr, lift, mod, rem;
+    int     incr;
 
 
     dx = x2 - x1;
 
 
     dx = x2 - x1;
     if ( ex1 == ex2 )
     {
       delta      = y2 - y1;
     if ( ex1 == ex2 )
     {
       delta      = y2 - y1;
-      ras.area  += (TArea)( fx1 + fx2 ) * delta;
+      ras.area  += (TArea)(( fx1 + fx2 ) * delta);
       ras.cover += delta;
       return;
     }
       ras.cover += delta;
       return;
     }
       mod += (TCoord)dx;
     }
 
       mod += (TCoord)dx;
     }
 
-    ras.area  += (TArea)( fx1 + first ) * delta;
+    ras.area  += (TArea)(( fx1 + first ) * delta);
     ras.cover += delta;
 
     ex1 += incr;
     ras.cover += delta;
 
     ex1 += incr;
           delta++;
         }
 
           delta++;
         }
 
-        ras.area  += (TArea)ONE_PIXEL * delta;
+        ras.area  += (TArea)(ONE_PIXEL * delta);
         ras.cover += delta;
         y1        += delta;
         ex1       += incr;
         ras.cover += delta;
         y1        += delta;
         ex1       += incr;
     }
 
     delta      = y2 - y1;
     }
 
     delta      = y2 - y1;
-    ras.area  += (TArea)( fx2 + ONE_PIXEL - first ) * delta;
+    ras.area  += (TArea)(( fx2 + ONE_PIXEL - first ) * delta);
     ras.cover += delta;
   }
 
     ras.cover += delta;
   }
 
   gray_render_line( RAS_ARG_ TPos  to_x,
                              TPos  to_y )
   {
   gray_render_line( RAS_ARG_ TPos  to_x,
                              TPos  to_y )
   {
-    TCoord  ey1, ey2, fy1, fy2;
+    TCoord  ey1, ey2, fy1, fy2, mod;
     TPos    dx, dy, x, x2;
     long    p, first;
     TPos    dx, dy, x, x2;
     long    p, first;
-    int     delta, rem, mod, lift, incr;
+    int     delta, rem, lift, incr;
 
 
     ey1 = TRUNC( ras.last_ey );
 
 
     ey1 = TRUNC( ras.last_ey );
     {
       TCoord  ex     = TRUNC( ras.x );
       TCoord  two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 );
     {
       TCoord  ex     = TRUNC( ras.x );
       TCoord  two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 );
-      TPos    area;
+      TArea   area;
 
 
       first = ONE_PIXEL;
 
 
       first = ONE_PIXEL;
       ras.cover += delta;
       ey1       += incr;
 
       ras.cover += delta;
       ey1       += incr;
 
-      gray_set_cell( &ras, ex, ey1 );
+      gray_set_cell( RAS_VAR_ ex, ey1 );
 
       delta = (int)( first + first - ONE_PIXEL );
       area  = (TArea)two_fx * delta;
 
       delta = (int)( first + first - ONE_PIXEL );
       area  = (TArea)two_fx * delta;
         ras.cover += delta;
         ey1       += incr;
 
         ras.cover += delta;
         ey1       += incr;
 
-        gray_set_cell( &ras, ex, ey1 );
+        gray_set_cell( RAS_VAR_ ex, ey1 );
       }
 
       delta      = (int)( fy2 - ONE_PIXEL + first );
       }
 
       delta      = (int)( fy2 - ONE_PIXEL + first );
 
 
     /* record current cell, if any */
 
 
     /* record current cell, if any */
-    gray_record_cell( worker );
+    gray_record_cell( RAS_VAR );
 
     /* start to a new position */
     x = UPSCALE( to->x );
     y = UPSCALE( to->y );
 
 
     /* start to a new position */
     x = UPSCALE( to->x );
     y = UPSCALE( to->y );
 
-    gray_start_cell( worker, TRUNC( x ), TRUNC( y ) );
+    gray_start_cell( RAS_VAR_ TRUNC( x ), TRUNC( y ) );
 
     worker->x = x;
     worker->y = y;
 
     worker->x = x;
     worker->y = y;
   gray_line_to( const FT_Vector*  to,
                 PWorker           worker )
   {
   gray_line_to( const FT_Vector*  to,
                 PWorker           worker )
   {
-    gray_render_line( worker, UPSCALE( to->x ), UPSCALE( to->y ) );
+    gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) );
     return 0;
   }
 
     return 0;
   }
 
                  const FT_Vector*  to,
                  PWorker           worker )
   {
                  const FT_Vector*  to,
                  PWorker           worker )
   {
-    gray_render_conic( worker, control, to );
+    gray_render_conic( RAS_VAR_ control, to );
     return 0;
   }
 
     return 0;
   }
 
                  const FT_Vector*  to,
                  PWorker           worker )
   {
                  const FT_Vector*  to,
                  PWorker           worker )
   {
-    gray_render_cubic( worker, control1, control2, to );
+    gray_render_cubic( RAS_VAR_ control1, control2, to );
     return 0;
   }
 
     return 0;
   }
 
   gray_hline( RAS_ARG_ TCoord  x,
                        TCoord  y,
                        TPos    area,
   gray_hline( RAS_ARG_ TCoord  x,
                        TCoord  y,
                        TPos    area,
-                       int     acount )
+                       TCoord  acount )
   {
     FT_Span*  span;
     int       count;
   {
     FT_Span*  span;
     int       count;
     x += (TCoord)ras.min_ex;
 
     /* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
     x += (TCoord)ras.min_ex;
 
     /* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
-    if ( x >= 32768 )
+    if ( x >= 32767 )
       x = 32767;
 
       x = 32767;
 
+    /* FT_Span.y is an integer, so limit our coordinates appropriately */
+    if ( y >= FT_INT_MAX )
+      y = FT_INT_MAX;
+
     if ( coverage )
     {
       /* see whether we can add this span to the current list */
     if ( coverage )
     {
       /* see whether we can add this span to the current list */
         if ( ras.render_span && count > 0 )
           ras.render_span( ras.span_y, count, ras.gray_spans,
                            ras.render_span_data );
         if ( ras.render_span && count > 0 )
           ras.render_span( ras.span_y, count, ras.gray_spans,
                            ras.render_span_data );
-        /* ras.render_span( span->y, ras.gray_spans, count ); */
 
 
-#ifdef DEBUG_GRAYS
+#ifdef FT_DEBUG_LEVEL_TRACE
 
 
-        if ( ras.span_y >= 0 )
+        if ( count > 0 )
         {
           int  n;
 
 
         {
           int  n;
 
 
-          fprintf( stderr, "y=%3d ", ras.span_y );
+          FT_TRACE7(( "y = %3d ", ras.span_y ));
           span = ras.gray_spans;
           for ( n = 0; n < count; n++, span++ )
           span = ras.gray_spans;
           for ( n = 0; n < count; n++, span++ )
-            fprintf( stderr, "[%d..%d]:%02x ",
-                     span->x, span->x + span->len - 1, span->coverage );
-          fprintf( stderr, "\n" );
+            FT_TRACE7(( "[%d..%d]:%02x ",
+                        span->x, span->x + span->len - 1, span->coverage ));
+          FT_TRACE7(( "\n" ));
         }
 
         }
 
-#endif /* DEBUG_GRAYS */
+#endif /* FT_DEBUG_LEVEL_TRACE */
 
         ras.num_gray_spans = 0;
 
         ras.num_gray_spans = 0;
-        ras.span_y         = y;
+        ras.span_y         = (int)y;
 
         count = 0;
         span  = ras.gray_spans;
 
         count = 0;
         span  = ras.gray_spans;
   }
 
 
   }
 
 
-#ifdef DEBUG_GRAYS
+#ifdef FT_DEBUG_LEVEL_TRACE
 
 
-  /* to be called while in the debugger */
+  /* to be called while in the debugger --                                */
+  /* this function causes a compiler warning since it is unused otherwise */
+  static void
   gray_dump_cells( RAS_ARG )
   {
     int  yindex;
   gray_dump_cells( RAS_ARG )
   {
     int  yindex;
       printf( "%3d:", yindex );
 
       for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next )
       printf( "%3d:", yindex );
 
       for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next )
-        printf( " (%3d, c:%4d, a:%6d)", cell->x, cell->cover, cell->area );
+        printf( " (%3ld, c:%4ld, a:%6d)", cell->x, cell->cover, cell->area );
       printf( "\n" );
     }
   }
 
       printf( "\n" );
     }
   }
 
-#endif /* DEBUG_GRAYS */
+#endif /* FT_DEBUG_LEVEL_TRACE */
 
 
   static void
 
 
   static void
 
     ras.num_gray_spans = 0;
 
 
     ras.num_gray_spans = 0;
 
+    FT_TRACE7(( "gray_sweep: start\n" ));
+
     for ( yindex = 0; yindex < ras.ycount; yindex++ )
     {
       PCell   cell  = ras.ycells[yindex];
     for ( yindex = 0; yindex < ras.ycount; yindex++ )
     {
       PCell   cell  = ras.ycells[yindex];
 
       for ( ; cell != NULL; cell = cell->next )
       {
 
       for ( ; cell != NULL; cell = cell->next )
       {
-        TArea  area;
+        TPos  area;
 
 
         if ( cell->x > x && cover != 0 )
 
 
         if ( cell->x > x && cover != 0 )
     if ( ras.render_span && ras.num_gray_spans > 0 )
       ras.render_span( ras.span_y, ras.num_gray_spans,
                        ras.gray_spans, ras.render_span_data );
     if ( ras.render_span && ras.num_gray_spans > 0 )
       ras.render_span( ras.span_y, ras.num_gray_spans,
                        ras.gray_spans, ras.render_span_data );
+
+    FT_TRACE7(( "gray_sweep: end\n" ));
   }
 
 
   }
 
 
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
-  /*  The following function should only compile in stand_alone mode,      */
+  /*  The following function should only compile in stand-alone mode,      */
   /*  i.e., when building this component without the rest of FreeType.     */
   /*                                                                       */
   /*************************************************************************/
   /*  i.e., when building this component without the rest of FreeType.     */
   /*                                                                       */
   /*************************************************************************/
   /*    FT_Outline_Decompose                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    FT_Outline_Decompose                                               */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Walks over an outline's structure to decompose it into individual  */
-  /*    segments and Bezier arcs.  This function is also able to emit      */
+  /*    Walk over an outline's structure to decompose it into individual   */
+  /*    segments and Bzier arcs.  This function is also able to emit      */
   /*    `move to' and `close to' operations to indicate the start and end  */
   /*    of new contours in the outline.                                    */
   /*                                                                       */
   /* <Input>                                                               */
   /*    outline        :: A pointer to the source target.                  */
   /*                                                                       */
   /*    `move to' and `close to' operations to indicate the start and end  */
   /*    of new contours in the outline.                                    */
   /*                                                                       */
   /* <Input>                                                               */
   /*    outline        :: A pointer to the source target.                  */
   /*                                                                       */
-  /*    func_interface :: A table of `emitters', i.e,. function pointers   */
+  /*    func_interface :: A table of `emitters', i.e., function pointers   */
   /*                      called during decomposition to indicate path     */
   /*                      operations.                                      */
   /*                                                                       */
   /*                      called during decomposition to indicate path     */
   /*                      operations.                                      */
   /*                                                                       */
+  /* <InOut>                                                               */
   /*    user           :: A typeless pointer which is passed to each       */
   /*                      emitter during the decomposition.  It can be     */
   /*                      used to store the state during the               */
   /*    user           :: A typeless pointer which is passed to each       */
   /*                      emitter during the decomposition.  It can be     */
   /*                      used to store the state during the               */
   /* <Return>                                                              */
   /*    Error code.  0 means success.                                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Error code.  0 means success.                                      */
   /*                                                                       */
-  static
-  int  FT_Outline_Decompose( const FT_Outline*        outline,
-                             const FT_Outline_Funcs*  func_interface,
-                             void*                    user )
+  static int
+  FT_Outline_Decompose( const FT_Outline*        outline,
+                        const FT_Outline_Funcs*  func_interface,
+                        void*                    user )
   {
 #undef SCALED
   {
 #undef SCALED
-#if 0
 #define SCALED( x )  ( ( (x) << shift ) - delta )
 #define SCALED( x )  ( ( (x) << shift ) - delta )
-#else
-#define SCALED( x )  (x)
-#endif
 
     FT_Vector   v_last;
     FT_Vector   v_control;
 
     FT_Vector   v_last;
     FT_Vector   v_control;
     FT_Vector*  limit;
     char*       tags;
 
     FT_Vector*  limit;
     char*       tags;
 
+    int         error;
+
     int   n;         /* index of contour in outline     */
     int   first;     /* index of first point in contour */
     int   n;         /* index of contour in outline     */
     int   first;     /* index of first point in contour */
-    int   error;
     char  tag;       /* current point's state           */
 
     char  tag;       /* current point's state           */
 
-#if 0
-    int   shift = func_interface->shift;
-    TPos  delta = func_interface->delta;
-#endif
+    int   shift;
+    TPos  delta;
+
 
 
+    if ( !outline || !func_interface )
+      return ErrRaster_Invalid_Argument;
 
 
+    shift = func_interface->shift;
+    delta = func_interface->delta;
     first = 0;
 
     for ( n = 0; n < outline->n_contours; n++ )
     first = 0;
 
     for ( n = 0; n < outline->n_contours; n++ )
       int  last;  /* index of last point in contour */
 
 
       int  last;  /* index of last point in contour */
 
 
+      FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
+
       last  = outline->contours[n];
       last  = outline->contours[n];
+      if ( last < 0 )
+        goto Invalid_Outline;
       limit = outline->points + last;
 
       limit = outline->points + last;
 
-      v_start = outline->points[first];
-      v_last  = outline->points[last];
-
+      v_start   = outline->points[first];
       v_start.x = SCALED( v_start.x );
       v_start.y = SCALED( v_start.y );
 
       v_start.x = SCALED( v_start.x );
       v_start.y = SCALED( v_start.y );
 
-      v_last.x  = SCALED( v_last.x );
-      v_last.y  = SCALED( v_last.y );
+      v_last   = outline->points[last];
+      v_last.x = SCALED( v_last.x );
+      v_last.y = SCALED( v_last.y );
 
       v_control = v_start;
 
       point = outline->points + first;
 
       v_control = v_start;
 
       point = outline->points + first;
-      tags  = outline->tags  + first;
+      tags  = outline->tags   + first;
       tag   = FT_CURVE_TAG( tags[0] );
 
       /* A contour cannot start with a cubic control point! */
       tag   = FT_CURVE_TAG( tags[0] );
 
       /* A contour cannot start with a cubic control point! */
         tags--;
       }
 
         tags--;
       }
 
+      FT_TRACE5(( "  move to (%.2f, %.2f)\n",
+                  v_start.x / 64.0, v_start.y / 64.0 ));
       error = func_interface->move_to( &v_start, user );
       if ( error )
         goto Exit;
       error = func_interface->move_to( &v_start, user );
       if ( error )
         goto Exit;
             vec.x = SCALED( point->x );
             vec.y = SCALED( point->y );
 
             vec.x = SCALED( point->x );
             vec.y = SCALED( point->y );
 
+            FT_TRACE5(( "  line to (%.2f, %.2f)\n",
+                        vec.x / 64.0, vec.y / 64.0 ));
             error = func_interface->line_to( &vec, user );
             if ( error )
               goto Exit;
             error = func_interface->line_to( &vec, user );
             if ( error )
               goto Exit;
           }
 
         case FT_CURVE_TAG_CONIC:  /* consume conic arcs */
           }
 
         case FT_CURVE_TAG_CONIC:  /* consume conic arcs */
-          {
-            v_control.x = SCALED( point->x );
-            v_control.y = SCALED( point->y );
-
-          Do_Conic:
-            if ( point < limit )
-            {
-              FT_Vector  vec;
-              FT_Vector  v_middle;
-
-
-              point++;
-              tags++;
-              tag = FT_CURVE_TAG( tags[0] );
+          v_control.x = SCALED( point->x );
+          v_control.y = SCALED( point->y );
 
 
-              vec.x = SCALED( point->x );
-              vec.y = SCALED( point->y );
+        Do_Conic:
+          if ( point < limit )
+          {
+            FT_Vector  vec;
+            FT_Vector  v_middle;
 
 
-              if ( tag == FT_CURVE_TAG_ON )
-              {
-                error = func_interface->conic_to( &v_control, &vec,
-                                                  user );
-                if ( error )
-                  goto Exit;
-                continue;
-              }
 
 
-              if ( tag != FT_CURVE_TAG_CONIC )
-                goto Invalid_Outline;
+            point++;
+            tags++;
+            tag = FT_CURVE_TAG( tags[0] );
 
 
-              v_middle.x = ( v_control.x + vec.x ) / 2;
-              v_middle.y = ( v_control.y + vec.y ) / 2;
+            vec.x = SCALED( point->x );
+            vec.y = SCALED( point->y );
 
 
-              error = func_interface->conic_to( &v_control, &v_middle,
-                                                user );
+            if ( tag == FT_CURVE_TAG_ON )
+            {
+              FT_TRACE5(( "  conic to (%.2f, %.2f)"
+                          " with control (%.2f, %.2f)\n",
+                          vec.x / 64.0, vec.y / 64.0,
+                          v_control.x / 64.0, v_control.y / 64.0 ));
+              error = func_interface->conic_to( &v_control, &vec, user );
               if ( error )
                 goto Exit;
               if ( error )
                 goto Exit;
-
-              v_control = vec;
-              goto Do_Conic;
+              continue;
             }
 
             }
 
-            error = func_interface->conic_to( &v_control, &v_start,
-                                              user );
-            goto Close;
+            if ( tag != FT_CURVE_TAG_CONIC )
+              goto Invalid_Outline;
+
+            v_middle.x = ( v_control.x + vec.x ) / 2;
+            v_middle.y = ( v_control.y + vec.y ) / 2;
+
+            FT_TRACE5(( "  conic to (%.2f, %.2f)"
+                        " with control (%.2f, %.2f)\n",
+                        v_middle.x / 64.0, v_middle.y / 64.0,
+                        v_control.x / 64.0, v_control.y / 64.0 ));
+            error = func_interface->conic_to( &v_control, &v_middle, user );
+            if ( error )
+              goto Exit;
+
+            v_control = vec;
+            goto Do_Conic;
           }
 
           }
 
+          FT_TRACE5(( "  conic to (%.2f, %.2f)"
+                      " with control (%.2f, %.2f)\n",
+                      v_start.x / 64.0, v_start.y / 64.0,
+                      v_control.x / 64.0, v_control.y / 64.0 ));
+          error = func_interface->conic_to( &v_control, &v_start, user );
+          goto Close;
+
         default:  /* FT_CURVE_TAG_CUBIC */
           {
             FT_Vector  vec1, vec2;
         default:  /* FT_CURVE_TAG_CUBIC */
           {
             FT_Vector  vec1, vec2;
               vec.x = SCALED( point->x );
               vec.y = SCALED( point->y );
 
               vec.x = SCALED( point->x );
               vec.y = SCALED( point->y );
 
+              FT_TRACE5(( "  cubic to (%.2f, %.2f)"
+                          " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+                          vec.x / 64.0, vec.y / 64.0,
+                          vec1.x / 64.0, vec1.y / 64.0,
+                          vec2.x / 64.0, vec2.y / 64.0 ));
               error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
               if ( error )
                 goto Exit;
               continue;
             }
 
               error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
               if ( error )
                 goto Exit;
               continue;
             }
 
+            FT_TRACE5(( "  cubic to (%.2f, %.2f)"
+                        " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
+                        v_start.x / 64.0, v_start.y / 64.0,
+                        vec1.x / 64.0, vec1.y / 64.0,
+                        vec2.x / 64.0, vec2.y / 64.0 ));
             error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
             goto Close;
           }
             error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
             goto Close;
           }
       }
 
       /* close the contour with a line segment */
       }
 
       /* close the contour with a line segment */
+      FT_TRACE5(( "  line to (%.2f, %.2f)\n",
+                  v_start.x / 64.0, v_start.y / 64.0 ));
       error = func_interface->line_to( &v_start, user );
 
    Close:
       error = func_interface->line_to( &v_start, user );
 
    Close:
       first = last + 1;
     }
 
       first = last + 1;
     }
 
+    FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
     return 0;
 
   Exit:
     return 0;
 
   Exit:
+    FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
     return error;
 
   Invalid_Outline:
     return error;
 
   Invalid_Outline:
 
   } TBand;
 
 
   } TBand;
 
-
-  static int
-  gray_convert_glyph_inner( RAS_ARG )
-  {
-    static
-    const FT_Outline_Funcs  func_interface =
-    {
+    FT_DEFINE_OUTLINE_FUNCS(func_interface,
       (FT_Outline_MoveTo_Func) gray_move_to,
       (FT_Outline_LineTo_Func) gray_line_to,
       (FT_Outline_ConicTo_Func)gray_conic_to,
       (FT_Outline_CubicTo_Func)gray_cubic_to,
       0,
       0
       (FT_Outline_MoveTo_Func) gray_move_to,
       (FT_Outline_LineTo_Func) gray_line_to,
       (FT_Outline_ConicTo_Func)gray_conic_to,
       (FT_Outline_CubicTo_Func)gray_cubic_to,
       0,
       0
-    };
+    )
+
+  static int
+  gray_convert_glyph_inner( RAS_ARG )
+  {
 
     volatile int  error = 0;
 
 
     volatile int  error = 0;
 
+#ifdef FT_CONFIG_OPTION_PIC
+      FT_Outline_Funcs func_interface;
+      Init_Class_func_interface(&func_interface);
+#endif
+
     if ( ft_setjmp( ras.jump_buffer ) == 0 )
     {
       error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
       gray_record_cell( RAS_VAR );
     }
     else
     if ( ft_setjmp( ras.jump_buffer ) == 0 )
     {
       error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
       gray_record_cell( RAS_VAR );
     }
     else
-    {
       error = ErrRaster_Memory_Overflow;
       error = ErrRaster_Memory_Overflow;
-    }
 
     return error;
   }
 
     return error;
   }
     ras.count_ex = ras.max_ex - ras.min_ex;
     ras.count_ey = ras.max_ey - ras.min_ey;
 
     ras.count_ex = ras.max_ex - ras.min_ex;
     ras.count_ey = ras.max_ey - ras.min_ey;
 
-    /* simple heuristic used to speed-up the bezier decomposition -- see */
+    /* simple heuristic used to speed up the bezier decomposition -- see */
     /* the code in gray_render_conic() and gray_render_cubic() for more  */
     /* details                                                           */
     ras.conic_level = 32;
     ras.cubic_level = 16;
 
     {
     /* the code in gray_render_conic() and gray_render_cubic() for more  */
     /* details                                                           */
     ras.conic_level = 32;
     ras.cubic_level = 16;
 
     {
-      int level = 0;
+      int  level = 0;
 
 
       if ( ras.count_ex > 24 || ras.count_ey > 24 )
 
 
       if ( ras.count_ex > 24 || ras.count_ey > 24 )
       ras.cubic_level <<= level;
     }
 
       ras.cubic_level <<= level;
     }
 
-    /* setup vertical bands */
+    /* set up vertical bands */
     num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );
     num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );
-    if ( num_bands == 0 )  num_bands = 1;
-    if ( num_bands >= 39 ) num_bands = 39;
+    if ( num_bands == 0 )
+      num_bands = 1;
+    if ( num_bands >= 39 )
+      num_bands = 39;
 
     ras.band_shoot = 0;
 
 
     ras.band_shoot = 0;
 
         /* be some problems.                                     */
         if ( middle == bottom )
         {
         /* be some problems.                                     */
         if ( middle == bottom )
         {
-#ifdef DEBUG_GRAYS
-          fprintf( stderr, "Rotten glyph!\n" );
+#ifdef FT_DEBUG_LEVEL_TRACE
+          FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
 #endif
           return 1;
         }
 #endif
           return 1;
         }
     if ( !raster || !raster->buffer || !raster->buffer_size )
       return ErrRaster_Invalid_Argument;
 
     if ( !raster || !raster->buffer || !raster->buffer_size )
       return ErrRaster_Invalid_Argument;
 
+    if ( !outline )
+      return ErrRaster_Invalid_Outline;
+
     /* return immediately if the outline is empty */
     if ( outline->n_points == 0 || outline->n_contours <= 0 )
       return 0;
 
     /* return immediately if the outline is empty */
     if ( outline->n_points == 0 || outline->n_contours <= 0 )
       return 0;
 
-    if ( !outline || !outline->contours || !outline->points )
+    if ( !outline->contours || !outline->points )
       return ErrRaster_Invalid_Outline;
 
     if ( outline->n_points !=
       return ErrRaster_Invalid_Outline;
 
     if ( outline->n_points !=
     worker = raster->worker;
 
     /* if direct mode is not set, we must have a target bitmap */
     worker = raster->worker;
 
     /* if direct mode is not set, we must have a target bitmap */
-    if ( ( params->flags & FT_RASTER_FLAG_DIRECT ) == 0 )
+    if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
     {
       if ( !target_map )
         return ErrRaster_Invalid_Argument;
     {
       if ( !target_map )
         return ErrRaster_Invalid_Argument;
       return ErrRaster_Invalid_Mode;
 
     /* compute clipping box */
       return ErrRaster_Invalid_Mode;
 
     /* compute clipping box */
-    if ( ( params->flags & FT_RASTER_FLAG_DIRECT ) == 0 )
+    if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
     {
       /* compute clip box from target pixmap */
       ras.clip_box.xMin = 0;
     {
       /* compute clip box from target pixmap */
       ras.clip_box.xMin = 0;
       ras.clip_box.yMax = target_map->rows;
     }
     else if ( params->flags & FT_RASTER_FLAG_CLIP )
       ras.clip_box.yMax = target_map->rows;
     }
     else if ( params->flags & FT_RASTER_FLAG_CLIP )
-    {
       ras.clip_box = params->clip_box;
       ras.clip_box = params->clip_box;
-    }
     else
     {
       ras.clip_box.xMin = -32768L;
     else
     {
       ras.clip_box.xMin = -32768L;
       ras.clip_box.yMax =  32767L;
     }
 
       ras.clip_box.yMax =  32767L;
     }
 
-    gray_init_cells( worker, raster->buffer, raster->buffer_size );
+    gray_init_cells( RAS_VAR_ raster->buffer, raster->buffer_size );
 
 
-    ras.outline   = *outline;
-    ras.num_cells = 0;
-    ras.invalid   = 1;
-    ras.band_size = raster->band_size;
+    ras.outline        = *outline;
+    ras.num_cells      = 0;
+    ras.invalid        = 1;
+    ras.band_size      = raster->band_size;
     ras.num_gray_spans = 0;
 
     ras.num_gray_spans = 0;
 
-    if ( target_map )
-      ras.target = *target_map;
-
-    ras.render_span      = (FT_Raster_Span_Func)gray_render_span;
-    ras.render_span_data = &ras;
-
     if ( params->flags & FT_RASTER_FLAG_DIRECT )
     {
       ras.render_span      = (FT_Raster_Span_Func)params->gray_spans;
       ras.render_span_data = params->user;
     }
     if ( params->flags & FT_RASTER_FLAG_DIRECT )
     {
       ras.render_span      = (FT_Raster_Span_Func)params->gray_spans;
       ras.render_span_data = params->user;
     }
+    else
+    {
+      ras.target           = *target_map;
+      ras.render_span      = (FT_Raster_Span_Func)gray_render_span;
+      ras.render_span_data = &ras;
+    }
 
 
-    return gray_convert_glyph( worker );
+    return gray_convert_glyph( RAS_VAR );
   }
 
 
   }
 
 
-  /**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/
-  /****                         a static object.                  *****/
+  /**** RASTER OBJECT CREATION: In stand-alone mode, we simply use *****/
+  /****                         a static object.                   *****/
 
 #ifdef _STANDALONE_
 
 
 #ifdef _STANDALONE_
 
   }
 
 
   }
 
 
-  const FT_Raster_Funcs  ft_grays_raster =
-  {
+  FT_DEFINE_RASTER_FUNCS(ft_grays_raster,
     FT_GLYPH_FORMAT_OUTLINE,
 
     (FT_Raster_New_Func)     gray_raster_new,
     FT_GLYPH_FORMAT_OUTLINE,
 
     (FT_Raster_New_Func)     gray_raster_new,
     (FT_Raster_Set_Mode_Func)0,
     (FT_Raster_Render_Func)  gray_raster_render,
     (FT_Raster_Done_Func)    gray_raster_done
     (FT_Raster_Set_Mode_Func)0,
     (FT_Raster_Render_Func)  gray_raster_render,
     (FT_Raster_Done_Func)    gray_raster_done
-  };
+  )
 
 
 /* END */
 
 
 /* END */
+
+
+/* Local Variables: */
+/* coding: utf-8    */
+/* End:             */
index 2d40954..f20f55f 100644 (file)
@@ -28,6 +28,7 @@
 #include "ftimage.h"
 #else
 #include <ft2build.h>
 #include "ftimage.h"
 #else
 #include <ft2build.h>
+#include FT_CONFIG_CONFIG_H /* for FT_CONFIG_OPTION_PIC */
 #include FT_IMAGE_H
 #endif
 
 #include FT_IMAGE_H
 #endif
 
index 85d04eb..eed6353 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Anti-aliasing renderer interface (body).                             */
 /*                                                                         */
 /*                                                                         */
 /*    Anti-aliasing renderer interface (body).                             */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 
 
 #include <ft2build.h>
 
 
 #include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_OUTLINE_H
 #include "ftsmooth.h"
 #include "ftgrays.h"
 #include FT_INTERNAL_OBJECTS_H
 #include FT_OUTLINE_H
 #include "ftsmooth.h"
 #include "ftgrays.h"
+#include "ftspic.h"
 
 #include "ftsmerrs.h"
 
 
 #include "ftsmerrs.h"
 
       slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
     }
 
       slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
     }
 
-    /* allocate new one, depends on pixel format */
+    /* allocate new one */
     pitch = width;
     if ( hmul )
     {
     pitch = width;
     if ( hmul )
     {
       }
     }
 
       }
     }
 
+#endif
+
+#if FT_UINT_MAX > 0xFFFFU
+
+    /* Required check is ( pitch * height < FT_ULONG_MAX ),     */
+    /* but we care realistic cases only. Always pitch <= width. */
+    if ( width > 0xFFFFU || height > 0xFFFFU )
+    {
+      FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n",
+                 width, height ));
+      return Smooth_Err_Raster_Overflow;
+    }
+
 #endif
 
     bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
 #endif
 
     bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
 
       for ( hh = height_org; hh > 0; hh-- )
       {
 
       for ( hh = height_org; hh > 0; hh-- )
       {
-        memcpy( write, read, pitch );
+        ft_memcpy( write, read, pitch );
         write += pitch;
 
         write += pitch;
 
-        memcpy( write, read, pitch );
+        ft_memcpy( write, read, pitch );
         write += pitch;
 
         write += pitch;
 
-        memcpy( write, read, pitch );
+        ft_memcpy( write, read, pitch );
         write += pitch;
         read  += pitch;
       }
         write += pitch;
         read  += pitch;
       }
 
     FT_Outline_Translate( outline, x_shift, y_shift );
 
 
     FT_Outline_Translate( outline, x_shift, y_shift );
 
+    /*
+     * XXX: on 16bit system, we return an error for huge bitmap
+     * to prevent an overflow.
+     */
+    if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX )
+      return Smooth_Err_Invalid_Pixel_Size;
+
     if ( error )
       goto Exit;
 
     slot->format      = FT_GLYPH_FORMAT_BITMAP;
     if ( error )
       goto Exit;
 
     slot->format      = FT_GLYPH_FORMAT_BITMAP;
-    slot->bitmap_left = x_left;
-    slot->bitmap_top  = y_top;
+    slot->bitmap_left = (FT_Int)x_left;
+    slot->bitmap_top  = (FT_Int)y_top;
 
   Exit:
     if ( outline && origin )
 
   Exit:
     if ( outline && origin )
   }
 
 
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Renderer_Class  ft_smooth_renderer_class =
-  {
-    {
+  FT_DEFINE_RENDERER(ft_smooth_renderer_class,
+
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       (FT_Module_Constructor)ft_smooth_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
       (FT_Module_Constructor)ft_smooth_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
-    },
+    ,
 
     FT_GLYPH_FORMAT_OUTLINE,
 
 
     FT_GLYPH_FORMAT_OUTLINE,
 
     (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,
 
     (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,
 
-    (FT_Raster_Funcs*)    &ft_grays_raster
-  };
+    (FT_Raster_Funcs*)    &FT_GRAYS_RASTER_GET
+  )
 
 
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Renderer_Class  ft_smooth_lcd_renderer_class =
-  {
-    {
+  FT_DEFINE_RENDERER(ft_smooth_lcd_renderer_class,
+  
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       (FT_Module_Constructor)ft_smooth_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
       (FT_Module_Constructor)ft_smooth_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
-    },
+    ,
 
     FT_GLYPH_FORMAT_OUTLINE,
 
 
     FT_GLYPH_FORMAT_OUTLINE,
 
     (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,
 
     (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,
 
-    (FT_Raster_Funcs*)    &ft_grays_raster
-  };
+    (FT_Raster_Funcs*)    &FT_GRAYS_RASTER_GET
+  )
 
 
+  FT_DEFINE_RENDERER(ft_smooth_lcdv_renderer_class,
 
 
-
-  FT_CALLBACK_TABLE_DEF
-  const FT_Renderer_Class  ft_smooth_lcdv_renderer_class =
-  {
-    {
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       FT_MODULE_RENDERER,
       sizeof( FT_RendererRec ),
 
       (FT_Module_Constructor)ft_smooth_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
       (FT_Module_Constructor)ft_smooth_init,
       (FT_Module_Destructor) 0,
       (FT_Module_Requester)  0
-    },
+    ,
 
     FT_GLYPH_FORMAT_OUTLINE,
 
 
     FT_GLYPH_FORMAT_OUTLINE,
 
     (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,
 
     (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,
     (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,
 
-    (FT_Raster_Funcs*)    &ft_grays_raster
-  };
+    (FT_Raster_Funcs*)    &FT_GRAYS_RASTER_GET
+  )
 
 
 /* END */
 
 
 /* END */
index 62cced4..3708790 100644 (file)
@@ -28,15 +28,15 @@ FT_BEGIN_HEADER
 
 
 #ifndef FT_CONFIG_OPTION_NO_STD_RASTER
 
 
 #ifndef FT_CONFIG_OPTION_NO_STD_RASTER
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_std_renderer_class;
+  FT_DECLARE_RENDERER( ft_std_renderer_class )
 #endif
 
 #ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER
 #endif
 
 #ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_smooth_renderer_class;
+  FT_DECLARE_RENDERER( ft_smooth_renderer_class )
 
 
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_smooth_lcd_renderer_class;
+  FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class )
 
 
-  FT_EXPORT_VAR( const FT_Renderer_Class )  ft_smooth_lcd_v_renderer_class;
+  FT_DECLARE_RENDERER( ft_smooth_lcd_v_renderer_class )
 #endif
 
 
 #endif
 
 
diff --git a/reactos/lib/3rdparty/freetype/src/smooth/ftspic.c b/reactos/lib/3rdparty/freetype/src/smooth/ftspic.c
new file mode 100644 (file)
index 0000000..aa547fc
--- /dev/null
@@ -0,0 +1,97 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftspic.c                                                               */
+/*                                                                         */
+/*    The FreeType position independent code services for smooth module.   */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "ftspic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from ftgrays.c */
+  void FT_Init_Class_ft_grays_raster(FT_Raster_Funcs*);
+
+  void
+  ft_smooth_renderer_class_pic_free(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory memory = library->memory;
+    if ( pic_container->smooth )
+    {
+      SmoothPIC* container = (SmoothPIC*)pic_container->smooth;
+      if(--container->ref_count)
+        return;
+      FT_FREE( container );
+      pic_container->smooth = NULL;
+    }
+  }
+
+
+  FT_Error
+  ft_smooth_renderer_class_pic_init(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    SmoothPIC* container;
+    FT_Memory memory = library->memory;
+
+    /* since this function also serve smooth_lcd and smooth_lcdv renderers, 
+       it implements reference counting */
+    if(pic_container->smooth)
+    {
+      ((SmoothPIC*)pic_container->smooth)->ref_count++;
+      return error;
+    }
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->smooth = container;
+    container->ref_count = 1;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    FT_Init_Class_ft_grays_raster(&container->ft_grays_raster);
+/*Exit:*/
+    if(error)
+      ft_smooth_renderer_class_pic_free(library);
+    return error;
+  }
+
+  /* re-route these init and free functions to the above functions */
+  FT_Error ft_smooth_lcd_renderer_class_pic_init(FT_Library library)
+  {
+    return ft_smooth_renderer_class_pic_init(library);
+  }
+  void ft_smooth_lcd_renderer_class_pic_free(FT_Library library)
+  {
+    ft_smooth_renderer_class_pic_free(library);
+  }
+  FT_Error ft_smooth_lcdv_renderer_class_pic_init(FT_Library library)
+  {
+    return ft_smooth_renderer_class_pic_init(library);
+  }
+  void ft_smooth_lcdv_renderer_class_pic_free(FT_Library library)
+  {
+    ft_smooth_renderer_class_pic_free(library);
+  }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/smooth/ftspic.h b/reactos/lib/3rdparty/freetype/src/smooth/ftspic.h
new file mode 100644 (file)
index 0000000..c7e0ce9
--- /dev/null
@@ -0,0 +1,50 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftspic.h                                                               */
+/*                                                                         */
+/*    The FreeType position independent code services for smooth module.   */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __FTSPIC_H__
+#define __FTSPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_GRAYS_RASTER_GET        ft_grays_raster
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+  typedef struct SmoothPIC_
+  {
+    int ref_count;
+    FT_Raster_Funcs ft_grays_raster;
+  } SmoothPIC;
+
+#define GET_PIC(lib)               ((SmoothPIC*)((lib)->pic_container.smooth))
+#define FT_GRAYS_RASTER_GET        (GET_PIC(library)->ft_grays_raster)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __FTSPIC_H__ */
+
+
+/* END */
index 05ad4ba..47f6c04 100644 (file)
 FTMODULE_H_COMMANDS += SMOOTH_RENDERER
 
 define SMOOTH_RENDERER
 FTMODULE_H_COMMANDS += SMOOTH_RENDERER
 
 define SMOOTH_RENDERER
-$(OPEN_DRIVER)ft_smooth_renderer_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE)
 $(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER)ft_smooth_lcd_renderer_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE)
 $(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER)ft_smooth_lcdv_renderer_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE)
 endef
 
index ff6be3e..a8ac51f 100644 (file)
@@ -19,6 +19,7 @@
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
+#include "ftspic.c"
 #include "ftgrays.c"
 #include "ftsmooth.c"
 
 #include "ftgrays.c"
 #include "ftsmooth.c"
 
index f08919b..19aec50 100644 (file)
@@ -10,7 +10,7 @@
  * accepted if you are using GCC for compilation (and probably by
  * other compilers too).
  *
  * accepted if you are using GCC for compilation (and probably by
  * other compilers too).
  *
- * Author: David Turner, 2005, 2006
+ * Author: David Turner, 2005, 2006, 2008
  *
  * This code is explicitly placed into the public domain.
  *
  *
  * This code is explicitly placed into the public domain.
  *
@@ -26,7 +26,7 @@
 
 #define  LINEBUFF_SIZE  1024
 
 
 #define  LINEBUFF_SIZE  1024
 
-typedef enum
+typedef enum  OutputFormat_
 {
   OUTPUT_LIST = 0,      /* output the list of names, one per line             */
   OUTPUT_WINDOWS_DEF,   /* output a Windows .DEF file for Visual C++ or Mingw */
 {
   OUTPUT_LIST = 0,      /* output the list of names, one per line             */
   OUTPUT_WINDOWS_DEF,   /* output a Windows .DEF file for Visual C++ or Mingw */
@@ -44,7 +44,7 @@ panic( const char*  message )
 }
 
 
 }
 
 
-typedef struct
+typedef struct  NameRec_
 {
   char*         name;
   unsigned int  hash;
 {
   char*         name;
   unsigned int  hash;
@@ -191,7 +191,7 @@ names_dump( FILE*         out,
 
 /* states of the line parser */
 
 
 /* states of the line parser */
 
-typedef enum
+typedef enum  State_
 {
   STATE_START = 0,  /* waiting for FT_EXPORT keyword and return type */
   STATE_TYPE        /* type was read, waiting for function name      */
 {
   STATE_START = 0,  /* waiting for FT_EXPORT keyword and return type */
   STATE_TYPE        /* type was read, waiting for function name      */
diff --git a/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py b/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py
new file mode 100644 (file)
index 0000000..d0f342e
--- /dev/null
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+#
+# Check trace components in FreeType 2 source.
+# Author: suzuki toshiya, 2009
+#
+# This code is explicitly into the public domain.
+
+
+import sys
+import os
+import re
+
+SRC_FILE_LIST   = []
+USED_COMPONENT  = {}
+KNOWN_COMPONENT = {}
+
+SRC_FILE_DIRS   = [ "src" ]
+TRACE_DEF_FILES = [ "include/freetype/internal/fttrace.h" ]
+
+
+# --------------------------------------------------------------
+# Parse command line options
+#
+
+for i in range( 1, len( sys.argv ) ):
+  if sys.argv[i].startswith( "--help" ):
+    print "Usage: %s [option]" % sys.argv[0]
+    print "Search used-but-defined and defined-but-not-used trace_XXX macros"
+    print ""
+    print "  --help:"
+    print "        Show this help"
+    print ""
+    print "  --src-dirs=dir1:dir2:..."
+    print "        Specify the directories of C source files to be checked"
+    print "        Default is %s" % ":".join( SRC_FILE_DIRS )
+    print ""
+    print "  --def-files=file1:file2:..."
+    print "        Specify the header files including FT_TRACE_DEF()"
+    print "        Default is %s" % ":".join( TRACE_DEF_FILES )
+    print ""
+    exit(0)
+  if sys.argv[i].startswith( "--src-dirs=" ):
+    SRC_FILE_DIRS = sys.argv[i].replace( "--src-dirs=", "", 1 ).split( ":" )
+  elif sys.argv[i].startswith( "--def-files=" ):
+    TRACE_DEF_FILES = sys.argv[i].replace( "--def-files=", "", 1 ).split( ":" )
+
+
+# --------------------------------------------------------------
+# Scan C source and header files using trace macros.
+#
+
+c_pathname_pat = re.compile( '^.*\.[ch]$', re.IGNORECASE )
+trace_use_pat  = re.compile( '^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+trace_' )
+
+for d in SRC_FILE_DIRS:
+  for ( p, dlst, flst ) in os.walk( d ):
+    for f in flst:
+      if c_pathname_pat.match( f ) != None:
+        src_pathname = os.path.join( p, f )
+
+        line_num = 0
+        for src_line in open( src_pathname, 'r' ):
+          line_num = line_num + 1
+          src_line = src_line.strip()
+          if trace_use_pat.match( src_line ) != None:
+            component_name = trace_use_pat.sub( '', src_line )
+            if component_name in USED_COMPONENT:
+              USED_COMPONENT[component_name].append( "%s:%d" % ( src_pathname, line_num ) )
+            else:
+              USED_COMPONENT[component_name] = [ "%s:%d" % ( src_pathname, line_num ) ]
+
+
+# --------------------------------------------------------------
+# Scan header file(s) defining trace macros.
+#
+
+trace_def_pat_opn = re.compile( '^.*FT_TRACE_DEF[ \t]*\([ \t]*' )
+trace_def_pat_cls = re.compile( '[ \t\)].*$' )
+
+for f in TRACE_DEF_FILES:
+  line_num = 0
+  for hdr_line in open( f, 'r' ):
+    line_num = line_num + 1
+    hdr_line = hdr_line.strip()
+    if trace_def_pat_opn.match( hdr_line ) != None:
+      component_name = trace_def_pat_opn.sub( '', hdr_line )
+      component_name = trace_def_pat_cls.sub( '', component_name )
+      if component_name in KNOWN_COMPONENT:
+        print "trace component %s is defined twice, see %s and fttrace.h:%d" % \
+          ( component_name, KNOWN_COMPONENT[component_name], line_num )
+      else:
+        KNOWN_COMPONENT[component_name] = "%s:%d" % \
+          ( os.path.basename( f ), line_num )
+
+
+# --------------------------------------------------------------
+# Compare the used and defined trace macros.
+#
+
+print "# Trace component used in the implementations but not defined in fttrace.h."
+cmpnt = USED_COMPONENT.keys()
+cmpnt.sort()
+for c in cmpnt:
+  if c not in KNOWN_COMPONENT:
+    print "Trace component %s (used in %s) is not defined." % ( c, ", ".join( USED_COMPONENT[c] ) )
+
+print "# Trace component is defined but not used in the implementations."
+cmpnt = KNOWN_COMPONENT.keys()
+cmpnt.sort()
+for c in cmpnt:
+  if c not in USED_COMPONENT:
+    if c != "any":
+      print "Trace component %s (defined in %s) is not used." % ( c, KNOWN_COMPONENT[c] )
+
index b14c52e..b398955 100644 (file)
@@ -1,4 +1,5 @@
-#  Content (c) 2002, 2004, 2006, 2007 David Turner <david@freetype.org>
+#  Content (c) 2002, 2004, 2006, 2007, 2008, 2009
+#    David Turner <david@freetype.org>
 #
 #  This file contains routines used to parse the content of documentation
 #  comment blocks and build more structured objects out of them.
 #
 #  This file contains routines used to parse the content of documentation
 #  comment blocks and build more structured objects out of them.
@@ -34,6 +35,13 @@ re_code_end   = re.compile( r"(\s*)}\s*$" )
 re_identifier = re.compile( r'(\w*)' )
 
 
 re_identifier = re.compile( r'(\w*)' )
 
 
+# we collect macros ending in `_H'; while outputting the object data, we use
+# this info together with the object's file location to emit the appropriate
+# header file macro and name before the object itself
+#
+re_header_macro = re.compile( r'^#define\s{1,}(\w{1,}_H)\s{1,}<(.*)>' )
+
+
 #############################################################################
 #
 # The DocCode class is used to store source code lines.
 #############################################################################
 #
 # The DocCode class is used to store source code lines.
@@ -44,11 +52,11 @@ re_identifier = re.compile( r'(\w*)' )
 #   The object is filled line by line by the parser; it strips the leading
 #   "margin" space from each input line before storing it in 'self.lines'.
 #
 #   The object is filled line by line by the parser; it strips the leading
 #   "margin" space from each input line before storing it in 'self.lines'.
 #
-class DocCode:
+class  DocCode:
 
 
-    def __init__( self, margin, lines ):
-        self.lines  = []
-        self.words  = None
+    def  __init__( self, margin, lines ):
+        self.lines = []
+        self.words = None
 
         # remove margin spaces
         for l in lines:
 
         # remove margin spaces
         for l in lines:
@@ -56,15 +64,15 @@ class DocCode:
                 l = l[margin:]
             self.lines.append( l )
 
                 l = l[margin:]
             self.lines.append( l )
 
-    def dump( self, prefix = "", width=60 ):
+    def  dump( self, prefix = "", width = 60 ):
         lines = self.dump_lines( 0, width )
         for l in lines:
             print prefix + l
 
         lines = self.dump_lines( 0, width )
         for l in lines:
             print prefix + l
 
-    def dump_lines( self, margin=0, width=60 ):
+    def  dump_lines( self, margin = 0, width = 60 ):
         result = []
         for l in self.lines:
         result = []
         for l in self.lines:
-            result.append( " "*margin + l )
+            result.append( " " * margin + l )
         return result
 
 
         return result
 
 
@@ -75,34 +83,34 @@ class DocCode:
 #
 #   'self.words' contains the list of words that make up the paragraph
 #
 #
 #   'self.words' contains the list of words that make up the paragraph
 #
-class DocPara:
+class  DocPara:
 
 
-    def __init__( self, lines ):
+    def  __init__( self, lines ):
         self.lines = None
         self.words = []
         for l in lines:
         self.lines = None
         self.words = []
         for l in lines:
-            l = string.strip(l)
+            l = string.strip( l )
             self.words.extend( string.split( l ) )
 
             self.words.extend( string.split( l ) )
 
-    def dump( self, prefix = "", width = 60 ):
+    def  dump( self, prefix = "", width = 60 ):
         lines = self.dump_lines( 0, width )
         for l in lines:
             print prefix + l
 
         lines = self.dump_lines( 0, width )
         for l in lines:
             print prefix + l
 
-    def dump_lines( self, margin=0, width = 60 ):
+    def  dump_lines( self, margin = 0, width = 60 ):
         cur    = ""  # current line
         col    = 0   # current width
         result = []
 
         for word in self.words:
         cur    = ""  # current line
         col    = 0   # current width
         result = []
 
         for word in self.words:
-            ln = len(word)
+            ln = len( word )
             if col > 0:
             if col > 0:
-                ln = ln+1
+                ln = ln + 1
 
             if col + ln > width:
 
             if col + ln > width:
-                result.append( " "*margin + cur )
+                result.append( " " * margin + cur )
                 cur = word
                 cur = word
-                col = len(word)
+                col = len( word )
             else:
                 if col > 0:
                     cur = cur + " "
             else:
                 if col > 0:
                     cur = cur + " "
@@ -110,31 +118,29 @@ class DocPara:
                 col = col + ln
 
         if col > 0:
                 col = col + ln
 
         if col > 0:
-            result.append( " "*margin + cur )
+            result.append( " " * margin + cur )
 
         return result
 
 
 
 
         return result
 
 
 
-
 #############################################################################
 #
 #  The DocField class is used to store a list containing either DocPara or
 #  DocCode objects. Each DocField also has an optional "name" which is used
 #  when the object corresponds to a field or value definition
 #
 #############################################################################
 #
 #  The DocField class is used to store a list containing either DocPara or
 #  DocCode objects. Each DocField also has an optional "name" which is used
 #  when the object corresponds to a field or value definition
 #
-class DocField:
-
-    def __init__( self, name, lines ):
+class  DocField:
 
 
+    def  __init__( self, name, lines ):
         self.name  = name  # can be None for normal paragraphs/sources
         self.name  = name  # can be None for normal paragraphs/sources
-        self.items = []     # list of items
+        self.items = []    # list of items
 
 
-        mode_none  = 0   # start parsing mode
-        mode_code  = 1   # parsing code sequences
-        mode_para  = 3   # parsing normal paragraph
+        mode_none  = 0     # start parsing mode
+        mode_code  = 1     # parsing code sequences
+        mode_para  = 3     # parsing normal paragraph
 
 
-        margin     = -1  # current code sequence indentation
+        margin     = -1    # current code sequence indentation
         cur_lines  = []
 
         # now analyze the markup lines to see if they contain paragraphs,
         cur_lines  = []
 
         # now analyze the markup lines to see if they contain paragraphs,
@@ -142,14 +148,13 @@ class DocField:
         #
         start = 0
         mode  = mode_none
         #
         start = 0
         mode  = mode_none
-        for l in lines:
 
 
+        for l in lines:
             # are we parsing a code sequence ?
             if mode == mode_code:
             # are we parsing a code sequence ?
             if mode == mode_code:
-
                 m = re_code_end.match( l )
                 m = re_code_end.match( l )
-                if m and len(m.group(1)) <= margin:
-                    # that's it, we finised the code sequence
+                if m and len( m.group( 1 ) ) <= margin:
+                    # that's it, we finished the code sequence
                     code = DocCode( 0, cur_lines )
                     self.items.append( code )
                     margin    = -1
                     code = DocCode( 0, cur_lines )
                     self.items.append( code )
                     margin    = -1
@@ -169,9 +174,8 @@ class DocField:
                         cur_lines = []
 
                     # switch to code extraction mode
                         cur_lines = []
 
                     # switch to code extraction mode
-                    margin = len(m.group(1))
+                    margin = len( m.group( 1 ) )
                     mode   = mode_code
                     mode   = mode_code
-
                 else:
                     if not string.split( l ) and cur_lines:
                         # if the line is empty, we end the current paragraph,
                 else:
                     if not string.split( l ) and cur_lines:
                         # if the line is empty, we end the current paragraph,
@@ -188,12 +192,11 @@ class DocField:
             # unexpected end of code sequence
             code = DocCode( margin, cur_lines )
             self.items.append( code )
             # unexpected end of code sequence
             code = DocCode( margin, cur_lines )
             self.items.append( code )
-
         elif cur_lines:
             para = DocPara( cur_lines )
             self.items.append( para )
 
         elif cur_lines:
             para = DocPara( cur_lines )
             self.items.append( para )
 
-    def dump( self, prefix = "" ):
+    def  dump( self, prefix = "" ):
         if self.field:
             print prefix + self.field + " ::"
             prefix = prefix + "----"
         if self.field:
             print prefix + self.field + " ::"
             prefix = prefix + "----"
@@ -205,9 +208,10 @@ class DocField:
             p.dump( prefix )
             first = 0
 
             p.dump( prefix )
             first = 0
 
-    def dump_lines( self, margin=0, width=60 ):
+    def  dump_lines( self, margin = 0, width = 60 ):
         result = []
         nl     = None
         result = []
         nl     = None
+
         for p in self.items:
             if nl:
                 result.append( "" )
         for p in self.items:
             if nl:
                 result.append( "" )
@@ -217,17 +221,19 @@ class DocField:
 
         return result
 
 
         return result
 
+
+
 # this regular expression is used to detect field definitions
 #
 # this regular expression is used to detect field definitions
 #
-re_field  = re.compile( r"\s*(\w*|\w(\w|\.)*\w)\s*::" )
+re_field = re.compile( r"\s*(\w*|\w(\w|\.)*\w)\s*::" )
 
 
 
 
 
 
-class DocMarkup:
+class  DocMarkup:
 
 
-    def __init__( self, tag, lines ):
-        self.tag       = string.lower(tag)
-        self.fields    = []
+    def  __init__( self, tag, lines ):
+        self.tag    = string.lower( tag )
+        self.fields = []
 
         cur_lines = []
         field     = None
 
         cur_lines = []
         field     = None
@@ -245,10 +251,10 @@ class DocMarkup:
                     cur_lines = []
                     field     = None
 
                     cur_lines = []
                     field     = None
 
-                field     = m.group(1)   # record field name
-                ln        = len(m.group(0))
-                l         = " "*ln + l[ln:]
-                cur_lines = [ l ]
+                field     = m.group( 1 )   # record field name
+                ln        = len( m.group( 0 ) )
+                l         = " " * ln + l[ln:]
+                cur_lines = [l]
             else:
                 cur_lines.append( l )
 
             else:
                 cur_lines.append( l )
 
@@ -256,51 +262,48 @@ class DocMarkup:
             f = DocField( field, cur_lines )
             self.fields.append( f )
 
             f = DocField( field, cur_lines )
             self.fields.append( f )
 
-    def get_name( self ):
+    def  get_name( self ):
         try:
             return self.fields[0].items[0].words[0]
         try:
             return self.fields[0].items[0].words[0]
-
         except:
             return None
 
         except:
             return None
 
-    def get_start( self ):
+    def  get_start( self ):
         try:
             result = ""
             for word in self.fields[0].items[0].words:
                 result = result + " " + word
             return result[1:]
         try:
             result = ""
             for word in self.fields[0].items[0].words:
                 result = result + " " + word
             return result[1:]
-
         except:
             return "ERROR"
 
         except:
             return "ERROR"
 
-    def dump( self, margin ):
-        print " "*margin + "<" + self.tag + ">"
+    def  dump( self, margin ):
+        print " " * margin + "<" + self.tag + ">"
         for f in self.fields:
             f.dump( "  " )
         for f in self.fields:
             f.dump( "  " )
-        print " "*margin + "</" + self.tag + ">"
+        print " " * margin + "</" + self.tag + ">"
 
 
 
 
 
 
+class  DocChapter:
 
 
-class DocChapter:
-
-    def __init__( self, block ):
+    def  __init__( self, block ):
         self.block    = block
         self.sections = []
         if block:
         self.block    = block
         self.sections = []
         if block:
-            self.name     = block.name
-            self.title    = block.get_markup_words( "title" )
-            self.order    = block.get_markup_words( "sections" )
+            self.name  = block.name
+            self.title = block.get_markup_words( "title" )
+            self.order = block.get_markup_words( "sections" )
         else:
         else:
-            self.name     = "Other"
-            self.title    = string.split( "Miscellaneous" )
-            self.order    = []
+            self.name  = "Other"
+            self.title = string.split( "Miscellaneous" )
+            self.order = []
 
 
 
 
 
 
-class DocSection:
+class  DocSection:
 
 
-    def __init__( self, name = "Other" ):
+    def  __init__( self, name = "Other" ):
         self.name        = name
         self.blocks      = {}
         self.block_names = []  # ordered block names in section
         self.name        = name
         self.blocks      = {}
         self.block_names = []  # ordered block names in section
@@ -311,15 +314,15 @@ class DocSection:
         self.title       = "ERROR"
         self.chapter     = None
 
         self.title       = "ERROR"
         self.chapter     = None
 
-    def add_def( self, block ):
+    def  add_def( self, block ):
         self.defs.append( block )
 
         self.defs.append( block )
 
-    def add_block( self, block ):
+    def  add_block( self, block ):
         self.block_names.append( block.name )
         self.block_names.append( block.name )
-        self.blocks[ block.name ] = block
+        self.blocks[block.name] = block
 
 
-    def process( self ):
-        # lookup one block that contains a valid section description
+    def  process( self ):
+        # look up one block that contains a valid section description
         for block in self.defs:
             title = block.get_markup_text( "title" )
             if title:
         for block in self.defs:
             title = block.get_markup_text( "title" )
             if title:
@@ -329,49 +332,51 @@ class DocSection:
                 self.order       = block.get_markup_words( "order" )
                 return
 
                 self.order       = block.get_markup_words( "order" )
                 return
 
-    def reorder( self ):
-
+    def  reorder( self ):
         self.block_names = sort_order_list( self.block_names, self.order )
 
 
         self.block_names = sort_order_list( self.block_names, self.order )
 
 
-class ContentProcessor:
 
 
-    def __init__( self ):
+class  ContentProcessor:
+
+    def  __init__( self ):
         """initialize a block content processor"""
         self.reset()
 
         self.sections = {}    # dictionary of documentation sections
         self.section  = None  # current documentation section
 
         """initialize a block content processor"""
         self.reset()
 
         self.sections = {}    # dictionary of documentation sections
         self.section  = None  # current documentation section
 
-        self.chapters = []        # list of chapters
+        self.chapters = []    # list of chapters
+
+        self.headers  = {}    # dictionary of header macros
 
 
-    def set_section( self, section_name ):
+    def  set_section( self, section_name ):
         """set current section during parsing"""
         if not self.sections.has_key( section_name ):
             section = DocSection( section_name )
         """set current section during parsing"""
         if not self.sections.has_key( section_name ):
             section = DocSection( section_name )
-            self.sections[ section_name ] = section
-            self.section                  = section
+            self.sections[section_name] = section
+            self.section                = section
         else:
         else:
-            self.section = self.sections[ section_name ]
+            self.section = self.sections[section_name]
 
 
-    def add_chapter( self, block ):
+    def  add_chapter( self, block ):
         chapter = DocChapter( block )
         self.chapters.append( chapter )
 
 
         chapter = DocChapter( block )
         self.chapters.append( chapter )
 
 
-    def reset( self ):
+    def  reset( self ):
         """reset the content processor for a new block"""
         self.markups      = []
         self.markup       = None
         self.markup_lines = []
 
         """reset the content processor for a new block"""
         self.markups      = []
         self.markup       = None
         self.markup_lines = []
 
-    def add_markup( self ):
+    def  add_markup( self ):
         """add a new markup section"""
         if self.markup and self.markup_lines:
 
             # get rid of last line of markup if it's empty
             marks = self.markup_lines
         """add a new markup section"""
         if self.markup and self.markup_lines:
 
             # get rid of last line of markup if it's empty
             marks = self.markup_lines
-            if len(marks) > 0 and not string.strip(marks[-1]):
+            if len( marks ) > 0 and not string.strip( marks[-1] ):
                 self.markup_lines = marks[:-1]
 
             m = DocMarkup( self.markup, self.markup_lines )
                 self.markup_lines = marks[:-1]
 
             m = DocMarkup( self.markup, self.markup_lines )
@@ -381,8 +386,7 @@ class ContentProcessor:
             self.markup       = None
             self.markup_lines = []
 
             self.markup       = None
             self.markup_lines = []
 
-
-    def process_content( self, content ):
+    def  process_content( self, content ):
         """process a block content and return a list of DocMarkup objects
            corresponding to it"""
         markup       = None
         """process a block content and return a list of DocMarkup objects
            corresponding to it"""
         markup       = None
@@ -394,9 +398,9 @@ class ContentProcessor:
             for t in re_markup_tags:
                 m = t.match( line )
                 if m:
             for t in re_markup_tags:
                 m = t.match( line )
                 if m:
-                    found  = string.lower(m.group(1))
-                    prefix = len(m.group(0))
-                    line   = " "*prefix + line[prefix:]   # remove markup from line
+                    found  = string.lower( m.group( 1 ) )
+                    prefix = len( m.group( 0 ) )
+                    line   = " " * prefix + line[prefix:]   # remove markup from line
                     break
 
             # is it the start of a new markup section ?
                     break
 
             # is it the start of a new markup section ?
@@ -404,7 +408,7 @@ class ContentProcessor:
                 first = 0
                 self.add_markup()  # add current markup content
                 self.markup = found
                 first = 0
                 self.add_markup()  # add current markup content
                 self.markup = found
-                if len(string.strip( line )) > 0:
+                if len( string.strip( line ) ) > 0:
                     self.markup_lines.append( line )
             elif first == 0:
                 self.markup_lines.append( line )
                     self.markup_lines.append( line )
             elif first == 0:
                 self.markup_lines.append( line )
@@ -413,28 +417,25 @@ class ContentProcessor:
 
         return self.markups
 
 
         return self.markups
 
-
     def  parse_sources( self, source_processor ):
         blocks = source_processor.blocks
     def  parse_sources( self, source_processor ):
         blocks = source_processor.blocks
-        count  = len(blocks)
-        for n in range(count):
+        count  = len( blocks )
 
 
+        for n in range( count ):
             source = blocks[n]
             if source.content:
                 # this is a documentation comment, we need to catch
                 # all following normal blocks in the "follow" list
                 #
                 follow = []
             source = blocks[n]
             if source.content:
                 # this is a documentation comment, we need to catch
                 # all following normal blocks in the "follow" list
                 #
                 follow = []
-                m = n+1
+                m = n + 1
                 while m < count and not blocks[m].content:
                     follow.append( blocks[m] )
                 while m < count and not blocks[m].content:
                     follow.append( blocks[m] )
-                    m = m+1
+                    m = m + 1
 
                 doc_block = DocBlock( source, follow, self )
 
 
                 doc_block = DocBlock( source, follow, self )
 
-
     def  finish( self ):
     def  finish( self ):
-
         # process all sections to extract their abstract, description
         # and ordered list of items
         #
         # process all sections to extract their abstract, description
         # and ordered list of items
         #
@@ -445,13 +446,13 @@ class ContentProcessor:
         # listed there
         for chap in self.chapters:
             for sec in chap.order:
         # listed there
         for chap in self.chapters:
             for sec in chap.order:
-                if self.sections.has_key(sec):
-                    section = self.sections[ sec ]
+                if self.sections.has_key( sec ):
+                    section = self.sections[sec]
                     section.chapter = chap
                     section.reorder()
                     chap.sections.append( section )
                 else:
                     section.chapter = chap
                     section.reorder()
                     chap.sections.append( section )
                 else:
-                    sys.stderr.write( "WARNING: chapter '" +
+                    sys.stderr.write( "WARNING: chapter '" +          \
                         chap.name + "' in " + chap.block.location() + \
                         " lists unknown section '" + sec + "'\n" )
 
                         chap.name + "' in " + chap.block.location() + \
                         " lists unknown section '" + sec + "'\n" )
 
@@ -460,7 +461,7 @@ class ContentProcessor:
         others = []
         for sec in self.sections.values():
             if not sec.chapter:
         others = []
         for sec in self.sections.values():
             if not sec.chapter:
-                others.append(sec)
+                others.append( sec )
 
         # create a new special chapter for all remaining sections
         # when necessary
 
         # create a new special chapter for all remaining sections
         # when necessary
@@ -472,18 +473,17 @@ class ContentProcessor:
 
 
 
 
 
 
-class DocBlock:
-
-    def __init__( self, source, follow, processor ):
+class  DocBlock:
 
 
+    def  __init__( self, source, follow, processor ):
         processor.reset()
 
         processor.reset()
 
-        self.source    = source
-        self.code      = []
-        self.type      = "ERRTYPE"
-        self.name      = "ERRNAME"
-        self.section   = processor.section
-        self.markups   = processor.process_content( source.content )
+        self.source  = source
+        self.code    = []
+        self.type    = "ERRTYPE"
+        self.name    = "ERRNAME"
+        self.section = processor.section
+        self.markups = processor.process_content( source.content )
 
         # compute block type from first markup tag
         try:
 
         # compute block type from first markup tag
         try:
@@ -491,7 +491,6 @@ class DocBlock:
         except:
             pass
 
         except:
             pass
 
-
         # compute block name from first markup paragraph
         try:
             markup = self.markups[0]
         # compute block name from first markup paragraph
         try:
             markup = self.markups[0]
@@ -499,20 +498,18 @@ class DocBlock:
             name   = para.words[0]
             m = re_identifier.match( name )
             if m:
             name   = para.words[0]
             m = re_identifier.match( name )
             if m:
-                name = m.group(1)
+                name = m.group( 1 )
             self.name = name
         except:
             pass
 
             self.name = name
         except:
             pass
 
-        # detect new section starts
         if self.type == "section":
         if self.type == "section":
+            # detect new section starts
             processor.set_section( self.name )
             processor.section.add_def( self )
             processor.set_section( self.name )
             processor.section.add_def( self )
-
-        # detect new chapter
         elif self.type == "chapter":
         elif self.type == "chapter":
+            # detect new chapter
             processor.add_chapter( self )
             processor.add_chapter( self )
-
         else:
             processor.section.add_block( self )
 
         else:
             processor.section.add_block( self )
 
@@ -523,6 +520,11 @@ class DocBlock:
             if b.format:
                 break
             for l in b.lines:
             if b.format:
                 break
             for l in b.lines:
+                # collect header macro definitions
+                m = re_header_macro.match( l )
+                if m:
+                    processor.headers[m.group( 2 )] = m.group( 1 );
+
                 # we use "/* */" as a separator
                 if re_source_sep.match( l ):
                     break
                 # we use "/* */" as a separator
                 if re_source_sep.match( l ):
                     break
@@ -530,7 +532,7 @@ class DocBlock:
 
         # now strip the leading and trailing empty lines from the sources
         start = 0
 
         # now strip the leading and trailing empty lines from the sources
         start = 0
-        end   = len( source )-1
+        end   = len( source ) - 1
 
         while start < end and not string.strip( source[start] ):
             start = start + 1
 
         while start < end and not string.strip( source[start] ):
             start = start + 1
@@ -538,25 +540,22 @@ class DocBlock:
         while start < end and not string.strip( source[end] ):
             end = end - 1
 
         while start < end and not string.strip( source[end] ):
             end = end - 1
 
-        source = source[start:end+1]
-
-        self.code = source
-
+        if start == end and not string.strip( source[start] ):
+            self.code = []
+        else:
+            self.code = source[start:end + 1]
 
 
-    def location( self ):
+    def  location( self ):
         return self.source.location()
 
         return self.source.location()
 
-
-
-    def get_markup( self, tag_name ):
+    def  get_markup( self, tag_name ):
         """return the DocMarkup corresponding to a given tag in a block"""
         for m in self.markups:
         """return the DocMarkup corresponding to a given tag in a block"""
         for m in self.markups:
-            if m.tag == string.lower(tag_name):
+            if m.tag == string.lower( tag_name ):
                 return m
         return None
 
                 return m
         return None
 
-
-    def get_markup_name( self, tag_name ):
+    def  get_markup_name( self, tag_name ):
         """return the name of a given primary markup in a block"""
         try:
             m = self.get_markup( tag_name )
         """return the name of a given primary markup in a block"""
         try:
             m = self.get_markup( tag_name )
@@ -564,21 +563,18 @@ class DocBlock:
         except:
             return None
 
         except:
             return None
 
-
-    def get_markup_words( self, tag_name ):
+    def  get_markup_words( self, tag_name ):
         try:
             m = self.get_markup( tag_name )
             return m.fields[0].items[0].words
         except:
             return []
 
         try:
             m = self.get_markup( tag_name )
             return m.fields[0].items[0].words
         except:
             return []
 
-
-    def get_markup_text( self, tag_name ):
+    def  get_markup_text( self, tag_name ):
         result = self.get_markup_words( tag_name )
         return string.join( result )
 
         result = self.get_markup_words( tag_name )
         return string.join( result )
 
-
-    def get_markup_items( self, tag_name ):
+    def  get_markup_items( self, tag_name ):
         try:
             m = self.get_markup( tag_name )
             return m.fields[0].items
         try:
             m = self.get_markup( tag_name )
             return m.fields[0].items
index 55c4329..3ddf4a9 100644 (file)
@@ -1,23 +1,24 @@
 #!/usr/bin/env python
 #
 #!/usr/bin/env python
 #
-#  DocBeauty (c) 2003, 2004 David Turner <david@freetype.org>
+#  DocBeauty (c) 2003, 2004, 2008 David Turner <david@freetype.org>
 #
 # This program is used to beautify the documentation comments used
 # in the FreeType 2 public headers.
 #
 
 #
 # 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 *
+from sources import *
+from content import *
+from utils   import *
 
 import utils
 
 import sys, os, time, string, getopt
 
 
 import utils
 
 import sys, os, time, string, getopt
 
+
 content_processor = ContentProcessor()
 
 
 content_processor = ContentProcessor()
 
 
-def beautify_block( block ):
+def  beautify_block( block ):
     if block.content:
         content_processor.reset()
 
     if block.content:
         content_processor.reset()
 
@@ -30,7 +31,7 @@ def beautify_block( block ):
             first = 0
 
         # now beautify the documentation "borders" themselves
             first = 0
 
         # now beautify the documentation "borders" themselves
-        lines = [ " /*************************************************************************" ]
+        lines = [" /*************************************************************************"]
         for l in text:
             lines.append( "  *" + l )
         lines.append( "  */" )
         for l in text:
             lines.append( "  *" + l )
         lines.append( "  */" )
@@ -38,9 +39,9 @@ def beautify_block( block ):
         block.lines = lines
 
 
         block.lines = lines
 
 
-def usage():
+def  usage():
     print "\nDocBeauty 0.1 Usage information\n"
     print "\nDocBeauty 0.1 Usage information\n"
-    print "  docbeauty [options] file1 [ file2 ... ]\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 "using the following options:\n"
     print "  -h : print this page"
     print "  -b : backup original files with the 'orig' extension"
@@ -48,16 +49,15 @@ def usage():
     print "  --backup : same as -b"
 
 
     print "  --backup : same as -b"
 
 
-def main( argv ):
+def  main( argv ):
     """main program loop"""
 
     global output_dir
 
     try:
     """main program loop"""
 
     global output_dir
 
     try:
-        opts, args = getopt.getopt( sys.argv[1:],
-                                    "hb",
-                                    [ "help", "backup" ] )
-
+        opts, args = getopt.getopt( sys.argv[1:], \
+                                    "hb",         \
+                                    ["help", "backup"] )
     except getopt.GetoptError:
         usage()
         sys.exit( 2 )
     except getopt.GetoptError:
         usage()
         sys.exit( 2 )
@@ -80,16 +80,19 @@ def main( argv ):
             do_backup = 1
 
     # create context and processor
             do_backup = 1
 
     # create context and processor
-    source_processor  = SourceProcessor()
+    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 )
 
     # 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 )
         for block in source_processor.blocks:
             beautify_block( block )
+
         new_name = filename + ".new"
         ok       = None
         new_name = filename + ".new"
         ok       = None
+
         try:
             file = open( new_name, "wt" )
             for block in source_processor.blocks:
         try:
             file = open( new_name, "wt" )
             for block in source_processor.blocks:
@@ -100,6 +103,7 @@ def main( argv ):
         except:
             ok = 0
 
         except:
             ok = 0
 
+
 # if called from the command line
 #
 if __name__ == '__main__':
 # if called from the command line
 #
 if __name__ == '__main__':
index d34b6e8..1d9de9f 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
 #!/usr/bin/env python
 #
-#  DocMaker (c) 2002, 2004 David Turner <david@freetype.org>
+#  DocMaker (c) 2002, 2004, 2008 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
 #
 # This program is a re-write of the original DocMaker took used
 # to generate the API Reference of the FreeType font engine
@@ -24,9 +24,9 @@ import utils
 import sys, os, time, string, glob, getopt
 
 
 import sys, os, time, string, glob, getopt
 
 
-def usage():
+def  usage():
     print "\nDocMaker Usage information\n"
     print "\nDocMaker Usage information\n"
-    print "  docmaker [options] file1 [ file2 ... ]\n"
+    print "  docmaker [options] file1 [file2 ...]\n"
     print "using the following options:\n"
     print "  -h : print this page"
     print "  -t : set project title, as in '-t \"My Project\"'"
     print "using the following options:\n"
     print "  -h : print this page"
     print "  -t : set project title, as in '-t \"My Project\"'"
@@ -38,16 +38,15 @@ def usage():
     print "  --prefix : same as -p, as in '--prefix=ft2'"
 
 
     print "  --prefix : same as -p, as in '--prefix=ft2'"
 
 
-def main( argv ):
+def  main( argv ):
     """main program loop"""
 
     global output_dir
 
     try:
     """main program loop"""
 
     global output_dir
 
     try:
-        opts, args = getopt.getopt( sys.argv[1:],
-                                    "ht:o:p:",
-                                    [ "help", "title=", "output=", "prefix=" ] )
-
+        opts, args = getopt.getopt( sys.argv[1:], \
+                                    "ht:o:p:",    \
+                                    ["help", "title=", "output=", "prefix="] )
     except getopt.GetoptError:
         usage()
         sys.exit( 2 )
     except getopt.GetoptError:
         usage()
         sys.exit( 2 )
@@ -76,7 +75,7 @@ def main( argv ):
         if opt[0] in ( "-p", "--prefix" ):
             project_prefix = opt[1]
 
         if opt[0] in ( "-p", "--prefix" ):
             project_prefix = opt[1]
 
-    check_output( )
+    check_output()
 
     # create context and processor
     source_processor  = SourceProcessor()
 
     # create context and processor
     source_processor  = SourceProcessor()
index 363410e..f62ce67 100644 (file)
@@ -1,4 +1,4 @@
-#  Formatter (c) 2002, 2004, 2007 David Turner <david@freetype.org>
+#  Formatter (c) 2002, 2004, 2007, 2008 David Turner <david@freetype.org>
 #
 
 from sources import *
 #
 
 from sources import *
@@ -14,10 +14,9 @@ from utils   import *
 # used to output -- you guessed it -- HTML.
 #
 
 # used to output -- you guessed it -- HTML.
 #
 
-class Formatter:
-
-    def __init__( self, processor ):
+class  Formatter:
 
 
+    def  __init__( self, processor ):
         self.processor   = processor
         self.identifiers = {}
         self.chapters    = processor.chapters
         self.processor   = processor
         self.identifiers = {}
         self.chapters    = processor.chapters
@@ -25,7 +24,7 @@ class Formatter:
         self.block_index = []
 
         # store all blocks in a dictionary
         self.block_index = []
 
         # store all blocks in a dictionary
-        self.blocks      = []
+        self.blocks = []
         for section in self.sections:
             for block in section.blocks.values():
                 self.add_identifier( block.name, block )
         for section in self.sections:
             for block in section.blocks.values():
                 self.add_identifier( block.name, block )
@@ -36,26 +35,22 @@ class Formatter:
                         for field in markup.fields:
                             self.add_identifier( field.name, block )
 
                         for field in markup.fields:
                             self.add_identifier( field.name, block )
 
-
         self.block_index = self.identifiers.keys()
         self.block_index.sort( index_sort )
 
         self.block_index = self.identifiers.keys()
         self.block_index.sort( index_sort )
 
-
-    def add_identifier( self, name, block ):
+    def  add_identifier( self, name, block ):
         if self.identifiers.has_key( name ):
         if self.identifiers.has_key( name ):
-            # duplicate name !!
-            sys.stderr.write( \
+            # duplicate name!
+            sys.stderr.write(                                           \
                "WARNING: duplicate definition for '" + name + "' in " + \
                block.location() + ", previous definition in " +         \
                "WARNING: duplicate definition for '" + name + "' in " + \
                block.location() + ", previous definition in " +         \
-               self.identifiers[ name ].location() + "\n" )
+               self.identifiers[name].location() + "\n" )
         else:
             self.identifiers[name] = block
 
         else:
             self.identifiers[name] = block
 
-
     #
     #  Formatting the table of contents
     #
     #
     #  Formatting the table of contents
     #
-
     def  toc_enter( self ):
         pass
 
     def  toc_enter( self ):
         pass
 
@@ -78,7 +73,6 @@ class Formatter:
         pass
 
     def  toc_dump( self, toc_filename = None, index_filename = None ):
         pass
 
     def  toc_dump( self, toc_filename = None, index_filename = None ):
-
         output = None
         if toc_filename:
             output = open_output( toc_filename )
         output = None
         if toc_filename:
             output = open_output( toc_filename )
@@ -93,7 +87,7 @@ class Formatter:
                 self.toc_section_enter( section )
                 self.toc_section_exit( section )
 
                 self.toc_section_enter( section )
                 self.toc_section_exit( section )
 
-            self.toc_chapter_exit ( chap )
+            self.toc_chapter_exit( chap )
 
         self.toc_index( index_filename )
 
 
         self.toc_index( index_filename )
 
@@ -105,7 +99,6 @@ class Formatter:
     #
     #  Formatting the index
     #
     #
     #  Formatting the index
     #
-
     def  index_enter( self ):
         pass
 
     def  index_enter( self ):
         pass
 
@@ -119,7 +112,6 @@ class Formatter:
         pass
 
     def  index_dump( self, index_filename = None ):
         pass
 
     def  index_dump( self, index_filename = None ):
-
         output = None
         if index_filename:
             output = open_output( index_filename )
         output = None
         if index_filename:
             output = open_output( index_filename )
@@ -128,7 +120,7 @@ class Formatter:
 
         for name in self.block_index:
             self.index_name_enter( name )
 
         for name in self.block_index:
             self.index_name_enter( name )
-            self.index_name_exit ( name )
+            self.index_name_exit( name )
 
         self.index_exit()
 
 
         self.index_exit()
 
@@ -162,9 +154,7 @@ class Formatter:
     def  section_exit( self, section ):
         pass
 
     def  section_exit( self, section ):
         pass
 
-
     def  section_dump( self, section, section_filename = None ):
     def  section_dump( self, section, section_filename = None ):
-
         output = None
         if section_filename:
             output = open_output( section_filename )
         output = None
         if section_filename:
             output = open_output( section_filename )
@@ -172,33 +162,27 @@ class Formatter:
         self.section_enter( section )
 
         for name in section.block_names:
         self.section_enter( section )
 
         for name in section.block_names:
-            block = self.identifiers[ name ]
+            block = self.identifiers[name]
             self.block_enter( block )
 
             self.block_enter( block )
 
-            for markup in block.markups[1:]:   # always ignore first markup !!
+            for markup in block.markups[1:]:   # always ignore first markup!
                 self.markup_enter( markup, block )
 
                 for field in markup.fields:
                     self.field_enter( field, markup, block )
                 self.markup_enter( markup, block )
 
                 for field in markup.fields:
                     self.field_enter( field, markup, block )
-
-                    self.field_exit ( field, markup, block )
+                    self.field_exit( field, markup, block )
 
                 self.markup_exit( markup, block )
 
             self.block_exit( block )
 
 
                 self.markup_exit( markup, block )
 
             self.block_exit( block )
 
-        self.section_exit ( section )
+        self.section_exit( section )
 
         if output:
             close_output( output )
 
 
         if output:
             close_output( output )
 
-
-    def section_dump_all( self ):
+    def  section_dump_all( self ):
         for section in self.sections:
             self.section_dump( section )
 
         for section in self.sections:
             self.section_dump( section )
 
-    #
-    #  Formatting a block
-    #
-
 # eof
 # eof
index 09ff7f9..7b68c07 100644 (file)
@@ -1,4 +1,4 @@
-#  Sources (c) 2002, 2003, 2004, 2006, 2007
+#  Sources (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009
 #    David Turner <david@freetype.org>
 #
 #
 #    David Turner <david@freetype.org>
 #
 #
 # the classes and methods found here only deal with text parsing
 # and basic documentation block extraction
 #
 # the classes and methods found here only deal with text parsing
 # and basic documentation block extraction
 #
-import fileinput, re, sys, os, string
-
-
 
 
+import fileinput, re, sys, os, string
 
 
 
 
 
 
@@ -36,11 +34,10 @@ import fileinput, re, sys, os, string
 ##   note that the 'column' pattern must contain a group that will
 ##   be used to "unbox" the content of documentation comment blocks
 ##
 ##   note that the 'column' pattern must contain a group that will
 ##   be used to "unbox" the content of documentation comment blocks
 ##
-class SourceBlockFormat:
+class  SourceBlockFormat:
 
 
-    def __init__( self, id, start, column, end ):
+    def  __init__( self, id, start, column, end ):
         """create a block pattern, used to recognize special documentation blocks"""
         """create a block pattern, used to recognize special documentation blocks"""
-
         self.id     = id
         self.start  = re.compile( start, re.VERBOSE )
         self.column = re.compile( column, re.VERBOSE )
         self.id     = id
         self.start  = re.compile( start, re.VERBOSE )
         self.column = re.compile( column, re.VERBOSE )
@@ -61,9 +58,9 @@ class SourceBlockFormat:
 #
 
 start = r'''
 #
 
 start = r'''
-  \s*       # any number of whitespace
-  /\*{2,}/  # followed by '/' and at least two asterisks then '/'
-  \s*$      # eventually followed by whitespace
+  \s*      # any number of whitespace
+  /\*{2,}/ # followed by '/' and at least two asterisks then '/'
+  \s*$     # probably followed by whitespace
 '''
 
 column = r'''
 '''
 
 column = r'''
@@ -71,11 +68,12 @@ column = r'''
   /\*{1}   # followed by '/' and precisely one asterisk
   ([^*].*) # followed by anything (group 1)
   \*{1}/   # followed by one asterisk and a '/'
   /\*{1}   # followed by '/' and precisely one asterisk
   ([^*].*) # followed by anything (group 1)
   \*{1}/   # followed by one asterisk and a '/'
-  \s*$     # eventually followed by whitespace
+  \s*$     # probably followed by whitespace
 '''
 
 re_source_block_format1 = SourceBlockFormat( 1, start, column, start )
 
 '''
 
 re_source_block_format1 = SourceBlockFormat( 1, start, column, start )
 
+
 #
 # format 2 documentation comment blocks look like the following:
 #
 #
 # format 2 documentation comment blocks look like the following:
 #
@@ -91,27 +89,28 @@ re_source_block_format1 = SourceBlockFormat( 1, start, column, start )
 start = r'''
   \s*     # any number of whitespace
   /\*{2,} # followed by '/' and at least two asterisks
 start = r'''
   \s*     # any number of whitespace
   /\*{2,} # followed by '/' and at least two asterisks
-  \s*$    # eventually followed by whitespace
+  \s*$    # probably followed by whitespace
 '''
 
 column = r'''
 '''
 
 column = r'''
-  \s*         # any number of whitespace
-  \*{1}(?!/)  # followed by precisely one asterisk not followed by `/'
-  (.*)        # then anything (group1)
+  \s*        # any number of whitespace
+  \*{1}(?!/) # followed by precisely one asterisk not followed by `/'
+  (.*)       # then anything (group1)
 '''
 
 end = r'''
 '''
 
 end = r'''
-  \s*     # any number of whitespace
-  \*+/    # followed by at least one asterisk, then '/'
+  \s*  # any number of whitespace
+  \*+/ # followed by at least one asterisk, then '/'
 '''
 
 re_source_block_format2 = SourceBlockFormat( 2, start, column, end )
 
 '''
 
 re_source_block_format2 = SourceBlockFormat( 2, start, column, end )
 
+
 #
 # the list of supported documentation block formats, we could add new ones
 # relatively easily
 #
 #
 # the list of supported documentation block formats, we could add new ones
 # relatively easily
 #
-re_source_block_formats = [ re_source_block_format1, re_source_block_format2 ]
+re_source_block_formats = [re_source_block_format1, re_source_block_format2]
 
 
 #
 
 
 #
@@ -128,7 +127,7 @@ re_markup_tag2 = re.compile( r'''\s*@(\w*):''' )  # @xxxx: format
 # the list of supported markup tags, we could add new ones relatively
 # easily
 #
 # the list of supported markup tags, we could add new ones relatively
 # easily
 #
-re_markup_tags = [ re_markup_tag1, re_markup_tag2 ]
+re_markup_tags = [re_markup_tag1, re_markup_tag2]
 
 #
 # used to detect a cross-reference, after markup tags have been stripped
 
 #
 # used to detect a cross-reference, after markup tags have been stripped
@@ -175,18 +174,19 @@ re_source_keywords = re.compile( '''\\b ( typedef   |
                                           \#else    |
                                           \#endif   ) \\b''', re.VERBOSE )
 
                                           \#else    |
                                           \#endif   ) \\b''', re.VERBOSE )
 
+
 ################################################################
 ##
 ##  SOURCE BLOCK CLASS
 ##
 ################################################################
 ##
 ##  SOURCE BLOCK CLASS
 ##
-##   A SourceProcessor is in charge or reading a C source file
+##   A SourceProcessor is in charge of reading a C source file
 ##   and decomposing it into a series of different "SourceBlocks".
 ##   each one of these blocks can be made of the following data:
 ##
 ##   - A documentation comment block that starts with "/**" and
 ##     whose exact format will be discussed later
 ##
 ##   and decomposing it into a series of different "SourceBlocks".
 ##   each one of these blocks can be made of the following data:
 ##
 ##   - A documentation comment block that starts with "/**" and
 ##     whose exact format will be discussed later
 ##
-##   - normal sources lines, include comments
+##   - normal sources lines, including comments
 ##
 ##   the important fields in a text block are the following ones:
 ##
 ##
 ##   the important fields in a text block are the following ones:
 ##
@@ -198,8 +198,9 @@ re_source_keywords = re.compile( '''\\b ( typedef   |
 ##                    (i.e. sources or ordinary comments with no starting
 ##                     markup tag)
 ##
 ##                    (i.e. sources or ordinary comments with no starting
 ##                     markup tag)
 ##
-class SourceBlock:
-    def __init__( self, processor, filename, lineno, lines ):
+class  SourceBlock:
+
+    def  __init__( self, processor, filename, lineno, lines ):
         self.processor = processor
         self.filename  = filename
         self.lineno    = lineno
         self.processor = processor
         self.filename  = filename
         self.lineno    = lineno
@@ -218,24 +219,22 @@ class SourceBlock:
         for line0 in self.lines:
             m = self.format.column.match( line0 )
             if m:
         for line0 in self.lines:
             m = self.format.column.match( line0 )
             if m:
-                lines.append( m.group(1) )
+                lines.append( m.group( 1 ) )
 
         # now, look for a markup tag
         for l in lines:
 
         # now, look for a markup tag
         for l in lines:
-            l = string.strip(l)
-            if len(l) > 0:
+            l = string.strip( l )
+            if len( l ) > 0:
                 for tag in re_markup_tags:
                     if tag.match( l ):
                         self.content = lines
                 for tag in re_markup_tags:
                     if tag.match( l ):
                         self.content = lines
-                return
-
-    def location( self ):
-        return "(" + self.filename + ":" + repr(self.lineno) + ")"
+                        return
 
 
+    def  location( self ):
+        return "(" + self.filename + ":" + repr( self.lineno ) + ")"
 
     # debugging only - not used in normal operations
 
     # debugging only - not used in normal operations
-    def dump( self ):
-
+    def  dump( self ):
         if self.content:
             print "{{{content start---"
             for l in self.content:
         if self.content:
             print "{{{content start---"
             for l in self.content:
@@ -245,17 +244,18 @@ class SourceBlock:
 
         fmt = ""
         if self.format:
 
         fmt = ""
         if self.format:
-            fmt = repr(self.format.id) + " "
+            fmt = repr( self.format.id ) + " "
 
         for line in self.lines:
             print line
 
 
 
         for line in self.lines:
             print line
 
 
+
 ################################################################
 ##
 ##  SOURCE PROCESSOR CLASS
 ##
 ################################################################
 ##
 ##  SOURCE PROCESSOR CLASS
 ##
-##   The SourceProcessor is in charge or reading a C source file
+##   The SourceProcessor is in charge of reading a C source file
 ##   and decomposing it into a series of different "SourceBlock"
 ##   objects.
 ##
 ##   and decomposing it into a series of different "SourceBlock"
 ##   objects.
 ##
@@ -267,7 +267,7 @@ class SourceBlock:
 ##   - normal sources lines, include comments
 ##
 ##
 ##   - normal sources lines, include comments
 ##
 ##
-class SourceProcessor:
+class  SourceProcessor:
 
     def  __init__( self ):
         """initialize a source processor"""
 
     def  __init__( self ):
         """initialize a source processor"""
@@ -281,39 +281,33 @@ class SourceProcessor:
         self.blocks = []
         self.format = None
 
         self.blocks = []
         self.format = None
 
-
     def  parse_file( self, filename ):
     def  parse_file( self, filename ):
-        """parse a C source file, and adds its blocks to the processor's list"""
-
+        """parse a C source file, and add its blocks to the processor's list"""
         self.reset()
 
         self.filename = filename
 
         fileinput.close()
         self.reset()
 
         self.filename = filename
 
         fileinput.close()
-        self.format    = None
-        self.lineno    = 0
-        self.lines     = []
+        self.format = None
+        self.lineno = 0
+        self.lines  = []
 
         for line in fileinput.input( filename ):
 
         for line in fileinput.input( filename ):
-
-            # strip trailing newlines, important on Windows machines !!
-            if  line[-1] == '\012':
+            # strip trailing newlines, important on Windows machines!
+            if line[-1] == '\012':
                 line = line[0:-1]
 
             if self.format == None:
                 self.process_normal_line( line )
                 line = line[0:-1]
 
             if self.format == None:
                 self.process_normal_line( line )
-
             else:
                 if self.format.end.match( line ):
             else:
                 if self.format.end.match( line ):
-                    # that's a normal block end, add it to lines and
+                    # that's a normal block end, add it to 'lines' and
                     # create a new block
                     self.lines.append( line )
                     self.add_block_lines()
                     # create a new block
                     self.lines.append( line )
                     self.add_block_lines()
-
                 elif self.format.column.match( line ):
                     # that's a normal column line, add it to 'lines'
                     self.lines.append( line )
                 elif self.format.column.match( line ):
                     # that's a normal column line, add it to 'lines'
                     self.lines.append( line )
-
                 else:
                     # humm.. this is an unexpected block end,
                     # create a new block, but don't process the line
                 else:
                     # humm.. this is an unexpected block end,
                     # create a new block, but don't process the line
@@ -325,22 +319,18 @@ class SourceProcessor:
         # record the last lines
         self.add_block_lines()
 
         # record the last lines
         self.add_block_lines()
 
-
-
-    def process_normal_line( self, line ):
-        """process a normal line and check if it's the start of a new block"""
+    def  process_normal_line( self, line ):
+        """process a normal line and check whether it is the start of a new block"""
         for f in re_source_block_formats:
         for f in re_source_block_formats:
-          if f.start.match( line ):
-            self.add_block_lines()
-            self.format = f
-            self.lineno = fileinput.filelineno()
+            if f.start.match( line ):
+                self.add_block_lines()
+                self.format = f
+                self.lineno = fileinput.filelineno()
 
         self.lines.append( line )
 
 
         self.lines.append( line )
 
-
-
-    def add_block_lines( self ):
-        """add the current accumulated lines, and create a new block"""
+    def  add_block_lines( self ):
+        """add the current accumulated lines and create a new block"""
         if self.lines != []:
             block = SourceBlock( self, self.filename, self.lineno, self.lines )
 
         if self.lines != []:
             block = SourceBlock( self, self.filename, self.lineno, self.lines )
 
@@ -348,9 +338,8 @@ class SourceProcessor:
             self.format = None
             self.lines  = []
 
             self.format = None
             self.lines  = []
 
-
     # debugging only, not used in normal operations
     # debugging only, not used in normal operations
-    def dump( self ):
+    def  dump( self ):
         """print all blocks in a processor"""
         for b in self.blocks:
             b.dump()
         """print all blocks in a processor"""
         for b in self.blocks:
             b.dump()
index 04dfba3..fffa120 100644 (file)
@@ -1,4 +1,4 @@
-#  ToHTML (c) 2002, 2003, 2005, 2006, 2007
+#  ToHTML (c) 2002, 2003, 2005, 2006, 2007, 2008
 #    David Turner <david@freetype.org>
 
 from sources import *
 #    David Turner <david@freetype.org>
 
 from sources import *
@@ -7,17 +7,19 @@ from formatter import *
 
 import time
 
 
 import time
 
+
 # The following defines the HTML header used by all generated pages.
 # The following defines the HTML header used by all generated pages.
-#
 html_header_1 = """\
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 html_header_1 = """\
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>"""
+<title>\
+"""
 
 
-html_header_2= """ API Reference</title>
+html_header_2 = """\
+ API Reference</title>
 <style type="text/css">
   body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
          color: #000000;
 <style type="text/css">
   body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
          color: #000000;
@@ -26,7 +28,9 @@ html_header_2= """ API Reference</title>
   p { text-align: justify; }
   h1 { text-align: center; }
   li { text-align: justify; }
   p { text-align: justify; }
   h1 { text-align: center; }
   li { text-align: justify; }
-  td { padding: 0 0.5em 0 0.5em }
+  td { padding: 0 0.5em 0 0.5em; }
+  td.left { padding: 0 0.5em 0 0.5em;
+            text-align: left; }
 
   a:link { color: #0000EF; }
   a:visited { color: #51188E; }
 
   a:link { color: #0000EF; }
   a:visited { color: #51188E; }
@@ -43,69 +47,91 @@ html_header_2= """ API Reference</title>
 </style>
 </head>
 <body>
 </style>
 </head>
 <body>
-<center><h1>"""
+"""
+
+html_header_3 = """
+<table align=center><tr><td><font size=-1>[<a href="\
+"""
+
+html_header_3i = """
+<table align=center><tr><td width="100%"></td>
+<td><font size=-1>[<a href="\
+"""
+
+html_header_4 = """\
+">Index</a>]</font></td>
+<td width="100%"></td>
+<td><font size=-1>[<a href="\
+"""
+
+html_header_5 = """\
+">TOC</a>]</font></td></tr></table>
+<center><h1>\
+"""
 
 
-html_header_3=""" API Reference</h1></center>
+html_header_5t = """\
+">Index</a>]</font></td>
+<td width="100%"></td></tr></table>
+<center><h1>\
 """
 
 """
 
+html_header_6 = """\
+ API Reference</h1></center>
+"""
 
 
 # The HTML footer used by all generated pages.
 
 
 # The HTML footer used by all generated pages.
-#
 html_footer = """\
 </body>
 html_footer = """\
 </body>
-</html>"""
+</html>\
+"""
 
 # The header and footer used for each section.
 
 # The header and footer used for each section.
-#
 section_title_header = "<center><h1>"
 section_title_footer = "</h1></center>"
 
 # The header and footer used for code segments.
 section_title_header = "<center><h1>"
 section_title_footer = "</h1></center>"
 
 # The header and footer used for code segments.
-#
 code_header = '<pre class="colored">'
 code_footer = '</pre>'
 
 # Paragraph header and footer.
 code_header = '<pre class="colored">'
 code_footer = '</pre>'
 
 # Paragraph header and footer.
-#
 para_header = "<p>"
 para_footer = "</p>"
 
 # Block header and footer.
 para_header = "<p>"
 para_footer = "</p>"
 
 # Block header and footer.
-#
 block_header        = '<table align=center width="75%"><tr><td>'
 block_footer_start  = """\
 </td></tr></table>
 <hr width="75%">
 block_header        = '<table align=center width="75%"><tr><td>'
 block_footer_start  = """\
 </td></tr></table>
 <hr width="75%">
-<table align=center width="75%"><tr><td><font size=-2>[<a href="
+<table align=center width="75%"><tr><td><font size=-2>[<a href="\
 """
 block_footer_middle = """\
 ">Index</a>]</font></td>
 <td width="100%"></td>
 """
 block_footer_middle = """\
 ">Index</a>]</font></td>
 <td width="100%"></td>
-<td><font size=-2>[<a href="
+<td><font size=-2>[<a href="\
 """
 block_footer_end    = """\
 ">TOC</a>]</font></td></tr></table>
 """
 
 # Description header/footer.
 """
 block_footer_end    = """\
 ">TOC</a>]</font></td></tr></table>
 """
 
 # Description header/footer.
-#
 description_header = '<table align=center width="87%"><tr><td>'
 description_footer = "</td></tr></table><br>"
 
 # Marker header/inter/footer combination.
 description_header = '<table align=center width="87%"><tr><td>'
 description_footer = "</td></tr></table><br>"
 
 # Marker header/inter/footer combination.
-#
 marker_header = '<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>'
 marker_inter  = "</b></em></td></tr><tr><td>"
 marker_footer = "</td></tr></table>"
 
 marker_header = '<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>'
 marker_inter  = "</b></em></td></tr><tr><td>"
 marker_footer = "</td></tr></table>"
 
+# Header location header/footer.
+header_location_header = '<table align=center width="87%"><tr><td>'
+header_location_footer = "</td></tr></table><br>"
+
 # Source code extracts header/footer.
 # Source code extracts header/footer.
-#
 source_header = '<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>\n'
 source_footer = "\n</pre></table><br>"
 
 # Chapter header/inter/footer.
 source_header = '<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>\n'
 source_footer = "\n</pre></table><br>"
 
 # Chapter header/inter/footer.
-#
 chapter_header = '<br><table align=center width="75%"><tr><td><h2>'
 chapter_inter  = '</h2><ul class="empty"><li>'
 chapter_footer = '</li></ul></td></tr></table>'
 chapter_header = '<br><table align=center width="75%"><tr><td><h2>'
 chapter_inter  = '</h2><ul class="empty"><li>'
 chapter_footer = '</li></ul></td></tr></table>'
@@ -114,86 +140,108 @@ chapter_footer = '</li></ul></td></tr></table>'
 index_footer_start = """\
 <hr>
 <table><tr><td width="100%"></td>
 index_footer_start = """\
 <hr>
 <table><tr><td width="100%"></td>
-<td><font size=-2>[<a href="
+<td><font size=-2>[<a href="\
 """
 index_footer_end = """\
 ">TOC</a>]</font></td></tr></table>
 """
 
 """
 index_footer_end = """\
 ">TOC</a>]</font></td></tr></table>
 """
 
+# TOC footer.
+toc_footer_start = """\
+<hr>
+<table><tr><td><font size=-2>[<a href="\
+"""
+toc_footer_end = """\
+">Index</a>]</font></td>
+<td width="100%"></td>
+</tr></table>
+"""
+
 
 # source language keyword coloration/styling
 
 # source language keyword coloration/styling
-#
 keyword_prefix = '<span class="keyword">'
 keyword_suffix = '</span>'
 
 section_synopsis_header = '<h2>Synopsis</h2>'
 section_synopsis_footer = ''
 
 keyword_prefix = '<span class="keyword">'
 keyword_suffix = '</span>'
 
 section_synopsis_header = '<h2>Synopsis</h2>'
 section_synopsis_footer = ''
 
+
 # Translate a single line of source to HTML.  This will convert
 # a "<" into "&lt.", ">" into "&gt.", etc.
 # Translate a single line of source to HTML.  This will convert
 # a "<" into "&lt.", ">" into "&gt.", etc.
-#
-def html_quote( line ):
-    result = string.replace( line,   "&", "&amp;" )
+def  html_quote( line ):
+    result = string.replace( line, "&", "&amp;" )
     result = string.replace( result, "<", "&lt;" )
     result = string.replace( result, ">", "&gt;" )
     return result
 
 
 # same as 'html_quote', but ignores left and right brackets
     result = string.replace( result, "<", "&lt;" )
     result = string.replace( result, ">", "&gt;" )
     return result
 
 
 # same as 'html_quote', but ignores left and right brackets
-#
-def html_quote0( line ):
+def  html_quote0( line ):
     return string.replace( line, "&", "&amp;" )
 
 
     return string.replace( line, "&", "&amp;" )
 
 
-def dump_html_code( lines, prefix = "" ):
+def  dump_html_code( lines, prefix = "" ):
     # clean the last empty lines
     # clean the last empty lines
-    #
     l = len( self.lines )
     while l > 0 and string.strip( self.lines[l - 1] ) == "":
         l = l - 1
 
     # The code footer should be directly appended to the last code
     # line to avoid an additional blank line.
     l = len( self.lines )
     while l > 0 and string.strip( self.lines[l - 1] ) == "":
         l = l - 1
 
     # The code footer should be directly appended to the last code
     # line to avoid an additional blank line.
-    #
     print prefix + code_header,
     print prefix + code_header,
-    for line in self.lines[0 : l+1]:
-        print '\n' + prefix + html_quote(line),
+    for line in self.lines[0 : l + 1]:
+        print '\n' + prefix + html_quote( line ),
     print prefix + code_footer,
 
 
 
     print prefix + code_footer,
 
 
 
-class HtmlFormatter(Formatter):
-
-    def __init__( self, processor, project_title, file_prefix ):
+class  HtmlFormatter( Formatter ):
 
 
+    def  __init__( self, processor, project_title, file_prefix ):
         Formatter.__init__( self, processor )
 
         Formatter.__init__( self, processor )
 
-        global html_header_1, html_header_2, html_header_3, html_footer
+        global html_header_1, html_header_2, html_header_3
+        global html_header_4, html_header_5, html_footer
 
         if file_prefix:
             file_prefix = file_prefix + "-"
         else:
             file_prefix = ""
 
 
         if file_prefix:
             file_prefix = file_prefix + "-"
         else:
             file_prefix = ""
 
-        self.project_title = project_title
-        self.file_prefix   = file_prefix
-        self.html_header   = html_header_1 + project_title + html_header_2 + \
-                             project_title + html_header_3
-
-        self.html_footer = "<center><font size=""-2"">generated on " +      \
-                            time.asctime( time.localtime( time.time() ) ) + \
-                           "</font></center>" + html_footer
+        self.headers           = processor.headers
+        self.project_title     = project_title
+        self.file_prefix       = file_prefix
+        self.html_header       = html_header_1 + project_title +              \
+                                 html_header_2 +                              \
+                                 html_header_3 + file_prefix + "index.html" + \
+                                 html_header_4 + file_prefix + "toc.html" +   \
+                                 html_header_5 + project_title +              \
+                                 html_header_6
+
+        self.html_index_header = html_header_1 + project_title +             \
+                                 html_header_2 +                             \
+                                 html_header_3i + file_prefix + "toc.html" + \
+                                 html_header_5 + project_title +             \
+                                 html_header_6
+
+        self.html_toc_header   = html_header_1 + project_title +              \
+                                 html_header_2 +                              \
+                                 html_header_3 + file_prefix + "index.html" + \
+                                 html_header_5t + project_title +             \
+                                 html_header_6
+
+        self.html_footer       = "<center><font size=""-2"">generated on " +     \
+                                 time.asctime( time.localtime( time.time() ) ) + \
+                                 "</font></center>" + html_footer
 
         self.columns = 3
 
     def  make_section_url( self, section ):
         return self.file_prefix + section.name + ".html"
 
 
         self.columns = 3
 
     def  make_section_url( self, section ):
         return self.file_prefix + section.name + ".html"
 
-
     def  make_block_url( self, block ):
         return self.make_section_url( block.section ) + "#" + block.name
 
     def  make_block_url( self, block ):
         return self.make_section_url( block.section ) + "#" + block.name
 
-
     def  make_html_words( self, words ):
         """ convert a series of simple words into some HTML text """
         line = ""
     def  make_html_words( self, words ):
         """ convert a series of simple words into some HTML text """
         line = ""
@@ -204,16 +252,14 @@ class HtmlFormatter(Formatter):
 
         return line
 
 
         return line
 
-
     def  make_html_word( self, word ):
         """analyze a simple word to detect cross-references and styling"""
         # look for cross-references
     def  make_html_word( self, word ):
         """analyze a simple word to detect cross-references and styling"""
         # look for cross-references
-        #
         m = re_crossref.match( word )
         if m:
             try:
         m = re_crossref.match( word )
         if m:
             try:
-                name = m.group(1)
-                rest = m.group(2)
+                name = m.group( 1 )
+                rest = m.group( 2 )
                 block = self.identifiers[name]
                 url   = self.make_block_url( block )
                 return '<a href="' + url + '">' + name + '</a>' + rest
                 block = self.identifiers[name]
                 url   = self.make_block_url( block )
                 return '<a href="' + url + '">' + name + '</a>' + rest
@@ -226,34 +272,34 @@ class HtmlFormatter(Formatter):
         # look for italics and bolds
         m = re_italic.match( word )
         if m:
         # look for italics and bolds
         m = re_italic.match( word )
         if m:
-            name = m.group(1)
-            rest = m.group(3)
+            name = m.group( 1 )
+            rest = m.group( 3 )
             return '<i>' + name + '</i>' + rest
 
         m = re_bold.match( word )
         if m:
             return '<i>' + name + '</i>' + rest
 
         m = re_bold.match( word )
         if m:
-            name = m.group(1)
-            rest = m.group(3)
+            name = m.group( 1 )
+            rest = m.group( 3 )
             return '<b>' + name + '</b>' + rest
 
             return '<b>' + name + '</b>' + rest
 
-        return html_quote(word)
-
+        return html_quote( word )
 
     def  make_html_para( self, words ):
 
     def  make_html_para( self, words ):
-        """ convert a paragraph's words into tagged HTML text, handle xrefs """
+        """ convert words of a paragraph into tagged HTML text, handle xrefs """
         line = ""
         if words:
             line = self.make_html_word( words[0] )
             for word in words[1:]:
                 line = line + " " + self.make_html_word( word )
             # convert `...' quotations into real left and right single quotes
         line = ""
         if words:
             line = self.make_html_word( words[0] )
             for word in words[1:]:
                 line = line + " " + self.make_html_word( word )
             # convert `...' quotations into real left and right single quotes
-            line = re.sub( r"(^|\W)`(.*?)'(\W|$)",
-                           r'\1&lsquo;\2&rsquo;\3',
+            line = re.sub( r"(^|\W)`(.*?)'(\W|$)",  \
+                           r'\1&lsquo;\2&rsquo;\3', \
                            line )
                            line )
+            # convert tilde into non-breakable space
+            line = string.replace( line, "~", "&nbsp;" )
 
         return para_header + line + para_footer
 
 
         return para_header + line + para_footer
 
-
     def  make_html_code( self, lines ):
         """ convert a code sequence to HTML """
         line = code_header + '\n'
     def  make_html_code( self, lines ):
         """ convert a code sequence to HTML """
         line = code_header + '\n'
@@ -262,7 +308,6 @@ class HtmlFormatter(Formatter):
 
         return line + code_footer
 
 
         return line + code_footer
 
-
     def  make_html_items( self, items ):
         """ convert a field's content into some valid HTML """
         lines = []
     def  make_html_items( self, items ):
         """ convert a field's content into some valid HTML """
         lines = []
@@ -274,59 +319,54 @@ class HtmlFormatter(Formatter):
 
         return string.join( lines, '\n' )
 
 
         return string.join( lines, '\n' )
 
-
     def  print_html_items( self, items ):
         print self.make_html_items( items )
 
     def  print_html_items( self, items ):
         print self.make_html_items( items )
 
-
-    def print_html_field( self, field ):
+    def  print_html_field( self, field ):
         if field.name:
         if field.name:
-            print "<table><tr valign=top><td><p><b>"+field.name+"</b></p></td><td>"
+            print "<table><tr valign=top><td><b>" + field.name + "</b></td><td>"
 
         print self.make_html_items( field.items )
 
         if field.name:
             print "</td></tr></table>"
 
 
         print self.make_html_items( field.items )
 
         if field.name:
             print "</td></tr></table>"
 
-
-    def html_source_quote( self, line, block_name = None ):
+    def  html_source_quote( self, line, block_name = None ):
         result = ""
         while line:
             m = re_source_crossref.match( line )
             if m:
         result = ""
         while line:
             m = re_source_crossref.match( line )
             if m:
-                name   = m.group(2)
-                prefix = html_quote( m.group(1) )
-                length = len( m.group(0) )
+                name   = m.group( 2 )
+                prefix = html_quote( m.group( 1 ) )
+                length = len( m.group( 0 ) )
 
                 if name == block_name:
                     # this is the current block name, if any
                     result = result + prefix + '<b>' + name + '</b>'
 
                 if name == block_name:
                     # this is the current block name, if any
                     result = result + prefix + '<b>' + name + '</b>'
-
-                elif re_source_keywords.match(name):
+                elif re_source_keywords.match( name ):
                     # this is a C keyword
                     result = result + prefix + keyword_prefix + name + keyword_suffix
                     # this is a C keyword
                     result = result + prefix + keyword_prefix + name + keyword_suffix
-
-                elif self.identifiers.has_key(name):
+                elif self.identifiers.has_key( name ):
                     # this is a known identifier
                     block = self.identifiers[name]
                     result = result + prefix + '<a href="' + \
                     # this is a known identifier
                     block = self.identifiers[name]
                     result = result + prefix + '<a href="' + \
-                             self.make_block_url(block) + '">' + name + '</a>'
+                             self.make_block_url( block ) + '">' + name + '</a>'
                 else:
                 else:
-                    result = result + html_quote(line[:length])
+                    result = result + html_quote( line[:length] )
 
                 line = line[length:]
             else:
 
                 line = line[length:]
             else:
-                result = result + html_quote(line)
+                result = result + html_quote( line )
                 line   = []
 
         return result
 
                 line   = []
 
         return result
 
-
-    def print_html_field_list( self, fields ):
+    def  print_html_field_list( self, fields ):
+        print "<p></p>"
         print "<table cellpadding=3 border=0>"
         for field in fields:
         print "<table cellpadding=3 border=0>"
         for field in fields:
-            if len(field.name) > 22:
-              print "<tr valign=top><td colspan=0><b>"+field.name+"</b></td></tr>"
+            if len( field.name ) > 22:
+              print "<tr valign=top><td colspan=0><b>" + field.name + "</b></td></tr>"
               print "<tr valign=top><td></td><td>"
             else:
               print "<tr valign=top><td><b>" + field.name + "</b></td><td>"
               print "<tr valign=top><td></td><td>"
             else:
               print "<tr valign=top><td><b>" + field.name + "</b></td><td>"
@@ -335,8 +375,7 @@ class HtmlFormatter(Formatter):
             print "</td></tr>"
         print "</table>"
 
             print "</td></tr>"
         print "</table>"
 
-
-    def print_html_markup( self, markup ):
+    def  print_html_markup( self, markup ):
         table_fields = []
         for field in markup.fields:
             if field.name:
         table_fields = []
         for field in markup.fields:
             if field.name:
@@ -345,7 +384,6 @@ class HtmlFormatter(Formatter):
                 # all of them as a single table
                 #
                 table_fields.append( field )
                 # all of them as a single table
                 #
                 table_fields.append( field )
-
             else:
                 if table_fields:
                     self.print_html_field_list( table_fields )
             else:
                 if table_fields:
                     self.print_html_field_list( table_fields )
@@ -359,9 +397,8 @@ class HtmlFormatter(Formatter):
     #
     #  Formatting the index
     #
     #
     #  Formatting the index
     #
-
     def  index_enter( self ):
     def  index_enter( self ):
-        print self.html_header
+        print self.html_index_header
         self.index_items = {}
 
     def  index_name_enter( self, name ):
         self.index_items = {}
 
     def  index_name_enter( self, name ):
@@ -370,16 +407,15 @@ class HtmlFormatter(Formatter):
         self.index_items[name] = url
 
     def  index_exit( self ):
         self.index_items[name] = url
 
     def  index_exit( self ):
-
         # block_index already contains the sorted list of index names
         count = len( self.block_index )
         # block_index already contains the sorted list of index names
         count = len( self.block_index )
-        rows  = (count + self.columns - 1) / self.columns
+        rows  = ( count + self.columns - 1 ) / self.columns
 
         print "<table align=center border=0 cellpadding=0 cellspacing=0>"
 
         print "<table align=center border=0 cellpadding=0 cellspacing=0>"
-        for r in range(rows):
+        for r in range( rows ):
             line = "<tr>"
             line = "<tr>"
-            for c in range(self.columns):
-                i = r + c*rows
+            for c in range( self.columns ):
+                i = r + c * rows
                 if i < count:
                     bname = self.block_index[r + c * rows]
                     url   = self.index_items[bname]
                 if i < count:
                     bname = self.block_index[r + c * rows]
                     url   = self.index_items[bname]
@@ -391,14 +427,15 @@ class HtmlFormatter(Formatter):
 
         print "</table>"
 
 
         print "</table>"
 
-        print index_footer_start + \
+        print index_footer_start +            \
               self.file_prefix + "toc.html" + \
               index_footer_end
 
               self.file_prefix + "toc.html" + \
               index_footer_end
 
+        print self.html_footer
+
         self.index_items = {}
 
     def  index_dump( self, index_filename = None ):
         self.index_items = {}
 
     def  index_dump( self, index_filename = None ):
-
         if index_filename == None:
             index_filename = self.file_prefix + "index.html"
 
         if index_filename == None:
             index_filename = self.file_prefix + "index.html"
 
@@ -408,15 +445,15 @@ class HtmlFormatter(Formatter):
     #  Formatting the table of content
     #
     def  toc_enter( self ):
     #  Formatting the table of content
     #
     def  toc_enter( self ):
-        print self.html_header
+        print self.html_toc_header
         print "<center><h1>Table of Contents</h1></center>"
 
     def  toc_chapter_enter( self, chapter ):
         print "<center><h1>Table of Contents</h1></center>"
 
     def  toc_chapter_enter( self, chapter ):
-        print  chapter_header + string.join(chapter.title) + chapter_inter
+        print  chapter_header + string.join( chapter.title ) + chapter_inter
         print "<table cellpadding=5>"
 
     def  toc_section_enter( self, section ):
         print "<table cellpadding=5>"
 
     def  toc_section_enter( self, section ):
-        print "<tr valign=top><td>"
+        print '<tr valign=top><td class="left">'
         print '<a href="' + self.make_section_url( section ) + '">' + \
                section.title + '</a></td><td>'
 
         print '<a href="' + self.make_section_url( section ) + '">' + \
                section.title + '</a></td><td>'
 
@@ -427,12 +464,18 @@ class HtmlFormatter(Formatter):
 
     def  toc_chapter_exit( self, chapter ):
         print "</table>"
 
     def  toc_chapter_exit( self, chapter ):
         print "</table>"
-        print  chapter_footer
+        print chapter_footer
 
     def  toc_index( self, index_filename ):
 
     def  toc_index( self, index_filename ):
-        print chapter_header + '<a href="' + index_filename + '">Global Index</a>' + chapter_inter + chapter_footer
+        print chapter_header +                                      \
+              '<a href="' + index_filename + '">Global Index</a>' + \
+              chapter_inter + chapter_footer
 
     def  toc_exit( self ):
 
     def  toc_exit( self ):
+        print toc_footer_start +                \
+              self.file_prefix + "index.html" + \
+              toc_footer_end
+
         print self.html_footer
 
     def  toc_dump( self, toc_filename = None, index_filename = None ):
         print self.html_footer
 
     def  toc_dump( self, toc_filename = None, index_filename = None ):
@@ -459,7 +502,7 @@ class HtmlFormatter(Formatter):
             if len( b.name ) > maxwidth:
                 maxwidth = len( b.name )
 
             if len( b.name ) > maxwidth:
                 maxwidth = len( b.name )
 
-        width  = 70  # XXX magic number
+        width = 70  # XXX magic number
         if maxwidth <> 0:
             # print section synopsis
             print section_synopsis_header
         if maxwidth <> 0:
             # print section synopsis
             print section_synopsis_header
@@ -501,12 +544,26 @@ class HtmlFormatter(Formatter):
 
         # dump the block C source lines now
         if block.code:
 
         # dump the block C source lines now
         if block.code:
+            header = ''
+            for f in self.headers.keys():
+                if block.source.filename.find( f ) >= 0:
+                    header = self.headers[f] + ' (' + f + ')'
+                    break;
+                
+#           if not header:
+#               sys.stderr.write( \
+#                 'WARNING: No header macro for ' + block.source.filename + '.\n' )
+
+            if header:
+                print header_location_header
+                print 'Defined in ' + header + '.'
+                print header_location_footer
+
             print source_header
             for l in block.code:
                 print self.html_source_quote( l, block.name )
             print source_footer
 
             print source_header
             for l in block.code:
                 print self.html_source_quote( l, block.name )
             print source_footer
 
-
     def  markup_enter( self, markup, block ):
         if markup.tag == "description":
             print description_header
     def  markup_enter( self, markup, block ):
         if markup.tag == "description":
             print description_header
@@ -523,15 +580,13 @@ class HtmlFormatter(Formatter):
 
     def  block_exit( self, block ):
         print block_footer_start + self.file_prefix + "index.html" + \
 
     def  block_exit( self, block ):
         print block_footer_start + self.file_prefix + "index.html" + \
-              block_footer_middle + self.file_prefix + "toc.html" + \
+              block_footer_middle + self.file_prefix + "toc.html" +  \
               block_footer_end
 
               block_footer_end
 
-
     def  section_exit( self, section ):
         print html_footer
 
     def  section_exit( self, section ):
         print html_footer
 
-
-    def section_dump_all( self ):
+    def  section_dump_all( self ):
         for section in self.sections:
             self.section_dump( section, self.file_prefix + section.name + '.html' )
 
         for section in self.sections:
             self.section_dump( section, self.file_prefix + section.name + '.html' )
 
index e751c56..1d96658 100644 (file)
@@ -1,4 +1,4 @@
-#  Utils (c) 2002, 2004, 2007  David Turner <david@freetype.org>
+#  Utils (c) 2002, 2004, 2007, 2008  David Turner <david@freetype.org>
 #
 
 import string, sys, os, glob
 #
 
 import string, sys, os, glob
@@ -11,7 +11,7 @@ output_dir = None
 # This function is used to sort the index.  It is a simple lexicographical
 # sort, except that it places capital letters before lowercase ones.
 #
 # This function is used to sort the index.  It is a simple lexicographical
 # sort, except that it places capital letters before lowercase ones.
 #
-def index_sort( s1, s2 ):
+def  index_sort( s1, s2 ):
     if not s1:
         return -1
 
     if not s1:
         return -1
 
@@ -41,9 +41,10 @@ def index_sort( s1, s2 ):
 
     return 0
 
 
     return 0
 
+
 # Sort input_list, placing the elements of order_list in front.
 #
 # Sort input_list, placing the elements of order_list in front.
 #
-def sort_order_list( input_list, order_list ):
+def  sort_order_list( input_list, order_list ):
     new_list = order_list[:]
     for id in input_list:
         if not id in order_list:
     new_list = order_list[:]
     for id in input_list:
         if not id in order_list:
@@ -51,12 +52,11 @@ def sort_order_list( input_list, order_list ):
     return new_list
 
 
     return new_list
 
 
-
 # Open the standard output to a given project documentation file.  Use
 # "output_dir" to determine the filename location if necessary and save the
 # old stdout in a tuple that is returned by this function.
 #
 # Open the standard output to a given project documentation file.  Use
 # "output_dir" to determine the filename location if necessary and save the
 # old stdout in a tuple that is returned by this function.
 #
-def open_output( filename ):
+def  open_output( filename ):
     global output_dir
 
     if output_dir and output_dir != "":
     global output_dir
 
     if output_dir and output_dir != "":
@@ -71,25 +71,26 @@ def open_output( filename ):
 
 # Close the output that was returned by "close_output".
 #
 
 # Close the output that was returned by "close_output".
 #
-def close_output( output ):
+def  close_output( output ):
     output[0].close()
     sys.stdout = output[1]
 
 
 # Check output directory.
 #
     output[0].close()
     sys.stdout = output[1]
 
 
 # Check output directory.
 #
-def check_output( ):
+def  check_output():
     global output_dir
     if output_dir:
         if output_dir != "":
             if not os.path.isdir( output_dir ):
     global output_dir
     if output_dir:
         if output_dir != "":
             if not os.path.isdir( output_dir ):
-                sys.stderr.write( "argument" + " '" + output_dir + "' " +
+                sys.stderr.write( "argument" + " '" + output_dir + "' " + \
                                   "is not a valid directory" )
                 sys.exit( 2 )
         else:
             output_dir = None
 
                                   "is not a valid directory" )
                 sys.exit( 2 )
         else:
             output_dir = None
 
-def file_exists( pathname ):
+
+def  file_exists( pathname ):
     """checks that a given file exists"""
     result = 1
     try:
     """checks that a given file exists"""
     result = 1
     try:
@@ -102,9 +103,8 @@ def file_exists( pathname ):
     return result
 
 
     return result
 
 
-def make_file_list( args = None ):
+def  make_file_list( args = None ):
     """builds a list of input files from command-line arguments"""
     """builds a list of input files from command-line arguments"""
-
     file_list = []
     # sys.stderr.write( repr( sys.argv[1 :] ) + '\n' )
 
     file_list = []
     # sys.stderr.write( repr( sys.argv[1 :] ) + '\n' )
 
index fcff27b..4daac0d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 by George Williams */
+/* Copyright (C) 2005, 2007, 2008 by George Williams */
 /*
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
 /*
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
     int  load_flags = FT_LOAD_DEFAULT;
 
 
     int  load_flags = FT_LOAD_DEFAULT;
 
 
-    if ( check_outlines                               &&
-         ( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
+    if ( check_outlines         &&
+         FT_IS_SCALABLE( face ) )
       load_flags = FT_LOAD_NO_BITMAP;
 
     if ( nohints )
       load_flags = FT_LOAD_NO_BITMAP;
 
     if ( nohints )
 
     for ( gid = 0; gid < face->num_glyphs; ++gid )
     {
 
     for ( gid = 0; gid < face->num_glyphs; ++gid )
     {
-      if ( check_outlines                               &&
-           ( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
+      if ( check_outlines         &&
+           FT_IS_SCALABLE( face ) )
       {
         if ( !FT_Load_Glyph( face, gid, load_flags ) )
           FT_Outline_Decompose( &face->glyph->outline, &outlinefuncs, NULL );
       {
         if ( !FT_Load_Glyph( face, gid, load_flags ) )
           FT_Outline_Decompose( &face->glyph->outline, &outlinefuncs, NULL );
index 9a6da38..55573b2 100644 (file)
@@ -6,7 +6,7 @@
 #
 
 
 #
 
 
-# Copyright 1996-2000, 2003, 2005, 2007 by
+# Copyright 1996-2000, 2003, 2005, 2007, 2008 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -21,7 +21,7 @@
 usage: %s <output-file>
 
   This python script generates the glyph names tables defined in the
 usage: %s <output-file>
 
   This python script generates the glyph names tables defined in the
-  PSNames module.
+  `psnames' module.
 
   Its single argument is the name of the header file to be created.
 """
 
   Its single argument is the name of the header file to be created.
 """
@@ -5011,7 +5011,7 @@ def dump_array( the_array, write, array_name ):
   """dumps a given encoding"""
 
   write( "  static const unsigned char  " + array_name +
   """dumps a given encoding"""
 
   write( "  static const unsigned char  " + array_name +
-         "[" + repr( len( the_array ) ) + "] =\n" )
+         "[" + repr( len( the_array ) ) + "L] =\n" )
   write( "  {\n" )
 
   line  = ""
   write( "  {\n" )
 
   line  = ""
@@ -5067,7 +5067,7 @@ def main():
   write( "/*                                                                         */\n" )
   write( "/*    PostScript glyph names.                                              */\n" )
   write( "/*                                                                         */\n" )
   write( "/*                                                                         */\n" )
   write( "/*    PostScript glyph names.                                              */\n" )
   write( "/*                                                                         */\n" )
-  write( "/*  Copyright 2005 by                                                      */\n" )
+  write( "/*  Copyright 2005, 2008 by                                                */\n" )
   write( "/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\n" )
   write( "/*                                                                         */\n" )
   write( "/*  This file is part of the FreeType project, and may only be used,       */\n" )
   write( "/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\n" )
   write( "/*                                                                         */\n" )
   write( "/*  This file is part of the FreeType project, and may only be used,       */\n" )
@@ -5117,6 +5117,9 @@ def main():
    *  The lookup function to get the Unicode value for a given string
    *  is defined below the table.
    */
    *  The lookup function to get the Unicode value for a given string
    *  is defined below the table.
    */
+
+#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
+
 """ )
 
   dump_array( dict_array, write, "ft_adobe_glyph_list" )
 """ )
 
   dump_array( dict_array, write, "ft_adobe_glyph_list" )
@@ -5219,6 +5222,8 @@ def main():
     return 0;
   }
 
     return 0;
   }
 
+#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
+
 """ )
 
   if 0:  # generate unit test, or don't
 """ )
 
   if 0:  # generate unit test, or don't
index d53cb33..f5f9936 100644 (file)
@@ -63,7 +63,7 @@
 
   int
   dummy_get_index( const char*  name,
 
   int
   dummy_get_index( const char*  name,
-                   FT_UInt      len,
+                   FT_Offset    len,
                    void*        user_data )
   {
     if ( len )
                    void*        user_data )
   {
     if ( len )
index a166909..a8cccfe 100644 (file)
@@ -16,7 +16,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) truetype ;
 
   if $(FT2_MULTI)
   {
 
   if $(FT2_MULTI)
   {
-    _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ;
+    _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ttpic ;
   }
   else
   {
   }
   else
   {
index 3b05afc..baee81a 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += TRUETYPE_DRIVER
 
 define TRUETYPE_DRIVER
 FTMODULE_H_COMMANDS += TRUETYPE_DRIVER
 
 define TRUETYPE_DRIVER
-$(OPEN_DRIVER)tt_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, tt_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)truetype  $(ECHO_DRIVER_DESC)Windows/Mac font files with extension *.ttf or *.ttc$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)truetype  $(ECHO_DRIVER_DESC)Windows/Mac font files with extension *.ttf or *.ttc$(ECHO_DRIVER_DONE)
 endef
 
index b36473a..4bd1209 100644 (file)
@@ -19,6 +19,7 @@
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
+#include "ttpic.c"
 #include "ttdriver.c"   /* driver interface    */
 #include "ttpload.c"    /* tables loader       */
 #include "ttgload.c"    /* glyph loader        */
 #include "ttdriver.c"   /* driver interface    */
 #include "ttpload.c"    /* tables loader       */
 #include "ttgload.c"    /* glyph loader        */
index c2cf452..dca009a 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType font driver implementation (body).                          */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  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 FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_IDS_H
 #include FT_SERVICE_XFREE86_NAME_H
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 #include FT_SERVICE_XFREE86_NAME_H
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -41,6 +40,7 @@
 
 #include "tterrors.h"
 
 
 #include "tterrors.h"
 
+#include "ttpic.h"
 
   /*************************************************************************/
   /*                                                                       */
 
   /*************************************************************************/
   /*                                                                       */
 #undef PAIR_TAG
 
 
 #undef PAIR_TAG
 
 
+  static FT_Error
+  tt_get_advances( FT_Face    ttface,
+                   FT_UInt    start,
+                   FT_UInt    count,
+                   FT_Int32   flags,
+                   FT_Fixed  *advances )
+  {
+    FT_UInt  nn;
+    TT_Face  face  = (TT_Face) ttface;
+    FT_Bool  check = FT_BOOL(
+                       !( flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) );
+
+
+    /* XXX: TODO: check for sbits */
+
+    if ( flags & FT_LOAD_VERTICAL_LAYOUT )
+    {
+      for ( nn = 0; nn < count; nn++ )
+      {
+        FT_Short   tsb;
+        FT_UShort  ah;
+
+
+        TT_Get_VMetrics( face, start + nn, check, &tsb, &ah );
+        advances[nn] = ah;
+      }
+    }
+    else
+    {
+      for ( nn = 0; nn < count; nn++ )
+      {
+        FT_Short   lsb;
+        FT_UShort  aw;
+
+
+        TT_Get_HMetrics( face, start + nn, check, &lsb, &aw );
+        advances[nn] = aw;
+      }
+    }
+
+    return TT_Err_Ok;
+  }
+
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /*    glyph_index :: The index of the glyph in the font file.            */
   /*                                                                       */
   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
   /*    glyph_index :: The index of the glyph in the font file.            */
   /*                                                                       */
   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
-  /*                   FTLOAD_??? constants can be used to control the     */
+  /*                   FT_LOAD_XXX constants can be used to control the    */
   /*                   glyph loading process (e.g., whether the outline    */
   /*                   should be scaled, whether to load bitmaps or not,   */
   /*                   whether to hint the outline, etc).                  */
   /*                   glyph loading process (e.g., whether the outline    */
   /*                   should be scaled, whether to load bitmaps or not,   */
   /*                   whether to hint the outline, etc).                  */
     if ( !face || glyph_index >= (FT_UInt)face->num_glyphs )
       return TT_Err_Invalid_Argument;
 
     if ( !face || glyph_index >= (FT_UInt)face->num_glyphs )
       return TT_Err_Invalid_Argument;
 
+    if ( load_flags & FT_LOAD_NO_HINTING )
+    {
+      /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT   */
+      /* are necessary to disable hinting for tricky fonts */          
+
+      if ( FT_IS_TRICKY( face ) )
+        load_flags &= ~FT_LOAD_NO_HINTING;
+
+      if ( load_flags & FT_LOAD_NO_AUTOHINT )
+        load_flags |= FT_LOAD_NO_HINTING;
+    }
+
     if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
     {
     if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
     {
-      load_flags |= FT_LOAD_NO_HINTING |
-                    FT_LOAD_NO_BITMAP  |
-                    FT_LOAD_NO_SCALE;
+      load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
+
+      if ( !FT_IS_TRICKY( face ) )
+        load_flags |= FT_LOAD_NO_HINTING;
     }
 
     /* now load the glyph outline if necessary */
     }
 
     /* now load the glyph outline if necessary */
   /*************************************************************************/
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
   /*************************************************************************/
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-  static const FT_Service_MultiMastersRec  tt_service_gx_multi_masters =
-  {
+  FT_DEFINE_SERVICE_MULTIMASTERSREC(tt_service_gx_multi_masters,
     (FT_Get_MM_Func)        NULL,
     (FT_Set_MM_Design_Func) NULL,
     (FT_Set_MM_Blend_Func)  TT_Set_MM_Blend,
     (FT_Get_MM_Var_Func)    TT_Get_MM_Var,
     (FT_Set_Var_Design_Func)TT_Set_Var_Design
     (FT_Get_MM_Func)        NULL,
     (FT_Set_MM_Design_Func) NULL,
     (FT_Set_MM_Blend_Func)  TT_Set_MM_Blend,
     (FT_Get_MM_Var_Func)    TT_Get_MM_Var,
     (FT_Set_Var_Design_Func)TT_Set_Var_Design
-  };
+  )
 #endif
 
   static const FT_Service_TrueTypeEngineRec  tt_service_truetype_engine =
 #endif
 
   static const FT_Service_TrueTypeEngineRec  tt_service_truetype_engine =
 #endif /* TT_USE_BYTECODE_INTERPRETER */
   };
 
 #endif /* TT_USE_BYTECODE_INTERPRETER */
   };
 
-  static const FT_Service_TTGlyfRec  tt_service_truetype_glyf =
-  {
+  FT_DEFINE_SERVICE_TTGLYFREC(tt_service_truetype_glyf,
     (TT_Glyf_GetLocationFunc)tt_face_get_location
     (TT_Glyf_GetLocationFunc)tt_face_get_location
-  };
+  )
 
 
-  static const FT_ServiceDescRec  tt_services[] =
-  {
-    { FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_TRUETYPE },
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-    { FT_SERVICE_ID_MULTI_MASTERS,   &tt_service_gx_multi_masters },
+  FT_DEFINE_SERVICEDESCREC4(tt_services,
+    FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_TRUETYPE,
+    FT_SERVICE_ID_MULTI_MASTERS,   &FT_TT_SERVICE_GX_MULTI_MASTERS_GET,
+    FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
+    FT_SERVICE_ID_TT_GLYF,         &FT_TT_SERVICE_TRUETYPE_GLYF_GET
+  )
+#else
+  FT_DEFINE_SERVICEDESCREC3(tt_services,
+    FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_TRUETYPE,
+    FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
+    FT_SERVICE_ID_TT_GLYF,         &FT_TT_SERVICE_TRUETYPE_GLYF_GET
+  )
 #endif
 #endif
-    { FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine },
-    { FT_SERVICE_ID_TT_GLYF,         &tt_service_truetype_glyf },
-    { NULL, NULL }
-  };
-
 
   FT_CALLBACK_DEF( FT_Module_Interface )
   tt_get_interface( FT_Module    driver,    /* TT_Driver */
                     const char*  tt_interface )
   {
 
   FT_CALLBACK_DEF( FT_Module_Interface )
   tt_get_interface( FT_Module    driver,    /* TT_Driver */
                     const char*  tt_interface )
   {
+    FT_Library           library = driver->library;
     FT_Module_Interface  result;
     FT_Module            sfntd;
     SFNT_Service         sfnt;
     FT_Module_Interface  result;
     FT_Module            sfntd;
     SFNT_Service         sfnt;
+    FT_UNUSED(library);
 
 
-
-    result = ft_service_list_lookup( tt_services, tt_interface );
+    result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface );
     if ( result != NULL )
       return result;
 
     if ( result != NULL )
       return result;
 
 
   /* The FT_DriverInterface structure is defined in ftdriver.h. */
 
 
   /* The FT_DriverInterface structure is defined in ftdriver.h. */
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Driver_ClassRec  tt_driver_class =
-  {
-    {
-      FT_MODULE_FONT_DRIVER        |
-      FT_MODULE_DRIVER_SCALABLE    |
 #ifdef TT_USE_BYTECODE_INTERPRETER
 #ifdef TT_USE_BYTECODE_INTERPRETER
-      FT_MODULE_DRIVER_HAS_HINTER,
+#define TT_HINTER_FLAG   FT_MODULE_DRIVER_HAS_HINTER
+#else
+#define TT_HINTER_FLAG   0
+#endif
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+#define TT_SIZE_SELECT    tt_size_select
 #else
 #else
-      0,
+#define TT_SIZE_SELECT    0
 #endif
 
 #endif
 
+  FT_DEFINE_DRIVER(tt_driver_class,
+  
+    
+      FT_MODULE_FONT_DRIVER        |
+      FT_MODULE_DRIVER_SCALABLE    |
+      TT_HINTER_FLAG,
+
       sizeof ( TT_DriverRec ),
 
       "truetype",      /* driver name                           */
       sizeof ( TT_DriverRec ),
 
       "truetype",      /* driver name                           */
       tt_driver_init,
       tt_driver_done,
       tt_get_interface,
       tt_driver_init,
       tt_driver_done,
       tt_get_interface,
-    },
 
     sizeof ( TT_FaceRec ),
     sizeof ( TT_SizeRec ),
 
     sizeof ( TT_FaceRec ),
     sizeof ( TT_SizeRec ),
     tt_slot_init,
     0,                      /* FT_Slot_DoneFunc */
 
     tt_slot_init,
     0,                      /* FT_Slot_DoneFunc */
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
+    ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+    ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+
     Load_Glyph,
 
     tt_get_kerning,
     0,                      /* FT_Face_AttachFunc      */
     Load_Glyph,
 
     tt_get_kerning,
     0,                      /* FT_Face_AttachFunc      */
-    0,                      /* FT_Face_GetAdvancesFunc */
+    tt_get_advances,
 
     tt_size_request,
 
     tt_size_request,
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-    tt_size_select
-#else
-    0                       /* FT_Size_SelectFunc      */
-#endif
-  };
+    TT_SIZE_SELECT
+  )
 
 
 /* END */
 
 
 /* END */
index f6f26e4..aae00f2 100644 (file)
@@ -27,7 +27,7 @@
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
 
-  FT_EXPORT_VAR( const FT_Driver_ClassRec )  tt_driver_class;
+  FT_DECLARE_DRIVER( tt_driver_class )
 
 
 FT_END_HEADER
 
 
 FT_END_HEADER
index ae476a4..28ddb99 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (body).                                        */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType Glyph Loader (body).                                        */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   /* `check' is true, take care of monospaced fonts by returning the       */
   /* advance width maximum.                                                */
   /*                                                                       */
   /* `check' is true, take care of monospaced fonts by returning the       */
   /* advance width maximum.                                                */
   /*                                                                       */
-  static void
-  Get_HMetrics( TT_Face     face,
-                FT_UInt     idx,
-                FT_Bool     check,
-                FT_Short*   lsb,
-                FT_UShort*  aw )
+  FT_LOCAL_DEF(void)
+  TT_Get_HMetrics( TT_Face     face,
+                   FT_UInt     idx,
+                   FT_Bool     check,
+                   FT_Short*   lsb,
+                   FT_UShort*  aw )
   {
     ( (SFNT_Service)face->sfnt )->get_metrics( face, 0, idx, lsb, aw );
 
   {
     ( (SFNT_Service)face->sfnt )->get_metrics( face, 0, idx, lsb, aw );
 
   /* The monospace `check' is probably not meaningful here, but we leave   */
   /* it in for a consistent interface.                                     */
   /*                                                                       */
   /* 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_LOCAL_DEF(void)
+  TT_Get_VMetrics( TT_Face     face,
+                   FT_UInt     idx,
+                   FT_Bool     check,
+                   FT_Short*   tsb,
+                   FT_UShort*  ah )
   {
     FT_UNUSED( check );
 
   {
     FT_UNUSED( check );
 
     if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit )
       goto Invalid_Outline;
 
     if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit )
       goto Invalid_Outline;
 
-    cont[0] = prev_cont = FT_NEXT_USHORT( p );
+    prev_cont = FT_NEXT_USHORT( p );
+
+    if ( n_contours > 0 )
+      cont[0] = prev_cont;
+
     for ( cont++; cont < cont_limit; cont++ )
     {
       cont[0] = FT_NEXT_USHORT( p );
     for ( cont++; cont < cont_limit; cont++ )
     {
       cont[0] = FT_NEXT_USHORT( p );
 
     if ( n_ins > face->max_profile.maxSizeOfInstructions )
     {
 
     if ( n_ins > face->max_profile.maxSizeOfInstructions )
     {
-      FT_TRACE0(( "TT_Load_Simple_Glyph: Too many instructions (%d)\n",
+      FT_TRACE0(( "TT_Load_Simple_Glyph: too many instructions (%d)\n",
                   n_ins ));
       error = TT_Err_Too_Many_Hints;
       goto Fail;
                   n_ins ));
       error = TT_Err_Too_Many_Hints;
       goto Fail;
 
     if ( ( limit - p ) < n_ins )
     {
 
     if ( ( limit - p ) < n_ins )
     {
-      FT_TRACE0(( "TT_Load_Simple_Glyph: Instruction count mismatch!\n" ));
+      FT_TRACE0(( "TT_Load_Simple_Glyph: instruction count mismatch\n" ));
       error = TT_Err_Too_Many_Hints;
       goto Fail;
     }
       error = TT_Err_Too_Many_Hints;
       goto Fail;
     }
 
     for ( ; vec < vec_limit; vec++, flag++ )
     {
 
     for ( ; vec < vec_limit; vec++, flag++ )
     {
-      FT_Pos  y = 0;
-      FT_Byte f = *flag;
+      FT_Pos   y = 0;
+      FT_Byte  f = *flag;
 
 
       if ( f & 2 )
 
 
       if ( f & 2 )
 
       x     += y;
       vec->x = x;
 
       x     += y;
       vec->x = x;
-      *flag  = f & ~( 2 | 16 );
+      /* the cast is for stupid compilers */
+      *flag  = (FT_Byte)( f & ~( 2 | 16 ) );
     }
 
     /* reading the Y coordinates */
     }
 
     /* reading the Y coordinates */
 
     for ( ; vec < vec_limit; vec++, flag++ )
     {
 
     for ( ; vec < vec_limit; vec++, flag++ )
     {
-      FT_Pos  y = 0;
-      FT_Byte f = *flag;
+      FT_Pos   y = 0;
+      FT_Byte  f = *flag;
 
 
       if ( f & 4 )
 
 
       if ( f & 4 )
 
       x     += y;
       vec->y = x;
 
       x     += y;
       vec->y = x;
-      *flag  = f & FT_CURVE_TAG_ON;
+      /* the cast is for stupid compilers */
+      *flag  = (FT_Byte)( f & FT_CURVE_TAG_ON );
     }
 
     outline->n_points   = (FT_UShort)n_points;
     }
 
     outline->n_points   = (FT_UShort)n_points;
       FT_Stream  stream = loader->stream;
 
 
       FT_Stream  stream = loader->stream;
 
 
-      /* we must undo the FT_FRAME_ENTER in order to point to the */
-      /* composite instructions, if we find some.               */
-      /* we will process them later...                          */
-      /*                                                        */
+      /* we must undo the FT_FRAME_ENTER in order to point */
+      /* to the composite instructions, if we find some.   */
+      /* We will process them later.                       */
+      /*                                                   */
       loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +
                                     p - limit );
     }
       loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +
                                     p - limit );
     }
 
 
 #ifdef TT_USE_BYTECODE_INTERPRETER
 
 
 #ifdef TT_USE_BYTECODE_INTERPRETER
-    n_ins = loader->glyph->control_len;
+    if ( loader->glyph->control_len > 0xFFFFL )
+    {
+      FT_TRACE1(( "TT_Hint_Glyph: too long instructions " ));
+      FT_TRACE1(( "(0x%lx byte) is truncated\n",
+                 loader->glyph->control_len ));
+    }
+    n_ins = (FT_UInt)( loader->glyph->control_len );
 #endif
 
     origin = zone->cur[zone->n_points - 4].x;
 #endif
 
     origin = zone->cur[zone->n_points - 4].x;
     /* save original point position in org */
     if ( n_ins > 0 )
       FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
     /* save original point position in org */
     if ( n_ins > 0 )
       FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
+
+    /* Reset graphics state. */
+    loader->exec->GS = ((TT_Size)loader->size)->GS;
+
+    /* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */
+    /*      completely refer to the (already) hinted subglyphs.     */
+    if ( is_composite )
+    {
+      loader->exec->metrics.x_scale = 1 << 16;
+      loader->exec->metrics.y_scale = 1 << 16;
+
+      FT_ARRAY_COPY( zone->orus, zone->cur, zone->n_points );
+    }
+    else
+    {
+      loader->exec->metrics.x_scale =
+        ((TT_Size)loader->size)->metrics.x_scale;
+      loader->exec->metrics.y_scale =
+        ((TT_Size)loader->size)->metrics.y_scale;
+    }
 #endif
 
     /* round pp2 and pp4 */
 #endif
 
     /* round pp2 and pp4 */
       FT_Bool   debug;
       FT_Error  error;
 
       FT_Bool   debug;
       FT_Error  error;
 
+      FT_GlyphLoader  gloader         = loader->gloader;
+      FT_Outline      current_outline = gloader->current.outline;
+
 
       error = TT_Set_CodeRange( loader->exec, tt_coderange_glyph,
                                 loader->exec->glyphIns, n_ins );
 
       error = TT_Set_CodeRange( loader->exec, tt_coderange_glyph,
                                 loader->exec->glyphIns, n_ins );
       error = TT_Run_Context( loader->exec, debug );
       if ( error && loader->exec->pedantic_hinting )
         return error;
       error = TT_Run_Context( loader->exec, debug );
       if ( error && loader->exec->pedantic_hinting )
         return error;
+
+      /* store drop-out mode in bits 5-7; set bit 2 also as a marker */
+      current_outline.tags[0] |=
+        ( loader->exec->GS.scan_type << 5 ) | FT_CURVE_TAG_HAS_SCANMODE;
     }
 
 #endif
     }
 
 #endif
     FT_GlyphLoader  gloader = loader->gloader;
     FT_Error        error   = TT_Err_Ok;
     FT_Outline*     outline;
     FT_GlyphLoader  gloader = loader->gloader;
     FT_Error        error   = TT_Err_Ok;
     FT_Outline*     outline;
-    FT_UInt         n_points;
+    FT_Int          n_points;
 
 
     outline  = &gloader->current.outline;
 
 
     outline  = &gloader->current.outline;
       /* Deltas apply to the unscaled data. */
       FT_Vector*  deltas;
       FT_Memory   memory = loader->face->memory;
       /* Deltas apply to the unscaled data. */
       FT_Vector*  deltas;
       FT_Memory   memory = loader->face->memory;
-      FT_UInt     i;
+      FT_Int      i;
 
 
       error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(loader->face),
 
 
       error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(loader->face),
   /* This algorithm is a guess and works much better than the above.       */
   /*                                                                       */
         FT_Fixed  mac_xscale = FT_SqrtFixed(
   /* This algorithm is a guess and works much better than the above.       */
   /*                                                                       */
         FT_Fixed  mac_xscale = FT_SqrtFixed(
-                                 FT_MulFix( subglyph->transform.xx,
-                                            subglyph->transform.xx ) +
-                                 FT_MulFix( subglyph->transform.xy,
-                                            subglyph->transform.xy ) );
+                                 (FT_Int32)FT_MulFix( subglyph->transform.xx,
+                                                      subglyph->transform.xx ) +
+                                 (FT_Int32)FT_MulFix( subglyph->transform.xy,
+                                                      subglyph->transform.xy ) );
         FT_Fixed  mac_yscale = FT_SqrtFixed(
         FT_Fixed  mac_yscale = FT_SqrtFixed(
-                                 FT_MulFix( subglyph->transform.yy,
-                                            subglyph->transform.yy ) +
-                                 FT_MulFix( subglyph->transform.yx,
-                                            subglyph->transform.yx ) );
+                                 (FT_Int32)FT_MulFix( subglyph->transform.yy,
+                                                      subglyph->transform.yy ) +
+                                 (FT_Int32)FT_MulFix( subglyph->transform.yx,
+                                                      subglyph->transform.yx ) );
 
 
         x = FT_MulFix( x, mac_xscale );
 
 
         x = FT_MulFix( x, mac_xscale );
       /* check it */
       if ( n_ins > ((TT_Face)loader->face)->max_profile.maxSizeOfInstructions )
       {
       /* check it */
       if ( n_ins > ((TT_Face)loader->face)->max_profile.maxSizeOfInstructions )
       {
-        FT_TRACE0(( "TT_Process_Composite_Glyph: Too many instructions (%d)\n",
+        FT_TRACE0(( "TT_Process_Composite_Glyph: too many instructions (%d)\n",
                     n_ins ));
 
         return TT_Err_Too_Many_Hints;
                     n_ins ));
 
         return TT_Err_Too_Many_Hints;
     /* Some points are likely touched during execution of  */
     /* instructions on components.  So let's untouch them. */
     for ( i = start_point; i < loader->zone.n_points; i++ )
     /* Some points are likely touched during execution of  */
     /* instructions on components.  So let's untouch them. */
     for ( i = start_point; i < loader->zone.n_points; i++ )
-      loader->zone.tags[i] &= ~( FT_CURVE_TAG_TOUCH_X |
-                                 FT_CURVE_TAG_TOUCH_Y );
+      loader->zone.tags[i] &= ~FT_CURVE_TAG_TOUCH_BOTH;
 
     loader->zone.n_points += 4;
 
 
     loader->zone.n_points += 4;
 
 #endif
 
 
 #endif
 
 
-    if ( recurse_count > face->max_profile.maxComponentDepth )
+    /* some fonts have an incorrect value of `maxComponentDepth', */
+    /* thus we allow depth 1 to catch the majority of them        */
+    if ( recurse_count > 1                                   &&
+         recurse_count > face->max_profile.maxComponentDepth )
     {
       error = TT_Err_Invalid_Composite;
       goto Exit;
     {
       error = TT_Err_Invalid_Composite;
       goto Exit;
       FT_UShort  advance_width = 0, advance_height = 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 );
+      TT_Get_HMetrics( face, glyph_index,
+                       (FT_Bool)!( loader->load_flags &
+                                   FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
+                       &left_bearing,
+                       &advance_width );
+      TT_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
 
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
       offset = tt_face_get_location( face, glyph_index,
                                      (FT_UInt*)&loader->byte_len );
 
       offset = tt_face_get_location( face, glyph_index,
                                      (FT_UInt*)&loader->byte_len );
 
-    if ( loader->byte_len == 0 )
+    if ( loader->byte_len > 0 )
+    {
+      if ( !loader->glyf_offset )
+      {
+        FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" ));
+        error = TT_Err_Invalid_Table;
+        goto Exit;
+      }
+
+      error = face->access_glyph_frame( loader, glyph_index,
+                                        loader->glyf_offset + offset,
+                                        loader->byte_len );
+      if ( error )
+        goto Exit;
+
+      opened_frame = 1;
+
+      /* read first glyph header */
+      error = face->read_glyph_header( loader );
+      if ( error )
+        goto Exit;
+    }
+
+    if ( loader->byte_len == 0 || loader->n_contours == 0 )
     {
     {
-      /* as described by Frederic Loyer, these are spaces or */
-      /* the unknown glyph.                                  */
       loader->bbox.xMin = 0;
       loader->bbox.xMax = 0;
       loader->bbox.yMin = 0;
       loader->bbox.xMin = 0;
       loader->bbox.xMax = 0;
       loader->bbox.yMin = 0;
       goto Exit;
     }
 
       goto Exit;
     }
 
-    error = face->access_glyph_frame( loader, glyph_index,
-                                      loader->glyf_offset + offset,
-                                      loader->byte_len );
-    if ( error )
-      goto Exit;
-
-    opened_frame = 1;
-
-    /* read first glyph header */
-    error = face->read_glyph_header( loader );
-    if ( error )
-      goto Exit;
-
     TT_LOADER_SET_PP( loader );
 
     /***********************************************************************/
     TT_LOADER_SET_PP( loader );
 
     /***********************************************************************/
 
     /* if it is a simple glyph, load it */
 
 
     /* if it is a simple glyph, load it */
 
-    if ( loader->n_contours >= 0 )
+    if ( loader->n_contours > 0 )
     {
       error = face->read_simple_glyph( loader );
       if ( error )
     {
       error = face->read_simple_glyph( loader );
       if ( error )
         {
           if ( subglyph->flags & ARGS_ARE_XY_VALUES )
           {
         {
           if ( subglyph->flags & ARGS_ARE_XY_VALUES )
           {
-            subglyph->arg1 += deltas[i].x;
-            subglyph->arg2 += deltas[i].y;
+            /* XXX: overflow check for subglyph->{arg1,arg2}.   */
+            /* deltas[i].{x,y} must be within signed 16-bit,    */
+            /* but the restriction of summed delta is not clear */
+            subglyph->arg1 += (FT_Int16)deltas[i].x;
+            subglyph->arg2 += (FT_Int16)deltas[i].y;
           }
         }
 
           }
         }
 
       /*********************************************************************/
 
       {
       /*********************************************************************/
 
       {
-        FT_UInt           n, num_base_points;
-        FT_SubGlyph       subglyph       = 0;
-
-        FT_UInt           num_points     = start_point;
-        FT_UInt           num_subglyphs  = gloader->current.num_subglyphs;
-        FT_UInt           num_base_subgs = gloader->base.num_subglyphs;
+        FT_UInt      n, num_base_points;
+        FT_SubGlyph  subglyph       = 0;
 
 
-        FT_Stream         old_stream     = loader->stream;
+        FT_UInt      num_points     = start_point;
+        FT_UInt      num_subglyphs  = gloader->current.num_subglyphs;
+        FT_UInt      num_base_subgs = gloader->base.num_subglyphs;
 
 
-        TT_GraphicsState  saved_GS;
+        FT_Stream    old_stream     = loader->stream;
 
 
 
 
-        if ( loader->exec )
-          saved_GS = loader->exec->GS;
-
         FT_GlyphLoader_Add( gloader );
 
         /* read each subglyph independently */
         FT_GlyphLoader_Add( gloader );
 
         /* read each subglyph independently */
           FT_Vector  pp[4];
 
 
           FT_Vector  pp[4];
 
 
-          /* reinitialize graphics state */
-          if ( loader->exec )
-            loader->exec->GS = saved_GS;
-
           /* Each time we call load_truetype_glyph in this loop, the   */
           /* value of `gloader.base.subglyphs' can change due to table */
           /* reallocations.  We thus need to recompute the subglyph    */
           /* Each time we call load_truetype_glyph in this loop, the   */
           /* value of `gloader.base.subglyphs' can change due to table */
           /* reallocations.  We thus need to recompute the subglyph    */
     glyph->metrics.horiBearingY = bbox.yMax;
     glyph->metrics.horiAdvance  = loader->pp2.x - loader->pp1.x;
 
     glyph->metrics.horiBearingY = bbox.yMax;
     glyph->metrics.horiAdvance  = loader->pp2.x - loader->pp1.x;
 
-    /* Now take care of vertical metrics.  In the case where there is    */
-    /* no vertical information within the font (relatively common), make */
-    /* up some metrics by `hand'...                                      */
+    /* adjust advance width to the value contained in the hdmx table */
+    if ( !face->postscript.isFixedPitch  &&
+         IS_HINTED( loader->load_flags ) )
+    {
+      FT_Byte*  widthp;
+
+
+      widthp = tt_face_get_device_metrics( face,
+                                           size->root.metrics.x_ppem,
+                                           glyph_index );
+
+      if ( widthp )
+        glyph->metrics.horiAdvance = *widthp << 6;
+    }
+
+    /* set glyph dimensions */
+    glyph->metrics.width  = bbox.xMax - bbox.xMin;
+    glyph->metrics.height = bbox.yMax - bbox.yMin;
 
 
+    /* Now take care of vertical metrics.  In the case where there is */
+    /* no vertical information within the font (relatively common),   */
+    /* create some metrics manually                                   */
     {
       FT_Pos  top;      /* scaled vertical top side bearing  */
       FT_Pos  advance;  /* scaled vertical advance height    */
 
 
       /* Get the unscaled top bearing and advance height. */
     {
       FT_Pos  top;      /* scaled vertical top side bearing  */
       FT_Pos  advance;  /* scaled vertical advance height    */
 
 
       /* Get the unscaled top bearing and advance height. */
-      if ( face->vertical_info &&
+      if ( face->vertical_info                   &&
            face->vertical.number_Of_VMetrics > 0 )
       {
         top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax,
            face->vertical.number_Of_VMetrics > 0 )
       {
         top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax,
       /* XXX: for now, we have no better algorithm for the lsb, but it */
       /*      should work fine.                                        */
       /*                                                               */
       /* XXX: for now, we have no better algorithm for the lsb, but it */
       /*      should work fine.                                        */
       /*                                                               */
-      glyph->metrics.vertBearingX = ( bbox.xMin - bbox.xMax ) / 2;
+      glyph->metrics.vertBearingX = glyph->metrics.horiBearingX -
+                                      glyph->metrics.horiAdvance / 2;
       glyph->metrics.vertBearingY = top;
       glyph->metrics.vertAdvance  = advance;
     }
 
       glyph->metrics.vertBearingY = top;
       glyph->metrics.vertAdvance  = advance;
     }
 
-    /* adjust advance width to the value contained in the hdmx table */
-    if ( !face->postscript.isFixedPitch &&
-         IS_HINTED( loader->load_flags )        )
-    {
-      FT_Byte*  widthp;
-
-
-      widthp = tt_face_get_device_metrics( face,
-                                           size->root.metrics.x_ppem,
-                                           glyph_index );
-
-      if ( widthp )
-        glyph->metrics.horiAdvance = *widthp << 6;
-    }
-
-    /* set glyph dimensions */
-    glyph->metrics.width  = bbox.xMax - bbox.xMin;
-    glyph->metrics.height = bbox.yMax - bbox.yMin;
-
     return 0;
   }
 
     return 0;
   }
 
       FT_Error  error = face->goto_table( face, TTAG_glyf, stream, 0 );
 
 
       FT_Error  error = face->goto_table( face, TTAG_glyf, stream, 0 );
 
 
-      if ( error )
+      if ( error == TT_Err_Table_Missing )
+        loader->glyf_offset = 0;
+      else if ( error )
       {
       {
-        FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" ));
+        FT_ERROR(( "tt_loader_init: could not access glyph table\n" ));
         return error;
       }
         return error;
       }
-      loader->glyf_offset = FT_STREAM_POS();
+      else
+        loader->glyf_offset = FT_STREAM_POS();
     }
 
     /* get face's glyph loader */
     }
 
     /* get face's glyph loader */
       loader->gloader = gloader;
     }
 
       loader->gloader = gloader;
     }
 
-    loader->load_flags    = load_flags;
+    loader->load_flags = load_flags;
 
     loader->face   = (FT_Face)face;
     loader->size   = (FT_Size)size;
 
     loader->face   = (FT_Face)face;
     loader->size   = (FT_Size)size;
           FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
       }
 
           FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
       }
 
+#ifdef TT_USE_BYTECODE_INTERPRETER
+
+      if ( IS_HINTED( load_flags ) )
+      {
+        if ( loader.exec->GS.scan_control )
+        {
+          /* convert scan conversion mode to FT_OUTLINE_XXX flags */
+          switch ( loader.exec->GS.scan_type )
+          {
+          case 0: /* simple drop-outs including stubs */
+            glyph->outline.flags |= FT_OUTLINE_INCLUDE_STUBS;
+            break;
+          case 1: /* simple drop-outs excluding stubs */
+            /* nothing; it's the default rendering mode */
+            break;
+          case 4: /* smart drop-outs including stubs */
+            glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS |
+                                    FT_OUTLINE_INCLUDE_STUBS;
+            break;
+          case 5: /* smart drop-outs excluding stubs  */
+            glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS;
+            break;
+
+          default: /* no drop-out control */
+            glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
+            break;
+          }
+        }
+        else
+          glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
+      }
+
+#endif /* TT_USE_BYTECODE_INTERPRETER */
+
       compute_glyph_metrics( &loader, glyph_index );
     }
 
       compute_glyph_metrics( &loader, glyph_index );
     }
 
index b261e97..958d67d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -34,6 +34,20 @@ FT_BEGIN_HEADER
   FT_LOCAL( void )
   TT_Init_Glyph_Loading( TT_Face  face );
 
   FT_LOCAL( void )
   TT_Init_Glyph_Loading( TT_Face  face );
 
+  FT_LOCAL( void )
+  TT_Get_HMetrics( TT_Face     face,
+                   FT_UInt     idx,
+                   FT_Bool     check,
+                   FT_Short*   lsb,
+                   FT_UShort*  aw );
+
+  FT_LOCAL( void )
+  TT_Get_VMetrics( TT_Face     face,
+                   FT_UInt     idx,
+                   FT_Bool     check,
+                   FT_Short*   tsb,
+                   FT_UShort*  ah );
+
   FT_LOCAL( FT_Error )
   TT_Load_Glyph( TT_Size       size,
                  TT_GlyphSlot  glyph,
   FT_LOCAL( FT_Error )
   TT_Load_Glyph( TT_Size       size,
                  TT_GlyphSlot  glyph,
index 0dc2c4f..1456a8c 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType GX Font Variation loader                                    */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType GX Font Variation loader                                    */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006, 2007 by                                    */
+/*  Copyright 2004, 2005, 2006, 2007, 2008, 2009 by                        */
 /*  David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /***************************************************************************/
 
 
 /***************************************************************************/
 
 
-/***************************************************************************/
-/*                                                                         */
-/* Apple documents the `fvar', `gvar', `cvar', and `avar' tables at        */
-/*                                                                         */
-/*   http://developer.apple.com/fonts/TTRefMan/RM06/Chap6[fgca]var.html    */
-/*                                                                         */
-/* The documentation for `fvar' is inconsistent.  At one point it says     */
-/* that `countSizePairs' should be 3, at another point 2.  It should be 2. */
-/*                                                                         */
-/* The documentation for `gvar' is not intelligible; `cvar' refers you to  */
-/* `gvar' and is thus also incomprehensible.                               */
-/*                                                                         */
-/* The documentation for `avar' appears correct, but Apple has no fonts    */
-/* with an `avar' table, so it is hard to test.                            */
-/*                                                                         */
-/* Many thanks to John Jenkins (at Apple) in figuring this out.            */
-/*                                                                         */
-/*                                                                         */
-/* Apple's `kern' table has some references to tuple indices, but as there */
-/* is no indication where these indices are defined, nor how to            */
-/* interpolate the kerning values (different tuples have different         */
-/* classes) this issue is ignored.                                         */
-/*                                                                         */
-/***************************************************************************/
+  /*************************************************************************/
+  /*                                                                       */
+  /* Apple documents the `fvar', `gvar', `cvar', and `avar' tables at      */
+  /*                                                                       */
+  /*   http://developer.apple.com/fonts/TTRefMan/RM06/Chap6[fgca]var.html  */
+  /*                                                                       */
+  /* The documentation for `fvar' is inconsistent.  At one point it says   */
+  /* that `countSizePairs' should be 3, at another point 2.  It should     */
+  /* be 2.                                                                 */
+  /*                                                                       */
+  /* The documentation for `gvar' is not intelligible; `cvar' refers you   */
+  /* to `gvar' and is thus also incomprehensible.                          */
+  /*                                                                       */
+  /* The documentation for `avar' appears correct, but Apple has no fonts  */
+  /* with an `avar' table, so it is hard to test.                          */
+  /*                                                                       */
+  /* Many thanks to John Jenkins (at Apple) in figuring this out.          */
+  /*                                                                       */
+  /*                                                                       */
+  /* Apple's `kern' table has some references to tuple indices, but as     */
+  /* there is no indication where these indices are defined, nor how to    */
+  /* interpolate the kerning values (different tuples have different       */
+  /* classes) this issue is ignored.                                       */
+  /*                                                                       */
+  /*************************************************************************/
 
 
 #include <ft2build.h>
 
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_CONFIG_CONFIG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_MULTIPLE_MASTERS_H
 
 #include FT_TRUETYPE_TAGS_H
 #include FT_MULTIPLE_MASTERS_H
 
-#include "ttdriver.h"
 #include "ttpload.h"
 #include "ttgxvar.h"
 
 #include "ttpload.h"
 #include "ttgxvar.h"
 
         runcnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK;
         first  = points[i++] = FT_GET_USHORT();
 
         runcnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK;
         first  = points[i++] = FT_GET_USHORT();
 
+        if ( runcnt < 1 )
+          goto Exit;
+
         /* first point not included in runcount */
         for ( j = 0; j < runcnt; ++j )
           points[i++] = (FT_UShort)( first += FT_GET_USHORT() );
         /* first point not included in runcount */
         for ( j = 0; j < runcnt; ++j )
           points[i++] = (FT_UShort)( first += FT_GET_USHORT() );
       {
         first = points[i++] = FT_GET_BYTE();
 
       {
         first = points[i++] = FT_GET_BYTE();
 
+        if ( runcnt < 1 )
+          goto Exit;
+
         for ( j = 0; j < runcnt; ++j )
           points[i++] = (FT_UShort)( first += FT_GET_BYTE() );
       }
     }
 
         for ( j = 0; j < runcnt; ++j )
           points[i++] = (FT_UShort)( first += FT_GET_BYTE() );
       }
     }
 
+  Exit:
     return points;
   }
 
     return points;
   }
 
   /*                                                                       */
   static FT_Short*
   ft_var_readpackeddeltas( FT_Stream  stream,
   /*                                                                       */
   static FT_Short*
   ft_var_readpackeddeltas( FT_Stream  stream,
-                           FT_Int     delta_cnt )
+                           FT_Offset  delta_cnt )
   {
     FT_Short  *deltas;
     FT_Int     runcnt;
   {
     FT_Short  *deltas;
     FT_Int     runcnt;
-    FT_Int     i;
-    FT_Int     j;
+    FT_Offset  i;
+    FT_Offset  j;
     FT_Memory  memory = stream->memory;
     FT_Error   error = TT_Err_Ok;
 
     FT_Memory  memory = stream->memory;
     FT_Error   error = TT_Err_Ok;
 
   }
 
 
   }
 
 
-  typedef struct  GX_GVar_Head_ {
+  typedef struct  GX_GVar_Head_
+  {
     FT_Long    version;
     FT_UShort  axisCount;
     FT_UShort  globalCoordCount;
     FT_Long    version;
     FT_UShort  axisCount;
     FT_UShort  globalCoordCount;
   /*************************************************************************/
 
 
   /*************************************************************************/
 
 
-  typedef struct  GX_FVar_Head_ {
+  typedef struct  GX_FVar_Head_
+  {
     FT_Long    version;
     FT_UShort  offsetToData;
     FT_UShort  countSizePairs;
     FT_Long    version;
     FT_UShort  offsetToData;
     FT_UShort  countSizePairs;
   } GX_FVar_Head;
 
 
   } GX_FVar_Head;
 
 
-  typedef struct  fvar_axis {
+  typedef struct  fvar_axis_
+  {
     FT_ULong   axisTag;
     FT_ULong   minValue;
     FT_ULong   defaultValue;
     FT_ULong   axisTag;
     FT_ULong   minValue;
     FT_ULong   defaultValue;
       }
 
       ns = mmvar->namedstyle;
       }
 
       ns = mmvar->namedstyle;
-      for ( i = 0; i < fvar_head.instanceCount; ++i )
+      for ( i = 0; i < fvar_head.instanceCount; ++i, ++ns )
       {
         if ( FT_FRAME_ENTER( 4L + 4L * fvar_head.axisCount ) )
           goto Exit;
       {
         if ( FT_FRAME_ENTER( 4L + 4L * fvar_head.axisCount ) )
           goto Exit;
     }
     else
     {
     }
     else
     {
-      for ( i = 0;
-            i < num_coords && blend->normalizedcoords[i] == coords[i];
-            ++i );
-        if ( i == num_coords )
-          manageCvt = mcvt_retain;
-        else
+      manageCvt = mcvt_retain;
+      for ( i = 0; i < num_coords; ++i )
+      {
+        if ( blend->normalizedcoords[i] != coords[i] )
+        {
           manageCvt = mcvt_load;
           manageCvt = mcvt_load;
+          break;
+        }
+      }
 
       /* If we don't change the blend coords then we don't need to do  */
       /* anything to the cvt table.  It will be correct.  Otherwise we */
 
       /* If we don't change the blend coords then we don't need to do  */
       /* anything to the cvt table.  It will be correct.  Otherwise we */
 
     if ( blend == NULL )
     {
 
     if ( blend == NULL )
     {
-      FT_TRACE2(( "no blend specified!\n" ));
+      FT_TRACE2(( "tt_face_vary_cvt: no blend specified\n" ));
 
       error = TT_Err_Ok;
       goto Exit;
 
       error = TT_Err_Ok;
       goto Exit;
 
     if ( face->cvt == NULL )
     {
 
     if ( face->cvt == NULL )
     {
-      FT_TRACE2(( "no `cvt ' table!\n" ));
+      FT_TRACE2(( "tt_face_vary_cvt: no `cvt ' table\n" ));
 
       error = TT_Err_Ok;
       goto Exit;
 
       error = TT_Err_Ok;
       goto Exit;
     error = face->goto_table( face, TTAG_cvar, stream, &table_len );
     if ( error )
     {
     error = face->goto_table( face, TTAG_cvar, stream, &table_len );
     if ( error )
     {
-      FT_TRACE2(( "is missing!\n" ));
+      FT_TRACE2(( "is missing\n" ));
 
       error = TT_Err_Ok;
       goto Exit;
 
       error = TT_Err_Ok;
       goto Exit;
     table_start = FT_Stream_FTell( stream );
     if ( FT_GET_LONG() != 0x00010000L )
     {
     table_start = FT_Stream_FTell( stream );
     if ( FT_GET_LONG() != 0x00010000L )
     {
-      FT_TRACE2(( "bad table version!\n" ));
+      FT_TRACE2(( "bad table version\n" ));
 
       error = TT_Err_Ok;
       goto FExit;
 
       error = TT_Err_Ok;
       goto FExit;
index 706cb4d..82dfc44 100644 (file)
@@ -84,7 +84,7 @@ FT_BEGIN_HEADER
     FT_Fixed*       normalizedcoords;
 
     FT_MM_Var*      mmvar;
     FT_Fixed*       normalizedcoords;
 
     FT_MM_Var*      mmvar;
-    FT_Int          mmvar_len;
+    FT_Offset       mmvar_len;
 
     FT_Bool         avar_checked;
     GX_AVarSegment  avar_segment;
 
     FT_Bool         avar_checked;
     GX_AVarSegment  avar_segment;
index 85c8529..13aa9a2 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType bytecode interpreter (body).                                */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType bytecode interpreter (body).                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   /*    exec  :: A handle to the target execution context.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    exec  :: A handle to the target execution context.                 */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    TrueTyoe error code.  0 means success.                             */
+  /*    TrueType error code.  0 means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Only the glyph loader and debugger should call this function.      */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Only the glyph loader and debugger should call this function.      */
   }
 
 
   }
 
 
+  /* The default value for `scan_control' is documented as FALSE in the */
+  /* TrueType specification.  This is confusing since it implies a      */
+  /* Boolean value.  However, this is not the case, thus both the       */
+  /* default values of our `scan_type' and `scan_control' fields (which */
+  /* the documentation's `scan_control' variable is split into) are     */
+  /* zero.                                                              */
+
   const TT_GraphicsState  tt_default_graphics_state =
   {
     0, 0, 0,
   const TT_GraphicsState  tt_default_graphics_state =
   {
     0, 0, 0,
 
     1, 64, 1,
     TRUE, 68, 0, 0, 9, 3,
 
     1, 64, 1,
     TRUE, 68, 0, 0, 9, 3,
-    0, FALSE, 2, 1, 1, 1
+    0, FALSE, 0, 1, 1, 1
   };
 
 
   };
 
 
 
       /* allocate object */
       if ( FT_NEW( exec ) )
 
       /* allocate object */
       if ( FT_NEW( exec ) )
-        goto Exit;
+        goto Fail;
 
 
-      /* initialize it */
+      /* initialize it; in case of error this deallocates `exec' too */
       error = Init_Context( exec, memory );
       if ( error )
         goto Fail;
       error = Init_Context( exec, memory );
       if ( error )
         goto Fail;
       driver->context = exec;
     }
 
       driver->context = exec;
     }
 
-  Exit:
     return driver->context;
 
   Fail:
     return driver->context;
 
   Fail:
-    FT_FREE( exec );
-
-    return 0;
+    return NULL;
   }
 
 
   }
 
 
     FT_ASSERT( !CUR.face->unpatented_hinting );
 #endif
 
     FT_ASSERT( !CUR.face->unpatented_hinting );
 #endif
 
-    return TT_DotFix14( dx, dy,
+    return TT_DotFix14( (FT_UInt32)dx, (FT_UInt32)dy,
                         CUR.GS.projVector.x,
                         CUR.GS.projVector.y );
   }
                         CUR.GS.projVector.x,
                         CUR.GS.projVector.y );
   }
   Dual_Project( EXEC_OP_ FT_Pos  dx,
                          FT_Pos  dy )
   {
   Dual_Project( EXEC_OP_ FT_Pos  dx,
                          FT_Pos  dy )
   {
-    return TT_DotFix14( dx, dy,
+    return TT_DotFix14( (FT_UInt32)dx, (FT_UInt32)dy,
                         CUR.GS.dualVector.x,
                         CUR.GS.dualVector.y );
   }
                         CUR.GS.dualVector.x,
                         CUR.GS.dualVector.y );
   }
       CUR.numFDefs++;
     }
 
       CUR.numFDefs++;
     }
 
+    /* Although FDEF takes unsigned 32-bit integer,  */
+    /* func # must be within unsigned 16-bit integer */
+    if ( n > 0xFFFFU )
+    {
+      CUR.error = TT_Err_Too_Many_Function_Defs;
+      return;
+    }
+
     rec->range  = CUR.curRange;
     rec->range  = CUR.curRange;
-    rec->opc    = n;
+    rec->opc    = (FT_UInt16)n;
     rec->start  = CUR.IP + 1;
     rec->active = TRUE;
 
     if ( n > CUR.maxFunc )
     rec->start  = CUR.IP + 1;
     rec->active = TRUE;
 
     if ( n > CUR.maxFunc )
-      CUR.maxFunc = n;
+      CUR.maxFunc = (FT_UInt16)n;
 
     /* Now skip the whole function definition. */
     /* We don't allow nested IDEFS & FDEFs.    */
 
     /* Now skip the whole function definition. */
     /* We don't allow nested IDEFS & FDEFs.    */
       CUR.numIDefs++;
     }
 
       CUR.numIDefs++;
     }
 
-    def->opc    = args[0];
+    /* opcode must be unsigned 8-bit integer */
+    if ( 0 > args[0] || args[0] > 0x00FF )
+    {
+      CUR.error = TT_Err_Too_Many_Instruction_Defs;
+      return;
+    }
+
+    def->opc    = (FT_Byte)args[0];
     def->start  = CUR.IP+1;
     def->range  = CUR.curRange;
     def->active = TRUE;
 
     if ( (FT_ULong)args[0] > CUR.maxIns )
     def->start  = CUR.IP+1;
     def->range  = CUR.curRange;
     def->active = TRUE;
 
     if ( (FT_ULong)args[0] > CUR.maxIns )
-      CUR.maxIns = args[0];
+      CUR.maxIns = (FT_Byte)args[0];
 
     /* Now skip the whole function definition. */
     /* We don't allow nested IDEFs & FDEFs.    */
 
     /* Now skip the whole function definition. */
     /* We don't allow nested IDEFs & FDEFs.    */
       if ( CUR.opcode & 1 )
         D = CUR_Func_project( CUR.zp0.cur + L, CUR.zp1.cur + K );
       else
       if ( CUR.opcode & 1 )
         D = CUR_Func_project( CUR.zp0.cur + L, CUR.zp1.cur + K );
       else
-        D = CUR_Func_dualproj( CUR.zp0.org + L, CUR.zp1.org + K );
+      {
+        FT_Vector*  vec1 = CUR.zp0.orus + L;
+        FT_Vector*  vec2 = CUR.zp1.orus + K;
+
+
+        if ( CUR.metrics.x_scale == CUR.metrics.y_scale )
+        {
+          /* this should be faster */
+          D = CUR_Func_dualproj( vec1, vec2 );
+          D = TT_MULFIX( D, CUR.metrics.x_scale );
+        }
+        else
+        {
+          FT_Vector  vec;
+
+
+          vec.x = TT_MULFIX( vec1->x - vec2->x, CUR.metrics.x_scale );
+          vec.y = TT_MULFIX( vec1->y - vec2->y, CUR.metrics.y_scale );
+
+          D = CUR_fast_dualproj( &vec );
+        }
+      }
     }
 
     args[0] = D;
     }
 
     args[0] = D;
       return;
     }
 
       return;
     }
 
-    A *= 64;
-
-#if 0
-    if ( ( args[0] & 0x100 ) != 0 && CUR.metrics.pointSize <= A )
+    if ( ( args[0] & 0x100 ) != 0 && CUR.tt_metrics.ppem <= A )
       CUR.GS.scan_control = TRUE;
       CUR.GS.scan_control = TRUE;
-#endif
 
     if ( ( args[0] & 0x200 ) != 0 && CUR.tt_metrics.rotated )
       CUR.GS.scan_control = TRUE;
 
     if ( ( args[0] & 0x200 ) != 0 && CUR.tt_metrics.rotated )
       CUR.GS.scan_control = TRUE;
     if ( ( args[0] & 0x400 ) != 0 && CUR.tt_metrics.stretched )
       CUR.GS.scan_control = TRUE;
 
     if ( ( args[0] & 0x400 ) != 0 && CUR.tt_metrics.stretched )
       CUR.GS.scan_control = TRUE;
 
-#if 0
-    if ( ( args[0] & 0x800 ) != 0 && CUR.metrics.pointSize > A )
+    if ( ( args[0] & 0x800 ) != 0 && CUR.tt_metrics.ppem > A )
       CUR.GS.scan_control = FALSE;
       CUR.GS.scan_control = FALSE;
-#endif
 
     if ( ( args[0] & 0x1000 ) != 0 && CUR.tt_metrics.rotated )
       CUR.GS.scan_control = FALSE;
 
     if ( ( args[0] & 0x1000 ) != 0 && CUR.tt_metrics.rotated )
       CUR.GS.scan_control = FALSE;
   static void
   Ins_SCANTYPE( INS_ARG )
   {
   static void
   Ins_SCANTYPE( INS_ARG )
   {
-    /* for compatibility with future enhancements, */
-    /* we must ignore new modes                    */
-
-    if ( args[0] >= 0 && args[0] <= 5 )
-    {
-      if ( args[0] == 3 )
-        args[0] = 2;
-
+    if ( args[0] >= 0 )
       CUR.GS.scan_type = (FT_Int)args[0];
       CUR.GS.scan_type = (FT_Int)args[0];
-    }
   }
 
 
   }
 
 
 
     /* XXX: this is probably wrong... at least it prevents memory */
     /*      corruption when zp2 is the twilight zone              */
 
     /* XXX: this is probably wrong... at least it prevents memory */
     /*      corruption when zp2 is the twilight zone              */
-    if ( last_point > CUR.zp2.n_points )
+    if ( BOUNDS( last_point, CUR.zp2.n_points ) )
     {
       if ( CUR.zp2.n_points > 0 )
         last_point = (FT_UShort)(CUR.zp2.n_points - 1);
     {
       if ( CUR.zp2.n_points > 0 )
         last_point = (FT_UShort)(CUR.zp2.n_points - 1);
     {
       if ( CUR.GS.both_x_axis )
       {
     {
       if ( CUR.GS.both_x_axis )
       {
-        dx = TT_MulFix14( args[0], 0x4000 );
+        dx = TT_MulFix14( (FT_UInt32)args[0], 0x4000 );
         dy = 0;
       }
       else
       {
         dx = 0;
         dy = 0;
       }
       else
       {
         dx = 0;
-        dy = TT_MulFix14( args[0], 0x4000 );
+        dy = TT_MulFix14( (FT_UInt32)args[0], 0x4000 );
       }
     }
     else
 #endif
     {
       }
     }
     else
 #endif
     {
-      dx = TT_MulFix14( args[0], CUR.GS.freeVector.x );
-      dy = TT_MulFix14( args[0], CUR.GS.freeVector.y );
+      dx = TT_MulFix14( (FT_UInt32)args[0], CUR.GS.freeVector.x );
+      dy = TT_MulFix14( (FT_UInt32)args[0], CUR.GS.freeVector.y );
     }
 
     while ( CUR.GS.loop > 0 )
     }
 
     while ( CUR.GS.loop > 0 )
 
     if ( CUR.GS.gep0 == 0 )   /* If in twilight zone */
     {
 
     if ( CUR.GS.gep0 == 0 )   /* If in twilight zone */
     {
-      CUR.zp0.org[point].x = TT_MulFix14( distance, CUR.GS.freeVector.x );
-      CUR.zp0.org[point].y = TT_MulFix14( distance, CUR.GS.freeVector.y ),
+      CUR.zp0.org[point].x = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.x );
+      CUR.zp0.org[point].y = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.y ),
       CUR.zp0.cur[point]   = CUR.zp0.org[point];
     }
 
       CUR.zp0.cur[point]   = CUR.zp0.org[point];
     }
 
     if ( CUR.GS.gep1 == 0 )
     {
       CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x +
     if ( CUR.GS.gep1 == 0 )
     {
       CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x +
-                             TT_MulFix14( cvt_dist, CUR.GS.freeVector.x );
+                             TT_MulFix14( (FT_UInt32)cvt_dist,
+                                          CUR.GS.freeVector.x );
 
       CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y +
 
       CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y +
-                             TT_MulFix14( cvt_dist, CUR.GS.freeVector.y );
+                             TT_MulFix14( (FT_UInt32)cvt_dist,
+                                          CUR.GS.freeVector.y );
 
       CUR.zp1.cur[point] = CUR.zp0.cur[point];
     }
 
       CUR.zp1.cur[point] = CUR.zp0.cur[point];
     }
         org_dist = CUR_Func_dualproj( &CUR.zp2.orus[point], orus_base );
 
       cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base );
         org_dist = CUR_Func_dualproj( &CUR.zp2.orus[point], orus_base );
 
       cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base );
-      new_dist = ( old_range != 0 )
-                   ? TT_MULDIV( org_dist, cur_range, old_range )
-                   : cur_dist;
+
+      if ( org_dist )
+        new_dist = ( old_range != 0 )
+                     ? TT_MULDIV( org_dist, cur_range, old_range )
+                     : cur_dist;
+      else
+        new_dist = 0;
 
       CUR_Func_move( &CUR.zp2, (FT_UShort)point, new_dist - cur_dist );
     }
 
       CUR_Func_move( &CUR.zp2, (FT_UShort)point, new_dist - cur_dist );
     }
 
 
   /* Local variables for Ins_IUP: */
 
 
   /* Local variables for Ins_IUP: */
-  typedef struct
+  typedef struct  IUP_WorkerRec_
   {
     FT_Vector*  orgs;   /* original and current coordinate */
     FT_Vector*  curs;   /* arrays                          */
   {
     FT_Vector*  orgs;   /* original and current coordinate */
     FT_Vector*  curs;   /* arrays                          */
           {
             scale_valid = 1;
             scale       = TT_MULDIV( org2 + delta2 - ( org1 + delta1 ),
           {
             scale_valid = 1;
             scale       = TT_MULDIV( org2 + delta2 - ( org1 + delta1 ),
-                                     0x10000, orus2 - orus1 );
+                                     0x10000L, orus2 - orus1 );
           }
 
           x = ( org1 + delta1 ) +
           }
 
           x = ( org1 + delta1 ) +
       end_point   = CUR.pts.contours[contour] - CUR.pts.first_point;
       first_point = point;
 
       end_point   = CUR.pts.contours[contour] - CUR.pts.first_point;
       first_point = point;
 
+      if ( CUR.pts.n_points <= end_point )
+        end_point = CUR.pts.n_points;
+
       while ( point <= end_point && ( CUR.pts.tags[point] & mask ) == 0 )
         point++;
 
       while ( point <= end_point && ( CUR.pts.tags[point] & mask ) == 0 )
         point++;
 
index 0294a1b..11d662d 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Objects manager (body).                                              */
 /*                                                                         */
 /*                                                                         */
 /*    Objects manager (body).                                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,9 +18,7 @@
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_SFNT_H
 
 #include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_SFNT_H
 
 #endif /* TT_USE_BYTECODE_INTERPRETER */
 
 
 #endif /* TT_USE_BYTECODE_INTERPRETER */
 
 
+  /* Compare the face with a list of well-known `tricky' fonts. */
+  /* This list shall be expanded as we find more of them.       */
+
+  static FT_Bool
+  tt_check_trickyness( FT_String*  name )
+  {
+#define TRICK_NAMES_MAX_CHARACTERS  16
+#define TRICK_NAMES_COUNT 7
+    static const char trick_names[TRICK_NAMES_COUNT][TRICK_NAMES_MAX_CHARACTERS+1] =
+    {
+      "DFKaiSho-SB",     /* dfkaisb.ttf */
+      "DFKaiShu",
+      "DFKai-SB",        /* kaiu.ttf */
+      "HuaTianSongTi?",  /* htst3.ttf */
+      "MingLiU",         /* mingliu.ttf & mingliu.ttc */
+      "PMingLiU",        /* mingliu.ttc */
+      "MingLi43",        /* mingli.ttf */
+    };
+    int  nn;
+
+
+    if ( !name )
+      return FALSE;
+
+    /* Note that we only check the face name at the moment; it might */
+    /* be worth to do more checks for a few special cases.           */
+    for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ )
+      if ( ft_strstr( name, trick_names[nn] ) )
+        return TRUE;
+
+    return FALSE;
+  }
+
+
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
     TT_Face       face = (TT_Face)ttface;
 
 
     TT_Face       face = (TT_Face)ttface;
 
 
-    library = face->root.driver->root.library;
+    library = ttface->driver->root.library;
     sfnt    = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
     if ( !sfnt )
       goto Bad_Format;
     sfnt    = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
     if ( !sfnt )
       goto Bad_Format;
     }
 
 #ifdef TT_USE_BYTECODE_INTERPRETER
     }
 
 #ifdef TT_USE_BYTECODE_INTERPRETER
-    face->root.face_flags |= FT_FACE_FLAG_HINTER;
+    ttface->face_flags |= FT_FACE_FLAG_HINTER;
 #endif
 
     /* If we are performing a simple font format check, exit immediately. */
 #endif
 
     /* If we are performing a simple font format check, exit immediately. */
     if ( error )
       goto Exit;
 
     if ( error )
       goto Exit;
 
+    if ( tt_check_trickyness( ttface->family_name ) )
+      ttface->face_flags |= FT_FACE_FLAG_TRICKY;
+
     error = tt_face_load_hdmx( face, stream );
     if ( error )
       goto Exit;
 
     error = tt_face_load_hdmx( face, stream );
     if ( error )
       goto Exit;
 
-    if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE )
+    if ( FT_IS_SCALABLE( ttface ) )
     {
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     {
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
-      if ( !face->root.internal->incremental_interface )
+      if ( !ttface->internal->incremental_interface )
         error = tt_face_load_loca( face, stream );
       if ( !error )
         error = tt_face_load_loca( face, stream );
       if ( !error )
-        error = tt_face_load_cvt( face, stream )  ||
-                tt_face_load_fpgm( face, stream ) ||
-                tt_face_load_prep( face, stream );
+        error = tt_face_load_cvt( face, stream );
+      if ( !error )
+        error = tt_face_load_fpgm( face, stream );
+      if ( !error )
+        error = tt_face_load_prep( face, stream );
 
 #else
 
       if ( !error )
 
 #else
 
       if ( !error )
-        error = tt_face_load_loca( face, stream ) ||
-                tt_face_load_cvt( face, stream )  ||
-                tt_face_load_fpgm( face, stream ) ||
-                tt_face_load_prep( face, stream );
+        error = tt_face_load_loca( face, stream );
+      if ( !error )
+        error = tt_face_load_cvt( face, stream );
+      if ( !error )
+        error = tt_face_load_fpgm( face, stream );
+      if ( !error )
+        error = tt_face_load_prep( face, stream );
 
 #endif
 
 
 #endif
 
         if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
           unpatented_hinting = TRUE;
 
         if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
           unpatented_hinting = TRUE;
 
-      /* Compare the face with a list of well-known `tricky' fonts. */
-      /* This list shall be expanded as we find more of them.       */
       if ( !unpatented_hinting )
       if ( !unpatented_hinting )
-      {
-        static const char* const  trick_names[] =
-        {
-          "DFKaiSho-SB",     /* dfkaisb.ttf */
-          "DFKai-SB",        /* kaiu.ttf */
-          "HuaTianSongTi?",  /* htst3.ttf */
-          "MingLiU",         /* mingliu.ttf & mingliu.ttc */
-          "PMingLiU",        /* mingliu.ttc */
-          "MingLi43",        /* mingli.ttf */
-          NULL
-        };
-        int  nn;
-
-
-        /* Note that we only check the face name at the moment; it might */
-        /* be worth to do more checks for a few special cases.           */
-        for ( nn = 0; trick_names[nn] != NULL; nn++ )
-        {
-          if ( ttface->family_name                               &&
-               ft_strstr( ttface->family_name, trick_names[nn] ) )
-          {
-            unpatented_hinting = 1;
-            break;
-          }
-        }
-      }
-
-      ttface->internal->ignore_unpatented_hinter =
-        FT_BOOL( !unpatented_hinting );
+        ttface->internal->ignore_unpatented_hinter = TRUE;
     }
 
 #endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
     }
 
 #endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
   FT_LOCAL_DEF( void )
   tt_face_done( FT_Face  ttface )           /* TT_Face */
   {
   FT_LOCAL_DEF( void )
   tt_face_done( FT_Face  ttface )           /* TT_Face */
   {
-    TT_Face       face   = (TT_Face)ttface;
-    FT_Memory     memory = face->root.memory;
-    FT_Stream     stream = face->root.stream;
+    TT_Face       face = (TT_Face)ttface;
+    FT_Memory     memory;
+    FT_Stream     stream;
+    SFNT_Service  sfnt;
 
 
-    SFNT_Service  sfnt   = (SFNT_Service)face->sfnt;
 
 
+    if ( !face )
+      return;
+
+    memory = ttface->memory;
+    stream = ttface->stream;
+    sfnt   = (SFNT_Service)face->sfnt;
 
     /* for `extended TrueType formats' (i.e. compressed versions) */
     if ( face->extra.finalizer )
 
     /* for `extended TrueType formats' (i.e. compressed versions) */
     if ( face->extra.finalizer )
 
     /* Set default metrics */
     {
 
     /* Set default metrics */
     {
-      FT_Size_Metrics*  metrics  = &size->metrics;
-      TT_Size_Metrics*  metrics2 = &size->ttmetrics;
+      TT_Size_Metrics*  metrics = &size->ttmetrics;
 
 
-      metrics->x_ppem = 0;
-      metrics->y_ppem = 0;
 
 
-      metrics2->rotated   = FALSE;
-      metrics2->stretched = FALSE;
+      metrics->rotated   = FALSE;
+      metrics->stretched = FALSE;
 
       /* set default compensation (all 0) */
       for ( i = 0; i < 4; i++ )
 
       /* set default compensation (all 0) */
       for ( i = 0; i < 4; i++ )
-        metrics2->compensations[i] = 0;
+        metrics->compensations[i] = 0;
     }
 
     /* allocate function defs, instruction defs, cvt, and storage area */
     }
 
     /* allocate function defs, instruction defs, cvt, and storage area */
     if ( !size->cvt_ready )
     {
       FT_UInt  i;
     if ( !size->cvt_ready )
     {
       FT_UInt  i;
-      TT_Face  face = (TT_Face) size->root.face;
+      TT_Face  face = (TT_Face)size->root.face;
 
 
       /* Scale the cvt values to the new ppem.          */
 
 
       /* Scale the cvt values to the new ppem.          */
 
       error = tt_size_run_prep( size );
       if ( !error )
 
       error = tt_size_run_prep( size );
       if ( !error )
-          size->cvt_ready = 1;
+        size->cvt_ready = 1;
     }
     }
+
   Exit:
     return error;
   }
   Exit:
     return error;
   }
index 6971013..30c8669 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Objects manager (specification).                                     */
 /*                                                                         */
 /*                                                                         */
 /*    Objects manager (specification).                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -99,6 +99,10 @@ FT_BEGIN_HEADER
     FT_Short       delta_shift;
 
     FT_Byte        instruct_control;
     FT_Short       delta_shift;
 
     FT_Byte        instruct_control;
+    /* According to Greg Hitchcock from Microsoft, the `scan_control'     */
+    /* variable as documented in the TrueType specification is a 32-bit   */
+    /* integer; the high-word part holds the SCANTYPE value, the low-word */
+    /* part the SCANCTRL value.  We separate it into two fields.          */
     FT_Bool        scan_control;
     FT_Int         scan_type;
 
     FT_Bool        scan_control;
     FT_Int         scan_type;
 
@@ -190,45 +194,13 @@ FT_BEGIN_HEADER
   } TT_Transform;
 
 
   } TT_Transform;
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* Subglyph loading record.  Used to load composite components.          */
-  /*                                                                       */
-  typedef struct  TT_SubglyphRec_
-  {
-    FT_Long          index;        /* subglyph index; initialized with -1 */
-    FT_Bool          is_scaled;    /* is the subglyph scaled?             */
-    FT_Bool          is_hinted;    /* should it be hinted?                */
-    FT_Bool          preserve_pps; /* preserve phantom points?            */
-
-    FT_Long          file_offset;
-
-    FT_BBox          bbox;
-    FT_Pos           left_bearing;
-    FT_Pos           advance;
-
-    TT_GlyphZoneRec  zone;
-
-    FT_Long          arg1;         /* first argument                      */
-    FT_Long          arg2;         /* second argument                     */
-
-    FT_UShort        element_flag; /* current load element flag           */
-
-    TT_Transform     transform;    /* transformation matrix               */
-
-    FT_Vector        pp1, pp2;     /* phantom points (horizontal)         */
-    FT_Vector        pp3, pp4;     /* phantom points (vertical)           */
-
-  } TT_SubGlyphRec, *TT_SubGlyph_Stack;
-
-
   /*************************************************************************/
   /*                                                                       */
   /* A note regarding non-squared pixels:                                  */
   /*                                                                       */
   /* (This text will probably go into some docs at some time; for now, it  */
   /*************************************************************************/
   /*                                                                       */
   /* A note regarding non-squared pixels:                                  */
   /*                                                                       */
   /* (This text will probably go into some docs at some time; for now, it  */
-  /*  is kept here to explain some definitions in the TIns_Metrics         */
-  /*  record).                                                             */
+  /* is kept here to explain some definitions in the TT_Size_Metrics       */
+  /* record).                                                              */
   /*                                                                       */
   /* The CVT is a one-dimensional array containing values that control     */
   /* certain important characteristics in a font, like the height of all   */
   /*                                                                       */
   /* The CVT is a one-dimensional array containing values that control     */
   /* certain important characteristics in a font, like the height of all   */
diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttpic.c b/reactos/lib/3rdparty/freetype/src/truetype/ttpic.c
new file mode 100644 (file)
index 0000000..27ec4a1
--- /dev/null
@@ -0,0 +1,79 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ttpic.c                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services for truetype module. */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "ttpic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from ttdriver.c */
+  FT_Error FT_Create_Class_tt_services( FT_Library, FT_ServiceDescRec**);
+  void FT_Destroy_Class_tt_services( FT_Library, FT_ServiceDescRec*);
+  void FT_Init_Class_tt_service_gx_multi_masters(FT_Service_MultiMastersRec*);
+  void FT_Init_Class_tt_service_truetype_glyf(FT_Service_TTGlyfRec*);
+
+  void
+  tt_driver_class_pic_free(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory memory = library->memory;
+    if ( pic_container->truetype )
+    {
+      TTModulePIC* container = (TTModulePIC*)pic_container->truetype;
+      if(container->tt_services)
+        FT_Destroy_Class_tt_services(library, container->tt_services);
+      container->tt_services = NULL;
+      FT_FREE( container );
+      pic_container->truetype = NULL;
+    }
+  }
+
+  FT_Error
+  tt_driver_class_pic_init(  FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    TTModulePIC* container;
+    FT_Memory memory = library->memory;
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->truetype = container;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    error = FT_Create_Class_tt_services(library, &container->tt_services);
+    if(error) 
+      goto Exit;
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+    FT_Init_Class_tt_service_gx_multi_masters(&container->tt_service_gx_multi_masters);
+#endif
+    FT_Init_Class_tt_service_truetype_glyf(&container->tt_service_truetype_glyf);
+Exit:
+    if(error)
+      tt_driver_class_pic_free(library);
+    return error;
+  }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttpic.h b/reactos/lib/3rdparty/freetype/src/truetype/ttpic.h
new file mode 100644 (file)
index 0000000..84de0fe
--- /dev/null
@@ -0,0 +1,59 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ttpic.h                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services for truetype module. */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __TTPIC_H__
+#define __TTPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_TT_SERVICES_GET                   tt_services
+#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET   tt_service_gx_multi_masters
+#define FT_TT_SERVICE_TRUETYPE_GLYF_GET      tt_service_truetype_glyf
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include FT_MULTIPLE_MASTERS_H
+#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include FT_SERVICE_TRUETYPE_GLYF_H
+
+  typedef struct TTModulePIC_
+  {
+    FT_ServiceDescRec* tt_services;
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+    FT_Service_MultiMastersRec tt_service_gx_multi_masters;
+#endif
+    FT_Service_TTGlyfRec tt_service_truetype_glyf;
+  } TTModulePIC;
+
+#define GET_PIC(lib)                         ((TTModulePIC*)((lib)->pic_container.truetype))
+#define FT_TT_SERVICES_GET                   (GET_PIC(library)->tt_services)
+#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET   (GET_PIC(library)->tt_service_gx_multi_masters)
+#define FT_TT_SERVICE_TRUETYPE_GLYF_GET      (GET_PIC(library)->tt_service_truetype_glyf)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __TTPIC_H__ */
+
+
+/* END */
index 9d3381b..a311b03 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType-specific tables loader (body).                              */
 /*                                                                         */
 /*                                                                         */
 /*    TrueType-specific tables loader (body).                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
-
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_loca( TT_Face    face,
                      FT_Stream  stream )
   {
     FT_Error  error;
     FT_ULong  table_len;
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_loca( TT_Face    face,
                      FT_Stream  stream )
   {
     FT_Error  error;
     FT_ULong  table_len;
+    FT_Int    shift;
 
 
     /* we need the size of the `glyf' table for malformed `loca' tables */
     error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
 
 
     /* we need the size of the `glyf' table for malformed `loca' tables */
     error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
-    if ( error )
+
+    /* it is possible that a font doesn't have a glyf table at all */
+    /* or its size is zero                                         */
+    if ( error == TT_Err_Table_Missing )
+      face->glyf_len = 0;
+    else if ( error )
       goto Exit;
 
     FT_TRACE2(( "Locations " ));
       goto Exit;
 
     FT_TRACE2(( "Locations " ));
 
     if ( face->header.Index_To_Loc_Format != 0 )
     {
 
     if ( face->header.Index_To_Loc_Format != 0 )
     {
+      shift = 2;
+
       if ( table_len >= 0x40000L )
       {
       if ( table_len >= 0x40000L )
       {
-        FT_TRACE2(( "table too large!\n" ));
+        FT_TRACE2(( "table too large\n" ));
         error = TT_Err_Invalid_Table;
         goto Exit;
       }
         error = TT_Err_Invalid_Table;
         goto Exit;
       }
-      face->num_locations = (FT_UInt)( table_len >> 2 );
+      face->num_locations = table_len >> shift;
     }
     else
     {
     }
     else
     {
+      shift = 1;
+
       if ( table_len >= 0x20000L )
       {
       if ( table_len >= 0x20000L )
       {
-        FT_TRACE2(( "table too large!\n" ));
+        FT_TRACE2(( "table too large\n" ));
         error = TT_Err_Invalid_Table;
         goto Exit;
       }
         error = TT_Err_Invalid_Table;
         goto Exit;
       }
-      face->num_locations = (FT_UInt)( table_len >> 1 );
+      face->num_locations = table_len >> shift;
+    }
+
+    if ( face->num_locations != (FT_ULong)face->root.num_glyphs )
+    {
+      FT_TRACE2(( "glyph count mismatch!  loca: %d, maxp: %d\n",
+                  face->num_locations, face->root.num_glyphs ));
+
+      /* we only handle the case where `maxp' gives a larger value */
+      if ( face->num_locations < (FT_ULong)face->root.num_glyphs )
+      {
+        FT_Long   new_loca_len = (FT_Long)face->root.num_glyphs << shift;
+
+        TT_Table  entry = face->dir_tables;
+        TT_Table  limit = entry + face->num_tables;
+
+        FT_Long   pos  = FT_Stream_Pos( stream );
+        FT_Long   dist = 0x7FFFFFFFL;
+
+
+        /* compute the distance to next table in font file */
+        for ( ; entry < limit; entry++ )
+        {
+          FT_Long  diff = entry->Offset - pos;
+
+
+          if ( diff > 0 && diff < dist )
+            dist = diff;
+        }
+
+        if ( new_loca_len <= dist )
+        {
+          face->num_locations = face->root.num_glyphs;
+          table_len           = new_loca_len;
+
+          FT_TRACE2(( "adjusting num_locations to %d\n",
+                      face->num_locations ));
+        }
+      }
     }
 
     /*
     }
 
     /*
       }
     }
 
       }
     }
 
-    /* It isn't mentioned explicitly that the `loca' table must be  */
-    /* ordered, but implicitly it refers to the length of an entry  */
-    /* as the difference between the current and the next position. */
-    /* Anyway, there do exist (malformed) fonts which don't obey    */
-    /* this rule, so we are only able to provide an upper bound for */
-    /* the size.                                                    */
+    /* The `loca' table must be ordered; it refers to the length of */
+    /* an entry as the difference between the current and the next  */
+    /* position.  However, there do exist (malformed) fonts which   */
+    /* don't obey this rule, so we are only able to provide an      */
+    /* upper bound for the size.                                    */
+    /*                                                              */
+    /* We get (intentionally) a wrong, non-zero result in case the  */
+    /* `glyf' table is missing.                                     */
     if ( pos2 >= pos1 )
       *asize = (FT_UInt)( pos2 - pos1 );
     else
     if ( pos2 >= pos1 )
       *asize = (FT_UInt)( pos2 - pos1 );
     else
     error = face->goto_table( face, TTAG_cvt, stream, &table_len );
     if ( error )
     {
     error = face->goto_table( face, TTAG_cvt, stream, &table_len );
     if ( error )
     {
-      FT_TRACE2(( "is missing!\n" ));
+      FT_TRACE2(( "is missing\n" ));
 
       face->cvt_size = 0;
       face->cvt      = NULL;
 
       face->cvt_size = 0;
       face->cvt      = NULL;
       face->font_program_size = 0;
       error                   = TT_Err_Ok;
 
       face->font_program_size = 0;
       error                   = TT_Err_Ok;
 
-      FT_TRACE2(( "is missing!\n" ));
+      FT_TRACE2(( "is missing\n" ));
     }
     else
     {
     }
     else
     {
       face->cvt_program_size = 0;
       error                  = TT_Err_Ok;
 
       face->cvt_program_size = 0;
       error                  = TT_Err_Ok;
 
-      FT_TRACE2(( "is missing!\n" ));
+      FT_TRACE2(( "is missing\n" ));
     }
     else
     {
     }
     else
     {
index baf98c0..ade0210 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += TYPE1_DRIVER
 
 define TYPE1_DRIVER
 FTMODULE_H_COMMANDS += TYPE1_DRIVER
 
 define TYPE1_DRIVER
-$(OPEN_DRIVER)t1_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, t1_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)type1     $(ECHO_DRIVER_DESC)Postscript font files with extension *.pfa or *.pfb$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)type1     $(ECHO_DRIVER_DESC)Postscript font files with extension *.pfa or *.pfb$(ECHO_DRIVER_DONE)
 endef
 
index b81a8df..16dc471 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    AFM support for Type 1 fonts (body).                                 */
 /*                                                                         */
 /*                                                                         */
 /*    AFM support for Type 1 fonts (body).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   /* read a glyph name and return the equivalent glyph index */
   static FT_Int
   t1_get_index( const char*  name,
   /* read a glyph name and return the equivalent glyph index */
   static FT_Int
   t1_get_index( const char*  name,
-                FT_UInt      len,
+                FT_Offset    len,
                 void*        user_data )
   {
     T1_Font  type1 = (T1_Font)user_data;
     FT_Int   n;
 
 
                 void*        user_data )
   {
     T1_Font  type1 = (T1_Font)user_data;
     FT_Int   n;
 
 
+    /* PS string/name length must be < 16-bit */
+    if ( ( len - 0xFFFFU ) > 0 )
+      return 0;
+
     for ( n = 0; n < type1->num_glyphs; n++ )
     {
       char*  gname = (char*)type1->glyph_names[n];
     for ( n = 0; n < type1->num_glyphs; n++ )
     {
       char*  gname = (char*)type1->glyph_names[n];
     FT_ULong  index2 = KERN_INDEX( pair2->index1, pair2->index2 );
 
 
     FT_ULong  index2 = KERN_INDEX( pair2->index1, pair2->index2 );
 
 
-    return (int)( index1 - index2 );
+    if ( index1 > index2 )
+      return 1;
+    else if ( index1 < index2 )
+      return -1;
+    else
+      return 0;
   }
 
 
   }
 
 
index 3ca21dc..8c398ee 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 driver interface (body).                                      */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 driver interface (body).                                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -84,6 +84,7 @@
     return 0;
   }
 
     return 0;
   }
 
+
   static const FT_Service_GlyphDictRec  t1_service_glyph_dict =
   {
     (FT_GlyphDict_GetNameFunc)  t1_get_glyph_name,
   static const FT_Service_GlyphDictRec  t1_service_glyph_dict =
   {
     (FT_GlyphDict_GetNameFunc)  t1_get_glyph_name,
   };
 
 
   };
 
 
- /*
-  *  POSTSCRIPT NAME SERVICE
-  *
-  */
 /*
+   *  POSTSCRIPT NAME SERVICE
+   *
+   */
 
   static const char*
   t1_get_ps_name( T1_Face  face )
 
   static const char*
   t1_get_ps_name( T1_Face  face )
     return (const char*) face->type1.font_name;
   }
 
     return (const char*) face->type1.font_name;
   }
 
+
   static const FT_Service_PsFontNameRec  t1_service_ps_name =
   {
     (FT_PsName_GetFunc)t1_get_ps_name
   };
 
 
   static const FT_Service_PsFontNameRec  t1_service_ps_name =
   {
     (FT_PsName_GetFunc)t1_get_ps_name
   };
 
 
- /*
-  *  MULTIPLE MASTERS SERVICE
-  *
-  */
 /*
+   *  MULTIPLE MASTERS SERVICE
+   *
+   */
 
 #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
   static const FT_Service_MultiMastersRec  t1_service_multi_masters =
 
 #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
   static const FT_Service_MultiMastersRec  t1_service_multi_masters =
 #endif
 
 
 #endif
 
 
- /*
-  *  POSTSCRIPT INFO SERVICE
-  *
-  */
 /*
+   *  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;
 
   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;
+
+    return T1_Err_Ok;
+  }
+
+
+  static FT_Error
+  t1_ps_get_font_extra( FT_Face           face,
+                        PS_FontExtraRec*  afont_extra )
+  {
+    *afont_extra = ((T1_Face)face)->type1.font_extra;
+
+    return T1_Err_Ok;
   }
 
 
   }
 
 
   t1_ps_has_glyph_names( FT_Face  face )
   {
     FT_UNUSED( face );
   t1_ps_has_glyph_names( FT_Face  face )
   {
     FT_UNUSED( face );
+
     return 1;
   }
 
     return 1;
   }
 
                           PS_PrivateRec*  afont_private )
   {
     *afont_private = ((T1_Face)face)->type1.private_dict;
                           PS_PrivateRec*  afont_private )
   {
     *afont_private = ((T1_Face)face)->type1.private_dict;
-    return 0;
+
+    return T1_Err_Ok;
   }
 
 
   static const FT_Service_PsInfoRec  t1_service_ps_info =
   {
     (PS_GetFontInfoFunc)   t1_ps_get_font_info,
   }
 
 
   static const FT_Service_PsInfoRec  t1_service_ps_info =
   {
     (PS_GetFontInfoFunc)   t1_ps_get_font_info,
+    (PS_GetFontExtraFunc)  t1_ps_get_font_extra,
     (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
     (PS_GetFontPrivateFunc)t1_ps_get_font_private,
   };
 
     (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
     (PS_GetFontPrivateFunc)t1_ps_get_font_private,
   };
 
+
 #ifndef T1_CONFIG_OPTION_NO_AFM
   static const FT_Service_KerningRec  t1_service_kerning =
   {
 #ifndef T1_CONFIG_OPTION_NO_AFM
   static const FT_Service_KerningRec  t1_service_kerning =
   {
   };
 #endif
 
   };
 #endif
 
- /*
-  *  SERVICE LIST
-  *
-  */
+
+  /*
+   *  SERVICE LIST
+   *
+   */
 
   static const FT_ServiceDescRec  t1_services[] =
   {
 
   static const FT_ServiceDescRec  t1_services[] =
   {
     (FT_Face_GetKerningFunc)  Get_Kerning,
     (FT_Face_AttachFunc)      T1_Read_Metrics,
 #endif
     (FT_Face_GetKerningFunc)  Get_Kerning,
     (FT_Face_AttachFunc)      T1_Read_Metrics,
 #endif
-    (FT_Face_GetAdvancesFunc) 0,
+    (FT_Face_GetAdvancesFunc) T1_Get_Advances,
     (FT_Size_RequestFunc)     T1_Size_Request,
     (FT_Size_SelectFunc)      0
   };
     (FT_Size_RequestFunc)     T1_Size_Request,
     (FT_Size_SelectFunc)      0
   };
index ad42944..9fecbeb 100644 (file)
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
 
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  t1_driver_class;
 
 
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  t1_driver_class;
 
index e08a428..1658615 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 Glyph Loader (body).                                          */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 Glyph Loader (body).                                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,6 +18,7 @@
 
 #include <ft2build.h>
 #include "t1gload.h"
 
 #include <ft2build.h>
 #include "t1gload.h"
+#include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_OUTLINE_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_OUTLINE_H
     T1_Font   type1 = &face->type1;
     FT_Error  error = T1_Err_Ok;
 
     T1_Font   type1 = &face->type1;
     FT_Error  error = T1_Err_Ok;
 
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+    FT_Incremental_InterfaceRec *inc =
+                      face->root.internal->incremental_interface;
+#endif
+
 
     decoder->font_matrix = type1->font_matrix;
     decoder->font_offset = type1->font_offset;
 
     decoder->font_matrix = type1->font_matrix;
     decoder->font_offset = type1->font_offset;
 
     /* For incremental fonts get the character data using the */
     /* callback function.                                     */
 
     /* For incremental fonts get the character data using the */
     /* callback function.                                     */
-    if ( face->root.internal->incremental_interface )
-      error = face->root.internal->incremental_interface->funcs->get_glyph_data(
-                face->root.internal->incremental_interface->object,
-                glyph_index, char_string );
+    if ( inc )
+      error = inc->funcs->get_glyph_data( inc->object,
+                                          glyph_index, char_string );
     else
 
 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
     else
 
 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     /* Incremental fonts can optionally override the metrics. */
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     /* Incremental fonts can optionally override the metrics. */
-    if ( !error && face->root.internal->incremental_interface                 &&
-         face->root.internal->incremental_interface->funcs->get_glyph_metrics )
+    if ( !error && inc && inc->funcs->get_glyph_metrics )
     {
       FT_Incremental_MetricsRec  metrics;
 
 
     {
       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;
-      error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
-                face->root.internal->incremental_interface->object,
-                glyph_index, FALSE, &metrics );
-      decoder->builder.left_bearing.x = metrics.bearing_x;
-      decoder->builder.left_bearing.y = metrics.bearing_y;
-      decoder->builder.advance.x      = metrics.advance;
+      metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
+      metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
+      metrics.advance   = FIXED_TO_INT( decoder->builder.advance.x );
+
+      error = inc->funcs->get_glyph_metrics( inc->object,
+                                             glyph_index, FALSE, &metrics );
+
+      decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
+      decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
+      decoder->builder.advance.x      = INT_TO_FIXED( metrics.advance );
       decoder->builder.advance.y      = 0;
     }
 
       decoder->builder.advance.y      = 0;
     }
 
   }
 
 
   }
 
 
+  FT_LOCAL_DEF( FT_Error )
+  T1_Get_Advances( T1_Face    face,
+                   FT_UInt    first,
+                   FT_UInt    count,
+                   FT_ULong   load_flags,
+                   FT_Fixed*  advances )
+  {
+    T1_DecoderRec  decoder;
+    T1_Font        type1 = &face->type1;
+    PSAux_Service  psaux = (PSAux_Service)face->psaux;
+    FT_UInt        nn;
+    FT_Error       error;
+
+
+    if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
+    {
+      for ( nn = 0; nn < count; nn++ )
+        advances[nn] = 0;
+
+      return T1_Err_Ok;
+    }
+
+    error = psaux->t1_decoder_funcs->init( &decoder,
+                                           (FT_Face)face,
+                                           0, /* size       */
+                                           0, /* glyph slot */
+                                           (FT_Byte**)type1->glyph_names,
+                                           face->blend,
+                                           0,
+                                           FT_RENDER_MODE_NORMAL,
+                                           T1_Parse_Glyph );
+    if ( error )
+      return error;
+
+    decoder.builder.metrics_only = 1;
+    decoder.builder.load_points  = 0;
+
+    decoder.num_subrs = type1->num_subrs;
+    decoder.subrs     = type1->subrs;
+    decoder.subrs_len = type1->subrs_len;
+
+    decoder.buildchar     = face->buildchar;
+    decoder.len_buildchar = face->len_buildchar;
+
+    for ( nn = 0; nn < count; nn++ )
+    {
+      error = T1_Parse_Glyph( &decoder, first + nn );
+      if ( !error )
+        advances[nn] = FIXED_TO_INT( decoder.builder.advance.x );
+      else
+        advances[nn] = 0;
+    }
+
+    return T1_Err_Ok;
+  }
+
+
   FT_LOCAL_DEF( FT_Error )
   T1_Load_Glyph( T1_GlyphSlot  glyph,
                  T1_Size       size,
   FT_LOCAL_DEF( FT_Error )
   T1_Load_Glyph( T1_GlyphSlot  glyph,
                  T1_Size       size,
     if ( load_flags & FT_LOAD_NO_RECURSE )
       load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
 
     if ( load_flags & FT_LOAD_NO_RECURSE )
       load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
 
-    glyph->x_scale = size->root.metrics.x_scale;
-    glyph->y_scale = size->root.metrics.y_scale;
+    if ( size )
+    {
+      glyph->x_scale = size->root.metrics.x_scale;
+      glyph->y_scale = size->root.metrics.y_scale;
+    }
+    else
+    {
+      glyph->x_scale = 0x10000L;
+      glyph->y_scale = 0x10000L;
+    }
 
     glyph->root.outline.n_points   = 0;
     glyph->root.outline.n_contours = 0;
 
     glyph->root.outline.n_points   = 0;
     glyph->root.outline.n_contours = 0;
         FT_Slot_Internal  internal = glyph->root.internal;
 
 
         FT_Slot_Internal  internal = glyph->root.internal;
 
 
-        glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
-        glyph->root.metrics.horiAdvance  = decoder.builder.advance.x;
-        internal->glyph_matrix           = font_matrix;
-        internal->glyph_delta            = font_offset;
-        internal->glyph_transformed      = 1;
+        glyph->root.metrics.horiBearingX =
+          FIXED_TO_INT( decoder.builder.left_bearing.x );
+        glyph->root.metrics.horiAdvance  =
+          FIXED_TO_INT( decoder.builder.advance.x );
+
+        internal->glyph_matrix      = font_matrix;
+        internal->glyph_delta       = font_offset;
+        internal->glyph_transformed = 1;
       }
       else
       {
       }
       else
       {
 
 
         /* copy the _unscaled_ advance width */
 
 
         /* copy the _unscaled_ advance width */
-        metrics->horiAdvance                    = decoder.builder.advance.x;
-        glyph->root.linearHoriAdvance           = decoder.builder.advance.x;
+        metrics->horiAdvance =
+          FIXED_TO_INT( decoder.builder.advance.x );
+        glyph->root.linearHoriAdvance =
+          FIXED_TO_INT( decoder.builder.advance.x );
         glyph->root.internal->glyph_transformed = 0;
 
         /* make up vertical ones */
         glyph->root.internal->glyph_transformed = 0;
 
         /* make up vertical ones */
             }
 
           /* Then scale the metrics */
             }
 
           /* Then scale the metrics */
-          metrics->horiAdvance  = FT_MulFix( metrics->horiAdvance,  x_scale );
-          metrics->vertAdvance  = FT_MulFix( metrics->vertAdvance,  y_scale );
+          metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
+          metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
         }
 
         /* compute the other metrics */
         }
 
         /* compute the other metrics */
index de87896..100df06 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 Glyph Loader (specification).                                 */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 Glyph Loader (specification).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2008 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -31,6 +31,13 @@ FT_BEGIN_HEADER
   T1_Compute_Max_Advance( T1_Face  face,
                           FT_Pos*  max_advance );
 
   T1_Compute_Max_Advance( T1_Face  face,
                           FT_Pos*  max_advance );
 
+  FT_LOCAL( FT_Error )
+  T1_Get_Advances( T1_Face    face,
+                   FT_UInt    first,
+                   FT_UInt    count,
+                   FT_ULong   load_flags,
+                   FT_Fixed*  advances );
+
   FT_LOCAL( FT_Error )
   T1_Load_Glyph( T1_GlyphSlot  glyph,
                  T1_Size       size,
   FT_LOCAL( FT_Error )
   T1_Load_Glyph( T1_GlyphSlot  glyph,
                  T1_Size       size,
index 55177ee..d867e94 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 font loader (body).                                           */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 font loader (body).                                           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -65,6 +65,7 @@
 #include FT_CONFIG_CONFIG_H
 #include FT_MULTIPLE_MASTERS_H
 #include FT_INTERNAL_TYPE1_TYPES_H
 #include FT_CONFIG_CONFIG_H
 #include FT_MULTIPLE_MASTERS_H
 #include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_INTERNAL_CALC_H
 
 #include "t1load.h"
 #include "t1errors.h"
 
 #include "t1load.h"
 #include "t1errors.h"
   }
 
 
   }
 
 
-#define FT_INT_TO_FIXED( a )  ( (a) << 16 )
-#define FT_FIXED_TO_INT( a )  ( FT_RoundFix( a ) >> 16 )
-
-
   /*************************************************************************/
   /*                                                                       */
   /* Given a normalized (blend) coordinate, figure out the design          */
   /*************************************************************************/
   /*                                                                       */
   /* Given a normalized (blend) coordinate, figure out the design          */
 
 
     if ( ncv <= axismap->blend_points[0] )
 
 
     if ( ncv <= axismap->blend_points[0] )
-      return axismap->design_points[0];
+      return INT_TO_FIXED( axismap->design_points[0] );
 
     for ( j = 1; j < axismap->num_points; ++j )
     {
 
     for ( j = 1; j < axismap->num_points; ++j )
     {
                                  axismap->blend_points[j] -
                                    axismap->blend_points[j - 1] );
 
                                  axismap->blend_points[j] -
                                    axismap->blend_points[j - 1] );
 
-
-        return axismap->design_points[j - 1] +
+        return INT_TO_FIXED( axismap->design_points[j - 1] ) +
                  FT_MulDiv( t,
                             axismap->design_points[j] -
                               axismap->design_points[j - 1],
                  FT_MulDiv( t,
                             axismap->design_points[j] -
                               axismap->design_points[j - 1],
       }
     }
 
       }
     }
 
-    return axismap->design_points[axismap->num_points - 1];
+    return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );
   }
 
 
   }
 
 
     for ( i = 0 ; i < mmaster.num_axis; ++i )
     {
       mmvar->axis[i].name    = mmaster.axis[i].name;
     for ( i = 0 ; i < mmaster.num_axis; ++i )
     {
       mmvar->axis[i].name    = mmaster.axis[i].name;
-      mmvar->axis[i].minimum = FT_INT_TO_FIXED( mmaster.axis[i].minimum);
-      mmvar->axis[i].maximum = FT_INT_TO_FIXED( mmaster.axis[i].maximum);
+      mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum);
+      mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum);
       mmvar->axis[i].def     = ( mmvar->axis[i].minimum +
                                    mmvar->axis[i].maximum ) / 2;
                             /* Does not apply.  But this value is in range */
       mmvar->axis[i].def     = ( mmvar->axis[i].minimum +
                                    mmvar->axis[i].maximum ) / 2;
                             /* Does not apply.  But this value is in range */
-      mmvar->axis[i].strid   = 0xFFFFFFFFUL;   /* Does not apply */
-      mmvar->axis[i].tag     = 0xFFFFFFFFUL;   /* Does not apply */
+      mmvar->axis[i].strid   = (FT_UInt)-1;    /* Does not apply */
+      mmvar->axis[i].tag     = (FT_ULong)-1;   /* Does not apply */
 
       if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
         mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
 
       if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
         mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
         mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' );
     }
 
         mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' );
     }
 
-    if ( blend->num_designs == 1U << blend->num_axis )
+    if ( blend->num_designs == ( 1U << blend->num_axis ) )
     {
       mm_weights_unmap( blend->default_weight_vector,
                         axiscoords,
                         blend->num_axis );
 
       for ( i = 0; i < mmaster.num_axis; ++i )
     {
       mm_weights_unmap( blend->default_weight_vector,
                         axiscoords,
                         blend->num_axis );
 
       for ( i = 0; i < mmaster.num_axis; ++i )
-        mmvar->axis[i].def =
-          FT_INT_TO_FIXED( mm_axis_unmap( &blend->design_map[i],
-                                          axiscoords[i] ) );
+        mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i],
+                                            axiscoords[i] );
     }
 
     *master = mmvar;
     }
 
     *master = mmvar;
      if ( num_coords <= 4 && num_coords > 0 )
      {
        for ( i = 0; i < num_coords; ++i )
      if ( num_coords <= 4 && num_coords > 0 )
      {
        for ( i = 0; i < num_coords; ++i )
-         lcoords[i] = FT_FIXED_TO_INT( coords[i] );
+         lcoords[i] = FIXED_TO_INT( coords[i] );
        error = T1_Set_MM_Design( face, num_coords, lcoords );
      }
 
        error = T1_Set_MM_Design( face, num_coords, lcoords );
      }
 
     }
     if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
     {
     }
     if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
     {
-      FT_ERROR(( "parse_blend_design_positions:" ));
-      FT_ERROR(( " incorrect number of designs: %d\n",
+      FT_ERROR(( "parse_blend_design_positions:"
+                 " incorrect number of designs: %d\n",
                  num_designs ));
       error = T1_Err_Invalid_File_Format;
       goto Exit;
                  num_designs ));
       error = T1_Err_Invalid_File_Format;
       goto Exit;
 
       for ( n = 0; n < 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_AXIS];
         T1_Token     token;
         FT_Int       axis, n_axis;
 
         T1_Token     token;
         FT_Int       axis, n_axis;
 
 
         if ( n == 0 )
         {
 
         if ( n == 0 )
         {
+          if ( n_axis <= 0 || n_axis > T1_MAX_MM_AXIS )
+          {
+            FT_ERROR(( "parse_blend_design_positions:"
+                       " invalid number of axes: %d\n",
+                       n_axis ));
+            error = T1_Err_Invalid_File_Format;
+            goto Exit;
+          }
+
           num_axis = n_axis;
           error = t1_allocate_blend( face, num_designs, num_axis );
           if ( error )
           num_axis = n_axis;
           error = t1_allocate_blend( face, num_designs, num_axis );
           if ( error )
     }
     if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
     {
     }
     if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
     {
-      FT_ERROR(( "parse_weight_vector:" ));
-      FT_ERROR(( " incorrect number of designs: %d\n",
+      FT_ERROR(( "parse_weight_vector:"
+                 " incorrect number of designs: %d\n",
                  num_designs ));
       error = T1_Err_Invalid_File_Format;
       goto Exit;
                  num_designs ));
       error = T1_Err_Invalid_File_Format;
       goto Exit;
     else if ( blend->num_designs != (FT_UInt)num_designs )
     {
       FT_ERROR(( "parse_weight_vector:"
     else if ( blend->num_designs != (FT_UInt)num_designs )
     {
       FT_ERROR(( "parse_weight_vector:"
-                 " /BlendDesignPosition and /WeightVector have\n" ));
-      FT_ERROR(( "                    "
-                 " different number of elements!\n" ));
+                 " /BlendDesignPosition and /WeightVector have\n"
+                 "                    "
+                 " different number of elements\n" ));
       error = T1_Err_Invalid_File_Format;
       goto Exit;
     }
       error = T1_Err_Invalid_File_Format;
       goto Exit;
     }
       }
       break;
 
       }
       break;
 
+    case T1_FIELD_LOCATION_FONT_EXTRA:
+      dummy_object = &face->type1.font_extra;
+      objects      = &dummy_object;
+      max_objects  = 0;
+      break;
+
     case T1_FIELD_LOCATION_PRIVATE:
       dummy_object = &face->type1.private_dict;
       objects      = &dummy_object;
     case T1_FIELD_LOCATION_PRIVATE:
       dummy_object = &face->type1.private_dict;
       objects      = &dummy_object;
     cur = parser->root.cursor;
     if ( cur >= limit )
     {
     cur = parser->root.cursor;
     if ( cur >= limit )
     {
-      FT_ERROR(( "parse_encoding: out of bounds!\n" ));
+      FT_ERROR(( "parse_encoding: out of bounds\n" ));
       parser->root.error = T1_Err_Invalid_File_Format;
       return;
     }
       parser->root.error = T1_Err_Invalid_File_Format;
       return;
     }
 
             n++;
           }
 
             n++;
           }
+          else if ( only_immediates )
+          {
+            /* Since the current position is not updated for           */
+            /* immediates-only mode we would get an infinite loop if   */
+            /* we don't do anything here.                              */
+            /*                                                         */
+            /* This encoding array is not valid according to the type1 */
+            /* specification (it might be an encoding for a CID type1  */
+            /* font, however), so we conclude that this font is NOT a  */
+            /* type1 font.                                             */
+            parser->root.error = FT_Err_Unknown_File_Format;
+            return;
+          }
         }
         else
         {
         }
         else
         {
     PS_Table   table  = &loader->subrs;
     FT_Memory  memory = parser->root.memory;
     FT_Error   error;
     PS_Table   table  = &loader->subrs;
     FT_Memory  memory = parser->root.memory;
     FT_Error   error;
-    FT_Int     n, num_subrs;
+    FT_Int     num_subrs;
 
 
-    PSAux_Service  psaux  = (PSAux_Service)face->psaux;
+    PSAux_Service  psaux = (PSAux_Service)face->psaux;
 
 
     T1_Skip_Spaces( parser );
 
 
     T1_Skip_Spaces( parser );
         goto Fail;
     }
 
         goto Fail;
     }
 
-    /* the format is simple:                                 */
-    /*                                                       */
-    /*   `index' + binary data                               */
-    /*                                                       */
-    for ( n = 0; n < num_subrs; n++ )
+    /* the format is simple:   */
+    /*                         */
+    /*   `index' + binary data */
+    /*                         */
+    for (;;)
     {
       FT_Long   idx, size;
       FT_Byte*  base;
 
 
     {
       FT_Long   idx, size;
       FT_Byte*  base;
 
 
-      /* If the next token isn't `dup', we are also done.  This */
-      /* happens when there are `holes' in the Subrs array.     */
+      /* If the next token isn't `dup' we are done. */
       if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 )
         break;
 
       if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 )
         break;
 
         FT_Byte*  temp;
 
 
         FT_Byte*  temp;
 
 
-        if ( size <= face->type1.private_dict.lenIV )
+        /* some fonts define empty subr records -- this is not totally */
+        /* compliant to the specification (which says they should at   */
+        /* least contain a `return'), but we support them anyway       */
+        if ( size < face->type1.private_dict.lenIV )
         {
           error = T1_Err_Invalid_File_Format;
           goto Fail;
         {
           error = T1_Err_Invalid_File_Format;
           goto Fail;
       }
     }
 
       }
     }
 
-    if ( loader->num_glyphs )
-      return;
-    else
-      loader->num_glyphs = n;
+    loader->num_glyphs = n;
 
     /* if /.notdef is found but does not occupy index 0, do our magic. */
 
     /* if /.notdef is found but does not occupy index 0, do our magic. */
-    if ( ft_strcmp( (const char*)".notdef",
-                    (const char*)name_table->elements[0] ) &&
-         notdef_found                                      )
+    if ( notdef_found                                                 &&
+         ft_strcmp( ".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   */
     {
       /* Swap glyph in index 0 with /.notdef glyph.  First, add index 0  */
       /* name and code entries to swap_table.  Then place notdef_index   */
       /* and add our own /.notdef glyph to index 0.               */
 
       /* 0 333 hsbw endchar */
       /* and add our own /.notdef glyph to index 0.               */
 
       /* 0 333 hsbw endchar */
-      FT_Byte  notdef_glyph[] = {0x8B, 0xF7, 0xE1, 0x0D, 0x0E};
+      FT_Byte  notdef_glyph[] = { 0x8B, 0xF7, 0xE1, 0x0D, 0x0E };
       char*    notdef_name    = (char *)".notdef";
 
 
       char*    notdef_name    = (char *)".notdef";
 
 
         goto Fail;
 
       /* we added a glyph. */
         goto Fail;
 
       /* we added a glyph. */
-      loader->num_glyphs = n + 1;
+      loader->num_glyphs += 1;
     }
 
     return;
     }
 
     return;
 #endif
       if ( !loader.charstrings.init )
       {
 #endif
       if ( !loader.charstrings.init )
       {
-        FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face!\n" ));
+        FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" ));
         error = T1_Err_Invalid_File_Format;
       }
 
         error = T1_Err_Invalid_File_Format;
       }
 
       /* the index is then stored in type1.encoding.char_index, and */
       /* a the name to type1.encoding.char_name                     */
 
       /* the index is then stored in type1.encoding.char_index, and */
       /* a the name to type1.encoding.char_name                     */
 
-      min_char = +32000;
-      max_char = -32000;
+      min_char = 0;
+      max_char = 0;
 
       charcode = 0;
       for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
 
       charcode = 0;
       for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
               {
                 if ( charcode < min_char )
                   min_char = charcode;
               {
                 if ( charcode < min_char )
                   min_char = charcode;
-                if ( charcode > max_char )
-                  max_char = charcode;
+                if ( charcode >= max_char )
+                  max_char = charcode + 1;
               }
               break;
             }
           }
       }
 
               }
               break;
             }
           }
       }
 
-      /*
-       *  Yes, this happens: Certain PDF-embedded fonts have only a
-       *  `.notdef' glyph defined!
-       */
-
-      if ( min_char > max_char )
-      {
-        min_char = 0;
-        max_char = loader.encoding_table.max_elems;
-      }
-
       type1->encoding.code_first = min_char;
       type1->encoding.code_last  = max_char;
       type1->encoding.num_chars  = loader.num_chars;
       type1->encoding.code_first = min_char;
       type1->encoding.code_last  = max_char;
       type1->encoding.num_chars  = loader.num_chars;
index 3d08336..e9357e6 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 objects manager (body).                                       */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 objects manager (body).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -17,6 +17,7 @@
 
 
 #include <ft2build.h>
 
 
 #include <ft2build.h>
+#include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_TRUETYPE_IDS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_TRUETYPE_IDS_H
@@ -90,7 +91,7 @@
   FT_LOCAL_DEF( FT_Error )
   T1_Size_Init( T1_Size  size )
   {
   FT_LOCAL_DEF( FT_Error )
   T1_Size_Init( T1_Size  size )
   {
-    FT_Error           error = 0;
+    FT_Error           error = T1_Err_Ok;
     PSH_Globals_Funcs  funcs = T1_Size_Get_Globals_Funcs( size );
 
 
     PSH_Globals_Funcs  funcs = T1_Size_Get_Globals_Funcs( size );
 
 
   FT_LOCAL_DEF( void )
   T1_Face_Done( T1_Face  face )
   {
   FT_LOCAL_DEF( void )
   T1_Face_Done( T1_Face  face )
   {
-    if ( face )
-    {
-      FT_Memory  memory = face->root.memory;
-      T1_Font    type1  = &face->type1;
+    FT_Memory  memory;
+    T1_Font    type1;
+
+
+    if ( !face )
+      return;
 
 
+    memory = face->root.memory;
+    type1  = &face->type1;
 
 #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
 
 #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
-      /* release multiple masters information */
-      FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
+    /* release multiple masters information */
+    FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
 
 
-      if ( face->buildchar )
-      {
-        FT_FREE( face->buildchar );
+    if ( face->buildchar )
+    {
+      FT_FREE( face->buildchar );
 
 
-        face->buildchar     = NULL;
-        face->len_buildchar = 0;
-      }
+      face->buildchar     = NULL;
+      face->len_buildchar = 0;
+    }
 
 
-      T1_Done_Blend( face );
-      face->blend = 0;
+    T1_Done_Blend( face );
+    face->blend = 0;
 #endif
 
 #endif
 
-      /* release font info strings */
-      {
-        PS_FontInfo  info = &type1->font_info;
+    /* release font info strings */
+    {
+      PS_FontInfo  info = &type1->font_info;
 
 
 
 
-        FT_FREE( info->version );
-        FT_FREE( info->notice );
-        FT_FREE( info->full_name );
-        FT_FREE( info->family_name );
-        FT_FREE( info->weight );
-      }
+      FT_FREE( info->version );
+      FT_FREE( info->notice );
+      FT_FREE( info->full_name );
+      FT_FREE( info->family_name );
+      FT_FREE( info->weight );
+    }
 
 
-      /* release top dictionary */
-      FT_FREE( type1->charstrings_len );
-      FT_FREE( type1->charstrings );
-      FT_FREE( type1->glyph_names );
+    /* release top dictionary */
+    FT_FREE( type1->charstrings_len );
+    FT_FREE( type1->charstrings );
+    FT_FREE( type1->glyph_names );
 
 
-      FT_FREE( type1->subrs );
-      FT_FREE( type1->subrs_len );
+    FT_FREE( type1->subrs );
+    FT_FREE( type1->subrs_len );
 
 
-      FT_FREE( type1->subrs_block );
-      FT_FREE( type1->charstrings_block );
-      FT_FREE( type1->glyph_names_block );
+    FT_FREE( type1->subrs_block );
+    FT_FREE( type1->charstrings_block );
+    FT_FREE( type1->glyph_names_block );
 
 
-      FT_FREE( type1->encoding.char_index );
-      FT_FREE( type1->encoding.char_name );
-      FT_FREE( type1->font_name );
+    FT_FREE( type1->encoding.char_index );
+    FT_FREE( type1->encoding.char_name );
+    FT_FREE( type1->font_name );
 
 #ifndef T1_CONFIG_OPTION_NO_AFM
 
 #ifndef T1_CONFIG_OPTION_NO_AFM
-      /* release afm data if present */
-      if ( face->afm_data )
-        T1_Done_Metrics( memory, (AFM_FontInfo)face->afm_data );
+    /* release afm data if present */
+    if ( face->afm_data )
+      T1_Done_Metrics( memory, (AFM_FontInfo)face->afm_data );
 #endif
 
 #endif
 
-      /* release unicode map, if any */
+    /* release unicode map, if any */
 #if 0
 #if 0
-      FT_FREE( face->unicode_map_rec.maps );
-      face->unicode_map_rec.num_maps = 0;
-      face->unicode_map              = NULL;
+    FT_FREE( face->unicode_map_rec.maps );
+    face->unicode_map_rec.num_maps = 0;
+    face->unicode_map              = NULL;
 #endif
 
 #endif
 
-      face->root.family_name = 0;
-      face->root.style_name  = 0;
-    }
+    face->root.family_name = NULL;
+    face->root.style_name  = NULL;
   }
 
 
   }
 
 
 
     FT_UNUSED( num_params );
     FT_UNUSED( params );
 
     FT_UNUSED( num_params );
     FT_UNUSED( params );
-    FT_UNUSED( face_index );
     FT_UNUSED( stream );
 
 
     FT_UNUSED( stream );
 
 
       goto Exit;
 
     /* check the face index */
       goto Exit;
 
     /* check the face index */
-    if ( face_index != 0 )
+    if ( face_index > 0 )
     {
       FT_ERROR(( "T1_Face_Init: invalid face index\n" ));
       error = T1_Err_Invalid_Argument;
     {
       FT_ERROR(( "T1_Face_Init: invalid face index\n" ));
       error = T1_Err_Invalid_Argument;
 
 
       root->num_glyphs = type1->num_glyphs;
 
 
       root->num_glyphs = type1->num_glyphs;
-      root->face_index = face_index;
+      root->face_index = 0;
 
       root->face_flags = FT_FACE_FLAG_SCALABLE    |
                          FT_FACE_FLAG_HORIZONTAL  |
 
       root->face_flags = FT_FACE_FLAG_SCALABLE    |
                          FT_FACE_FLAG_HORIZONTAL  |
 
       /* XXX: TODO -- add kerning with .afm support */
 
 
       /* XXX: TODO -- add kerning with .afm support */
 
+
+      /* The following code to extract the family and the style is very   */
+      /* simplistic and might get some things wrong.  For a full-featured */
+      /* algorithm you might have a look at the whitepaper given at       */
+      /*                                                                  */
+      /*   http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */
+
       /* get style name -- be careful, some broken fonts only */
       /* have a `/FontName' dictionary entry!                 */
       root->family_name = info->family_name;
       /* get style name -- be careful, some broken fonts only */
       /* have a `/FontName' dictionary entry!                 */
       root->family_name = info->family_name;
-      /* assume "Regular" style if we don't know better */
-      root->style_name = (char *)"Regular";
+      root->style_name  = NULL;
+
       if ( root->family_name )
       {
         char*  full   = info->full_name;
       if ( root->family_name )
       {
         char*  full   = info->full_name;
 
         if ( full )
         {
 
         if ( full )
         {
+          FT_Bool  the_same = TRUE;
+
+
           while ( *full )
           {
             if ( *full == *family )
           while ( *full )
           {
             if ( *full == *family )
                 family++;
               else
               {
                 family++;
               else
               {
+                the_same = FALSE;
+
                 if ( !*family )
                   root->style_name = full;
                 break;
               }
             }
           }
                 if ( !*family )
                   root->style_name = full;
                 break;
               }
             }
           }
+
+          if ( the_same )
+            root->style_name = (char *)"Regular";
         }
       }
       else
         }
       }
       else
           root->family_name = type1->font_name;
       }
 
           root->family_name = type1->font_name;
       }
 
+      if ( !root->style_name )
+      {
+        if ( info->weight )
+          root->style_name = info->weight;
+        else
+          /* assume `Regular' style because we don't know better */
+          root->style_name = (char *)"Regular";
+      }
+
       /* compute style flags */
       root->style_flags = 0;
       if ( info->italic_angle )
       /* compute style flags */
       root->style_flags = 0;
       if ( info->italic_angle )
 
         /* in case of error, keep the standard width */
         if ( !error )
 
         /* in case of error, keep the standard width */
         if ( !error )
-          root->max_advance_width = (FT_Short)max_advance;
+          root->max_advance_width = (FT_Short)FIXED_TO_INT( max_advance );
         else
         else
-          error = 0;   /* clear error */
+          error = T1_Err_Ok;   /* clear error */
       }
 
       root->max_advance_height = root->height;
       }
 
       root->max_advance_height = root->height;
 
         charmap.face = root;
 
 
         charmap.face = root;
 
-        /* first of all, try to synthetize a Unicode charmap */
+        /* first of all, try to synthesize a Unicode charmap */
         charmap.platform_id = 3;
         charmap.encoding_id = 1;
         charmap.encoding    = FT_ENCODING_UNICODE;
         charmap.platform_id = 3;
         charmap.encoding_id = 1;
         charmap.encoding    = FT_ENCODING_UNICODE;
index 1b252c7..1bef56b 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 parser (body).                                                */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 parser (body).                                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -35,7 +35,6 @@
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 
   /*************************************************************************/
 
 
   /*************************************************************************/
 
 
+  /* see Adobe Technical Note 5040.Download_Fonts.pdf */
+
   static FT_Error
   read_pfb_tag( FT_Stream   stream,
                 FT_UShort  *atag,
   static FT_Error
   read_pfb_tag( FT_Stream   stream,
                 FT_UShort  *atag,
-                FT_Long    *asize )
+                FT_ULong   *asize )
   {
     FT_Error   error;
     FT_UShort  tag;
   {
     FT_Error   error;
     FT_UShort  tag;
-    FT_Long    size;
+    FT_ULong   size;
 
 
     *atag  = 0;
 
 
     *atag  = 0;
@@ -82,7 +83,7 @@
     {
       if ( tag == 0x8001U || tag == 0x8002U )
       {
     {
       if ( tag == 0x8001U || tag == 0x8002U )
       {
-        if ( !FT_READ_LONG_LE( size ) )
+        if ( !FT_READ_ULONG_LE( size ) )
           *asize = size;
       }
 
           *asize = size;
       }
 
   {
     FT_Error   error;
     FT_UShort  tag;
   {
     FT_Error   error;
     FT_UShort  tag;
-    FT_Long    size;
+    FT_ULong   dummy;
 
 
     if ( FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
 
 
     if ( FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
-    error = read_pfb_tag( stream, &tag, &size );
+    error = read_pfb_tag( stream, &tag, &dummy );
     if ( error )
       goto Exit;
 
     if ( error )
       goto Exit;
 
+    /* We assume that the first segment in a PFB is always encoded as   */
+    /* text.  This might be wrong (and the specification doesn't insist */
+    /* on that), but we have never seen a counterexample.               */
     if ( tag != 0x8001U && FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
     if ( !FT_FRAME_ENTER( header_length ) )
     {
     if ( tag != 0x8001U && FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
     if ( !FT_FRAME_ENTER( header_length ) )
     {
-      error = 0;
+      error = T1_Err_Ok;
 
       if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 )
         error = T1_Err_Unknown_File_Format;
 
       if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 )
         error = T1_Err_Unknown_File_Format;
   {
     FT_Error   error;
     FT_UShort  tag;
   {
     FT_Error   error;
     FT_UShort  tag;
-    FT_Long    size;
+    FT_ULong   size;
 
 
     psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );
 
 
     psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );
     /* Here a short summary of what is going on:                      */
     /*                                                                */
     /*   When creating a new Type 1 parser, we try to locate and load */
     /* Here a short summary of what is going on:                      */
     /*                                                                */
     /*   When creating a new Type 1 parser, we try to locate and load */
-    /*   the base dictionary if this is possible (i.e. for PFB        */
+    /*   the base dictionary if this is possible (i.e., for PFB       */
     /*   files).  Otherwise, we load 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 and load the base dictionary in it.                 */
     /*                                                                */
     /*   files).  Otherwise, we load 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 and load the base dictionary in it.                 */
     /*                                                                */
-    /*   parser->in_pfb is set if we are in a binary (".pfb") font.   */
+    /*   parser->in_pfb is set if we are in a binary (`.pfb') font.   */
     /*   parser->in_memory is set if we have a memory stream.         */
     /*                                                                */
 
     /*   parser->in_memory is set if we have a memory stream.         */
     /*                                                                */
 
-    /* try to compute the size of the base dictionary;   */
-    /* look for a Postscript binary file tag, i.e 0x8001 */
+    /* try to compute the size of the base dictionary;     */
+    /* look for a Postscript binary file tag, i.e., 0x8001 */
     if ( FT_STREAM_SEEK( 0L ) )
       goto Exit;
 
     if ( FT_STREAM_SEEK( 0L ) )
       goto Exit;
 
     }
     else
     {
     }
     else
     {
-      /* read segment in memory - this is clumsy, but so does the format */
+      /* read segment in memory -- this is clumsy, but so does the format */
       if ( FT_ALLOC( parser->base_dict, size )       ||
            FT_STREAM_READ( parser->base_dict, size ) )
         goto Exit;
       if ( FT_ALLOC( parser->base_dict, size )       ||
            FT_STREAM_READ( parser->base_dict, size ) )
         goto Exit;
     FT_Stream  stream = parser->stream;
     FT_Memory  memory = parser->root.memory;
     FT_Error   error  = T1_Err_Ok;
     FT_Stream  stream = parser->stream;
     FT_Memory  memory = parser->root.memory;
     FT_Error   error  = T1_Err_Ok;
-    FT_Long    size;
+    FT_ULong   size;
 
 
     if ( parser->in_pfb )
 
 
     if ( parser->in_pfb )
       /* and allocate private dictionary buffer        */
       if ( parser->private_len == 0 )
       {
       /* and allocate private dictionary buffer        */
       if ( parser->private_len == 0 )
       {
-        FT_ERROR(( "T1_Get_Private_Dict:" ));
-        FT_ERROR(( " invalid private dictionary section\n" ));
+        FT_ERROR(( "T1_Get_Private_Dict:"
+                   " invalid private dictionary section\n" ));
         error = T1_Err_Invalid_File_Format;
         goto Fail;
       }
 
         error = T1_Err_Invalid_File_Format;
         goto Fail;
       }
 
-      if ( FT_STREAM_SEEK( start_pos )                             ||
+      if ( FT_STREAM_SEEK( start_pos )                           ||
            FT_ALLOC( parser->private_dict, parser->private_len ) )
         goto Fail;
 
            FT_ALLOC( parser->private_dict, parser->private_len ) )
         goto Fail;
 
         cur++;
         if ( cur >= limit )
         {
         cur++;
         if ( cur >= limit )
         {
-          FT_ERROR(( "T1_Get_Private_Dict:" ));
-          FT_ERROR(( " could not find `eexec' keyword\n" ));
+          FT_ERROR(( "T1_Get_Private_Dict:"
+                     " could not find `eexec' keyword\n" ));
           error = T1_Err_Invalid_File_Format;
           goto Exit;
         }
           error = T1_Err_Invalid_File_Format;
           goto Exit;
         }
         cur++;
       else
       {
         cur++;
       else
       {
-        FT_ERROR(( "T1_Get_Private_Dict:" ));
-        FT_ERROR(( " `eexec' not properly terminated\n" ));
+        FT_ERROR(( "T1_Get_Private_Dict:"
+                   " `eexec' not properly terminated\n" ));
         error = T1_Err_Invalid_File_Format;
         goto Exit;
       }
 
         error = T1_Err_Invalid_File_Format;
         goto Exit;
       }
 
-      size = (FT_Long)( parser->base_len - ( cur - parser->base_dict ) );
+      size = parser->base_len - ( cur - parser->base_dict );
 
       if ( parser->in_memory )
       {
 
       if ( parser->in_memory )
       {
index 6fa4ca6..fb1c8a8 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 parser (specification).                                       */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 parser (specification).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2008 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -64,10 +64,10 @@ FT_BEGIN_HEADER
     FT_Stream     stream;
 
     FT_Byte*      base_dict;
     FT_Stream     stream;
 
     FT_Byte*      base_dict;
-    FT_Long       base_len;
+    FT_ULong      base_len;
 
     FT_Byte*      private_dict;
 
     FT_Byte*      private_dict;
-    FT_Long       private_len;
+    FT_ULong      private_len;
 
     FT_Bool       in_pfb;
     FT_Bool       in_memory;
 
     FT_Bool       in_pfb;
     FT_Bool       in_memory;
index 788c811..2d692f0 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 tokenizer (specification).                                    */
 /*                                                                         */
 /*                                                                         */
 /*    Type 1 tokenizer (specification).                                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
   T1_FIELD_NUM   ( "UnderlineThickness", underline_thickness,
                    T1_FIELD_DICT_FONTDICT )
 
   T1_FIELD_NUM   ( "UnderlineThickness", underline_thickness,
                    T1_FIELD_DICT_FONTDICT )
 
+#undef  FT_STRUCTURE
+#define FT_STRUCTURE  PS_FontExtraRec
+#undef  T1CODE
+#define T1CODE        T1_FIELD_LOCATION_FONT_EXTRA
+
+  T1_FIELD_NUM   ( "FSType", fs_type,
+                   T1_FIELD_DICT_FONTDICT )
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  PS_PrivateRec
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  PS_PrivateRec
@@ -87,7 +94,9 @@
 
   T1_FIELD_FIXED     ( "ExpansionFactor",  expansion_factor,
                        T1_FIELD_DICT_PRIVATE )
 
   T1_FIELD_FIXED     ( "ExpansionFactor",  expansion_factor,
                        T1_FIELD_DICT_PRIVATE )
-
+  T1_FIELD_BOOL      ( "ForceBold",        force_bold,
+                       T1_FIELD_DICT_PRIVATE )
+                         
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  T1_FontRec
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  T1_FontRec
index 8bd40a5..b3f10a8 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += TYPE42_DRIVER
 
 define TYPE42_DRIVER
 FTMODULE_H_COMMANDS += TYPE42_DRIVER
 
 define TYPE42_DRIVER
-$(OPEN_DRIVER)t42_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, t42_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)type42    $(ECHO_DRIVER_DESC)Type 42 font files with no known extension$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)type42    $(ECHO_DRIVER_DESC)Type 42 font files with no known extension$(ECHO_DRIVER_DONE)
 endef
 
index 5563061..eac1081 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
 #
 
 
-# Copyright 2002, 2003 by
+# Copyright 2002, 2003, 2008 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -32,7 +32,8 @@ T42_DRV_SRC := $(T42_DIR)/t42objs.c  \
 # Type42 driver headers
 #
 T42_DRV_H := $(T42_DRV_SRC:%.c=%.h) \
 # Type42 driver headers
 #
 T42_DRV_H := $(T42_DRV_SRC:%.c=%.h) \
-             $(T42_DIR)/t42error.h
+             $(T42_DIR)/t42error.h  \
+             $(T42_DIR)/t42types.h
 
 
 # Type42 driver object(s)
 
 
 # Type42 driver object(s)
index a6e4cf4..820c679 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level Type 42 driver interface (body).                          */
 /*                                                                         */
 /*                                                                         */
 /*    High-level Type 42 driver interface (body).                          */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2006, 2007 by Roberto Alameda.             */
+/*  Copyright 2002, 2003, 2004, 2006, 2007, 2009 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      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
 #define FT_COMPONENT  trace_t42
 
 
 #define FT_COMPONENT  trace_t42
 
 
- /*
-  *
-  *  GLYPH DICT SERVICE
-  *
-  */
 /*
+   *
+   *  GLYPH DICT SERVICE
+   *
+   */
 
   static FT_Error
   t42_get_glyph_name( T42_Face    face,
 
   static FT_Error
   t42_get_glyph_name( T42_Face    face,
   };
 
 
   };
 
 
- /*
-  *
-  *  POSTSCRIPT NAME SERVICE
-  *
-  */
 /*
+   *
+   *  POSTSCRIPT NAME SERVICE
+   *
+   */
 
   static const char*
   t42_get_ps_font_name( T42_Face  face )
 
   static const char*
   t42_get_ps_font_name( T42_Face  face )
   };
 
 
   };
 
 
- /*
-  *
-  *  POSTSCRIPT INFO SERVICE
-  *
-  */
 /*
+   *
+   *  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;
 
   static FT_Error
   t42_ps_get_font_info( FT_Face          face,
                         PS_FontInfoRec*  afont_info )
   {
     *afont_info = ((T42_Face)face)->type1.font_info;
+
+    return T42_Err_Ok;
+  }
+
+
+  static FT_Error
+  t42_ps_get_font_extra( FT_Face           face,
+                         PS_FontExtraRec*  afont_extra )
+  {
+    *afont_extra = ((T42_Face)face)->type1.font_extra;
+
     return T42_Err_Ok;
   }
 
     return T42_Err_Ok;
   }
 
   t42_ps_has_glyph_names( FT_Face  face )
   {
     FT_UNUSED( face );
   t42_ps_has_glyph_names( FT_Face  face )
   {
     FT_UNUSED( face );
+
     return 1;
   }
 
     return 1;
   }
 
                            PS_PrivateRec*  afont_private )
   {
     *afont_private = ((T42_Face)face)->type1.private_dict;
                            PS_PrivateRec*  afont_private )
   {
     *afont_private = ((T42_Face)face)->type1.private_dict;
+
     return T42_Err_Ok;
   }
 
     return T42_Err_Ok;
   }
 
   static const FT_Service_PsInfoRec  t42_service_ps_info =
   {
     (PS_GetFontInfoFunc)   t42_ps_get_font_info,
   static const FT_Service_PsInfoRec  t42_service_ps_info =
   {
     (PS_GetFontInfoFunc)   t42_ps_get_font_info,
+    (PS_GetFontExtraFunc)   t42_ps_get_font_extra,
     (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,
     (PS_GetFontPrivateFunc)t42_ps_get_font_private
   };
 
 
     (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,
     (PS_GetFontPrivateFunc)t42_ps_get_font_private
   };
 
 
- /*
-  *
-  *  SERVICE LIST
-  *
-  */
 /*
+   *
+   *  SERVICE LIST
+   *
+   */
 
   static const FT_ServiceDescRec  t42_services[] =
   {
 
   static const FT_ServiceDescRec  t42_services[] =
   {
index 98b7410..4717e46 100644 (file)
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
 
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  t42_driver_class;
 
 
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  t42_driver_class;
 
index db04fde..9081ffc 100644 (file)
@@ -4,7 +4,8 @@
 /*                                                                         */
 /*    Type 42 objects manager (body).                                      */
 /*                                                                         */
 /*                                                                         */
 /*    Type 42 objects manager (body).                                      */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007 by Roberto Alameda.       */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009               */
+/*  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      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -19,7 +20,6 @@
 #include "t42parse.h"
 #include "t42error.h"
 #include FT_INTERNAL_DEBUG_H
 #include "t42parse.h"
 #include "t42error.h"
 #include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
 #include FT_LIST_H
 
 
 #include FT_LIST_H
 
 
@@ -70,7 +70,7 @@
 
     if ( !loader.charstrings.init )
     {
 
     if ( !loader.charstrings.init )
     {
-      FT_ERROR(( "T42_Open_Face: no charstrings array in face!\n" ));
+      FT_ERROR(( "T42_Open_Face: no charstrings array in face\n" ));
       error = T42_Err_Invalid_File_Format;
     }
 
       error = T42_Err_Invalid_File_Format;
     }
 
       /* The index is then stored in type1.encoding.char_index, and  */
       /* the name in type1.encoding.char_name                        */
 
       /* The index is then stored in type1.encoding.char_index, and  */
       /* the name in type1.encoding.char_name                        */
 
-      min_char = +32000;
-      max_char = -32000;
+      min_char = 0;
+      max_char = 0;
 
       charcode = 0;
       for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
 
       charcode = 0;
       for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
               {
                 if ( charcode < min_char )
                   min_char = charcode;
               {
                 if ( charcode < min_char )
                   min_char = charcode;
-                if ( charcode > max_char )
-                  max_char = charcode;
+                if ( charcode >= max_char )
+                  max_char = charcode + 1;
               }
               break;
             }
           }
       }
               }
               break;
             }
           }
       }
+
       type1->encoding.code_first = min_char;
       type1->encoding.code_last  = max_char;
       type1->encoding.num_chars  = loader.num_chars;
       type1->encoding.code_first = min_char;
       type1->encoding.code_last  = max_char;
       type1->encoding.num_chars  = loader.num_chars;
       goto Exit;
 
     /* check the face index */
       goto Exit;
 
     /* check the face index */
-    if ( face_index != 0 )
+    if ( face_index > 0 )
     {
       FT_ERROR(( "T42_Face_Init: invalid face index\n" ));
       error = T42_Err_Invalid_Argument;
     {
       FT_ERROR(( "T42_Face_Init: invalid face index\n" ));
       error = T42_Err_Invalid_Argument;
 
     root->num_glyphs   = type1->num_glyphs;
     root->num_charmaps = 0;
 
     root->num_glyphs   = type1->num_glyphs;
     root->num_charmaps = 0;
-    root->face_index   = face_index;
+    root->face_index   = 0;
 
     root->face_flags = FT_FACE_FLAG_SCALABLE    |
                        FT_FACE_FLAG_HORIZONTAL  |
 
     root->face_flags = FT_FACE_FLAG_SCALABLE    |
                        FT_FACE_FLAG_HORIZONTAL  |
 
         charmap.face = root;
 
 
         charmap.face = root;
 
-        /* first of all, try to synthetize a Unicode charmap */
+        /* first of all, try to synthesize a Unicode charmap */
         charmap.platform_id = 3;
         charmap.encoding_id = 1;
         charmap.encoding    = FT_ENCODING_UNICODE;
         charmap.platform_id = 3;
         charmap.encoding_id = 1;
         charmap.encoding    = FT_ENCODING_UNICODE;
     FT_Memory    memory;
 
 
     FT_Memory    memory;
 
 
-    if ( face )
-    {
-      type1  = &face->type1;
-      info   = &type1->font_info;
-      memory = face->root.memory;
+    if ( !face )
+      return;
 
 
-      /* delete internal ttf face prior to freeing face->ttf_data */
-      if ( face->ttf_face )
-        FT_Done_Face( face->ttf_face );
+    type1  = &face->type1;
+    info   = &type1->font_info;
+    memory = face->root.memory;
 
 
-      /* release font info strings */
-      FT_FREE( info->version );
-      FT_FREE( info->notice );
-      FT_FREE( info->full_name );
-      FT_FREE( info->family_name );
-      FT_FREE( info->weight );
+    /* delete internal ttf face prior to freeing face->ttf_data */
+    if ( face->ttf_face )
+      FT_Done_Face( face->ttf_face );
 
 
-      /* release top dictionary */
-      FT_FREE( type1->charstrings_len );
-      FT_FREE( type1->charstrings );
-      FT_FREE( type1->glyph_names );
+    /* release font info strings */
+    FT_FREE( info->version );
+    FT_FREE( info->notice );
+    FT_FREE( info->full_name );
+    FT_FREE( info->family_name );
+    FT_FREE( info->weight );
 
 
-      FT_FREE( type1->charstrings_block );
-      FT_FREE( type1->glyph_names_block );
+    /* release top dictionary */
+    FT_FREE( type1->charstrings_len );
+    FT_FREE( type1->charstrings );
+    FT_FREE( type1->glyph_names );
 
 
-      FT_FREE( type1->encoding.char_index );
-      FT_FREE( type1->encoding.char_name );
-      FT_FREE( type1->font_name );
+    FT_FREE( type1->charstrings_block );
+    FT_FREE( type1->glyph_names_block );
 
 
-      FT_FREE( face->ttf_data );
+    FT_FREE( type1->encoding.char_index );
+    FT_FREE( type1->encoding.char_name );
+    FT_FREE( type1->font_name );
+
+    FT_FREE( face->ttf_data );
 
 #if 0
 
 #if 0
-      /* release afm data if present */
-      if ( face->afm_data )
-        T1_Done_AFM( memory, (T1_AFM*)face->afm_data );
+    /* release afm data if present */
+    if ( face->afm_data )
+      T1_Done_AFM( memory, (T1_AFM*)face->afm_data );
 #endif
 
 #endif
 
-      /* release unicode map, if any */
-      FT_FREE( face->unicode_map.maps );
-      face->unicode_map.num_maps = 0;
+    /* release unicode map, if any */
+    FT_FREE( face->unicode_map.maps );
+    face->unicode_map.num_maps = 0;
 
 
-      face->root.family_name = 0;
-      face->root.style_name  = 0;
-    }
+    face->root.family_name = 0;
+    face->root.style_name  = 0;
   }
 
 
   }
 
 
 
     FT_Activate_Size( size->ttsize );
 
 
     FT_Activate_Size( size->ttsize );
 
-    error = FT_Select_Size( face->ttf_face, strike_index );
+    error = FT_Select_Size( face->ttf_face, (FT_Int)strike_index );
     if ( !error )
       ( (FT_Size)size )->metrics = face->ttf_face->size->metrics;
 
     if ( !error )
       ( (FT_Size)size )->metrics = face->ttf_face->size->metrics;
 
index 7148379..13bda64 100644 (file)
@@ -4,7 +4,8 @@
 /*                                                                         */
 /*    Type 42 font parser (body).                                          */
 /*                                                                         */
 /*                                                                         */
 /*    Type 42 font parser (body).                                          */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007 by Roberto Alameda.       */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -19,7 +20,6 @@
 #include "t42error.h"
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include "t42error.h"
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
-#include FT_LIST_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 
 
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 
 
     T1_FIELD_NUM   ( "UnderlinePosition",  underline_position,  0 )
     T1_FIELD_NUM   ( "UnderlineThickness", underline_thickness, 0 )
 
     T1_FIELD_NUM   ( "UnderlinePosition",  underline_position,  0 )
     T1_FIELD_NUM   ( "UnderlineThickness", underline_thickness, 0 )
 
+#undef  FT_STRUCTURE
+#define FT_STRUCTURE  PS_FontExtraRec
+#undef  T1CODE
+#define T1CODE        T1_FIELD_LOCATION_FONT_EXTRA
+
+    T1_FIELD_NUM   ( "FSType",             fs_type,             0 )
+
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  T1_FontRec
 #undef  T1CODE
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  T1_FontRec
 #undef  T1CODE
     cur = parser->root.cursor;
     if ( cur >= limit )
     {
     cur = parser->root.cursor;
     if ( cur >= limit )
     {
-      FT_ERROR(( "t42_parse_encoding: out of bounds!\n" ));
+      FT_ERROR(( "t42_parse_encoding: out of bounds\n" ));
       parser->root.error = T42_Err_Invalid_File_Format;
       return;
     }
       parser->root.error = T42_Err_Invalid_File_Format;
       return;
     }
 
       else
       {
 
       else
       {
-        FT_ERROR(( "t42_parse_encoding: invalid token!\n" ));
+        FT_ERROR(( "t42_parse_encoding: invalid token\n" ));
         parser->root.error = T42_Err_Invalid_File_Format;
       }
     }
   }
 
 
         parser->root.error = T42_Err_Invalid_File_Format;
       }
     }
   }
 
 
-  typedef enum
+  typedef enum  T42_Load_Status_
   {
     BEFORE_START,
     BEFORE_TABLE_DIR,
   {
     BEFORE_START,
     BEFORE_TABLE_DIR,
 
     if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' )
     {
 
     if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' )
     {
-      FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector!\n" ));
+      FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector\n" ));
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
         if ( allocated )
         {
           FT_ERROR(( "t42_parse_sfnts: "
         if ( allocated )
         {
           FT_ERROR(( "t42_parse_sfnts: "
-                     "can't handle mixed binary and hex strings!\n" ));
+                     "can't handle mixed binary and hex strings\n" ));
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
         parser->root.cursor += string_size + 1;
         if ( parser->root.cursor >= limit )
         {
         parser->root.cursor += string_size + 1;
         if ( parser->root.cursor >= limit )
         {
-          FT_ERROR(( "t42_parse_sfnts: too many binary data!\n" ));
+          FT_ERROR(( "t42_parse_sfnts: too many binary data\n" ));
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
 
       if ( !string_buf )
       {
 
       if ( !string_buf )
       {
-        FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array!\n" ));
+        FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" ));
         error = T42_Err_Invalid_File_Format;
         goto Fail;
       }
         error = T42_Err_Invalid_File_Format;
         goto Fail;
       }
 
       if ( !string_size )
       {
 
       if ( !string_size )
       {
-        FT_ERROR(( "t42_parse_sfnts: invalid string!\n" ));
+        FT_ERROR(( "t42_parse_sfnts: invalid string\n" ));
         error = T42_Err_Invalid_File_Format;
         goto Fail;
       }
         error = T42_Err_Invalid_File_Format;
         goto Fail;
       }
           /* all other tables are just copied */
           if ( count >= ttf_size )
           {
           /* all other tables are just copied */
           if ( count >= ttf_size )
           {
-            FT_ERROR(( "t42_parse_sfnts: too many binary data!\n" ));
+            FT_ERROR(( "t42_parse_sfnts: too many binary data\n" ));
             error = T42_Err_Invalid_File_Format;
             goto Fail;
           }
             error = T42_Err_Invalid_File_Format;
             goto Fail;
           }
 
     if ( parser->root.cursor >= limit )
     {
 
     if ( parser->root.cursor >= limit )
     {
-      FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" ));
+      FT_ERROR(( "t42_parse_charstrings: out of bounds\n" ));
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
     }
     else
     {
     }
     else
     {
-      FT_ERROR(( "t42_parse_charstrings: invalid token!\n" ));
+      FT_ERROR(( "t42_parse_charstrings: invalid token\n" ));
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
 
     if ( parser->root.cursor >= limit )
     {
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
 
     if ( parser->root.cursor >= limit )
     {
-      FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" ));
+      FT_ERROR(( "t42_parse_charstrings: out of bounds\n" ));
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
 
         if ( cur + 1 >= limit )
         {
 
         if ( cur + 1 >= limit )
         {
-          FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" ));
+          FT_ERROR(( "t42_parse_charstrings: out of bounds\n" ));
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
         (void)T1_ToInt( parser );
         if ( parser->root.cursor >= limit )
         {
         (void)T1_ToInt( parser );
         if ( parser->root.cursor >= limit )
         {
-          FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" ));
+          FT_ERROR(( "t42_parse_charstrings: out of bounds\n" ));
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
 
     if ( !notdef_found )
     {
 
     if ( !notdef_found )
     {
-      FT_ERROR(( "t42_parse_charstrings: no /.notdef glyph!\n" ));
+      FT_ERROR(( "t42_parse_charstrings: no /.notdef glyph\n" ));
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
       dummy_object = &face->type1.font_info;
       break;
 
       dummy_object = &face->type1.font_info;
       break;
 
+    case T1_FIELD_LOCATION_FONT_EXTRA:
+      dummy_object = &face->type1.font_extra;
+      break;
+
     case T1_FIELD_LOCATION_BBOX:
       dummy_object = &face->type1.font_bbox;
       break;
     case T1_FIELD_LOCATION_BBOX:
       dummy_object = &face->type1.font_bbox;
       break;
index 6626b04..c7c2db4 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 42 font data types (specification only).                        */
 /*                                                                         */
 /*                                                                         */
 /*    Type 42 font data types (specification only).                        */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2006 by Roberto Alameda.                         */
+/*  Copyright 2002, 2003, 2006, 2008 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      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -35,7 +35,9 @@ FT_BEGIN_HEADER
     T1_FontRec      type1;
     const void*     psnames;
     const void*     psaux;
     T1_FontRec      type1;
     const void*     psnames;
     const void*     psaux;
+#if 0
     const void*     afm_data;
     const void*     afm_data;
+#endif
     FT_Byte*        ttf_data;
     FT_ULong        ttf_size;
     FT_Face         ttf_face;
     FT_Byte*        ttf_data;
     FT_ULong        ttf_size;
     FT_Face         ttf_face;
@@ -48,7 +50,7 @@ FT_BEGIN_HEADER
 
 FT_END_HEADER
 
 
 FT_END_HEADER
 
-#endif /* __T1TYPES_H__ */
+#endif /* __T42TYPES_H__ */
 
 
 /* END */
 
 
 /* END */
index 0ace3ae..b44d7f0 100644 (file)
@@ -16,7 +16,7 @@
 FTMODULE_H_COMMANDS += WINDOWS_DRIVER
 
 define WINDOWS_DRIVER
 FTMODULE_H_COMMANDS += WINDOWS_DRIVER
 
 define WINDOWS_DRIVER
-$(OPEN_DRIVER)winfnt_driver_class$(CLOSE_DRIVER)
+$(OPEN_DRIVER) FT_Driver_ClassRec, winfnt_driver_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)winfnt    $(ECHO_DRIVER_DESC)Windows bitmap fonts with extension *.fnt or *.fon$(ECHO_DRIVER_DONE)
 endef
 
 $(ECHO_DRIVER)winfnt    $(ECHO_DRIVER_DESC)Windows bitmap fonts with extension *.fnt or *.fon$(ECHO_DRIVER_DONE)
 endef
 
index 4aa9744..6b3a4e1 100644 (file)
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by                   */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*  Copyright 2003 Huw D M Davies for Codeweavers                          */
 /*  Copyright 2007 Dmitry Timoshkov for Codeweavers                        */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*  Copyright 2003 Huw D M Davies for Codeweavers                          */
 /*  Copyright 2007 Dmitry Timoshkov for Codeweavers                        */
 
         if ( !font_count || !font_offset )
         {
 
         if ( !font_count || !font_offset )
         {
-          FT_TRACE2(( "this file doesn't contain any FNT resources!\n" ));
+          FT_TRACE2(( "this file doesn't contain any FNT resources\n" ));
           error = FNT_Err_Invalid_File_Format;
           goto Exit;
         }
           error = FNT_Err_Invalid_File_Format;
           goto Exit;
         }
 
         if ( face_index >= font_count )
         {
 
         if ( face_index >= font_count )
         {
-          error = FNT_Err_Bad_Argument;
+          error = FNT_Err_Invalid_Argument;
           goto Exit;
         }
           goto Exit;
         }
+        else if ( face_index < 0 )
+          goto Exit;
 
         if ( FT_NEW( face->font ) )
           goto Exit;
 
         if ( FT_NEW( face->font ) )
           goto Exit;
 
       if ( face_index >= face->root.num_faces )
       {
 
       if ( face_index >= face->root.num_faces )
       {
-        error = FNT_Err_Bad_Argument;
+        error = FNT_Err_Invalid_Argument;
         goto Exit;
       }
     }
         goto Exit;
       }
     }
 
     char_code -= cmap->first;
     if ( char_code < cmap->count )
 
     char_code -= cmap->first;
     if ( char_code < cmap->count )
-      gindex = char_code + 1; /* we artificially increase the glyph index; */
-                              /* FNT_Load_Glyph reverts to the right one   */
+      /* we artificially increase the glyph index; */
+      /* FNT_Load_Glyph reverts to the right one   */
+      gindex = (FT_UInt)( char_code + 1 );
     return gindex;
   }
 
 
     return gindex;
   }
 
 
-  static FT_UInt
+  static FT_UInt32
   fnt_cmap_char_next( FNT_CMap    cmap,
                       FT_UInt32  *pchar_code )
   {
   fnt_cmap_char_next( FNT_CMap    cmap,
                       FT_UInt32  *pchar_code )
   {
       if ( char_code < cmap->count )
       {
         result = cmap->first + char_code;
       if ( char_code < cmap->count )
       {
         result = cmap->first + char_code;
-        gindex = char_code + 1;
+        gindex = (FT_UInt)( char_code + 1 );
       }
     }
 
       }
     }
 
     (FT_CMap_InitFunc)     fnt_cmap_init,
     (FT_CMap_DoneFunc)     NULL,
     (FT_CMap_CharIndexFunc)fnt_cmap_char_index,
     (FT_CMap_InitFunc)     fnt_cmap_init,
     (FT_CMap_DoneFunc)     NULL,
     (FT_CMap_CharIndexFunc)fnt_cmap_char_index,
-    (FT_CMap_CharNextFunc) fnt_cmap_char_next
+    (FT_CMap_CharNextFunc) fnt_cmap_char_next,
+
+    NULL, NULL, NULL, NULL, NULL
   };
 
   static FT_CMap_Class const  fnt_cmap_class = &fnt_cmap_class_rec;
   };
 
   static FT_CMap_Class const  fnt_cmap_class = &fnt_cmap_class_rec;
   static void
   FNT_Face_Done( FNT_Face  face )
   {
   static void
   FNT_Face_Done( FNT_Face  face )
   {
-    if ( face )
-    {
-      FT_Memory  memory = FT_FACE_MEMORY( face );
+    FT_Memory  memory;
 
 
 
 
-      fnt_font_done( face );
+    if ( !face )
+      return;
 
 
-      FT_FREE( face->root.available_sizes );
-      face->root.num_fixed_sizes = 0;
-    }
+    memory = FT_FACE_MEMORY( face );
+
+    fnt_font_done( face );
+
+    FT_FREE( face->root.available_sizes );
+    face->root.num_fixed_sizes = 0;
   }
 
 
   }
 
 
 
     /* try to load font from a DLL */
     error = fnt_face_get_dll_font( face, face_index );
 
     /* try to load font from a DLL */
     error = fnt_face_get_dll_font( face, face_index );
+    if ( !error && face_index < 0 )
+      goto Exit;
+
     if ( error == FNT_Err_Unknown_File_Format )
     {
       /* this didn't work; try to load a single FNT font */
       FNT_Font  font;
 
     if ( error == FNT_Err_Unknown_File_Format )
     {
       /* this didn't work; try to load a single FNT font */
       FNT_Font  font;
 
-
-      if ( face_index > 0 )
-      {
-        error = FNT_Err_Bad_Argument;
-        goto Exit;
-      }
-
       if ( FT_NEW( face->font ) )
         goto Exit;
 
       if ( FT_NEW( face->font ) )
         goto Exit;
 
       font->fnt_size = stream->size;
 
       error = fnt_font_load( font, stream );
       font->fnt_size = stream->size;
 
       error = fnt_font_load( font, stream );
+
+      if ( !error )
+      {
+        if ( face_index > 0 )
+          error = FNT_Err_Invalid_Argument;
+        else if ( face_index < 0 )
+          goto Exit;
+      }
     }
 
     if ( error )
     }
 
     if ( error )
       FT_PtrDist  family_size;
 
 
       FT_PtrDist  family_size;
 
 
+      root->face_index = face_index;
+
       root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
                          FT_FACE_FLAG_HORIZONTAL;
 
       root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
                          FT_FACE_FLAG_HORIZONTAL;
 
          * => nominal_point_size contains incorrect value;
          *    use pixel_height as the nominal height
          */
          * => nominal_point_size contains incorrect value;
          *    use pixel_height as the nominal height
          */
-        if ( bsize->y_ppem > font->header.pixel_height << 6 )
+        if ( bsize->y_ppem > ( font->header.pixel_height << 6 ) )
         {
           FT_TRACE2(( "use pixel_height as the nominal height\n" ));
 
         {
           FT_TRACE2(( "use pixel_height as the nominal height\n" ));
 
 
       if ( font->header.face_name_offset >= font->header.file_size )
       {
 
       if ( font->header.face_name_offset >= font->header.file_size )
       {
-        FT_TRACE2(( "invalid family name offset!\n" ));
+        FT_TRACE2(( "invalid family name offset\n" ));
         error = FNT_Err_Invalid_File_Format;
         goto Fail;
       }
         error = FNT_Err_Invalid_File_Format;
         goto Fail;
       }
     switch ( req->type )
     {
     case FT_SIZE_REQUEST_TYPE_NOMINAL:
     switch ( req->type )
     {
     case FT_SIZE_REQUEST_TYPE_NOMINAL:
-      if ( height == ( bsize->y_ppem + 32 ) >> 6 )
+      if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
         error = FNT_Err_Ok;
       break;
 
         error = FNT_Err_Ok;
       break;
 
 
     if ( offset >= font->header.file_size )
     {
 
     if ( offset >= font->header.file_size )
     {
-      FT_TRACE2(( "invalid FNT offset!\n" ));
+      FT_TRACE2(( "invalid FNT offset\n" ));
       error = FNT_Err_Invalid_File_Format;
       goto Exit;
     }
       error = FNT_Err_Invalid_File_Format;
       goto Exit;
     }
index ca75c95..70a9086 100644 (file)
 
 FT_BEGIN_HEADER
 
 
 FT_BEGIN_HEADER
 
+#ifdef FT_CONFIG_OPTION_PIC
+#error "this module does not support PIC yet"
+#endif 
+
   typedef struct  WinMZ_HeaderRec_
   {
     FT_UShort  magic;
   typedef struct  WinMZ_HeaderRec_
   {
     FT_UShort  magic;