From de271b9b4fe5b4a78652cfd70acba043e610f604 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Wed, 26 May 2010 23:20:20 +0000 Subject: [PATCH] Sync with trunk r47367 svn path=/branches/reactos-yarotows/; revision=47369 --- .../applications/games/winemine/lang/cs-CZ.rc | 16 +- base/applications/notepad/lang/cs-CZ.rc | 8 +- base/applications/paint/lang/cs-CZ.rc | 21 +- base/applications/regedit/lang/cs-CZ.rc | 125 +- base/applications/sndvol32/lang/cs-CZ.rc | 12 +- base/setup/usetup/lang/en-US.h | 2 +- base/setup/usetup/lang/es-ES.h | 20 +- base/setup/usetup/lang/et-EE.h | 4 +- base/setup/usetup/lang/it-IT.h | 12 +- base/setup/welcome/lang/es-ES.rc | 2 +- boot/freeldr/freeldr/fs/ntfs.c | 32 +- dll/cpl/usrmgr/lang/es-ES.rc | 219 + dll/cpl/usrmgr/rsrc.rc | 1 + dll/shellext/slayer/lang/cs-CZ.rc | 4 +- dll/win32/devmgr/lang/es-ES.rc | 54 +- dll/win32/kernel32/misc/console.c | 6 + dll/win32/shell32/lang/cs-CZ.rc | 4 +- dll/win32/shell32/lang/es-ES.rc | 12 +- dll/win32/shell32/lang/it-IT.rc | 10 + dll/win32/syssetup/lang/es-ES.rc | 4 +- dll/win32/userenv/lang/es-ES.rc | 6 +- dll/win32/userenv/lang/it-IT.rc | 4 +- include/reactos/subsys/csrss/csrss.h | 1 + lib/3rdparty/freetype/ChangeLog | 5635 ++++++++++++++++- lib/3rdparty/freetype/ChangeLog.21 | 8 +- lib/3rdparty/freetype/ChangeLog.22 | 14 +- lib/3rdparty/freetype/Jamfile | 4 +- lib/3rdparty/freetype/README | 12 +- .../freetype/{README.CVS => README.git} | 96 +- lib/3rdparty/freetype/autogen.sh | 122 +- lib/3rdparty/freetype/configure | 34 +- lib/3rdparty/freetype/devel/ftoption.h | 88 +- lib/3rdparty/freetype/freetype.def | 6 + lib/3rdparty/freetype/freetype.rbuild | 18 +- lib/3rdparty/freetype/i386/setjmplongjmp.s | 91 - .../include/freetype/config/ftconfig.h | 191 +- .../include/freetype/config/ftheader.h | 119 +- .../include/freetype/config/ftmodule.h | 36 +- .../include/freetype/config/ftoption.h | 87 +- .../include/freetype/config/ftstdlib.h | 11 +- .../freetype/include/freetype/freetype.h | 979 ++- .../freetype/include/freetype/ftadvanc.h | 179 + .../freetype/include/freetype/ftbbox.h | 8 +- .../freetype/include/freetype/ftbdf.h | 89 +- .../freetype/include/freetype/ftbitmap.h | 41 +- .../freetype/include/freetype/ftcache.h | 93 +- .../freetype/include/freetype/ftchapters.h | 3 + .../freetype/include/freetype/ftcid.h | 166 + .../freetype/include/freetype/ftgasp.h | 15 +- .../freetype/include/freetype/ftglyph.h | 86 +- .../freetype/include/freetype/ftgxval.h | 10 +- .../freetype/include/freetype/ftgzip.h | 2 +- .../freetype/include/freetype/ftimage.h | 332 +- .../freetype/include/freetype/ftincrem.h | 466 +- .../freetype/include/freetype/ftlcdfil.h | 16 +- .../freetype/include/freetype/ftlist.h | 14 +- .../freetype/include/freetype/ftlzw.h | 2 +- .../freetype/include/freetype/ftmac.h | 28 +- lib/3rdparty/freetype/include/freetype/ftmm.h | 28 +- .../freetype/include/freetype/ftmodapi.h | 81 +- .../freetype/include/freetype/ftotval.h | 15 +- .../freetype/include/freetype/ftoutln.h | 77 +- .../freetype/include/freetype/ftpfr.h | 16 +- .../freetype/include/freetype/ftrender.h | 37 +- .../freetype/include/freetype/ftsizes.h | 12 +- .../freetype/include/freetype/ftsnames.h | 42 +- .../freetype/include/freetype/ftstroke.h | 66 +- .../freetype/include/freetype/ftsynth.h | 27 +- .../freetype/include/freetype/ftsystem.h | 8 +- .../freetype/include/freetype/fttypes.h | 25 +- .../freetype/include/freetype/ftwinfnt.h | 63 +- .../freetype/include/freetype/ftxf86.h | 7 +- .../include/freetype/internal/autohint.h | 26 + .../include/freetype/internal/ftcalc.h | 28 +- .../include/freetype/internal/ftdebug.h | 34 +- .../include/freetype/internal/ftdriver.h | 194 +- .../include/freetype/internal/ftgloadr.h | 24 +- .../include/freetype/internal/ftmemory.h | 4 +- .../include/freetype/internal/ftobjs.h | 583 +- .../include/freetype/internal/ftpic.h | 67 + .../include/freetype/internal/ftrfork.h | 16 +- .../include/freetype/internal/ftserv.h | 293 + .../include/freetype/internal/fttrace.h | 8 +- .../include/freetype/internal/internal.h | 1 + .../include/freetype/internal/psaux.h | 30 +- .../include/freetype/internal/pshints.h | 47 +- .../freetype/internal/services/svbdf.h | 20 + .../freetype/internal/services/svcid.h | 83 + .../freetype/internal/services/svgldict.h | 22 + .../include/freetype/internal/services/svmm.h | 25 + .../freetype/internal/services/svpostnm.h | 21 + .../freetype/internal/services/svpscmap.h | 37 +- .../freetype/internal/services/svpsinfo.h | 34 +- .../freetype/internal/services/svsfnt.h | 22 + .../freetype/internal/services/svttcmap.h | 32 +- .../freetype/internal/services/svttglyf.h | 19 + .../freetype/include/freetype/internal/sfnt.h | 135 + .../include/freetype/internal/t1types.h | 30 +- .../include/freetype/internal/tttypes.h | 8 +- .../freetype/include/freetype/t1tables.h | 250 +- .../freetype/include/freetype/ttnameid.h | 297 +- .../freetype/include/freetype/tttables.h | 38 +- .../freetype/include/freetype/tttags.h | 10 +- lib/3rdparty/freetype/modules.cfg | 54 +- lib/3rdparty/freetype/src/autofit/Jamfile | 6 +- lib/3rdparty/freetype/src/autofit/afcjk.c | 96 +- lib/3rdparty/freetype/src/autofit/afcjk.h | 22 +- lib/3rdparty/freetype/src/autofit/afdummy.c | 6 +- lib/3rdparty/freetype/src/autofit/afdummy.h | 3 +- lib/3rdparty/freetype/src/autofit/afglobal.c | 69 +- lib/3rdparty/freetype/src/autofit/afglobal.h | 8 +- lib/3rdparty/freetype/src/autofit/afhints.c | 19 +- lib/3rdparty/freetype/src/autofit/afhints.h | 12 +- lib/3rdparty/freetype/src/autofit/afindic.c | 26 +- lib/3rdparty/freetype/src/autofit/afindic.h | 3 +- lib/3rdparty/freetype/src/autofit/aflatin.c | 131 +- lib/3rdparty/freetype/src/autofit/aflatin.h | 9 +- lib/3rdparty/freetype/src/autofit/aflatin2.c | 150 +- lib/3rdparty/freetype/src/autofit/aflatin2.h | 3 +- lib/3rdparty/freetype/src/autofit/afloader.c | 55 +- lib/3rdparty/freetype/src/autofit/afmodule.c | 15 +- lib/3rdparty/freetype/src/autofit/afmodule.h | 4 +- lib/3rdparty/freetype/src/autofit/afpic.c | 92 + lib/3rdparty/freetype/src/autofit/afpic.h | 64 + lib/3rdparty/freetype/src/autofit/aftypes.h | 68 +- lib/3rdparty/freetype/src/autofit/afwarp.c | 2 +- lib/3rdparty/freetype/src/autofit/autofit.c | 1 + lib/3rdparty/freetype/src/autofit/module.mk | 2 +- lib/3rdparty/freetype/src/base/Jamfile | 26 +- .../freetype/src/base/_ftmulfix_ros.c | 92 - lib/3rdparty/freetype/src/base/basepic.c | 83 + lib/3rdparty/freetype/src/base/basepic.h | 62 + lib/3rdparty/freetype/src/base/ftadvanc.c | 163 + lib/3rdparty/freetype/src/base/ftbase.c | 11 +- lib/3rdparty/freetype/src/base/ftbase.h | 57 + lib/3rdparty/freetype/src/base/ftbbox.c | 27 +- lib/3rdparty/freetype/src/base/ftbitmap.c | 43 +- lib/3rdparty/freetype/src/base/ftcalc.c | 217 +- lib/3rdparty/freetype/src/base/ftcid.c | 117 + lib/3rdparty/freetype/src/base/ftdbgmem.c | 9 +- lib/3rdparty/freetype/src/base/ftdebug.c | 8 +- lib/3rdparty/freetype/src/base/ftfstype.c | 62 + lib/3rdparty/freetype/src/base/ftgloadr.c | 7 + lib/3rdparty/freetype/src/base/ftglyph.c | 101 +- lib/3rdparty/freetype/src/base/ftinit.c | 119 +- lib/3rdparty/freetype/src/base/ftlcdfil.c | 16 +- lib/3rdparty/freetype/src/base/ftmac.c | 297 +- lib/3rdparty/freetype/src/base/ftmm.c | 4 +- lib/3rdparty/freetype/src/base/ftobjs.c | 705 ++- lib/3rdparty/freetype/src/base/ftotval.c | 3 +- lib/3rdparty/freetype/src/base/ftoutln.c | 76 +- lib/3rdparty/freetype/src/base/ftpatent.c | 21 +- lib/3rdparty/freetype/src/base/ftpfr.c | 33 +- lib/3rdparty/freetype/src/base/ftpic.c | 54 + lib/3rdparty/freetype/src/base/ftrfork.c | 187 +- lib/3rdparty/freetype/src/base/ftsnames.c | 94 + lib/3rdparty/freetype/src/base/ftstream.c | 64 +- lib/3rdparty/freetype/src/base/ftstroke.c | 201 +- lib/3rdparty/freetype/src/base/ftsynth.c | 61 +- lib/3rdparty/freetype/src/base/ftsystem.c | 11 +- lib/3rdparty/freetype/src/base/fttrigon.c | 10 +- lib/3rdparty/freetype/src/base/rules.mk | 20 +- lib/3rdparty/freetype/src/bdf/bdf.h | 6 +- lib/3rdparty/freetype/src/bdf/bdfdrivr.c | 85 +- lib/3rdparty/freetype/src/bdf/bdfdrivr.h | 4 + lib/3rdparty/freetype/src/bdf/bdflib.c | 87 +- lib/3rdparty/freetype/src/bdf/module.mk | 2 +- lib/3rdparty/freetype/src/bdf/rules.mk | 7 +- lib/3rdparty/freetype/src/cache/ftcbasic.c | 96 +- lib/3rdparty/freetype/src/cache/ftccache.c | 23 +- lib/3rdparty/freetype/src/cache/ftccache.h | 11 +- lib/3rdparty/freetype/src/cache/ftccback.h | 4 +- lib/3rdparty/freetype/src/cache/ftccmap.c | 52 +- lib/3rdparty/freetype/src/cache/ftcglyph.c | 8 +- lib/3rdparty/freetype/src/cache/ftcglyph.h | 9 +- lib/3rdparty/freetype/src/cache/ftcimage.c | 6 +- lib/3rdparty/freetype/src/cache/ftcmanag.c | 65 +- lib/3rdparty/freetype/src/cache/ftcmru.c | 8 +- lib/3rdparty/freetype/src/cache/ftcmru.h | 7 +- lib/3rdparty/freetype/src/cache/ftcsbits.c | 17 +- lib/3rdparty/freetype/src/cache/rules.mk | 10 +- lib/3rdparty/freetype/src/cff/Jamfile | 2 +- lib/3rdparty/freetype/src/cff/cff.c | 1 + lib/3rdparty/freetype/src/cff/cffcmap.c | 25 +- lib/3rdparty/freetype/src/cff/cffcmap.h | 6 +- lib/3rdparty/freetype/src/cff/cffdrivr.c | 330 +- lib/3rdparty/freetype/src/cff/cffdrivr.h | 3 +- lib/3rdparty/freetype/src/cff/cffgload.c | 851 ++- lib/3rdparty/freetype/src/cff/cffgload.h | 25 +- lib/3rdparty/freetype/src/cff/cffload.c | 98 +- lib/3rdparty/freetype/src/cff/cffload.h | 8 +- lib/3rdparty/freetype/src/cff/cffobjs.c | 440 +- lib/3rdparty/freetype/src/cff/cffobjs.h | 22 +- lib/3rdparty/freetype/src/cff/cffparse.c | 463 +- lib/3rdparty/freetype/src/cff/cffparse.h | 35 +- lib/3rdparty/freetype/src/cff/cffpic.c | 99 + lib/3rdparty/freetype/src/cff/cffpic.h | 80 + lib/3rdparty/freetype/src/cff/cfftypes.h | 10 +- lib/3rdparty/freetype/src/cff/module.mk | 2 +- lib/3rdparty/freetype/src/cid/cidgload.c | 72 +- lib/3rdparty/freetype/src/cid/cidload.c | 36 +- lib/3rdparty/freetype/src/cid/cidobjs.c | 90 +- lib/3rdparty/freetype/src/cid/cidparse.c | 9 +- lib/3rdparty/freetype/src/cid/cidriver.c | 109 +- lib/3rdparty/freetype/src/cid/cidriver.h | 4 + lib/3rdparty/freetype/src/cid/cidtoken.h | 15 +- lib/3rdparty/freetype/src/cid/module.mk | 2 +- lib/3rdparty/freetype/src/gxvalid/gxvbsln.c | 8 +- lib/3rdparty/freetype/src/gxvalid/gxvcommn.c | 47 +- lib/3rdparty/freetype/src/gxvalid/gxvcommn.h | 21 +- lib/3rdparty/freetype/src/gxvalid/gxvfeat.c | 7 +- lib/3rdparty/freetype/src/gxvalid/gxvjust.c | 26 +- lib/3rdparty/freetype/src/gxvalid/gxvkern.c | 4 +- lib/3rdparty/freetype/src/gxvalid/gxvlcar.c | 8 +- lib/3rdparty/freetype/src/gxvalid/gxvmod.h | 4 + lib/3rdparty/freetype/src/gxvalid/gxvmort.c | 8 +- lib/3rdparty/freetype/src/gxvalid/gxvmort.h | 2 +- lib/3rdparty/freetype/src/gxvalid/gxvmort0.c | 6 +- lib/3rdparty/freetype/src/gxvalid/gxvmort1.c | 8 +- lib/3rdparty/freetype/src/gxvalid/gxvmort2.c | 4 +- lib/3rdparty/freetype/src/gxvalid/gxvmort4.c | 8 +- lib/3rdparty/freetype/src/gxvalid/gxvmort5.c | 6 +- lib/3rdparty/freetype/src/gxvalid/gxvmorx.c | 9 +- lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c | 4 +- lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c | 16 +- lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c | 4 +- lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c | 6 +- lib/3rdparty/freetype/src/gxvalid/gxvopbd.c | 12 +- lib/3rdparty/freetype/src/gxvalid/gxvprop.c | 8 +- lib/3rdparty/freetype/src/gxvalid/gxvtrak.c | 2 +- lib/3rdparty/freetype/src/gxvalid/module.mk | 2 +- lib/3rdparty/freetype/src/gzip/adler32.c | 2 +- lib/3rdparty/freetype/src/gzip/ftgzip.c | 18 +- lib/3rdparty/freetype/src/gzip/inftrees.c | 3 + lib/3rdparty/freetype/src/gzip/zconf.h | 8 +- lib/3rdparty/freetype/src/gzip/zutil.c | 8 +- lib/3rdparty/freetype/src/gzip/zutil.h | 2 +- lib/3rdparty/freetype/src/lzw/ftlzw.c | 19 +- lib/3rdparty/freetype/src/lzw/ftzopen.c | 9 +- lib/3rdparty/freetype/src/lzw/ftzopen.h | 10 +- lib/3rdparty/freetype/src/otvalid/Jamfile | 2 +- lib/3rdparty/freetype/src/otvalid/module.mk | 2 +- lib/3rdparty/freetype/src/otvalid/otvalid.c | 3 +- lib/3rdparty/freetype/src/otvalid/otvalid.h | 8 +- lib/3rdparty/freetype/src/otvalid/otvbase.c | 6 +- lib/3rdparty/freetype/src/otvalid/otvcommn.c | 65 +- lib/3rdparty/freetype/src/otvalid/otvcommn.h | 57 +- lib/3rdparty/freetype/src/otvalid/otvgdef.c | 11 +- lib/3rdparty/freetype/src/otvalid/otvgpos.c | 52 +- lib/3rdparty/freetype/src/otvalid/otvgsub.c | 35 +- lib/3rdparty/freetype/src/otvalid/otvjstf.c | 4 +- lib/3rdparty/freetype/src/otvalid/otvmath.c | 452 ++ lib/3rdparty/freetype/src/otvalid/otvmod.c | 52 +- lib/3rdparty/freetype/src/otvalid/otvmod.h | 4 + lib/3rdparty/freetype/src/otvalid/rules.mk | 9 +- lib/3rdparty/freetype/src/pcf/module.mk | 2 +- lib/3rdparty/freetype/src/pcf/pcf.h | 4 +- lib/3rdparty/freetype/src/pcf/pcfdrivr.c | 101 +- lib/3rdparty/freetype/src/pcf/pcfdrivr.h | 4 + lib/3rdparty/freetype/src/pcf/pcfread.c | 63 +- lib/3rdparty/freetype/src/pcf/pcfutil.c | 8 +- lib/3rdparty/freetype/src/pcf/pcfutil.h | 6 +- lib/3rdparty/freetype/src/pcf/rules.mk | 11 +- lib/3rdparty/freetype/src/pfr/module.mk | 2 +- lib/3rdparty/freetype/src/pfr/pfrcmap.c | 11 +- lib/3rdparty/freetype/src/pfr/pfrdrivr.c | 11 +- lib/3rdparty/freetype/src/pfr/pfrdrivr.h | 4 + lib/3rdparty/freetype/src/pfr/pfrgload.c | 2 +- lib/3rdparty/freetype/src/pfr/pfrload.c | 15 +- lib/3rdparty/freetype/src/pfr/pfrobjs.c | 11 +- lib/3rdparty/freetype/src/pfr/pfrsbit.c | 34 +- lib/3rdparty/freetype/src/pfr/pfrtypes.h | 6 +- lib/3rdparty/freetype/src/psaux/afmparse.c | 38 +- lib/3rdparty/freetype/src/psaux/afmparse.h | 4 +- lib/3rdparty/freetype/src/psaux/module.mk | 2 +- lib/3rdparty/freetype/src/psaux/psauxmod.h | 4 + lib/3rdparty/freetype/src/psaux/psconv.c | 22 +- lib/3rdparty/freetype/src/psaux/psconv.h | 6 +- lib/3rdparty/freetype/src/psaux/psobjs.c | 89 +- lib/3rdparty/freetype/src/psaux/psobjs.h | 2 +- lib/3rdparty/freetype/src/psaux/t1cmap.c | 26 +- lib/3rdparty/freetype/src/psaux/t1decode.c | 384 +- lib/3rdparty/freetype/src/pshinter/Jamfile | 2 +- lib/3rdparty/freetype/src/pshinter/module.mk | 2 +- lib/3rdparty/freetype/src/pshinter/pshalgo.c | 93 +- lib/3rdparty/freetype/src/pshinter/pshalgo.h | 4 +- lib/3rdparty/freetype/src/pshinter/pshinter.c | 1 + lib/3rdparty/freetype/src/pshinter/pshmod.c | 17 +- lib/3rdparty/freetype/src/pshinter/pshmod.h | 2 +- lib/3rdparty/freetype/src/pshinter/pshpic.c | 67 + lib/3rdparty/freetype/src/pshinter/pshpic.h | 53 + lib/3rdparty/freetype/src/pshinter/pshrec.c | 101 +- lib/3rdparty/freetype/src/pshinter/pshrec.h | 6 +- lib/3rdparty/freetype/src/psnames/Jamfile | 2 +- lib/3rdparty/freetype/src/psnames/module.mk | 2 +- lib/3rdparty/freetype/src/psnames/psmodule.c | 220 +- lib/3rdparty/freetype/src/psnames/psmodule.h | 2 +- lib/3rdparty/freetype/src/psnames/psnames.c | 1 + lib/3rdparty/freetype/src/psnames/pspic.c | 77 + lib/3rdparty/freetype/src/psnames/pspic.h | 54 + lib/3rdparty/freetype/src/psnames/pstables.h | 9 +- lib/3rdparty/freetype/src/raster/Jamfile | 2 +- lib/3rdparty/freetype/src/raster/ftmisc.h | 30 +- lib/3rdparty/freetype/src/raster/ftraster.c | 994 +-- lib/3rdparty/freetype/src/raster/ftrend1.c | 46 +- lib/3rdparty/freetype/src/raster/ftrend1.h | 4 +- lib/3rdparty/freetype/src/raster/module.mk | 2 +- lib/3rdparty/freetype/src/raster/raster.c | 1 + lib/3rdparty/freetype/src/raster/rastpic.c | 89 + lib/3rdparty/freetype/src/raster/rastpic.h | 50 + lib/3rdparty/freetype/src/raster/rules.mk | 2 +- lib/3rdparty/freetype/src/sfnt/Jamfile | 2 +- lib/3rdparty/freetype/src/sfnt/module.mk | 2 +- lib/3rdparty/freetype/src/sfnt/rules.mk | 9 +- lib/3rdparty/freetype/src/sfnt/sfdriver.c | 213 +- lib/3rdparty/freetype/src/sfnt/sfdriver.h | 2 +- lib/3rdparty/freetype/src/sfnt/sfnt.c | 1 + lib/3rdparty/freetype/src/sfnt/sfntpic.c | 101 + lib/3rdparty/freetype/src/sfnt/sfntpic.h | 88 + lib/3rdparty/freetype/src/sfnt/sfobjs.c | 315 +- lib/3rdparty/freetype/src/sfnt/ttbdf.c | 16 +- lib/3rdparty/freetype/src/sfnt/ttcmap.c | 1554 ++++- lib/3rdparty/freetype/src/sfnt/ttcmap.h | 40 + lib/3rdparty/freetype/src/sfnt/ttcmapc.h | 55 + lib/3rdparty/freetype/src/sfnt/ttkern.c | 42 +- lib/3rdparty/freetype/src/sfnt/ttload.c | 197 +- lib/3rdparty/freetype/src/sfnt/ttmtx.c | 21 +- lib/3rdparty/freetype/src/sfnt/ttpost.c | 16 +- lib/3rdparty/freetype/src/sfnt/ttsbit.c | 30 +- lib/3rdparty/freetype/src/sfnt/ttsbit.h | 4 +- lib/3rdparty/freetype/src/sfnt/ttsbit0.c | 179 +- lib/3rdparty/freetype/src/smooth/Jamfile | 2 +- lib/3rdparty/freetype/src/smooth/ftgrays.c | 439 +- lib/3rdparty/freetype/src/smooth/ftgrays.h | 1 + lib/3rdparty/freetype/src/smooth/ftsmooth.c | 72 +- lib/3rdparty/freetype/src/smooth/ftsmooth.h | 8 +- lib/3rdparty/freetype/src/smooth/ftspic.c | 97 + .../{base/_ftbase_ros.c => smooth/ftspic.h} | 52 +- lib/3rdparty/freetype/src/smooth/module.mk | 6 +- lib/3rdparty/freetype/src/smooth/smooth.c | 1 + lib/3rdparty/freetype/src/tools/apinames.c | 10 +- lib/3rdparty/freetype/src/tools/chktrcmp.py | 114 + .../freetype/src/tools/docmaker/content.py | 258 +- .../freetype/src/tools/docmaker/docbeauty.py | 32 +- .../freetype/src/tools/docmaker/docmaker.py | 17 +- .../freetype/src/tools/docmaker/formatter.py | 46 +- .../freetype/src/tools/docmaker/sources.py | 113 +- .../freetype/src/tools/docmaker/tohtml.py | 261 +- .../freetype/src/tools/docmaker/utils.py | 22 +- .../freetype/src/tools/ftrandom/ftrandom.c | 10 +- lib/3rdparty/freetype/src/tools/glnames.py | 13 +- lib/3rdparty/freetype/src/tools/test_afm.c | 2 +- lib/3rdparty/freetype/src/truetype/Jamfile | 2 +- lib/3rdparty/freetype/src/truetype/module.mk | 2 +- lib/3rdparty/freetype/src/truetype/truetype.c | 1 + lib/3rdparty/freetype/src/truetype/ttdriver.c | 157 +- lib/3rdparty/freetype/src/truetype/ttdriver.h | 2 +- lib/3rdparty/freetype/src/truetype/ttgload.c | 492 +- lib/3rdparty/freetype/src/truetype/ttgload.h | 16 +- lib/3rdparty/freetype/src/truetype/ttgxvar.c | 108 +- lib/3rdparty/freetype/src/truetype/ttgxvar.h | 2 +- lib/3rdparty/freetype/src/truetype/ttinterp.c | 129 +- lib/3rdparty/freetype/src/truetype/ttobjs.c | 130 +- lib/3rdparty/freetype/src/truetype/ttobjs.h | 42 +- lib/3rdparty/freetype/src/truetype/ttpic.c | 79 + lib/3rdparty/freetype/src/truetype/ttpic.h | 59 + lib/3rdparty/freetype/src/truetype/ttpload.c | 81 +- lib/3rdparty/freetype/src/type1/module.mk | 2 +- lib/3rdparty/freetype/src/type1/t1afm.c | 29 +- lib/3rdparty/freetype/src/type1/t1driver.c | 58 +- lib/3rdparty/freetype/src/type1/t1driver.h | 4 + lib/3rdparty/freetype/src/type1/t1gload.c | 163 +- lib/3rdparty/freetype/src/type1/t1gload.h | 9 +- lib/3rdparty/freetype/src/type1/t1load.c | 134 +- lib/3rdparty/freetype/src/type1/t1objs.c | 146 +- lib/3rdparty/freetype/src/type1/t1parse.c | 71 +- lib/3rdparty/freetype/src/type1/t1parse.h | 6 +- lib/3rdparty/freetype/src/type1/t1tokens.h | 13 +- lib/3rdparty/freetype/src/type42/module.mk | 2 +- lib/3rdparty/freetype/src/type42/rules.mk | 5 +- lib/3rdparty/freetype/src/type42/t42drivr.c | 56 +- lib/3rdparty/freetype/src/type42/t42drivr.h | 4 + lib/3rdparty/freetype/src/type42/t42objs.c | 89 +- lib/3rdparty/freetype/src/type42/t42parse.c | 45 +- lib/3rdparty/freetype/src/type42/t42types.h | 6 +- lib/3rdparty/freetype/src/winfonts/module.mk | 2 +- lib/3rdparty/freetype/src/winfonts/winfnt.c | 67 +- lib/3rdparty/freetype/src/winfonts/winfnt.h | 4 + subsystems/win32/csrss/win32csr/conio.c | 59 + subsystems/win32/csrss/win32csr/conio.h | 9 + subsystems/win32/csrss/win32csr/guiconsole.c | 7 + subsystems/win32/win32k/include/timer.h | 1 + subsystems/win32/win32k/main/dllmain.c | 1 + subsystems/win32/win32k/ntuser/defwnd.c | 4 +- subsystems/win32/win32k/ntuser/msgqueue.c | 15 +- subsystems/win32/win32k/ntuser/timer.c | 40 +- subsystems/win32/win32k/ntuser/window.c | 5 +- 397 files changed, 23681 insertions(+), 6965 deletions(-) create mode 100644 dll/cpl/usrmgr/lang/es-ES.rc rename lib/3rdparty/freetype/{README.CVS => README.git} (62%) delete mode 100644 lib/3rdparty/freetype/i386/setjmplongjmp.s create mode 100644 lib/3rdparty/freetype/include/freetype/ftadvanc.h create mode 100644 lib/3rdparty/freetype/include/freetype/ftcid.h create mode 100644 lib/3rdparty/freetype/include/freetype/internal/ftpic.h create mode 100644 lib/3rdparty/freetype/include/freetype/internal/services/svcid.h create mode 100644 lib/3rdparty/freetype/src/autofit/afpic.c create mode 100644 lib/3rdparty/freetype/src/autofit/afpic.h delete mode 100644 lib/3rdparty/freetype/src/base/_ftmulfix_ros.c create mode 100644 lib/3rdparty/freetype/src/base/basepic.c create mode 100644 lib/3rdparty/freetype/src/base/basepic.h create mode 100644 lib/3rdparty/freetype/src/base/ftadvanc.c create mode 100644 lib/3rdparty/freetype/src/base/ftbase.h create mode 100644 lib/3rdparty/freetype/src/base/ftcid.c create mode 100644 lib/3rdparty/freetype/src/base/ftfstype.c create mode 100644 lib/3rdparty/freetype/src/base/ftpic.c create mode 100644 lib/3rdparty/freetype/src/base/ftsnames.c create mode 100644 lib/3rdparty/freetype/src/cff/cffpic.c create mode 100644 lib/3rdparty/freetype/src/cff/cffpic.h create mode 100644 lib/3rdparty/freetype/src/otvalid/otvmath.c create mode 100644 lib/3rdparty/freetype/src/pshinter/pshpic.c create mode 100644 lib/3rdparty/freetype/src/pshinter/pshpic.h create mode 100644 lib/3rdparty/freetype/src/psnames/pspic.c create mode 100644 lib/3rdparty/freetype/src/psnames/pspic.h create mode 100644 lib/3rdparty/freetype/src/raster/rastpic.c create mode 100644 lib/3rdparty/freetype/src/raster/rastpic.h create mode 100644 lib/3rdparty/freetype/src/sfnt/sfntpic.c create mode 100644 lib/3rdparty/freetype/src/sfnt/sfntpic.h create mode 100644 lib/3rdparty/freetype/src/sfnt/ttcmapc.h create mode 100644 lib/3rdparty/freetype/src/smooth/ftspic.c rename lib/3rdparty/freetype/src/{base/_ftbase_ros.c => smooth/ftspic.h} (55%) create mode 100644 lib/3rdparty/freetype/src/tools/chktrcmp.py create mode 100644 lib/3rdparty/freetype/src/truetype/ttpic.c create mode 100644 lib/3rdparty/freetype/src/truetype/ttpic.h diff --git a/base/applications/games/winemine/lang/cs-CZ.rc b/base/applications/games/winemine/lang/cs-CZ.rc index 3f281c7b317..bd776bafc40 100644 --- a/base/applications/games/winemine/lang/cs-CZ.rc +++ b/base/applications/games/winemine/lang/cs-CZ.rc @@ -1,8 +1,8 @@ /* FILE: applications/games/winemine/lang/cs-CZ.rc * PURPOSE: Czech Language File - * TRANSLATOR: Stepan Gabriel - SGABA (sgaba@centrum.cz) + * TRANSLATORS: Stepan Gabriel - SGABA (sgaba@centrum.cz); Radek Liska aka Black_Fox (radekliska at gmail dot com) * TRANSLATED FROM: Slovak translation by Kario (kario@szm.sk) - * UPDATED: 2008-07-06 + * UPDATED: 2010-05-25 * * Czech translation * Copyleft 2007 Kario (kario@szm.sk),2008 SGABA (sgaba@centrum.cz) @@ -15,7 +15,7 @@ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT STRINGTABLE BEGIN IDS_SECONDS, "sek." - IDS_NOBODY, "Nikdo" //windows = Anonym + IDS_NOBODY, "Bezejmenný" //windows = Anonym IDS_ABOUT, "od Joshua Thielena a vývojáøù systému ReactOS" END @@ -36,15 +36,15 @@ BEGIN MENUITEM SEPARATOR MENUITEM "&Konec", IDM_EXIT END - POPUP "&Info" //windows = &Pomocník + POPUP "&Nápovìda" //windows = &Pomocník BEGIN - MENUITEM "C&o je hra Miny...", IDM_ABOUT + MENUITEM "&O programu...", IDM_ABOUT END END IDD_TIMES DIALOGEX DISCARDABLE 0, 0, 200, 75 STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_POPUP | DS_SHELLFONT -CAPTION "Nejrychlejší htedaèi min" +CAPTION "Nejrychlejší hledaèi min" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Nejlepší èasy", IDNONE, 10, 10, 182, 45 @@ -66,7 +66,7 @@ STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_POPUP | DS_SHEL CAPTION "Blahopøeji!" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Zadejte prosím svoje jméno.", IDIGNORE, 25, 10, 150, 10 + LTEXT "Zadejte prosím svoje jméno", IDIGNORE, 25, 10, 150, 10 EDITTEXT IDC_EDITNAME, 25, 20, 110, 12 DEFPUSHBUTTON "OK", IDOK, 60, 40, 40, 15 END @@ -83,5 +83,5 @@ BEGIN EDITTEXT IDC_EDITCOLS, 49, 35, 30, 12, ES_NUMBER EDITTEXT IDC_EDITMINES, 49, 55, 30, 12, ES_NUMBER DEFPUSHBUTTON "OK", IDOK, 86, 32, 45, 15 - PUSHBUTTON "Zrušit", IDCANCEL, 86, 52, 45, 15 + PUSHBUTTON "Storno", IDCANCEL, 86, 52, 45, 15 END diff --git a/base/applications/notepad/lang/cs-CZ.rc b/base/applications/notepad/lang/cs-CZ.rc index e0be8ba66bb..d6dfcd25859 100644 --- a/base/applications/notepad/lang/cs-CZ.rc +++ b/base/applications/notepad/lang/cs-CZ.rc @@ -85,12 +85,12 @@ BEGIN END POPUP "&Nápovìda" BEGIN - MENUITEM "&Obsah", CMD_HELP_CONTENTS + MENUITEM "O&bsah", CMD_HELP_CONTENTS MENUITEM "&Najít...", CMD_HELP_SEARCH - MENUITEM "&Pomoc k nápovìdì", CMD_HELP_ON_HELP + MENUITEM "Pomoc k ná&povìdì", CMD_HELP_ON_HELP MENUITEM SEPARATOR - MENUITEM "&O programu" CMD_ABOUT - MENUITEM "Inf&o...", CMD_ABOUT_WINE + MENUITEM "&O programu..." CMD_ABOUT + MENUITEM "In&fo...", CMD_ABOUT_WINE END END diff --git a/base/applications/paint/lang/cs-CZ.rc b/base/applications/paint/lang/cs-CZ.rc index f3a8f3d2501..da0e84b5de3 100644 --- a/base/applications/paint/lang/cs-CZ.rc +++ b/base/applications/paint/lang/cs-CZ.rc @@ -49,7 +49,7 @@ BEGIN MENUITEM SEPARATOR POPUP "Lupa" BEGIN - POPUP "User defined" + POPUP "Vlastní nastavení" BEGIN MENUITEM "12,5%", IDM_VIEWZOOM125 MENUITEM "25%", IDM_VIEWZOOM25 @@ -60,8 +60,8 @@ BEGIN MENUITEM "800%", IDM_VIEWZOOM800 END MENUITEM SEPARATOR - MENUITEM "Show grid", IDM_VIEWSHOWGRID - MENUITEM "Show miniature", IDM_VIEWSHOWMINIATURE + MENUITEM "Zobrazit møížku", IDM_VIEWSHOWGRID + MENUITEM "Zobrazit miniaturu", IDM_VIEWSHOWMINIATURE END MENUITEM "Celá obrazovka\tCtrl+F", IDM_VIEWFULLSCREEN END @@ -86,7 +86,7 @@ BEGIN BEGIN MENUITEM "Témata nápovìdy", IDM_HELPHELPTOPICS MENUITEM SEPARATOR - MENUITEM "O programu...", IDM_HELPINFO + MENUITEM "&O programu...", IDM_HELPINFO END END @@ -104,6 +104,7 @@ BEGIN "^A", IDM_EDITSELECTALL "^T", IDM_VIEWTOOLBOX "^L", IDM_VIEWCOLORPALETTE + "^G", IDM_VIEWSHOWGRID "^F", IDM_VIEWFULLSCREEN "^R", IDM_IMAGEROTATEMIRROR "^W", IDM_IMAGECHANGESIZE @@ -140,9 +141,9 @@ BEGIN LTEXT "Datum zmìny:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10 LTEXT "Velikost souboru:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10 LTEXT "Rozlišení:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10 - LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10 - LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10 - LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10 + LTEXT "Nedostupné", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10 + LTEXT "Nedostupné", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10 + LTEXT "Nedostupné", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10 GROUPBOX "Jednotka", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27 AUTORADIOBUTTON "Palce", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP AUTORADIOBUTTON "Centimetry", IDD_ATTRIBUTESRB2, 52, 69, 35, 10 @@ -181,7 +182,7 @@ BEGIN IDS_INFOTEXT, "ReactOS Malování je dostupné pod licencí GNU Lesser General Public License (LGPL) verze 3 (viz. www.gnu.org)" IDS_SAVEPROMPTTEXT, "Chcete uložit provedené zmìny v %s?" IDS_DEFAULTFILENAME, "Bez názvu.bmp" - IDS_MINIATURETITLE, "Miniature" + IDS_MINIATURETITLE, "Miniatura" IDS_TOOLTIP1, "Volný výbìr" IDS_TOOLTIP2, "Výbìr" IDS_TOOLTIP3, "Guma" @@ -200,6 +201,6 @@ BEGIN IDS_TOOLTIP16, "Zaoblený obdélník" IDS_OPENFILTER, "Soubory bitmap (*.bmp;*.dib)\1*.bmp;*.dib\1Všechny soubory (*.*)\1*.*\1" IDS_SAVEFILTER, "24bitová bitmapa (*.bmp;*.dib)\1*.bmp;*.dib\1" - IDS_FILESIZE, "%d bytes" - IDS_PRINTRES, "%d x %d pixels per meter" + IDS_FILESIZE, "%d bajtù" + IDS_PRINTRES, "%d x %d pixelù na metr" END diff --git a/base/applications/regedit/lang/cs-CZ.rc b/base/applications/regedit/lang/cs-CZ.rc index 8f36dadaf0d..b412af4c186 100644 --- a/base/applications/regedit/lang/cs-CZ.rc +++ b/base/applications/regedit/lang/cs-CZ.rc @@ -54,8 +54,8 @@ BEGIN MENUITEM "&Exportovat do souboru registru...", ID_REGISTRY_EXPORTREGISTRYFILE MENUITEM SEPARATOR - MENUITEM "Load Hive...", ID_REGISTRY_LOADHIVE, GRAYED - MENUITEM "Unload Hive...", ID_REGISTRY_UNLOADHIVE, GRAYED + MENUITEM "Naèíst strom registru...", ID_REGISTRY_LOADHIVE, GRAYED + MENUITEM "Uvolnit strom registru...", ID_REGISTRY_UNLOADHIVE, GRAYED MENUITEM SEPARATOR MENUITEM "&Pøipojit síový registr...", ID_REGISTRY_CONNECTNETWORKREGISTRY @@ -79,19 +79,19 @@ BEGIN MENUITEM "&Øetìzec", ID_EDIT_NEW_STRINGVALUE MENUITEM "&Binární hodnota", ID_EDIT_NEW_BINARYVALUE MENUITEM "&Hodnota DWORD", ID_EDIT_NEW_DWORDVALUE - MENUITEM "&Multi-String Value", ID_EDIT_NEW_MULTISTRINGVALUE - MENUITEM "&Expandable String Value", ID_EDIT_NEW_EXPANDABLESTRINGVALUE + MENUITEM "&Víceøetìzcová hodnota", ID_EDIT_NEW_MULTISTRINGVALUE + MENUITEM "&Rozšiøitelná øetìzcová hodnota", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END MENUITEM SEPARATOR - MENUITEM "&Oprávnìní...", ID_EDIT_PERMISSIONS + MENUITEM "Oprá&vnìní...", ID_EDIT_PERMISSIONS MENUITEM SEPARATOR MENUITEM "&Odstranit\tDel", ID_EDIT_DELETE MENUITEM "&Pøejmenovat", ID_EDIT_RENAME MENUITEM SEPARATOR MENUITEM "Z&kopírovat název klíèe", ID_EDIT_COPYKEYNAME MENUITEM SEPARATOR - MENUITEM "&Hledat\tCtrl+F", ID_EDIT_FIND - MENUITEM "Hledat &další\tF3", ID_EDIT_FINDNEXT + MENUITEM "&Najít\tCtrl+F", ID_EDIT_FIND + MENUITEM "Najít &další\tF3", ID_EDIT_FINDNEXT END POPUP "&Zobrazit" BEGIN @@ -103,10 +103,8 @@ BEGIN END POPUP "&Oblíbené" BEGIN - MENUITEM "&Pøidat k oblíbeným", ID_FAVOURITES_ADDTOFAVOURITES - , GRAYED - MENUITEM "&Odebrat z oblíbených", ID_FAVOURITES_REMOVEFAVOURITE - , GRAYED + MENUITEM "&Pøidat k oblíbeným", ID_FAVOURITES_ADDTOFAVOURITES, GRAYED + MENUITEM "&Odebrat z oblíbených", ID_FAVOURITES_REMOVEFAVOURITE, GRAYED END POPUP "&Nápovìda" BEGIN @@ -135,32 +133,32 @@ BEGIN MENUITEM "&Øetìzec", ID_EDIT_NEW_STRINGVALUE MENUITEM "&Binární hodnota", ID_EDIT_NEW_BINARYVALUE MENUITEM "&Hodnota DWORD", ID_EDIT_NEW_DWORDVALUE - MENUITEM "&Multi-String Value", ID_EDIT_NEW_MULTISTRINGVALUE - MENUITEM "&Expandable String Value", ID_EDIT_NEW_EXPANDABLESTRINGVALUE + MENUITEM "&Víceøetìzcová hodnota", ID_EDIT_NEW_MULTISTRINGVALUE + MENUITEM "&Rozšiøitelná øetìzcová hodnota", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END END POPUP "" BEGIN - MENUITEM "Expand/Collapse", ID_TREE_EXPANDBRANCH - POPUP "&New" + MENUITEM "Rozbalit/Sbalit", ID_TREE_EXPANDBRANCH + POPUP "&Nový" BEGIN - MENUITEM "&Key", ID_EDIT_NEW_KEY + MENUITEM "&Klíè", ID_EDIT_NEW_KEY MENUITEM SEPARATOR - MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE - MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE - MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE - MENUITEM "&Multi-String Value", ID_EDIT_NEW_MULTISTRINGVALUE - MENUITEM "&Expandable String Value", ID_EDIT_NEW_EXPANDABLESTRINGVALUE + MENUITEM "&Øetìzec", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Binární hodnota", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&Hodnota DWORD", ID_EDIT_NEW_DWORDVALUE + MENUITEM "&Víceøetìzcová hodnota", ID_EDIT_NEW_MULTISTRINGVALUE + MENUITEM "&Rozšiøitelná øetìzcová hodnota", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END - MENUITEM "&Find", ID_EDIT_FIND + MENUITEM "&Najít", ID_EDIT_FIND MENUITEM SEPARATOR - MENUITEM "&Delete", ID_TREE_DELETE - MENUITEM "&Rename", ID_TREE_RENAME + MENUITEM "&Odstranit", ID_TREE_DELETE + MENUITEM "&Pøejmenovat", ID_TREE_RENAME MENUITEM SEPARATOR - MENUITEM "&Export", ID_TREE_EXPORT - MENUITEM "&Permissions...", ID_TREE_PERMISSIONS, GRAYED + MENUITEM "&Exportovat", ID_TREE_EXPORT + MENUITEM "Oprá&vnìní...", ID_TREE_PERMISSIONS, GRAYED MENUITEM SEPARATOR - MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME + MENUITEM "Z&kopírovat název klíèe", ID_EDIT_COPYKEYNAME END END @@ -287,22 +285,22 @@ BEGIN ID_EDIT_DELETE "Smaže výbìr" ID_EDIT_RENAME "Pøejmenuje výbìr" ID_EDIT_COPYKEYNAME "Zkopíruje název klíèe do schránky" - ID_EDIT_FIND "Hledá textový øetìzec v klíèi, položkách, nebo datech" - ID_EDIT_FINDNEXT "Hledá další výskyt textu zadaného v pøedchozím hledání" + ID_EDIT_FIND "Vyhledá textový øetìzec v klíèi, položkách, nebo datech" + ID_EDIT_FINDNEXT "Vyhledá další výskyt textu zadaného v pøedchozím hledání" END STRINGTABLE DISCARDABLE BEGIN - IDS_ERROR "Chyba" - IDS_WARNING "Upozornìní" - IDS_BAD_KEY "Can't query key '%s'" + IDS_ERROR "Chyba" + IDS_WARNING "Upozornìní" + IDS_BAD_KEY "Nelze se dotázat klíèe '%s'" IDS_BAD_VALUE "Nelze se dotázat položky '%s'" IDS_UNSUPPORTED_TYPE "Nelze upravovat klíèe tohoto typu (%ld)" IDS_TOO_BIG_VALUE "Položka je pøíliš velká (%ld)" IDS_MULTI_SZ_EMPTY_STRING "Položky typu REG_MULTI_SZ nemohou obsahovat prázdné øetezce.\nPrázdné øetìzce byly odebrány ze seznamu." - IDS_QUERY_DELETE_KEY_ONE "Are you sure you want to delete this key?" - IDS_QUERY_DELETE_KEY_MORE "Are you sure you want to delete these keys?" - IDS_QUERY_DELETE_KEY_CONFIRM "Confirm Key Delete" + IDS_QUERY_DELETE_KEY_ONE "Opravdu chcete odstranit tento klíè?" + IDS_QUERY_DELETE_KEY_MORE "Opravdu chcete odstranit tyto klíèe?" + IDS_QUERY_DELETE_KEY_CONFIRM "Potvrzení smazání klíèe" IDS_QUERY_DELETE_ONE "Opravdu chcete odstranit tuto položku?" IDS_QUERY_DELETE_MORE "Opravdu chcete odstranit tyto položky?" IDS_QUERY_DELETE_CONFIRM "Potvrzení odstranìní položky" @@ -310,8 +308,8 @@ BEGIN IDS_ERR_DELETEVALUE "Nelze odstranit všechny vybrané položky!" IDS_ERR_RENVAL_CAPTION "Chyba pøi pøejmenování položky" IDS_ERR_RENVAL_TOEMPTY "Nelze pøejmenovat %s. Vybraná položka je prázdná. Vyzkoušejte jiný název." - IDS_NEW_KEY "New Key #%d" - IDS_NEW_VALUE "New Value #%d" + IDS_NEW_KEY "Nový klíè #%d" + IDS_NEW_VALUE "Nová hodnota #%d" END STRINGTABLE DISCARDABLE @@ -328,7 +326,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_FLT_REGFILE "Registration File" + IDS_FLT_REGFILE "Soubor registru" IDS_FLT_REGFILES "Soubory registru" IDS_FLT_REGFILES_FLT "*.reg" IDS_FLT_REGEDIT4 "Soubory registru Win9x/NT4 (REGEDIT4)" @@ -362,10 +360,10 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_EXPAND "&Expand" - IDS_COLLAPSE "&Collapse" - IDS_GOTO_SUGGESTED_KEY "&Go to '%s'" - IDS_FINISHEDFIND "Finished searching through the registry." + IDS_EXPAND "&Rozbalit" + IDS_COLLAPSE "&Sbalit" + IDS_GOTO_SUGGESTED_KEY "&Jít na '%s'" + IDS_FINISHEDFIND "Prohledávání registru bylo dokonèeno." END /*****************************************************************/ @@ -376,70 +374,69 @@ END */ IDD_EXPORTRANGE DIALOGEX DISCARDABLE 50, 50, 370, 50 -STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | - WS_BORDER +STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Export Range",IDC_STATIC,2,0,366,48 - CONTROL "&All",IDC_EXPORT_ALL,"Button",BS_AUTORADIOBUTTON,10,10, 29,11 - CONTROL "S&elected Branch",IDC_EXPORT_BRANCH,"Button",BS_AUTORADIOBUTTON,10,22, 100,11 + GROUPBOX "Rozsah exportu",IDC_STATIC,2,0,366,48 + CONTROL "&Vše",IDC_EXPORT_ALL,"Button",BS_AUTORADIOBUTTON,10,10, 29,11 + CONTROL "V&ybraná vìtev",IDC_EXPORT_BRANCH,"Button",BS_AUTORADIOBUTTON,10,22, 100,11 EDITTEXT IDC_EXPORT_BRANCH_TEXT,30,34,335,12 END IDD_ADDFAVORITES DIALOGEX DISCARDABLE 0, 0, 186, 46 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Add to Favorites" +CAPTION "Pøidat do Oblíbených" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,129,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 - LTEXT "&Favorite Name:",IDC_STATIC,7,7,70,10 + PUSHBUTTON "Storno",IDCANCEL,129,24,50,14 + LTEXT "&Název oblíbené položky:",IDC_STATIC,7,7,70,10 EDITTEXT IDC_FAVORITENAME,7,26,110,13,ES_AUTOHSCROLL END IDD_REMOVEFAVORITES DIALOGEX DISCARDABLE 0, 0, 164, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Remove Favorites" +CAPTION "Odebrat z Oblíbených" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,107,114,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,114,50,14 + PUSHBUTTON "Storno",IDCANCEL,7,114,50,14 CONTROL "List1",IDC_FAVORITESLIST,"SysListView32",LVS_LIST | WS_BORDER | WS_TABSTOP,7,20,150,90 - LTEXT "Select Favorite(s):",IDC_STATIC,7,7,99,12 + LTEXT "Vyberte Oblíbené:",IDC_STATIC,7,7,99,12 END IDD_FIND DIALOGEX DISCARDABLE 0, 0, 254, 82 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Find" +CAPTION "Najít" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&Find Next",IDOK,197,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,197,24,50,14 + DEFPUSHBUTTON "Najít &další",IDOK,197,7,50,14 + PUSHBUTTON "Storno",IDCANCEL,197,24,50,14 GROUPBOX "Look at",IDC_STATIC,7,25,63,51 - LTEXT "Fi&nd what:",IDC_STATIC,7,8,37,10 + LTEXT "&Najít:",IDC_STATIC,7,8,37,10 EDITTEXT IDC_FINDWHAT,47,7,142,13,ES_AUTOHSCROLL - CONTROL "&Keys",IDC_LOOKAT_KEYS,"Button",BS_AUTOCHECKBOX | + CONTROL "&Klíèe",IDC_LOOKAT_KEYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,36,35,8 - CONTROL "&Values",IDC_LOOKAT_VALUES,"Button",BS_AUTOCHECKBOX | + CONTROL "&Hodnoty",IDC_LOOKAT_VALUES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,48,36,8 CONTROL "&Data",IDC_LOOKAT_DATA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,60,42,8 - CONTROL "Match &whole string only",IDC_MATCHSTRING,"Button", + CONTROL "Hledat pouze &celý øetìzec",IDC_MATCHSTRING,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,83,32,94,13 - CONTROL "Match &case",IDC_MATCHCASE,"Button",BS_AUTOCHECKBOX | + CONTROL "Rozlišovat &velikost písmen",IDC_MATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,48,90,12 END IDD_FINDING DIALOGEX 0, 0, 145, 50 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Find" +CAPTION "Najít" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 - LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 + DEFPUSHBUTTON "Storno",IDCANCEL,93,29,45,14 + LTEXT "Probíhá prohledávání registru...",IDC_STATIC,33,12,83,8 END /* diff --git a/base/applications/sndvol32/lang/cs-CZ.rc b/base/applications/sndvol32/lang/cs-CZ.rc index 9f89248021a..abeec0eb9db 100644 --- a/base/applications/sndvol32/lang/cs-CZ.rc +++ b/base/applications/sndvol32/lang/cs-CZ.rc @@ -1,3 +1,9 @@ +/* FILE: applications/sndvol32/lang/cs-CZ.rc + * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) + * THANKS TO: Denzil, who translated major part of this file + * UPDATED: 2010-05-25 + */ + LANGUAGE LANG_CZECH, SUBLANG_DEFAULT IDM_MAINMENU MENU DISCARDABLE @@ -5,7 +11,7 @@ BEGIN POPUP "&Nastavení" BEGIN MENUITEM "&Možnosti", IDC_PROPERTIES - MENUITEM "&Rozšíøené nastevení", IDC_ADVANCED_CONTROLS + MENUITEM "&Rozšíøené nastavení", IDC_ADVANCED_CONTROLS MENUITEM SEPARATOR MENUITEM "&Konec", IDC_EXIT END @@ -35,9 +41,9 @@ BEGIN PUSHBUTTON "&Záznam", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON PUSHBUTTON "&Jiné:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED - LTEXT "Show the following volume controls:", IDC_LABELCONTROLS, 7, 109, 162, 8 + LTEXT "Zobrazit tyto ovladaèe hlasitosti:", IDC_LABELCONTROLS, 7, 109, 162, 8 CONTROL "", IDC_CONTROLS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | WS_TABSTOP | WS_BORDER, 7, 122, 211, 96 PUSHBUTTON "OK", IDOK, 114,226,50,14 - PUSHBUTTON "Zrušit", IDCANCEL, 168,226,50,14 + PUSHBUTTON "Storno", IDCANCEL, 168,226,50,14 END diff --git a/base/setup/usetup/lang/en-US.h b/base/setup/usetup/lang/en-US.h index 1467dc764dc..9038002050d 100644 --- a/base/setup/usetup/lang/en-US.h +++ b/base/setup/usetup/lang/en-US.h @@ -93,7 +93,7 @@ static MUI_ENTRY enUSWelcomePageEntries[] = { 8, 19, - "\x07 Press L to view the ReactOS Licensing Terms and Conditions", + "\x07 Press L to view the ReactOS Licensing Terms and Conditions.", TEXT_STYLE_NORMAL }, { diff --git a/base/setup/usetup/lang/es-ES.h b/base/setup/usetup/lang/es-ES.h index 1d5599f720f..c01630efcb7 100644 --- a/base/setup/usetup/lang/es-ES.h +++ b/base/setup/usetup/lang/es-ES.h @@ -94,7 +94,7 @@ static MUI_ENTRY esESWelcomePageEntries[] = { 8, 19, - "\x07 Presione L para ver las condiciones y t‚rminos de licencia", + "\x07 Presione L para ver las condiciones y t‚rminos de licencia.", TEXT_STYLE_NORMAL }, { @@ -194,18 +194,24 @@ static MUI_ENTRY esESIntroPageEntries[] = { 8, 19, - "- El comprobador de integridad del sistema de archivos no est  a£n implementado.", + "- El comprobador de integridad del sistema de archivos no est  a£n", TEXT_STYLE_NORMAL }, { 8, - 23, - "\x07 Presione ENTER para instalar ReactOS.", + 20, + " implementado.", TEXT_STYLE_NORMAL }, { 8, 25, + "\x07 Presione ENTER para instalar ReactOS.", + TEXT_STYLE_NORMAL + }, + { + 8, + 27, "\x07 Presione F3 para salir sin instalar ReactOS.", TEXT_STYLE_NORMAL }, @@ -358,7 +364,7 @@ static MUI_ENTRY esESDevicePageEntries[] = { 6, 8, - "La lista inferior muestra la configuraci¢n del dispositivo actual.", + "La lista inferior muestra la configuraci¢n actual de dispositivos.", TEXT_STYLE_NORMAL }, { @@ -1598,7 +1604,7 @@ MUI_STRING esESStrings[] = {STRING_INSTALLDELETEPARTITION, " ENTER = Instalar D = Borrar Partici¢n F3 = Salir"}, {STRING_PARTITIONSIZE, - "Tamaño de la nueva partici¢n:"}, + "Tama¤o de la nueva partici¢n:"}, {STRING_CHOOSENEWPARTITION, "Ha elegido crear una nueva partici¢n en"}, {STRING_HDDSIZE, @@ -1696,6 +1702,6 @@ MUI_STRING esESStrings[] = {STRING_GB, "GB"}, {STRING_ADDKBLAYOUTS, - "Adding keyboard layouts"}, + "A¤adiendo disposici¢n de teclado"}, {0, 0} }; diff --git a/base/setup/usetup/lang/et-EE.h b/base/setup/usetup/lang/et-EE.h index c4dbf422919..819a2d47f08 100644 --- a/base/setup/usetup/lang/et-EE.h +++ b/base/setup/usetup/lang/et-EE.h @@ -1470,8 +1470,8 @@ MUI_ERROR etEEErrorEntries[] = }, { //ERROR_INSUFFICIENT_DISKSPACE, - "Not enough free space in the selected partition.\n" - " * Press any key to continue.", + "Valitud partitsioonil pole piisavalt ruumi.\n" + " * Vajuta suvalist klahvi, et j„tkata.", NULL }, { diff --git a/base/setup/usetup/lang/it-IT.h b/base/setup/usetup/lang/it-IT.h index 81bb197c760..b3e6ef496ed 100644 --- a/base/setup/usetup/lang/it-IT.h +++ b/base/setup/usetup/lang/it-IT.h @@ -94,7 +94,7 @@ static MUI_ENTRY itITWelcomePageEntries[] = { 8, 19, - "\x07 Premere L per vedere i termini e condizioni della licenza", + "\x07 Premere L per vedere i termini e condizioni della licenza.", TEXT_STYLE_NORMAL }, { @@ -158,7 +158,7 @@ static MUI_ENTRY itITIntroPageEntries[] = { 6, 12, - "Ci sono delle limitazioni:", + "Si applicano le seguenti limitazioni:", TEXT_STYLE_NORMAL }, { @@ -358,7 +358,7 @@ static MUI_ENTRY itITDevicePageEntries[] = { 6, 8, - "La lista inferiore mostra la configurazione della periferica corrente.", + "L'elenco che segue mostra le impostazioni correnti delle periferiche.", TEXT_STYLE_NORMAL }, { @@ -382,7 +382,7 @@ static MUI_ENTRY itITDevicePageEntries[] = { 3, 14, - "Nazionalit… tastiera:", + "Layout di tastiera:", TEXT_STYLE_NORMAL }, { @@ -393,7 +393,7 @@ static MUI_ENTRY itITDevicePageEntries[] = }, { 25, - 16, "Procedere con questa configurazione", + 16, "Accettare queste impostazioni", TEXT_STYLE_NORMAL }, { @@ -423,7 +423,7 @@ static MUI_ENTRY itITDevicePageEntries[] = { 6, 24, - "\"Procedere con questa configurazione\" e premere INVIO.", + "\"Accettare queste impostazioni\" e premere INVIO.", TEXT_STYLE_NORMAL }, { diff --git a/base/setup/welcome/lang/es-ES.rc b/base/setup/welcome/lang/es-ES.rc index 8d95d5cc1a5..3d44ee308d0 100644 --- a/base/setup/welcome/lang/es-ES.rc +++ b/base/setup/welcome/lang/es-ES.rc @@ -9,7 +9,7 @@ STRINGTABLE DISCARDABLE BEGIN IDS_APPTITLE "ReactOS - Bienvenido" IDS_DEFAULTTOPICTITLE "ReactOS" - IDS_DEFAULTTOPICDESC "Bienvenido al Sistema Operativo React.\n\nHaz Click en una opcion a la izquierda." + IDS_DEFAULTTOPICDESC "Bienvenido al Sistema Operativo React.\n\nHaz Click en una opción a la izquierda." // IDS_CHECKTEXT "Mostrar este dialogo otra vez" // IDS_CLOSETEXT "Salir" END diff --git a/boot/freeldr/freeldr/fs/ntfs.c b/boot/freeldr/freeldr/fs/ntfs.c index 830e3ade042..aff3bfaa339 100644 --- a/boot/freeldr/freeldr/fs/ntfs.c +++ b/boot/freeldr/freeldr/fs/ntfs.c @@ -1,6 +1,7 @@ /* * FreeLoader NTFS support * Copyright (C) 2004 Filip Navara + * Copyright (C) 2009-2010 Hervé Poussineau * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,6 +38,7 @@ typedef struct _NTFS_VOLUME_INFO /* FIXME: MFTContext is never freed. */ PNTFS_ATTR_CONTEXT MFTContext; ULONG DeviceId; + PUCHAR TemporarySector; } NTFS_VOLUME_INFO; PNTFS_VOLUME_INFO NtfsVolumes[MAX_FDS]; @@ -147,10 +149,17 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) return FALSE; - ReadLength = min(Length, Volume->BootSector.BytesPerSector - (Offset % Volume->BootSector.BytesPerSector)); - ret = ArcRead(Volume->DeviceId, Buffer, ReadLength, &Count); - if (ret != ESUCCESS || Count != ReadLength) + ret = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count); + if (ret != ESUCCESS || Count != Volume->BootSector.BytesPerSector) return FALSE; + ReadLength = min(Length, Volume->BootSector.BytesPerSector - (Offset % Volume->BootSector.BytesPerSector)); + + // + // Copy interesting data + // + RtlCopyMemory(Buffer, + &Volume->TemporarySector[Offset % Volume->BootSector.BytesPerSector], + ReadLength); // // Move to unfilled buffer part @@ -232,7 +241,9 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT AlreadyRead = 0; - if(Context->CacheRunOffset <= Offset && Offset < Context->CacheRunOffset + Context->CacheRunLength * Volume->ClusterSize) + // FIXME: Cache seems to be non-working. Disable it for now + //if(Context->CacheRunOffset <= Offset && Offset < Context->CacheRunOffset + Context->CacheRunLength * Volume->ClusterSize) + if (0) { DataRun = Context->CacheRun; LastLCN = Context->CacheRunLastLCN; @@ -790,6 +801,7 @@ LONG NtfsOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) return ENOENT; } + FsSetDeviceSpecific(*FileId, FileHandle); return ESUCCESS; } @@ -930,6 +942,18 @@ const DEVVTBL* NtfsMount(ULONG DeviceId) return NULL; } + // + // Keep room to read partial sectors + // + Volume->TemporarySector = MmHeapAlloc(Volume->BootSector.BytesPerSector); + if (!Volume->TemporarySector) + { + FileSystemError("Failed to allocate memory."); + MmHeapFree(Volume->MasterFileTable); + MmHeapFree(Volume); + return NULL; + } + // // Keep device id // diff --git a/dll/cpl/usrmgr/lang/es-ES.rc b/dll/cpl/usrmgr/lang/es-ES.rc new file mode 100644 index 00000000000..e2afc79cbb8 --- /dev/null +++ b/dll/cpl/usrmgr/lang/es-ES.rc @@ -0,0 +1,219 @@ +LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL + + +/* Dialogs */ + +IDD_USERS DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Usuarios" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, + 7, 7, 238, 85, WS_EX_CLIENTEDGE +END + + +IDD_GROUPS DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Grupos" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, + 7, 7, 238, 85, WS_EX_CLIENTEDGE +END + + +IDD_EXTRA DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Extra" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "This space is intentionally left blank", IDC_STATIC, 66, 90, 112, 8 +END + + +IDD_USER_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "General" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "", IDC_USER_GENERAL_NAME, 7, 12, 112, 8 + LTEXT "Nombre completo:", -1, 7, 46, 63, 8 + EDITTEXT IDC_USER_GENERAL_FULL_NAME,77,43,168,13,ES_AUTOHSCROLL + LTEXT "Descripción:", -1, 7, 64, 63, 8 + EDITTEXT IDC_USER_GENERAL_DESCRIPTION,77,61,168,13,ES_AUTOHSCROLL + AUTOCHECKBOX "El usuario debe cambiar la contraseña en el siguiente inicio de sesión",IDC_USER_GENERAL_FORCE_CHANGE,7,82,210,10 + AUTOCHECKBOX "El usuario no puede cambiar la contraseña",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10 + AUTOCHECKBOX "La contraseña nunca caduca",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 + AUTOCHECKBOX "Cuenta deshabilitada",IDC_USER_GENERAL_DISABLED,7,121,210,10 + AUTOCHECKBOX "La cuenta está bloqueada",IDC_USER_GENERAL_LOCKED,7,134,210,10 +END + + +IDD_USER_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Miembro de" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Miembro de:", -1, 7, 7, 56, 8 + CONTROL "", IDC_USER_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, + 7, 18, 238, 173, WS_EX_CLIENTEDGE + PUSHBUTTON "Agregar...", IDC_USER_MEMBERSHIP_ADD, 7, 197, 50, 14 + PUSHBUTTON "Quitar", IDC_USER_MEMBERSHIP_REMOVE, 61, 197, 50, 14, WS_DISABLED +END + + +IDD_USER_PROFILE DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Perfil" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Perfil de usuario ", -1, 7, 7, 238, 54 + LTEXT "Ruta de acceso al perfil:", -1, 16, 22, 55, 8 + EDITTEXT IDC_USER_PROFILE_PATH, 78, 19, 160, 13, ES_AUTOHSCROLL + LTEXT "Archivo de comandos de inicio de sesión:", -1, 16, 40, 55, 8 + EDITTEXT IDC_USER_PROFILE_SCRIPT, 78, 37, 160, 13, ES_AUTOHSCROLL + + GROUPBOX "Carpeta particular ", -1, 7, 68, 238, 54 + AUTORADIOBUTTON "Ruta de acceso local:", IDC_USER_PROFILE_LOCAL, 16, 83, 60, 10 + AUTORADIOBUTTON "Conectar:", IDC_USER_PROFILE_REMOTE, 16, 100, 60, 10 + EDITTEXT IDC_USER_PROFILE_LOCAL_PATH, 78, 81, 160, 13, ES_AUTOHSCROLL + COMBOBOX IDC_USER_PROFILE_DRIVE, 78, 99, 26, 160, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL + LTEXT "A:", -1, 112, 101, 12, 8 + EDITTEXT IDC_USER_PROFILE_REMOTE_PATH, 130, 99, 108, 13, ES_AUTOHSCROLL +END + + +IDD_GROUP_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "General" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "", IDC_GROUP_GENERAL_NAME, 7, 12, 112, 8 + LTEXT "Descripción:", -1, 7, 45, 46, 8 + EDITTEXT IDC_GROUP_GENERAL_DESCRIPTION,65,42,180,13,ES_AUTOHSCROLL + LTEXT "Miembros:", -1, 7, 63, 45, 8 + CONTROL "", IDC_GROUP_GENERAL_MEMBERS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, + 7, 74, 238, 117, WS_EX_CLIENTEDGE + PUSHBUTTON "Añadir...", IDC_GROUP_GENERAL_ADD, 7, 197, 50, 14 + PUSHBUTTON "Quitar", IDC_GROUP_GENERAL_REMOVE, 61, 197, 50, 14, WS_DISABLED +END + + +IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE 0, 0, 267, 74 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "Cambiar contraseña" +FONT 8, "MS Shell Dlg" +BEGIN + EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL | ES_PASSWORD + RTEXT "Nueva contraseña:", -1,7,10,96,8 + EDITTEXT IDC_EDIT_PASSWORD2,107,25,153,14,ES_AUTOHSCROLL | ES_PASSWORD + RTEXT "Confirmar la contraseña:", -1,7,28,96,8 + DEFPUSHBUTTON "Aceptar",IDOK,156,53,50,14 + PUSHBUTTON "Cancelar",IDCANCEL,210,53,50,14 +END + + +IDD_USER_NEW DIALOGEX DISCARDABLE 0, 0, 267, 200 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "Nuevo usuario" +FONT 8, "MS Shell Dlg" +BEGIN + EDITTEXT IDC_USER_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL + RTEXT "Nombre de usuario:", -1,7,10,96,8 + EDITTEXT IDC_USER_NEW_FULL_NAME,107,25,153,14,ES_AUTOHSCROLL + RTEXT "Nombre completo:", -1,7,28,96,8 + EDITTEXT IDC_USER_NEW_DESCRIPTION,107,43,153,14,ES_AUTOHSCROLL + RTEXT "Descripción:", -1,7,46,96,8 + EDITTEXT IDC_USER_NEW_PASSWORD1,107,67,153,14,ES_AUTOHSCROLL | ES_PASSWORD + RTEXT "Contraseña:", -1,7,70,96,8 + EDITTEXT IDC_USER_NEW_PASSWORD2,107,85,153,14,ES_AUTOHSCROLL | ES_PASSWORD + RTEXT "Confirmar la contraseña:", -1,7,88,96,8 + AUTOCHECKBOX "El usuario debe cambiar la contraseña en el siguiente inicio de sesión",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10 + AUTOCHECKBOX "El usuario no puede cambiar la contraseña",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED + AUTOCHECKBOX "La contraseña nunca caduca",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED + AUTOCHECKBOX "Cuenta deshabilitada",IDC_USER_NEW_DISABLED,7,151,200,10 + DEFPUSHBUTTON "Aceptar",IDOK,156,179,50,14,WS_DISABLED + PUSHBUTTON "Cancelar",IDCANCEL,210,179,50,14 +END + + +IDD_GROUP_NEW DIALOGEX DISCARDABLE 0, 0, 267, 74 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "Nuevo grupo" +FONT 8, "MS Shell Dlg" +BEGIN + EDITTEXT IDC_GROUP_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL + RTEXT "Nombre del grupo:", -1,7,10,96,8 + EDITTEXT IDC_GROUP_NEW_DESCRIPTION,107,25,153,14,ES_AUTOHSCROLL + RTEXT "Descripción:", -1,7,28,96,8 + DEFPUSHBUTTON "Aceptar",IDOK,156,53,50,14,WS_DISABLED + PUSHBUTTON "Cancelar",IDCANCEL,210,53,50,14 +END + + +IDD_USER_ADD_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "Pertenencia a grupos" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Miembro de:", -1, 7, 7, 56, 8 + CONTROL "", IDC_USER_ADD_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, + 7, 18, 238, 173, WS_EX_CLIENTEDGE + DEFPUSHBUTTON "Aceptar",IDOK,141,197,50,14 + PUSHBUTTON "Cancelar",IDCANCEL,195,197,50,14 +END + + +/* Menus */ + +IDM_POPUP_GROUP MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "Nuevo grupo...", IDM_GROUP_NEW + END + POPUP "" + BEGIN + MENUITEM "Añadir miembro", IDM_GROUP_ADD_MEMBER, GRAYED + MENUITEM SEPARATOR + MENUITEM "Borrar", IDM_GROUP_DELETE + MENUITEM "Renombrar", IDM_GROUP_RENAME + MENUITEM SEPARATOR + MENUITEM "Propiedades", IDM_GROUP_PROPERTIES + END +END + + +IDM_POPUP_USER MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "Nuevo usuario...", IDM_USER_NEW + END + POPUP "" + BEGIN + MENUITEM "Cambiar contraseña", IDM_USER_CHANGE_PASSWORD + MENUITEM SEPARATOR + MENUITEM "Borrar", IDM_USER_DELETE + MENUITEM "Renombrar", IDM_USER_RENAME + MENUITEM SEPARATOR + MENUITEM "Propiedades", IDM_USER_PROPERTIES + END +END + + +/* Strings */ + +STRINGTABLE +BEGIN + IDS_CPLNAME "Cuentas de usuario" + IDS_CPLDESCRIPTION "Gestiona Usuarios y Grupos." +END + +STRINGTABLE +BEGIN + IDS_NAME "Nombre" + IDS_FULLNAME "Nombre completo" + IDS_DESCRIPTION "Descripción" +END diff --git a/dll/cpl/usrmgr/rsrc.rc b/dll/cpl/usrmgr/rsrc.rc index 5e400c134c0..3c5ab7370fe 100644 --- a/dll/cpl/usrmgr/rsrc.rc +++ b/dll/cpl/usrmgr/rsrc.rc @@ -3,5 +3,6 @@ #include "lang/de-DE.rc" #include "lang/en-US.rc" +#include "lang/es-ES.rc" #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" diff --git a/dll/shellext/slayer/lang/cs-CZ.rc b/dll/shellext/slayer/lang/cs-CZ.rc index 063bad46de8..13eed0328fe 100644 --- a/dll/shellext/slayer/lang/cs-CZ.rc +++ b/dll/shellext/slayer/lang/cs-CZ.rc @@ -1,6 +1,6 @@ /* FILE: dll/shellext/slayer/lang/cs-CZ.rc * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) - * UPDATED: 2008-07-27 + * UPDATED: 2010-05-25 */ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT @@ -32,7 +32,7 @@ BEGIN PUSHBUTTON "&Upravit...", IDC_EDIT, 162,24,60,14, WS_DISABLED PUSHBUTTON "S&mazat", IDC_DELETE, 162,42,60,14, WS_DISABLED PUSHBUTTON "&OK", IDOK, 95,116,60,14 - PUSHBUTTON "&Storno", IDCANCEL, 162,116,60,14 + PUSHBUTTON "Storno", IDCANCEL, 162,116,60,14 END STRINGTABLE diff --git a/dll/win32/devmgr/lang/es-ES.rc b/dll/win32/devmgr/lang/es-ES.rc index 32b3820f5c0..d3e80b4950a 100644 --- a/dll/win32/devmgr/lang/es-ES.rc +++ b/dll/win32/devmgr/lang/es-ES.rc @@ -94,30 +94,30 @@ END STRINGTABLE BEGIN - IDS_PROP_DEVICEID "Device Instance ID" - IDS_PROP_HARDWAREIDS "Hardware IDs" - IDS_PROP_COMPATIBLEIDS "Compatible IDs" - IDS_PROP_MATCHINGDEVICEID "Matching Device ID" - IDS_PROP_SERVICE "Service" - IDS_PROP_ENUMERATOR "Enumerator" - IDS_PROP_CAPABILITIES "Capabilities" - IDS_PROP_DEVNODEFLAGS "Devnode Flags" - IDS_PROP_CONFIGFLAGS "Config Flags" - IDS_PROP_CSCONFIGFLAGS "CSConfig Flags" - IDS_PROP_EJECTIONRELATIONS "Ejection Relations" - IDS_PROP_REMOVALRELATIONS "Removal Relations" - IDS_PROP_BUSRELATIONS "Bus Relations" - IDS_PROP_DEVUPPERFILTERS "Device Upper Filters" - IDS_PROP_DEVLOWERFILTERS "Device Lower Filters" - IDS_PROP_CLASSUPPERFILTERS "Class Upper Filters" - IDS_PROP_CLASSLOWERFILTERS "Class Lower Filters" - IDS_PROP_CLASSINSTALLER "Class Installers" - IDS_PROP_CLASSCOINSTALLER "Class Coinstallers" - IDS_PROP_DEVICECOINSTALLER "Device Coinstallers" - IDS_PROP_FIRMWAREREVISION "Firmware Revision" - IDS_PROP_CURRENTPOWERSTATE "Current Power State" - IDS_PROP_POWERCAPABILITIES "Power Capabilities" - IDS_PROP_POWERSTATEMAPPINGS "Power State Mappings" + IDS_PROP_DEVICEID "Id. de instancia de dispositivo" + IDS_PROP_HARDWAREIDS "Identificadores de hardware" + IDS_PROP_COMPATIBLEIDS "Identificadores compatibles" + IDS_PROP_MATCHINGDEVICEID "Id. de dispositivo coincidente" + IDS_PROP_SERVICE "Servicio" + IDS_PROP_ENUMERATOR "Enumerador" + IDS_PROP_CAPABILITIES "Recursos" + IDS_PROP_DEVNODEFLAGS "Marcadores Devnode" + IDS_PROP_CONFIGFLAGS "Marcadores Config" + IDS_PROP_CSCONFIGFLAGS "Marcadores CSConfig" + IDS_PROP_EJECTIONRELATIONS "Relaciones de extracción" + IDS_PROP_REMOVALRELATIONS "Relaciones de eliminación" + IDS_PROP_BUSRELATIONS "Relaciones de bus" + IDS_PROP_DEVUPPERFILTERS "Filtros superiores de dispositivo" + IDS_PROP_DEVLOWERFILTERS "Filtros inferiores de dispositivo" + IDS_PROP_CLASSUPPERFILTERS "Filtros superiores de clase" + IDS_PROP_CLASSLOWERFILTERS "Filtros inferiores de clase" + IDS_PROP_CLASSINSTALLER "Instaladores de clase" + IDS_PROP_CLASSCOINSTALLER "Coinstaladores de clase" + IDS_PROP_DEVICECOINSTALLER "Coinstaladores de dispositivo" + IDS_PROP_FIRMWAREREVISION "Revisión de firmware" + IDS_PROP_CURRENTPOWERSTATE "Estado actual de energía" + IDS_PROP_POWERCAPABILITIES "Capacidad de energía" + IDS_PROP_POWERSTATEMAPPINGS "Asignaciones de estado de energía" END IDD_HARDWARE DIALOGEX DISCARDABLE 0, 0, 300, 400 @@ -200,7 +200,7 @@ END IDD_DEVICEDETAILS DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Details" +CAPTION "Detalles" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 @@ -213,7 +213,7 @@ END IDD_DEVICERESOURCES DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Resources" +CAPTION "Recursos" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 @@ -222,7 +222,7 @@ END IDD_DEVICEPOWER DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Power" +CAPTION "Administración de energía" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 diff --git a/dll/win32/kernel32/misc/console.c b/dll/win32/kernel32/misc/console.c index 298f79b8e59..aaf48ac882f 100644 --- a/dll/win32/kernel32/misc/console.c +++ b/dll/win32/kernel32/misc/console.c @@ -1467,6 +1467,12 @@ IntWriteConsole(HANDLE hConsoleOutput, max(sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE) + SizeBytes)); + if (Status == STATUS_PENDING) + { + WaitForSingleObject(Request->Data.WriteConsoleRequest.UnpauseEvent, INFINITE); + CloseHandle(Request->Data.WriteConsoleRequest.UnpauseEvent); + continue; + } if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { RtlFreeHeap(RtlGetProcessHeap(), 0, Request); diff --git a/dll/win32/shell32/lang/cs-CZ.rc b/dll/win32/shell32/lang/cs-CZ.rc index 6c80a3e3ce7..dff2e85bff0 100644 --- a/dll/win32/shell32/lang/cs-CZ.rc +++ b/dll/win32/shell32/lang/cs-CZ.rc @@ -1,6 +1,6 @@ /* FILE: dll/win32/shell32/lang/cs-CZ.rc * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) - * UPDATED: 2010-05-06 + * UPDATED: 2010-05-25 * THANKS TO: navaraf, who translated major part of this file */ @@ -101,7 +101,7 @@ BEGIN DEFPUSHBUTTON "&Ano", IDYES, 34, 69, 53, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "Ano &všem", IDD_YESTOALL, 92, 69, 65, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "&Ne", IDNO, 162, 69, 53, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&Storno", IDCANCEL, 220, 69, 53, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Storno", IDCANCEL, 220, 69, 53, 14, WS_GROUP | WS_TABSTOP ICON "", IDD_ICON, 10, 10, 16, 16 LTEXT "", IDD_MESSAGE, 40, 10, 238, 52, 0 END diff --git a/dll/win32/shell32/lang/es-ES.rc b/dll/win32/shell32/lang/es-ES.rc index f26e1d4b616..c619493d3f2 100644 --- a/dll/win32/shell32/lang/es-ES.rc +++ b/dll/win32/shell32/lang/es-ES.rc @@ -376,6 +376,16 @@ BEGIN PUSHBUTTON "Cancelar", 14006, 226, 236, 50, 14 END +IDD_SH_FILE_COPY DIALOGEX 0, 0, 264, 45 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION +CAPTION "Copiando..." +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + PUSHBUTTON "Cancelar", 14002, 195, 14, 60, 16 + CONTROL "", 14000, "MSCTLS_PROGRESS32", 0, 8, 20, 170, 10 + LTEXT "Archivo", 14001, 8, 6, 169, 10 +END + FOLDER_OPTIONS_GENERAL_DLG DIALOGEX 0, 0, 294, 240 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION CAPTION "General" @@ -755,5 +765,5 @@ BEGIN IDS_DEFAULT_CLUSTER_SIZE "Tamaño asignado por defecto" IDS_COPY_OF "Copia de" - IDS_SHLEXEC_NOASSOC "There is no Windows program configured to open this type of file." + IDS_SHLEXEC_NOASSOC "No hay ningún programa configurado en ReactOS para abrir este tipo de archivo." END diff --git a/dll/win32/shell32/lang/it-IT.rc b/dll/win32/shell32/lang/it-IT.rc index 18bafe2a6fd..824eb22a88e 100644 --- a/dll/win32/shell32/lang/it-IT.rc +++ b/dll/win32/shell32/lang/it-IT.rc @@ -374,6 +374,16 @@ BEGIN PUSHBUTTON "Annulla", 14006, 206, 236, 50, 14 END +IDD_SH_FILE_COPY DIALOGEX 0, 0, 264, 45 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION +CAPTION "Copia in corso..." +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + PUSHBUTTON "Annulla", 14002, 195, 14, 60, 16 + CONTROL "", 14000, "MSCTLS_PROGRESS32", 0, 8, 20, 170, 10 + LTEXT "File", 14001, 8, 6, 169, 10 +END + FOLDER_OPTIONS_GENERAL_DLG DIALOGEX 0, 0, 264, 256 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION CAPTION "Generale" diff --git a/dll/win32/syssetup/lang/es-ES.rc b/dll/win32/syssetup/lang/es-ES.rc index 3b5fabc6482..878aa3b8e43 100644 --- a/dll/win32/syssetup/lang/es-ES.rc +++ b/dll/win32/syssetup/lang/es-ES.rc @@ -254,7 +254,7 @@ BEGIN IDS_SYS_ENTERTAINMENT "Entretenimiento" IDS_CMT_MPLAY32 "Ejecutar Reproductor multimedia" IDS_CMT_SNDVOL32 "Ejecutar Control de volumen" - IDS_CMT_SNDREC32 "Launch Sound Recorder" + IDS_CMT_SNDREC32 "Ejecutar Grabadora de sonidos" END STRINGTABLE @@ -292,7 +292,7 @@ BEGIN IDS_SHORT_EVENTVIEW "Visor de sucesos.lnk" IDS_SHORT_MSCONFIG "Configuración del sistema.lnk" IDS_SHORT_SNDVOL32 "Control de volumen.lnk" - IDS_SHORT_SNDREC32 "Audiorecorder.lnk" + IDS_SHORT_SNDREC32 "Grabadora de sonidos.lnk" IDS_SHORT_DXDIAG "Diagnóstico de ReactX.lnk" IDS_SHORT_PAINT "Paint.lnk" IDS_SHORT_SPIDER "Solitario Spider.lnk" diff --git a/dll/win32/userenv/lang/es-ES.rc b/dll/win32/userenv/lang/es-ES.rc index dcfd07f92d8..8d87d2859ad 100644 --- a/dll/win32/userenv/lang/es-ES.rc +++ b/dll/win32/userenv/lang/es-ES.rc @@ -27,7 +27,7 @@ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL STRINGTABLE BEGIN IDS_PROFILEPATH "%SystemDrive%\\Documents and Settings" - IDS_APPDATA "Application Data" + IDS_APPDATA "Datos de programa" IDS_DESKTOP "Escritorio" IDS_FAVORITES "Favoritos" IDS_STARTMENU "Menu de Inicio" @@ -39,8 +39,8 @@ BEGIN IDS_MYMUSIC "Mis Documentos\\Mi música" IDS_MYVIDEOS "Mis Documentos\\Mis videos" IDS_TEMPLATES "Plantillas" - IDS_RECENT "Documentos recientes" - IDS_SENDTO "Enviar a" + IDS_RECENT "Reciente" + IDS_SENDTO "SendTo" IDS_PRINTHOOD "Impresoras" IDS_NETHOOD "Entorno de red" IDS_LOCALSETTINGS "Configuración local" diff --git a/dll/win32/userenv/lang/it-IT.rc b/dll/win32/userenv/lang/it-IT.rc index fa6106f922e..dbbbcfa17f9 100644 --- a/dll/win32/userenv/lang/it-IT.rc +++ b/dll/win32/userenv/lang/it-IT.rc @@ -27,8 +27,8 @@ BEGIN IDS_MYMUSIC "Documenti\\Musica" IDS_MYVIDEOS "Documenti\\Video" IDS_TEMPLATES "Modelli" - IDS_RECENT "Dati recenti" - IDS_SENDTO "Invia a" + IDS_RECENT "Recent" + IDS_SENDTO "SendTo" IDS_PRINTHOOD "Stampanti" IDS_NETHOOD "Risorse di rete" IDS_LOCALSETTINGS "Impostazioni locali" diff --git a/include/reactos/subsys/csrss/csrss.h b/include/reactos/subsys/csrss/csrss.h index 62fe387633c..0b707582f6f 100644 --- a/include/reactos/subsys/csrss/csrss.h +++ b/include/reactos/subsys/csrss/csrss.h @@ -62,6 +62,7 @@ typedef struct BOOL Unicode; ULONG NrCharactersToWrite; ULONG NrCharactersWritten; + HANDLE UnpauseEvent; BYTE Buffer[0]; } CSRSS_WRITE_CONSOLE, *PCSRSS_WRITE_CONSOLE; diff --git a/lib/3rdparty/freetype/ChangeLog b/lib/3rdparty/freetype/ChangeLog index cd5a4df4cc1..83a7d53c6d4 100644 --- a/lib/3rdparty/freetype/ChangeLog +++ b/lib/3rdparty/freetype/ChangeLog @@ -1,3 +1,5498 @@ +2010-02-13 Werner Lemberg + + * Version 2.3.12 released. + ========================== + + + Tag sources with `VER-2-3-12'. + + * docs/CHANGES: Updated. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.3.12. + + * README, Jamfile (RefDoc), + builds/win32/vc2005/freetype.vcproj, builds/win32/vc2005/index.html, + builds/win32/vc2008/freetype.vcproj, builds/win32/vc2008/index.html, + builds/win32/visualc/freetype.dsp, + builds/win32/visualc/freetype.vcproj, + builds/win32/visualc/index.html, builds/win32/visualce/freetype.dsp, + builds/win32/visualce/freetype.vcproj, + builds/win32/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.3.11/2.3.12/, s/2311/2312/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 12. + + * builds/unix/configure.raw (version_info): Set to 10:0:4. + +2010-02-12 suzuki toshiya + + Improve autotool version checking to work with beta releases. + + * autogen.sh (check_tool_version): Improve the extraction of version + number from "tool --version" output. Some beta releases of + autotools have extra strings before version number. + +2010-02-12 suzuki toshiya + + Fix overallocating bug in FT_Outline_New_Internal(). + + * src/base/ftoutln.c (FT_Outline_New_Internal): The length of + FT_Outline->points[] should be numPoints, not 2 * numPoints. + Found by Paul Messmer, see + http://lists.gnu.org/archive/html/freetype-devel/2010-02/msg00003.html + +2010-02-10 Ken Sharp + + Really fix Savannah bug #28678 (part 2). + + Since we consider `sbw' for the horizontal direction only, we still have + to synthesize vertical metrics if the user wants to use the vertical + writing direction. + + * src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c + (cid_slot_load_glyph), src/type1/t1gload.c (T1_Load_Glyph): + Synthesize vertical metrics (only) if FT_LOAD_VERTICAL_LAYOUT is + set. + +2010-02-10 Ken Sharp + + Really fix Savannah bug #28678 (part 1). + + After long discussion, we now consider the character width vector + (wx,wy) returned by the `sbw' Type 1 operator as being part of *one* + direction only. For example, if you are using the horizontal + writing direction, you get the horizontal and vertical components of + the advance width for this direction. Note that OpenType and CFF fonts + don't have such a vertical component; instead, the GPOS table can be + used to generate two-dimensional advance widths (but this isn't + handled by FreeType). + + * include/freetype/ftincrem.h (FT_Incremental_MetricsRec): Add + `advance_v' field to hold the vertical component of the advance + value. + + * src/truetype/ttgload.c (tt_get_metrics), src/cff/cffgload.c + (cff_slot_load), src/type1/t1gload.c + (T1_Parse_Glyph_And_Get_Char_String), src/cid/cidgload.c + (cid_load_glyph): Use it. + +2010-02-08 Werner Lemberg + + * devel/ftoption.h [FT_CONFIG_OPTION_PIC]: Define. + +2010-02-04 suzuki toshiya + + Prevent NULL pointer dereference passed to FT_Module_Requester. + + * src/sfnt/sfdriver.c (sfnt_get_interface): Don't use `module'. + * src/psnames/psmodule.c (psnames_get_interface): Ditto. + + * src/cff/cffdrivr.c (cff_get_interface): Check NULL `driver'. + * src/truetype/ttdriver.c (tt_get_interface): Ditto. + +2010-01-29 suzuki toshiya + + Fix memory leaks in previous patch. + + * src/sfnt/sfobjs.c (sfnt_load_face): Don't overwrite the strings + allocated for face->root.family_name and style_name. + +2010-01-29 suzuki toshiya + + New parameters for FT_Open_Face() to ignore preferred family names. + + Preferred family names should be used for legacy systems that + can hold only a few faces (<= 4) for a family name. Suggested by + Andreas Heinrich. + http://lists.gnu.org/archive/html/freetype/2010-01/msg00001.html + + * include/freetype/ftsnames.h (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, + FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Define. + + * src/sfnt/sfobjs.h (sfnt_load_face): Check the arguments and + ignore preferred family and subfamily names if requested. + +2010-01-27 Ken Sharp + + Fix Savannah bug #28678. + + * src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c + (cid_load_glyph): Handle vertical metrics correctly. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Handle + vertical metrics correctly. + (T1_Load_Glyph): Don't synthesize vertical metrics. + +2010-01-14 Werner Lemberg + + Make FT_Set_Transform work if no renderer is available. + + * src/base/ftobjs.c (FT_Load_Glyph): Apply `standard' transformation + if no renderer is compiled into the library. + +2010-01-14 Werner Lemberg + + Fix compilation warning. + + * src/base/ftbase.h: s/LOCAL_DEF/LOCAL/. + * src/base/ftobjc.s: Include ftbase.h conditionally. + +2010-01-11 Kwang Yul Seo + + Provide inline assembly code for RVCT compiler. + This is Savannah patch #7059. + + * include/freetype/config/ftconfig.h (FT_MULFIX_ASSEMBLER, + FT_MulFix_arm) [__CC_ARM || __ARM_CC]: Define. + +2010-01-08 Ken Sharp + + Fix Savannah bug #28521. + + Issue #28226 involved a work-around for a font which used the + `setcurrentpoint' operator in an invalid way; this operator is only + supposed to be used with the result of OtherSubrs, and the font used + it directly. The supplied patch removed the block of code which + checked this usage entirely. + + This turns out to be a Bad Thing. If `setcurrentpoint' is being + used correctly it should reset the flex flag in the decoder. If we + don't do this then the flag never gets reset and we omit any further + contours from the glyph (at least until we close the path or + similar). + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Handle `flex_state' correctly. + +2010-01-05 Werner Lemberg + + Apply reports from clang static analyzer. + + * src/lzw/ftlzw.c (ft_lzw_file_init), src/base/ftstroke.c + (FT_Stroker_ParseOutline), src/base/ftsynth.c + (FT_GlyphSlot_Embolden): Remove dead code. + + * src/base/ftpatent.c (_tt_check_patents_in_table): Initialize + `offset_i' and `length_i'. + +2010-01-05 Ralph Giles + + Enable the incremental font interface by default. + + Ghostscript requires the incremental font interface for handling + some Postscript documents. It is moving to using FreeType as its + primary renderer; supporting this in the default build makes it + Ghostscript to be linked against the system FreeType when one is + available. + + * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_INCREMENTAL): + Uncomment. + +2010-01-05 Werner Lemberg + + Fix Savannah bug #28395. + + * src/truetype/ttdriver.c (Load_Glyph), src/type1/t1gload.c + (T1_Loada_Glyph): Don't check `num_glyphs' if incremental interface + is used. + +2010-01-05 Ken Sharp + + Make Type 1 `seac' operator work with incremental interface. + This fixes Savannah bug #28480. + + * src/psaux/t1decode.c (t1operator_seac): Don't check `glyph_names' + if incremental interface is used. + +2010-01-04 Ken Sharp + + Make incremental interface work with TrueType fonts. + This fixes Savannah bug #28478. + + * src/truetype/ttgload.c (load_truetype_glyph): Don't check + `glyf_offset' if incremental interface is used. + +2009-12-31 Lars Abrahamsson + + Make compilation with FT_CONFIG_OPTION_PIC work again. + + * src/base/ftglyph.c (FT_Glyph_To_Bitmap) [FT_CONFIG_OPTION_PIC]: + Declare `library' for FT_BITMAP_GLYPH_CLASS_GET. + + * src/base/ftinit.c (ft_destroy_default_module_classes, + ft_create_default_module_classes): Use proper casts (needed for C++ + compilation). + + * src/sfnt/ttcmap.c (tt_cmap13_class_rec): Use FT_DEFINE_TT_CMAP. + +2009-12-22 Marc Kleine-Budde + + Make freetype-config aware of $SYSROOT. + This is Savannah patch #7040. + + * builds/unix/freetype-config.in: Decorate with ${SYSROOT} where + appropriate. + +2009-12-20 Werner Lemberg + + Fix compiler warning. + Reported by Sean. + + * src/base/ftdbgmem.c [!FT_DEBUG_MEMORY]: ANSI C doesn't like empty + source files; however, some compilers warn about an unused variable + declaration. This is now replaced with a typedef. + +2009-12-18 Werner Lemberg + + Fix Savannah bug #28320. + + There exist corrupt, subsetted fonts (embedded in PDF files) which + contain a private dict that ends with an unterminated floating point + number (no operator following). We now ignore this error (as + acrobat does). + + * src/cff/cffparse.c (cff_parser_run): Don't emit a syntax error for + unterminated floating point numbers. + +2009-12-16 Werner Lemberg + + Really fix compiler warnings. + Reported by Sean. + + * src/truetype/ttgxvar.c (GX_PT_POINTS_ARE_WORDS, + GX_PT_POINT_RUN_COUNT_MASK): Convert enum values to macros. + +2009-12-16 suzuki toshiya + + Improve configure.raw to copy some options from CFLAGS to LDFLAGS. + The linker of Mac OS X 10.6 is sensitive to the architecture. If + the architectures are specified explicitly for the C compiler, the + linker requires the architecture specifications too. + + * builds/unix/configure.raw: Replace `-isysroot' option parser by + more generic argument parser. + +2009-12-15 Werner Lemberg + + Fix compiler warnings. + Reported by Sean. + + * src/truetype/ttgxvar.c (ft_var_readpackeddeltas): Fix counter data + type. + +2009-12-14 Ken Sharp + + Ignore invalid `setcurrentpoint' operations in Type 1 fonts. + This fixes Savannah bug #28226. + + At least two wild PostScript files of unknown provenance contain + Type 1 fonts, apparently converted from TrueType fonts in earlier + PDF versions of the files, which use the `setcurrentpoint' operator + inappropriately. + + FreeType currently throws an error in this case, but Ghostscript and + Adobe Distiller both accept the fonts and ignore the problem. This + commit #ifdefs out the check so PostScript interpreters using + FreeType can render these files. + + The specification says `setcurrentpoint' should only be used to set + the point after a `Subr' call, but these fonts use it to set the + initial point to (0,0). Unnecessarily so, as they correctly use an + `hsbw' operation which implicitly sets the initial point. + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Comment out code. + +2009-12-14 Bram Tassyns + + Fix parsing of /CIDFontVersion. + This fixes Savannah bug #28287. + + * src/cid/cidtoken.h: `cid_version' in CID_FaceInfoRec (in + t1tables.h) is of type FT_Fixed. + +2009-12-14 Werner Lemberg + + Trace glyph index in CID module. + Suggested in Savannah patch #7023. + + * src/cid/cidgload.c (cid_load_glyph): Add tracing message. + +2009-12-03 Werner Lemberg + + Fix compiler warnings. + + * src/truetype/ttgload.c (tt_get_metrics): Put `Exit' label into the + proper preprocessor conditional. + * src/pfr/pfrobjs.c (pfr_slot_load): Pacify gcc. + +2009-11-25 John Tytgat + + Better handling of start of `eexec' section. + This fixes Savannah bug #28090. + + * src/type1/t1parse.c (T1_Get_Private_Dict): Skip all whitespace + characters before start of `eexec' section. + +2009-11-20 Werner Lemberg + + Fix Savannah bug #27742. + + * src/base/ftstroke.c (ft_stroker_outside): Avoid silent division by + zero, using a threshold for `theta'. + +2009-11-20 Werner Lemberg + + Fix Savannah bug #28036. + + * src/type1/t1afm.c (t1_get_index): Fix comparison. + +2009-11-16 Werner Lemberg + + Fix compiler warnings. + Reported by Kevin Blenkinsopp . + + * src/sfnt/ttload.c (check_table_dir): Use proper data type. + +2009-11-15 Werner Lemberg + + Really fix FreeDesktop bug #21197. + This also fixes Savannah bug #28021. + + * src/autofit/aflatin.c (af_latin_metrics_check_digits), + src/autofit/aflatin2.c (af_latin2_metrics_check_digits): Fix loop. + +2009-11-15 Werner Lemberg + + Add tracing messages for advance values. + + * src/base/ftobjs.c (FT_Load_Glyph), src/truetype/ttgload.c + (TT_Get_HMetrics, TT_Get_VMetrics): Do it. + +2009-11-08 Werner Lemberg + + Fix compiler warning. + Reported by Jeremy Manson . + + * src/truetype/ttgload.c (load_truetype_glyph): Initialize `error'. + +2009-11-04 Werner Lemberg + + Remove compiler warning. + Reported by Sean McBride . + + * src/tools/apinames.c (read_header_file): Use a cast to + `int', as specified in the printf(3) man page. + +2009-11-04 Werner Lemberg + + Fix Savannah bug #27921. + + * src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c + (cid_face_init), src/type1/t1afm.c (T1_Read_Metrics), + src/type1/t1objs.c (T1_Face_Init): Don't use unsigned constant + values for rounding if the argument can be negative. + +2009-11-03 Bram Tassyns + + Add basic support for Type1 charstrings in CFF. + This fixes Savannah bug #27922. + + * src/cff/cffgload.c (CFF_Operator, cff_argument_counts): Handle + `seac', `sbw', and `setcurrentpoint' opcodes. + (cff_compute_bias): Add parameter to indicate the charstring type. + Update all callers. + (cff_operator_seac): Add parameter for side bearing. + (cff_decoder_parse_charstrings): Updated for more Type1 support. + +2009-11-03 Werner Lemberg + + Return correct `linearHoriAdvance' value for embedded TT bitmaps too. + Reported by Jeremy Manson . + + src/truetype/ttgload.c (load_truetype_glyph): Add parameter to + quickly load the glyph header only. + Update all callers. + (tt_loader_init): Add parameter to quickly load the `glyf' table + only. + Update all callers. + (TT_Load_Glyph): Compute linear advance values for embedded bitmap + glyphs too. + +2009-11-03 Werner Lemberg + + Improve code readability. + + * src/ttgload.c (load_truetype_glyph): Move metrics calculation + to... + (tt_get_metrics): This new function. + +2009-10-26 Bram Tassyns + + Fix Savannah bug #27811. + + * src/truetype/ttxgvar.c (ft_var_readpackeddeltas): Fix + signed/unsigned mismatch. + +2009-10-19 Ning Dong + + Fix handling of `get' and `put' CFF instructions. + + * src/cff/cffgload.c (cff_decoder_parse_charstrings) : Appendix B of Adobe Technote #5177 limits the number of + elements for the `get' and `put' operators to 32. + * src/cff/cffgload.h (CFF_MAX_TRANS_ELEMENTS): Define. + (CFF_Decoder): Use it for `buildchar' and remove `len_buildchar'. + +2009-10-18 Werner Lemberg + + Fix handling of `dup' CFF instruction. + Problem and solution reported by Ning Dong . + + * src/cff/cffgload.c (cff_decoder_parse_charstrings) : + Increase `args' by 2, not 1. + +2009-10-10 Werner Lemberg + + * 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 + + * docs/CHANGES, docs/release: Updated. + +2009-10-10 suzuki toshiya + + * 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 + + * 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 + + 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 + + [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 + + [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 + + [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 to handle + FT_ADVANCES_H correctly in multi build. + +2009-09-24 suzuki toshiya + + [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 + + * docs/CHANGES: Updated. + +2009-09-12 Werner Lemberg + + [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 + + 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 + + [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 + + [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 + + [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 + + 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 + + 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 + + Fix rendering of horizontally compressed CFFs. + Bug reported by Ivan Nincic . + + * 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 cast 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 cast to FT_UInt32, when calculates FT_UInt32. + (FT_Vector_Rotate): The long constant 1L is cast to + FT_Int32 to calculate FT_Int32 `half'. + +2009-07-31 suzuki toshiya + + 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 + + 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 + + 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 cast to unsigned 32-bit + integer. + +2009-07-31 suzuki toshiya + + 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 + + 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 + cast to unsigned 32-bit integer. + +2009-07-31 suzuki toshiya + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 cast to size_t. + +2009-07-31 suzuki toshiya + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + gzip: Distinguish PureC from TurboC on MSDOS. + + * src/gzip/zutil.c (zcalloc, zcfree): Enable only for + MSDOS platform. + +2009-07-31 suzuki toshiya + + 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 + + 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 + + Fix Redhat bugzilla #513582 and Savannah bug #26849. + + * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP) : Fix + aliasing bug. + +2009-07-19 Werner Lemberg + + Document recent library changes. + + * docs/CHANGES: Do it. + +2009-07-17 Werner Lemberg + + 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 + + * docs/release: Updated. + +2009-07-15 Werner Lemberg + + README.CVS -> README.git + + * README.CVS: Renamed to... + * README.git: This. + Updated. + +2009-07-15 suzuki toshiya + + 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 + + Fix Savannah bug #27026. + + * builds/win32/vc2005/freetype.sln: Use correct version number. + +2009-07-12 suzuki toshiya + + 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 + + [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 + + smooth: Check glyph size by width/height, instead of pitch/height. + Suggested by der Mouse . + + * 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 + + 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 + + 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 + + Prevent the overflows by a glyph with too many points or contours. + The bug is reported by Boris Letocha . 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 + + 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 + + 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 + + [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 + + Thinko. + + * src/psaux/t1decode.c (t1operator_seac) + [FT_CONFIG_OPTION_INCREMENTAL]: Test for existence of incremental + interface. + +2009-06-28 Werner Lemberg + + * devel/ftoption.h [FT_CONFIG_OPTION_INCREMENTAL]: Define. + +2009-06-27 suzuki toshiya + + 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 + + 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 + + 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 + + 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 + + [truetype] Remove TT_SubGlyphRec. + + * src/truetype/ttobjs.h (TT_SubGlyphRec): Removed, unused. + +2009-06-26 Werner Lemberg + + * */*: 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 + + 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 + + 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 + + * src/pshinter/pshrec.c: Use PSH_Err_Ok. + +2009-06-21 Werner Lemberg + + 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 + + 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 + + [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 + + [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 + + * src/autofit/aflatin.c (af_latin_metrics_check_digits): Fix + compiler warning. + +2009-06-20 Werner Lemberg + + * builds/compiler/gcc.mk (CFLAGS): Use -O3, not -O6. + +2009-06-19 Werner Lemberg + + [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 + + 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 + + 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 + + * docs/CHANGES: Updated. + +2009-06-18 Werner Lemberg + + 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 + + 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 + + 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 + + Handle FT_STROKER_LINECAP_BUTT. + This fixes Savannah bug #26757. + + * src/base/ftstroke.c (ft_stroker_cap): Implement it. + +2009-06-07 Harald Fernengel + + 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 + + Simplify math. + Suggested by Alexei Podtelezhnikov . + + * src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop, + Horizontal_Gray_Sweep_Drop): Do it. + +2009-06-04 Werner Lemberg + + 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 + + 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 + + Remove compiler warning. + Reported by Krzysztof Kowalczyk . + + * src/autofit/aflatin2.c (af_latin2_hint_edges): Move declaration of + `n_edges' into `#if' block. + +2009-05-28 Werner Lemberg + + Make compilation work with FT_CONFIG_OPTION_USE_ZLIB not defined. + Reported by Krzysztof Kowalczyk . + + * src/pcf/pcfdrivr.c (PCF_Face_Init) [!FT_CONFIG_OPTION_USE_ZLIB]: + Make it work. + Simplify #ifdef logic. + +2009-05-22 Werner Lemberg + + Improve b/w rasterizer. + Problem reported by Krzysztof Kotlenga . + + * 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 + + Fix Savannah bug #26600. + + * src/type42/t42parse.c (t42_load_keyword): Handle + T1_FIELD_LOCATION_FONT_EXTRA. + +2009-04-30 Werner Lemberg + + Document recent changes to ftview. + + * docs/CHANGES: Do it. + +2009-04-27 Werner Lemberg + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + Ignore empty contours in CFF glyphs. + + Problem reported by Albert Astals Cid . + + * src/cff/cffgload.c (cff_builder_close_contour): Synchronize with + t1_builder_close_contour. + +2009-03-21 Werner Lemberg + + Another redundant header inclusion. + + * src/truetype/ttgxvar.c: Fix Ghostscript Coverity issue #4041. + +2009-03-21 Werner Lemberg + + Remove redundant header inclusions. + + This covers many Ghostscript Coverity issues. + + * src/*: Do it. + +2009-03-21 Werner Lemberg + + Fix Ghostscript Coverity issue #3904. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Protect against + invalid values of `runcnt'. + +2009-03-20 Werner Lemberg + + Fix `make multi' run. + + * src/smooth/ftsmooth.h: Include FT_INTERNAL_DEBUG_H. + +2009-03-20 Werner Lemberg + + Fix Savannah bug #25923. + + * src/cache/ftccmap.c (FTC_CMAP_HASH): Fix typo. + +2009-03-20 Werner Lemberg + + Protect against too large glyphs. + + Problem reported by Tavis Ormandy . + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Don't allow + `pitch' or `height' to be larger than 0xFFFF. + +2009-03-20 Werner Lemberg + Tavis Ormandy + + 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 + + Protect against malformed compressed data. + + * src/lzw/ftzopen.c (ft_lzwstate_io): Test whether `state->prefix' is + zero. + +2009-03-20 Werner Lemberg + + Protect against invalid SID values in CFFs. + + Problem reported by Tavis Ormandy . + + * src/cff/cffload.c (cff_charset_load): Reject SID values larger + than 64999. + +2009-03-19 Vincent Richomme + + 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 + + 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 + + Make `gzip' module compile on WinCE. + + * src/gzip/zconf.h [_WIN32_WCE]: Define NO_ERRNO_H. + +2009-03-19 Werner Lemberg + + 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 + + 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 + + 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 + + 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 + + * Version 2.3.9 released. + ========================= + + + Tag sources with `VER-2-3-9'. + +2009-03-12 Werner Lemberg + + * builds/unix/freetype2.in: Move @FT2_EXTRA_LIBS@ to `Libs.private'. + +2009-03-12 Werner Lemberg + + 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 + + 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 + + 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 + + Fix Savannah bug #25814. + + * builds/unix/freetype2.in: As suggested in the bug report, move + @LIBZ@ to `Libs.private'. + +2009-03-11 Werner Lemberg + + 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 + + * src/base/Jamfile: Fix handling of ftadvanc.c. + Reported by Oran Agra . + +2009-03-10 Vincent Richomme + + 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 + + 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 + + * src/sfnt/rules.mk (SFNT_DRV_H): Add ttsbit0.c. + +2009-03-09 Alexey Kryukov + + 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 + + * builds/unix/configure.raw (version_info): Set to 9:20:3. + +2009-03-03 David Turner + + 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 + + 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 + + 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 + + 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 + + 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 + + Fix Savannah bug #25588. + + * builds/unix/ftconfig.in (FT_MulFix_arm): Use correct syntax for + `orr' instruction. + +2009-02-11 Werner Lemberg + + * src/truetype/ttobjs.c (tt_check_trickyness): Add `DFKaiShu'. + Reported by David Bevan . + +2009-02-09 Werner Lemberg + + 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 + + Fix Savannah bug #25480. + + * builds/unix/freetype-config.in: For --ftversion, don't use $prefix + but $includedir. + +2009-01-31 Werner Lemberg + + Minor docmaker improvements. + + * src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty + code blocks. + +2009-01-25 Werner Lemberg + + Fix SCANCTRL handling in TTFs. + Problem reported by Alexey Kryukov . + + * src/truetype/ttinterp.c (Ins_SCANCTRL): Fix threshold handling. + +2009-01-23 Werner Lemberg + + Move FT_Get_FSType_Flags to a separate file. + Problem reported by Mickey Gabel . + + * 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 + + * builds/unix/ftsystem.c (FT_Stream_Open): Fix 2 error + messages ending without "\n". + +2009-01-22 suzuki toshiya + + 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 + + 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 + + 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 . + +2009-01-18 Werner Lemberg + + 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 . + +2009-01-18 Werner Lemberg + + * include/freetype/ftstroke.h (FT_Outline_GetInsideBorder): Fix + documentation. Problem reported by Truc Truong . + + * docs/CHANGES: Updated. + +2009-01-14 Werner Lemberg + + * 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 + + * builds/toplevel.mk (dist): Compress better. + +2009-01-13 Werner Lemberg + + * src/base/ftobjs.c (FT_Get_FSType_Flags): Cast for compilation + with C++. + +2009-01-13 Werner Lemberg + + Don't use stdlib.h and friends directly. + Reported by Mickey Gabel . + + * src/base/ftdbgmem.c: s//FT_CONFIG_STANDARD_LIBRARY_H/. + + * src/gzip/ftgzip.c, src/lzw/ftlzw.c, src/raster/ftmisc.h: + s//FT_CONFIG_STANDARD_LIBRARY_H/. + + * src/autofit/aftypes.h, src/autofit/afhints.c, + src/pshinter/pshalgo.c: s//FT_CONFIG_STANDARD_LIBRARY_H/ + + * src/lzw/ftlzw.c, src/base/ftdbgmem.c: Don't include stdio.h. + +2009-01-12 Werner Lemberg + + Avoid compiler warnings. + + * */*: s/do ; while ( 0 )/do { } while ( 0 )/. + Reported by Sean McBride . + +2009-01-12 Werner Lemberg + + Fix stdlib dependencies. + + Problem reported by Mickey Gabel . + + * 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 + + * docs/formats.txt: Add link to PCF specification. + + * include/freetype/ftbdf.h (FT_Get_BDF_Property): Improve + documentation. + +2009-01-09 suzuki toshiya + + * 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 + + * src/gxvalid/gxvmort.c (gxv_mort_feature_validate): Fix wrong + length check. From Savannah patch #6682. + +2009-01-09 Werner Lemberg + + 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 . + +2009-01-09 suzuki toshiya + + * 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 + + * 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 + + * docs/CHANGES: Document new key `a' in ftdiff. + +2009-01-06 Werner Lemberg + + * autogen.sh: Don't use GNUisms while calling sed. Problem reported + by Sean McBride. + +2009-01-06 Werner Lemberg + + * src/base/ftbitmap.c (FT_Bitmap_Convert): Handle FT_PIXEL_MODE_LCD + and FT_PIXEL_MODE_LCD_V. Problem reported by Chi Nguyen + . + +2009-01-06 Diego Pettenò + + * 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 + + * src/base/ftdbgmem.c (_debug_mem_dummy): Make it static. + + * src/base/ftmac.c: Remove some #undefs. + +2008-12-26 Werner Lemberg + + 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 + + * 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 + + * 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 . + +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 + + * 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 + + * docs/CHANGES: Updated. + +2008-12-18 Bevan, David + + 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 + + * 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 + + * 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 + + 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 + + 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 + + * 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 + + * 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 + + GDEF tables need `glyph_count' too for validation. Problem reported + by Chi Nguyen . + + * 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 + + * 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 + + * 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 + + * 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 + + * src/cff/cffparse.c (cff_parse_real): Handle more than nine + significant digits correctly. This fixes Savannah bug #24953. + +2008-11-25 Daniel Zimmermann + + * src/base/ftstream.c (FT_Stream_ReadFields): Don't access stream + before the NULL check. From Savannah patch #6681. + +2008-11-24 Werner Lemberg + + 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 + + * 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 + . + +2008-11-12 Tor Andersson + + * src/cff/cffdrivr.c (cff_get_cmap_info): Initialize `format' field. + This fixes Savannah bug #24819. + +2008-11-08 Werner Lemberg + + * 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 + + * src/base/ftobjs.c (ft_glyphslot_free_bitmap): Protect against + slot->internal == NULL. Reported by Graham Asher. + +2008-11-08 Werner Lemberg + + * 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 + + * 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 + + * 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 . + +2008-10-15 Graham Asher + + * src/sfnt/ttpost.c (tt_post_default_names): Add `const'. + +2008-10-15 David Turner + + * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Disambiguate for + meddlesome compilers' warning against `for ( ...; ...; ...) ;'. + +2008-10-14 Werner Lemberg + + * src/cff/cffobjs.c (cff_face_init): Remove compiler warning. + Suggested by Bram Tassyns in Savannah patch #6651. + +2008-10-12 Graham Asher + + * src/sfnt/sfobjs.c (sfnt_load_face): Fix computation of + `underline_position'. + +2008-10-12 Werner Lemberg + + * docs/CHANGES: Updated. + +2008-10-09 suzuki toshiya + + 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 + + Fix Savannah bug #24485. + + * src/type1/t1load.c (parse_charstrings): Assure that we always have + a .notdef glyph. + +2008-10-05 suzuki toshiya + + * src/base/ftmac.c: Include FT_TRUETYPE_TAGS_H for multi build. + * builds/mac/ftmac.c: Ditto. + +2008-10-05 suzuki toshiya + + * include/freetype/tttags.h (TTAG_TYP1, TTAG_typ1): Fix definitions. + * src/base/ftobjs.c: Include FT_TRUETYPE_TAGS_H. + +2008-10-05 suzuki toshiya + + * 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 + + * 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 + + * src/base/ftobjs.c (ft_lookup_PS_in_sfnt_stream): Remove wrong + initialization of *is_sfnt_cid. + +2008-10-04 Werner Lemberg + + * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Remove compiler + warnings. + +2008-10-04 suzuki toshiya + + * 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 + + * 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 + + * 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 + + * src/cff/cffgload.c (cff_slot_load): Map CID 0 to GID 0. This + fixes Savannah bug #24430. + +2008-10-02 Werner Lemberg + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * src/cff/cffgload.c (CFF_Operator, cff_argument_counts, + cff_decoder_parse_charstrings): Handle (invalid) + `callothersubr' and `pop' instructions. + +2008-09-22 John Tytgat + + 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 + + * 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 . + +2008-09-21 suzuki toshiya + + * 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 + + * src/smooth/ftgrays.c (gray_find_cell): Fix threshold. The values + passed to this function are already `normalized'. Problem reported + by Stephan T. Lavavej . + + * docs/CHANGES: Document it. + +2008-09-20 Werner Lemberg + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * src/cff/cffobjs.c (cff_face_init): Use TTAG_OTTO defined + in ttags.h instead of numerical value 0x4F54544FL. + +2008-09-16 Werner Lemberg + + * src/cff/cffgload.h, src/cff/cffgload.c + (cff_decoder_set_width_only): Eliminate function call. + +2008-09-15 George Williams + + 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 + + * 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 + + * 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 + + * src/base/ftbase.c: Include ftadvanc.c. + +2008-09-11 suzuki toshiya + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + 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 + + * 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 + + 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 + + * src/cff/cffgload.c (cff_decoder_prepare, + cff_decoder_parse_charstrings): Improve debug output. + +2008-07-22 Martin McBride + + * 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 + + * 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 + + 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 + + * 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 + + 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 + + * 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 + + * 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 + + * 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 + + * 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 + + 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 + + * 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 + + * 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 + + * 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 + + * src/truetype/ttgload.c (TT_Load_Glyph): Protect bytecode stuff + with IS_HINTED. + + * docs/CHANGES: Updated. + +2008-06-22 suzuki toshiya + + * 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 + + 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 + + * 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 + + * src/type/t1objs.c (T1_Face_Init): Slightly improve algorithm fix + from 2008-06-19. + +2008-06-18 Werner Lemberg + + * src/type/t1objs.c (T1_Face_Init): Fix change from 2008-03-21. + Reported by Peter Weilbacher . + + * docs/CHANGES: Updated. + +2008-06-15 George Williams + + * 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 + + * src/base/ftcalc.c (FT_MulFix) : Protect registers correctly + from clobbering. Patch from Savannah bug report #23556. + + * docs/CHANGES: Document it. + +2008-06-10 Werner Lemberg + + * autogen.sh: Add option `--install' to libtoolize. + +2008-06-10 Werner Lemberg + + * 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 + + * src/base/ftobjs.c (open_face): Check `clazz->init_face' and + `clazz->done_face'. + +2008-06-09 VaDiM + + 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 + + * 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 + + * 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 + + * 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 + + * include/freetype/ftcache.h (FTC_FaceID): Change type back to + FT_Pointer. Reported by Ian Britten . + +2008-06-02 Werner Lemberg + + 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 + + * include/freetype/config/ftheader.h (FT_UNPATENTED_HINTING_H, + FT_INCREMENTAL_H): Added. + +2008-05-28 Werner Lemberg + + * 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 + + * 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 + + * src/tools/docmaker/tohtml.py (block_footer_start, + block_footer_middle): Beautify output. + +2008-05-25 Werner Lemberg + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Handle zero-contour + glyphs correctly. Patch from Savannah bug #23277. + +2008-05-16 Werner Lemberg + + * docs/CHANGES: Updated. + +2008-05-16 Sergey Tolstov + + 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 + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : `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 + + * builds/toplevel.mk (CONFIG_GUESS, CONFIG_SUB): Updated. + +2008-05-15 Werner Lemberg + + * 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 + + 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 + + * 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 + + 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 + + * 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 + + * 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 + + * 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 + + * src/psaux/psconv.c (PS_Conv_ToFixed): Increase precision if + integer part is zero. + +2008-04-01 Werner Lemberg + + 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 + + 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 + + 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 + + * src/type1/t1objs.c (T1_Face_Init): Use `/Weight'. Patch from + Savannah bug #22675. + +2008-03-13 Derek Clegg + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix named style loop. + Patch from Savannah bug #22541. + +2008-03-03 Masatoshi Kimura + + * 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 + + * 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 + + * 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 + + * 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 + + * src/truetype/ttinterp.c (Ins_IUP): Check number of points. Fix + from Savannah bug #22356. + +2008-02-17 Jonathan Blow + + * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): + Check for valid callback pointers. + +2008-02-15 suzuki toshiya + + * 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 + + * src/base/ftbase.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 + + * 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 + + * 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 + + * src/raster/ftraster.c (ft_black_render): Check `outline' before + using it. Reported by Allan Yang. + +2008-01-12 Werner Lemberg + + * src/raster/ftraster.c (FT_CONFIG_OPTION_5_GRAY_LEVELS): Remove. + +2008-01-12 Allan Yang, Jian Hua - SH + + * src/raster/ftraster.c (ft_black_init) + [FT_RASTER_OPTION_ANTI_ALIASING]: Fix compilation. + +2008-01-10 Werner Lemberg + + * 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 + + 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 + + * src/smooth/ftgrays.c (gray_raster_render): Check `outline' + correctly. + +2007-12-21 suzuki toshiya + + 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 + + * 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 + + * src/truetype/ttgload.c (load_truetype_glyph): Fix compilation if + TT_USE_BYTECODE_INTERPRETER isn't defined. + +2007-12-06 Werner Lemberg + + 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 + + * 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 + + * 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 + + 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 + + * 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 + + * src/truetype/ttobjs.c (tt_face_init): Don't use logical OR to + concatenate error codes. + +2007-12-04 Sean McBride + + * src/pfr/pfrgload.c (pfr_glyph_load_compound): Remove compiler + warning. + +2007-11-20 suzuki toshiya + + 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 + + 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 + and + instead of + all-in-one header file . + + Include 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 + + * src/sfnt/sfobjs.c (sfnt_done_face): Check `sfnt' everywhere. This + fixes Savannah bug #21485. + +2007-10-29 Daniel Svoboda + + * 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 + + * 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 + + * 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 + + * 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 + + 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 + + * 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 + + * 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 + + * 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 + + * src/otvalid/otvgsub.c (otv_SingleSubst_validate): Fix handling of + SingleSubstFormat1. + +2007-08-11 suzuki toshiya + + * 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 + + * 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 + + * 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 + + 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 + + * builds/unix/configure.raw: Add call to AC_LIBTOOL_WIN32_DLL. + Fixes Savannah bug #20686. + +2007-08-03 Werner Lemberg + + * src/psnames/psmodule.c: Fix usage of + FT_CONFIG_OPTION_POSTSCRIPT_NAMES macro. Reported by Graham Asher. + +2007-07-31 suzuki toshiya + + * 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 + + * 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 + + * src/base/ftoutln.c (FT_Outline_Translate): Check `outline' before + first usage. From Savannah patch #6115. + +2007-07-16 Werner Lemberg + + * docs/CHANGES: Updated. + +2007-07-16 Derek Clegg + + 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 + + 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 + + * src/base/ftglyph.c (FT_Glyph_Copy): Fix initialization of + `target'. Reported by Sean McBride. + +2007-07-06 Werner Lemberg + + * 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 + + * 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 + + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize + `round' to pacify compiler. + 2007-07-02 Werner Lemberg @@ -564,7 +6059,7 @@ * 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 +2007-04-25 Boris Letocha * src/truetype/ttobjs.c: Fix a typo that created a speed regression in the TrueType bytecode loader. @@ -1363,7 +6858,7 @@ * 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. @@ -1405,8 +6900,8 @@ 2006-12-08 Vladimir Volovich - * src/tools/apinames (State): Remove final comma in structure -- xlc - v5 under AIX 4.3 doesn't like this. + * src/tools/apinames.c (State): Remove final comma in structure -- + xlc v5 under AIX 4.3 doesn't like this. 2006-12-07 David Turner @@ -1922,22 +7417,22 @@ 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. - * 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. - * freetype2/src/bdf/bdflib.c (bdf_load_font): Initialize local + * src/bdf/bdflib.c (bdf_load_font): Initialize local 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 @@ -1950,30 +7445,29 @@ 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 - * 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'. - * 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 @@ -1984,7 +7478,7 @@ 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 @@ -2030,44 +7524,43 @@ `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 - * 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. - * 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. - * 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'). - * 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 @@ -2078,19 +7571,18 @@ 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. - * 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'. @@ -2102,46 +7594,45 @@ `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 - * 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. - * 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'. - * 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. - * 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'. - * 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. @@ -2156,12 +7647,12 @@ `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. - * 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 @@ -2230,7 +7721,7 @@ 2006-06-24 Eugeniy Meshcheryakov 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. @@ -2441,7 +7932,7 @@ ---------------------------------------------------------------------------- -Copyright 2006, 2007 by +Copyright 2006, 2007, 2008, 2009, 2010 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/lib/3rdparty/freetype/ChangeLog.21 b/lib/3rdparty/freetype/ChangeLog.21 index 3a1bcf0c11d..d6371d17583 100644 --- a/lib/3rdparty/freetype/ChangeLog.21 +++ b/lib/3rdparty/freetype/ChangeLog.21 @@ -922,7 +922,7 @@ (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 @@ -1221,7 +1221,7 @@ 2004-11-16 Owen Taylor * 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 @@ -3554,7 +3554,7 @@ - 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, @@ -9423,7 +9423,7 @@ ---------------------------------------------------------------------------- -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, diff --git a/lib/3rdparty/freetype/ChangeLog.22 b/lib/3rdparty/freetype/ChangeLog.22 index 22bf4f91895..4144288a5bf 100644 --- a/lib/3rdparty/freetype/ChangeLog.22 +++ b/lib/3rdparty/freetype/ChangeLog.22 @@ -199,7 +199,7 @@ * 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, @@ -2301,7 +2301,7 @@ 2005-09-19 David Somers - * 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'. @@ -2320,9 +2320,9 @@ 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 @@ -2808,7 +2808,7 @@ . 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 @@ -2821,7 +2821,7 @@ ---------------------------------------------------------------------------- -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, diff --git a/lib/3rdparty/freetype/Jamfile b/lib/3rdparty/freetype/Jamfile index ad1341ed369..d8c1bbada29 100644 --- a/lib/3rdparty/freetype/Jamfile +++ b/lib/3rdparty/freetype/Jamfile @@ -1,6 +1,6 @@ # 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, @@ -194,7 +194,7 @@ rule 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.12 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h } RefDoc refdoc ; diff --git a/lib/3rdparty/freetype/README b/lib/3rdparty/freetype/README index 82d0003374a..282791ef087 100644 --- a/lib/3rdparty/freetype/README +++ b/lib/3rdparty/freetype/README @@ -9,8 +9,8 @@ is called `libttf'. They are *not* compatible! - FreeType 2.3.5 - ============== + FreeType 2.3.12 + =============== Please read the docs/CHANGES file, it contains IMPORTANT INFORMATION. @@ -26,9 +26,9 @@ 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.12.tar.bz2 + freetype-doc-2.3.12.tar.gz + ftdoc2312.zip Bugs @@ -51,7 +51,7 @@ ---------------------------------------------------------------------- -Copyright 2006, 2007 by +Copyright 2006, 2007, 2008, 2009, 2010 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/3rdparty/freetype/README.CVS b/lib/3rdparty/freetype/README.git similarity index 62% rename from lib/3rdparty/freetype/README.CVS rename to lib/3rdparty/freetype/README.git index 63afddfbb52..bb36cf7b303 100644 --- a/lib/3rdparty/freetype/README.CVS +++ b/lib/3rdparty/freetype/README.git @@ -1,50 +1,46 @@ -The CVS archive doesn't contain pre-built configuration scripts for -UNIXish platforms. To generate them say - - sh autogen.sh - -which in turn depends on the following packages: - - automake (1.9.6) - libtool (1.5.22) - autoconf (2.59c) - -The versions given in parentheses are known to work. Newer versions -should work too, of course. Note that autogen.sh also sets up proper -file permissions for the `configure' and auxiliary scripts. - -A very common problem is that this script complains that the `aclocal' -program doesn't accept a `--force' option: - - generating `configure.ac' - running `aclocal -I . --force' - aclocal: unrecognized option -- `--force' - Try `aclocal --help' for more information. - error while running `aclocal -I . --force' - -This means that your version of the automake package is too old. -Please update it before trying to build FreeType. - - -For static builds which don't use platform specific optimizations, no -configure script is necessary at all; saying - - make setup ansi - make - -should work on all platforms which have GNU make (or makepp). - - ----------------------------------------------------------------------- - -Copyright 2005, 2006, 2007 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. - - ---- end of README.CVS --- +The git archive doesn't contain pre-built configuration scripts for +UNIXish platforms. To generate them say + + sh autogen.sh + +which in turn depends on the following packages: + + automake (1.10.1) + libtool (2.2.4) + autoconf (2.62) + +The versions given in parentheses are known to work. Newer versions +should work too, of course. Note that autogen.sh also sets up proper +file permissions for the `configure' and auxiliary scripts. + +The autogen.sh script now checks the version of above three packages +whether they match the numbers above. Otherwise it will complain and +suggest either upgrading or using an environment variable to point to +a more recent version of the required tool(s). + +Note that `aclocal' is provided by the `automake' package on Linux, +and that `libtoolize' is called `glibtoolize' on Darwin (OS X). + + +For static builds which don't use platform specific optimizations, no +configure script is necessary at all; saying + + make setup ansi + make + +should work on all platforms which have GNU make (or makepp). + + +---------------------------------------------------------------------- + +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, 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. + + +--- end of README.CVS --- diff --git a/lib/3rdparty/freetype/autogen.sh b/lib/3rdparty/freetype/autogen.sh index d8fb5b2ec6d..c28a51c1323 100644 --- a/lib/3rdparty/freetype/autogen.sh +++ b/lib/3rdparty/freetype/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2005, 2006, 2007 by +# Copyright 2005, 2006, 2007, 2008, 2009, 2010 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -20,12 +20,121 @@ run () 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 + # assume the output of "[TOOL] --version" is "toolname (GNU toolname foo bar) version" + if test "$field"x = x; then + field=3 # default to 3 for all GNU autotools, after filtering enclosed string + fi + version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | 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 +# 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` @@ -38,17 +147,10 @@ cd builds/unix 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 $LIBTOOLIZE --force --copy +run $LIBTOOLIZE --force --copy --install run autoconf --force chmod +x mkinstalldirs diff --git a/lib/3rdparty/freetype/configure b/lib/3rdparty/freetype/configure index f251ae417a4..2efa2696797 100644 --- a/lib/3rdparty/freetype/configure +++ b/lib/3rdparty/freetype/configure @@ -1,6 +1,6 @@ #!/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, @@ -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 - 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= $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` +# `--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 - 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 @@ -92,9 +105,16 @@ fi # 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 diff --git a/lib/3rdparty/freetype/devel/ftoption.h b/lib/3rdparty/freetype/devel/ftoption.h index 6cf1af23610..9c6c2fe4594 100644 --- a/lib/3rdparty/freetype/devel/ftoption.h +++ b/lib/3rdparty/freetype/devel/ftoption.h @@ -4,7 +4,8 @@ /* */ /* 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, */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -85,9 +86,9 @@ FT_BEGIN_HEADER /* */ /* This macro has no impact on the FreeType API, only on its */ /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ - /* FT_Render_Glyph still generates a bitmap that is 3 times larger than */ - /* the original size; the difference will be that each triplet of */ - /* subpixels has R=G=B. */ + /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ + /* the original size in case this macro isn't defined; however, each */ + /* triplet of subpixels has R=G=B. */ /* */ /* This is done to allow FreeType clients to run unmodified, forcing */ /* them to display normal gray-level anti-aliased glyphs. */ @@ -112,7 +113,28 @@ FT_BEGIN_HEADER /* 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 +185,7 @@ FT_BEGIN_HEADER /* 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 +226,27 @@ FT_BEGIN_HEADER /* 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 */ /* */ - /* 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. */ /* */ - /* 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. */ /* */ - /* - 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 */ @@ -240,12 +262,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 */ - /* 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 */ - /* 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 @@ -291,10 +313,11 @@ FT_BEGIN_HEADER /* */ /* Allow the use of FT_Incremental_Interface to load typefaces that */ /* contain no glyph data, but supply it via a callback function. */ - /* This allows FreeType to be used with the PostScript language, using */ - /* the GhostScript interpreter. */ + /* This is required by clients supporting document formats which */ + /* supply font data incrementally as the document is parsed, such */ + /* as the Ghostscript interpreter for the PostScript language. */ /* */ -/* #define FT_CONFIG_OPTION_INCREMENTAL */ +#define FT_CONFIG_OPTION_INCREMENTAL /*************************************************************************/ @@ -375,6 +398,20 @@ FT_BEGIN_HEADER #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 +455,7 @@ FT_BEGIN_HEADER /* 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 @@ -436,6 +473,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_13 +#define TT_CONFIG_CMAP_FORMAT_14 /*************************************************************************/ @@ -466,9 +505,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 */ - /* 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 */ @@ -624,11 +663,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 - /*************************************************************************/ /* */ /* Compile autofit module with Indic script support. */ @@ -648,15 +687,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. */ -#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 +#undef TT_CONFIG_OPTION_UNPATENTED_HINTING #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING #define TT_USE_BYTECODE_INTERPRETER #endif diff --git a/lib/3rdparty/freetype/freetype.def b/lib/3rdparty/freetype/freetype.def index e6896e69e2b..1f5895f9b92 100644 --- a/lib/3rdparty/freetype/freetype.def +++ b/lib/3rdparty/freetype/freetype.def @@ -40,13 +40,19 @@ EXPORTS 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_CID_From_Glyph_Index + FT_Get_CID_Is_Internally_CID_keyed + FT_Get_CID_Registry_Ordering_Supplement FT_Get_First_Char + FT_Get_FSType_Flags FT_Get_Glyph FT_Get_Glyph_Name FT_Get_Kerning diff --git a/lib/3rdparty/freetype/freetype.rbuild b/lib/3rdparty/freetype/freetype.rbuild index bf7709ede9d..5c41eb1d442 100644 --- a/lib/3rdparty/freetype/freetype.rbuild +++ b/lib/3rdparty/freetype/freetype.rbuild @@ -10,30 +10,28 @@ - - - setjmplongjmp.s - - - ftsystem.c - ftinit.c - ftdebug.c - _ftbase_ros.c + ftbase.c ftbbox.c - ftglyph.c ftbdf.c ftbitmap.c + ftdebug.c + ftgasp.c + ftglyph.c ftgxval.c + ftinit.c + ftlcdfil.c ftmm.c ftotval.c ftpatent.c ftpfr.c ftstroke.c ftsynth.c + ftsystem.c fttype1.c ftwinfnt.c + ftxf86.c autofit.c diff --git a/lib/3rdparty/freetype/i386/setjmplongjmp.s b/lib/3rdparty/freetype/i386/setjmplongjmp.s deleted file mode 100644 index d0e13a5b064..00000000000 --- a/lib/3rdparty/freetype/i386/setjmplongjmp.s +++ /dev/null @@ -1,91 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: FreeType implementation for ReactOS - * PURPOSE: Implementation of _setjmp/longjmp - * FILE: thirdparty/freetype/i386/setjmplongjmp.s - * PROGRAMMER: Ge van Geldorp (ge@gse.nl) - * NOTES: Copied from glibc. - * I have the feeling this could be implemented using the SEH - * routines, but if it's good enough for glibc it's propably - * good enough for me... - * The MingW headers define jmp_buf to be an array of 16 ints, - * based on the jmp_buf used by MSCVRT. We're using only 6 of - * them, so plenty of space. - */ - -#define JB_BX 0 -#define JB_SI 1 -#define JB_DI 2 -#define JB_BP 3 -#define JB_SP 4 -#define JB_PC 5 - -#define PCOFF 0 - -#define JMPBUF 4 - -/* - * int - * _setjmp(jmp_buf env); - * - * Parameters: - * [ESP+04h] - jmp_buf env - * Registers: - * None - * Returns: - * 0 - * Notes: - * Sets up the jmp_buf - */ -.globl __setjmp -__setjmp: - xorl %eax, %eax - movl JMPBUF(%esp), %edx - - /* Save registers. */ - movl %ebx, (JB_BX*4)(%edx) - movl %esi, (JB_SI*4)(%edx) - movl %edi, (JB_DI*4)(%edx) - leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, (JB_SP*4)(%edx) - movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, (JB_PC*4)(%edx) - movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */ - ret - -#define VAL 8 - -/* - * void - * longjmp(jmp_buf env, int value); - * - * Parameters: - * [ESP+04h] - jmp_buf setup by _setjmp - * [ESP+08h] - int value to return - * Registers: - * None - * Returns: - * Doesn't return - * Notes: - * Non-local goto - */ -.globl _longjmp -_longjmp: - movl JMPBUF(%esp), %ecx /* User's jmp_buf in %ecx. */ - - movl VAL(%esp), %eax /* Second argument is return value. */ - testl %eax, %eax - jnz 0f - incl %eax -0: - /* Save the return address now. */ - movl (JB_PC*4)(%ecx), %edx - /* Restore registers. */ - movl (JB_BX*4)(%ecx), %ebx - movl (JB_SI*4)(%ecx), %esi - movl (JB_DI*4)(%ecx), %edi - movl (JB_BP*4)(%ecx), %ebp - movl (JB_SP*4)(%ecx), %esp - /* Jump to saved PC. */ - jmp *%edx diff --git a/lib/3rdparty/freetype/include/freetype/config/ftconfig.h b/lib/3rdparty/freetype/include/freetype/config/ftconfig.h index 1547f5adb14..43d587e02b9 100644 --- a/lib/3rdparty/freetype/include/freetype/config/ftconfig.h +++ b/lib/3rdparty/freetype/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* ANSI-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -35,7 +35,6 @@ /* */ /*************************************************************************/ - #ifndef __FTCONFIG_H__ #define __FTCONFIG_H__ @@ -43,6 +42,7 @@ #include FT_CONFIG_OPTIONS_H #include FT_CONFIG_STANDARD_LIBRARY_H + FT_BEGIN_HEADER @@ -134,18 +134,78 @@ FT_BEGIN_HEADER #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 /*************************************************************************/ /* */ - /* IntN types */ + /*
*/ + /* basic_types */ /* */ - /* Used to guarantee the size of some specific integers. */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Int16 */ + /* */ + /* */ + /* A typedef for a 16bit signed integer type. */ + /* */ + typedef signed short FT_Int16; + + + /*************************************************************************/ + /* */ + /* */ + /* FT_UInt16 */ + /* */ + /* */ + /* A typedef for a 16bit unsigned integer type. */ /* */ - typedef signed short FT_Int16; typedef unsigned short FT_UInt16; + /* */ + + + /* this #if 0 ... #endif clause is for documentation purposes */ +#if 0 + + /*************************************************************************/ + /* */ + /* */ + /* FT_Int32 */ + /* */ + /* */ + /* A typedef for a 32bit signed integer type. The size depends on */ + /* the configuration. */ + /* */ + typedef signed XXX FT_Int32; + + + /*************************************************************************/ + /* */ + /* */ + /* 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; @@ -160,6 +220,7 @@ FT_BEGIN_HEADER #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) @@ -215,17 +276,12 @@ FT_BEGIN_HEADER #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 */ - /* 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 ) @@ -240,6 +296,115 @@ FT_BEGIN_HEADER #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. */ + +#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ +#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 + { + smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ + mov a, t, asr #31 /* a = (hi >> 31) */ + add a, a, #0x8000 /* a += 0x8000 */ + adds t2, t2, a /* t2 += a */ + adc t, t, #0 /* t += carry */ + mov a, t2, lsr #16 /* a = t2 >> 16 */ + orr a, a, t, lsl #16 /* a |= t << 16 */ + } + return a; + } + +#endif /* __CC_ARM || __ARMCC__ */ + + +#ifdef __GNUC__ + +#if defined( __arm__ ) && !defined( __thumb__ ) && \ + !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) +#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__ && !( __CC_ARM || __ARMCC__ ) */ + +#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 diff --git a/lib/3rdparty/freetype/include/freetype/config/ftheader.h b/lib/3rdparty/freetype/include/freetype/config/ftheader.h index b957d05bedd..b63945dcbd3 100644 --- a/lib/3rdparty/freetype/include/freetype/config/ftheader.h +++ b/lib/3rdparty/freetype/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -74,7 +74,7 @@ /* */ /* */ /* 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: */ /* */ /* { */ @@ -85,11 +85,11 @@ /* */ /* 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 */ - /* way FreeType 2 is installed on a given system. */ + /* way FreeType~2 is installed on a given system. */ /* */ /*************************************************************************/ @@ -103,7 +103,7 @@ * * @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 @@ -118,7 +118,7 @@ * * @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 @@ -133,7 +133,7 @@ * * @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 @@ -148,7 +148,7 @@ * * @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. * */ @@ -156,6 +156,7 @@ #define FT_CONFIG_MODULES_H #endif + /* */ /* public headers */ @@ -166,7 +167,7 @@ * * @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 @@ -179,7 +180,7 @@ * * @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. * @@ -194,7 +195,7 @@ * * @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 @@ -207,7 +208,7 @@ * * @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. @@ -239,7 +240,7 @@ * * @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. * @@ -254,7 +255,7 @@ * * @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.) * @@ -269,7 +270,7 @@ * * @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 @@ -295,7 +296,7 @@ * * @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 @@ -308,7 +309,7 @@ * * @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 @@ -321,7 +322,7 @@ * * @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 @@ -383,6 +384,20 @@ #define FT_BDF_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 + + /************************************************************************* * * @macro: @@ -468,7 +483,7 @@ * * @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 @@ -481,7 +496,7 @@ * * @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 @@ -501,7 +516,7 @@ * * @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 @@ -522,7 +537,7 @@ * * @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. @@ -538,7 +553,7 @@ * * @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 @@ -555,7 +570,7 @@ * * @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 @@ -568,7 +583,7 @@ * * @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). * */ @@ -582,7 +597,7 @@ * * @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). * */ @@ -596,7 +611,7 @@ * * @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). * */ @@ -610,7 +625,7 @@ * * @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 @@ -623,7 +638,7 @@ * * @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 @@ -635,7 +650,7 @@ * * @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 @@ -647,7 +662,7 @@ * * @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 @@ -660,7 +675,7 @@ * * @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 @@ -673,11 +688,35 @@ * * @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 + /************************************************************************* + * + * @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 + + + /************************************************************************* + * + * @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 + + /************************************************************************* * * @macro: @@ -685,11 +724,23 @@ * * @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 + /************************************************************************* + * + * @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 + + /* */ #define FT_ERROR_DEFINITIONS_H diff --git a/lib/3rdparty/freetype/include/freetype/config/ftmodule.h b/lib/3rdparty/freetype/include/freetype/config/ftmodule.h index d92b0ee6a1a..76d271a74b9 100644 --- a/lib/3rdparty/freetype/include/freetype/config/ftmodule.h +++ b/lib/3rdparty/freetype/include/freetype/config/ftmodule.h @@ -10,23 +10,23 @@ * */ -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 */ diff --git a/lib/3rdparty/freetype/include/freetype/config/ftoption.h b/lib/3rdparty/freetype/include/freetype/config/ftoption.h index 5d99ae3c3c2..443c0d8bf4d 100644 --- a/lib/3rdparty/freetype/include/freetype/config/ftoption.h +++ b/lib/3rdparty/freetype/include/freetype/config/ftoption.h @@ -4,7 +4,8 @@ /* */ /* 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, */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -85,9 +86,9 @@ FT_BEGIN_HEADER /* */ /* This macro has no impact on the FreeType API, only on its */ /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ - /* FT_Render_Glyph still generates a bitmap that is 3 times larger than */ - /* the original size; the difference will be that each triplet of */ - /* subpixels has R=G=B. */ + /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ + /* the original size in case this macro isn't defined; however, each */ + /* triplet of subpixels has R=G=B. */ /* */ /* This is done to allow FreeType clients to run unmodified, forcing */ /* them to display normal gray-level anti-aliased glyphs. */ @@ -112,7 +113,28 @@ FT_BEGIN_HEADER /* 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 +185,7 @@ FT_BEGIN_HEADER /* 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 +226,27 @@ FT_BEGIN_HEADER /* 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 */ /* */ - /* 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. */ /* */ - /* 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. */ /* */ - /* - 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 */ @@ -240,12 +262,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 */ - /* 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 */ - /* 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 @@ -291,8 +313,9 @@ FT_BEGIN_HEADER /* */ /* Allow the use of FT_Incremental_Interface to load typefaces that */ /* contain no glyph data, but supply it via a callback function. */ - /* This allows FreeType to be used with the PostScript language, using */ - /* the GhostScript interpreter. */ + /* This is required by clients supporting document formats which */ + /* supply font data incrementally as the document is parsed, such */ + /* as the Ghostscript interpreter for the PostScript language. */ /* */ /* #define FT_CONFIG_OPTION_INCREMENTAL */ @@ -375,6 +398,20 @@ FT_BEGIN_HEADER #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 +455,7 @@ FT_BEGIN_HEADER /* 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 @@ -436,6 +473,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_13 +#define TT_CONFIG_CMAP_FORMAT_14 /*************************************************************************/ @@ -466,9 +505,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 */ - /* 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 */ @@ -505,7 +544,7 @@ FT_BEGIN_HEADER /* ... */ /* } */ /* */ -/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ +//#define TT_CONFIG_OPTION_UNPATENTED_HINTING /*************************************************************************/ @@ -624,7 +663,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 @@ -632,7 +672,7 @@ FT_BEGIN_HEADER /* */ /* Compile autofit module with Indic script support. */ /* */ -/* #define AF_CONFIG_OPTION_INDIC */ +#define AF_CONFIG_OPTION_INDIC /* */ @@ -651,11 +691,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 +#undef TT_CONFIG_OPTION_UNPATENTED_HINTING #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING #define TT_USE_BYTECODE_INTERPRETER #endif diff --git a/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h b/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h index f923f3e4cf8..30ec14e74ef 100644 --- a/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h +++ b/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h @@ -5,7 +5,7 @@ /* 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, */ @@ -54,12 +54,6 @@ /* 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_INT_MIN INT_MIN #define FT_UINT_MAX UINT_MAX #define FT_ULONG_MAX ULONG_MAX @@ -124,8 +119,6 @@ #define ft_qsort qsort -#define ft_exit exit /* only used to exit from unhandled exceptions */ - /**********************************************************************/ /* */ diff --git a/lib/3rdparty/freetype/include/freetype/freetype.h b/lib/3rdparty/freetype/include/freetype/freetype.h index dbca087e5f0..942a740f00a 100644 --- a/lib/3rdparty/freetype/include/freetype/freetype.h +++ b/lib/3rdparty/freetype/include/freetype/freetype.h @@ -4,7 +4,8 @@ /* */ /* 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, */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,14 +26,6 @@ #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__ @@ -60,8 +53,8 @@ FT_BEGIN_HEADER /* */ /* */ /* 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. */ /* */ /*************************************************************************/ @@ -86,10 +79,10 @@ FT_BEGIN_HEADER /* Base Interface */ /* */ /* */ - /* The FreeType 2 base font interface. */ + /* The FreeType~2 base font interface. */ /* */ /* */ - /* This section describes the public high-level API of FreeType 2. */ + /* This section describes the public high-level API of FreeType~2. */ /* */ /* */ /* FT_Library */ @@ -191,6 +184,15 @@ FT_BEGIN_HEADER /* 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 */ + /* */ /*************************************************************************/ @@ -230,6 +232,10 @@ FT_BEGIN_HEADER /* vertAdvance :: */ /* Advance height for vertical layout. */ /* */ + /* */ + /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ + /* dimensions of the hinted glyph (in case hinting is applicable). */ + /* */ typedef struct FT_Glyph_Metrics_ { FT_Pos width; @@ -386,8 +392,8 @@ FT_BEGIN_HEADER /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ /* */ /* */ - /* 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; @@ -416,8 +422,8 @@ FT_BEGIN_HEADER /* activated at any given time per face. */ /* */ /* */ - /* 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; @@ -429,7 +435,7 @@ FT_BEGIN_HEADER /* */ /* */ /* 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 */ @@ -438,7 +444,7 @@ FT_BEGIN_HEADER /* other control information. */ /* */ /* */ - /* @FT_GlyphSlotRec details the publicly accessible glyph fields. */ + /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */ /* */ typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; @@ -469,8 +475,8 @@ FT_BEGIN_HEADER /* the list and automatically activates it. */ /* */ /* */ - /* 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; @@ -485,7 +491,7 @@ FT_BEGIN_HEADER /* used to define `encoding' identifiers (see @FT_Encoding). */ /* */ /* */ - /* 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: */ /* */ @@ -518,131 +524,132 @@ FT_BEGIN_HEADER /* */ /* 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. */ /* */ /* */ - /* 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. */ /* */ /* */ - /* 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_ { @@ -753,7 +760,7 @@ FT_BEGIN_HEADER /* 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; @@ -774,7 +781,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -790,6 +797,9 @@ FT_BEGIN_HEADER /* `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 */ @@ -799,6 +809,8 @@ FT_BEGIN_HEADER /* 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 */ @@ -836,9 +848,13 @@ FT_BEGIN_HEADER /* 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 */ - /* 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, */ @@ -874,7 +890,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -889,8 +905,8 @@ FT_BEGIN_HEADER /* charmap :: The current active charmap for this face. */ /* */ /* */ - /* 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_ { @@ -1019,6 +1035,36 @@ FT_BEGIN_HEADER /* 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 ) @@ -1031,8 +1077,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_CID_KEYED ( 1L << 12 ) +#define FT_FACE_FLAG_TRICKY ( 1L << 13 ) /************************************************************************* @@ -1087,7 +1133,7 @@ FT_BEGIN_HEADER * * @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. * */ @@ -1143,8 +1189,6 @@ FT_BEGIN_HEADER #define FT_HAS_FIXED_SIZES( face ) \ ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) - /* */ - /************************************************************************* * @@ -1187,9 +1231,41 @@ FT_BEGIN_HEADER ( 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 ) + + /*************************************************************************/ /* */ - /* */ + /* */ /* FT_STYLE_FLAG_XXX */ /* */ /* */ @@ -1198,11 +1274,17 @@ FT_BEGIN_HEADER /* */ /* */ /* 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. */ /* */ + /* */ + /* 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 ) @@ -1214,7 +1296,7 @@ FT_BEGIN_HEADER /* */ /* */ /* 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; @@ -1345,7 +1427,7 @@ FT_BEGIN_HEADER /* */ /* */ /* 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; @@ -1400,8 +1482,13 @@ FT_BEGIN_HEADER /* important to perform correct WYSIWYG layout. */ /* Only relevant for outline glyphs. */ /* */ - /* advance :: This is the transformed advance width for the */ - /* glyph. */ + /* advance :: This shorthand is, depending on */ + /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */ + /* advance width for the glyph (in 26.6 */ + /* fractional pixel format). As specified with */ + /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */ + /* `horiAdvance' or the `vertAdvance' value of */ + /* `metrics' field. */ /* */ /* format :: This field indicates the format of the image */ /* contained in the glyph slot. Typically */ @@ -1425,7 +1512,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 */ - /* glyph scanline, upwards y-coordinates being */ + /* glyph scanline, upwards y~coordinates being */ /* *positive*. */ /* */ /* outline :: The outline descriptor for the current glyph */ @@ -1448,7 +1535,7 @@ FT_BEGIN_HEADER /* */ /* 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 */ @@ -1470,15 +1557,15 @@ FT_BEGIN_HEADER /* */ /* 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 */ - /* 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 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 */ @@ -1573,7 +1660,12 @@ FT_BEGIN_HEADER /* alibrary :: A handle to a new library object. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ + /* */ + /* */ + /* 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 ); @@ -1592,7 +1684,7 @@ FT_BEGIN_HEADER /* library :: A handle to the target library object. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Done_FreeType( FT_Library library ); @@ -1608,26 +1700,26 @@ FT_BEGIN_HEADER /* @FT_Open_Args structure. */ /* */ /* */ - /* 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. */ /* */ /* */ /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ @@ -1652,8 +1744,8 @@ FT_BEGIN_HEADER /* FT_Parameter */ /* */ /* */ - /* 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. */ /* */ /* */ /* tag :: A four-byte identification tag. */ @@ -1661,7 +1753,8 @@ FT_BEGIN_HEADER /* data :: A pointer to the parameter data. */ /* */ /* */ - /* The ID and function of parameters are driver-specific. */ + /* The ID and function of parameters are driver-specific. See the */ + /* various FT_PARAM_TAG_XXX flags for more information. */ /* */ typedef struct FT_Parameter_ { @@ -1695,7 +1788,7 @@ FT_BEGIN_HEADER /* */ /* 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. */ @@ -1726,7 +1819,7 @@ FT_BEGIN_HEADER /* `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_ @@ -1758,7 +1851,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ /* */ /* aface :: A handle to a new face object. If `face_index' is */ @@ -1766,7 +1859,7 @@ FT_BEGIN_HEADER /* See @FT_Open_Face for more details. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_New_Face( FT_Library library, @@ -1793,7 +1886,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 */ - /* face has index 0. */ + /* face has index~0. */ /* */ /* */ /* aface :: A handle to a new face object. If `face_index' is */ @@ -1801,7 +1894,7 @@ FT_BEGIN_HEADER /* See @FT_Open_Face for more details. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* You must not deallocate the memory before calling @FT_Done_Face. */ @@ -1831,7 +1924,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ /* */ /* aface :: A handle to a new face object. If `face_index' is */ @@ -1839,7 +1932,7 @@ FT_BEGIN_HEADER /* See note below. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* Unlike FreeType 1.x, this function automatically creates a glyph */ @@ -1848,7 +1941,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 */ - /* `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 */ @@ -1881,7 +1974,7 @@ FT_BEGIN_HEADER /* filepathname :: The pathname. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Attach_File( FT_Face face, @@ -1896,7 +1989,7 @@ FT_BEGIN_HEADER /* */ /* `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. */ /* */ /* */ @@ -1907,7 +2000,7 @@ FT_BEGIN_HEADER /* the caller. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* The meaning of the `attach' (i.e., what really happens when the */ @@ -1936,7 +2029,7 @@ FT_BEGIN_HEADER /* face :: A handle to a target face object. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Done_Face( FT_Face face ); @@ -1958,7 +2051,7 @@ FT_BEGIN_HEADER /* `available_sizes' field of @FT_FaceRec structure. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Select_Size( FT_Face face, @@ -2044,8 +2137,8 @@ FT_BEGIN_HEADER /* value. */ /* */ /* */ - /* 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_ { @@ -2055,7 +2148,18 @@ FT_BEGIN_HEADER FT_UInt horiResolution; FT_UInt vertResolution; - } FT_Size_RequestRec, *FT_Size_Request; + } FT_Size_RequestRec; + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Size_Request */ + /* */ + /* */ + /* A handle to a size request structure. */ + /* */ + typedef struct FT_Size_RequestRec_ *FT_Size_Request; /*************************************************************************/ @@ -2073,7 +2177,7 @@ FT_BEGIN_HEADER /* req :: A pointer to a @FT_Size_RequestRec. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* Although drivers may select the bitmap strike matching the */ @@ -2108,7 +2212,7 @@ FT_BEGIN_HEADER /* vert_resolution :: The vertical resolution in dpi. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* If either the character width or height is zero, it is set equal */ @@ -2120,7 +2224,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. */ /* */ - + /* 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, @@ -2147,7 +2252,7 @@ FT_BEGIN_HEADER /* pixel_height :: The nominal height, in pixels. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Pixel_Sizes( FT_Face face, @@ -2180,12 +2285,17 @@ FT_BEGIN_HEADER /* whether to hint the outline, etc). */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* 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, @@ -2216,7 +2326,7 @@ FT_BEGIN_HEADER /* whether to hint the outline, etc). */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */ @@ -2238,7 +2348,7 @@ FT_BEGIN_HEADER * * @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 @@ -2328,10 +2438,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 - * 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 - * 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 :: @@ -2350,8 +2460,12 @@ FT_BEGIN_HEADER * @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. + * */ #define FT_LOAD_DEFAULT 0x0 #define FT_LOAD_NO_SCALE 0x1 @@ -2367,13 +2481,14 @@ FT_BEGIN_HEADER #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 /* */ + /* used internally only by certain font drivers! */ +#define FT_LOAD_ADVANCE_ONLY 0x100 +#define FT_LOAD_SBITS_ONLY 0x4000 + /************************************************************************** * @@ -2401,7 +2516,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 - * 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. * @@ -2437,30 +2552,29 @@ FT_BEGIN_HEADER * * 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. + * */ - #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) - /* */ - /*************************************************************************/ /* */ @@ -2476,9 +2590,9 @@ FT_BEGIN_HEADER /* face :: A handle to the source face object. */ /* */ /* */ - /* 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. */ - /* 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. */ /* */ /* */ @@ -2503,17 +2617,19 @@ FT_BEGIN_HEADER /* */ /* */ /* 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. */ /* */ - /* 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. */ /* */ /* */ /* 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 */ @@ -2522,24 +2638,32 @@ FT_BEGIN_HEADER /* @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 */ - /* 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 */ - /* 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. */ /* */ /* */ - /* 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_ { @@ -2564,8 +2688,8 @@ FT_BEGIN_HEADER /* @FT_Render_Mode values instead. */ /* */ /* */ - /* 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 @@ -2591,7 +2715,7 @@ FT_BEGIN_HEADER /* list of possible values. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Render_Glyph( FT_GlyphSlot slot, @@ -2609,7 +2733,7 @@ FT_BEGIN_HEADER /* */ /* */ /* 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. */ @@ -2687,7 +2811,7 @@ FT_BEGIN_HEADER /* and in pixels for fixed-sizes formats. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* Only horizontal layouts (left-to-right & right-to-left) are */ @@ -2712,17 +2836,17 @@ FT_BEGIN_HEADER /* Return the track kerning for a given face object at a given size. */ /* */ /* */ - /* 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. */ /* */ /* */ - /* akerning :: The kerning in 16.16 fractional points. */ + /* akerning :: The kerning in 16.16 fractional points. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Track_Kerning( FT_Face face, @@ -2738,7 +2862,7 @@ FT_BEGIN_HEADER /* */ /* */ /* 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. */ /* */ /* */ /* face :: A handle to a source face object. */ @@ -2753,12 +2877,12 @@ FT_BEGIN_HEADER /* copied to. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* 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. */ @@ -2780,14 +2904,14 @@ FT_BEGIN_HEADER /* FT_Get_Postscript_Name */ /* */ /* */ - /* 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. */ /* */ /* */ /* face :: A handle to the source face object. */ /* */ /* */ - /* A pointer to the face's Postscript name. NULL if unavailable. */ + /* A pointer to the face's PostScript name. NULL if unavailable. */ /* */ /* */ /* The returned pointer is owned by the face and is destroyed with */ @@ -2813,7 +2937,7 @@ FT_BEGIN_HEADER /* encoding :: A handle to the selected encoding. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* This function returns an error if no charmap in the face */ @@ -2821,7 +2945,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 */ - /* 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 ) @@ -2844,13 +2969,15 @@ FT_BEGIN_HEADER /* charmap :: A handle to the selected charmap. */ /* */ /* */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* */ /* 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 ); @@ -2892,13 +3019,13 @@ FT_BEGIN_HEADER /* charcode :: The character code. */ /* */ /* */ - /* The glyph index. 0 means `undefined character code'. */ + /* The glyph index. 0~means `undefined character code'. */ /* */ /* */ /* 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 ) @@ -2920,7 +3047,7 @@ FT_BEGIN_HEADER /* face :: A handle to the source face object. */ /* */ /* */ - /* agindex :: Glyph index of first character code. 0 if charmap is */ + /* agindex :: Glyph index of first character code. 0~if charmap is */ /* empty. */ /* */ /* */ @@ -2945,9 +3072,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, @@ -2969,7 +3096,7 @@ FT_BEGIN_HEADER /* char_code :: The starting character code. */ /* */ /* */ - /* agindex :: Glyph index of first character code. 0 if charmap */ + /* agindex :: Glyph index of next character code. 0~if charmap */ /* is empty. */ /* */ /* */ @@ -2980,7 +3107,7 @@ FT_BEGIN_HEADER /* 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 ) @@ -3004,7 +3131,7 @@ FT_BEGIN_HEADER /* glyph_name :: The glyph name. */ /* */ /* */ - /* 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, @@ -3046,15 +3173,16 @@ FT_BEGIN_HEADER * * @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 :: - * 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 :: @@ -3073,7 +3201,7 @@ FT_BEGIN_HEADER * 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 @@ -3091,6 +3219,305 @@ FT_BEGIN_HEADER FT_Matrix *p_transform ); + /*************************************************************************/ + /* */ + /* */ + /* FT_FSTYPE_XXX */ + /* */ + /* */ + /* 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. */ + /* */ + /* */ + /* 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. */ + /* */ + /* */ + /* 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 + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Get_FSType_Flags */ + /* */ + /* */ + /* Return the fsType flags for a font. */ + /* */ + /* */ + /* face :: A handle to the source face object. */ + /* */ + /* */ + /* The fsType flags, @FT_FSTYPE_XXX. */ + /* */ + /* */ + /* 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 ); + + + /*************************************************************************/ + /* */ + /*
*/ + /* glyph_variants */ + /* */ + /* */ + /* 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> */ @@ -3149,6 +3576,12 @@ FT_BEGIN_HEADER FT_Long c ); + /* */ + + /* The following #if 0 ... #endif is for the documentation formatter, */ + /* hiding the internal `FT_MULFIX_INLINED' macro. */ + +#if 0 /*************************************************************************/ /* */ /* <Function> */ @@ -3182,6 +3615,17 @@ FT_BEGIN_HEADER 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 +3646,8 @@ FT_BEGIN_HEADER /* 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 ) @@ -3310,26 +3754,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_PATCH 5 +#define FREETYPE_PATCH 12 /*************************************************************************/ @@ -3386,8 +3831,8 @@ FT_BEGIN_HEADER /* 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 */ @@ -3413,7 +3858,7 @@ FT_BEGIN_HEADER /* */ /* <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> */ diff --git a/lib/3rdparty/freetype/include/freetype/ftadvanc.h b/lib/3rdparty/freetype/include/freetype/ftadvanc.h new file mode 100644 index 00000000000..b2451bec426 --- /dev/null +++ b/lib/3rdparty/freetype/include/freetype/ftadvanc.h @@ -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 */ diff --git a/lib/3rdparty/freetype/include/freetype/ftbbox.h b/lib/3rdparty/freetype/include/freetype/ftbbox.h index 5f79c327405..01fe3fb0d10 100644 --- a/lib/3rdparty/freetype/include/freetype/ftbbox.h +++ b/lib/3rdparty/freetype/include/freetype/ftbbox.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -58,10 +58,10 @@ FT_BEGIN_HEADER /* 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 */ - /* 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> */ @@ -71,7 +71,7 @@ FT_BEGIN_HEADER /* 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, diff --git a/lib/3rdparty/freetype/include/freetype/ftbdf.h b/lib/3rdparty/freetype/include/freetype/ftbdf.h index 9555694811e..4f8baf84017 100644 --- a/lib/3rdparty/freetype/include/freetype/ftbdf.h +++ b/lib/3rdparty/freetype/include/freetype/ftbdf.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -38,38 +38,39 @@ FT_BEGIN_HEADER /* bdf_fonts */ /* */ /* <Title> */ - /* BDF Files */ + /* BDF and PCF Files */ /* */ /* <Abstract> */ - /* BDF specific API. */ + /* BDF and PCF specific API. */ /* */ /* <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, @@ -80,15 +81,15 @@ FT_BEGIN_HEADER } 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; @@ -132,7 +133,7 @@ FT_BEGIN_HEADER * 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: @@ -141,13 +142,13 @@ FT_BEGIN_HEADER * * @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 :: - * Charset registry, as a C string, owned by the face. + * Charset registry, as a C~string, owned by the face. * * @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. @@ -164,7 +165,7 @@ FT_BEGIN_HEADER * 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. @@ -175,13 +176,21 @@ FT_BEGIN_HEADER * 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. * + * 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. */ diff --git a/lib/3rdparty/freetype/include/freetype/ftbitmap.h b/lib/3rdparty/freetype/include/freetype/ftbitmap.h index 337d888eaf2..92742369baa 100644 --- a/lib/3rdparty/freetype/include/freetype/ftbitmap.h +++ b/lib/3rdparty/freetype/include/freetype/ftbitmap.h @@ -2,10 +2,9 @@ /* */ /* 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, */ @@ -72,7 +71,7 @@ FT_BEGIN_HEADER /* FT_Bitmap_Copy */ /* */ /* <Description> */ - /* Copies an bitmap into another one. */ + /* Copy a bitmap into another one. */ /* */ /* <Input> */ /* library :: A handle to a library object. */ @@ -83,7 +82,7 @@ FT_BEGIN_HEADER /* 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, @@ -114,14 +113,14 @@ FT_BEGIN_HEADER /* 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 */ - /* 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, */ - /* 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, @@ -152,7 +151,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -170,6 +169,28 @@ FT_BEGIN_HEADER 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> */ @@ -184,7 +205,7 @@ FT_BEGIN_HEADER /* 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 */ diff --git a/lib/3rdparty/freetype/include/freetype/ftcache.h b/lib/3rdparty/freetype/include/freetype/ftcache.h index 721aa16f32b..0916d70a37e 100644 --- a/lib/3rdparty/freetype/include/freetype/ftcache.h +++ b/lib/3rdparty/freetype/include/freetype/ftcache.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -36,10 +36,10 @@ FT_BEGIN_HEADER * 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> - * 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. @@ -165,7 +165,7 @@ FT_BEGIN_HEADER * 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> - * 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 @@ -260,7 +260,7 @@ FT_BEGIN_HEADER /* */ /* <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., */ @@ -279,19 +279,19 @@ FT_BEGIN_HEADER /* 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 */ - /* 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 */ - /* 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. */ - /* 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 */ @@ -301,11 +301,11 @@ FT_BEGIN_HEADER /* 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FTC_Manager_New( FT_Library library, @@ -323,7 +323,7 @@ FT_BEGIN_HEADER /* 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> */ @@ -339,7 +339,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -354,7 +354,7 @@ FT_BEGIN_HEADER /* 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> */ @@ -366,7 +366,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -415,10 +415,10 @@ FT_BEGIN_HEADER /* 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. */ /* */ - /* 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> */ @@ -434,7 +434,18 @@ FT_BEGIN_HEADER 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> */ - /* 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 */ @@ -569,7 +580,7 @@ FT_BEGIN_HEADER * 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 @@ -598,13 +609,14 @@ FT_BEGIN_HEADER * 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: - * Glyph index. 0 means `no glyph'. + * Glyph index. 0~means `no glyph'. * */ FT_EXPORT( FT_UInt ) @@ -710,7 +722,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -719,7 +731,7 @@ FT_BEGIN_HEADER /* 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, @@ -732,7 +744,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -742,7 +754,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -750,7 +762,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -795,7 +807,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -803,7 +815,7 @@ FT_BEGIN_HEADER /* (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. */ @@ -821,6 +833,9 @@ FT_BEGIN_HEADER /* 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, @@ -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 */ - /* Y coordinates. */ + /* y~coordinates. */ /* */ /* 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. */ @@ -915,7 +930,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -924,7 +939,7 @@ FT_BEGIN_HEADER /* 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, @@ -937,7 +952,7 @@ FT_BEGIN_HEADER /* 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> */ @@ -955,7 +970,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -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. */ /* */ - /* 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 */ @@ -1010,7 +1025,7 @@ FT_BEGIN_HEADER /* (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 */ @@ -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. */ /* */ - /* 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 */ diff --git a/lib/3rdparty/freetype/include/freetype/ftchapters.h b/lib/3rdparty/freetype/include/freetype/ftchapters.h index bd812c8e65e..7775a6bb00a 100644 --- a/lib/3rdparty/freetype/include/freetype/ftchapters.h +++ b/lib/3rdparty/freetype/include/freetype/ftchapters.h @@ -32,6 +32,7 @@ /* version */ /* basic_types */ /* base_interface */ +/* glyph_variants */ /* glyph_management */ /* mac_specific */ /* sizes_management */ @@ -54,6 +55,7 @@ /* type1_tables */ /* sfnt_names */ /* bdf_fonts */ +/* cid_fonts */ /* pfr_fonts */ /* winfnt_fonts */ /* font_formats */ @@ -88,6 +90,7 @@ /* computations */ /* list_processing */ /* outline_processing */ +/* quick_advance */ /* bitmap_handling */ /* raster */ /* glyph_stroker */ diff --git a/lib/3rdparty/freetype/include/freetype/ftcid.h b/lib/3rdparty/freetype/include/freetype/ftcid.h new file mode 100644 index 00000000000..203a30caf85 --- /dev/null +++ b/lib/3rdparty/freetype/include/freetype/ftcid.h @@ -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 */ diff --git a/lib/3rdparty/freetype/include/freetype/ftgasp.h b/lib/3rdparty/freetype/include/freetype/ftgasp.h index 97cd3301457..91a769e520f 100644 --- a/lib/3rdparty/freetype/include/freetype/ftgasp.h +++ b/lib/3rdparty/freetype/include/freetype/ftgasp.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -22,6 +22,13 @@ #include <ft2build.h> #include FT_FREETYPE_H +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + /*************************************************************************** * * @section: @@ -31,11 +38,11 @@ * 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 - * 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. */ @@ -95,7 +102,7 @@ * 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: diff --git a/lib/3rdparty/freetype/include/freetype/ftglyph.h b/lib/3rdparty/freetype/include/freetype/ftglyph.h index 08058dadd13..0b8f0c04444 100644 --- a/lib/3rdparty/freetype/include/freetype/ftglyph.h +++ b/lib/3rdparty/freetype/include/freetype/ftglyph.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -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 */ - /* bitmap. This distance is positive for upwards-y! */ + /* bitmap. This distance is positive for upwards~y! */ /* */ /* bitmap :: A descriptor for the bitmap. */ /* */ @@ -194,7 +194,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -219,7 +219,8 @@ FT_BEGIN_HEADER /* 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. */ @@ -228,7 +229,7 @@ FT_BEGIN_HEADER /* 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, @@ -248,11 +249,11 @@ FT_BEGIN_HEADER /* 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Glyph_Copy( FT_Glyph source, @@ -265,7 +266,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -375,7 +376,7 @@ FT_BEGIN_HEADER /* 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' */ @@ -421,17 +422,17 @@ FT_BEGIN_HEADER /* 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> */ - /* 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 */ - /* 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. */ /* */ @@ -440,15 +441,17 @@ FT_BEGIN_HEADER /* never destroyed in case of error. */ /* */ /* <Return> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* <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 */ - /* 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 ); */ /* */ - /* // 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, */ + /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */ /* 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, @@ -497,7 +535,7 @@ FT_BEGIN_HEADER /* FT_Done_Glyph */ /* */ /* <Description> */ - /* Destroys a given glyph. */ + /* Destroy a given glyph. */ /* */ /* <Input> */ /* glyph :: A handle to the target glyph object. */ @@ -524,7 +562,7 @@ FT_BEGIN_HEADER /* 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'. */ @@ -537,7 +575,7 @@ FT_BEGIN_HEADER /* */ 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> */ - /* 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Matrix_Invert( FT_Matrix* matrix ); diff --git a/lib/3rdparty/freetype/include/freetype/ftgxval.h b/lib/3rdparty/freetype/include/freetype/ftgxval.h index c7ea861a0da..497015c1011 100644 --- a/lib/3rdparty/freetype/include/freetype/ftgxval.h +++ b/lib/3rdparty/freetype/include/freetype/ftgxval.h @@ -202,7 +202,7 @@ FT_BEGIN_HEADER * 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 @@ -285,14 +285,14 @@ FT_BEGIN_HEADER * 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 - * 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 :: @@ -307,7 +307,7 @@ FT_BEGIN_HEADER * 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 diff --git a/lib/3rdparty/freetype/include/freetype/ftgzip.h b/lib/3rdparty/freetype/include/freetype/ftgzip.h index 9893437bfa7..acbc4f0327b 100644 --- a/lib/3rdparty/freetype/include/freetype/ftgzip.h +++ b/lib/3rdparty/freetype/include/freetype/ftgzip.h @@ -66,7 +66,7 @@ FT_BEGIN_HEADER * 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. diff --git a/lib/3rdparty/freetype/include/freetype/ftimage.h b/lib/3rdparty/freetype/include/freetype/ftimage.h index 1c428f117db..0272e92d2b3 100644 --- a/lib/3rdparty/freetype/include/freetype/ftimage.h +++ b/lib/3rdparty/freetype/include/freetype/ftimage.h @@ -5,7 +5,8 @@ /* 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, */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,7 +29,7 @@ #define __FTIMAGE_H__ -/* _STANDALONE_ is from ftgrays.c */ + /* _STANDALONE_ is from ftgrays.c */ #ifndef _STANDALONE_ #include <ft2build.h> #endif @@ -51,10 +52,9 @@ FT_BEGIN_HEADER /* FT_Pos */ /* */ /* <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 */ - /* pixel coordinates. */ + /* The type FT_Pos is 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 pixel coordinates. */ /* */ typedef signed long FT_Pos; @@ -99,6 +99,20 @@ FT_BEGIN_HEADER /* */ /* yMax :: The vertical maximum (top-most). */ /* */ + /* <Note> */ + /* The bounding box is specified with the coordinates of the lower */ + /* left and the upper right corner. In PostScript, those values are */ + /* often called (llx,lly) and (urx,ury), respectively. */ + /* */ + /* If `yMin' is negative, this value gives the glyph's descender. */ + /* Otherwise, the glyph doesn't descend below the baseline. */ + /* Similarly, if `ymax' is positive, this value gives the glyph's */ + /* ascender. */ + /* */ + /* `xMin' gives the horizontal distance from the glyph's origin to */ + /* the left edge of the glyph's bounding box. If `xMin' is negative, */ + /* the glyph extends to the left of the origin. */ + /* */ typedef struct FT_BBox_ { FT_Pos xMin, yMin; @@ -119,39 +133,40 @@ FT_BEGIN_HEADER /* */ /* <Values> */ /* FT_PIXEL_MODE_NONE :: */ - /* Value 0 is reserved. */ + /* Value~0 is reserved. */ /* */ /* 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 */ - /* 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 :: */ - /* 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 :: */ - /* 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 :: */ - /* 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 :: */ - /* 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_ @@ -206,11 +221,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. */ /* */ - /* <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. */ /* */ - /* 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> */ @@ -222,7 +237,7 @@ FT_BEGIN_HEADER 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; @@ -253,6 +268,9 @@ FT_BEGIN_HEADER /* flow. In all cases, the pitch is an offset to add */ /* to a bitmap pointer in order to go down one row. */ /* */ + /* For the B/W rasterizer, `pitch' is always an even */ + /* number. */ + /* */ /* buffer :: A typeless pointer to the bitmap buffer. This */ /* value should be aligned on 32-bit boundaries in */ /* most cases. */ @@ -317,14 +335,23 @@ FT_BEGIN_HEADER /* 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. */ /* */ + /* 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 */ @@ -335,6 +362,12 @@ FT_BEGIN_HEADER /* 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 */ @@ -348,71 +381,91 @@ FT_BEGIN_HEADER } 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> */ - /* FT_OUTLINE_FLAGS */ + /* FT_OUTLINE_FLAGS */ /* */ /* <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_SMART_DROPOUTS 0x10 +#define FT_OUTLINE_INCLUDE_STUBS 0x20 #define FT_OUTLINE_HIGH_PRECISION 0x100 #define FT_OUTLINE_SINGLE_PASS 0x200 @@ -448,21 +501,24 @@ FT_BEGIN_HEADER #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 +538,7 @@ FT_BEGIN_HEADER /* decomposition function. */ /* */ /* <Return> */ - /* Error code. 0 means success. */ + /* Error code. 0~means success. */ /* */ typedef int (*FT_Outline_MoveToFunc)( const FT_Vector* to, @@ -490,6 +546,7 @@ FT_BEGIN_HEADER #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc + /*************************************************************************/ /* */ /* <FuncType> */ @@ -508,13 +565,14 @@ FT_BEGIN_HEADER /* decomposition function. */ /* */ /* <Return> */ - /* Error code. 0 means success. */ + /* Error code. 0~means success. */ /* */ 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 + /*************************************************************************/ /* */ @@ -522,8 +580,8 @@ FT_BEGIN_HEADER /* FT_Outline_ConicToFunc */ /* */ /* <Description> */ - /* A function pointer type use to describe the signature of a `conic */ - /* to' function during outline walking/decomposition. */ + /* A function pointer type used to describe the signature of a `conic */ + /* to' function during outline walking or decomposition. */ /* */ /* A `conic to' is emitted to indicate a second-order Bézier arc in */ /* the outline. */ @@ -538,14 +596,15 @@ FT_BEGIN_HEADER /* 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 ); -#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc +#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc + /*************************************************************************/ /* */ @@ -554,7 +613,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* A function pointer type used to describe the signature of a `cubic */ - /* to' function during outline walking/decomposition. */ + /* to' function during outline walking or decomposition. */ /* */ /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ /* */ @@ -569,7 +628,7 @@ FT_BEGIN_HEADER /* the decomposition function. */ /* */ /* <Return> */ - /* Error code. 0 means success. */ + /* Error code. 0~means success. */ /* */ typedef int (*FT_Outline_CubicToFunc)( const FT_Vector* control1, @@ -577,7 +636,7 @@ FT_BEGIN_HEADER const FT_Vector* to, void* user ); -#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc +#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc /*************************************************************************/ @@ -587,8 +646,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* A structure to hold various function pointers used during outline */ - /* decomposition in order to emit segments, conic, and cubic Béziers, */ - /* as well as `move to' and `close to' operations. */ + /* decomposition in order to emit segments, conic, and cubic Béziers. */ /* */ /* <Fields> */ /* move_to :: The `move to' emitter. */ @@ -615,7 +673,7 @@ FT_BEGIN_HEADER /* y' = (x << shift) - delta */ /* } */ /* */ - /* Set the value of `shift' and `delta' to 0 to get the original */ + /* Set the values of `shift' and `delta' to~0 to get the original */ /* point coordinates. */ /* */ typedef struct FT_Outline_Funcs_ @@ -648,7 +706,7 @@ FT_BEGIN_HEADER /* 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: */ /* */ @@ -680,7 +738,7 @@ FT_BEGIN_HEADER /* */ /* <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 */ @@ -700,7 +758,7 @@ FT_BEGIN_HEADER /* */ /* 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. */ @@ -812,10 +870,11 @@ FT_BEGIN_HEADER /* */ /* <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. */ /* */ - /* 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_ { @@ -837,7 +896,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -854,8 +913,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 */ - /* `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. */ /* */ @@ -868,7 +927,7 @@ FT_BEGIN_HEADER const FT_Span* spans, void* user ); -#define FT_Raster_Span_Func FT_SpanFunc +#define FT_Raster_Span_Func FT_SpanFunc /*************************************************************************/ @@ -885,14 +944,14 @@ FT_BEGIN_HEADER /* 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> */ - /* 1 if the pixel is `set', 0 otherwise. */ + /* 1~if the pixel is `set', 0~otherwise. */ /* */ typedef int (*FT_Raster_BitTest_Func)( int y, @@ -913,14 +972,14 @@ FT_BEGIN_HEADER /* 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> */ - /* 1 if the pixel is `set', 0 otherwise. */ + /* 1~if the pixel is `set', 0~otherwise. */ /* */ typedef void (*FT_Raster_BitSet_Func)( int y, @@ -999,7 +1058,7 @@ FT_BEGIN_HEADER /* */ /* 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! */ /* */ @@ -1036,7 +1095,7 @@ FT_BEGIN_HEADER 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; @@ -1060,7 +1119,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -1073,7 +1132,8 @@ FT_BEGIN_HEADER (*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 +1149,8 @@ FT_BEGIN_HEADER 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 +1184,8 @@ FT_BEGIN_HEADER 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 +1210,8 @@ FT_BEGIN_HEADER 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 +1219,8 @@ FT_BEGIN_HEADER /* 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. */ @@ -1166,7 +1229,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -1188,7 +1251,8 @@ FT_BEGIN_HEADER (*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 +1275,12 @@ FT_BEGIN_HEADER /* */ 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; diff --git a/lib/3rdparty/freetype/include/freetype/ftincrem.h b/lib/3rdparty/freetype/include/freetype/ftincrem.h index 46bc8bdd37c..aaf689ff16c 100644 --- a/lib/3rdparty/freetype/include/freetype/ftincrem.h +++ b/lib/3rdparty/freetype/include/freetype/ftincrem.h @@ -4,7 +4,7 @@ /* */ /* FreeType incremental loading (specification). */ /* */ -/* Copyright 2002, 2003, 2006, 2007 by */ +/* Copyright 2002, 2003, 2006, 2007, 2008, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,192 +31,212 @@ 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; - /*************************************************************************** - * - * @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 :: + * Horizontal component of glyph advance, in font units. + * + * advance_v :: + * Vertical component of 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; + FT_Long advance_v; /* since 2.3.12 */ + + } FT_Incremental_MetricsRec; + - } 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. - */ + /*************************************************************************** + * + * @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 ); - /*************************************************************************** - * - * @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 ); - /*************************************************************************** - * - * @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, @@ -244,6 +264,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. + * */ typedef struct FT_Incremental_FuncsRec_ { @@ -254,41 +275,42 @@ FT_BEGIN_HEADER } 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 = ¶meter; // 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 = ¶meter; // 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; @@ -297,31 +319,31 @@ FT_BEGIN_HEADER } 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; - /*************************************************************************** - * - * @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' ) - /* */ + /* */ FT_END_HEADER diff --git a/lib/3rdparty/freetype/include/freetype/ftlcdfil.h b/lib/3rdparty/freetype/include/freetype/ftlcdfil.h index 9a61377a394..c6201b38e99 100644 --- a/lib/3rdparty/freetype/include/freetype/ftlcdfil.h +++ b/lib/3rdparty/freetype/include/freetype/ftlcdfil.h @@ -5,7 +5,7 @@ /* 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, */ @@ -23,6 +23,12 @@ #include <ft2build.h> #include FT_FREETYPE_H +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + FT_BEGIN_HEADER @@ -85,7 +91,7 @@ FT_BEGIN_HEADER * @since: * 2.3.0 */ - typedef enum + typedef enum FT_LcdFilter_ { FT_LCD_FILTER_NONE = 0, FT_LCD_FILTER_DEFAULT = 1, @@ -119,7 +125,7 @@ FT_BEGIN_HEADER * 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 @@ -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 - * @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 diff --git a/lib/3rdparty/freetype/include/freetype/ftlist.h b/lib/3rdparty/freetype/include/freetype/ftlist.h index f3223ee8fdb..93b05fc0d62 100644 --- a/lib/3rdparty/freetype/include/freetype/ftlist.h +++ b/lib/3rdparty/freetype/include/freetype/ftlist.h @@ -81,7 +81,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -101,7 +101,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -118,7 +118,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -135,7 +135,7 @@ FT_BEGIN_HEADER /* 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> */ @@ -155,7 +155,7 @@ FT_BEGIN_HEADER /* 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> */ @@ -193,7 +193,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -242,7 +242,7 @@ FT_BEGIN_HEADER /* 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. */ diff --git a/lib/3rdparty/freetype/include/freetype/ftlzw.h b/lib/3rdparty/freetype/include/freetype/ftlzw.h index d950653ebf8..00d40169a75 100644 --- a/lib/3rdparty/freetype/include/freetype/ftlzw.h +++ b/lib/3rdparty/freetype/include/freetype/ftlzw.h @@ -63,7 +63,7 @@ FT_BEGIN_HEADER * 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. diff --git a/lib/3rdparty/freetype/include/freetype/ftmac.h b/lib/3rdparty/freetype/include/freetype/ftmac.h index 3c6fafe5500..ab5bab5170c 100644 --- a/lib/3rdparty/freetype/include/freetype/ftmac.h +++ b/lib/3rdparty/freetype/include/freetype/ftmac.h @@ -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> */ - /* 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 */ @@ -100,7 +100,8 @@ FT_BEGIN_HEADER 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ 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> */ - /* 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, @@ -182,13 +183,14 @@ FT_BEGIN_HEADER /* 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_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 */ - /* first face has index 0. */ + /* first face has index~0. */ /* <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 */ @@ -242,12 +244,12 @@ FT_BEGIN_HEADER /* 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> */ - /* 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 */ diff --git a/lib/3rdparty/freetype/include/freetype/ftmm.h b/lib/3rdparty/freetype/include/freetype/ftmm.h index a9ccfe71380..3aefb9e4f25 100644 --- a/lib/3rdparty/freetype/include/freetype/ftmm.h +++ b/lib/3rdparty/freetype/include/freetype/ftmm.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -44,7 +44,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -91,12 +91,12 @@ FT_BEGIN_HEADER /* 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 */ - /* even though the Type 1 specification strangely */ + /* even though the Type~1 specification strangely */ /* allows for intermediate designs to be present. This */ - /* number cannot exceed 16. */ + /* number cannot exceed~16. */ /* */ /* 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> */ - /* 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 */ @@ -227,7 +227,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -238,7 +238,7 @@ FT_BEGIN_HEADER /* 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, @@ -251,18 +251,18 @@ FT_BEGIN_HEADER /* 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> */ - /* 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, diff --git a/lib/3rdparty/freetype/include/freetype/ftmodapi.h b/lib/3rdparty/freetype/include/freetype/ftmodapi.h index 9cc32aff4e1..3c9b876dfee 100644 --- a/lib/3rdparty/freetype/include/freetype/ftmodapi.h +++ b/lib/3rdparty/freetype/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -78,12 +78,50 @@ FT_BEGIN_HEADER 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 ); + + /*************************************************************************/ + /* */ + /* <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 ); + + /*************************************************************************/ + /* */ + /* <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 ); @@ -112,14 +150,11 @@ FT_BEGIN_HEADER /* 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_ { @@ -144,7 +179,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -153,7 +188,7 @@ FT_BEGIN_HEADER /* 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, */ @@ -170,7 +205,7 @@ FT_BEGIN_HEADER /* FT_Get_Module */ /* */ /* <Description> */ - /* Finds a module by its name. */ + /* Find a module by its name. */ /* */ /* <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> */ - /* 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 */ @@ -195,7 +230,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -204,7 +239,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -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. */ /* */ + /* 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. */ /* */ @@ -231,7 +270,7 @@ FT_BEGIN_HEADER /* 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, @@ -244,14 +283,14 @@ FT_BEGIN_HEADER /* 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Done_Library( FT_Library library ); @@ -268,7 +307,7 @@ FT_BEGIN_HEADER /* 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> */ @@ -283,7 +322,7 @@ FT_BEGIN_HEADER /* */ /* <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. */ @@ -301,7 +340,7 @@ FT_BEGIN_HEADER /* 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). */ /* */ @@ -362,7 +401,7 @@ FT_BEGIN_HEADER * 2.2 * */ - typedef enum + typedef enum FT_TrueTypeEngineType_ { FT_TRUETYPE_ENGINE_TYPE_NONE = 0, FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, @@ -377,7 +416,7 @@ FT_BEGIN_HEADER * 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: diff --git a/lib/3rdparty/freetype/include/freetype/ftotval.h b/lib/3rdparty/freetype/include/freetype/ftotval.h index 7c488fdf465..027f2e88657 100644 --- a/lib/3rdparty/freetype/include/freetype/ftotval.h +++ b/lib/3rdparty/freetype/include/freetype/ftotval.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -56,7 +56,7 @@ FT_BEGIN_HEADER /* */ /* <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_MATH :: + * Validate MATH table. + * * 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 @@ -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_MATH 0x2000 #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: - * FreeType error code. 0 means success. + * FreeType error code. 0~means success. * * @note: * This function only works with OpenType fonts, returning an error diff --git a/lib/3rdparty/freetype/include/freetype/ftoutln.h b/lib/3rdparty/freetype/include/freetype/ftoutln.h index 786ae13ed8f..2829a05ca30 100644 --- a/lib/3rdparty/freetype/include/freetype/ftoutln.h +++ b/lib/3rdparty/freetype/include/freetype/ftoutln.h @@ -5,7 +5,7 @@ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -84,15 +84,14 @@ FT_BEGIN_HEADER /* FT_Outline_Decompose */ /* */ /* <Description> */ - /* Walks 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. */ + /* Walk over an outline's structure to decompose it into individual */ + /* segments and Bézier arcs. This function also emits `move to' */ + /* operations to indicate the start 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. */ /* */ @@ -103,7 +102,7 @@ FT_BEGIN_HEADER /* decomposition. */ /* */ /* <Return> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Decompose( FT_Outline* outline, @@ -117,7 +116,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -130,11 +129,10 @@ FT_BEGIN_HEADER /* 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> */ - /* FreeType error code. 0 means success. */ + /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The reason why this function takes a `library' parameter is simply */ @@ -160,7 +158,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -169,7 +167,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -200,7 +198,7 @@ FT_BEGIN_HEADER /* 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 ); @@ -212,7 +210,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -240,7 +238,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -262,7 +260,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -273,7 +271,7 @@ FT_BEGIN_HEADER /* 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, @@ -286,7 +284,7 @@ FT_BEGIN_HEADER /* 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> */ @@ -310,7 +308,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -325,7 +323,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -333,6 +331,9 @@ FT_BEGIN_HEADER /* 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: */ /* */ /* { */ @@ -352,14 +353,14 @@ FT_BEGIN_HEADER /* 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> */ - /* 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 */ @@ -375,7 +376,7 @@ FT_BEGIN_HEADER /* 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> */ @@ -387,14 +388,19 @@ FT_BEGIN_HEADER /* 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 */ - /* 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. */ /* */ + /* 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, @@ -407,8 +413,8 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -422,7 +428,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -432,6 +438,11 @@ FT_BEGIN_HEADER /* 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, @@ -446,7 +457,7 @@ FT_BEGIN_HEADER * @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: @@ -455,7 +466,7 @@ FT_BEGIN_HEADER * 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 :: @@ -465,7 +476,7 @@ FT_BEGIN_HEADER * * 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 :: @@ -473,7 +484,7 @@ FT_BEGIN_HEADER * the glyph have different orientation. * */ - typedef enum + typedef enum FT_Orientation_ { FT_ORIENTATION_TRUETYPE = 0, FT_ORIENTATION_POSTSCRIPT = 1, diff --git a/lib/3rdparty/freetype/include/freetype/ftpfr.h b/lib/3rdparty/freetype/include/freetype/ftpfr.h index e2801fd0f98..0b7b7d427c9 100644 --- a/lib/3rdparty/freetype/include/freetype/ftpfr.h +++ b/lib/3rdparty/freetype/include/freetype/ftpfr.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -62,8 +62,8 @@ FT_BEGIN_HEADER * * @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' @@ -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 - * can be NULL) + * can be NULL). * * ametrics_y_scale :: * Same as `ametrics_x_scale' but for the vertical direction. - * optional (parameter can be NULL) + * optional (parameter can be NULL). * * @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. @@ -115,7 +115,7 @@ FT_BEGIN_HEADER * 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 @@ -150,7 +150,7 @@ FT_BEGIN_HEADER * 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 diff --git a/lib/3rdparty/freetype/include/freetype/ftrender.h b/lib/3rdparty/freetype/include/freetype/ftrender.h index 5b07f08c2de..41c31eac48c 100644 --- a/lib/3rdparty/freetype/include/freetype/ftrender.h +++ b/lib/3rdparty/freetype/include/freetype/ftrender.h @@ -124,27 +124,32 @@ FT_BEGIN_HEADER /* 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_ { - 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; @@ -162,7 +167,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -170,7 +175,7 @@ FT_BEGIN_HEADER /* 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, */ @@ -190,7 +195,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -203,7 +208,7 @@ FT_BEGIN_HEADER /* 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 */ diff --git a/lib/3rdparty/freetype/include/freetype/ftsizes.h b/lib/3rdparty/freetype/include/freetype/ftsizes.h index 622df162d2c..3e548cc39f3 100644 --- a/lib/3rdparty/freetype/include/freetype/ftsizes.h +++ b/lib/3rdparty/freetype/include/freetype/ftsizes.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -89,7 +89,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -115,7 +115,7 @@ FT_BEGIN_HEADER /* 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 ); @@ -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 */ - /* @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. */ @@ -139,7 +139,7 @@ FT_BEGIN_HEADER /* 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 */ diff --git a/lib/3rdparty/freetype/include/freetype/ftsnames.h b/lib/3rdparty/freetype/include/freetype/ftsnames.h index 003cbcd129c..485e4e162e7 100644 --- a/lib/3rdparty/freetype/include/freetype/ftsnames.h +++ b/lib/3rdparty/freetype/include/freetype/ftsnames.h @@ -7,7 +7,7 @@ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006 by */ +/* Copyright 1996-2001, 2002, 2003, 2006, 2009, 2010 by */ /* 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> */ - /* 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. */ @@ -114,7 +114,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -132,7 +132,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -143,11 +143,12 @@ FT_BEGIN_HEADER /* 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 */ - /* 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 */ @@ -159,6 +160,35 @@ FT_BEGIN_HEADER FT_SfntName *aname ); + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY + * + * @description: + * A constant used as the tag of @FT_Parameter structures to make + * FT_Open_Face() ignore preferred family subfamily names in `name' + * table since OpenType version 1.4. For backwards compatibility with + * legacy systems which has 4-face-per-family restriction. + * + */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY + * + * @description: + * A constant used as the tag of @FT_Parameter structures to make + * FT_Open_Face() ignore preferred subfamily names in `name' table since + * OpenType version 1.4. For backwards compatibility with legacy + * systems which has 4-face-per-family restriction. + * + */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' ) + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/ftstroke.h b/lib/3rdparty/freetype/include/freetype/ftstroke.h index 738b43c1acc..3afb87df887 100644 --- a/lib/3rdparty/freetype/include/freetype/ftstroke.h +++ b/lib/3rdparty/freetype/include/freetype/ftstroke.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -84,7 +84,7 @@ FT_BEGIN_HEADER * 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, @@ -115,7 +115,7 @@ FT_BEGIN_HEADER * 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, @@ -149,7 +149,7 @@ FT_BEGIN_HEADER * 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 @@ -171,7 +171,7 @@ FT_BEGIN_HEADER * 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 ) @@ -216,7 +216,7 @@ FT_BEGIN_HEADER * 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, @@ -249,7 +249,7 @@ FT_BEGIN_HEADER * 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 ) @@ -297,18 +297,18 @@ FT_BEGIN_HEADER * 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: - * FreeType error code. 0 means success. + * FreeType error code. 0~means success. * * @note: - * If `opened' is 0 (the default), the outline is treated as a closed - * path, and the stroker will generate two distinct `border' outlines. + * If `opened' is~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. */ @@ -334,10 +334,10 @@ FT_BEGIN_HEADER * 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: - * 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 @@ -362,11 +362,11 @@ FT_BEGIN_HEADER * 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. - * 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 ) @@ -390,7 +390,7 @@ FT_BEGIN_HEADER * 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 @@ -421,7 +421,7 @@ FT_BEGIN_HEADER * 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 @@ -456,7 +456,7 @@ FT_BEGIN_HEADER * 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 @@ -476,7 +476,7 @@ FT_BEGIN_HEADER * * @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. * @@ -495,7 +495,7 @@ FT_BEGIN_HEADER * 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 @@ -525,8 +525,8 @@ FT_BEGIN_HEADER * 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: @@ -583,7 +583,7 @@ FT_BEGIN_HEADER * 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, @@ -598,10 +598,10 @@ FT_BEGIN_HEADER * * @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: @@ -649,11 +649,11 @@ FT_BEGIN_HEADER * 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: - * FreeType error code. 0 means success. + * FreeType error code. 0~means success. * * @note: * The source glyph is untouched in case of error. @@ -682,15 +682,15 @@ FT_BEGIN_HEADER * 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 :: - * A Boolean. If 1, the source glyph object is destroyed + * A Boolean. If~1, the source glyph object is destroyed * 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. diff --git a/lib/3rdparty/freetype/include/freetype/ftsynth.h b/lib/3rdparty/freetype/include/freetype/ftsynth.h index 36984bf1a7b..a068b7928d6 100644 --- a/lib/3rdparty/freetype/include/freetype/ftsynth.h +++ b/lib/3rdparty/freetype/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ /* 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, */ @@ -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 *********/ /********* *********/ @@ -34,6 +34,13 @@ /*************************************************************************/ + /* 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__ @@ -50,20 +57,20 @@ 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 ); - + /* Slant an outline glyph to the right by about 12 degrees. */ FT_EXPORT( void ) FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); - /* */ + /* */ FT_END_HEADER diff --git a/lib/3rdparty/freetype/include/freetype/ftsystem.h b/lib/3rdparty/freetype/include/freetype/ftsystem.h index 59cd0198221..a95b2c76b61 100644 --- a/lib/3rdparty/freetype/include/freetype/ftsystem.h +++ b/lib/3rdparty/freetype/include/freetype/ftsystem.h @@ -82,7 +82,7 @@ FT_BEGIN_HEADER * 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* @@ -133,7 +133,7 @@ FT_BEGIN_HEADER * 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. @@ -152,7 +152,7 @@ FT_BEGIN_HEADER * 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 :: @@ -240,7 +240,7 @@ FT_BEGIN_HEADER * * @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 diff --git a/lib/3rdparty/freetype/include/freetype/fttypes.h b/lib/3rdparty/freetype/include/freetype/fttypes.h index 2340bacd310..a57ffa69bd8 100644 --- a/lib/3rdparty/freetype/include/freetype/fttypes.h +++ b/lib/3rdparty/freetype/include/freetype/fttypes.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -43,7 +43,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -53,6 +53,10 @@ FT_BEGIN_HEADER /* FT_Char */ /* FT_Int */ /* FT_UInt */ + /* FT_Int16 */ + /* FT_UInt16 */ + /* FT_Int32 */ + /* FT_UInt32 */ /* 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, */ - /* values 1 and 0 represent true and false, respectively. */ + /* values 1 and~0 represent true and false, respectively. */ /* */ typedef unsigned char FT_Bool; @@ -163,7 +167,7 @@ FT_BEGIN_HEADER /* 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; @@ -286,7 +290,7 @@ FT_BEGIN_HEADER /* 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; @@ -309,7 +313,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -322,7 +326,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -409,7 +413,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -466,10 +470,11 @@ FT_BEGIN_HEADER /* 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 ) \ + (FT_Tag) \ ( ( (FT_ULong)_x1 << 24 ) | \ ( (FT_ULong)_x2 << 16 ) | \ ( (FT_ULong)_x3 << 8 ) | \ diff --git a/lib/3rdparty/freetype/include/freetype/ftwinfnt.h b/lib/3rdparty/freetype/include/freetype/ftwinfnt.h index a0063cc7356..ea33353536e 100644 --- a/lib/3rdparty/freetype/include/freetype/ftwinfnt.h +++ b/lib/3rdparty/freetype/include/freetype/ftwinfnt.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -111,11 +111,11 @@ FT_BEGIN_HEADER * 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 :: - * 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 :: @@ -219,36 +219,47 @@ FT_BEGIN_HEADER 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_END_HEADER diff --git a/lib/3rdparty/freetype/include/freetype/ftxf86.h b/lib/3rdparty/freetype/include/freetype/ftxf86.h index ea82abb0842..8c68afdcc58 100644 --- a/lib/3rdparty/freetype/include/freetype/ftxf86.h +++ b/lib/3rdparty/freetype/include/freetype/ftxf86.h @@ -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. */ /* */ + /* 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 */ - /* `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 :: */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/autohint.h b/lib/3rdparty/freetype/include/freetype/internal/autohint.h index ee004022f9d..7e3a08a0511 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/autohint.h +++ b/lib/3rdparty/freetype/include/freetype/internal/autohint.h @@ -196,6 +196,32 @@ FT_BEGIN_HEADER } 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 diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h b/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h index c7e9901ebaf..f8b4324777e 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h +++ b/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -111,6 +111,31 @@ FT_BEGIN_HEADER #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 @@ -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 FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 ) #define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ : ( -( ( 32 - (x) ) & -64 ) ) ) diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h b/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h index 15627147b8e..7baae3531d5 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h +++ b/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -54,7 +54,7 @@ FT_BEGIN_HEADER #define FT_TRACE_DEF( x ) trace_ ## x , /* defining the enumeration */ - typedef enum + typedef enum FT_Trace_ { #include FT_INTERNAL_TRACE_H trace_count @@ -92,7 +92,7 @@ FT_BEGIN_HEADER #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 */ @@ -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 )) */ /* */ + /* Output of the FT_TRACEX macros is sent to stderr. */ + /* */ /*************************************************************************/ #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 */ -#define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */ +#define FT_ERROR( varformat ) do { } while ( 0 ) /* nothing */ #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 */ -#define FT_ASSERT( condition ) do ; while ( 0 ) +#define FT_ASSERT( condition ) do { } while ( 0 ) #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 -#include "stdio.h" /* for vprintf() */ +#include "stdio.h" /* for vfprintf() */ /* print a message */ FT_BASE( void ) - FT_Message( const char* fmt, ... ); + FT_Message( const char* fmt, + ... ); /* print a message and exit */ FT_BASE( void ) - FT_Panic( const char* fmt, ... ); + FT_Panic( const char* fmt, + ... ); #endif /* FT_DEBUG_LEVEL_ERROR */ @@ -229,8 +235,8 @@ FT_BEGIN_HEADER #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 */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h b/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h index 97f3fd04d90..1d06997bd18 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h +++ b/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -91,6 +91,7 @@ FT_BEGIN_HEADER (*FT_CharMap_CharNextFunc)( FT_CharMap charmap, FT_Long charcode ); + typedef FT_Error (*FT_Face_GetKerningFunc)( FT_Face face, FT_UInt left_glyph, @@ -104,11 +105,11 @@ FT_BEGIN_HEADER 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! */ /* */ - /* 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 */ @@ -180,8 +177,8 @@ FT_BEGIN_HEADER /* 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_ { @@ -243,6 +240,179 @@ FT_BEGIN_HEADER #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 diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h b/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h index 9f47c0b8c87..ce4dc6c9cc6 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h +++ b/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h @@ -67,11 +67,11 @@ FT_BEGIN_HEADER 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_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; @@ -121,15 +121,15 @@ FT_BEGIN_HEADER 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 ) && \ diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h b/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h index c6ddc42ea9b..2010ca90d7e 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h +++ b/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h @@ -333,8 +333,8 @@ FT_BEGIN_HEADER 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 ) ) diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h b/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h index 15b68d63f15..574cf582967 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h +++ b/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -35,6 +35,7 @@ #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 @@ -160,6 +161,31 @@ FT_BEGIN_HEADER (*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_ { @@ -169,8 +195,56 @@ FT_BEGIN_HEADER 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; +#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 ) @@ -306,7 +380,28 @@ FT_BEGIN_HEADER } 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 */ /* */ + /* pic_container :: Contains global structs and tables, instead */ + /* of defining them globallly. */ + /* */ + 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 +#ifdef FT_CONFIG_OPTION_PIC + FT_PIC_Container pic_container; +#endif + } FT_LibraryRec; @@ -811,6 +914,484 @@ FT_BEGIN_HEADER 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 diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftpic.h b/lib/3rdparty/freetype/include/freetype/internal/ftpic.h new file mode 100644 index 00000000000..1b31957d702 --- /dev/null +++ b/lib/3rdparty/freetype/include/freetype/internal/ftpic.h @@ -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 */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h b/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h index 94402bcfa73..aa573c87054 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h +++ b/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -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. */ -#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; /*************************************************************************/ diff --git a/lib/3rdparty/freetype/include/freetype/internal/ftserv.h b/lib/3rdparty/freetype/include/freetype/internal/ftserv.h index 45d2fa91834..569b9f7e0e8 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/ftserv.h +++ b/lib/3rdparty/freetype/include/freetype/internal/ftserv.h @@ -163,6 +163,298 @@ FT_BEGIN_HEADER 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 @@ -301,6 +593,7 @@ FT_BEGIN_HEADER */ #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> diff --git a/lib/3rdparty/freetype/include/freetype/internal/fttrace.h b/lib/3rdparty/freetype/include/freetype/internal/fttrace.h index 81916fc6aea..e9b383a5881 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/fttrace.h +++ b/lib/3rdparty/freetype/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -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( 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( synth ) /* bold/slant synthesizer (ftsynth.c) */ /* 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) */ @@ -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( ttbdf ) /* TrueType embedded BDF (ttbdf.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( t1afm ) 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( otvmath ) /* TrueTypeGX/AAT validation components */ FT_TRACE_DEF( gxvmodule ) diff --git a/lib/3rdparty/freetype/include/freetype/internal/internal.h b/lib/3rdparty/freetype/include/freetype/internal/internal.h index 27d5dc585d3..f500a651c27 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/internal.h +++ b/lib/3rdparty/freetype/include/freetype/internal/internal.h @@ -25,6 +25,7 @@ #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> diff --git a/lib/3rdparty/freetype/include/freetype/internal/psaux.h b/lib/3rdparty/freetype/include/freetype/internal/psaux.h index 4baf7a094a8..a96e0dfa865 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/psaux.h +++ b/lib/3rdparty/freetype/include/freetype/internal/psaux.h @@ -5,7 +5,7 @@ /* 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, */ @@ -197,6 +197,7 @@ FT_BEGIN_HEADER { 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, @@ -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 */ - /* 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; @@ -355,7 +360,7 @@ FT_BEGIN_HEADER 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 ); @@ -528,13 +533,6 @@ FT_BEGIN_HEADER /* */ /* 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). */ @@ -567,11 +565,6 @@ FT_BEGIN_HEADER 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; @@ -582,7 +575,6 @@ FT_BEGIN_HEADER T1_ParseState parse_state; FT_Bool load_points; FT_Bool no_recurse; - FT_Bool shift; FT_Bool metrics_only; @@ -697,9 +689,11 @@ FT_BEGIN_HEADER T1_Decoder_Callback parse_callback; T1_Decoder_FuncsRec funcs; - FT_Int* buildchar; + FT_Long* buildchar; FT_UInt len_buildchar; + FT_Bool seac; + } T1_DecoderRec; @@ -761,7 +755,7 @@ FT_BEGIN_HEADER FT_Int (*get_index)( const char* name, - FT_UInt len, + FT_Offset len, void* user_data ); void* user_data; diff --git a/lib/3rdparty/freetype/include/freetype/internal/pshints.h b/lib/3rdparty/freetype/include/freetype/internal/pshints.h index 48452c0cf3e..0c357651be4 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/pshints.h +++ b/lib/3rdparty/freetype/include/freetype/internal/pshints.h @@ -6,7 +6,7 @@ /* 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, */ @@ -157,7 +157,8 @@ FT_BEGIN_HEADER * 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 @@ -175,9 +176,9 @@ FT_BEGIN_HEADER * */ 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 :: - * 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 @@ -209,9 +210,9 @@ FT_BEGIN_HEADER * */ 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 :: - * 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 @@ -678,6 +679,30 @@ FT_BEGIN_HEADER 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 diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h b/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h index 0f7fc6115d6..9264239146b 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h @@ -45,6 +45,26 @@ FT_BEGIN_HEADER 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/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h b/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h new file mode 100644 index 00000000000..9b874b5e725 --- /dev/null +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h @@ -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 */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h b/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h index e5e56b253c1..d66a41d5ae3 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h @@ -51,6 +51,28 @@ FT_BEGIN_HEADER 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 */ + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h b/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h index 8a99ec4b1a7..66e1da22f1a 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h @@ -68,6 +68,31 @@ FT_BEGIN_HEADER 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 */ + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h b/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h index 282da68d13e..106c54f8530 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h @@ -46,6 +46,27 @@ FT_BEGIN_HEADER 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 */ + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h b/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h index c4e25ed635f..961030cc391 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h @@ -98,7 +98,7 @@ FT_BEGIN_HEADER (*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes, FT_UInt32 unicode ); - typedef FT_ULong + typedef FT_UInt32 (*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes, FT_UInt32 *unicode ); @@ -117,6 +117,41 @@ FT_BEGIN_HEADER 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 */ + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h b/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h index 63f5db9c19a..91ba91e5dc0 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -33,6 +33,10 @@ FT_BEGIN_HEADER (*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 ); @@ -44,10 +48,38 @@ FT_BEGIN_HEADER 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; }; +#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 */ + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h b/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h index b4a85d97ec7..30bb1620fe1 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h @@ -58,6 +58,7 @@ FT_BEGIN_HEADER (*FT_SFNT_TableInfoFunc)( FT_Face face, FT_UInt idx, FT_ULong *tag, + FT_ULong *offset, FT_ULong *length ); @@ -68,6 +69,27 @@ FT_BEGIN_HEADER 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 */ + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h b/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h index 1e02d15506d..8af00351d9d 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h @@ -1,13 +1,13 @@ /***************************************************************************/ /* */ -/* svsttcmap.h */ +/* svttcmap.h */ /* */ /* 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, */ @@ -49,6 +49,13 @@ FT_BEGIN_HEADER /* 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; @@ -67,6 +74,27 @@ FT_BEGIN_HEADER 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 */ + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h b/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h index e57d484b7e2..ab2dc9a9fe9 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h +++ b/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h @@ -37,6 +37,25 @@ FT_BEGIN_HEADER 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 */ + /* */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/sfnt.h b/lib/3rdparty/freetype/include/freetype/internal/sfnt.h index 7e8f6847c98..6326debd00c 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/sfnt.h +++ b/lib/3rdparty/freetype/include/freetype/internal/sfnt.h @@ -753,6 +753,141 @@ FT_BEGIN_HEADER /* 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 diff --git a/lib/3rdparty/freetype/include/freetype/internal/t1types.h b/lib/3rdparty/freetype/include/freetype/internal/t1types.h index 047c6d59df0..5f730637b5b 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/t1types.h +++ b/lib/3rdparty/freetype/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ /* 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, */ @@ -58,7 +58,9 @@ FT_BEGIN_HEADER /* */ /* 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. */ /* */ @@ -87,11 +89,24 @@ FT_BEGIN_HEADER } 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_ { - 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; @@ -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; - FT_Int* buildchar; + FT_Long* buildchar; /* 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; + PS_FontExtraRec font_extra; +#if 0 void* afm_data; +#endif CID_Subrs subrs; /* since version 2.1 - interface to PostScript hinter */ diff --git a/lib/3rdparty/freetype/include/freetype/internal/tttypes.h b/lib/3rdparty/freetype/include/freetype/internal/tttypes.h index dfbb6a1ea0b..acbb863b0f1 100644 --- a/lib/3rdparty/freetype/include/freetype/internal/tttypes.h +++ b/lib/3rdparty/freetype/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ /* 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, */ @@ -586,7 +586,7 @@ FT_BEGIN_HEADER /* 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; @@ -902,7 +902,7 @@ FT_BEGIN_HEADER 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; @@ -1401,7 +1401,7 @@ FT_BEGIN_HEADER 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; diff --git a/lib/3rdparty/freetype/include/freetype/t1tables.h b/lib/3rdparty/freetype/include/freetype/t1tables.h index 250629d2522..5e2a3934cee 100644 --- a/lib/3rdparty/freetype/include/freetype/t1tables.h +++ b/lib/3rdparty/freetype/include/freetype/t1tables.h @@ -5,7 +5,7 @@ /* 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, */ @@ -43,7 +43,7 @@ FT_BEGIN_HEADER /* 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, */ @@ -62,11 +62,11 @@ FT_BEGIN_HEADER /* 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. */ /* */ - typedef struct PS_FontInfoRec + typedef struct PS_FontInfoRec_ { FT_String* version; FT_String* notice; @@ -78,7 +78,18 @@ FT_BEGIN_HEADER 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> */ - /* 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_ { @@ -142,7 +153,18 @@ FT_BEGIN_HEADER 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. */ /* */ - typedef enum + typedef enum T1_Blend_Flags_ { /*# required fields in a FontInfo blend dictionary */ T1_BLEND_UNDERLINE_POSITION = 0, @@ -272,6 +294,14 @@ FT_BEGIN_HEADER 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; @@ -290,7 +320,20 @@ FT_BEGIN_HEADER 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 */ @@ -332,7 +375,18 @@ FT_BEGIN_HEADER 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; - /* */ - - /************************************************************************ - * - * @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 ); - /************************************************************************ - * - * @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_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_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 diff --git a/lib/3rdparty/freetype/include/freetype/ttnameid.h b/lib/3rdparty/freetype/include/freetype/ttnameid.h index b9acbdad119..cbeac78db1e 100644 --- a/lib/3rdparty/freetype/include/freetype/ttnameid.h +++ b/lib/3rdparty/freetype/include/freetype/ttnameid.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -26,6 +26,13 @@ FT_BEGIN_HEADER + /*************************************************************************/ + /* */ + /* <Section> */ + /* truetype_tables */ + /* */ + + /*************************************************************************/ /* */ /* 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_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. + * TT_ADOBE_ID_LATIN_1 :: + * Adobe Latin~1 encoding. */ #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.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. */ /* */ - /* 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 */ @@ -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 */ - /* Bit 4 IPA Extensions */ + /* Bit 4 IPA Extensions */ + /* Phonetic Extensions */ + /* Phonetic Extensions Supplement */ #define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */ + /* U+1D00-U+1D7F */ + /* U+1D80-U+1DBF */ /* Bit 5 Spacing Modifier Letters */ + /* Modifier Tone Letters */ #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 */ + /* U+1DC0-U+1DFF */ /* 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 */ + /* 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 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 */ - /* 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 */ @@ -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 */ - /* Bit 26 Georgian */ + /* Bit 26 Georgian */ + /* Georgian Supplement */ #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 */ + /* Latin Extended-C */ + /* Latin Extended-D */ #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 */ - - /* Symbols Area */ - - /* Bit 31 General Punctuation */ + /* Bit 31 General Punctuation */ + /* Supplemental Punctuation */ #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 */ @@ -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 */ - /* 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 */ - /* 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 */ @@ -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 */ - - /* 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 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 */ - /* 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 */ - /* 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 */ - - /* Hangul Syllables Area */ - - /* Bit 56 Hangul */ + /* Bit 56 Hangul Syllables */ #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 */ - /* 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 */ @@ -999,17 +1033,13 @@ FT_BEGIN_HEADER /* 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 */ - - /* 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 */ @@ -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 */ - /* 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 */ @@ -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 */ - /* Bit 75 Ethiopic */ + /* Bit 75 Ethiopic */ + /* Ethiopic Supplement */ + /* Ethiopic Extended */ #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 */ @@ -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 */ - /* Bit 80 Khmer */ + /* Bit 80 Khmer */ + /* Khmer Symbols */ #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 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 */ - /* 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 */ @@ -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*/ - /* 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*/ + /*U+1D200-U+1D24F*/ /* 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*/ - /* Bit 91 Variation Selectors */ + /* Bit 91 Variation Selectors */ + /* Variation Selectors Supplement */ #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 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. */ /* */ - /* 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 */ diff --git a/lib/3rdparty/freetype/include/freetype/tttables.h b/lib/3rdparty/freetype/include/freetype/tttables.h index 43eca2e2580..c12b1726896 100644 --- a/lib/3rdparty/freetype/include/freetype/tttables.h +++ b/lib/3rdparty/freetype/include/freetype/tttables.h @@ -5,7 +5,7 @@ /* 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, */ @@ -156,9 +156,9 @@ FT_BEGIN_HEADER /* 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 */ @@ -281,9 +281,9 @@ FT_BEGIN_HEADER /* 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 */ @@ -406,9 +406,9 @@ FT_BEGIN_HEADER /* 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 */ - /* 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_ @@ -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. */ /* */ - typedef enum + typedef enum FT_Sfnt_Tag_ { ft_sfnt_head = 0, ft_sfnt_maxp = 1, @@ -578,7 +578,7 @@ FT_BEGIN_HEADER /* 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. */ @@ -586,7 +586,7 @@ FT_BEGIN_HEADER /* 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. */ /* */ @@ -608,14 +608,14 @@ FT_BEGIN_HEADER * 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 :: - * 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. @@ -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. * - * 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: - * 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 - * 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; @@ -674,7 +674,7 @@ FT_BEGIN_HEADER * FT_Sfnt_Table_Info * * @description: - * Returns information on an SFNT table. + * Return information on an SFNT table. * * @input: * face :: @@ -692,10 +692,10 @@ FT_BEGIN_HEADER * The length of the SFNT table. * * @return: - * FreeType error code. 0 means success. + * FreeType error code. 0~means success. * * @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 ) @@ -720,7 +720,7 @@ FT_BEGIN_HEADER /* */ /* <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 ); diff --git a/lib/3rdparty/freetype/include/freetype/tttags.h b/lib/3rdparty/freetype/include/freetype/tttags.h index e10244ca7c9..307ce4b6374 100644 --- a/lib/3rdparty/freetype/include/freetype/tttags.h +++ b/lib/3rdparty/freetype/include/freetype/tttags.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -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_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', ' ' ) @@ -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_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' ) @@ -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_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' ) @@ -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_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_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_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' ) diff --git a/lib/3rdparty/freetype/modules.cfg b/lib/3rdparty/freetype/modules.cfg index 6d8a95eaca6..4047d7f09cf 100644 --- a/lib/3rdparty/freetype/modules.cfg +++ b/lib/3rdparty/freetype/modules.cfg @@ -1,6 +1,6 @@ # 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, @@ -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 -# include/freetype/ftcache.h. +# include/freetype/ftcache.h. Needs ftglyph.c. 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 -# 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 -# Interface for gxvalid module (which is required). +# Interface for gxvalid module. # # 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 -# Interface for otvalid module (which is required). +# Interface for otvalid module. # # 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 -# Path stroker. +# Path stroker. Needs ftglyph.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 @@ -210,21 +235,6 @@ BASE_EXTENSIONS += ftwinfnt.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) diff --git a/lib/3rdparty/freetype/src/autofit/Jamfile b/lib/3rdparty/freetype/src/autofit/Jamfile index acee8bf2cbf..2714765b5b5 100644 --- a/lib/3rdparty/freetype/src/autofit/Jamfile +++ b/lib/3rdparty/freetype/src/autofit/Jamfile @@ -1,6 +1,6 @@ # 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, @@ -14,14 +14,14 @@ SubDir FT2_TOP src autofit ; { 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) { - _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) { diff --git a/lib/3rdparty/freetype/src/autofit/afcjk.c b/lib/3rdparty/freetype/src/autofit/afcjk.c index c7ca266da8a..bab0c42bade 100644 --- a/lib/3rdparty/freetype/src/autofit/afcjk.c +++ b/lib/3rdparty/freetype/src/autofit/afcjk.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -45,7 +45,7 @@ /*************************************************************************/ /*************************************************************************/ - static FT_Error + FT_LOCAL_DEF( FT_Error ) af_cjk_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { @@ -58,9 +58,12 @@ 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 ); @@ -91,7 +94,7 @@ } - static void + FT_LOCAL_DEF( void ) af_cjk_metrics_scale( AF_LatinMetrics metrics, AF_Scaler scaler ) { @@ -427,7 +430,9 @@ /* 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; @@ -596,7 +601,7 @@ } - static FT_Error + FT_LOCAL_DEF( FT_Error ) af_cjk_hints_init( AF_GlyphHints hints, AF_LatinMetrics metrics ) { @@ -1015,7 +1020,7 @@ 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; @@ -1251,10 +1256,15 @@ 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 ); + } } } } @@ -1350,7 +1360,7 @@ } - static FT_Error + FT_LOCAL_DEF( FT_Error ) af_cjk_hints_apply( AF_GlyphHints hints, FT_Outline* outline, AF_LatinMetrics metrics ) @@ -1434,35 +1444,33 @@ static const AF_Script_UniRangeRec af_cjk_uniranges[] = { #if 0 - { 0x0100, 0xFFFF }, /* why this? */ + AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ), /* why this? */ #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, @@ -1474,19 +1482,17 @@ (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[] = { - { 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, @@ -1498,7 +1504,7 @@ (AF_Script_InitHintsFunc) NULL, (AF_Script_ApplyHintsFunc) NULL - }; + ) #endif /* !AF_CONFIG_OPTION_CJK */ diff --git a/lib/3rdparty/freetype/src/autofit/afcjk.h b/lib/3rdparty/freetype/src/autofit/afcjk.h index 0de4a5ab728..0b20d4ae356 100644 --- a/lib/3rdparty/freetype/src/autofit/afcjk.h +++ b/lib/3rdparty/freetype/src/autofit/afcjk.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -27,10 +27,26 @@ FT_BEGIN_HEADER /* 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 diff --git a/lib/3rdparty/freetype/src/autofit/afdummy.c b/lib/3rdparty/freetype/src/autofit/afdummy.c index ed96e96410d..42b2fcb216d 100644 --- a/lib/3rdparty/freetype/src/autofit/afdummy.c +++ b/lib/3rdparty/freetype/src/autofit/afdummy.c @@ -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, @@ -56,7 +54,7 @@ (AF_Script_InitHintsFunc) af_dummy_hints_init, (AF_Script_ApplyHintsFunc) af_dummy_hints_apply - }; + ) /* END */ diff --git a/lib/3rdparty/freetype/src/autofit/afdummy.h b/lib/3rdparty/freetype/src/autofit/afdummy.h index 2a5faf8f851..b69ef437fe9 100644 --- a/lib/3rdparty/freetype/src/autofit/afdummy.h +++ b/lib/3rdparty/freetype/src/autofit/afdummy.h @@ -29,8 +29,7 @@ FT_BEGIN_HEADER * 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) /* */ diff --git a/lib/3rdparty/freetype/src/autofit/afglobal.c b/lib/3rdparty/freetype/src/autofit/afglobal.c index 1875f52befc..ac293619d3d 100644 --- a/lib/3rdparty/freetype/src/autofit/afglobal.c +++ b/lib/3rdparty/freetype/src/autofit/afglobal.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -21,6 +21,7 @@ #include "aflatin.h" #include "afcjk.h" #include "afindic.h" +#include "afpic.h" #include "aferrors.h" @@ -28,6 +29,11 @@ #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[] = { @@ -37,14 +43,18 @@ #endif &af_latin_script_class, &af_cjk_script_class, - &af_indic_script_class, + &af_indic_script_class, NULL /* do not remove */ }; +#endif /* FT_CONFIG_OPTION_PIC */ + /* 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; - 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]; @@ -72,7 +82,7 @@ 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' */ @@ -84,17 +94,17 @@ 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 */ - 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; @@ -114,7 +124,7 @@ 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; @@ -127,7 +137,7 @@ 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; @@ -136,13 +146,23 @@ } } + /* 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? */ { - FT_UInt nn; + FT_Long nn; for ( nn = 0; nn < globals->glyph_count; nn++ ) @@ -201,7 +221,7 @@ { 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 ); @@ -232,12 +252,12 @@ 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; - if ( gindex >= globals->glyph_count ) + if ( gindex >= (FT_ULong)globals->glyph_count ) { error = AF_Err_Invalid_Argument; goto Exit; @@ -245,9 +265,9 @@ 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; @@ -286,4 +306,15 @@ } + 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 */ diff --git a/lib/3rdparty/freetype/src/autofit/afglobal.h b/lib/3rdparty/freetype/src/autofit/afglobal.h index cf52c087560..2a68e19607a 100644 --- a/lib/3rdparty/freetype/src/autofit/afglobal.h +++ b/lib/3rdparty/freetype/src/autofit/afglobal.h @@ -5,7 +5,7 @@ /* 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, */ @@ -56,7 +56,11 @@ FT_BEGIN_HEADER 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 diff --git a/lib/3rdparty/freetype/src/autofit/afhints.c b/lib/3rdparty/freetype/src/autofit/afhints.c index 482870686d5..fe38fba9954 100644 --- a/lib/3rdparty/freetype/src/autofit/afhints.c +++ b/lib/3rdparty/freetype/src/autofit/afhints.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -34,7 +34,7 @@ { 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 ) @@ -77,7 +77,7 @@ { 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 ) @@ -127,7 +127,7 @@ #ifdef AF_DEBUG -#include <stdio.h> +#include FT_CONFIG_STANDARD_LIBRARY_H static const char* af_dir_str( AF_Direction dir ) @@ -203,14 +203,14 @@ 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++] = ' '; - memcpy( temp + pos, "serif", 5 ); + ft_memcpy( temp + pos, "serif", 5 ); pos += 5; } if ( pos == 0 ) @@ -645,6 +645,7 @@ FT_Int contour_index = 0; + FT_UNUSED( first ); for ( point = points; point < point_limit; point++, vec++, tag++ ) { point->fx = (FT_Short)vec->x; @@ -940,8 +941,8 @@ } { - FT_UInt min, max, mid; - FT_Pos fpos; + FT_PtrDist min, max, mid; + FT_Pos fpos; /* find enclosing edges */ @@ -952,7 +953,7 @@ /* 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 ) diff --git a/lib/3rdparty/freetype/src/autofit/afhints.h b/lib/3rdparty/freetype/src/autofit/afhints.h index 49e88d1b621..675826835ae 100644 --- a/lib/3rdparty/freetype/src/autofit/afhints.h +++ b/lib/3rdparty/freetype/src/autofit/afhints.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -30,7 +30,7 @@ FT_BEGIN_HEADER * script analysis routines (until now). */ - typedef enum + typedef enum AF_Dimension_ { 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' */ - typedef enum + typedef enum AF_Direction_ { AF_DIR_NONE = 4, AF_DIR_RIGHT = 1, @@ -56,7 +56,7 @@ FT_BEGIN_HEADER /* point hint flags */ - typedef enum + typedef enum AF_Flags_ { AF_FLAG_NONE = 0, @@ -87,7 +87,7 @@ FT_BEGIN_HEADER /* edge hint flags */ - typedef enum + typedef enum AF_Edge_Flags_ { 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; - + } AF_GlyphHintsRec; diff --git a/lib/3rdparty/freetype/src/autofit/afindic.c b/lib/3rdparty/freetype/src/autofit/afindic.c index c6e7522e15b..1d9e9eafbad 100644 --- a/lib/3rdparty/freetype/src/autofit/afindic.c +++ b/lib/3rdparty/freetype/src/autofit/afindic.c @@ -43,7 +43,7 @@ static void af_indic_metrics_scale( AF_LatinMetrics metrics, - AF_Scaler scaler ) + AF_Scaler scaler ) { /* use CJK routines */ af_cjk_metrics_scale( metrics, scaler ); @@ -52,7 +52,7 @@ 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 ); @@ -61,8 +61,8 @@ 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 ); @@ -81,16 +81,14 @@ static const AF_Script_UniRangeRec af_indic_uniranges[] = { #if 0 - { 0x0100, 0xFFFF }, /* why this? */ + AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ), /* why this? */ #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, @@ -102,7 +100,7 @@ (AF_Script_InitHintsFunc) af_indic_hints_init, (AF_Script_ApplyHintsFunc) af_indic_hints_apply - }; + ) #else /* !AF_CONFIG_OPTION_INDIC */ @@ -112,9 +110,7 @@ }; - 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, @@ -126,7 +122,7 @@ (AF_Script_InitHintsFunc) NULL, (AF_Script_ApplyHintsFunc) NULL - }; + ) #endif /* !AF_CONFIG_OPTION_INDIC */ diff --git a/lib/3rdparty/freetype/src/autofit/afindic.h b/lib/3rdparty/freetype/src/autofit/afindic.h index b242b261443..662a982200e 100644 --- a/lib/3rdparty/freetype/src/autofit/afindic.h +++ b/lib/3rdparty/freetype/src/autofit/afindic.h @@ -27,8 +27,7 @@ FT_BEGIN_HEADER /* the Indic-specific script class */ - FT_CALLBACK_TABLE const AF_ScriptClassRec - af_indic_script_class; + AF_DECLARE_SCRIPT_CLASS(af_indic_script_class) /* */ diff --git a/lib/3rdparty/freetype/src/autofit/aflatin.c b/lib/3rdparty/freetype/src/autofit/aflatin.c index 52e952d9885..e6882d5e7b5 100644 --- a/lib/3rdparty/freetype/src/autofit/aflatin.c +++ b/lib/3rdparty/freetype/src/autofit/aflatin.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -16,6 +16,9 @@ /***************************************************************************/ +#include <ft2build.h> +#include FT_ADVANCES_H + #include "aflatin.h" #include "aferrors.h" @@ -146,7 +149,8 @@ #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", @@ -195,7 +199,8 @@ 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; @@ -328,7 +333,7 @@ * 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; } @@ -379,7 +384,7 @@ 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. */ @@ -393,6 +398,52 @@ } + 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; + FT_Fixed advance, old_advance = 0; + + + /* 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; + + + 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 ) @@ -426,6 +477,7 @@ /* 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 ); @@ -1004,12 +1056,14 @@ if ( !found ) { - AF_Edge edge; + AF_Edge edge; /* 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; @@ -1565,7 +1619,7 @@ /* not hinted, appear a lot bolder or thinner than the */ /* vertical stems. */ - FT_Int delta; + FT_Pos delta; dist = ( dist + 22 ) & ~63; @@ -1649,7 +1703,7 @@ 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; @@ -2006,7 +2060,10 @@ 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 ); @@ -2122,33 +2179,37 @@ 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, @@ -2160,7 +2221,7 @@ (AF_Script_InitHintsFunc) af_latin_hints_init, (AF_Script_ApplyHintsFunc) af_latin_hints_apply - }; + ) /* END */ diff --git a/lib/3rdparty/freetype/src/autofit/aflatin.h b/lib/3rdparty/freetype/src/autofit/aflatin.h index 3251d3783f3..660b10c83f7 100644 --- a/lib/3rdparty/freetype/src/autofit/aflatin.h +++ b/lib/3rdparty/freetype/src/autofit/aflatin.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -27,8 +27,7 @@ FT_BEGIN_HEADER /* 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 */ @@ -138,6 +137,10 @@ FT_BEGIN_HEADER FT_Face face, FT_ULong charcode ); + FT_LOCAL( void ) + af_latin_metrics_check_digits( AF_LatinMetrics metrics, + FT_Face face ); + /*************************************************************************/ /*************************************************************************/ diff --git a/lib/3rdparty/freetype/src/autofit/aflatin2.c b/lib/3rdparty/freetype/src/autofit/aflatin2.c index 0b4177414c1..5cbeb296b58 100644 --- a/lib/3rdparty/freetype/src/autofit/aflatin2.c +++ b/lib/3rdparty/freetype/src/autofit/aflatin2.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -16,6 +16,8 @@ /***************************************************************************/ +#include FT_ADVANCES_H + #include "aflatin.h" #include "aflatin2.h" #include "aferrors.h" @@ -154,7 +156,7 @@ #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", @@ -336,7 +338,7 @@ * 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; } @@ -401,6 +403,52 @@ } + 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; + FT_Fixed advance, old_advance = 0; + + + /* 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; + + + 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 ) @@ -434,6 +482,7 @@ /* 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 ); @@ -944,6 +993,9 @@ } } } +#if 0 + } +#endif /* now, compute the `serif' segments */ for ( seg1 = segments; seg1 < segment_limit; seg1++ ) @@ -1736,7 +1788,6 @@ 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; @@ -2047,54 +2098,60 @@ /* 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 - 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 + if ( has_serifs || !anchor ) { /* @@ -2150,7 +2207,10 @@ 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 ); @@ -2260,15 +2320,13 @@ 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, @@ -2280,7 +2338,7 @@ (AF_Script_InitHintsFunc) af_latin2_hints_init, (AF_Script_ApplyHintsFunc) af_latin2_hints_apply - }; + ) /* END */ diff --git a/lib/3rdparty/freetype/src/autofit/aflatin2.h b/lib/3rdparty/freetype/src/autofit/aflatin2.h index 34eda058229..925c6214db3 100644 --- a/lib/3rdparty/freetype/src/autofit/aflatin2.h +++ b/lib/3rdparty/freetype/src/autofit/aflatin2.h @@ -27,8 +27,7 @@ FT_BEGIN_HEADER /* the latin-specific script class */ - FT_CALLBACK_TABLE const AF_ScriptClassRec - af_latin2_script_class; + AF_DECLARE_SCRIPT_CLASS(af_latin2_script_class) /* */ diff --git a/lib/3rdparty/freetype/src/autofit/afloader.c b/lib/3rdparty/freetype/src/autofit/afloader.c index 4e4373a4924..6dd9f2a314a 100644 --- a/lib/3rdparty/freetype/src/autofit/afloader.c +++ b/lib/3rdparty/freetype/src/autofit/afloader.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -19,7 +19,6 @@ #include "afloader.h" #include "afhints.h" #include "afglobal.h" -#include "aflatin.h" #include "aferrors.h" @@ -165,9 +164,10 @@ /* 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 */ @@ -183,9 +183,9 @@ 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 */ @@ -216,8 +216,9 @@ } 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 ); @@ -228,8 +229,9 @@ } 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 ); @@ -412,7 +414,8 @@ 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; @@ -420,13 +423,9 @@ 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 ); @@ -436,6 +435,12 @@ 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, @@ -515,9 +520,13 @@ 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 ); } diff --git a/lib/3rdparty/freetype/src/autofit/afmodule.c b/lib/3rdparty/freetype/src/autofit/afmodule.c index cd5e1cc218b..ec2d707c9f9 100644 --- a/lib/3rdparty/freetype/src/autofit/afmodule.c +++ b/lib/3rdparty/freetype/src/autofit/afmodule.c @@ -18,6 +18,7 @@ #include "afmodule.h" #include "afloader.h" +#include "afpic.h" #ifdef AF_DEBUG int _af_debug; @@ -66,19 +67,15 @@ } - 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 - }; + ) + FT_DEFINE_MODULE(autofit_module_class, - FT_CALLBACK_TABLE_DEF - const FT_Module_Class autofit_module_class = - { FT_MODULE_HINTER, sizeof ( FT_AutofitterRec ), @@ -86,12 +83,12 @@ 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 - }; + ) /* END */ diff --git a/lib/3rdparty/freetype/src/autofit/afmodule.h b/lib/3rdparty/freetype/src/autofit/afmodule.h index 36268a0890a..d9792399b63 100644 --- a/lib/3rdparty/freetype/src/autofit/afmodule.h +++ b/lib/3rdparty/freetype/src/autofit/afmodule.h @@ -20,13 +20,13 @@ #define __AFMODULE_H__ #include <ft2build.h> +#include FT_INTERNAL_OBJECTS_H #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 diff --git a/lib/3rdparty/freetype/src/autofit/afpic.c b/lib/3rdparty/freetype/src/autofit/afpic.c new file mode 100644 index 00000000000..76822c301a8 --- /dev/null +++ b/lib/3rdparty/freetype/src/autofit/afpic.c @@ -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/lib/3rdparty/freetype/src/autofit/afpic.h b/lib/3rdparty/freetype/src/autofit/afpic.h new file mode 100644 index 00000000000..80e62d39a99 --- /dev/null +++ b/lib/3rdparty/freetype/src/autofit/afpic.h @@ -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 */ diff --git a/lib/3rdparty/freetype/src/autofit/aftypes.h b/lib/3rdparty/freetype/src/autofit/aftypes.h index 9c27df2d9f0..5574f0c302b 100644 --- a/lib/3rdparty/freetype/src/autofit/aftypes.h +++ b/lib/3rdparty/freetype/src/autofit/aftypes.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -58,7 +58,8 @@ FT_BEGIN_HEADER #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; @@ -69,7 +70,7 @@ extern void* _af_debug_hints; #else /* !AF_DEBUG */ -#define AF_LOG( x ) do ; while ( 0 ) /* nothing */ +#define AF_LOG( x ) do { } while ( 0 ) /* nothing */ #endif /* !AF_DEBUG */ @@ -202,7 +203,7 @@ extern void* _af_debug_hints; * 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 */ @@ -260,12 +261,12 @@ extern void* _af_debug_hints; * 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_INDIC = 3, + AF_SCRIPT_INDIC = 3, #ifdef FT_OPTION_AUTOFIT2 AF_SCRIPT_LATIN2, #endif @@ -284,6 +285,7 @@ extern void* _af_debug_hints; { AF_ScriptClass clazz; AF_ScalerRec scaler; + FT_Bool digits_have_same_width; } AF_ScriptMetricsRec, *AF_ScriptMetrics; @@ -320,6 +322,8 @@ extern void* _af_debug_hints; } AF_Script_UniRangeRec; +#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) } + 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 } */ - 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; @@ -338,6 +342,56 @@ extern void* _af_debug_hints; } 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 + /* */ diff --git a/lib/3rdparty/freetype/src/autofit/afwarp.c b/lib/3rdparty/freetype/src/autofit/afwarp.c index 6c31cffc4e1..f5bb9b18ad9 100644 --- a/lib/3rdparty/freetype/src/autofit/afwarp.c +++ b/lib/3rdparty/freetype/src/autofit/afwarp.c @@ -317,7 +317,7 @@ { 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; diff --git a/lib/3rdparty/freetype/src/autofit/autofit.c b/lib/3rdparty/freetype/src/autofit/autofit.c index 2fe66a990ec..83b613e79b3 100644 --- a/lib/3rdparty/freetype/src/autofit/autofit.c +++ b/lib/3rdparty/freetype/src/autofit/autofit.c @@ -18,6 +18,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> +#include "afpic.c" #include "afangles.c" #include "afglobal.c" #include "afhints.c" diff --git a/lib/3rdparty/freetype/src/autofit/module.mk b/lib/3rdparty/freetype/src/autofit/module.mk index 4a386ce66cc..6ec60912ab7 100644 --- a/lib/3rdparty/freetype/src/autofit/module.mk +++ b/lib/3rdparty/freetype/src/autofit/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/base/Jamfile b/lib/3rdparty/freetype/src/base/Jamfile index aeffe388e58..832e8b84249 100644 --- a/lib/3rdparty/freetype/src/base/Jamfile +++ b/lib/3rdparty/freetype/src/base/Jamfile @@ -1,6 +1,6 @@ # 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, @@ -17,8 +17,11 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; 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 { @@ -31,11 +34,11 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; # 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 ; } @@ -46,5 +49,12 @@ if $(MAC) { Library $(FT2_LIB) : ftmac.c ; } +else if $(OS) = MACOSX +{ + if $(FT2_MULTI) + { + Library $(FT2_LIB) : ftmac.c ; + } +} # end of src/base Jamfile diff --git a/lib/3rdparty/freetype/src/base/_ftmulfix_ros.c b/lib/3rdparty/freetype/src/base/_ftmulfix_ros.c deleted file mode 100644 index b5d448c9509..00000000000 --- a/lib/3rdparty/freetype/src/base/_ftmulfix_ros.c +++ /dev/null @@ -1,92 +0,0 @@ - FT_EXPORT_DEF( FT_Long ) - 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; - - - __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), "=d"(b) - : "a"(a), "d"(b) - : "%ecx" - ); - return result; - -#elif 1 - - FT_Long sa, sb; - FT_ULong ua, ub; - - - if ( a == 0 || b == 0x10000L ) - return a; - - sa = ( a >> ( sizeof ( a ) * 8 - 1 ) ); - a = ( a ^ sa ) - sa; - sb = ( b >> ( sizeof ( b ) * 8 - 1 ) ); - b = ( b ^ sb ) - sb; - - ua = (FT_ULong)a; - ub = (FT_ULong)b; - - if ( ua <= 2048 && ub <= 1048576L ) - ua = ( ua * ub + 0x8000U ) >> 16; - else - { - FT_ULong al = ua & 0xFFFFU; - - - ua = ( ua >> 16 ) * ub + al * ( ub >> 16 ) + - ( ( al * ( ub & 0xFFFFU ) + 0x8000U ) >> 16 ); - } - - sa ^= sb, - ua = (FT_ULong)(( ua ^ sa ) - sa); - - return (FT_Long)ua; - -#else /* 0 */ - - FT_Long s; - FT_ULong ua, ub; - - - if ( a == 0 || b == 0x10000L ) - return a; - - s = a; a = FT_ABS( a ); - s ^= b; b = FT_ABS( b ); - - ua = (FT_ULong)a; - ub = (FT_ULong)b; - - if ( ua <= 2048 && ub <= 1048576L ) - ua = ( ua * ub + 0x8000UL ) >> 16; - else - { - FT_ULong al = ua & 0xFFFFUL; - - - ua = ( ua >> 16 ) * ub + al * ( ub >> 16 ) + - ( ( al * ( ub & 0xFFFFUL ) + 0x8000UL ) >> 16 ); - } - - return ( s < 0 ? -(FT_Long)ua : (FT_Long)ua ); - -#endif /* 0 */ - - } diff --git a/lib/3rdparty/freetype/src/base/basepic.c b/lib/3rdparty/freetype/src/base/basepic.c new file mode 100644 index 00000000000..c0bccb6959b --- /dev/null +++ b/lib/3rdparty/freetype/src/base/basepic.c @@ -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/lib/3rdparty/freetype/src/base/basepic.h b/lib/3rdparty/freetype/src/base/basepic.h new file mode 100644 index 00000000000..bb17745769e --- /dev/null +++ b/lib/3rdparty/freetype/src/base/basepic.h @@ -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/lib/3rdparty/freetype/src/base/ftadvanc.c b/lib/3rdparty/freetype/src/base/ftadvanc.c new file mode 100644 index 00000000000..8ab7fcb9271 --- /dev/null +++ b/lib/3rdparty/freetype/src/base/ftadvanc.c @@ -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 */ diff --git a/lib/3rdparty/freetype/src/base/ftbase.c b/lib/3rdparty/freetype/src/base/ftbase.c index d176b8150c3..6a27ea95a62 100644 --- a/lib/3rdparty/freetype/src/base/ftbase.c +++ b/lib/3rdparty/freetype/src/base/ftbase.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -20,19 +20,22 @@ #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 "ftnames.c" #include "ftobjs.c" #include "ftoutln.c" #include "ftrfork.c" +#include "ftsnames.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 */ diff --git a/lib/3rdparty/freetype/src/base/ftbase.h b/lib/3rdparty/freetype/src/base/ftbase.h new file mode 100644 index 00000000000..1dc49f3bdf6 --- /dev/null +++ b/lib/3rdparty/freetype/src/base/ftbase.h @@ -0,0 +1,57 @@ +/***************************************************************************/ +/* */ +/* ftbase.h */ +/* */ +/* The FreeType private functions used in base module (specification). */ +/* */ +/* Copyright 2008, 2010 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( 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( 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 */ diff --git a/lib/3rdparty/freetype/src/base/ftbbox.c b/lib/3rdparty/freetype/src/base/ftbbox.c index 532ab135791..4b8e9112fee 100644 --- a/lib/3rdparty/freetype/src/base/ftbbox.c +++ b/lib/3rdparty/freetype/src/base/ftbbox.c @@ -4,7 +4,7 @@ /* */ /* FreeType bbox computation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2006 by */ +/* Copyright 1996-2001, 2002, 2004, 2006, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -29,6 +29,7 @@ #include FT_IMAGE_H #include FT_OUTLINE_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_OBJECTS_H typedef struct TBBox_Rec_ @@ -139,7 +140,7 @@ /* */ /* <Description> */ /* This function is used as a `conic_to' emitter during */ - /* FT_Raster_Decompose(). It checks a conic Bezier curve with the */ + /* FT_Outline_Decompose(). It checks a conic Bezier curve with the */ /* current bounding box, and computes its extrema if necessary to */ /* update it. */ /* */ @@ -506,7 +507,7 @@ /* */ /* <Description> */ /* This function is used as a `cubic_to' emitter during */ - /* FT_Raster_Decompose(). It checks a cubic Bezier curve with the */ + /* FT_Outline_Decompose(). It checks a cubic Bezier curve with the */ /* current bounding box, and computes its extrema if necessary to */ /* update it. */ /* */ @@ -559,6 +560,13 @@ 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 */ @@ -628,18 +636,13 @@ /* 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; +#ifdef FT_CONFIG_OPTION_PIC + FT_Outline_Funcs bbox_interface; + Init_Class_bbox_interface(&bbox_interface); +#endif user.bbox = bbox; diff --git a/lib/3rdparty/freetype/src/base/ftbitmap.c b/lib/3rdparty/freetype/src/base/ftbitmap.c index c847eb00d24..82b5baf2a64 100644 --- a/lib/3rdparty/freetype/src/base/ftbitmap.c +++ b/lib/3rdparty/freetype/src/base/ftbitmap.c @@ -2,10 +2,9 @@ /* */ /* 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, */ @@ -19,6 +18,7 @@ #include <ft2build.h> #include FT_BITMAP_H +#include FT_IMAGE_H #include FT_INTERNAL_OBJECTS_H @@ -228,8 +228,12 @@ 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; @@ -388,6 +392,8 @@ 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; @@ -482,6 +488,8 @@ 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; @@ -603,6 +611,31 @@ } + /* 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 ) diff --git a/lib/3rdparty/freetype/src/base/ftcalc.c b/lib/3rdparty/freetype/src/base/ftcalc.c index 63aed95b75e..3892fabfe93 100644 --- a/lib/3rdparty/freetype/src/base/ftcalc.c +++ b/lib/3rdparty/freetype/src/base/ftcalc.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -33,10 +33,14 @@ #include <ft2build.h> +#include FT_GLYPH_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 */ @@ -106,12 +110,12 @@ FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt32( FT_Int32 x ) { - FT_ULong val, root, newroot, mask; + FT_UInt32 val, root, newroot, mask; root = 0; - mask = 0x40000000L; - val = (FT_ULong)x; + mask = (FT_UInt32)0x40000000UL; + val = (FT_UInt32)x; do { @@ -192,15 +196,33 @@ 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; - 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 ); - return ( s > 0 ) ? c : -c ; + + return ( s > 0 ) ? c : -c; + +#endif /* FT_MULFIX_ASSEMBLER */ } @@ -340,6 +362,7 @@ long s; + /* XXX: this function does not allow 64-bit arguments */ if ( a == 0 || b == c ) return a; @@ -355,12 +378,12 @@ 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 ); - a = ft_div64by32( temp.hi, temp.lo, c ); + a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c ); } else a = 0x7FFFFFFFL; @@ -394,8 +417,8 @@ 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; @@ -412,31 +435,18 @@ 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; @@ -445,6 +455,24 @@ 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 ) ); @@ -512,13 +540,14 @@ 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 */ - q = 0x7FFFFFFFL; + q = (FT_UInt32)0x7FFFFFFFL; } else if ( ( a >> 16 ) == 0 ) { @@ -535,7 +564,7 @@ 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 ); @@ -666,6 +695,110 @@ #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 ) @@ -709,7 +842,7 @@ 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 */ @@ -758,8 +891,9 @@ 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; @@ -775,7 +909,8 @@ #endif } - return result; + /* XXX: only the sign of return value, +1/0/-1 must be used */ + return (FT_Int)result; } diff --git a/lib/3rdparty/freetype/src/base/ftcid.c b/lib/3rdparty/freetype/src/base/ftcid.c new file mode 100644 index 00000000000..733aae14751 --- /dev/null +++ b/lib/3rdparty/freetype/src/base/ftcid.c @@ -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 */ diff --git a/lib/3rdparty/freetype/src/base/ftdbgmem.c b/lib/3rdparty/freetype/src/base/ftdbgmem.c index 52a5c2057f8..160269d1929 100644 --- a/lib/3rdparty/freetype/src/base/ftdbgmem.c +++ b/lib/3rdparty/freetype/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -33,8 +33,7 @@ * 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; @@ -422,7 +421,7 @@ "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" ); } } @@ -990,7 +989,7 @@ #else /* !FT_DEBUG_MEMORY */ /* ANSI C doesn't like empty source files */ - const FT_Byte _debug_mem_dummy = 0; + typedef int _debug_mem_dummy; #endif /* !FT_DEBUG_MEMORY */ diff --git a/lib/3rdparty/freetype/src/base/ftdebug.c b/lib/3rdparty/freetype/src/base/ftdebug.c index c55d3c8114e..2adbeabeb23 100644 --- a/lib/3rdparty/freetype/src/base/ftdebug.c +++ b/lib/3rdparty/freetype/src/base/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -46,7 +46,7 @@ #include FT_INTERNAL_DEBUG_H -#if defined( FT_DEBUG_LEVEL_ERROR ) +#ifdef FT_DEBUG_LEVEL_ERROR /* documentation is in ftdebug.h */ @@ -57,7 +57,7 @@ va_start( ap, fmt ); - vprintf( fmt, ap ); + vfprintf( stderr, fmt, ap ); va_end( ap ); } @@ -71,7 +71,7 @@ va_start( ap, fmt ); - vprintf( fmt, ap ); + vfprintf( stderr, fmt, ap ); va_end( ap ); exit( EXIT_FAILURE ); diff --git a/lib/3rdparty/freetype/src/base/ftfstype.c b/lib/3rdparty/freetype/src/base/ftfstype.c new file mode 100644 index 00000000000..d0ef7b7c1b0 --- /dev/null +++ b/lib/3rdparty/freetype/src/base/ftfstype.c @@ -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 */ diff --git a/lib/3rdparty/freetype/src/base/ftgloadr.c b/lib/3rdparty/freetype/src/base/ftgloadr.c index ab52621ea67..ac0010ddd88 100644 --- a/lib/3rdparty/freetype/src/base/ftgloadr.c +++ b/lib/3rdparty/freetype/src/base/ftgloadr.c @@ -218,6 +218,9 @@ { 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; @@ -246,6 +249,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/base/ftglyph.c b/lib/3rdparty/freetype/src/base/ftglyph.c index 969c5dbb05a..3505d6dde9a 100644 --- a/lib/3rdparty/freetype/src/base/ftglyph.c +++ b/lib/3rdparty/freetype/src/base/ftglyph.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -34,6 +34,7 @@ #include FT_BITMAP_H #include FT_INTERNAL_OBJECTS_H +#include "basepic.h" /*************************************************************************/ /* */ @@ -45,68 +46,6 @@ #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; - } - - /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -191,9 +130,7 @@ } - 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, @@ -203,7 +140,7 @@ 0, /* FT_Glyph_TransformFunc */ ft_bitmap_glyph_bbox, 0 /* FT_Glyph_PrepareFunc */ - }; + ) /*************************************************************************/ @@ -317,9 +254,7 @@ } - 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, @@ -329,7 +264,7 @@ ft_outline_glyph_transform, ft_outline_glyph_bbox, ft_outline_glyph_prepare - }; + ) /*************************************************************************/ @@ -376,10 +311,16 @@ const FT_Glyph_Class* clazz; + /* check arguments */ + if ( !target ) + { + error = FT_Err_Invalid_Argument; + goto Exit; + } + *target = 0; - /* check arguments */ - if ( !target || !source || !source->clazz ) + if ( !source || !source->clazz ) { error = FT_Err_Invalid_Argument; goto Exit; @@ -429,11 +370,11 @@ /* 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 */ + /* if it is an outline */ else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) - clazz = &ft_outline_glyph_class; + clazz = FT_OUTLINE_GLYPH_CLASS_GET; else { @@ -574,6 +515,10 @@ const FT_Glyph_Class* clazz; +#ifdef FT_CONFIG_OPTION_PIC + FT_Library library = FT_GLYPH( glyph )->library; +#endif + /* check argument */ if ( !the_glyph ) @@ -589,7 +534,7 @@ 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 ) @@ -602,7 +547,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/base/ftinit.c b/lib/3rdparty/freetype/src/base/ftinit.c index 7af19c3d80f..f94f25a83c1 100644 --- a/lib/3rdparty/freetype/src/base/ftinit.c +++ b/lib/3rdparty/freetype/src/base/ftinit.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -42,6 +42,7 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_MODULE_H +#include "basepic.h" /*************************************************************************/ @@ -53,11 +54,13 @@ #undef FT_COMPONENT #define FT_COMPONENT trace_init +#ifndef FT_CONFIG_OPTION_PIC + #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 -#define FT_USE_MODULE( x ) extern const FT_Module_Class x; +#define FT_USE_MODULE( type, x ) extern const type x; #endif @@ -65,7 +68,7 @@ #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[] = @@ -74,6 +77,99 @@ 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 = (BasePIC*)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 = (BasePIC*)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 */ @@ -86,16 +182,15 @@ /* 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 ) - { - 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++; } } @@ -127,13 +222,7 @@ 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 ); - } return error; } diff --git a/lib/3rdparty/freetype/src/base/ftlcdfil.c b/lib/3rdparty/freetype/src/base/ftlcdfil.c index f40bbeae5fb..80640111c4f 100644 --- a/lib/3rdparty/freetype/src/base/ftlcdfil.c +++ b/lib/3rdparty/freetype/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -161,7 +161,7 @@ #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, @@ -181,7 +181,7 @@ 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; @@ -266,7 +266,7 @@ #endif /* USE_LEGACY */ - FT_EXPORT( FT_Error ) + FT_EXPORT_DEF( FT_Error ) FT_Library_SetLcdFilter( FT_Library library, FT_LcdFilter filter ) { @@ -296,13 +296,13 @@ #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 - 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; @@ -311,7 +311,7 @@ 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; @@ -335,7 +335,7 @@ #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - FT_EXPORT( FT_Error ) + FT_EXPORT_DEF( FT_Error ) FT_Library_SetLcdFilter( FT_Library library, FT_LcdFilter filter ) { diff --git a/lib/3rdparty/freetype/src/base/ftmac.c b/lib/3rdparty/freetype/src/base/ftmac.c index fd6201adb5a..63f927d57d8 100644 --- a/lib/3rdparty/freetype/src/base/ftmac.c +++ b/lib/3rdparty/freetype/src/base/ftmac.c @@ -8,7 +8,8 @@ /* 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, */ @@ -67,7 +68,9 @@ #include <ft2build.h> #include FT_FREETYPE_H +#include FT_TRUETYPE_TAGS_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 */ @@ -76,20 +79,36 @@ #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 +#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 - /* 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 @@ -100,6 +119,7 @@ #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, @@ -115,19 +135,28 @@ /* 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 ) { -#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 ); + return fnfErr; -#else +#else /* 32bit Carbon API on legacy platforms */ OSStatus err; FSSpec spec; @@ -214,7 +243,8 @@ 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 ); @@ -239,8 +269,8 @@ static OSErr - FT_FSPathMakeRes( const UInt8* pathname, - short* res ) + FT_FSPathMakeRes( const UInt8* pathname, + ResFileRefNum* res ) { OSErr err; FSRef ref; @@ -357,7 +387,7 @@ static void parse_fond( char* fond_data, short* have_sfnt, - short* sfnt_id, + ResID* sfnt_id, Str255 lwfn_file_name, short face_index ) { @@ -374,6 +404,10 @@ 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 ) ) { @@ -425,9 +459,10 @@ 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++ ) @@ -463,8 +498,8 @@ 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. */ @@ -504,10 +539,10 @@ count_faces( Handle fond, const UInt8* pathname ) { - short sfnt_id; + ResID sfnt_id; short have_sfnt, have_lwfn; Str255 lwfn_file_name; - UInt8 buff[HFS_MAXPATHLEN]; + UInt8 buff[PATH_MAX]; FT_Error err; short num_faces; @@ -539,13 +574,13 @@ 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; - short res_id; + ResID res_id; unsigned char *buffer, *p, *size_p = NULL; FT_ULong total_size = 0; FT_ULong old_total_size = 0; @@ -563,7 +598,7 @@ for (;;) { - post_data = Get1Resource( 'POST', res_id++ ); + post_data = Get1Resource( TTAG_POST, res_id++ ); if ( post_data == NULL ) break; /* we are done */ @@ -602,7 +637,7 @@ for (;;) { - post_data = Get1Resource( 'POST', res_id++ ); + post_data = Get1Resource( TTAG_POST, res_id++ ); if ( post_data == NULL ) break; /* we are done */ @@ -654,120 +689,17 @@ } - /* 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 ) { - 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 ) ) @@ -792,7 +724,7 @@ /* 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 ) { @@ -801,11 +733,11 @@ 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 ); @@ -818,31 +750,56 @@ 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 ) { - 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 ) ) @@ -855,7 +812,7 @@ 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; @@ -869,7 +826,7 @@ } 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; } @@ -883,25 +840,25 @@ 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; - 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 ); - 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] ) { - short res; + ResFileRefNum res; res = HomeResFile( fond ); @@ -909,7 +866,7 @@ goto found_no_lwfn_file; { - UInt8 path_fond[HFS_MAXPATHLEN]; + UInt8 path_fond[PATH_MAX]; FSRef ref; @@ -961,7 +918,7 @@ /* 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 */ @@ -1029,6 +986,8 @@ /* 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, @@ -1038,7 +997,7 @@ FT_Error error; FT_Open_Args args; OSErr err; - UInt8 pathname[HFS_MAXPATHLEN]; + UInt8 pathname[PATH_MAX]; if ( !ref ) @@ -1068,13 +1027,15 @@ /* 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 ) { -#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 ); diff --git a/lib/3rdparty/freetype/src/base/ftmm.c b/lib/3rdparty/freetype/src/base/ftmm.c index 586d5e84db1..0307729811f 100644 --- a/lib/3rdparty/freetype/src/base/ftmm.c +++ b/lib/3rdparty/freetype/src/base/ftmm.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -52,7 +52,7 @@ *aservice, MULTI_MASTERS ); - if ( aservice ) + if ( *aservice ) error = FT_Err_Ok; } diff --git a/lib/3rdparty/freetype/src/base/ftobjs.c b/lib/3rdparty/freetype/src/base/ftobjs.c index fa080940045..46bcd3bb8b2 100644 --- a/lib/3rdparty/freetype/src/base/ftobjs.c +++ b/lib/3rdparty/freetype/src/base/ftobjs.c @@ -4,7 +4,8 @@ /* */ /* 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, */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,6 +27,7 @@ #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 @@ -36,8 +38,13 @@ #include FT_SERVICE_KERNING_H #include FT_SERVICE_TRUETYPE_ENGINE_H +#ifdef FT_CONFIG_OPTION_MAC_FONTS +#include "ftbase.h" +#endif + #define GRID_FIT_METRICS + FT_BASE_DEF( FT_Pointer ) ft_service_list_lookup( FT_ServiceDesc service_descriptors, const char* service_id ) @@ -128,13 +135,14 @@ FT_Stream stream; + *astream = 0; + if ( !library ) return FT_Err_Invalid_Library_Handle; if ( !args ) return FT_Err_Invalid_Argument; - *astream = 0; memory = library->memory; if ( FT_NEW( stream ) ) @@ -196,6 +204,12 @@ } + /*************************************************************************/ + /* */ + /* 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 @@ -244,7 +258,7 @@ 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 ); @@ -337,14 +351,18 @@ /* 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 ); + } } @@ -542,7 +560,7 @@ FT_Driver driver; FT_GlyphSlot slot; FT_Library library; - FT_Bool autohint = 0; + FT_Bool autohint = FALSE; FT_Module hinter; @@ -577,31 +595,33 @@ * 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. * - * - 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 ); @@ -609,7 +629,7 @@ if ( mode == FT_RENDER_MODE_LIGHT || face->internal->ignore_unpatented_hinter ) - autohint = 1; + autohint = TRUE; } } @@ -634,12 +654,24 @@ 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; + + + /* 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 ); + error = hinting->load_glyph( (FT_AutoHinter)hinter, + slot, face->size, + glyph_index, load_flags ); + + internal->transform_flags = transform_flags; + } } else { @@ -679,8 +711,8 @@ } /* compute the linear advance in 16.16 pixels */ - if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 && - ( face->face_flags & FT_FACE_FLAG_SCALABLE ) ) + if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 && + ( FT_IS_SCALABLE( face ) ) ) { FT_Size_Metrics* metrics = &face->size->metrics; @@ -710,11 +742,30 @@ renderer, slot, &internal->transform_matrix, &internal->transform_delta ); + else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { + /* apply `standard' transformation if no renderer is available */ + if ( &internal->transform_matrix ) + FT_Outline_Transform( &slot->outline, + &internal->transform_matrix ); + + if ( &internal->transform_delta ) + FT_Outline_Translate( &slot->outline, + internal->transform_delta.x, + internal->transform_delta.y ); + } + /* transform advance */ FT_Vector_Transform( &slot->advance, &internal->transform_matrix ); } } + FT_TRACE5(( " x advance: %d\n" , slot->advance.x )); + FT_TRACE5(( " y advance: %d\n" , slot->advance.y )); + + FT_TRACE5(( " linear x advance: %d\n" , slot->linearHoriAdvance )); + FT_TRACE5(( " linear y advance: %d\n" , slot->linearVertAdvance )); + /* do we need to render the image now? */ if ( !error && slot->format != FT_GLYPH_FORMAT_BITMAP && @@ -883,14 +934,13 @@ /* 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; - FT_CharMap* unicmap = NULL; /* some UCS-2 map, if we found it */ /* caller should have already checked that `face' is valid */ @@ -935,36 +985,75 @@ { 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 && - 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]->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]; - 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; } + /*************************************************************************/ + /* */ + /* <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> */ @@ -1013,15 +1102,17 @@ 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 - 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; @@ -1044,7 +1135,8 @@ 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; @@ -1057,7 +1149,7 @@ /* 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 */ @@ -1076,11 +1168,12 @@ args.flags = FT_OPEN_PATHNAME; args.pathname = (char*)pathname; + args.stream = NULL; 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 */ @@ -1102,12 +1195,13 @@ 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 ); } -#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. */ @@ -1136,9 +1230,9 @@ /* 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 ) { @@ -1154,7 +1248,7 @@ /* 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, @@ -1191,7 +1285,7 @@ /* 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, @@ -1224,20 +1318,172 @@ 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 +#ifdef FT_MACINTOSH + FT_Stream_Free( stream, 0 ); +#else { FT_Stream_Close( stream ); FT_FREE( stream ); } +#endif 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. */ @@ -1392,17 +1638,25 @@ 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; - 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, @@ -1441,7 +1695,7 @@ 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 ) { @@ -1456,7 +1710,7 @@ 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 ) { @@ -1488,6 +1742,9 @@ FT_Long dlen, offset; + if ( NULL == stream ) + return FT_Err_Invalid_Stream_Operation; + error = FT_Stream_Seek( stream, 0 ); if ( error ) goto Exit; @@ -1544,7 +1801,7 @@ FT_Error errors[FT_RACCESS_N_RULES]; FT_Open_Args args2; - FT_Stream stream2; + FT_Stream stream2 = 0; FT_Raccess_Guess( library, stream, @@ -1599,7 +1856,7 @@ } - /* 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) */ @@ -1642,6 +1899,7 @@ face_index, aface, args ); return error; } +#endif #endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */ @@ -1657,10 +1915,12 @@ 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_Module* cur; + FT_Module* limit; /* test for valid `library' delayed to */ @@ -1675,7 +1935,7 @@ /* create input stream */ error = FT_Stream_New( library, args, &stream ); if ( error ) - goto Exit; + goto Fail3; memory = library->memory; @@ -1712,8 +1972,8 @@ 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++ ) @@ -1738,6 +1998,28 @@ 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; } @@ -1747,7 +2029,8 @@ /* 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; @@ -2143,12 +2426,24 @@ 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 ) - 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; } @@ -2212,8 +2507,8 @@ } 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; @@ -2324,8 +2619,8 @@ else { FT_ZERO( metrics ); - metrics->x_scale = 1L << 22; - metrics->y_scale = 1L << 22; + metrics->x_scale = 1L << 16; + metrics->y_scale = 1L << 16; } } @@ -2631,6 +2926,8 @@ 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; @@ -2791,7 +3088,12 @@ 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; } @@ -2849,6 +3151,186 @@ } + /* 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 ) @@ -2891,7 +3373,7 @@ ((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; @@ -2991,6 +3473,7 @@ FT_ULong *length ) { FT_Service_SFNT_Table service; + FT_ULong offset; if ( !face || !FT_IS_SFNT( face ) ) @@ -3000,7 +3483,7 @@ 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 ); } @@ -3061,11 +3544,11 @@ if ( size == NULL ) - return FT_Err_Bad_Argument; + return FT_Err_Invalid_Argument; 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 */ @@ -3325,7 +3808,7 @@ while ( renderer ) { error = renderer->render( renderer, slot, render_mode, NULL ); - if ( !error || + if ( !error || FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph ) break; @@ -3723,11 +4206,23 @@ 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; - 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; @@ -3735,6 +4230,9 @@ return FT_Err_Ok; Fail: +#ifdef FT_CONFIG_OPTION_PIC + ft_pic_container_destroy( library ); +#endif FT_FREE( library ); return error; } @@ -3812,7 +4310,11 @@ faces = &FT_DRIVER(module)->faces_list; while ( faces->head ) + { FT_Done_Face( FT_FACE( faces->head->data ) ); + if ( faces->head ) + FT_TRACE0(( "FT_Done_Library: failed to free some faces\n" )); + } } } @@ -3847,6 +4349,11 @@ 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; } diff --git a/lib/3rdparty/freetype/src/base/ftotval.c b/lib/3rdparty/freetype/src/base/ftotval.c index b6de6db85d1..20ed686eee6 100644 --- a/lib/3rdparty/freetype/src/base/ftotval.c +++ b/lib/3rdparty/freetype/src/base/ftotval.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -18,6 +18,7 @@ #include <ft2build.h> #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_OPENTYPE_VALIDATE_H +#include FT_OPENTYPE_VALIDATE_H /* documentation is in ftotval.h */ diff --git a/lib/3rdparty/freetype/src/base/ftoutln.c b/lib/3rdparty/freetype/src/base/ftoutln.c index 6926f3a09a7..b69df84c04c 100644 --- a/lib/3rdparty/freetype/src/base/ftoutln.c +++ b/lib/3rdparty/freetype/src/base/ftoutln.c @@ -4,7 +4,7 @@ /* */ /* FreeType outline management (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,6 +26,7 @@ #include <ft2build.h> #include FT_OUTLINE_H #include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DEBUG_H #include FT_TRIGONOMETRY_H @@ -83,21 +84,25 @@ 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; - 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; - tags = outline->tags + first; + tags = outline->tags + first; tag = FT_CURVE_TAG( tags[0] ); /* A contour cannot start with a cubic control point! */ @@ -128,6 +133,8 @@ 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; @@ -148,6 +155,8 @@ 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; @@ -174,6 +183,10 @@ 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; @@ -186,6 +199,10 @@ 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; @@ -194,6 +211,10 @@ 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; @@ -209,8 +230,11 @@ 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 ) { @@ -220,12 +244,22 @@ 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; } + 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; } @@ -233,6 +267,8 @@ } /* 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: @@ -242,9 +278,11 @@ first = last + 1; } - return 0; + FT_TRACE5(( "FT_Outline_Decompose: Done\n", n )); + return FT_Err_Ok; Exit: + FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error )); return error; Invalid_Outline: @@ -266,9 +304,9 @@ *anoutline = null_outline; - if ( FT_NEW_ARRAY( anoutline->points, numPoints * 2L ) || - FT_NEW_ARRAY( anoutline->tags, numPoints ) || - FT_NEW_ARRAY( anoutline->contours, numContours ) ) + if ( FT_NEW_ARRAY( anoutline->points, numPoints ) || + FT_NEW_ARRAY( anoutline->tags, numPoints ) || + FT_NEW_ARRAY( anoutline->contours, numContours ) ) goto Fail; anoutline->n_points = (FT_UShort)numPoints; @@ -474,12 +512,14 @@ FT_Pos yOffset ) { FT_UShort n; - FT_Vector* vec = outline->points; + FT_Vector* vec; if ( !outline ) return; + vec = outline->points; + for ( n = 0; n < outline->n_points; n++ ) { vec->x += xOffset; @@ -556,7 +596,7 @@ FT_Raster_Params* params ) { FT_Error error; - FT_Bool update = 0; + FT_Bool update = FALSE; FT_Renderer renderer; FT_ListNode node; @@ -587,7 +627,7 @@ /* 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 */ @@ -626,13 +666,13 @@ } - /* 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_Pos xz, yz; + FT_Pos xz, yz; if ( !vector || !matrix ) @@ -1005,7 +1045,7 @@ } } - if ( xmin == 32768 ) + if ( xmin == 32768L ) return FT_ORIENTATION_TRUETYPE; ray_y[0] = ( xmin_ymin * 3 + xmin_ymax ) >> 2; diff --git a/lib/3rdparty/freetype/src/base/ftpatent.c b/lib/3rdparty/freetype/src/base/ftpatent.c index d63f191c3ea..501cab52cad 100644 --- a/lib/3rdparty/freetype/src/base/ftpatent.c +++ b/lib/3rdparty/freetype/src/base/ftpatent.c @@ -5,7 +5,7 @@ /* FreeType API for checking patented TrueType bytecode instructions */ /* (body). */ /* */ -/* Copyright 2007 by David Turner. */ +/* Copyright 2007, 2008, 2010 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 */ @@ -103,6 +103,7 @@ } Exit: + FT_UNUSED( error ); FT_FRAME_EXIT(); return result; } @@ -113,7 +114,7 @@ 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; @@ -122,15 +123,19 @@ if ( service ) { - FT_ULong offset, size; + FT_UInt i = 0; + FT_ULong tag_i = 0, offset_i = 0, length_i = 0; - error = service->table_info( face, tag, &offset, &size ); - if ( error || - FT_STREAM_SEEK( offset ) ) + for ( i = 0; !error && tag_i != tag ; i++ ) + error = service->table_info( face, i, + &tag_i, &offset_i, &length_i ); + + if ( error || + FT_STREAM_SEEK( offset_i ) ) goto Exit; - result = _tt_check_patents_in_range( stream, size ); + result = _tt_check_patents_in_range( stream, length_i ); } Exit: @@ -260,7 +265,7 @@ FT_Face_SetUnpatentedHinting( FT_Face face, FT_Bool value ) { - FT_Bool result = 0; + FT_Bool result = FALSE; #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \ diff --git a/lib/3rdparty/freetype/src/base/ftpfr.c b/lib/3rdparty/freetype/src/base/ftpfr.c index 9e930ddf7e3..f9592bb1bba 100644 --- a/lib/3rdparty/freetype/src/base/ftpfr.c +++ b/lib/3rdparty/freetype/src/base/ftpfr.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -46,6 +46,9 @@ FT_Service_PfrMetrics service; + if ( !face ) + return FT_Err_Invalid_Argument; + service = ft_pfr_check( face ); if ( service ) { @@ -55,14 +58,17 @@ ametrics_x_scale, ametrics_y_scale ); } - else if ( face ) + else { 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 ) @@ -70,11 +76,15 @@ 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; } @@ -92,14 +102,15 @@ 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 ); - else if ( face ) + else error = FT_Get_Kerning( face, left, right, FT_KERNING_UNSCALED, avector ); - else - error = FT_Err_Invalid_Argument; return error; } diff --git a/lib/3rdparty/freetype/src/base/ftpic.c b/lib/3rdparty/freetype/src/base/ftpic.c new file mode 100644 index 00000000000..d5271a9726a --- /dev/null +++ b/lib/3rdparty/freetype/src/base/ftpic.c @@ -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 */ diff --git a/lib/3rdparty/freetype/src/base/ftrfork.c b/lib/3rdparty/freetype/src/base/ftrfork.c index a4f726d9303..133c2de0575 100644 --- a/lib/3rdparty/freetype/src/base/ftrfork.c +++ b/lib/3rdparty/freetype/src/base/ftrfork.c @@ -4,7 +4,7 @@ /* */ /* 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 */ @@ -132,6 +132,19 @@ } + 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, @@ -141,12 +154,13 @@ 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 ); @@ -179,28 +193,43 @@ 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 ) { - (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 ) ) - { - 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; + error = FT_Err_Ok; - return FT_Err_Ok; + Exit: + FT_FREE( ref ); + return error; } } @@ -227,7 +256,7 @@ 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 ); @@ -235,56 +264,63 @@ 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 * 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 * base_file_name, + char *base_file_name, 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, - 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 * 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 * 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 * 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 * base_file_name, + char *base_file_name, char **result_file_name, FT_Long *result_offset ); @@ -298,7 +334,7 @@ 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 ); @@ -329,6 +365,7 @@ 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, @@ -339,7 +376,11 @@ 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 ; @@ -354,14 +395,20 @@ 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 ) { - FT_Int32 magic = ( 0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x07 ); + FT_Int32 magic = ( 0x00 << 24 ) | + ( 0x05 << 16 ) | + ( 0x16 << 8 ) | + 0x07; *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 ); } @@ -370,14 +417,20 @@ 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 ) { - FT_Int32 magic = (0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x00); + FT_Int32 magic = ( 0x00 << 24 ) | + ( 0x05 << 16 ) | + ( 0x16 << 8 ) | + 0x00; *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 ); } @@ -386,7 +439,7 @@ 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 ) { @@ -416,7 +469,7 @@ 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 ) { @@ -433,7 +486,7 @@ 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 ) ) @@ -449,10 +502,46 @@ } + 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, - char * base_file_name, + char *base_file_name, char **result_file_name, FT_Long *result_offset ) { @@ -479,7 +568,7 @@ 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 ) { @@ -505,7 +594,7 @@ 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 ) { @@ -536,7 +625,7 @@ 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 ) { @@ -568,7 +657,7 @@ 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 ) { @@ -620,8 +709,12 @@ 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; } @@ -629,7 +722,7 @@ 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; @@ -659,9 +752,9 @@ const char *insertion ) { char* new_name; - char* tmp; + const char* tmp; const char* slash; - unsigned new_length; + size_t new_length; FT_Error error = FT_Err_Ok; FT_UNUSED( error ); @@ -701,7 +794,7 @@ 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 ) diff --git a/lib/3rdparty/freetype/src/base/ftsnames.c b/lib/3rdparty/freetype/src/base/ftsnames.c new file mode 100644 index 00000000000..3447888ca23 --- /dev/null +++ b/lib/3rdparty/freetype/src/base/ftsnames.c @@ -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 */ diff --git a/lib/3rdparty/freetype/src/base/ftstream.c b/lib/3rdparty/freetype/src/base/ftstream.c index a067a1fde7d..b638599dbcf 100644 --- a/lib/3rdparty/freetype/src/base/ftstream.c +++ b/lib/3rdparty/freetype/src/base/ftstream.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -60,13 +60,12 @@ FT_Error error = FT_Err_Ok; - stream->pos = pos; - 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; @@ -75,12 +74,16 @@ /* 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; } + if ( !error ) + stream->pos = pos; + return error; } @@ -89,6 +92,9 @@ 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 ) ); } @@ -121,7 +127,8 @@ 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; @@ -142,8 +149,8 @@ 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; @@ -208,7 +215,7 @@ FT_Stream_ReleaseFrame( FT_Stream stream, FT_Byte** pbytes ) { - if ( stream->read ) + if ( stream && stream->read ) { FT_Memory memory = stream->memory; @@ -253,8 +260,8 @@ 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 ); @@ -270,8 +277,8 @@ 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; @@ -456,7 +463,8 @@ 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; @@ -502,8 +510,8 @@ 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; @@ -549,8 +557,8 @@ 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; @@ -596,8 +604,8 @@ 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; @@ -642,9 +650,10 @@ 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; + FT_ERROR(( "FT_Stream_ReadLong:" + " invalid i/o; pos = 0x%lx, size = 0x%lx\n", + stream->pos, stream->size )); return 0; } @@ -688,10 +697,10 @@ 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; + FT_ERROR(( "FT_Stream_ReadLongLE:" + " invalid i/o; pos = 0x%lx, size = 0x%lx\n", + stream->pos, stream->size )); return 0; } @@ -704,12 +713,13 @@ { FT_Error error; FT_Bool frame_accessed = 0; - FT_Byte* cursor = stream->cursor; - + FT_Byte* cursor; if ( !fields || !stream ) return FT_Err_Invalid_Argument; + cursor = stream->cursor; + error = FT_Err_Ok; do { diff --git a/lib/3rdparty/freetype/src/base/ftstroke.c b/lib/3rdparty/freetype/src/base/ftstroke.c index 8f7e0459da4..75bcbded6a3 100644 --- a/lib/3rdparty/freetype/src/base/ftstroke.c +++ b/lib/3rdparty/freetype/src/base/ftstroke.c @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006 by */ +/* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -230,7 +230,7 @@ /***************************************************************************/ /***************************************************************************/ - typedef enum + typedef enum FT_StrokeTags_ { FT_STROKE_TAG_ON = 1, /* on-curve point */ FT_STROKE_TAG_CUBIC = 2, /* cubic off-point */ @@ -261,7 +261,7 @@ { 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 ) @@ -279,6 +279,7 @@ border->max_points = cur_max; } + Exit: return error; } @@ -346,7 +347,7 @@ } border->start = -1; - border->movable = 0; + border->movable = FALSE; } @@ -355,7 +356,7 @@ FT_Vector* to, FT_Bool movable ) { - FT_Error error = 0; + FT_Error error = FT_Err_Ok; FT_ASSERT( border->start >= 0 ); @@ -410,7 +411,7 @@ border->num_points += 2; } - border->movable = 0; + border->movable = FALSE; return error; } @@ -443,7 +444,7 @@ border->num_points += 3; } - border->movable = 0; + border->movable = FALSE; return error; } @@ -461,7 +462,7 @@ 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 */ @@ -527,12 +528,12 @@ { /* 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->movable = 0; + border->movable = FALSE; - return ft_stroke_border_lineto( border, to, 0 ); + return ft_stroke_border_lineto( border, to, FALSE ); } @@ -547,7 +548,7 @@ border->num_points = 0; border->max_points = 0; border->start = -1; - border->valid = 0; + border->valid = FALSE; } @@ -556,7 +557,7 @@ { border->num_points = 0; border->start = -1; - border->valid = 0; + border->valid = FALSE; } @@ -572,7 +573,7 @@ border->num_points = 0; border->max_points = 0; border->start = -1; - border->valid = 0; + border->valid = FALSE; } @@ -581,7 +582,7 @@ 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; @@ -605,9 +606,6 @@ if ( tags[0] & FT_STROKE_TAG_END ) { - if ( in_contour == 0 ) - goto Fail; - in_contour = 0; num_contours++; } @@ -616,7 +614,7 @@ if ( in_contour != 0 ) goto Fail; - border->valid = 1; + border->valid = TRUE; Exit: *anum_points = num_points; @@ -708,7 +706,7 @@ FT_Bool valid; FT_StrokeBorderRec borders[2]; - FT_Memory memory; + FT_Library library; } FT_StrokerRec; @@ -731,7 +729,7 @@ 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 ); @@ -779,13 +777,13 @@ { 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] ); - stroker->memory = NULL; + stroker->library = NULL; FT_FREE( stroker ); } } @@ -798,7 +796,7 @@ { 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; @@ -813,7 +811,7 @@ radius, stroker->angle_in + rotate, total ); - border->movable = 0; + border->movable = FALSE; return error; } @@ -824,7 +822,7 @@ FT_Angle angle, FT_Int side ) { - FT_Error error = 0; + FT_Error error = FT_Err_Ok; if ( stroker->line_cap == FT_STROKER_LINECAP_ROUND ) @@ -849,7 +847,7 @@ 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; @@ -859,7 +857,32 @@ 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: @@ -876,7 +899,7 @@ 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 ); @@ -900,7 +923,7 @@ stroker->angle_out + rotate ); delta.x += stroker->center.x; delta.y += stroker->center.y; - border->movable = 0; + border->movable = FALSE; } else { @@ -911,7 +934,7 @@ delta.y += stroker->center.y; } - error = ft_stroke_border_lineto( border, &delta, 0 ); + error = ft_stroke_border_lineto( border, &delta, FALSE ); return error; } @@ -928,9 +951,7 @@ if ( stroker->line_join == FT_STROKER_LINEJOIN_ROUND ) - { error = ft_stroker_arcto( stroker, side ); - } else { /* this is a mitered or beveled corner */ @@ -943,7 +964,7 @@ 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; @@ -958,8 +979,9 @@ thcos = FT_Cos( theta ); sigma = FT_MulFix( stroker->miter_limit, thcos ); - if ( sigma >= 0x10000L ) - miter = 0; + /* FT_Sin(x) = 0 for x <= 57 */ + if ( sigma >= 0x10000L || ft_pos_abs( theta ) <= 57 ) + miter = FALSE; if ( miter ) /* this is a miter (broken angle) */ { @@ -983,7 +1005,7 @@ 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; @@ -992,7 +1014,7 @@ 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; @@ -1001,7 +1023,7 @@ 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) */ @@ -1016,8 +1038,9 @@ 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, @@ -1025,7 +1048,7 @@ 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 ); } } @@ -1037,7 +1060,7 @@ 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; @@ -1069,7 +1092,7 @@ /* 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 ) @@ -1099,7 +1122,7 @@ /* save angle for last cap */ stroker->subpath_angle = start_angle; - stroker->first_point = 0; + stroker->first_point = FALSE; Exit: return error; @@ -1112,7 +1135,7 @@ 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; @@ -1143,7 +1166,7 @@ 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++ ) { @@ -1153,7 +1176,7 @@ 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; @@ -1176,12 +1199,12 @@ 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_Bool first_arc = 1; + FT_Bool first_arc = TRUE; arc = bez_stack; @@ -1206,7 +1229,7 @@ if ( first_arc ) { - first_arc = 0; + first_arc = FALSE; start_angle = angle_in; @@ -1275,12 +1298,12 @@ 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_Bool first_arc = 1; + FT_Bool first_arc = TRUE; arc = bez_stack; @@ -1308,7 +1331,7 @@ if ( first_arc ) { - first_arc = 0; + first_arc = FALSE; /* process corner if necessary */ start_angle = angle_in; @@ -1338,7 +1361,7 @@ phi1 = (angle_mid + angle_in ) / 2; phi2 = (angle_mid + angle_out ) / 2; length1 = FT_DivFix( stroker->radius, FT_Cos( theta1 ) ); - length2 = FT_DivFix( stroker->radius, FT_Cos(theta2) ); + length2 = FT_DivFix( stroker->radius, FT_Cos( theta2 ) ); for ( side = 0; side <= 1; side++ ) { @@ -1386,15 +1409,16 @@ { /* 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; - return 0; + + return FT_Err_Ok; } @@ -1402,10 +1426,10 @@ 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_Error error = 0; + FT_Error error = FT_Err_Ok; FT_ASSERT( left->start >= 0 ); @@ -1452,8 +1476,8 @@ left->num_points = left->start; right->num_points += new_points; - right->movable = 0; - left->movable = 0; + right->movable = FALSE; + left->movable = FALSE; } Exit: @@ -1467,7 +1491,8 @@ 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 ) { @@ -1480,8 +1505,8 @@ 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; @@ -1494,7 +1519,7 @@ /* 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 { @@ -1536,8 +1561,8 @@ } /* 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: @@ -1692,7 +1717,7 @@ 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! */ @@ -1711,13 +1736,10 @@ } else { - /* if both first and last points are conic, */ - /* start at their middle and record its position */ - /* for closure */ + /* if both first and last points are conic, */ + /* start at their middle */ v_start.x = ( v_start.x + v_last.x ) / 2; v_start.y = ( v_start.y + v_last.y ) / 2; - - v_last = v_start; } point--; tags--; @@ -1836,7 +1858,7 @@ first = last + 1; } - return 0; + return FT_Err_Ok; Exit: return error; @@ -1845,8 +1867,13 @@ 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; +#endif +#include "basepic.h" /* documentation is in ftstroke.h */ @@ -1858,13 +1885,14 @@ { 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 ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class ) + if ( glyph == NULL || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET ) goto Exit; { @@ -1884,7 +1912,7 @@ FT_UInt num_points, num_contours; - error = FT_Stroker_ParseOutline( stroker, outline, 0 ); + error = FT_Stroker_ParseOutline( stroker, outline, FALSE ); if ( error ) goto Fail; @@ -1931,13 +1959,14 @@ { 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 ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class ) + if ( glyph == NULL || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET ) goto Exit; { @@ -1967,7 +1996,7 @@ border = FT_STROKER_BORDER_LEFT; } - error = FT_Stroker_ParseOutline( stroker, outline, 0 ); + error = FT_Stroker_ParseOutline( stroker, outline, FALSE ); if ( error ) goto Fail; diff --git a/lib/3rdparty/freetype/src/base/ftsynth.c b/lib/3rdparty/freetype/src/base/ftsynth.c index ff88ce96c5b..ba3c633e28e 100644 --- a/lib/3rdparty/freetype/src/base/ftsynth.c +++ b/lib/3rdparty/freetype/src/base/ftsynth.c @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,11 +18,21 @@ #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 + /*************************************************************************/ + /* */ + /* 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 + /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -68,36 +78,13 @@ /*************************************************************************/ - 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; - FT_Face face = FT_SLOT_FACE( slot ); + FT_Face face = slot->face; FT_Error error; FT_Pos xstr, ystr; @@ -113,8 +100,8 @@ if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) { - error = FT_Outline_Embolden( &slot->outline, xstr ); /* ignore error */ + (void)FT_Outline_Embolden( &slot->outline, xstr ); /* this is more than enough for most glyphs; if you need accurate */ /* values, you have to call FT_Outline_Get_CBox */ @@ -123,11 +110,24 @@ } 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; - 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; @@ -151,8 +151,9 @@ 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 ) - slot->bitmap_top += ystr >> 6; + slot->bitmap_top += (FT_Int)( ystr >> 6 ); } diff --git a/lib/3rdparty/freetype/src/base/ftsystem.c b/lib/3rdparty/freetype/src/base/ftsystem.c index f61a3edfb6b..4d06d6db5cc 100644 --- a/lib/3rdparty/freetype/src/base/ftsystem.c +++ b/lib/3rdparty/freetype/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -205,7 +205,8 @@ 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 ); } @@ -226,8 +227,8 @@ 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; } @@ -294,7 +295,7 @@ #ifdef FT_DEBUG_MEMORY ft_mem_debug_done( memory ); #endif - memory->free( memory, memory ); + ft_sfree( memory ); } diff --git a/lib/3rdparty/freetype/src/base/fttrigon.c b/lib/3rdparty/freetype/src/base/fttrigon.c index 9f513946b83..fdf433ab866 100644 --- a/lib/3rdparty/freetype/src/base/fttrigon.c +++ b/lib/3rdparty/freetype/src/base/fttrigon.c @@ -72,10 +72,10 @@ 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 */ @@ -86,7 +86,7 @@ hi += lo1 >> 16; if ( lo1 < lo3 ) - hi += 0x10000UL; + hi += (FT_UInt32)0x10000UL; val = (FT_Fixed)hi; @@ -433,7 +433,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/base/rules.mk b/lib/3rdparty/freetype/src/base/rules.mk index d6e441254b7..10f578abc8c 100644 --- a/lib/3rdparty/freetype/src/base/rules.mk +++ b/lib/3rdparty/freetype/src/base/rules.mk @@ -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, @@ -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_H is defined in freetype.mk to simplify the dependency rules. 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). # -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)/ftnames.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 + +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 @@ -77,13 +83,13 @@ BASE_SRC_S := $(BASE_DIR)/ftbase.c # 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 # -$(OBJ_DIR)/%.$O: $(BASE_DIR)/%.c $(FREETYPE_H) +$(OBJ_DIR)/%.$O: $(BASE_DIR)/%.c $(FREETYPE_H) $(BASE_H) $(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) diff --git a/lib/3rdparty/freetype/src/bdf/bdf.h b/lib/3rdparty/freetype/src/bdf/bdf.h index 1b64426aad6..561b4158a51 100644 --- a/lib/3rdparty/freetype/src/bdf/bdf.h +++ b/lib/3rdparty/freetype/src/bdf/bdf.h @@ -114,8 +114,8 @@ FT_BEGIN_HEADER union { char* atom; - long int32; - unsigned long card32; + long l; + unsigned long ul; } value; /* Value of the property. */ @@ -160,7 +160,7 @@ FT_BEGIN_HEADER typedef struct _hashnode_ { const char* key; - void* data; + size_t data; } _hashnode, *hashnode; diff --git a/lib/3rdparty/freetype/src/bdf/bdfdrivr.c b/lib/3rdparty/freetype/src/bdf/bdfdrivr.c index 74cc2f1b8bf..631ec460e7c 100644 --- a/lib/3rdparty/freetype/src/bdf/bdfdrivr.c +++ b/lib/3rdparty/freetype/src/bdf/bdfdrivr.c @@ -2,7 +2,7 @@ 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 @@ -53,7 +53,7 @@ THE SOFTWARE. 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; @@ -92,8 +92,8 @@ THE SOFTWARE. { 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; @@ -101,7 +101,7 @@ THE SOFTWARE. while ( min < max ) { - FT_UInt32 code; + FT_ULong code; mid = ( min + max ) >> 1; @@ -131,9 +131,9 @@ THE SOFTWARE. { 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; @@ -141,7 +141,7 @@ THE SOFTWARE. while ( min < max ) { - FT_UInt32 code; + FT_ULong code; /* same as BDF_encoding_el.enc */ mid = ( min + max ) >> 1; @@ -169,7 +169,14 @@ THE SOFTWARE. } 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; } @@ -181,7 +188,9 @@ THE SOFTWARE. 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; - 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; @@ -282,7 +290,7 @@ THE SOFTWARE. /* add_style_name and setwidth_name */ if ( nn == 0 || nn == 3 ) { - int mm; + size_t 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 */ { - 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 ); @@ -419,7 +432,7 @@ THE SOFTWARE. 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 ); @@ -427,21 +440,21 @@ THE SOFTWARE. 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 ) - 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 ) - resolution_x = (FT_Short)prop->value.int32; + resolution_x = (FT_Short)prop->value.l; 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 ) { @@ -472,7 +485,12 @@ THE SOFTWARE. (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: - if ( height == ( bsize->y_ppem + 32 ) >> 6 ) + if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) ) error = BDF_Err_Ok; break; @@ -664,7 +682,10 @@ THE SOFTWARE. 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 */ @@ -736,13 +757,23 @@ THE SOFTWARE. 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->u.integer = prop->value.int32; + aproperty->u.integer = (FT_Int32)prop->value.l; 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->u.cardinal = prop->value.card32; + aproperty->u.cardinal = (FT_UInt32)prop->value.ul; break; default: diff --git a/lib/3rdparty/freetype/src/bdf/bdfdrivr.h b/lib/3rdparty/freetype/src/bdf/bdfdrivr.h index 86f40ee4af5..db7093bb45f 100644 --- a/lib/3rdparty/freetype/src/bdf/bdfdrivr.h +++ b/lib/3rdparty/freetype/src/bdf/bdfdrivr.h @@ -36,6 +36,10 @@ THE SOFTWARE. FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_PIC +#error "this module does not support PIC yet" +#endif + typedef struct BDF_encoding_el_ { diff --git a/lib/3rdparty/freetype/src/bdf/bdflib.c b/lib/3rdparty/freetype/src/bdf/bdflib.c index 512cd62c3ec..5fa5868c715 100644 --- a/lib/3rdparty/freetype/src/bdf/bdflib.c +++ b/lib/3rdparty/freetype/src/bdf/bdflib.c @@ -1,6 +1,6 @@ /* * 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 @@ -281,7 +281,7 @@ static FT_Error hash_insert( char* key, - void* data, + size_t data, hashtable* ht, FT_Memory memory ) { @@ -415,18 +415,18 @@ 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; - 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 ) @@ -614,8 +614,8 @@ { _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; @@ -648,8 +648,8 @@ { 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; @@ -971,7 +971,7 @@ 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; @@ -991,7 +991,9 @@ 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; @@ -1003,7 +1005,7 @@ 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; @@ -1018,8 +1020,8 @@ bdf_get_property( char* name, bdf_font_t* font ) { - hashnode hn; - unsigned long propid; + hashnode hn; + size_t propid; if ( name == 0 || *name == 0 ) @@ -1028,7 +1030,7 @@ 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 ); @@ -1131,11 +1133,11 @@ _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 ) @@ -1150,7 +1152,7 @@ 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 ) { @@ -1261,7 +1263,7 @@ char* name, char* value ) { - unsigned long propid; + size_t propid; hashnode hn; bdf_property_t *prop, *fp; FT_Memory memory = font->memory; @@ -1273,7 +1275,7 @@ { /* 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 ) { @@ -1289,11 +1291,11 @@ break; case BDF_INTEGER: - fp->value.int32 = _bdf_atol( value, 0, 10 ); + fp->value.l = _bdf_atol( value, 0, 10 ); break; case BDF_CARDINAL: - fp->value.card32 = _bdf_atoul( value, 0, 10 ); + fp->value.ul = _bdf_atoul( value, 0, 10 ); break; default: @@ -1335,7 +1337,7 @@ 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 @@ -1359,11 +1361,11 @@ break; case BDF_INTEGER: - fp->value.int32 = _bdf_atol( value, 0, 10 ); + fp->value.l = _bdf_atol( value, 0, 10 ); break; case BDF_CARDINAL: - fp->value.card32 = _bdf_atoul( value, 0, 10 ); + fp->value.ul = _bdf_atoul( value, 0, 10 ); break; } @@ -1372,7 +1374,7 @@ 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 ) @@ -1387,13 +1389,19 @@ /* 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 ) - font->font_ascent = fp->value.int32; + font->font_ascent = fp->value.l; 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 ) { + 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' ) @@ -2038,7 +2046,7 @@ p->memory = 0; { /* setup */ - unsigned long i; + size_t i; bdf_property_t* prop; @@ -2048,7 +2056,7 @@ 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; @@ -2072,6 +2080,7 @@ 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 ) ) @@ -2465,7 +2474,7 @@ hn = hash_lookup( name, (hashtable *)font->internal ); - return hn ? ( font->props + (unsigned long)hn->data ) : 0; + return hn ? ( font->props + hn->data ) : 0; } diff --git a/lib/3rdparty/freetype/src/bdf/module.mk b/lib/3rdparty/freetype/src/bdf/module.mk index dfaa2744ebe..fe06ae8e064 100644 --- a/lib/3rdparty/freetype/src/bdf/module.mk +++ b/lib/3rdparty/freetype/src/bdf/module.mk @@ -27,7 +27,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/bdf/rules.mk b/lib/3rdparty/freetype/src/bdf/rules.mk index 25d98e55b07..6ff1614ddec 100644 --- a/lib/3rdparty/freetype/src/bdf/rules.mk +++ b/lib/3rdparty/freetype/src/bdf/rules.mk @@ -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 @@ -29,7 +29,7 @@ # bdf driver directory # -BDF_DIR := $(SRC_DIR)/bdf +BDF_DIR := $(SRC_DIR)/bdf 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_DIR)/bdfdrivr.h + $(BDF_DIR)/bdfdrivr.h \ + $(BDF_DIR)/bdferror.h # bdf driver object(s) # diff --git a/lib/3rdparty/freetype/src/cache/ftcbasic.c b/lib/3rdparty/freetype/src/cache/ftcbasic.c index f2e62297d5c..ebc8871ccc0 100644 --- a/lib/3rdparty/freetype/src/cache/ftcbasic.c +++ b/lib/3rdparty/freetype/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -17,15 +17,17 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_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" +#define FT_COMPONENT trace_cache + #ifdef FT_CONFIG_OPTION_OLD_INTERNALS @@ -140,8 +142,18 @@ 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 ) - result = face->num_glyphs; + result = (FT_UInt)face->num_glyphs; return result; } @@ -304,7 +316,7 @@ 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; @@ -320,13 +332,13 @@ 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. */ - if ( type->width >= 0x10000 ) + if ( (FT_ULong)type->width >= 0x10000L ) { FTC_OldImageDesc desc = (FTC_OldImageDesc)type; @@ -341,10 +353,16 @@ #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.load_flags = type->flags; + query.attrs.load_flags = (FT_UInt)type->flags; } query.attrs.scaler.pixel = 1; @@ -365,7 +383,7 @@ error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex, FTC_GQUERY( &query ), - (FTC_Node*) &node ); + &node ); #endif if ( !error ) { @@ -373,8 +391,8 @@ if ( anode ) { - *anode = FTC_NODE( node ); - FTC_NODE( node )->ref_count++; + *anode = node; + node->ref_count++; } } @@ -394,7 +412,7 @@ 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; @@ -410,8 +428,15 @@ 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.load_flags = load_flags; + query.attrs.load_flags = (FT_UInt)load_flags; hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex; @@ -428,8 +453,8 @@ if ( anode ) { - *anode = FTC_NODE( node ); - FTC_NODE( node )->ref_count++; + *anode = node; + node->ref_count++; } } @@ -438,7 +463,7 @@ } - + #ifdef FT_CONFIG_OPTION_OLD_INTERNALS /* yet another backwards-legacy structure */ @@ -630,7 +655,7 @@ { FT_Error error; FTC_BasicQueryRec query; - FTC_SNode node = 0; /* make compiler happy */ + FTC_Node node = 0; /* make compiler happy */ FT_UInt32 hash; @@ -643,12 +668,12 @@ *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. */ - if ( type->width >= 0x10000 ) + if ( (FT_ULong)type->width >= 0x10000L ) { FTC_OldImageDesc desc = (FTC_OldImageDesc)type; @@ -663,10 +688,16 @@ #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.load_flags = type->flags; + query.attrs.load_flags = (FT_UInt)type->flags; } query.attrs.scaler.pixel = 1; @@ -690,17 +721,18 @@ hash, gindex, FTC_GQUERY( &query ), - (FTC_Node*)&node ); + &node ); #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 ) { - *anode = FTC_NODE( node ); - FTC_NODE( node )->ref_count++; + *anode = node; + node->ref_count++; } Exit: @@ -720,7 +752,7 @@ { FT_Error error; FTC_BasicQueryRec query; - FTC_SNode node = 0; /* make compiler happy */ + FTC_Node node = 0; /* make compiler happy */ FT_UInt32 hash; @@ -733,8 +765,15 @@ *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.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 ) + @@ -750,12 +789,13 @@ if ( error ) goto Exit; - *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex ); + *ansbit = FTC_SNODE( node )->sbits + + ( gindex - FTC_GNODE( node )->gindex ); if ( anode ) { - *anode = FTC_NODE( node ); - FTC_NODE( node )->ref_count++; + *anode = node; + node->ref_count++; } Exit: diff --git a/lib/3rdparty/freetype/src/cache/ftccache.c b/lib/3rdparty/freetype/src/cache/ftccache.c index f3e699c3850..463addd99be 100644 --- a/lib/3rdparty/freetype/src/cache/ftccache.c +++ b/lib/3rdparty/freetype/src/cache/ftccache.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -24,6 +24,9 @@ #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 @@ -93,9 +96,9 @@ 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? */ @@ -153,7 +156,7 @@ /* 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; @@ -216,7 +219,7 @@ if ( node == NULL ) { - FT_ERROR(( "ftc_node_hash_unlink: unknown node!\n" )); + FT_TRACE0(( "ftc_node_hash_unlink: unknown node\n" )); return; } @@ -273,7 +276,7 @@ /* 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 @@ -283,7 +286,7 @@ #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 @@ -302,7 +305,7 @@ #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 } @@ -347,7 +350,7 @@ { FTC_Manager manager = cache->manager; FT_UFast i; - FT_UInt count; + FT_UFast count; count = cache->p + cache->mask + 1; diff --git a/lib/3rdparty/freetype/src/cache/ftccache.h b/lib/3rdparty/freetype/src/cache/ftccache.h index 8c0a7c94fe6..2082bc4f4f0 100644 --- a/lib/3rdparty/freetype/src/cache/ftccache.h +++ b/lib/3rdparty/freetype/src/cache/ftccache.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -91,7 +91,7 @@ FT_BEGIN_HEADER FT_Pointer query, FTC_Cache cache ); - typedef FT_ULong + typedef FT_Offset (*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; - FT_UInt cache_size; + FT_Offset cache_size; 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); \ - FT_UInt _idx; \ + FT_UFast _idx; \ \ \ error = 0; \ @@ -246,8 +246,7 @@ FT_BEGIN_HEADER error = FTC_Cache_NewNode( _cache, _hash, query, &_node ); \ \ _Ok: \ - _pnode = (FTC_Node*)(void*)&(node); \ - *_pnode = _node; \ + node = _node; \ FT_END_STMNT #else /* !FTC_INLINE */ diff --git a/lib/3rdparty/freetype/src/cache/ftccback.h b/lib/3rdparty/freetype/src/cache/ftccback.h index 86e72a7514f..4d0818db277 100644 --- a/lib/3rdparty/freetype/src/cache/ftccback.h +++ b/lib/3rdparty/freetype/src/cache/ftccback.h @@ -36,7 +36,7 @@ FT_Pointer gquery, FTC_Cache cache ); - FT_LOCAL( FT_ULong ) + FT_LOCAL( FT_Offset ) ftc_inode_weight( FTC_Node inode, FTC_Cache cache ); @@ -50,7 +50,7 @@ FT_Pointer gquery, FTC_Cache cache ); - FT_LOCAL( FT_ULong ) + FT_LOCAL( FT_Offset ) ftc_snode_weight( FTC_Node snode, FTC_Cache cache ); diff --git a/lib/3rdparty/freetype/src/cache/ftccmap.c b/lib/3rdparty/freetype/src/cache/ftccmap.c index aa59307f489..a802b0557c7 100644 --- a/lib/3rdparty/freetype/src/cache/ftccmap.c +++ b/lib/3rdparty/freetype/src/cache/ftccmap.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -22,7 +22,6 @@ #include "ftcmanag.h" #include FT_INTERNAL_MEMORY_H #include FT_INTERNAL_DEBUG_H -#include FT_TRUETYPE_IDS_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_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_ @@ -175,7 +174,7 @@ /* 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 ) { @@ -284,15 +283,27 @@ { 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_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 ) { - FT_ERROR(( "FTC_CMapCache_Lookup: bad arguments, returning 0!\n" )); + FT_TRACE0(( "FTC_CMapCache_Lookup: bad arguments, returning 0\n" )); return 0; } @@ -311,7 +322,7 @@ * 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; @@ -362,18 +373,21 @@ 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; - 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 */ - 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; - 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; @@ -381,7 +395,9 @@ 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; @@ -393,16 +409,18 @@ 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 ); - if ( old != cmap ) + if ( old != cmap && !no_cmap_change ) 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: diff --git a/lib/3rdparty/freetype/src/cache/ftcglyph.c b/lib/3rdparty/freetype/src/cache/ftcglyph.c index 5c03abe0552..a9ab0c319f7 100644 --- a/lib/3rdparty/freetype/src/cache/ftcglyph.c +++ b/lib/3rdparty/freetype/src/cache/ftcglyph.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -20,8 +20,6 @@ #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" @@ -73,8 +71,8 @@ FT_UNUSED( cache ); - return FT_BOOL( gnode->family == gquery->family && - gnode->gindex == gquery->gindex ); + return FT_BOOL( gnode->family == gquery->family && + gnode->gindex == gquery->gindex ); } diff --git a/lib/3rdparty/freetype/src/cache/ftcglyph.h b/lib/3rdparty/freetype/src/cache/ftcglyph.h index 87a4199bfd8..c18f9c3af31 100644 --- a/lib/3rdparty/freetype/src/cache/ftcglyph.h +++ b/lib/3rdparty/freetype/src/cache/ftcglyph.h @@ -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_MruNode _mrunode; \ \ \ _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; \ @@ -303,11 +305,10 @@ FT_BEGIN_HEADER #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, \ - FTC_GQUERY( query ), (FTC_Node*)_n ); \ + FTC_GQUERY( query ), node ); \ + \ FT_END_STMNT #endif /* !FTC_INLINE */ diff --git a/lib/3rdparty/freetype/src/cache/ftcimage.c b/lib/3rdparty/freetype/src/cache/ftcimage.c index 15d4e80c8c3..417daf2aaea 100644 --- a/lib/3rdparty/freetype/src/cache/ftcimage.c +++ b/lib/3rdparty/freetype/src/cache/ftcimage.c @@ -103,12 +103,12 @@ } - 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; - FT_ULong size = 0; + FT_Offset size = 0; FT_Glyph glyph = inode->glyph; FT_UNUSED( ftccache ); @@ -151,7 +151,7 @@ #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 ); diff --git a/lib/3rdparty/freetype/src/cache/ftcmanag.c b/lib/3rdparty/freetype/src/cache/ftcmanag.c index 9d7347c3dfd..f2a298e7d90 100644 --- a/lib/3rdparty/freetype/src/cache/ftcmanag.c +++ b/lib/3rdparty/freetype/src/cache/ftcmanag.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -26,6 +26,10 @@ #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 @@ -78,6 +82,8 @@ } FTC_SizeNodeRec, *FTC_SizeNode; +#define FTC_SIZE_NODE( x ) ( (FTC_SizeNode)( x ) ) + FT_CALLBACK_DEF( void ) ftc_size_node_done( FTC_MruNode ftcnode, @@ -176,12 +182,12 @@ FTC_Scaler scaler, FT_Size *asize ) { - FT_Error error; - FTC_SizeNode node; + FT_Error error; + FTC_MruNode mrunode; if ( asize == NULL ) - return FTC_Err_Bad_Argument; + return FTC_Err_Invalid_Argument; *asize = NULL; @@ -191,14 +197,14 @@ #ifdef FTC_INLINE FTC_MRULIST_LOOKUP_CMP( &manager->sizes, scaler, ftc_size_node_compare, - node, error ); + mrunode, error ); #else - error = FTC_MruList_Lookup( &manager->sizes, scaler, (FTC_MruNode*)&node ); + error = FTC_MruList_Lookup( &manager->sizes, scaler, &mrunode ); #endif if ( !error ) - *asize = node->size; + *asize = FTC_SIZE_NODE( mrunode )->size; return error; } @@ -220,6 +226,8 @@ } FTC_FaceNodeRec, *FTC_FaceNode; +#define FTC_FACE_NODE( x ) ( ( FTC_FaceNode )( x ) ) + FT_CALLBACK_DEF( FT_Error ) ftc_face_node_init( FTC_MruNode ftcnode, @@ -301,12 +309,12 @@ FTC_FaceID face_id, FT_Face *aface ) { - FT_Error error; - FTC_FaceNode node; + FT_Error error; + FTC_MruNode mrunode; if ( aface == NULL ) - return FTC_Err_Bad_Argument; + return FTC_Err_Invalid_Argument; *aface = NULL; @@ -317,14 +325,14 @@ #ifdef FTC_INLINE FTC_MRULIST_LOOKUP_CMP( &manager->faces, face_id, ftc_face_node_compare, - node, error ); + mrunode, error ); #else - error = FTC_MruList_Lookup( &manager->faces, face_id, (FTC_MruNode*)&node ); + error = FTC_MruList_Lookup( &manager->faces, face_id, &mrunode ); #endif if ( !error ) - *aface = node->face; + *aface = FTC_FACE_NODE( mrunode )->face; return error; } @@ -476,8 +484,8 @@ 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 ); @@ -486,8 +494,8 @@ } 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 */ @@ -505,9 +513,9 @@ } 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 )); } } @@ -534,9 +542,9 @@ #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 ) @@ -579,8 +587,8 @@ 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; } @@ -608,7 +616,8 @@ } Exit: - *acache = cache; + if ( acache ) + *acache = cache; return error; } @@ -660,7 +669,9 @@ /* 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 ); diff --git a/lib/3rdparty/freetype/src/cache/ftcmru.c b/lib/3rdparty/freetype/src/cache/ftcmru.c index 3a6c625afa5..9944b58980d 100644 --- a/lib/3rdparty/freetype/src/cache/ftcmru.c +++ b/lib/3rdparty/freetype/src/cache/ftcmru.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -46,7 +46,7 @@ { if ( cnode == node ) { - fprintf( stderr, "FTC_MruNode_Prepend: invalid action!\n" ); + fprintf( stderr, "FTC_MruNode_Prepend: invalid action\n" ); exit( 2 ); } cnode = cnode->next; @@ -94,7 +94,7 @@ } while ( cnode != first ); - fprintf( stderr, "FTC_MruNode_Up: invalid action!\n" ); + fprintf( stderr, "FTC_MruNode_Up: invalid action\n" ); exit( 2 ); Ok: } @@ -141,7 +141,7 @@ } while ( cnode != first ); - fprintf( stderr, "FTC_MruNode_Remove: invalid action!\n" ); + fprintf( stderr, "FTC_MruNode_Remove: invalid action\n" ); exit( 2 ); Ok: } diff --git a/lib/3rdparty/freetype/src/cache/ftcmru.h b/lib/3rdparty/freetype/src/cache/ftcmru.h index c8f0c6ef6e3..5739439f450 100644 --- a/lib/3rdparty/freetype/src/cache/ftcmru.h +++ b/lib/3rdparty/freetype/src/cache/ftcmru.h @@ -107,7 +107,7 @@ FT_BEGIN_HEADER 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; @@ -163,7 +163,7 @@ FT_BEGIN_HEADER 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; \ @@ -180,8 +180,7 @@ FT_BEGIN_HEADER if ( _node != _first ) \ FTC_MruNode_Up( _pfirst, _node ); \ \ - _pnode = (FTC_MruNode*)(void*)&(node); \ - *_pnode = _node; \ + node = _node; \ goto _MruOk; \ } \ _node = _node->next; \ diff --git a/lib/3rdparty/freetype/src/cache/ftcsbits.c b/lib/3rdparty/freetype/src/cache/ftcsbits.c index 72f139d565b..60d46aa7a06 100644 --- a/lib/3rdparty/freetype/src/cache/ftcsbits.c +++ b/lib/3rdparty/freetype/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -26,6 +26,9 @@ #include "ftccback.h" #include "ftcerror.h" +#undef FT_COMPONENT +#define FT_COMPONENT trace_cache + /*************************************************************************/ /*************************************************************************/ @@ -129,13 +132,13 @@ 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 ) { - 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; } @@ -263,7 +266,7 @@ } - FT_LOCAL_DEF( FT_ULong ) + FT_LOCAL_DEF( FT_Offset ) ftc_snode_weight( FTC_Node ftcsnode, FTC_Cache cache ) { @@ -271,7 +274,7 @@ FT_UInt count = snode->count; FTC_SBit sbit = snode->sbits; FT_Int pitch; - FT_ULong size; + FT_Offset size; FT_UNUSED( cache ); @@ -300,7 +303,7 @@ #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 ); diff --git a/lib/3rdparty/freetype/src/cache/rules.mk b/lib/3rdparty/freetype/src/cache/rules.mk index 457dec848df..ed75a6a91fd 100644 --- a/lib/3rdparty/freetype/src/cache/rules.mk +++ b/lib/3rdparty/freetype/src/cache/rules.mk @@ -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, @@ -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_DIR)/ftccmap.c \ + $(CACHE_DIR)/ftccmap.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_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)/ftcmru.h + $(CACHE_DIR)/ftcmru.h \ + $(CACHE_DIR)/ftcsbits.h # Cache driver object(s) diff --git a/lib/3rdparty/freetype/src/cff/Jamfile b/lib/3rdparty/freetype/src/cff/Jamfile index 6d0bb1b8679..6705d3cfdb7 100644 --- a/lib/3rdparty/freetype/src/cff/Jamfile +++ b/lib/3rdparty/freetype/src/cff/Jamfile @@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) cff ; if $(FT2_MULTI) { - _sources = cffdrivr cffgload cffload cffobjs cffparse cffcmap ; + _sources = cffdrivr cffgload cffload cffobjs cffparse cffcmap cffpic ; } else { diff --git a/lib/3rdparty/freetype/src/cff/cff.c b/lib/3rdparty/freetype/src/cff/cff.c index e6d8954c9ab..fccfd442f5d 100644 --- a/lib/3rdparty/freetype/src/cff/cff.c +++ b/lib/3rdparty/freetype/src/cff/cff.c @@ -19,6 +19,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> +#include "cffpic.c" #include "cffdrivr.c" #include "cffparse.c" #include "cffload.c" diff --git a/lib/3rdparty/freetype/src/cff/cffcmap.c b/lib/3rdparty/freetype/src/cff/cffcmap.c index fffc5fc550d..46d603e3a89 100644 --- a/lib/3rdparty/freetype/src/cff/cffcmap.c +++ b/lib/3rdparty/freetype/src/cff/cffcmap.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -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 ) { @@ -99,16 +99,16 @@ } - 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, - (FT_CMap_CharNextFunc) cff_cmap_encoding_char_next - }; + (FT_CMap_CharNextFunc) cff_cmap_encoding_char_next, + + NULL, NULL, NULL, NULL, NULL + ) /*************************************************************************/ @@ -192,7 +192,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) cff_cmap_unicode_char_next( PS_Unicodes unicodes, FT_UInt32 *pchar_code ) { @@ -205,16 +205,15 @@ } - 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, - (FT_CMap_CharNextFunc) cff_cmap_unicode_char_next - }; + (FT_CMap_CharNextFunc) cff_cmap_unicode_char_next, + NULL, NULL, NULL, NULL, NULL + ) /* END */ diff --git a/lib/3rdparty/freetype/src/cff/cffcmap.h b/lib/3rdparty/freetype/src/cff/cffcmap.h index 3809b85611f..3f7f67bbe05 100644 --- a/lib/3rdparty/freetype/src/cff/cffcmap.h +++ b/lib/3rdparty/freetype/src/cff/cffcmap.h @@ -43,8 +43,7 @@ FT_BEGIN_HEADER } 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 */ - FT_CALLBACK_TABLE const FT_CMap_ClassRec - cff_cmap_unicode_class_rec; + FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec) FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/cff/cffdrivr.c b/lib/3rdparty/freetype/src/cff/cffdrivr.c index 952e88e39f2..dad0b65d8b1 100644 --- a/lib/3rdparty/freetype/src/cff/cffdrivr.c +++ b/lib/3rdparty/freetype/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -21,21 +21,25 @@ #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_NAME_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 "cffpic.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 */ @@ -151,7 +155,7 @@ 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; @@ -163,10 +167,10 @@ 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; - /* reset the size object if necessary */ if ( size ) { /* these two objects must have the same parent */ @@ -184,10 +188,39 @@ } - /* - * 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, @@ -206,10 +239,10 @@ 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; } @@ -226,8 +259,8 @@ FT_FREE( gname ); error = CFF_Err_Ok; - Exit: - return error; + Exit: + return error; } @@ -277,17 +310,16 @@ } - 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_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 ) @@ -306,9 +338,10 @@ 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 ) ) ) @@ -316,19 +349,19 @@ 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, - cff->psnames ); + psnames ); 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, - cff->psnames ); + psnames ); 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; @@ -337,19 +370,40 @@ cff->font_info = font_info; } - *afont_info = *cff->font_info; + if ( cff ) + *afont_info = *cff->font_info; 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_GetFontExtraFunc) NULL, (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 + ) /* @@ -368,15 +422,16 @@ { 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->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, @@ -391,10 +446,143 @@ } - 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 - }; + ) + + + /* + * 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 + ) /*************************************************************************/ @@ -408,18 +596,24 @@ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ - - static const FT_ServiceDescRec cff_services[] = - { - { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF }, - { FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info }, #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES - { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict }, + 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 - { 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 */ @@ -429,10 +623,13 @@ FT_Module_Interface result; - 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 ( !driver ) + return NULL; + /* we pass our request to the `sfnt' module */ sfnt = FT_Get_Module( driver->library, "sfnt" ); @@ -442,11 +639,13 @@ /* 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, @@ -461,7 +660,6 @@ cff_driver_init, cff_driver_done, cff_get_interface, - }, /* now the specific driver fields */ sizeof( TT_FaceRec ), @@ -475,25 +673,19 @@ 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 */ - 0, /* FT_Face_GetAdvancesFunc */ + cff_get_advances, /* FT_Face_GetAdvancesFunc */ cff_size_request, -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - cff_size_select -#else - 0 /* FT_Size_SelectFunc */ -#endif - }; + CFF_SIZE_SELECT + ) /* END */ diff --git a/lib/3rdparty/freetype/src/cff/cffdrivr.h b/lib/3rdparty/freetype/src/cff/cffdrivr.h index 553848c0a9c..50e8138701e 100644 --- a/lib/3rdparty/freetype/src/cff/cffdrivr.h +++ b/lib/3rdparty/freetype/src/cff/cffdrivr.h @@ -27,8 +27,7 @@ FT_BEGIN_HEADER - FT_CALLBACK_TABLE - const FT_Driver_ClassRec cff_driver_class; + FT_DECLARE_DRIVER( cff_driver_class ) FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/cff/cffgload.c b/lib/3rdparty/freetype/src/cff/cffgload.c index d354227e250..9330c058823 100644 --- a/lib/3rdparty/freetype/src/cff/cffgload.c +++ b/lib/3rdparty/freetype/src/cff/cffgload.c @@ -4,7 +4,8 @@ /* */ /* 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, */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,11 +19,9 @@ #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_TRUETYPE_TAGS_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H #include "cffobjs.h" @@ -110,6 +109,15 @@ 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, + cff_op_seac, + cff_op_sbw, + cff_op_setcurrentpoint, + /* do not remove */ cff_op_max @@ -120,6 +128,11 @@ #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[] = { @@ -187,7 +200,15 @@ 1, /* callsubr */ 1, - 0 + 0, + + 2, /* hsbw */ + 0, + 0, + 0, + 5, /* seac */ + 4, /* sbw */ + 2 /* setcurrentpoint */ }; @@ -222,6 +243,8 @@ /* */ /* glyph :: The current glyph object. */ /* */ + /* hinting :: Whether hinting is active. */ + /* */ static void cff_builder_init( CFF_Builder* builder, TT_Face face, @@ -251,17 +274,14 @@ 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; } } - 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; @@ -306,17 +326,23 @@ /* subroutines. */ /* */ /* <Input> */ - /* num_subrs :: The number of glyph subroutines. */ + /* in_charstring_type :: The `CharstringType' value of the top DICT */ + /* dictionary. */ + /* */ + /* num_subrs :: The number of glyph subroutines. */ /* */ /* <Return> */ /* The bias value. */ static FT_Int - cff_compute_bias( FT_UInt num_subrs ) + cff_compute_bias( FT_Int in_charstring_type, + FT_UInt num_subrs ) { FT_Int result; - if ( num_subrs < 1240 ) + if ( in_charstring_type == 1 ) + result = 0; + else if ( num_subrs < 1240 ) result = 107; else if ( num_subrs < 33900U ) result = 1131; @@ -339,11 +365,15 @@ /* 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, @@ -363,26 +393,32 @@ cff_builder_init( &decoder->builder, face, size, slot, hinting ); /* initialize Type2 decoder */ + decoder->cff = cff; decoder->num_globals = cff->num_global_subrs; decoder->globals = cff->global_subrs; - decoder->globals_bias = cff_compute_bias( decoder->num_globals ); + decoder->globals_bias = cff_compute_bias( + cff->top_font.font_dict.charstring_type, + decoder->num_globals ); decoder->hint_mode = hint_mode; } - /* 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, + CFF_Size size, 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 */ - if ( cff->num_subfonts >= 1 ) + if ( cff->num_subfonts ) { FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); @@ -394,12 +430,29 @@ goto Exit; } + FT_TRACE4(( "glyph index %d (subfont %d):\n", glyph_index, 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->locals_bias = cff_compute_bias( decoder->num_locals ); + decoder->locals_bias = cff_compute_bias( + decoder->cff->top_font.font_dict.charstring_type, + decoder->num_locals ); decoder->glyph_width = sub->private_dict.default_width; decoder->nominal_width = sub->private_dict.nominal_width; @@ -437,8 +490,6 @@ 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++; @@ -517,27 +568,24 @@ cff_builder_close_contour( CFF_Builder* builder ) { FT_Outline* outline = builder->current; + FT_Int first; 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 ) { - 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; - 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 ) @@ -546,8 +594,18 @@ } 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 ); + } } @@ -637,7 +695,7 @@ data.length = length; face->root.internal->incremental_interface->funcs->free_glyph_data( - face->root.internal->incremental_interface->object,&data ); + face->root.internal->incremental_interface->object, &data ); } else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ @@ -653,6 +711,7 @@ static FT_Error cff_operator_seac( CFF_Decoder* decoder, + FT_Pos asb, FT_Pos adx, FT_Pos ady, FT_Int bchar, @@ -665,7 +724,17 @@ FT_Vector left_bearing, advance; FT_Byte* charstring; FT_ULong charstring_len; + FT_Pos glyph_width; + + + if ( decoder->seac ) + { + FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); + return CFF_Err_Syntax_Error; + } + adx += decoder->builder.left_bearing.x; + ady += decoder->builder.left_bearing.y; #ifdef FT_CONFIG_OPTION_INCREMENTAL /* Incremental fonts don't necessarily have valid charsets. */ @@ -687,8 +756,8 @@ 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; } @@ -737,8 +806,11 @@ &charstring, &charstring_len ); if ( !error ) { + /* the seac operator must not be nested */ + decoder->seac = TRUE; error = cff_decoder_parse_charstrings( decoder, charstring, charstring_len ); + decoder->seac = FALSE; if ( error ) goto Exit; @@ -746,16 +818,17 @@ cff_free_glyph_data( face, &charstring, charstring_len ); } - /* Save the left bearing and width of the base character */ - /* as they will be erased by the next load. */ + /* Save the left bearing, advance and glyph width of the base */ + /* character as they will be erased by the next load. */ left_bearing = builder->left_bearing; advance = builder->advance; + glyph_width = decoder->glyph_width; builder->left_bearing.x = 0; builder->left_bearing.y = 0; - builder->pos_x = adx; + builder->pos_x = adx - asb; builder->pos_y = ady; /* Now load `achar' on top of the base outline. */ @@ -763,8 +836,11 @@ &charstring, &charstring_len ); if ( !error ) { + /* the seac operator must not be nested */ + decoder->seac = TRUE; error = cff_decoder_parse_charstrings( decoder, charstring, charstring_len ); + decoder->seac = FALSE; if ( error ) goto Exit; @@ -772,10 +848,11 @@ cff_free_glyph_data( face, &charstring, charstring_len ); } - /* Restore the left side bearing and advance width */ - /* of the base character. */ + /* Restore the left side bearing, advance and glyph width */ + /* of the base character. */ builder->left_bearing = left_bearing; builder->advance = advance; + decoder->glyph_width = glyph_width; builder->pos_x = 0; builder->pos_y = 0; @@ -817,6 +894,8 @@ FT_Pos x, y; FT_Fixed seed; FT_Fixed* stack; + FT_Int charstring_type = + decoder->cff->top_font.font_dict.charstring_type; T2_Hints_Funcs hinter; @@ -826,9 +905,10 @@ 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; @@ -883,18 +963,18 @@ 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; - 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; - val = -( (FT_Long)v - 251 ) * 256 - *ip++ - 108; + val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108; } else { @@ -905,7 +985,8 @@ ( (FT_Int32)ip[2] << 8 ) | ip[3]; ip += 4; - shift = 0; + if ( charstring_type == 2 ) + shift = 0; } if ( decoder->top - stack >= CFF_MAX_OPERANDS ) goto Stack_Overflow; @@ -923,6 +1004,11 @@ } 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; @@ -954,6 +1040,9 @@ case 8: op = cff_op_rrcurveto; break; + case 9: + op = cff_op_closepath; + break; case 10: op = cff_op_callsubr; break; @@ -971,6 +1060,12 @@ case 0: op = cff_op_dotsection; break; + case 1: /* this is actually the Type1 vstem3 operator */ + op = cff_op_vstem; + break; + case 2: /* this is actually the Type1 hstem3 operator */ + op = cff_op_hstem; + break; case 3: op = cff_op_and; break; @@ -980,6 +1075,12 @@ case 5: op = cff_op_not; break; + case 6: + op = cff_op_seac; + break; + case 7: + op = cff_op_sbw; + break; case 8: op = cff_op_store; break; @@ -1004,6 +1105,12 @@ 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; @@ -1037,6 +1144,9 @@ case 30: op = cff_op_roll; break; + case 33: + op = cff_op_setcurrentpoint; + break; case 34: op = cff_op_hflex; break; @@ -1055,6 +1165,9 @@ } } break; + case 13: + op = cff_op_hsbw; + break; case 14: op = cff_op_endchar; break; @@ -1101,8 +1214,9 @@ op = cff_op_hvcurveto; break; default: - ; + break; } + if ( op == cff_op_unknown ) goto Syntax_Error; @@ -1110,8 +1224,6 @@ 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 */ @@ -1145,7 +1257,7 @@ 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: @@ -1158,9 +1270,14 @@ 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--; - args++; } } @@ -1168,12 +1285,20 @@ req_args = 0; } - req_args &= 15; + req_args &= 0x000F; 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: @@ -1181,15 +1306,16 @@ 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, - args ); + args - ( num_args & ~1 ) ); decoder->num_hints += num_args / 2; args = stack; @@ -1209,7 +1335,7 @@ hinter->stems( hinter->hints, 0, num_args / 2, - args ); + args - ( num_args & ~1 ) ); decoder->num_hints += num_args / 2; } @@ -1232,12 +1358,14 @@ 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 )); + + FT_TRACE4(( ")\n" )); } #else ip += ( decoder->num_hints + 7 ) >> 3; @@ -1248,44 +1376,44 @@ break; case cff_op_rmoveto: - FT_TRACE4(( " rmoveto" )); + FT_TRACE4(( " rmoveto\n" )); 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: - FT_TRACE4(( " vmoveto" )); + FT_TRACE4(( " vmoveto\n" )); cff_builder_close_contour( builder ); builder->path_begun = 0; - y += args[0]; + y += args[-1]; args = stack; break; case cff_op_hmoveto: - FT_TRACE4(( " hmoveto" )); + FT_TRACE4(( " hmoveto\n" )); cff_builder_close_contour( builder ); builder->path_begun = 0; - x += args[0]; + x += args[-1]; 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 ( num_args < 2 || num_args & 1 ) + if ( num_args < 2 ) goto Stack_Underflow; - args = stack; + args -= num_args & ~1; while ( args < decoder->top ) { x += args[0]; @@ -1302,8 +1430,11 @@ 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 ) ) @@ -1328,125 +1459,164 @@ 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: - 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: - 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; + 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; - args = stack; - if ( num_args < 4 || ( num_args % 4 ) > 1 ) + if ( num_args < 4 ) 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 ); - while ( num_args >= 4 ) + while ( nargs >= 4 ) { - num_args -= 4; + nargs -= 4; if ( phase ) { x += args[0]; @@ -1455,7 +1625,7 @@ 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 ); } @@ -1467,7 +1637,7 @@ 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 ); } @@ -1480,19 +1650,23 @@ 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; + 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; - args = stack; + args -= nargs; /* first, add the line segments */ while ( num_lines > 0 ) @@ -1520,19 +1694,24 @@ 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; + nargs = num_args - 2; + nargs = nargs - nargs % 6 + 2; + num_curves = ( nargs - 2 ) / 6; + if ( cff_builder_start_point ( builder, x, y ) || - check_points( builder, num_curves*3 + 2 ) ) + check_points( builder, num_curves * 3 + 2 ) ) goto Fail; - args = stack; + args -= nargs; /* first, add the curves */ while ( num_curves > 0 ) @@ -1563,18 +1742,16 @@ 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; - /* 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 */ @@ -1616,9 +1793,7 @@ 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 ) || @@ -1663,14 +1838,15 @@ 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 ) || @@ -1684,21 +1860,20 @@ /* 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-- ) { - 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 ); @@ -1707,7 +1882,8 @@ { 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; } @@ -1734,13 +1910,12 @@ FT_UInt count; - FT_TRACE4(( " flex" )); + FT_TRACE4(( " flex\n" )); 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]; @@ -1754,22 +1929,34 @@ } break; + case cff_op_seac: + FT_TRACE4(( " seac\n" )); + + error = cff_operator_seac( decoder, + args[0], args[1], args[2], + (FT_Int)( args[3] >> 16 ), + (FT_Int)( args[4] >> 16 ) ); + + /* add current outline to the glyph slot */ + FT_GlyphLoader_Add( builder->loader ); + + /* return now! */ + FT_TRACE4(( "\n" )); + return error; + case cff_op_endchar: - FT_TRACE4(( " endchar" )); + FT_TRACE4(( " endchar\n" )); /* 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, - args[0], - args[1], - (FT_Int)( args[2] >> 16 ), - (FT_Int)( args[3] >> 16 ) ); - args += 4; + 0L, args[-4], args[-3], + (FT_Int)( args[-2] >> 16 ), + (FT_Int)( args[-1] >> 16 ) ); decoder->glyph_width = glyph_width; } @@ -1799,11 +1986,11 @@ } /* return now! */ - FT_TRACE4(( "\n\n" )); + FT_TRACE4(( "\n" )); return error; case cff_op_abs: - FT_TRACE4(( " abs" )); + FT_TRACE4(( " abs\n" )); if ( args[0] < 0 ) args[0] = -args[0]; @@ -1811,28 +1998,28 @@ break; case cff_op_add: - FT_TRACE4(( " add" )); + FT_TRACE4(( " add\n" )); 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: - FT_TRACE4(( " div" )); + FT_TRACE4(( " div\n" )); 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++; @@ -1843,7 +2030,7 @@ FT_Fixed Rand; - FT_TRACE4(( " rand" )); + FT_TRACE4(( " rand\n" )); Rand = seed; if ( Rand >= 0x8000L ) @@ -1858,14 +2045,14 @@ 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: - FT_TRACE4(( " sqrt" )); + FT_TRACE4(( " sqrt\n" )); if ( args[0] > 0 ) { @@ -1890,7 +2077,7 @@ case cff_op_drop: /* nothing */ - FT_TRACE4(( " drop" )); + FT_TRACE4(( " drop\n" )); break; @@ -1899,7 +2086,7 @@ FT_Fixed tmp; - FT_TRACE4(( " exch" )); + FT_TRACE4(( " exch\n" )); tmp = args[0]; args[0] = args[1]; @@ -1913,7 +2100,7 @@ FT_Int idx = (FT_Int)( args[0] >> 16 ); - FT_TRACE4(( " index" )); + FT_TRACE4(( " index\n" )); if ( idx < 0 ) idx = 0; @@ -1930,7 +2117,7 @@ FT_Int idx = (FT_Int)( args[1] >> 16 ); - FT_TRACE4(( " roll" )); + FT_TRACE4(( " roll\n" )); if ( count <= 0 ) count = 1; @@ -1972,10 +2159,10 @@ break; case cff_op_dup: - FT_TRACE4(( " dup" )); + FT_TRACE4(( " dup\n" )); args[1] = args[0]; - args++; + args += 2; break; case cff_op_put: @@ -1984,9 +2171,9 @@ FT_Int idx = (FT_Int)( args[1] >> 16 ); - FT_TRACE4(( " put" )); + FT_TRACE4(( " put\n" )); - if ( idx >= 0 && idx < decoder->len_buildchar ) + if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) decoder->buildchar[idx] = val; } break; @@ -1997,9 +2184,9 @@ FT_Fixed val = 0; - FT_TRACE4(( " get" )); + FT_TRACE4(( " get\n" )); - if ( idx >= 0 && idx < decoder->len_buildchar ) + if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) val = decoder->buildchar[idx]; args[0] = val; @@ -2008,18 +2195,97 @@ break; case cff_op_store: - FT_TRACE4(( " store ")); + FT_TRACE4(( " store\n")); 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 */ - 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 ); + + decoder->builder.left_bearing.x = args[0]; + decoder->builder.left_bearing.y = 0; + + x = decoder->builder.pos_x + args[0]; + y = decoder->builder.pos_y; + args = stack; + break; + + case cff_op_sbw: + /* 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(( " sbw (invalid op)\n" )); + + decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 ); + + decoder->builder.left_bearing.x = args[0]; + decoder->builder.left_bearing.y = args[1]; + + x = decoder->builder.pos_x + args[0]; + y = decoder->builder.pos_y + args[1]; + args = stack; + break; + + case cff_op_setcurrentpoint: + /* 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(( " setcurrentpoint (invalid op)\n" )); + + x = decoder->builder.pos_x + args[0]; + y = decoder->builder.pos_y + args[1]; + 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" )); + + /* subsequent `pop' operands should add the arguments, */ + /* this is the implementation described for `unknown' other */ + /* subroutines in the Type1 spec. */ + args -= 2 + ( args[-2] >> 16 ); + 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: @@ -2027,7 +2293,7 @@ FT_Fixed cond = args[0] && args[1]; - FT_TRACE4(( " and" )); + FT_TRACE4(( " and\n" )); args[0] = cond ? 0x10000L : 0; args++; @@ -2039,7 +2305,7 @@ FT_Fixed cond = args[0] || args[1]; - FT_TRACE4(( " or" )); + FT_TRACE4(( " or\n" )); args[0] = cond ? 0x10000L : 0; args++; @@ -2051,7 +2317,7 @@ FT_Fixed cond = !args[0]; - FT_TRACE4(( " eq" )); + FT_TRACE4(( " eq\n" )); args[0] = cond ? 0x10000L : 0; args++; @@ -2063,7 +2329,7 @@ FT_Fixed cond = ( args[2] <= args[3] ); - FT_TRACE4(( " ifelse" )); + FT_TRACE4(( " ifelse\n" )); if ( !cond ) args[0] = args[1]; @@ -2077,12 +2343,12 @@ decoder->locals_bias ); - FT_TRACE4(( " callsubr(%d)", idx )); + FT_TRACE4(( " callsubr(%d)\n", idx )); 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; } @@ -2103,7 +2369,7 @@ if ( !zone->base || zone->limit == zone->base ) { FT_ERROR(( "cff_decoder_parse_charstrings:" - " invoking empty subrs!\n" )); + " invoking empty subrs\n" )); goto Syntax_Error; } @@ -2119,12 +2385,12 @@ decoder->globals_bias ); - FT_TRACE4(( " callgsubr(%d)", idx )); + FT_TRACE4(( " callgsubr(%d)\n", idx )); 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; } @@ -2145,7 +2411,7 @@ if ( !zone->base || zone->limit == zone->base ) { FT_ERROR(( "cff_decoder_parse_charstrings:" - " invoking empty subrs!\n" )); + " invoking empty subrs\n" )); goto Syntax_Error; } @@ -2156,7 +2422,7 @@ break; case cff_op_return: - FT_TRACE4(( " return" )); + FT_TRACE4(( " return\n" )); if ( decoder->zone <= decoder->zones ) { @@ -2194,15 +2460,15 @@ 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: - 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: - FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!" )); + FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" )); return CFF_Err_Stack_Overflow; } @@ -2260,7 +2526,7 @@ &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, @@ -2290,23 +2556,30 @@ { 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; + 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 && - 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; @@ -2389,6 +2662,36 @@ 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; @@ -2405,15 +2708,18 @@ 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 = - (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 ) { - error = cff_decoder_prepare( &decoder, glyph_index ); + error = cff_decoder_prepare( &decoder, size, glyph_index ); if ( !error ) { error = cff_decoder_parse_charstrings( &decoder, @@ -2458,44 +2764,31 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL /* Incremental fonts can optionally override the metrics. */ - if ( !error && - face->root.internal->incremental_interface && + if ( !error && + face->root.internal->incremental_interface && face->root.internal->incremental_interface->funcs->get_glyph_metrics ) { FT_Incremental_MetricsRec metrics; metrics.bearing_x = decoder.builder.left_bearing.x; - metrics.bearing_y = decoder.builder.left_bearing.y; + metrics.bearing_y = 0; metrics.advance = decoder.builder.advance.x; + metrics.advance_v = decoder.builder.advance.y; + 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; - decoder.builder.advance.y = 0; + decoder.builder.advance.y = metrics.advance_v; } #endif /* FT_CONFIG_OPTION_INCREMENTAL */ 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. */ @@ -2526,9 +2819,14 @@ 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 && - 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 ) @@ -2565,7 +2863,6 @@ 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 && @@ -2587,7 +2884,7 @@ 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; @@ -2620,10 +2917,14 @@ metrics->horiBearingY = cbox.yMax; if ( has_vertical_info ) - metrics->vertBearingX = -metrics->width / 2; - else - ft_synthesize_vertical_metrics( metrics, - metrics->vertAdvance ); + metrics->vertBearingX = metrics->horiBearingX - + metrics->horiAdvance / 2; + else + { + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + ft_synthesize_vertical_metrics( metrics, + metrics->vertAdvance ); + } } } diff --git a/lib/3rdparty/freetype/src/cff/cffgload.h b/lib/3rdparty/freetype/src/cff/cffgload.h index f67864a6925..38937be5c11 100644 --- a/lib/3rdparty/freetype/src/cff/cffgload.h +++ b/lib/3rdparty/freetype/src/cff/cffgload.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -28,8 +28,9 @@ FT_BEGIN_HEADER -#define CFF_MAX_OPERANDS 48 -#define CFF_MAX_SUBRS_CALLS 32 +#define CFF_MAX_OPERANDS 48 +#define CFF_MAX_SUBRS_CALLS 32 +#define CFF_MAX_TRANS_ELEMENTS 32 /*************************************************************************/ @@ -53,12 +54,6 @@ FT_BEGIN_HEADER /* */ /* 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). */ @@ -92,11 +87,6 @@ FT_BEGIN_HEADER 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; @@ -146,9 +136,9 @@ FT_BEGIN_HEADER FT_Pos nominal_width; FT_Bool read_width; + FT_Bool width_only; FT_Int num_hints; - FT_Fixed* buildchar; - FT_Int len_buildchar; + FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; FT_UInt num_locals; FT_UInt num_globals; @@ -164,6 +154,8 @@ FT_BEGIN_HEADER FT_Render_Mode hint_mode; + FT_Bool seac; + } CFF_Decoder; @@ -177,6 +169,7 @@ FT_BEGIN_HEADER 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 */ diff --git a/lib/3rdparty/freetype/src/cff/cffload.c b/lib/3rdparty/freetype/src/cff/cffload.c index dd2f1133dca..64d13957235 100644 --- a/lib/3rdparty/freetype/src/cff/cffload.c +++ b/lib/3rdparty/freetype/src/cff/cffload.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -31,6 +31,7 @@ #if 1 + static const FT_UShort cff_isoadobe_charset[229] = { 0, 1, 2, 3, 4, 5, 6, 7, @@ -175,13 +176,15 @@ 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 ) { - return (FT_UShort)(charcode < 256 ? cff_standard_encoding[charcode] : 0); + return (FT_UShort)( charcode < 256 ? cff_standard_encoding[charcode] + : 0 ); } @@ -316,7 +319,7 @@ 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; @@ -399,6 +402,7 @@ 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; @@ -732,6 +736,7 @@ { FT_Error error = FT_Err_Ok; FT_UInt i; + FT_Long j; FT_UShort max_cid = 0; @@ -746,8 +751,11 @@ 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; @@ -838,7 +846,20 @@ 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(); } @@ -871,6 +892,20 @@ 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; @@ -879,7 +914,7 @@ 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; } @@ -902,7 +937,7 @@ 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; } @@ -920,7 +955,7 @@ 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; } @@ -938,7 +973,7 @@ 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; } @@ -1123,7 +1158,7 @@ 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; } @@ -1218,7 +1253,7 @@ 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; } @@ -1236,7 +1271,8 @@ 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; @@ -1246,7 +1282,7 @@ 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 ) ); @@ -1272,8 +1308,9 @@ 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 ); @@ -1296,7 +1333,7 @@ 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 ) ) @@ -1349,9 +1386,11 @@ FT_LOCAL_DEF( FT_Error ) - cff_font_load( FT_Stream stream, + cff_font_load( FT_Library library, + FT_Stream stream, FT_Int face_index, - CFF_Font font ) + CFF_Font font, + FT_Bool pure_cff ) { static const FT_Frame_Field cff_header_fields[] = { @@ -1388,7 +1427,7 @@ 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; } @@ -1426,7 +1465,8 @@ &font->font_dict_index, face_index, stream, - base_offset ); + base_offset, + library ); if ( error ) goto Exit; @@ -1456,7 +1496,7 @@ 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; } @@ -1474,7 +1514,7 @@ { sub = font->subfonts[idx]; error = cff_subfont_load( sub, &fd_index, idx, - stream, base_offset ); + stream, base_offset, library ); if ( error ) goto Fail_CID; } @@ -1497,7 +1537,7 @@ /* 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; } @@ -1515,7 +1555,7 @@ /* 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, @@ -1535,9 +1575,6 @@ 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, */ @@ -1590,6 +1627,9 @@ FT_FREE( font->font_info ); } + FT_FREE( font->registry ); + FT_FREE( font->ordering ); + FT_FREE( font->global_subrs ); FT_FREE( font->font_name ); } diff --git a/lib/3rdparty/freetype/src/cff/cffload.h b/lib/3rdparty/freetype/src/cff/cffload.h index 068cbb58c23..2b313acf06e 100644 --- a/lib/3rdparty/freetype/src/cff/cffload.h +++ b/lib/3rdparty/freetype/src/cff/cffload.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -58,9 +58,11 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - cff_font_load( FT_Stream stream, + cff_font_load( FT_Library library, + FT_Stream stream, FT_Int face_index, - CFF_Font font ); + CFF_Font font, + FT_Bool pure_cff ); FT_LOCAL( void ) cff_font_done( CFF_Font font ); diff --git a/lib/3rdparty/freetype/src/cff/cffobjs.c b/lib/3rdparty/freetype/src/cff/cffobjs.c index c02cf33fc8b..bd56c4ba11d 100644 --- a/lib/3rdparty/freetype/src/cff/cffobjs.c +++ b/lib/3rdparty/freetype/src/cff/cffobjs.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -30,6 +30,7 @@ #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_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; @@ -72,23 +73,84 @@ 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 ) - 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 */ { @@ -99,68 +161,43 @@ 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; + 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; + Exit: return error; } @@ -182,11 +219,42 @@ 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 ); + 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; } @@ -223,11 +291,42 @@ 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 ); + 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; } @@ -249,7 +348,7 @@ 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; @@ -270,7 +369,7 @@ } } - return 0; + return CFF_Err_Ok; } @@ -288,7 +387,9 @@ FT_String* result; - result = ft_mem_strdup( memory, source, &error ); + (void)FT_STRDUP( result, source ); + + FT_UNUSED( error ); return result; } @@ -308,6 +409,7 @@ PSHinter_Service pshinter; FT_Bool pure_cff = 1; FT_Bool sfnt_format = 0; + FT_Library library = cffface->driver->root.library; #if 0 @@ -319,14 +421,14 @@ 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( - cffface->driver->root.library, "pshinter" ); + library, "pshinter" ); #endif /* create input stream from resource */ @@ -337,7 +439,7 @@ 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; @@ -365,8 +467,7 @@ 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; } @@ -408,13 +509,15 @@ 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; + 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. */ @@ -427,13 +530,118 @@ /* 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; } + 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; @@ -444,20 +652,18 @@ /* 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; /* set global bbox, as well as EM size */ - cffface->bbox.xMin = dict->font_bbox.xMin >> 16; - cffface->bbox.yMin = dict->font_bbox.yMin >> 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->bbox.xMin = dict->font_bbox.xMin >> 16; + cffface->bbox.yMin = dict->font_bbox.yMin >> 16; + /* no `U' suffix here to 0xFFFF! */ + cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFF ) >> 16; + cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFF ) >> 16; - 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 ); @@ -561,22 +767,22 @@ /* */ /* 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 ) - flags |= FT_FACE_FLAG_SFNT; + flags |= (FT_UInt32)FT_FACE_FLAG_SFNT; /* 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 ) - flags |= FT_FACE_FLAG_KERNING; + flags |= (FT_UInt32)FT_FACE_FLAG_KERNING; #endif cffface->face_flags = flags; @@ -611,51 +817,25 @@ 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 */ - /* 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 && pure_cff ) + cffface->face_flags |= FT_FACE_FLAG_CID_KEYED; + + /*******************************************************************/ /* */ /* 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. */ { @@ -683,7 +863,7 @@ 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; @@ -691,7 +871,7 @@ 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 ) @@ -710,19 +890,19 @@ { 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; - 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; - clazz = &cff_cmap_encoding_class_rec; + clazz = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET; } FT_CMap_New( clazz, NULL, &cmaprec, NULL ); @@ -742,10 +922,16 @@ 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 ); diff --git a/lib/3rdparty/freetype/src/cff/cffobjs.h b/lib/3rdparty/freetype/src/cff/cffobjs.h index f18b5d9322d..3c81cee0094 100644 --- a/lib/3rdparty/freetype/src/cff/cffobjs.h +++ b/lib/3rdparty/freetype/src/cff/cffobjs.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -25,6 +25,7 @@ #include "cfftypes.h" #include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_INTERNAL_POSTSCRIPT_HINTS_H FT_BEGIN_HEADER @@ -53,8 +54,8 @@ FT_BEGIN_HEADER /* */ 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; @@ -80,6 +81,21 @@ FT_BEGIN_HEADER } 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; + /*************************************************************************/ /* */ diff --git a/lib/3rdparty/freetype/src/cff/cffparse.c b/lib/3rdparty/freetype/src/cff/cffparse.c index 41af6a317f1..01266a193d2 100644 --- a/lib/3rdparty/freetype/src/cff/cffparse.c +++ b/lib/3rdparty/freetype/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -19,8 +19,10 @@ #include <ft2build.h> #include "cffparse.h" #include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_DEBUG_H #include "cfferrs.h" +#include "cffpic.h" /*************************************************************************/ @@ -33,47 +35,20 @@ #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, - void* object ) + void* object, + FT_Library library) { FT_MEM_ZERO( parser, sizeof ( *parser ) ); parser->top = parser->stack; parser->object_code = code; parser->object = object; + parser->library = library; } @@ -136,24 +111,53 @@ } + 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, - 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_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 (;;) @@ -166,7 +170,7 @@ /* Make sure we don't read past the end. */ if ( p >= limit ) - goto Bad; + goto Exit; } /* Get the nibble. */ @@ -178,10 +182,20 @@ 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 (;;) { @@ -193,7 +207,7 @@ /* Make sure we don't read past the end. */ if ( p >= limit ) - goto Bad; + goto Exit; } /* Get the nibble. */ @@ -202,14 +216,18 @@ 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; @@ -218,19 +236,17 @@ if ( nib == 11 ) { - exponent = 0; - 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 ) - goto Bad; + goto Exit; } /* Get the nibble. */ @@ -240,47 +256,111 @@ break; exponent = exponent * 10 + nib; + + /* Arbitrarily limit exponent. */ + if ( exponent > 1000 ) + goto Exit; } 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; - - Bad: - result = 0; - goto Exit; } @@ -288,8 +368,8 @@ 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] ); } @@ -297,64 +377,120 @@ 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, */ - /* 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 - 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; - FT_UShort* upm = &dict->units_per_em; + FT_ULong* upm = &dict->units_per_em; 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 ) { - 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; } @@ -418,7 +554,12 @@ { 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; } @@ -439,6 +580,11 @@ #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, \ @@ -470,9 +616,6 @@ FT_FIELD_OFFSET( num_ ## name ) \ }, -#define CFFCODE_TOPDICT 0x1000 -#define CFFCODE_PRIVATE 0x2000 - static const CFF_Field_Handler cff_field_handlers[] = { @@ -482,13 +625,99 @@ }; +#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_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; @@ -516,8 +745,10 @@ p++; for (;;) { + /* An unterminated floating point number at the */ + /* end of a dictionary is invalid but harmless. */ if ( p >= limit ) - goto Syntax_Error; + goto Exit; v = p[0] >> 4; if ( v == 15 ) break; @@ -558,7 +789,7 @@ } 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 ) { @@ -585,7 +816,7 @@ 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 ) diff --git a/lib/3rdparty/freetype/src/cff/cffparse.h b/lib/3rdparty/freetype/src/cff/cffparse.h index 8f3fa588592..7e2c00a0449 100644 --- a/lib/3rdparty/freetype/src/cff/cffparse.h +++ b/lib/3rdparty/freetype/src/cff/cffparse.h @@ -36,6 +36,7 @@ FT_BEGIN_HEADER typedef struct CFF_ParserRec_ { + FT_Library library; 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, - void* object ); + void* object, + FT_Library library); FT_LOCAL( FT_Error ) cff_parser_run( CFF_Parser parser, @@ -60,6 +62,37 @@ FT_BEGIN_HEADER 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 diff --git a/lib/3rdparty/freetype/src/cff/cffpic.c b/lib/3rdparty/freetype/src/cff/cffpic.c new file mode 100644 index 00000000000..568956d6a93 --- /dev/null +++ b/lib/3rdparty/freetype/src/cff/cffpic.c @@ -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/lib/3rdparty/freetype/src/cff/cffpic.h b/lib/3rdparty/freetype/src/cff/cffpic.h new file mode 100644 index 00000000000..e29d068134b --- /dev/null +++ b/lib/3rdparty/freetype/src/cff/cffpic.h @@ -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 */ diff --git a/lib/3rdparty/freetype/src/cff/cfftypes.h b/lib/3rdparty/freetype/src/cff/cfftypes.h index 306e5aab670..df92e9a1ac3 100644 --- a/lib/3rdparty/freetype/src/cff/cfftypes.h +++ b/lib/3rdparty/freetype/src/cff/cfftypes.h @@ -5,7 +5,7 @@ /* 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, */ @@ -114,7 +114,7 @@ FT_BEGIN_HEADER 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; @@ -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; - FT_ULong cid_supplement; + FT_Long cid_supplement; 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.6 */ + FT_String* registry; + FT_String* ordering; + } CFF_FontRec, *CFF_Font; diff --git a/lib/3rdparty/freetype/src/cff/module.mk b/lib/3rdparty/freetype/src/cff/module.mk index 0474e37b69c..ef1391c279b 100644 --- a/lib/3rdparty/freetype/src/cff/module.mk +++ b/lib/3rdparty/freetype/src/cff/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/cid/cidgload.c b/lib/3rdparty/freetype/src/cid/cidgload.c index 8bec6e187b4..ea61b4e1283 100644 --- a/lib/3rdparty/freetype/src/cid/cidgload.c +++ b/lib/3rdparty/freetype/src/cid/cidgload.c @@ -4,7 +4,7 @@ /* */ /* 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, 2010 by */ /* 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_CALC_H #include "ciderrs.h" @@ -51,20 +52,25 @@ 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 + + + FT_TRACE4(( "cid_load_glyph: glyph index %d\n", glyph_index )); #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; - 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; @@ -74,15 +80,13 @@ 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 ); } - 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; @@ -163,23 +167,22 @@ #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; - 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; - decoder->builder.advance.y = 0; + metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x ); + metrics.bearing_y = 0; + metrics.advance = FIXED_TO_INT( decoder->builder.advance.x ); + metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y ); + + 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.advance.x = INT_TO_FIXED( metrics.advance ); + decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v ); } #endif /* FT_CONFIG_OPTION_INCREMENTAL */ @@ -251,7 +254,7 @@ /* 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 ); @@ -342,8 +345,10 @@ 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; @@ -357,8 +362,10 @@ /* 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 */ @@ -420,9 +427,12 @@ metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; - /* make up vertical ones */ - ft_synthesize_vertical_metrics( metrics, - metrics->vertAdvance ); + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + { + /* make up vertical ones */ + ft_synthesize_vertical_metrics( metrics, + metrics->vertAdvance ); + } } Exit: diff --git a/lib/3rdparty/freetype/src/cid/cidload.c b/lib/3rdparty/freetype/src/cid/cidload.c index 9ed8cee46c7..3bb359446f9 100644 --- a/lib/3rdparty/freetype/src/cid/cidload.c +++ b/lib/3rdparty/freetype/src/cid/cidload.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -97,6 +97,10 @@ 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; @@ -108,7 +112,7 @@ 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; @@ -234,14 +238,38 @@ } + /* 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" - 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 } }; diff --git a/lib/3rdparty/freetype/src/cid/cidobjs.c b/lib/3rdparty/freetype/src/cid/cidobjs.c index 1b3bfbf749a..82678af0d4b 100644 --- a/lib/3rdparty/freetype/src/cid/cidobjs.c +++ b/lib/3rdparty/freetype/src/cid/cidobjs.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -193,61 +193,61 @@ 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 ); } @@ -324,6 +324,7 @@ 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" )); @@ -412,10 +413,11 @@ cidface->num_fixed_sizes = 0; cidface->available_sizes = 0; - cidface->bbox.xMin = cid->font_bbox.xMin >> 16; - cidface->bbox.yMin = cid->font_bbox.yMin >> 16; - cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16; - cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16; + cidface->bbox.xMin = cid->font_bbox.xMin >> 16; + cidface->bbox.yMin = cid->font_bbox.yMin >> 16; + /* no `U' suffix here to 0xFFFF! */ + cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16; + cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16; if ( !cidface->units_per_EM ) cidface->units_per_EM = 1000; diff --git a/lib/3rdparty/freetype/src/cid/cidparse.c b/lib/3rdparty/freetype/src/cid/cidparse.c index bb87afc5891..efed618f5af 100644 --- a/lib/3rdparty/freetype/src/cid/cidparse.c +++ b/lib/3rdparty/freetype/src/cid/cidparse.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -18,7 +18,6 @@ #include <ft2build.h> #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_STREAM_H @@ -87,13 +86,13 @@ /* `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; - 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(); diff --git a/lib/3rdparty/freetype/src/cid/cidriver.c b/lib/3rdparty/freetype/src/cid/cidriver.c index 5c5a72957c0..3a2d22532a6 100644 --- a/lib/3rdparty/freetype/src/cid/cidriver.c +++ b/lib/3rdparty/freetype/src/cid/cidriver.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -20,13 +20,14 @@ #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 FT_SERVICE_CID_H + /*************************************************************************/ /* */ @@ -38,10 +39,10 @@ #define FT_COMPONENT trace_ciddriver - /* - * POSTSCRIPT NAME SERVICE - * - */ + /* + * POSTSCRIPT NAME SERVICE + * + */ static const char* cid_get_postscript_name( CID_Face face ) @@ -62,38 +63,114 @@ }; - /* - * 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; - 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, + (PS_GetFontExtraFunc) cid_ps_get_font_extra, (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[] = { - { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name }, { 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_CID, &cid_service_cid_info }, { NULL, NULL } }; diff --git a/lib/3rdparty/freetype/src/cid/cidriver.h b/lib/3rdparty/freetype/src/cid/cidriver.h index d5a80f6f9fb..c7f424bb389 100644 --- a/lib/3rdparty/freetype/src/cid/cidriver.h +++ b/lib/3rdparty/freetype/src/cid/cidriver.h @@ -26,6 +26,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/cid/cidtoken.h b/lib/3rdparty/freetype/src/cid/cidtoken.h index ad5bbb2eefd..904cb09cf4d 100644 --- a/lib/3rdparty/freetype/src/cid/cidtoken.h +++ b/lib/3rdparty/freetype/src/cid/cidtoken.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -22,7 +22,7 @@ #define T1CODE T1_FIELD_LOCATION_CID_INFO T1_FIELD_KEY ( "CIDFontName", cid_font_name, 0 ) - T1_FIELD_NUM ( "CIDFontVersion", cid_version, 0 ) + T1_FIELD_FIXED ( "CIDFontVersion", cid_version, 0 ) T1_FIELD_NUM ( "CIDFontType", cid_font_type, 0 ) T1_FIELD_STRING( "Registry", registry, 0 ) T1_FIELD_STRING( "Ordering", ordering, 0 ) @@ -49,6 +49,13 @@ 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 @@ -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_FIXED( "ExpansionFactor", expansion_factor, 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_BOOL ( "ForceBold", force_bold, 0 ) + + #undef FT_STRUCTURE #define FT_STRUCTURE FT_BBox #undef T1CODE diff --git a/lib/3rdparty/freetype/src/cid/module.mk b/lib/3rdparty/freetype/src/cid/module.mk index 41e5a68e599..ce30bfd7ae4 100644 --- a/lib/3rdparty/freetype/src/cid/module.mk +++ b/lib/3rdparty/freetype/src/cid/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c b/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c index 6cca65831e0..3d100315636 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c @@ -71,10 +71,10 @@ static void gxv_bsln_LookupValue_validate( FT_UShort glyph, - GXV_LookupValueDesc value, + GXV_LookupValueCPtr value_p, GXV_Validator valid ) { - FT_UShort v = value.u; + FT_UShort v = value_p->u; FT_UShort* ctlPoints; FT_UNUSED( glyph ); @@ -122,7 +122,7 @@ 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 ) { @@ -132,7 +132,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c b/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c index 82fd6b3a6d3..de7ce6fdef1 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c @@ -4,7 +4,8 @@ /* */ /* 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, */ @@ -50,11 +51,11 @@ FT_UShort* b ) { if ( *a < *b ) - return ( -1 ); + return -1; else if ( *a > *b ) - return ( 1 ); + return 1; else - return ( 0 ); + return 0; } @@ -115,11 +116,11 @@ FT_ULong* b ) { if ( *a < *b ) - return ( -1 ); + return -1; else if ( *a > *b ) - return ( 1 ); + return 1; else - return ( 0 ); + return 0; } @@ -404,8 +405,8 @@ 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 ) \ { \ @@ -447,7 +448,7 @@ } 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; @@ -552,7 +553,7 @@ } 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 ); @@ -630,11 +631,11 @@ for ( gid = firstGlyph; gid <= lastGlyph; gid++ ) { value = valid->lookupfmt4_trans( (FT_UShort)( gid - firstGlyph ), - base_value, + &base_value, limit, valid ); - valid->lookupval_func( gid, value, valid ); + valid->lookupval_func( gid, &value, valid ); } } @@ -709,7 +710,7 @@ } prev_glyph = glyph; - valid->lookupval_func( glyph, value, valid ); + valid->lookupval_func( glyph, &value, valid ); } gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, valid ); @@ -749,7 +750,7 @@ { 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; @@ -1180,7 +1181,7 @@ if ( NULL != valid->statetable.entry_validate_func ) valid->statetable.entry_validate_func( state, flags, - glyphOffset, + &glyphOffset, statetable_table, statetable_limit, valid ); @@ -1351,15 +1352,15 @@ static void gxv_XClassTable_lookupval_validate( FT_UShort glyph, - GXV_LookupValueDesc value, + GXV_LookupValueCPtr value_p, GXV_Validator valid ) { FT_UNUSED( glyph ); - if ( value.u >= valid->xstatetable.nClasses ) + if ( value_p->u >= valid->xstatetable.nClasses ) 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; } @@ -1391,7 +1392,7 @@ */ 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 ) { @@ -1401,7 +1402,7 @@ 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; @@ -1555,7 +1556,7 @@ if ( NULL != valid->xstatetable.entry_validate_func ) valid->xstatetable.entry_validate_func( state, flags, - glyphOffset, + &glyphOffset, xstatetable_table, xstatetable_limit, valid ); diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h b/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h index 0128eca79e3..404c07ffad9 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h +++ b/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h @@ -79,6 +79,8 @@ FT_BEGIN_HEADER } GXV_LookupValueDesc; + typedef const GXV_LookupValueDesc* GXV_LookupValueCPtr; + 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, - GXV_LookupValueDesc value, + GXV_LookupValueCPtr value_p, 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 ); @@ -134,6 +136,7 @@ FT_BEGIN_HEADER } GXV_StateTable_GlyphOffsetDesc; + typedef const GXV_StateTable_GlyphOffsetDesc* GXV_StateTable_GlyphOffsetCPtr; 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_GlyphOffsetDesc glyphOffset, + GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, 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 const GXV_XStateTable_GlyphOffsetDesc* GXV_XStateTable_GlyphOffsetCPtr; + 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_StateTable_GlyphOffsetDesc glyphOffset, + GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes xstatetable_table, FT_Bytes xstatetable_limit, GXV_Validator valid ); @@ -275,11 +280,11 @@ FT_BEGIN_HEADER #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 */ diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c b/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c index d7c6ad166d5..002fec6d6b1 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c @@ -4,7 +4,8 @@ /* */ /* 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, */ @@ -59,7 +60,7 @@ #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, @@ -198,7 +199,7 @@ FT_UShort feature; FT_UShort nSettings; - FT_UInt settingTable; + FT_ULong settingTable; FT_UShort featureFlags; FT_Bool exclusive; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvjust.c b/lib/3rdparty/freetype/src/gxvalid/gxvjust.c index 29bf840b57a..e14f946f2da 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvjust.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvjust.c @@ -323,15 +323,15 @@ static void gxv_just_pcTable_LookupValue_entry_validate( FT_UShort glyph, - GXV_LookupValueDesc value, + GXV_LookupValueCPtr value_p, 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; } @@ -384,7 +384,7 @@ 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 ) @@ -395,7 +395,7 @@ FT_UShort currentClass; FT_UNUSED( state ); - FT_UNUSED( glyphOffset ); + FT_UNUSED( glyphOffset_p ); FT_UNUSED( table ); FT_UNUSED( limit ); FT_UNUSED( valid ); @@ -449,15 +449,15 @@ static void gxv_just_wdcTable_LookupValue_validate( FT_UShort glyph, - GXV_LookupValueDesc value, + GXV_LookupValueCPtr value_p, 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; } @@ -557,7 +557,7 @@ { FT_Bytes p = table; FT_Bytes limit = 0; - FT_UInt table_size; + FT_Offset table_size; GXV_ValidatorRec validrec; GXV_Validator valid = &validrec; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvkern.c b/lib/3rdparty/freetype/src/gxvalid/gxvkern.c index bfb405f65ba..2137db842a4 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvkern.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvkern.c @@ -256,7 +256,7 @@ 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 ) @@ -268,7 +268,7 @@ FT_UShort kernValue; FT_UNUSED( state ); - FT_UNUSED( glyphOffset ); + FT_UNUSED( glyphOffset_p ); push = (FT_UShort)( ( flags >> 15 ) & 1 ); diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c b/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c index 48821ea8796..f14fa5b1313 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c @@ -83,10 +83,10 @@ static void gxv_lcar_LookupValue_validate( FT_UShort glyph, - GXV_LookupValueDesc value, + GXV_LookupValueCPtr value_p, 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; @@ -146,7 +146,7 @@ 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 ) { @@ -158,7 +158,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmod.h b/lib/3rdparty/freetype/src/gxvalid/gxvmod.h index 466584ef4fd..d912a8f8381 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmod.h +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmod.h @@ -34,6 +34,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmort.c b/lib/3rdparty/freetype/src/gxvalid/gxvmort.c index 6fb71b92be4..0aa066339df 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmort.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmort.c @@ -42,7 +42,7 @@ 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", @@ -85,17 +85,17 @@ /* - * 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, - FT_UInt nFeatureFlags, + FT_ULong nFeatureFlags, GXV_Validator valid ) { FT_Bytes p = table; - FT_UInt i; + FT_ULong i; GXV_mort_featureRec f = GXV_MORT_FEATURE_OFF; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmort.h b/lib/3rdparty/freetype/src/gxvalid/gxvmort.h index 1d64e69c475..1e5a1f5ab68 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmort.h +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmort.h @@ -54,7 +54,7 @@ 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 ) diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c b/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c index 0902056c628..0453062f636 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c @@ -64,7 +64,7 @@ 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 ) @@ -80,7 +80,7 @@ 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 ); @@ -91,7 +91,7 @@ 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 )); diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c b/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c index 0575b1260ac..696d85032d0 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c @@ -135,7 +135,7 @@ 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 ) @@ -154,8 +154,8 @@ 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 ) { @@ -202,7 +202,7 @@ 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 ) diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c b/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c index f19d15dab5d..6f77cf39ce7 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c @@ -189,7 +189,7 @@ 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 ) @@ -199,7 +199,7 @@ FT_UShort offset; FT_UNUSED( state ); - FT_UNUSED( glyphOffset ); + FT_UNUSED( glyphOffset_p ); FT_UNUSED( limit ); diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c b/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c index a04bc1efaf4..83470988c09 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c @@ -40,12 +40,12 @@ 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_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, - GXV_LookupValueDesc base_value, + GXV_LookupValueCPtr base_value_p, FT_Bytes lookuptbl_limit, GXV_Validator valid ) { @@ -88,7 +88,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c b/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c index a7cabc359fc..ec0bcb634d5 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c @@ -139,7 +139,7 @@ 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 ) @@ -168,8 +168,8 @@ 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 ) { diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c b/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c index 849d5e942a5..f8ba5b985d9 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c @@ -4,7 +4,8 @@ /* */ /* 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, */ @@ -68,8 +69,8 @@ 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 ); @@ -129,7 +130,7 @@ 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, diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c b/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c index ca92b6c3925..0159c5aef7a 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c @@ -42,7 +42,7 @@ 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 ) @@ -54,7 +54,7 @@ FT_UShort verb; FT_UNUSED( state ); - FT_UNUSED( glyphOffset ); + FT_UNUSED( glyphOffset_p ); FT_UNUSED( table ); FT_UNUSED( limit ); diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c b/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c index 331d4ccdab3..e1c162fa0c6 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c @@ -103,7 +103,7 @@ 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 ) @@ -127,8 +127,8 @@ 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 )); @@ -155,14 +155,14 @@ 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_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; } @@ -170,7 +170,7 @@ 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 ) { @@ -180,7 +180,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c b/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c index 5cad5169c21..b4bb3353f69 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c @@ -186,7 +186,7 @@ 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 ) @@ -206,7 +206,7 @@ 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" )); diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c b/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c index d9115618c09..5e3a16437e2 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c @@ -136,7 +136,7 @@ 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 ) @@ -165,8 +165,8 @@ 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, diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c b/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c index 8d6fe669f30..e1250609460 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c @@ -67,18 +67,18 @@ 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 */ - 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; - 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++ ) { @@ -132,7 +132,7 @@ 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 ) { @@ -142,7 +142,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvprop.c b/lib/3rdparty/freetype/src/gxvalid/gxvprop.c index 010eeda4266..66c3ab74042 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvprop.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvprop.c @@ -168,10 +168,10 @@ static void gxv_prop_LookupValue_validate( FT_UShort glyph, - GXV_LookupValueDesc value, + GXV_LookupValueCPtr value_p, GXV_Validator valid ) { - gxv_prop_property_validate( value.u, glyph, valid ); + gxv_prop_property_validate( value_p->u, glyph, valid ); } @@ -204,7 +204,7 @@ 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 ) { @@ -214,7 +214,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c b/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c index 432ee4e2719..df3fd15c0b6 100644 --- a/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c +++ b/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c @@ -198,7 +198,7 @@ { FT_Bytes p = table; FT_Bytes limit = 0; - FT_UInt table_size; + FT_Offset table_size; GXV_ValidatorRec validrec; GXV_Validator valid = &validrec; diff --git a/lib/3rdparty/freetype/src/gxvalid/module.mk b/lib/3rdparty/freetype/src/gxvalid/module.mk index 44ef94addfa..9fd098e2c5e 100644 --- a/lib/3rdparty/freetype/src/gxvalid/module.mk +++ b/lib/3rdparty/freetype/src/gxvalid/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/gzip/adler32.c b/lib/3rdparty/freetype/src/gzip/adler32.c index 36f6a432eaf..c53f9dd125d 100644 --- a/lib/3rdparty/freetype/src/gzip/adler32.c +++ b/lib/3rdparty/freetype/src/gzip/adler32.c @@ -3,7 +3,7 @@ * 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" diff --git a/lib/3rdparty/freetype/src/gzip/ftgzip.c b/lib/3rdparty/freetype/src/gzip/ftgzip.c index af2022d7f5a..6f0c515723e 100644 --- a/lib/3rdparty/freetype/src/gzip/ftgzip.c +++ b/lib/3rdparty/freetype/src/gzip/ftgzip.c @@ -8,7 +8,7 @@ /* 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, */ @@ -25,7 +25,7 @@ #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 @@ -40,6 +40,10 @@ #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> @@ -54,7 +58,9 @@ /* 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" @@ -117,7 +123,7 @@ } -#ifndef FT_CONFIG_OPTION_SYSTEM_ZLIB +#if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC ) local voidpf zcalloc ( voidpf opaque, @@ -134,7 +140,7 @@ ft_gzip_free( (FT_Memory)opaque, ptr ); } -#endif /* !SYSTEM_ZLIB */ +#endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */ /***************************************************************************/ @@ -569,7 +575,7 @@ if ( error ) result = 0; - FT_Stream_Seek( stream, old_pos ); + (void)FT_Stream_Seek( stream, old_pos ); } return result; diff --git a/lib/3rdparty/freetype/src/gzip/inftrees.c b/lib/3rdparty/freetype/src/gzip/inftrees.c index 3c39aca6e3a..ef536521686 100644 --- a/lib/3rdparty/freetype/src/gzip/inftrees.c +++ b/lib/3rdparty/freetype/src/gzip/inftrees.c @@ -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 0 + { +#endif #ifdef PKZIP_BUG_WORKAROUND r = Z_OK; } diff --git a/lib/3rdparty/freetype/src/gzip/zconf.h b/lib/3rdparty/freetype/src/gzip/zconf.h index 3ccc3a66ab6..3abf0ba03b0 100644 --- a/lib/3rdparty/freetype/src/gzip/zconf.h +++ b/lib/3rdparty/freetype/src/gzip/zconf.h @@ -3,7 +3,7 @@ * 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 @@ -60,6 +60,12 @@ # 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). diff --git a/lib/3rdparty/freetype/src/gzip/zutil.c b/lib/3rdparty/freetype/src/gzip/zutil.c index 5ed2da08713..7ad0c1f81bb 100644 --- a/lib/3rdparty/freetype/src/gzip/zutil.c +++ b/lib/3rdparty/freetype/src/gzip/zutil.c @@ -3,7 +3,7 @@ * 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" @@ -49,7 +49,7 @@ void zmemzero(dest, len) } #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 @@ -126,10 +126,10 @@ void zcfree (voidpf opaque, voidpf ptr) 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 diff --git a/lib/3rdparty/freetype/src/gzip/zutil.h b/lib/3rdparty/freetype/src/gzip/zutil.h index 8e3c69a9f06..c9688cd9c04 100644 --- a/lib/3rdparty/freetype/src/gzip/zutil.h +++ b/lib/3rdparty/freetype/src/gzip/zutil.h @@ -8,7 +8,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/lzw/ftlzw.c b/lib/3rdparty/freetype/src/lzw/ftlzw.c index 45fbf7b6ea1..6e57dedb971 100644 --- a/lib/3rdparty/freetype/src/lzw/ftlzw.c +++ b/lib/3rdparty/freetype/src/lzw/ftlzw.c @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2004, 2005, 2006 by */ +/* Copyright 2004, 2005, 2006, 2009, 2010 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 <string.h> -#include <stdio.h> +#include FT_CONFIG_STANDARD_LIBRARY_H #include FT_MODULE_ERRORS_H @@ -43,6 +42,10 @@ #ifdef FT_CONFIG_OPTION_USE_LZW +#ifdef FT_CONFIG_OPTION_PIC +#error "lzw code does not support PIC yet" +#endif + #include "ftzopen.h" @@ -119,13 +122,9 @@ zip->pos = 0; /* check and skip .Z header */ - { - stream = source; - - error = ft_lzw_check_header( source ); - if ( error ) - goto Exit; - } + error = ft_lzw_check_header( source ); + if ( error ) + goto Exit; /* initialize internal lzw variable */ ft_lzwstate_init( lzw, source ); diff --git a/lib/3rdparty/freetype/src/lzw/ftzopen.c b/lib/3rdparty/freetype/src/lzw/ftzopen.c index fc7831510d1..8bc65c8f57b 100644 --- a/lib/3rdparty/freetype/src/lzw/ftzopen.c +++ b/lib/3rdparty/freetype/src/lzw/ftzopen.c @@ -8,7 +8,7 @@ /* 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 */ @@ -113,8 +113,8 @@ { 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; @@ -332,6 +332,9 @@ while ( code >= 256U ) { + if ( !state->prefix ) + goto Eof; + FTLZW_STACK_PUSH( state->suffix[code - 256] ); code = state->prefix[code - 256]; } diff --git a/lib/3rdparty/freetype/src/lzw/ftzopen.h b/lib/3rdparty/freetype/src/lzw/ftzopen.h index 97881149c22..f7d2936be2f 100644 --- a/lib/3rdparty/freetype/src/lzw/ftzopen.h +++ b/lib/3rdparty/freetype/src/lzw/ftzopen.h @@ -8,7 +8,7 @@ /* 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 */ @@ -46,7 +46,7 @@ #define LZW_MASK( n ) ( ( 1U << (n) ) - 1U ) - typedef enum + typedef enum FT_LzwPhase_ { FT_LZW_PHASE_START = 0, FT_LZW_PHASE_CODE, @@ -109,7 +109,7 @@ * `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; @@ -118,7 +118,7 @@ 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 */ @@ -137,7 +137,7 @@ 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 */ diff --git a/lib/3rdparty/freetype/src/otvalid/Jamfile b/lib/3rdparty/freetype/src/otvalid/Jamfile index 35a14c6ab94..b457143de4f 100644 --- a/lib/3rdparty/freetype/src/otvalid/Jamfile +++ b/lib/3rdparty/freetype/src/otvalid/Jamfile @@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) otvalid ; if $(FT2_MULTI) { - _sources = otvbase otvcommn otvgdef otvgpos otvgsub otvjstf otvmod ; + _sources = otvbase otvcommn otvgdef otvgpos otvgsub otvjstf otvmod otvmath ; } else { diff --git a/lib/3rdparty/freetype/src/otvalid/module.mk b/lib/3rdparty/freetype/src/otvalid/module.mk index aa4db047d55..9cadde55e46 100644 --- a/lib/3rdparty/freetype/src/otvalid/module.mk +++ b/lib/3rdparty/freetype/src/otvalid/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/otvalid/otvalid.c b/lib/3rdparty/freetype/src/otvalid/otvalid.c index 2f85f601b66..d5c2b75abb6 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvalid.c +++ b/lib/3rdparty/freetype/src/otvalid/otvalid.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -25,6 +25,7 @@ #include "otvgpos.c" #include "otvgsub.c" #include "otvjstf.c" +#include "otvmath.c" #include "otvmod.c" /* END */ diff --git a/lib/3rdparty/freetype/src/otvalid/otvalid.h b/lib/3rdparty/freetype/src/otvalid/otvalid.h index 38f030f3935..eb99b9cc48e 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvalid.h +++ b/lib/3rdparty/freetype/src/otvalid/otvalid.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -42,6 +42,7 @@ FT_BEGIN_HEADER otv_GDEF_validate( FT_Bytes table, FT_Bytes gsub, FT_Bytes gpos, + FT_UInt glyph_count, FT_Validator valid ); FT_LOCAL( void ) @@ -63,6 +64,11 @@ FT_BEGIN_HEADER 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 diff --git a/lib/3rdparty/freetype/src/otvalid/otvbase.c b/lib/3rdparty/freetype/src/otvalid/otvbase.c index 8ad2238d6d6..d742d2dc95f 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvbase.c +++ b/lib/3rdparty/freetype/src/otvalid/otvbase.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -62,7 +62,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -297,7 +297,7 @@ OTV_LIMIT_CHECK( 6 ); if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ - FT_INVALID_DATA; + FT_INVALID_FORMAT; table_size = 6; diff --git a/lib/3rdparty/freetype/src/otvalid/otvcommn.c b/lib/3rdparty/freetype/src/otvalid/otvcommn.c index d94e4f3cb62..a4f885b51f8 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvcommn.c +++ b/lib/3rdparty/freetype/src/otvalid/otvcommn.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -39,10 +39,12 @@ 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_UInt total = 0; OTV_NAME_ENTER( "Coverage" ); @@ -57,6 +59,7 @@ case 1: /* CoverageFormat1 */ { FT_UInt GlyphCount; + FT_UInt i; GlyphCount = FT_NEXT_USHORT( p ); @@ -64,13 +67,25 @@ 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; - FT_UInt Start, End, StartCoverageIndex, total = 0, last = 0; + FT_UInt Start, End, StartCoverageIndex, last = 0; RangeCount = FT_NEXT_USHORT( p ); @@ -89,6 +104,9 @@ 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; @@ -102,8 +120,11 @@ 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; } @@ -215,18 +236,21 @@ { case 1: /* ClassDefFormat1 */ { + FT_UInt StartGlyph; 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 */ + + if ( StartGlyph + GlyphCount - 1 >= valid->glyph_count ) + FT_INVALID_GLYPH_ID; } break; @@ -252,6 +276,9 @@ if ( Start > End || ( n > 0 && Start <= last ) ) FT_INVALID_DATA; + if ( End >= valid->glyph_count ) + FT_INVALID_GLYPH_ID; + last = End; } } @@ -291,7 +318,10 @@ 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; @@ -330,7 +360,7 @@ 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]; @@ -657,7 +687,7 @@ OTV_TRACE(( " (Count = %d)\n", Count )); - otv_Coverage_validate( table + Coverage, valid ); + otv_Coverage_validate( table + Coverage, valid, Count ); OTV_LIMIT_CHECK( Count * 2 ); @@ -729,6 +759,7 @@ FT_INVALID_DATA; OTV_LIMIT_CHECK( ( Count1 - 1 ) * 2 + Count2 * 4 ); + p += ( Count1 - 1 ) * 2; for ( ; Count2 > 0; Count2-- ) { @@ -824,7 +855,7 @@ 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 ); @@ -872,7 +903,7 @@ 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-- ) { @@ -913,7 +944,7 @@ 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 ); @@ -963,7 +994,7 @@ 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 ); @@ -972,7 +1003,7 @@ 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 ); @@ -981,7 +1012,7 @@ 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 ); diff --git a/lib/3rdparty/freetype/src/otvalid/otvcommn.h b/lib/3rdparty/freetype/src/otvalid/otvcommn.h index be6ac69c284..898887fc954 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvcommn.h +++ b/lib/3rdparty/freetype/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -85,27 +85,27 @@ FT_BEGIN_HEADER 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 @@ -192,12 +192,12 @@ FT_BEGIN_HEADER 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 */ @@ -215,7 +215,8 @@ FT_BEGIN_HEADER 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 ) diff --git a/lib/3rdparty/freetype/src/otvalid/otvgdef.c b/lib/3rdparty/freetype/src/otvalid/otvgdef.c index 7d24902e881..3633ad0de18 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvgdef.c +++ b/lib/3rdparty/freetype/src/otvalid/otvgdef.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -61,7 +61,7 @@ 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; @@ -126,7 +126,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -141,10 +141,13 @@ /*************************************************************************/ /*************************************************************************/ + /* sets valid->glyph_count */ + 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; @@ -183,6 +186,8 @@ else table_size = 10; /* OpenType < 1.2 */ + valid->glyph_count = glyph_count; + OTV_OPTIONAL_OFFSET( GlyphClassDef ); OTV_SIZE_CHECK( GlyphClassDef ); if ( GlyphClassDef ) diff --git a/lib/3rdparty/freetype/src/otvalid/otvgpos.c b/lib/3rdparty/freetype/src/otvalid/otvgpos.c index ed347053d65..49b46183a32 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvgpos.c +++ b/lib/3rdparty/freetype/src/otvalid/otvgpos.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -124,8 +124,8 @@ 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 ); @@ -191,7 +191,7 @@ #endif if ( format >= 0x100 ) - FT_INVALID_DATA; + FT_INVALID_FORMAT; for ( count = 4; count > 0; count-- ) { @@ -209,7 +209,7 @@ { if ( format & 1 ) { - FT_UInt table_size; + FT_PtrDist table_size; OTV_OPTIONAL_TABLE( device ); @@ -294,7 +294,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -376,7 +376,7 @@ 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; @@ -395,7 +395,7 @@ 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 ); @@ -409,7 +409,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -498,7 +498,7 @@ OTV_TRACE(( " (PairSetCount = %d)\n", PairSetCount )); - otv_Coverage_validate( table + Coverage, valid ); + otv_Coverage_validate( table + Coverage, valid, -1 ); OTV_LIMIT_CHECK( PairSetCount * 2 ); @@ -530,7 +530,7 @@ 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 ); @@ -558,7 +558,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -605,7 +605,7 @@ OTV_TRACE(( " (EntryExitCount = %d)\n", EntryExitCount )); - otv_Coverage_validate( table + Coverage, valid ); + otv_Coverage_validate( table + Coverage, valid, EntryExitCount ); OTV_LIMIT_CHECK( EntryExitCount * 4 ); @@ -629,7 +629,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -644,7 +644,10 @@ /*************************************************************************/ /*************************************************************************/ - /* 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, @@ -664,13 +667,13 @@ switch ( PosFormat ) { case 1: - valid->extra2 = 0; + valid->extra2 = 1; OTV_NEST2( MarkBasePosFormat1, BaseArray ); OTV_RUN( table, valid ); break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -711,7 +714,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -752,7 +755,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -811,7 +814,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -872,7 +875,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -908,7 +911,8 @@ { case 1: /* ExtensionPosFormat1 */ { - FT_UInt ExtensionLookupType, ExtensionOffset; + FT_UInt ExtensionLookupType; + FT_ULong ExtensionOffset; OTV_Validate_Func validate; @@ -925,7 +929,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -989,7 +993,7 @@ 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 ); diff --git a/lib/3rdparty/freetype/src/otvalid/otvgsub.c b/lib/3rdparty/freetype/src/otvalid/otvgsub.c index 91dae0bb161..ed499d1e92d 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvgsub.c +++ b/lib/3rdparty/freetype/src/otvalid/otvgsub.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -68,7 +68,7 @@ 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 ) @@ -91,19 +91,19 @@ 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 ) - FT_INVALID_DATA; + FT_INVALID_GLYPH_ID; } break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -144,7 +144,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -185,7 +185,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -259,7 +259,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -318,7 +318,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -379,7 +379,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -415,7 +415,8 @@ { case 1: /* ExtensionSubstFormat1 */ { - FT_UInt ExtensionLookupType, ExtensionOffset; + FT_UInt ExtensionLookupType; + FT_ULong ExtensionOffset; OTV_Validate_Func validate; @@ -434,7 +435,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -476,12 +477,12 @@ 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_Coverage_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 ); LookaheadGlyphCount = FT_NEXT_USHORT( p ); @@ -490,7 +491,7 @@ 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 ); @@ -509,7 +510,7 @@ break; default: - FT_INVALID_DATA; + FT_INVALID_FORMAT; } OTV_EXIT; @@ -560,7 +561,7 @@ 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 ); diff --git a/lib/3rdparty/freetype/src/otvalid/otvjstf.c b/lib/3rdparty/freetype/src/otvalid/otvjstf.c index 80b8dd66043..a616a23432c 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvjstf.c +++ b/lib/3rdparty/freetype/src/otvalid/otvjstf.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -222,7 +222,7 @@ OTV_LIMIT_CHECK( 6 ); if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ - FT_INVALID_DATA; + FT_INVALID_FORMAT; JstfScriptCount = FT_NEXT_USHORT( p ); diff --git a/lib/3rdparty/freetype/src/otvalid/otvmath.c b/lib/3rdparty/freetype/src/otvalid/otvmath.c new file mode 100644 index 00000000000..50ed10cf284 --- /dev/null +++ b/lib/3rdparty/freetype/src/otvalid/otvmath.c @@ -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 */ diff --git a/lib/3rdparty/freetype/src/otvalid/otvmod.c b/lib/3rdparty/freetype/src/otvalid/otvmod.c index 157272f1ae9..3248564560c 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvmod.c +++ b/lib/3rdparty/freetype/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -79,12 +79,27 @@ 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_math; + FT_UInt num_glyphs = (FT_UInt)face->num_glyphs; 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 */ @@ -123,6 +138,13 @@ 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 ) @@ -139,7 +161,7 @@ { 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; @@ -149,7 +171,7 @@ { 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; @@ -159,7 +181,7 @@ { 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; @@ -169,7 +191,17 @@ { 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; @@ -192,6 +224,12 @@ 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; } diff --git a/lib/3rdparty/freetype/src/otvalid/otvmod.h b/lib/3rdparty/freetype/src/otvalid/otvmod.h index 1bfc1899fe3..573b2a0c4b9 100644 --- a/lib/3rdparty/freetype/src/otvalid/otvmod.h +++ b/lib/3rdparty/freetype/src/otvalid/otvmod.h @@ -27,6 +27,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/otvalid/rules.mk b/lib/3rdparty/freetype/src/otvalid/rules.mk index 48f12336f79..53bd41e5e7d 100644 --- a/lib/3rdparty/freetype/src/otvalid/rules.mk +++ b/lib/3rdparty/freetype/src/otvalid/rules.mk @@ -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, @@ -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)/otvmath.c \ $(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)/otvgpos.h \ + $(OTV_DIR)/otverror.h \ + $(OTV_DIR)/otvgpos.h \ $(OTV_DIR)/otvmod.h diff --git a/lib/3rdparty/freetype/src/pcf/module.mk b/lib/3rdparty/freetype/src/pcf/module.mk index 0c51cd6fc42..df383ff0fbe 100644 --- a/lib/3rdparty/freetype/src/pcf/module.mk +++ b/lib/3rdparty/freetype/src/pcf/module.mk @@ -27,7 +27,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/pcf/pcf.h b/lib/3rdparty/freetype/src/pcf/pcf.h index 9d2d8e0e429..1cd56c13a40 100644 --- a/lib/3rdparty/freetype/src/pcf/pcf.h +++ b/lib/3rdparty/freetype/src/pcf/pcf.h @@ -72,8 +72,8 @@ FT_BEGIN_HEADER union { FT_String* atom; - FT_Long integer; - FT_ULong cardinal; + FT_Long l; + FT_ULong ul; } value; diff --git a/lib/3rdparty/freetype/src/pcf/pcfdrivr.c b/lib/3rdparty/freetype/src/pcf/pcfdrivr.c index c0f0e49ca12..b34e542aeb0 100644 --- a/lib/3rdparty/freetype/src/pcf/pcfdrivr.c +++ b/lib/3rdparty/freetype/src/pcf/pcfdrivr.c @@ -2,7 +2,7 @@ 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 @@ -111,7 +111,7 @@ THE SOFTWARE. while ( min < max ) { - FT_UInt32 code; + FT_ULong code; 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; - FT_UInt32 charcode = *acharcode + 1; + FT_ULong charcode = *acharcode + 1; FT_UInt result = 0; @@ -149,7 +149,7 @@ THE SOFTWARE. while ( min < max ) { - FT_UInt32 code; + FT_ULong code; mid = ( min + max ) >> 1; @@ -175,7 +175,14 @@ THE SOFTWARE. } 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; } @@ -187,17 +194,24 @@ THE SOFTWARE. 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 */ { - 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 ); @@ -259,17 +273,26 @@ THE SOFTWARE. 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; @@ -281,29 +304,26 @@ THE SOFTWARE. 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 */ @@ -402,7 +422,7 @@ THE SOFTWARE. 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; @@ -431,11 +451,11 @@ THE SOFTWARE. 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; - int bytes; + FT_Offset bytes; FT_UNUSED( load_flags ); @@ -448,6 +468,8 @@ THE SOFTWARE. goto Exit; } + stream = face->root.stream; + if ( glyph_index > 0 ) glyph_index--; @@ -563,12 +585,17 @@ THE SOFTWARE. } 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; - aproperty->u.integer = prop->value.integer; + aproperty->u.integer = (FT_Int32)prop->value.l; } return 0; } diff --git a/lib/3rdparty/freetype/src/pcf/pcfdrivr.h b/lib/3rdparty/freetype/src/pcf/pcfdrivr.h index 7ddf697e164..a81d7309e5f 100644 --- a/lib/3rdparty/freetype/src/pcf/pcfdrivr.h +++ b/lib/3rdparty/freetype/src/pcf/pcfdrivr.h @@ -33,6 +33,10 @@ THE SOFTWARE. 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 diff --git a/lib/3rdparty/freetype/src/pcf/pcfread.c b/lib/3rdparty/freetype/src/pcf/pcfread.c index b9123cf574f..08becf99ce3 100644 --- a/lib/3rdparty/freetype/src/pcf/pcfread.c +++ b/lib/3rdparty/freetype/src/pcf/pcfread.c @@ -2,7 +2,7 @@ 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 @@ -32,7 +32,6 @@ THE SOFTWARE. #include FT_INTERNAL_OBJECTS_H #include "pcf.h" -#include "pcfdrivr.h" #include "pcfread.h" #include "pcferror.h" @@ -48,7 +47,7 @@ THE SOFTWARE. #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", @@ -152,7 +151,7 @@ THE SOFTWARE. break; } -#if defined( FT_DEBUG_LEVEL_TRACE ) +#ifdef FT_DEBUG_LEVEL_TRACE { FT_UInt i, j; @@ -290,13 +289,13 @@ THE SOFTWARE. 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_Int i; + FT_ULong i; for ( i = 0; i < ntables; i++ ) @@ -328,10 +327,10 @@ THE SOFTWARE. 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_Int i; + FT_ULong i; for ( i = 0; i < ntables; i++ ) @@ -400,7 +399,7 @@ THE SOFTWARE. { 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; @@ -434,7 +433,10 @@ THE SOFTWARE. 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 ) @@ -443,7 +445,7 @@ THE SOFTWARE. goto Bail; } - face->nprops = nprops; + face->nprops = (int)nprops; if ( FT_NEW_ARRAY( props, nprops ) ) goto Bail; @@ -470,7 +472,11 @@ THE SOFTWARE. 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 ) @@ -539,9 +545,9 @@ THE SOFTWARE. } 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++ ) { - pcf_get_metric( stream, format, metrics + i ); + error = pcf_get_metric( stream, format, metrics + i ); metrics[i].bits = 0; @@ -658,7 +664,7 @@ THE SOFTWARE. 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, @@ -689,7 +695,8 @@ THE SOFTWARE. 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 ) ) @@ -735,8 +742,8 @@ THE SOFTWARE. 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]; @@ -989,9 +996,9 @@ THE SOFTWARE. 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; @@ -1073,7 +1080,7 @@ THE SOFTWARE. /* add_style_name and setwidth_name */ if ( nn == 0 || nn == 3 ) { - int mm; + size_t mm; for ( mm = 0; mm < len; mm++ ) @@ -1198,7 +1205,7 @@ THE SOFTWARE. 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 ); @@ -1206,19 +1213,19 @@ THE SOFTWARE. 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 ) - 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 ) - resolution_x = (FT_Short)prop->value.integer; + resolution_x = (FT_Short)prop->value.l; 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 ) { diff --git a/lib/3rdparty/freetype/src/pcf/pcfutil.c b/lib/3rdparty/freetype/src/pcf/pcfutil.c index 67ddbe8890b..b91274f935b 100644 --- a/lib/3rdparty/freetype/src/pcf/pcfutil.c +++ b/lib/3rdparty/freetype/src/pcf/pcfutil.c @@ -42,9 +42,9 @@ in this Software without prior written authorization from The Open Group. 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; @@ -64,7 +64,7 @@ in this Software without prior written authorization from The Open Group. FT_LOCAL_DEF( void ) TwoByteSwap( unsigned char* buf, - int nbytes ) + size_t nbytes ) { 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, - int nbytes ) + size_t nbytes ) { unsigned char c; diff --git a/lib/3rdparty/freetype/src/pcf/pcfutil.h b/lib/3rdparty/freetype/src/pcf/pcfutil.h index 1557be3e800..ce10fb541d5 100644 --- a/lib/3rdparty/freetype/src/pcf/pcfutil.h +++ b/lib/3rdparty/freetype/src/pcf/pcfutil.h @@ -37,15 +37,15 @@ FT_BEGIN_HEADER FT_LOCAL( void ) BitOrderInvert( unsigned char* buf, - int nbytes ); + size_t nbytes ); FT_LOCAL( void ) TwoByteSwap( unsigned char* buf, - int nbytes ); + size_t nbytes ); FT_LOCAL( void ) FourByteSwap( unsigned char* buf, - int nbytes ); + size_t nbytes ); FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/pcf/rules.mk b/lib/3rdparty/freetype/src/pcf/rules.mk index 1ad4ba897a3..78641528fab 100644 --- a/lib/3rdparty/freetype/src/pcf/rules.mk +++ b/lib/3rdparty/freetype/src/pcf/rules.mk @@ -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 @@ -35,15 +35,14 @@ PCF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PCF_DIR)) # 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_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) diff --git a/lib/3rdparty/freetype/src/pfr/module.mk b/lib/3rdparty/freetype/src/pfr/module.mk index 53ab34aa9fe..8d1d28a9d23 100644 --- a/lib/3rdparty/freetype/src/pfr/module.mk +++ b/lib/3rdparty/freetype/src/pfr/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/pfr/pfrcmap.c b/lib/3rdparty/freetype/src/pfr/pfrcmap.c index c8faee04364..9c8f9ed8eb3 100644 --- a/lib/3rdparty/freetype/src/pfr/pfrcmap.c +++ b/lib/3rdparty/freetype/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -18,7 +18,8 @@ #include "pfrcmap.h" #include "pfrobjs.h" -#include FT_INTERNAL_DEBUG_H + +#include "pfrerror.h" 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 ) { @@ -156,7 +157,9 @@ (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 }; diff --git a/lib/3rdparty/freetype/src/pfr/pfrdrivr.c b/lib/3rdparty/freetype/src/pfr/pfrdrivr.c index 40206720efb..15cca9854e4 100644 --- a/lib/3rdparty/freetype/src/pfr/pfrdrivr.c +++ b/lib/3rdparty/freetype/src/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -66,10 +66,16 @@ 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; + + if ( !gindex ) + goto Exit; + + gindex--; + if ( face ) { PFR_PhyFont phys = &face->phy_font; @@ -82,6 +88,7 @@ } } + Exit: return error; } diff --git a/lib/3rdparty/freetype/src/pfr/pfrdrivr.h b/lib/3rdparty/freetype/src/pfr/pfrdrivr.h index 36f1205b772..da0a1aa6344 100644 --- a/lib/3rdparty/freetype/src/pfr/pfrdrivr.h +++ b/lib/3rdparty/freetype/src/pfr/pfrdrivr.h @@ -26,6 +26,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/pfr/pfrgload.c b/lib/3rdparty/freetype/src/pfr/pfrgload.c index 3bb173302d4..6fe6e4225ab 100644 --- a/lib/3rdparty/freetype/src/pfr/pfrgload.c +++ b/lib/3rdparty/freetype/src/pfr/pfrgload.c @@ -595,7 +595,7 @@ 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 ) ) diff --git a/lib/3rdparty/freetype/src/pfr/pfrload.c b/lib/3rdparty/freetype/src/pfr/pfrload.c index 1ee2c1f8c8b..bc5c035f3da 100644 --- a/lib/3rdparty/freetype/src/pfr/pfrload.c +++ b/lib/3rdparty/freetype/src/pfr/pfrload.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -428,7 +428,8 @@ 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; } @@ -506,7 +507,8 @@ 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; } @@ -603,8 +605,8 @@ 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; } @@ -714,7 +716,8 @@ { 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; diff --git a/lib/3rdparty/freetype/src/pfr/pfrobjs.c b/lib/3rdparty/freetype/src/pfr/pfrobjs.c index 180446d737d..56d617d880a 100644 --- a/lib/3rdparty/freetype/src/pfr/pfrobjs.c +++ b/lib/3rdparty/freetype/src/pfr/pfrobjs.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -41,10 +41,15 @@ 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; diff --git a/lib/3rdparty/freetype/src/pfr/pfrsbit.c b/lib/3rdparty/freetype/src/pfr/pfrsbit.c index 45ff6663b36..d2f17dc9ceb 100644 --- a/lib/3rdparty/freetype/src/pfr/pfrsbit.c +++ b/lib/3rdparty/freetype/src/pfr/pfrsbit.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR bitmap loader (body). */ /* */ -/* Copyright 2002, 2003, 2006 by */ +/* Copyright 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, */ @@ -600,8 +600,8 @@ /* get the bitmap metrics */ { - FT_Long xpos, ypos, advance; - FT_UInt xsize, ysize, format; + FT_Long xpos = 0, ypos = 0, advance = 0; + FT_UInt xsize = 0, ysize = 0, format = 0; FT_Byte* p; @@ -630,18 +630,35 @@ &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 */ + + /* 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.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.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 ) ); @@ -649,8 +666,9 @@ 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 */ { diff --git a/lib/3rdparty/freetype/src/pfr/pfrtypes.h b/lib/3rdparty/freetype/src/pfr/pfrtypes.h index c0ae04253a2..918310814c5 100644 --- a/lib/3rdparty/freetype/src/pfr/pfrtypes.h +++ b/lib/3rdparty/freetype/src/pfr/pfrtypes.h @@ -200,7 +200,7 @@ FT_BEGIN_HEADER FT_Byte flags; FT_Short base_adj; FT_UInt pair_size; - FT_UInt32 offset; + FT_Offset offset; FT_UInt32 pair1; FT_UInt32 pair2; @@ -252,7 +252,7 @@ FT_BEGIN_HEADER FT_UInt blue_scale; FT_UInt num_chars; - FT_UInt32 chars_offset; + FT_Offset chars_offset; 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 */ - FT_UInt32 bct_offset; + FT_Long bct_offset; FT_Byte* cursor; } PFR_PhyFontRec, *PFR_PhyFont; diff --git a/lib/3rdparty/freetype/src/psaux/afmparse.c b/lib/3rdparty/freetype/src/psaux/afmparse.c index 0528fe6ff4f..91a17e2362e 100644 --- a/lib/3rdparty/freetype/src/psaux/afmparse.c +++ b/lib/3rdparty/freetype/src/psaux/afmparse.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -18,7 +18,6 @@ #include <ft2build.h> #include FT_FREETYPE_H #include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_DEBUG_H #include "afmparse.h" #include "psconv.h" @@ -367,11 +366,11 @@ 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; - FT_Int i; + FT_UInt i; if ( n > AFM_MAX_ARGUMENTS ) @@ -379,7 +378,7 @@ for ( i = 0; i < n; i++ ) { - FT_UInt len; + FT_Offset len; AFM_Value val = vals + i; @@ -441,7 +440,7 @@ 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 */ @@ -489,7 +488,7 @@ } if ( len ) - *len = ( key ) ? AFM_STREAM_KEY_LEN( stream, key ) + *len = ( key ) ? (FT_Offset)AFM_STREAM_KEY_LEN( stream, key ) : 0; return key; @@ -498,7 +497,7 @@ static AFM_Token afm_tokenize( const char* key, - FT_UInt len ) + FT_Offset len ) { int n; @@ -586,7 +585,7 @@ AFM_FontInfo fi = parser->FontInfo; AFM_TrackKern tk; char* key; - FT_UInt len; + FT_Offset len; int n = -1; @@ -672,7 +671,12 @@ 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; } @@ -682,7 +686,7 @@ AFM_FontInfo fi = parser->FontInfo; AFM_KernPair kp; char* key; - FT_UInt len; + FT_Offset len; int n = -1; @@ -770,9 +774,9 @@ 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 ) @@ -814,8 +818,8 @@ FT_UInt n, AFM_Token end_section ) { - char* key; - FT_UInt len; + char* key; + FT_Offset len; while ( n-- > 0 ) @@ -846,7 +850,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/psaux/afmparse.h b/lib/3rdparty/freetype/src/psaux/afmparse.h index c2fce75c86e..de2a530b2f0 100644 --- a/lib/3rdparty/freetype/src/psaux/afmparse.h +++ b/lib/3rdparty/freetype/src/psaux/afmparse.h @@ -71,13 +71,13 @@ FT_BEGIN_HEADER 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, - FT_UInt* len ); + FT_Offset* len ); FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/psaux/module.mk b/lib/3rdparty/freetype/src/psaux/module.mk index 5431522084f..42bf6f51999 100644 --- a/lib/3rdparty/freetype/src/psaux/module.mk +++ b/lib/3rdparty/freetype/src/psaux/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/psaux/psauxmod.h b/lib/3rdparty/freetype/src/psaux/psauxmod.h index 92ac0560484..35e042dbce7 100644 --- a/lib/3rdparty/freetype/src/psaux/psauxmod.h +++ b/lib/3rdparty/freetype/src/psaux/psauxmod.h @@ -26,6 +26,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/psaux/psconv.c b/lib/3rdparty/freetype/src/psaux/psconv.c index 3bbeab6d256..1531d8f0fb5 100644 --- a/lib/3rdparty/freetype/src/psaux/psconv.c +++ b/lib/3rdparty/freetype/src/psaux/psconv.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -18,10 +18,8 @@ #include <ft2build.h> #include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_DEBUG_H #include "psconv.h" -#include "psobjs.h" #include "psauxerr.h" @@ -187,10 +185,18 @@ if ( c < 0 || c >= 10 ) break; - if ( divider < 10000000L ) + if ( !integral && power_ten > 0 ) { + power_ten--; decimal = decimal * 10 + c; - divider *= 10; + } + else + { + if ( divider < 10000000L ) + { + decimal = decimal * 10 + c; + divider *= 10; + } } } } @@ -233,7 +239,7 @@ 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; @@ -328,7 +334,7 @@ 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; @@ -417,7 +423,7 @@ PS_Conv_EexecDecode( FT_Byte** cursor, FT_Byte* limit, FT_Byte* buffer, - FT_UInt n, + FT_Offset n, FT_UShort* seed ) { FT_Byte* p; diff --git a/lib/3rdparty/freetype/src/psaux/psconv.h b/lib/3rdparty/freetype/src/psaux/psconv.h index e51124185d7..84854ba0d16 100644 --- a/lib/3rdparty/freetype/src/psaux/psconv.h +++ b/lib/3rdparty/freetype/src/psaux/psconv.h @@ -46,20 +46,20 @@ FT_BEGIN_HEADER 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, - FT_UInt n ); + FT_Offset n ); 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 ); diff --git a/lib/3rdparty/freetype/src/psaux/psobjs.c b/lib/3rdparty/freetype/src/psaux/psobjs.c index 957085668be..fe8398ae388 100644 --- a/lib/3rdparty/freetype/src/psaux/psobjs.c +++ b/lib/3rdparty/freetype/src/psaux/psobjs.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -19,6 +19,7 @@ #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" @@ -169,17 +170,23 @@ 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; } + 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; - FT_Offset new_size = table->capacity; + FT_Offset new_size = table->capacity; FT_Long in_offset; @@ -376,7 +383,7 @@ /* 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; @@ -558,8 +565,8 @@ 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; } @@ -584,9 +591,10 @@ 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; @@ -1147,8 +1155,10 @@ } 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; @@ -1185,8 +1195,8 @@ 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; } @@ -1259,8 +1269,9 @@ 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; @@ -1302,7 +1313,7 @@ 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 ) { @@ -1483,12 +1494,6 @@ 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; @@ -1550,16 +1555,9 @@ 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 ); - - builder->last = *point; } outline->n_points++; } @@ -1640,27 +1638,24 @@ t1_builder_close_contour( T1_Builder builder ) { FT_Outline* outline = builder->current; + FT_Int first; 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 ) { - 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; - 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 ) @@ -1669,8 +1664,18 @@ } 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 ); + } } diff --git a/lib/3rdparty/freetype/src/psaux/psobjs.h b/lib/3rdparty/freetype/src/psaux/psobjs.h index c2cbf2c79b3..e380c60dabb 100644 --- a/lib/3rdparty/freetype/src/psaux/psobjs.h +++ b/lib/3rdparty/freetype/src/psaux/psobjs.h @@ -111,7 +111,7 @@ FT_BEGIN_HEADER 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 ); diff --git a/lib/3rdparty/freetype/src/psaux/t1cmap.c b/lib/3rdparty/freetype/src/psaux/t1cmap.c index 29346869660..f933e4da88d 100644 --- a/lib/3rdparty/freetype/src/psaux/t1cmap.c +++ b/lib/3rdparty/freetype/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -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 ) { @@ -135,7 +135,9 @@ (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 }; @@ -154,7 +156,9 @@ (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 }; @@ -175,7 +179,7 @@ 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 ); @@ -209,7 +213,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) t1_cmap_custom_char_next( T1_CMapCustom cmap, FT_UInt32 *pchar_code ) { @@ -245,7 +249,9 @@ (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 }; @@ -306,7 +312,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) t1_cmap_unicode_char_next( PS_Unicodes unicodes, FT_UInt32 *pchar_code ) { @@ -326,7 +332,9 @@ (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 }; diff --git a/lib/3rdparty/freetype/src/psaux/t1decode.c b/lib/3rdparty/freetype/src/psaux/t1decode.c index f790643f961..31554ff1ba7 100644 --- a/lib/3rdparty/freetype/src/psaux/t1decode.c +++ b/lib/3rdparty/freetype/src/psaux/t1decode.c @@ -4,7 +4,8 @@ /* */ /* 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 */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +18,7 @@ #include <ft2build.h> +#include FT_INTERNAL_CALC_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H #include FT_OUTLINE_H @@ -144,7 +146,8 @@ 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; } @@ -193,26 +196,52 @@ #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; /* `glyph_names' is set to 0 for CID fonts which do not */ /* include an encoding. How can we deal with these? */ +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( decoder->glyph_names == 0 && + !face->root.internal->incremental_interface ) +#else if ( decoder->glyph_names == 0 ) +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ { - 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; } - 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 ) { - 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; } @@ -243,8 +272,8 @@ /* 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; @@ -260,7 +289,10 @@ 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 ); + decoder->seac = FALSE; if ( error ) goto Exit; @@ -278,7 +310,11 @@ /* 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 ); + decoder->seac = FALSE; if ( error ) goto Exit; @@ -327,9 +363,15 @@ 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; +#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 @@ -339,6 +381,16 @@ #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; @@ -351,15 +403,15 @@ /* 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 ) - 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; @@ -374,18 +426,26 @@ 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; - FT_Long value = 0; + FT_Int32 value = 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 /*********************************************************************/ /* */ @@ -456,8 +516,8 @@ 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; } @@ -492,8 +552,8 @@ 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; } @@ -502,42 +562,69 @@ 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; } - 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; + + /* 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 ) - value = (FT_Long)ip[-1] - 139; + value = (FT_Int32)ip[-1] - 139; 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 ) - value = ( ( (FT_Long)ip[-2] - 247 ) << 8 ) + ip[-1] + 108; + value = ( ( (FT_Int32)ip[-2] - 247 ) << 8 ) + ip[-1] + 108; 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 { - 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; } } @@ -559,6 +646,14 @@ } } + 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 */ @@ -568,11 +663,16 @@ { 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; } - 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; @@ -583,15 +683,18 @@ 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; - 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 ); /***********************************************************/ /* */ @@ -668,8 +771,8 @@ 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; } @@ -685,7 +788,6 @@ if ( hinter ) hinter->reset( hinter->hints, builder->current->n_points ); - break; case 12: @@ -708,16 +810,16 @@ 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 ) ) { - 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; } @@ -753,12 +855,6 @@ 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> ) */ @@ -771,16 +867,16 @@ 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; - 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; @@ -812,7 +908,7 @@ 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; @@ -823,24 +919,23 @@ 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; -#endif /* CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS */ - 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; + 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; @@ -850,17 +945,18 @@ 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; + 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; @@ -876,13 +972,13 @@ /* <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 */ - /* ==> 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; @@ -893,28 +989,40 @@ 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; - 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; -#endif 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: - 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; } @@ -951,9 +1059,9 @@ 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; } @@ -965,28 +1073,26 @@ switch ( op ) { case op_endchar: - FT_TRACE4(( " endchar" )); + FT_TRACE4(( " endchar\n" )); 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, - (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 ); - FT_TRACE4(( "\n" )); - /* the compiler should optimize away this empty loop but ... */ #ifdef FT_DEBUG_LEVEL_TRACE @@ -1020,8 +1126,8 @@ 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 ); @@ -1034,9 +1140,12 @@ 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" )); @@ -1048,8 +1157,8 @@ 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 */ @@ -1062,10 +1171,11 @@ 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; @@ -1134,7 +1244,7 @@ break; case op_rrcurveto: - FT_TRACE4(( " rcurveto" )); + FT_TRACE4(( " rrcurveto" )); if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) @@ -1193,16 +1303,13 @@ 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: @@ -1212,18 +1319,18 @@ FT_TRACE4(( " callsubr" )); - idx = (FT_Int)top[0]; + idx = (FT_Int)( top[0] >> 16 ); 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 ) { - 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; } @@ -1250,8 +1357,8 @@ 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; } @@ -1273,8 +1380,8 @@ 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; } @@ -1287,7 +1394,8 @@ 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; } @@ -1311,7 +1419,6 @@ /* top[0] += builder->left_bearing.y; */ hinter->stem( hinter->hints, 1, top ); } - break; case op_hstem3: @@ -1320,19 +1427,17 @@ /* record horizontal counter-controlled hints */ if ( hinter ) hinter->stem3( hinter->hints, 1, top ); - 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 ); } - break; case op_vstem3: @@ -1354,20 +1459,28 @@ case op_setcurrentpoint: FT_TRACE4(( " setcurrentpoint" )); - /* From the T1 specs, section 6.4: */ + /* From the T1 specification, section 6.4: */ /* */ /* The setcurrentpoint command is used only in */ /* conjunction with results from OtherSubrs procedures. */ - /* known_othersubr_result_cnt != 0 is already handled above */ + /* known_othersubr_result_cnt != 0 is already handled */ + /* above. */ + + /* Note, however, that both Ghostscript and Adobe */ + /* Distiller handle this situation by silently ignoring */ + /* the inappropriate `setcurrentpoint' instruction. So */ + /* we do the same. */ +#if 0 + 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 +#endif decoder->flex_state = 0; break; @@ -1377,8 +1490,8 @@ 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; } @@ -1389,6 +1502,11 @@ decoder->top = top; +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( "\n" )); + bol = TRUE; +#endif + } /* general operator processing */ } /* while ip < limit */ @@ -1437,8 +1555,8 @@ 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; } diff --git a/lib/3rdparty/freetype/src/pshinter/Jamfile b/lib/3rdparty/freetype/src/pshinter/Jamfile index 769dcc4b296..779f1b0b828 100644 --- a/lib/3rdparty/freetype/src/pshinter/Jamfile +++ b/lib/3rdparty/freetype/src/pshinter/Jamfile @@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ; if $(FT2_MULTI) { - _sources = pshrec pshglob pshalgo pshmod ; + _sources = pshrec pshglob pshalgo pshmod pshpic ; } else { diff --git a/lib/3rdparty/freetype/src/pshinter/module.mk b/lib/3rdparty/freetype/src/pshinter/module.mk index cd171d03552..ed24eb7fa89 100644 --- a/lib/3rdparty/freetype/src/pshinter/module.mk +++ b/lib/3rdparty/freetype/src/pshinter/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/pshinter/pshalgo.c b/lib/3rdparty/freetype/src/pshinter/pshalgo.c index 505d95c5720..417dcee547a 100644 --- a/lib/3rdparty/freetype/src/pshinter/pshalgo.c +++ b/lib/3rdparty/freetype/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ /* */ /* 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 */ @@ -103,7 +103,7 @@ 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; } @@ -137,7 +137,7 @@ 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" )); } @@ -230,7 +230,7 @@ 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++ ) @@ -282,8 +282,8 @@ { 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; @@ -295,8 +295,8 @@ 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" )); } } } @@ -898,7 +898,7 @@ #ifdef DEBUG_ZONES -#include <stdio.h> +#include FT_CONFIG_STANDARD_LIBRARY_H static void psh_print_zone( PSH_Zone zone ) @@ -2223,15 +2223,22 @@ 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_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 ) { + rescale = TRUE; + y_scale = FT_MulDiv( y_scale, fitted, scaled ); if ( fitted < scaled ) @@ -2239,43 +2246,47 @@ 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: diff --git a/lib/3rdparty/freetype/src/pshinter/pshalgo.h b/lib/3rdparty/freetype/src/pshinter/pshalgo.h index f68de71202e..1a248a70524 100644 --- a/lib/3rdparty/freetype/src/pshinter/pshalgo.h +++ b/lib/3rdparty/freetype/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -32,7 +32,7 @@ FT_BEGIN_HEADER 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, diff --git a/lib/3rdparty/freetype/src/pshinter/pshinter.c b/lib/3rdparty/freetype/src/pshinter/pshinter.c index 8e3f193093b..b35a2a91c53 100644 --- a/lib/3rdparty/freetype/src/pshinter/pshinter.c +++ b/lib/3rdparty/freetype/src/pshinter/pshinter.c @@ -19,6 +19,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> +#include "pshpic.c" #include "pshrec.c" #include "pshglob.c" #include "pshalgo.c" diff --git a/lib/3rdparty/freetype/src/pshinter/pshmod.c b/lib/3rdparty/freetype/src/pshinter/pshmod.c index 4eb3d912729..91da5d7e6bc 100644 --- a/lib/3rdparty/freetype/src/pshinter/pshmod.c +++ b/lib/3rdparty/freetype/src/pshinter/pshmod.c @@ -20,6 +20,7 @@ #include FT_INTERNAL_OBJECTS_H #include "pshrec.h" #include "pshalgo.h" +#include "pshpic.h" /* the Postscript Hinter module structure */ @@ -92,30 +93,26 @@ } - static - const PSHinter_Interface pshinter_interface = - { + FT_DEFINE_PSHINTER_INTERFACE(pshinter_interface, 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, - &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 */ - }; - + ) /* END */ diff --git a/lib/3rdparty/freetype/src/pshinter/pshmod.h b/lib/3rdparty/freetype/src/pshinter/pshmod.h index 1a91025b260..0ae7e96f54e 100644 --- a/lib/3rdparty/freetype/src/pshinter/pshmod.h +++ b/lib/3rdparty/freetype/src/pshinter/pshmod.h @@ -27,7 +27,7 @@ FT_BEGIN_HEADER - FT_EXPORT_VAR( const FT_Module_Class ) pshinter_module_class; + FT_DECLARE_MODULE( pshinter_module_class ) FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/pshinter/pshpic.c b/lib/3rdparty/freetype/src/pshinter/pshpic.c new file mode 100644 index 00000000000..51a08798883 --- /dev/null +++ b/lib/3rdparty/freetype/src/pshinter/pshpic.c @@ -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/lib/3rdparty/freetype/src/pshinter/pshpic.h b/lib/3rdparty/freetype/src/pshinter/pshpic.h new file mode 100644 index 00000000000..3555d8e8513 --- /dev/null +++ b/lib/3rdparty/freetype/src/pshinter/pshpic.h @@ -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 */ diff --git a/lib/3rdparty/freetype/src/pshinter/pshrec.c b/lib/3rdparty/freetype/src/pshinter/pshrec.c index 2a885ef2763..0910cc5e6a5 100644 --- a/lib/3rdparty/freetype/src/pshinter/pshrec.c +++ b/lib/3rdparty/freetype/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -20,6 +20,8 @@ #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" @@ -62,7 +64,7 @@ { 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 ) @@ -81,7 +83,7 @@ FT_Memory memory, PS_Hint *ahint ) { - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; FT_UInt count; PS_Hint hint = 0; @@ -137,7 +139,7 @@ { 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 ) @@ -184,7 +186,7 @@ FT_Int idx, FT_Memory memory ) { - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; FT_Byte* p; @@ -234,7 +236,7 @@ { 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 ) @@ -254,7 +256,7 @@ PS_Mask *amask ) { FT_UInt count; - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; PS_Mask mask = 0; @@ -285,7 +287,7 @@ FT_Memory memory, PS_Mask *amask ) { - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; FT_UInt count; PS_Mask mask; @@ -314,7 +316,7 @@ FT_UInt bit_count, FT_Memory memory ) { - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; PS_Mask mask; @@ -407,7 +409,7 @@ FT_Memory memory ) { FT_UInt temp; - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; /* swap index1 and index2 so that index1 < index2 */ @@ -481,8 +483,8 @@ 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; @@ -497,7 +499,7 @@ 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-- ) @@ -558,8 +560,8 @@ 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 */ @@ -619,7 +621,7 @@ FT_UInt end_point, FT_Memory memory ) { - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; /* reset current mask, if any */ @@ -644,7 +646,7 @@ FT_Memory memory, FT_Int *aindex ) { - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; FT_UInt flags = 0; @@ -715,7 +717,7 @@ 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; @@ -789,7 +791,7 @@ 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; } @@ -800,7 +802,7 @@ { FT_MEM_ZERO( hints, sizeof ( *hints ) ); hints->memory = memory; - return 0; + return PSH_Err_Ok; } @@ -813,7 +815,7 @@ { 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] ); @@ -824,7 +826,7 @@ 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; } } @@ -842,8 +844,8 @@ /* 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 ); } @@ -878,8 +880,8 @@ } 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; } } @@ -888,11 +890,11 @@ /* 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 ) @@ -906,8 +908,8 @@ /* 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 ); } @@ -919,9 +921,10 @@ /* 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; } @@ -934,7 +937,7 @@ } 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; } @@ -953,7 +956,7 @@ ps_hints_t1reset( PS_Hints hints, FT_UInt end_point ) { - FT_Error error = 0; + FT_Error error = PSH_Err_Ok; if ( !hints->error ) @@ -1008,8 +1011,8 @@ /* 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 */ @@ -1053,8 +1056,8 @@ /* 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 */ @@ -1124,11 +1127,17 @@ } 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 ); } @@ -1183,7 +1192,7 @@ for ( n = 0; n < count * 2; n++ ) { y += coords[n]; - stems[n] = ( y + 0x8000L ) >> 16; + stems[n] = FIXED_TO_INT( y ); } /* compute lengths */ diff --git a/lib/3rdparty/freetype/src/pshinter/pshrec.h b/lib/3rdparty/freetype/src/pshinter/pshrec.h index f7ef9004ea1..dcb3197f94d 100644 --- a/lib/3rdparty/freetype/src/pshinter/pshrec.h +++ b/lib/3rdparty/freetype/src/pshinter/pshrec.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -52,7 +52,7 @@ FT_BEGIN_HEADER 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 @@ -61,7 +61,7 @@ FT_BEGIN_HEADER /* hint flags */ - typedef enum + typedef enum PS_Hint_Flags_ { PS_HINT_FLAG_GHOST = 1, PS_HINT_FLAG_BOTTOM = 2 diff --git a/lib/3rdparty/freetype/src/psnames/Jamfile b/lib/3rdparty/freetype/src/psnames/Jamfile index d85c1e97de4..06c0dda66f2 100644 --- a/lib/3rdparty/freetype/src/psnames/Jamfile +++ b/lib/3rdparty/freetype/src/psnames/Jamfile @@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) psnames ; if $(FT2_MULTI) { - _sources = psmodule ; + _sources = psmodule pspic ; } else { diff --git a/lib/3rdparty/freetype/src/psnames/module.mk b/lib/3rdparty/freetype/src/psnames/module.mk index a93063b928d..a6e908257cb 100644 --- a/lib/3rdparty/freetype/src/psnames/module.mk +++ b/lib/3rdparty/freetype/src/psnames/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/psnames/psmodule.c b/lib/3rdparty/freetype/src/psnames/psmodule.c index 8d8c476a145..35188504936 100644 --- a/lib/3rdparty/freetype/src/psnames/psmodule.c +++ b/lib/3rdparty/freetype/src/psnames/psmodule.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -24,16 +24,17 @@ #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 -#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 */ @@ -57,7 +58,7 @@ /* `uniXXXXYYYYZZZZ'... */ FT_Int count; - FT_ULong value = 0; + FT_UInt32 value = 0; const char* p = glyph_name + 3; @@ -92,7 +93,7 @@ if ( *p == '\0' ) return value; if ( *p == '.' ) - return value | VARIANT_BIT; + return (FT_UInt32)( value | VARIANT_BIT ); } } @@ -101,7 +102,7 @@ if ( glyph_name[0] == 'u' ) { FT_Int count; - FT_ULong value = 0; + FT_UInt32 value = 0; const char* p = glyph_name + 1; @@ -132,7 +133,7 @@ if ( *p == '\0' ) return value; if ( *p == '.' ) - return value | VARIANT_BIT; + return (FT_UInt32)( value | VARIANT_BIT ); } } @@ -154,9 +155,10 @@ /* 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 - return ft_get_adobe_glyph_index( glyph_name, dot ) | VARIANT_BIT; + return (FT_UInt32)( ft_get_adobe_glyph_index( glyph_name, dot ) | + VARIANT_BIT ); } } @@ -174,9 +176,121 @@ /* 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 - 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; + } + } } @@ -191,12 +305,15 @@ { 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; - 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; @@ -213,10 +330,14 @@ 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 ) { + ps_check_extra_glyph_unicode( uni_char, + extra_glyph_list_states ); map->unicode = uni_char; map->glyph_index = n; map++; @@ -227,6 +348,19 @@ } } + 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 ); @@ -303,7 +437,7 @@ } - static FT_ULong + static FT_UInt32 ps_unicodes_char_next( PS_Unicodes table, FT_UInt32 *unicode ) { @@ -384,56 +518,66 @@ } - static - const FT_Service_PsCMapsRec pscmaps_interface = - { #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_Macintosh_NameFunc) ps_get_macintosh_name, + (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, + + t1_standard_encoding, + t1_expert_encoding + ) + #else + FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface, 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 - }; + ) + +#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 ) { - 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 ), @@ -441,18 +585,12 @@ 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_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 */ diff --git a/lib/3rdparty/freetype/src/psnames/psmodule.h b/lib/3rdparty/freetype/src/psnames/psmodule.h index 232fdfb9a90..28fa14807c0 100644 --- a/lib/3rdparty/freetype/src/psnames/psmodule.h +++ b/lib/3rdparty/freetype/src/psnames/psmodule.h @@ -27,7 +27,7 @@ FT_BEGIN_HEADER - FT_EXPORT_VAR( const FT_Module_Class ) psnames_module_class; + FT_DECLARE_MODULE( psnames_module_class ) FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/psnames/psnames.c b/lib/3rdparty/freetype/src/psnames/psnames.c index d6ed998bfb1..1ede225dc9c 100644 --- a/lib/3rdparty/freetype/src/psnames/psnames.c +++ b/lib/3rdparty/freetype/src/psnames/psnames.c @@ -19,6 +19,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> +#include "pspic.c" #include "psmodule.c" diff --git a/lib/3rdparty/freetype/src/psnames/pspic.c b/lib/3rdparty/freetype/src/psnames/pspic.c new file mode 100644 index 00000000000..ed7dadda393 --- /dev/null +++ b/lib/3rdparty/freetype/src/psnames/pspic.c @@ -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/lib/3rdparty/freetype/src/psnames/pspic.h b/lib/3rdparty/freetype/src/psnames/pspic.h new file mode 100644 index 00000000000..75a14fdcb9b --- /dev/null +++ b/lib/3rdparty/freetype/src/psnames/pspic.h @@ -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 */ diff --git a/lib/3rdparty/freetype/src/psnames/pstables.h b/lib/3rdparty/freetype/src/psnames/pstables.h index cc40ef735d6..1521e9c2854 100644 --- a/lib/3rdparty/freetype/src/psnames/pstables.h +++ b/lib/3rdparty/freetype/src/psnames/pstables.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -561,7 +561,10 @@ * 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, @@ -4086,5 +4089,7 @@ return 0; } +#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ + /* END */ diff --git a/lib/3rdparty/freetype/src/raster/Jamfile b/lib/3rdparty/freetype/src/raster/Jamfile index f6e4251cb8f..4f60e87c788 100644 --- a/lib/3rdparty/freetype/src/raster/Jamfile +++ b/lib/3rdparty/freetype/src/raster/Jamfile @@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) raster ; if $(FT2_MULTI) { - _sources = ftraster ftrend1 ; + _sources = ftraster ftrend1 rastpic ; } else { diff --git a/lib/3rdparty/freetype/src/raster/ftmisc.h b/lib/3rdparty/freetype/src/raster/ftmisc.h index c5dbd50d003..f04b5404bb8 100644 --- a/lib/3rdparty/freetype/src/raster/ftmisc.h +++ b/lib/3rdparty/freetype/src/raster/ftmisc.h @@ -5,7 +5,7 @@ /* 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 */ @@ -27,7 +27,8 @@ #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 @@ -51,6 +52,31 @@ (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> diff --git a/lib/3rdparty/freetype/src/raster/ftraster.c b/lib/3rdparty/freetype/src/raster/ftraster.c index 4cfca4ed035..23ad592653c 100644 --- a/lib/3rdparty/freetype/src/raster/ftraster.c +++ b/lib/3rdparty/freetype/src/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -49,6 +49,10 @@ #ifdef _STANDALONE_ +#define FT_CONFIG_STANDARD_LIBRARY_H <stdlib.h> + +#include <string.h> /* for memset */ + #include "ftmisc.h" #include "ftimage.h" @@ -58,6 +62,8 @@ #include "ftraster.h" #include FT_INTERNAL_CALC_H /* for FT_MulDiv only */ +#include "rastpic.h" + #endif /* !_STANDALONE_ */ @@ -72,13 +78,15 @@ /* 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 */ - /* between `Ymin' and `Ymax'. */ + /* between `Ymin' and `Ymax' */ /* */ /* 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 */ @@ -88,15 +96,15 @@ /* 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. */ /* */ @@ -140,13 +148,11 @@ /*************************************************************************/ /* 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. */ @@ -183,13 +189,13 @@ /* 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 -#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 @@ -199,9 +205,22 @@ #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 @@ -217,7 +236,7 @@ #define Raster_Err_Unsupported Raster_Err_Cannot_Render_Glyph -#endif /* _STANDALONE_ */ +#endif /* !_STANDALONE_ */ #ifndef FT_MEM_SET @@ -306,13 +325,10 @@ } 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 */ @@ -331,18 +347,21 @@ 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; @@ -372,10 +391,10 @@ #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, @@ -387,10 +406,10 @@ #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 */ @@ -417,65 +436,68 @@ #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_ { - 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 */ - 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 */ - 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 */ - TStates state; /* rendering state */ + TStates state; /* rendering state */ 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 */ @@ -484,31 +506,31 @@ 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. */ - 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 - 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 */ - 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 */ @@ -520,47 +542,90 @@ }; - 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 - static TWorker cur_ras; + static TWorker cur_ras; #define ras cur_ras -#else +#else /* !FT_STATIC_RASTER */ #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> */ - /* 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), */ @@ -590,9 +655,9 @@ static const char count_table[256] = { 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 { @@ -616,17 +681,21 @@ static const char count_table[256] = /* New_Profile */ /* */ /* <Description> */ - /* Creates a new profile in the render pool. */ + /* Create a new profile in the render pool. */ /* */ /* <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 - New_Profile( RAS_ARGS TStates aState ) + New_Profile( RAS_ARGS TStates aState, + Bool overshoot ) { if ( !ras.fProfile ) { @@ -641,30 +710,36 @@ static const char count_table[256] = 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: - 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: - 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_ERROR(( "New_Profile: invalid profile direction!\n" )); + FT_ERROR(( "New_Profile: invalid profile direction\n" )); 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; @@ -682,13 +757,17 @@ static const char count_table[256] = /* 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 - End_Profile( RAS_ARG ) + End_Profile( RAS_ARGS Bool overshoot ) { Long h; PProfile oldProfile; @@ -698,7 +777,7 @@ static const char count_table[256] = 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; } @@ -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 )); - oldProfile = ras.cProfile; 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; - oldProfile->next = ras.cProfile; + + oldProfile->next = ras.cProfile; ras.num_Profs++; } @@ -739,7 +827,7 @@ static const char count_table[256] = /* 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> */ @@ -794,7 +882,7 @@ static const char count_table[256] = /* 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. */ @@ -808,10 +896,10 @@ static const char count_table[256] = n = ras.num_Profs; + p = ras.fProfile; - if ( n > 1 ) + if ( n > 1 && p ) { - p = ras.fProfile; while ( n > 0 ) { if ( n > 1 ) @@ -819,23 +907,21 @@ static const char count_table[256] = 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; - 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; @@ -855,7 +941,7 @@ static const char count_table[256] = /* 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> */ @@ -894,7 +980,7 @@ static const char count_table[256] = /* 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> */ @@ -936,7 +1022,7 @@ static const char count_table[256] = /* 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> */ @@ -1075,8 +1161,8 @@ static const char count_table[256] = /* 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. */ @@ -1126,7 +1212,7 @@ static const char count_table[256] = /* 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> */ @@ -1227,7 +1313,7 @@ static const char count_table[256] = } 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; @@ -1259,7 +1345,7 @@ static const char count_table[256] = /* 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> */ @@ -1308,7 +1394,7 @@ static const char count_table[256] = /* 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 */ @@ -1332,13 +1418,15 @@ static const char count_table[256] = 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 ) - if ( New_Profile( RAS_VARS Descending_State ) ) + if ( New_Profile( RAS_VARS Descending_State, + IS_TOP_OVERSHOOT( ras.lastY ) ) ) return FAILURE; } break; @@ -1346,8 +1434,9 @@ static const char count_table[256] = 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; @@ -1355,8 +1444,9 @@ static const char count_table[256] = 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; @@ -1371,13 +1461,13 @@ static const char count_table[256] = { 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, - x, y, ras.minY, ras.maxY ) ) + x, y, ras.minY, ras.maxY ) ) return FAILURE; break; @@ -1398,7 +1488,7 @@ static const char count_table[256] = /* 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. */ @@ -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[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 { @@ -1469,13 +1561,17 @@ static const char count_table[256] = 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 */ - 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 */ - if ( New_Profile( RAS_VARS state_bez ) ) + if ( New_Profile( RAS_VARS state_bez, o ) ) goto Fail; } @@ -1508,7 +1604,7 @@ static const char count_table[256] = /* 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. */ @@ -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[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 { @@ -1598,11 +1697,16 @@ static const char count_table[256] = /* 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; - if ( New_Profile( RAS_VARS state_bez ) ) + if ( New_Profile( RAS_VARS state_bez, o ) ) goto Fail; } @@ -1646,7 +1750,7 @@ static const char count_table[256] = /* 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! */ @@ -1695,8 +1799,13 @@ static const char count_table[256] = 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 ) @@ -1867,7 +1976,7 @@ static const char count_table[256] = /* 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> */ @@ -1902,27 +2011,36 @@ static const char count_table[256] = 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.outline.contours[i], - flipped ) ) + ras.outline.contours[i], + flipped ) ) 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 ( 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; - 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 */ @@ -2042,7 +2160,7 @@ static const char count_table[256] = while ( current ) { current->X = *current->offset; - current->offset += current->flow; + current->offset += current->flags & Flow_Up ? 1 : -1; 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 ) ); - 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; @@ -2182,38 +2302,63 @@ static const char count_table[256] = PProfile left, PProfile right ) { - Long e1, e2; + Long e1, e2, pxl; 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 ) { + Int dropOutControl = left->flags & 7; + + if ( e1 == e2 + ras.precision ) { - switch ( ras.dropOutControl ) + switch ( dropOutControl ) { - case 1: - e1 = e2; + case 0: /* simple drop-outs including stubs */ + pxl = e2; 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; - 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: */ /* */ @@ -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 */ /* */ + /* 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; - if ( ras.dropOutControl == 2 ) - e1 = e2; + if ( dropOutControl == 1 ) + pxl = e2; else - e1 = CEILING( ( x1 + x2 + 1 ) / 2 ); - + pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); 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; } - e1 = TRUNC( e1 ); + e1 = TRUNC( pxl ); 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 ); } @@ -2363,74 +2513,88 @@ static const char count_table[256] = 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 */ - 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 ) { + Int dropOutControl = left->flags & 7; + + if ( e1 == e2 + ras.precision ) { - switch ( ras.dropOutControl ) + switch ( dropOutControl ) { - case 1: - e1 = e2; + case 0: /* simple drop-outs including stubs */ + pxl = e2; 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; - 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 ) + if ( left->next == right && + left->height <= 0 && + !( left->flags & Overshoot_Top && + x2 - x1 >= ras.precision_half ) ) 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; - /* 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; @@ -2439,7 +2603,7 @@ static const char count_table[256] = bits = ras.bTarget + ( y >> 3 ); f1 = (Byte)( 0x80 >> ( y & 7 ) ); - e1 = TRUNC( e1 ); + e1 = TRUNC( pxl ); 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 ) { - 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; @@ -2524,10 +2688,10 @@ static const char count_table[256] = 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 ) @@ -2539,8 +2703,8 @@ static const char count_table[256] = 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; @@ -2625,32 +2789,30 @@ static const char count_table[256] = /* During the horizontal sweep, we only take care of drop-outs */ + e1 = CEILING( x1 ); e2 = FLOOR ( x2 ); if ( e1 > e2 ) { + Int dropOutControl = left->flags & 7; + + if ( e1 == e2 + ras.precision ) { - switch ( ras.dropOutControl ) + switch ( dropOutControl ) { - case 1: + case 0: /* simple drop-outs including stubs */ 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; - 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 ) @@ -2660,15 +2822,15 @@ static const char count_table[256] = if ( right->next == left && left->start == y ) return; - if ( ras.dropOutControl == 2 ) + if ( dropOutControl == 1 ) e1 = e2; else - e1 = CEILING( ( x1 + x2 + 1 ) / 2 ); + e1 = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); break; - default: - return; /* unsupported mode */ + default: /* modes 2, 3, 6, 7 */ + return; /* no drop-out control */ } } else @@ -2720,7 +2882,7 @@ static const char count_table[256] = TProfileList draw_left, draw_right; - /* Init empty linked lists */ + /* initialize empty linked lists */ Init_Linked( &waiting ); @@ -2740,8 +2902,10 @@ static const char count_table[256] = 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 ); @@ -2749,18 +2913,18 @@ static const char count_table[256] = P = Q; } - /* Check the Y-turns */ + /* check the Y-turns */ 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 ); - /* Then compute the distance of each profile from min_Y */ + /* then compute the distance of each profile from min_Y */ P = waiting; @@ -2770,18 +2934,18 @@ static const char count_table[256] = P = P->link; } - /* Let's go */ + /* let's go */ 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 ) { - /* look in the waiting list for new activations */ + /* check waiting list for new activations */ P = waiting; @@ -2793,22 +2957,16 @@ static const char count_table[256] = { DelOld( &waiting, P ); - switch ( P->flow ) - { - case Flow_Up: + if ( P->flags & Flow_Up ) InsNew( &draw_left, P ); - break; - - case Flow_Down: + else InsNew( &draw_right, P ); - break; - } } P = Q; } - /* Sort the drawing lists */ + /* sort the drawing lists */ Sort( &draw_left ); Sort( &draw_right ); @@ -2818,7 +2976,7 @@ static const char count_table[256] = while ( y < y_change ) { - /* Let's trace */ + /* let's trace */ dropouts = 0; @@ -2837,22 +2995,28 @@ static const char count_table[256] = 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; } @@ -2866,9 +3030,9 @@ static const char count_table[256] = 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; @@ -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 ) @@ -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 ); @@ -2949,7 +3113,7 @@ static const char count_table[256] = /* 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. */ @@ -3024,7 +3188,7 @@ static const char count_table[256] = /* 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. */ @@ -3036,14 +3200,24 @@ static const char count_table[256] = 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; @@ -3062,7 +3236,7 @@ static const char count_table[256] = 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; @@ -3083,14 +3257,13 @@ static const char count_table[256] = #ifdef FT_RASTER_OPTION_ANTI_ALIASING - /*************************************************************************/ /* */ /* <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. */ @@ -3103,13 +3276,23 @@ static const char count_table[256] = 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 */ @@ -3137,7 +3320,7 @@ static const char count_table[256] = 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; @@ -3172,8 +3355,6 @@ static const char count_table[256] = static void ft_black_init( PRaster raster ) { - FT_UNUSED( raster ); - #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; - +#else + FT_UNUSED( raster ); #endif } @@ -3196,7 +3378,7 @@ static const char count_table[256] = static int - ft_black_new( void* memory, + ft_black_new( void* memory, FT_Raster *araster ) { static TRaster the_raster; @@ -3254,9 +3436,9 @@ static const char count_table[256] = 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 ) { @@ -3281,9 +3463,9 @@ static const char count_table[256] = 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 @@ -3319,14 +3501,18 @@ static const char count_table[256] = 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; - if ( !outline || !outline->contours || !outline->points ) + if ( !outline->contours || !outline->points ) 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; @@ -3335,35 +3521,43 @@ static const char count_table[256] = if ( params->flags & FT_RASTER_FLAG_DIRECT ) return Raster_Err_Unsupported; - if ( !target_map || !target_map->buffer ) + if ( !target_map ) 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 - 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 - 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 - }; + ) /* END */ diff --git a/lib/3rdparty/freetype/src/raster/ftrend1.c b/lib/3rdparty/freetype/src/raster/ftrend1.c index 3cc8d07413b..1ed8af61217 100644 --- a/lib/3rdparty/freetype/src/raster/ftrend1.c +++ b/lib/3rdparty/freetype/src/raster/ftrend1.c @@ -21,6 +21,7 @@ #include FT_OUTLINE_H #include "ftrend1.h" #include "ftraster.h" +#include "rastpic.h" #include "rasterrs.h" @@ -118,6 +119,7 @@ } /* check rendering mode */ +#ifndef FT_CONFIG_OPTION_PIC if ( mode != FT_RENDER_MODE_MONO ) { /* raster1 is only capable of producing monochrome bitmaps */ @@ -130,6 +132,25 @@ 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; @@ -208,10 +229,8 @@ } - 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 ), @@ -224,7 +243,7 @@ (FT_Module_Constructor)ft_raster1_init, (FT_Module_Destructor) 0, (FT_Module_Requester) 0 - }, + , FT_GLYPH_FORMAT_OUTLINE, @@ -233,18 +252,17 @@ (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. */ /* */ - 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 ), @@ -257,7 +275,7 @@ (FT_Module_Constructor)ft_raster1_init, (FT_Module_Destructor) 0, (FT_Module_Requester) 0 - }, + , FT_GLYPH_FORMAT_OUTLINE, @@ -266,8 +284,8 @@ (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 */ diff --git a/lib/3rdparty/freetype/src/raster/ftrend1.h b/lib/3rdparty/freetype/src/raster/ftrend1.h index 76e9a5f581e..4cf128622a9 100644 --- a/lib/3rdparty/freetype/src/raster/ftrend1.h +++ b/lib/3rdparty/freetype/src/raster/ftrend1.h @@ -27,13 +27,13 @@ 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. */ /* */ - FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster5_renderer_class; + FT_DECLARE_RENDERER( ft_raster5_renderer_class ) FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/raster/module.mk b/lib/3rdparty/freetype/src/raster/module.mk index 59c737b9303..cbff5df96ea 100644 --- a/lib/3rdparty/freetype/src/raster/module.mk +++ b/lib/3rdparty/freetype/src/raster/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/raster/raster.c b/lib/3rdparty/freetype/src/raster/raster.c index f13a67a209d..1202a116cdf 100644 --- a/lib/3rdparty/freetype/src/raster/raster.c +++ b/lib/3rdparty/freetype/src/raster/raster.c @@ -19,6 +19,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> +#include "rastpic.c" #include "ftraster.c" #include "ftrend1.c" diff --git a/lib/3rdparty/freetype/src/raster/rastpic.c b/lib/3rdparty/freetype/src/raster/rastpic.c new file mode 100644 index 00000000000..3c264877b6d --- /dev/null +++ b/lib/3rdparty/freetype/src/raster/rastpic.c @@ -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/lib/3rdparty/freetype/src/raster/rastpic.h b/lib/3rdparty/freetype/src/raster/rastpic.h new file mode 100644 index 00000000000..dcd82b8ca8f --- /dev/null +++ b/lib/3rdparty/freetype/src/raster/rastpic.h @@ -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 */ diff --git a/lib/3rdparty/freetype/src/raster/rules.mk b/lib/3rdparty/freetype/src/raster/rules.mk index 0dc8782ea45..9703b1298a1 100644 --- a/lib/3rdparty/freetype/src/raster/rules.mk +++ b/lib/3rdparty/freetype/src/raster/rules.mk @@ -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, diff --git a/lib/3rdparty/freetype/src/sfnt/Jamfile b/lib/3rdparty/freetype/src/sfnt/Jamfile index 6b8a4018223..cb20b1b04b1 100644 --- a/lib/3rdparty/freetype/src/sfnt/Jamfile +++ b/lib/3rdparty/freetype/src/sfnt/Jamfile @@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ; if $(FT2_MULTI) { - _sources = sfobjs sfdriver ttcmap ttpost ttload ttsbit ttkern ttbdf ; + _sources = sfobjs sfdriver ttcmap ttmtx ttpost ttload ttsbit ttkern ttbdf sfntpic ; } else { diff --git a/lib/3rdparty/freetype/src/sfnt/module.mk b/lib/3rdparty/freetype/src/sfnt/module.mk index d33913809cc..95fd6a31437 100644 --- a/lib/3rdparty/freetype/src/sfnt/module.mk +++ b/lib/3rdparty/freetype/src/sfnt/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/sfnt/rules.mk b/lib/3rdparty/freetype/src/sfnt/rules.mk index ff7840e7fe3..abda74fcaaa 100644 --- a/lib/3rdparty/freetype/src/sfnt/rules.mk +++ b/lib/3rdparty/freetype/src/sfnt/rules.mk @@ -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, @@ -37,8 +37,11 @@ SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c \ # 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) diff --git a/lib/3rdparty/freetype/src/sfnt/sfdriver.c b/lib/3rdparty/freetype/src/sfnt/sfdriver.c index 5ba22a6c51c..1097efb86d7 100644 --- a/lib/3rdparty/freetype/src/sfnt/sfdriver.c +++ b/lib/3rdparty/freetype/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -17,12 +17,14 @@ #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 "sfntpic.h" #include "sferrors.h" @@ -48,6 +50,15 @@ #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 @@ -103,27 +114,28 @@ sfnt_table_info( TT_Face face, FT_UInt idx, FT_ULong *tag, + FT_ULong *offset, 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; + *offset = face->dir_tables[idx].Offset; *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 - }; + ) #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES @@ -151,11 +163,43 @@ } - 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_NameIndexFunc)NULL - }; + (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index + ) #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ @@ -275,19 +319,17 @@ 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 - }; + ) /* * 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 - }; + ) #ifdef TT_CONFIG_OPTION_BDF @@ -328,11 +370,10 @@ } - static const FT_Service_BDFRec sfnt_service_bdf = - { + FT_DEFINE_SERVICE_BDFRec(sfnt_service_bdf, (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 */ @@ -341,20 +382,35 @@ * 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 - { FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info }, - - { NULL, NULL } - }; FT_CALLBACK_DEF( FT_Module_Interface ) @@ -363,7 +419,7 @@ { FT_UNUSED( module ); - return ft_service_list_lookup( sfnt_services, module_interface ); + return ft_service_list_lookup( FT_SFNT_SERVICES_GET, module_interface ); } @@ -494,10 +550,18 @@ #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, @@ -507,10 +571,8 @@ 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, @@ -522,53 +584,32 @@ 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, -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* 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' */ - 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 */ @@ -579,27 +620,19 @@ tt_face_load_font_dir, tt_face_load_hmtx, -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* 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 - }; + ) - 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 ), @@ -607,12 +640,12 @@ 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 - }; + ) /* END */ diff --git a/lib/3rdparty/freetype/src/sfnt/sfdriver.h b/lib/3rdparty/freetype/src/sfnt/sfdriver.h index 92db79694d0..5de25d51ca4 100644 --- a/lib/3rdparty/freetype/src/sfnt/sfdriver.h +++ b/lib/3rdparty/freetype/src/sfnt/sfdriver.h @@ -27,7 +27,7 @@ FT_BEGIN_HEADER - FT_EXPORT_VAR( const FT_Module_Class ) sfnt_module_class; + FT_DECLARE_MODULE( sfnt_module_class ) FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/sfnt/sfnt.c b/lib/3rdparty/freetype/src/sfnt/sfnt.c index 45a820b718d..fc507b49613 100644 --- a/lib/3rdparty/freetype/src/sfnt/sfnt.c +++ b/lib/3rdparty/freetype/src/sfnt/sfnt.c @@ -19,6 +19,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> +#include "sfntpic.c" #include "ttload.c" #include "ttmtx.c" #include "ttcmap.c" diff --git a/lib/3rdparty/freetype/src/sfnt/sfntpic.c b/lib/3rdparty/freetype/src/sfnt/sfntpic.c new file mode 100644 index 00000000000..fd3cf4e923e --- /dev/null +++ b/lib/3rdparty/freetype/src/sfnt/sfntpic.c @@ -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/lib/3rdparty/freetype/src/sfnt/sfntpic.h b/lib/3rdparty/freetype/src/sfnt/sfntpic.h new file mode 100644 index 00000000000..6943b4250a2 --- /dev/null +++ b/lib/3rdparty/freetype/src/sfnt/sfntpic.h @@ -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 */ diff --git a/lib/3rdparty/freetype/src/sfnt/sfobjs.c b/lib/3rdparty/freetype/src/sfnt/sfobjs.c index cc901100d1d..b74b1a93a9b 100644 --- a/lib/3rdparty/freetype/src/sfnt/sfobjs.c +++ b/lib/3rdparty/freetype/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -26,6 +26,7 @@ #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_SFNT_NAMES_H #include "sferrors.h" #ifdef TT_CONFIG_OPTION_BDF @@ -123,14 +124,20 @@ /* */ /* 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> */ - /* 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_Error error = SFNT_Err_Ok; FT_String* result = NULL; FT_UShort n; TT_NameEntryRec* rec; @@ -145,6 +152,8 @@ TT_NameEntry_ConvertFunc convert; + FT_ASSERT( name ); + rec = face->name_table.names; for ( n = 0; n < face->num_names; n++, rec++ ) { @@ -256,11 +265,8 @@ { if ( rec->string == NULL ) { - FT_Error error = SFNT_Err_Ok; FT_Stream stream = face->name_table.stream; - FT_UNUSED( error ); - if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) || FT_STREAM_SEEK( rec->stringOffset ) || @@ -277,7 +283,8 @@ } Exit: - return result; + *name = result; + return error; } @@ -285,7 +292,7 @@ sfnt_find_encoding( int platform_id, int encoding_id ) { - typedef struct TEncoding + typedef struct TEncoding_ { int platform_id; int encoding_id; @@ -363,11 +370,12 @@ 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; @@ -401,7 +409,7 @@ 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; @@ -451,7 +459,7 @@ 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; @@ -461,7 +469,8 @@ 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; } @@ -498,6 +507,13 @@ 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, @@ -506,16 +522,33 @@ 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 ignore_preferred_family = FALSE; + FT_Bool ignore_preferred_subfamily = FALSE; SFNT_Service sfnt = (SFNT_Service)face->sfnt; FT_UNUSED( face_index ); - FT_UNUSED( num_params ); - FT_UNUSED( params ); + /* Check parameters */ + + { + FT_Int i; + + + for ( i = 0; i < num_params; i++ ) + { + if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY ) + ignore_preferred_family = TRUE; + else if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY ) + ignore_preferred_subfamily = TRUE; + } + } /* Load tables */ @@ -581,7 +614,10 @@ /* don't check for errors */ LOAD_( name ); LOAD_( post ); + +#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES psnames_error = error; +#endif /* do not load the metrics headers and tables if this is an Apple */ /* sbit font file */ @@ -660,19 +696,20 @@ face->os2.version = 0xFFFFU; } - } /* the optional tables */ - /* embedded bitmap support. */ + /* embedded bitmap support */ 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; @@ -692,26 +729,47 @@ LOAD_( gasp ); LOAD_( kern ); - error = SFNT_Err_Ok; - 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 ); + face->root.family_name = NULL; + face->root.style_name = NULL; + if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 ) + { + if ( !ignore_preferred_family ) + GET_NAME( PREFERRED_FAMILY, &face->root.family_name ); + if ( !face->root.family_name ) + GET_NAME( FONT_FAMILY, &face->root.family_name ); + + if ( !ignore_preferred_subfamily ) + 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 && !ignore_preferred_family ) + 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 && !ignore_preferred_subfamily ) + 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 */ { - FT_Face root = &face->root; - FT_Int32 flags = root->face_flags; + FT_Face root = &face->root; + FT_Long flags = root->face_flags; /*********************************************************************/ @@ -727,7 +785,7 @@ 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 @@ -759,19 +817,26 @@ /* */ /* Compute style flags. */ /* */ + 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; - 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 */ + if ( face->header.Mac_Style & 1 ) flags |= FT_STYLE_FLAG_BOLD; @@ -816,12 +881,78 @@ } } +#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. */ /* */ - if ( has_outline == TRUE ) + if ( FT_IS_SCALABLE( root ) ) { /* XXX What about if outline header is missing */ /* (e.g. sfnt wrapped bitmap)? */ @@ -874,10 +1005,9 @@ /* 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 - /* some fonts have the OS/2 "sTypoAscender", "sTypoDescender" & */ /* "sTypoLineGap" fields set to 0, like ARIALNB.TTF */ if ( face->os2.version != 0xFFFFU && root->ascender ) @@ -892,80 +1022,21 @@ if ( height > root->height ) root->height = height; } - #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; } -#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: @@ -977,14 +1048,21 @@ #undef LOAD_ #undef LOADM_ +#undef GET_NAME 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 ) { @@ -1023,7 +1101,7 @@ } /* freeing the horizontal metrics */ -#if !defined FT_CONFIG_OPTION_OLD_INTERNALS +#ifndef FT_CONFIG_OPTION_OLD_INTERNALS { FT_Stream stream = FT_FACE_STREAM( face ); @@ -1051,7 +1129,8 @@ 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 ); diff --git a/lib/3rdparty/freetype/src/sfnt/ttbdf.c b/lib/3rdparty/freetype/src/sfnt/ttbdf.c index 6c95387adb8..206cecee5ed 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttbdf.c +++ b/lib/3rdparty/freetype/src/sfnt/ttbdf.c @@ -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_UInt32 strings = FT_NEXT_ULONG ( p ); + FT_ULong strings = FT_NEXT_ULONG ( p ); FT_UInt count; FT_Byte* strike; @@ -141,13 +141,13 @@ 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; diff --git a/lib/3rdparty/freetype/src/sfnt/ttcmap.c b/lib/3rdparty/freetype/src/sfnt/ttcmap.c index 2da43360eb6..b283f6d1621 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttcmap.c +++ b/lib/3rdparty/freetype/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -25,6 +25,7 @@ #include FT_INTERNAL_STREAM_H #include "ttload.h" #include "ttcmap.h" +#include "sfntpic.h" /*************************************************************************/ @@ -39,11 +40,13 @@ #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_NEXT_UINT24 FT_NEXT_UOFF3 #define TT_NEXT_LONG FT_NEXT_LONG #define TT_NEXT_ULONG FT_NEXT_ULONG @@ -122,7 +125,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) tt_cmap0_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -132,7 +135,7 @@ FT_UInt gindex = 0; - table += 6; /* go to glyph ids */ + table += 6; /* go to glyph IDs */ while ( ++charcode < 256 ) { gindex = table[charcode]; @@ -155,28 +158,27 @@ 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; } - 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, - (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 - }; + ) #endif /* TT_CONFIG_CMAP_FORMAT_0 */ @@ -227,7 +229,7 @@ /* 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 */ @@ -256,14 +258,14 @@ /* */ /* * 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 */ - /* 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). */ /* */ @@ -278,7 +280,7 @@ 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 ) @@ -324,6 +326,10 @@ 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 ) { @@ -338,7 +344,7 @@ 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; @@ -389,7 +395,7 @@ 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; @@ -454,7 +460,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) tt_cmap2_char_next( TT_CMap cmap, FT_UInt32 *pcharcode ) { @@ -528,28 +534,27 @@ 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; } - 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, - (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 - }; + ) #endif /* TT_CONFIG_CMAP_FORMAT_2 */ @@ -595,14 +600,14 @@ /* 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 */ - /* 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 */ @@ -615,14 +620,14 @@ /* 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. */ /* */ /* */ - /* 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 @@ -654,7 +659,7 @@ 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; @@ -687,6 +692,23 @@ 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; @@ -715,7 +737,7 @@ 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; @@ -777,7 +799,7 @@ } Fail: - cmap->cur_charcode = 0xFFFFFFFFUL; + cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL; cmap->cur_gindex = 0; } @@ -825,7 +847,7 @@ /* */ 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 ); @@ -852,7 +874,7 @@ 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; @@ -861,9 +883,9 @@ } { - 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; @@ -881,10 +903,10 @@ 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 ) @@ -892,7 +914,7 @@ 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; @@ -903,16 +925,27 @@ 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; } - 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 ) @@ -940,12 +973,12 @@ } 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 */ /* */ - 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; } @@ -959,9 +992,9 @@ 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; @@ -1003,6 +1036,22 @@ 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; @@ -1032,14 +1081,14 @@ 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 charcode = *pcharcode; + FT_UInt charcode = (FT_UInt)*pcharcode; FT_UInt gindex = 0; FT_Byte* p; @@ -1082,6 +1131,22 @@ 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 ) { @@ -1265,7 +1330,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) tt_cmap4_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -1305,27 +1370,26 @@ 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; } - 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, - (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 - }; + ) #endif /* TT_CONFIG_CMAP_FORMAT_4 */ @@ -1351,7 +1415,7 @@ /* */ /* 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. */ /* */ @@ -1417,7 +1481,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) tt_cmap6_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -1465,28 +1529,27 @@ 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; } - 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, - (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 - }; + ) #endif /* TT_CONFIG_CMAP_FORMAT_6 */ @@ -1496,7 +1559,7 @@ /***** *****/ /***** 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 *****/ @@ -1511,7 +1574,7 @@ /***** `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: *****/ @@ -1538,11 +1601,11 @@ /* 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 */ - /* startId 8 ULONG start glyph id for the group */ + /* startId 8 ULONG start glyph ID for the group */ /* */ #ifdef TT_CONFIG_CMAP_FORMAT_8 @@ -1561,7 +1624,7 @@ 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; @@ -1671,7 +1734,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) tt_cmap8_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -1719,28 +1782,27 @@ 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; } - 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, - (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 - }; + ) #endif /* TT_CONFIG_CMAP_FORMAT_8 */ @@ -1787,7 +1849,8 @@ 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 */ @@ -1829,7 +1892,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) tt_cmap10_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -1868,28 +1931,27 @@ 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; } - 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, - (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 - }; + ) #endif /* TT_CONFIG_CMAP_FORMAT_10 */ @@ -1920,7 +1982,7 @@ /* */ /* 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 @@ -1970,7 +2032,8 @@ 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 */ @@ -2039,7 +2102,7 @@ if ( gindex ) { - cmap->cur_charcode = char_code; + cmap->cur_charcode = char_code;; cmap->cur_gindex = gindex; cmap->cur_group = n; @@ -2147,7 +2210,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) tt_cmap12_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -2165,8 +2228,10 @@ if ( cmap12->valid ) { gindex = cmap12->cur_gindex; + + /* XXX: check cur_charcode overflow is expected */ if ( gindex ) - *pchar_code = cmap12->cur_charcode; + *pchar_code = (FT_UInt32)cmap12->cur_charcode; } else gindex = 0; @@ -2174,7 +2239,8 @@ else gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 ); - return gindex; + /* XXX: check gindex overflow is expected */ + return (FT_UInt32)gindex; } @@ -2185,155 +2251,1237 @@ 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; } - 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, - (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 - }; - + ) #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 = table + 4; + length = TT_NEXT_ULONG( p ); + + p = table + 12; + num_groups = TT_NEXT_ULONG( p ); + + if ( length > (FT_ULong)( valid->limit - table ) || + length < 16 + 12 * num_groups ) + FT_INVALID_TOO_SHORT; + + /* check groups, they must be in increasing order */ { - p -= 2; - FT_ERROR(( "tt_face_build_cmaps: unsupported `cmap' table format = %d\n", - TT_PEEK_USHORT( p ) )); - return SFNT_Err_Invalid_Table; + FT_ULong n, start, end, glyph_id, last = 0; + + + for ( n = 0; n < num_groups; n++ ) + { + start = TT_NEXT_ULONG( p ); + end = TT_NEXT_ULONG( p ); + glyph_id = TT_NEXT_ULONG( p ); + + if ( start > end ) + FT_INVALID_DATA; + + if ( n > 0 && start <= last ) + FT_INVALID_DATA; + + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + if ( glyph_id >= TT_VALID_GLYPH_COUNT( valid ) ) + FT_INVALID_GLYPH_ID; + } + + last = end; + } } - num_cmaps = TT_NEXT_USHORT( p ); + return SFNT_Err_Ok; + } - for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- ) - { - FT_CharMapRec charmap; - FT_UInt32 offset; + /* 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; - 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 = tt_cmap_classes; - TT_CMap_Class volatile clazz; + if ( cmap->cur_charcode >= 0xFFFFFFFFUL ) + goto Fail; + char_code = cmap->cur_charcode + 1; - for ( ; *pclazz; pclazz++ ) + 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 ) { - clazz = *pclazz; - if ( clazz->format == format ) - { - volatile TT_ValidatorRec valid; - volatile FT_Error error = SFNT_Err_Ok; + cmap->cur_charcode = char_code;; + cmap->cur_gindex = gindex; + cmap->cur_group = n; + return; + } + } + } - ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit, - FT_VALIDATE_DEFAULT ); + Fail: + cmap->valid = 0; + } - 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 ) ); - } + 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 ( valid.validator.error == 0 ) - { - FT_CMap ttcmap; + if ( !num_groups ) + return 0; - 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; + /* 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_DEFINE_TT_CMAP(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_ERROR(( "tt_face_build_cmaps:" )); - FT_ERROR(( " broken cmap sub-table ignored!\n" )); + 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" )); + } } } diff --git a/lib/3rdparty/freetype/src/sfnt/ttcmap.h b/lib/3rdparty/freetype/src/sfnt/ttcmap.h index a10a3e2502c..15a4a21e500 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttcmap.h +++ b/lib/3rdparty/freetype/src/sfnt/ttcmap.h @@ -55,6 +55,46 @@ FT_BEGIN_HEADER } 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_ { diff --git a/lib/3rdparty/freetype/src/sfnt/ttcmapc.h b/lib/3rdparty/freetype/src/sfnt/ttcmapc.h new file mode 100644 index 00000000000..4c9c6a56f72 --- /dev/null +++ b/lib/3rdparty/freetype/src/sfnt/ttcmapc.h @@ -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 */ diff --git a/lib/3rdparty/freetype/src/sfnt/ttkern.c b/lib/3rdparty/freetype/src/sfnt/ttkern.c index 28e52c333e8..c1540802b87 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttkern.c +++ b/lib/3rdparty/freetype/src/sfnt/ttkern.c @@ -5,7 +5,7 @@ /* 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, */ @@ -22,7 +22,6 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include "ttkern.h" -#include "ttload.h" #include "sferrors.h" @@ -60,14 +59,16 @@ 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 ) ) { - FT_ERROR(( "could not extract kerning table\n" )); + FT_ERROR(( "tt_face_load_kern:" + " could not extract kerning table\n" )); goto Exit; } @@ -86,7 +87,7 @@ { 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 ) @@ -103,6 +104,9 @@ 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 ) @@ -111,8 +115,8 @@ 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; @@ -122,8 +126,8 @@ */ if ( num_pairs > 0 ) { - FT_UInt count; - FT_UInt old_pair; + FT_ULong count; + FT_ULong old_pair; old_pair = FT_NEXT_ULONG( p ); @@ -181,18 +185,22 @@ 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; - 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_UInt num_pairs; FT_Int value = 0; FT_UNUSED( version ); @@ -200,21 +208,27 @@ 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; + 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: { - 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 */ { diff --git a/lib/3rdparty/freetype/src/sfnt/ttload.c b/lib/3rdparty/freetype/src/sfnt/ttload.c index abe0278a253..3ad33bd6d86 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttload.c +++ b/lib/3rdparty/freetype/src/sfnt/ttload.c @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 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, */ @@ -58,6 +58,9 @@ { 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' -- ", @@ -72,17 +75,28 @@ 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; } @@ -124,7 +138,7 @@ *length = table->Length; if ( FT_STREAM_SEEK( table->Offset ) ) - goto Exit; + goto Exit; } else error = SFNT_Err_Table_Missing; @@ -134,27 +148,30 @@ } - /* 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 ) { - 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_UShort 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[] = { @@ -170,12 +187,8 @@ }; - if ( sfnt->num_tables == 0 || - offset + sfnt->num_tables * 16 > stream->size ) - return SFNT_Err_Unknown_File_Format; - if ( FT_STREAM_SEEK( offset ) ) - return error; + goto Exit; for ( nn = 0; nn < sfnt->num_tables; nn++ ) { @@ -183,12 +196,23 @@ 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 ) { @@ -210,17 +234,26 @@ * */ 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 ) ) - return error; + goto Exit; 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 ) ) - return error; + goto Exit; } else if ( table.Tag == TTAG_SING ) has_sing = 1; @@ -228,11 +261,34 @@ 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 ) ) - return SFNT_Err_Ok; + { + error = SFNT_Err_Ok; + goto Exit; + } 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; } @@ -266,7 +322,7 @@ 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[] = { @@ -290,7 +346,7 @@ 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 @@ -301,51 +357,59 @@ /* 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 ) { - 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 ) ) - return error; + goto Exit; if ( FT_STREAM_SEEK( sfnt.offset + 12 ) || FT_FRAME_ENTER( face->num_tables * 16L ) ) - return error; + goto Exit; 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(); - 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" )); + Exit: return error; } @@ -618,6 +682,17 @@ 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 )); @@ -707,7 +782,7 @@ 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; } diff --git a/lib/3rdparty/freetype/src/sfnt/ttmtx.c b/lib/3rdparty/freetype/src/sfnt/ttmtx.c index 286bd0c311c..53e6ac7881f 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttmtx.c +++ b/lib/3rdparty/freetype/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -60,7 +60,7 @@ /* <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, @@ -97,7 +97,7 @@ 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, @@ -161,7 +161,9 @@ 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 @@ -229,7 +231,7 @@ return error; } -#endif /* !OPTIMIZE_MEMORY || OLD_INTERNALS */ +#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */ /*************************************************************************/ @@ -341,7 +343,7 @@ /* */ /* 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, @@ -420,7 +422,7 @@ 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, @@ -431,7 +433,8 @@ { 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; @@ -459,7 +462,7 @@ return SFNT_Err_Ok; } -#endif /* !OPTIMIZE_MEMORY || OLD_INTERNALS */ +#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */ /* END */ diff --git a/lib/3rdparty/freetype/src/sfnt/ttpost.c b/lib/3rdparty/freetype/src/sfnt/ttpost.c index 1e6163646dc..aa0bf1ec419 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttpost.c +++ b/lib/3rdparty/freetype/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ /* 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, */ @@ -29,7 +29,6 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include "ttpost.h" -#include "ttload.h" #include "sferrors.h" @@ -62,11 +61,11 @@ /* 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 */ - 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", @@ -416,13 +415,14 @@ /* 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. */ /* */ + /* <InOut> */ /* PSname :: The address of a string pointer. Will be NULL in case */ /* of error, otherwise it is a pointer to the glyph name. */ /* */ @@ -436,9 +436,9 @@ 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; diff --git a/lib/3rdparty/freetype/src/sfnt/ttsbit.c b/lib/3rdparty/freetype/src/sfnt/ttsbit.c index eff49dadd9a..833bb2add29 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttsbit.c +++ b/lib/3rdparty/freetype/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -24,11 +24,11 @@ * 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" -#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */ +#else /* FT_CONFIG_OPTION_OLD_INTERNALS */ #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 y_offset ) + FT_Int y_offset, + FT_Int source_height ) { FT_Byte* line_buff; FT_Int line_incr; @@ -116,7 +117,7 @@ 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 */ @@ -382,8 +383,9 @@ 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: @@ -492,7 +494,7 @@ 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; @@ -771,7 +773,7 @@ Found: /* return successfully! */ *arange = range; - return 0; + return SFNT_Err_Ok; } } @@ -1229,7 +1231,7 @@ /* 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(); } @@ -1323,7 +1325,11 @@ 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: @@ -1495,7 +1501,7 @@ return error; } -#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */ +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /* END */ diff --git a/lib/3rdparty/freetype/src/sfnt/ttsbit.h b/lib/3rdparty/freetype/src/sfnt/ttsbit.h index c6067c0e3e6..7ea2af18436 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttsbit.h +++ b/lib/3rdparty/freetype/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -45,7 +45,7 @@ FT_BEGIN_HEADER 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, diff --git a/lib/3rdparty/freetype/src/sfnt/ttsbit0.c b/lib/3rdparty/freetype/src/sfnt/ttsbit0.c index f8adc64a735..38bcf210ead 100644 --- a/lib/3rdparty/freetype/src/sfnt/ttsbit0.c +++ b/lib/3rdparty/freetype/src/sfnt/ttsbit0.c @@ -5,7 +5,7 @@ /* 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, */ @@ -39,65 +39,16 @@ #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_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; @@ -111,7 +62,7 @@ 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; } @@ -129,8 +80,7 @@ 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; } @@ -182,7 +132,7 @@ FT_ULong strike_index, FT_Size_Metrics* metrics ) { - FT_Byte* strike; + FT_Byte* strike; if ( strike_index >= (FT_ULong)face->sbit_num_strikes ) @@ -207,7 +157,7 @@ } - typedef struct + typedef struct TT_SBitDecoderRec_ { TT_Face face; FT_Stream stream; @@ -374,14 +324,11 @@ 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 ) @@ -389,19 +336,16 @@ 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; - return 0; + return SFNT_Err_Ok; Fail: return SFNT_Err_Invalid_Argument; @@ -507,7 +451,7 @@ 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 ) ); @@ -525,6 +469,41 @@ } + /* + * 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, @@ -570,6 +549,8 @@ } /* 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; @@ -580,16 +561,23 @@ 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 ( 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 @@ -598,12 +586,14 @@ nbits -= w; } - *write++ |= ( ( rval >> nbits ) & 0xFF ) & ~( 0xFF << w ); + *write++ |= ( ( rval >> nbits ) & 0xFF ) & + ( ~( 0xFF << w ) << ( 8 - w - x_pos ) ); rval <<= 8; w = width - w; } + /* handle medial bytes */ for ( ; w >= 8; w -= 8 ) { rval |= *p++; @@ -612,11 +602,13 @@ rval <<= 8; } + /* handle final byte if necessary */ if ( w > 0 ) { if ( nbits < w ) { - rval |= *p++; + if ( p < limit ) + rval |= *p++; *write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w ); nbits += 8 - w; @@ -645,6 +637,13 @@ 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; @@ -653,6 +652,13 @@ 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 ); @@ -667,6 +673,15 @@ 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; diff --git a/lib/3rdparty/freetype/src/smooth/Jamfile b/lib/3rdparty/freetype/src/smooth/Jamfile index 8a792df056c..a8496aa2c2c 100644 --- a/lib/3rdparty/freetype/src/smooth/Jamfile +++ b/lib/3rdparty/freetype/src/smooth/Jamfile @@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) smooth ; if $(FT2_MULTI) { - _sources = ftgrays ftsmooth ; + _sources = ftgrays ftsmooth ftspic ; } else { diff --git a/lib/3rdparty/freetype/src/smooth/ftgrays.c b/lib/3rdparty/freetype/src/smooth/ftgrays.c index 5a4a544e5a5..846e454e667 100644 --- a/lib/3rdparty/freetype/src/smooth/ftgrays.c +++ b/lib/3rdparty/freetype/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -91,11 +91,19 @@ #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 @@ -118,24 +126,81 @@ #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) - /* 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 -#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */ +#define FT_ERROR( varformat ) FT_Message varformat #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_ */ + #include <ft2build.h> #include "ftgrays.h" #include FT_INTERNAL_OBJECTS_H @@ -144,13 +209,14 @@ #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 ) @@ -160,35 +226,23 @@ #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 - #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 */ - #define RAS_ARG /* empty */ #define RAS_ARG_ /* empty */ #define RAS_VAR /* empty */ #define RAS_VAR_ /* empty */ - static TWorker ras; - - #endif /* FT_STATIC_RASTER */ @@ -221,7 +275,7 @@ /* 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 */ @@ -252,8 +306,8 @@ typedef struct TCell_ { - int x; - int cover; + TPos x; /* same with TWorker.ex */ + TCoord cover; /* same with TWorker.cover */ TArea area; PCell next; @@ -268,12 +322,12 @@ TPos count_ex, count_ey; TArea area; - int cover; + TCoord cover; int invalid; PCell cells; - int max_cells; - int num_cells; + FT_PtrDist max_cells; + FT_PtrDist num_cells; TCoord cx, cy; TPos x, y; @@ -305,11 +359,18 @@ long buffer_size; PCell* ycells; - int ycount; + TPos ycount; } TWorker, *PWorker; +#ifndef FT_STATIC_RASTER +#define ras (*worker) +#else + static TWorker ras; +#endif + + typedef struct TRaster_ { void* buffer; @@ -395,11 +456,11 @@ 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 (;;) @@ -527,9 +588,9 @@ TPos x2, TCoord y2 ) { - TCoord ex1, ex2, fx1, fx2, delta; + TCoord ex1, ex2, fx1, fx2, delta, mod, lift, rem; long p, first, dx; - int incr, lift, mod, rem; + int incr; dx = x2 - x1; @@ -551,7 +612,7 @@ if ( ex1 == ex2 ) { delta = y2 - y1; - ras.area += (TArea)( fx1 + fx2 ) * delta; + ras.area += (TArea)(( fx1 + fx2 ) * delta); ras.cover += delta; return; } @@ -579,7 +640,7 @@ mod += (TCoord)dx; } - ras.area += (TArea)( fx1 + first ) * delta; + ras.area += (TArea)(( fx1 + first ) * delta); ras.cover += delta; ex1 += incr; @@ -609,7 +670,7 @@ delta++; } - ras.area += (TArea)ONE_PIXEL * delta; + ras.area += (TArea)(ONE_PIXEL * delta); ras.cover += delta; y1 += delta; ex1 += incr; @@ -618,7 +679,7 @@ } delta = y2 - y1; - ras.area += (TArea)( fx2 + ONE_PIXEL - first ) * delta; + ras.area += (TArea)(( fx2 + ONE_PIXEL - first ) * delta); ras.cover += delta; } @@ -631,10 +692,10 @@ 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; - int delta, rem, mod, lift, incr; + int delta, rem, lift, incr; ey1 = TRUNC( ras.last_ey ); @@ -678,7 +739,7 @@ { TCoord ex = TRUNC( ras.x ); TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 ); - TPos area; + TArea area; first = ONE_PIXEL; @@ -693,7 +754,7 @@ 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; @@ -703,7 +764,7 @@ ras.cover += delta; ey1 += incr; - gray_set_cell( &ras, ex, ey1 ); + gray_set_cell( RAS_VAR_ ex, ey1 ); } delta = (int)( fy2 - ONE_PIXEL + first ); @@ -1071,13 +1132,13 @@ /* 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 ); - gray_start_cell( worker, TRUNC( x ), TRUNC( y ) ); + gray_start_cell( RAS_VAR_ TRUNC( x ), TRUNC( y ) ); worker->x = x; worker->y = y; @@ -1089,7 +1150,7 @@ 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; } @@ -1099,7 +1160,7 @@ const FT_Vector* to, PWorker worker ) { - gray_render_conic( worker, control, to ); + gray_render_conic( RAS_VAR_ control, to ); return 0; } @@ -1110,7 +1171,7 @@ const FT_Vector* to, PWorker worker ) { - gray_render_cubic( worker, control1, control2, to ); + gray_render_cubic( RAS_VAR_ control1, control2, to ); return 0; } @@ -1170,7 +1231,7 @@ gray_hline( RAS_ARG_ TCoord x, TCoord y, TPos area, - int acount ) + TCoord acount ) { FT_Span* span; int count; @@ -1207,9 +1268,13 @@ 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; + /* 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 */ @@ -1229,27 +1294,26 @@ 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; - 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++ ) - 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.span_y = y; + ras.span_y = (int)y; count = 0; span = ras.gray_spans; @@ -1267,9 +1331,11 @@ } -#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; @@ -1283,12 +1349,12 @@ 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" ); } } -#endif /* DEBUG_GRAYS */ +#endif /* FT_DEBUG_LEVEL_TRACE */ static void @@ -1304,6 +1370,8 @@ ras.num_gray_spans = 0; + FT_TRACE7(( "gray_sweep: start\n" )); + for ( yindex = 0; yindex < ras.ycount; yindex++ ) { PCell cell = ras.ycells[yindex]; @@ -1313,7 +1381,7 @@ for ( ; cell != NULL; cell = cell->next ) { - TArea area; + TPos area; if ( cell->x > x && cover != 0 ) @@ -1337,6 +1405,8 @@ 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" )); } @@ -1344,7 +1414,7 @@ /*************************************************************************/ /* */ - /* 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. */ /* */ /*************************************************************************/ @@ -1355,18 +1425,19 @@ /* 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 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. */ /* */ /* <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. */ /* */ + /* <InOut> */ /* user :: A typeless pointer which is passed to each */ /* emitter during the decomposition. It can be */ /* used to store the state during the */ @@ -1375,17 +1446,13 @@ /* <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 -#if 0 #define SCALED( x ) ( ( (x) << shift ) - delta ) -#else -#define SCALED( x ) (x) -#endif FT_Vector v_last; FT_Vector v_control; @@ -1395,17 +1462,21 @@ FT_Vector* limit; char* tags; + int error; + int n; /* index of contour in outline */ int first; /* index of first point in contour */ - int error; 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++ ) @@ -1413,22 +1484,25 @@ 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; - 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_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; - tags = outline->tags + first; + tags = outline->tags + first; tag = FT_CURVE_TAG( tags[0] ); /* A contour cannot start with a cubic control point! */ @@ -1459,6 +1533,8 @@ 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; @@ -1479,6 +1555,8 @@ 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; @@ -1486,53 +1564,60 @@ } 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; - - 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; @@ -1559,12 +1644,22 @@ 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; } + 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; } @@ -1572,6 +1667,8 @@ } /* 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: @@ -1581,9 +1678,11 @@ first = last + 1; } + FT_TRACE5(( "FT_Outline_Decompose: Done\n", n )); return 0; Exit: + FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error )); return error; Invalid_Outline: @@ -1599,32 +1698,33 @@ } 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 - }; + ) + + static int + gray_convert_glyph_inner( RAS_ARG ) + { 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 - { error = ErrRaster_Memory_Overflow; - } return error; } @@ -1659,14 +1759,14 @@ 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; { - int level = 0; + int level = 0; if ( ras.count_ex > 24 || ras.count_ey > 24 ) @@ -1678,10 +1778,12 @@ ras.cubic_level <<= level; } - /* setup vertical bands */ + /* set up vertical bands */ 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; @@ -1760,8 +1862,8 @@ /* 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; } @@ -1796,11 +1898,14 @@ 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; - if ( !outline || !outline->contours || !outline->points ) + if ( !outline->contours || !outline->points ) return ErrRaster_Invalid_Outline; if ( outline->n_points != @@ -1810,7 +1915,7 @@ 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; @@ -1828,7 +1933,7 @@ 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; @@ -1837,9 +1942,7 @@ ras.clip_box.yMax = target_map->rows; } else if ( params->flags & FT_RASTER_FLAG_CLIP ) - { ras.clip_box = params->clip_box; - } else { ras.clip_box.xMin = -32768L; @@ -1848,32 +1951,32 @@ 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; - 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; } + 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_ @@ -1968,8 +2071,7 @@ } - 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, @@ -1977,7 +2079,12 @@ (FT_Raster_Set_Mode_Func)0, (FT_Raster_Render_Func) gray_raster_render, (FT_Raster_Done_Func) gray_raster_done - }; + ) /* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/lib/3rdparty/freetype/src/smooth/ftgrays.h b/lib/3rdparty/freetype/src/smooth/ftgrays.h index 2d409543dce..f20f55f14b6 100644 --- a/lib/3rdparty/freetype/src/smooth/ftgrays.h +++ b/lib/3rdparty/freetype/src/smooth/ftgrays.h @@ -28,6 +28,7 @@ #include "ftimage.h" #else #include <ft2build.h> +#include FT_CONFIG_CONFIG_H /* for FT_CONFIG_OPTION_PIC */ #include FT_IMAGE_H #endif diff --git a/lib/3rdparty/freetype/src/smooth/ftsmooth.c b/lib/3rdparty/freetype/src/smooth/ftsmooth.c index 85d04eb458e..eed63531572 100644 --- a/lib/3rdparty/freetype/src/smooth/ftsmooth.c +++ b/lib/3rdparty/freetype/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -17,10 +17,12 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H #include FT_OUTLINE_H #include "ftsmooth.h" #include "ftgrays.h" +#include "ftspic.h" #include "ftsmerrs.h" @@ -153,7 +155,7 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } - /* allocate new one, depends on pixel format */ + /* allocate new one */ pitch = width; if ( hmul ) { @@ -192,6 +194,19 @@ } } +#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; @@ -294,13 +309,13 @@ for ( hh = height_org; hh > 0; hh-- ) { - memcpy( write, read, pitch ); + ft_memcpy( write, read, pitch ); write += pitch; - memcpy( write, read, pitch ); + ft_memcpy( write, read, pitch ); write += pitch; - memcpy( write, read, pitch ); + ft_memcpy( write, read, pitch ); write += pitch; read += pitch; } @@ -310,12 +325,19 @@ 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; - 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 ) @@ -376,10 +398,8 @@ } - 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 ), @@ -392,7 +412,7 @@ (FT_Module_Constructor)ft_smooth_init, (FT_Module_Destructor) 0, (FT_Module_Requester) 0 - }, + , FT_GLYPH_FORMAT_OUTLINE, @@ -401,14 +421,12 @@ (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 ), @@ -421,7 +439,7 @@ (FT_Module_Constructor)ft_smooth_init, (FT_Module_Destructor) 0, (FT_Module_Requester) 0 - }, + , FT_GLYPH_FORMAT_OUTLINE, @@ -430,15 +448,11 @@ (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 ), @@ -451,7 +465,7 @@ (FT_Module_Constructor)ft_smooth_init, (FT_Module_Destructor) 0, (FT_Module_Requester) 0 - }, + , FT_GLYPH_FORMAT_OUTLINE, @@ -460,8 +474,8 @@ (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 */ diff --git a/lib/3rdparty/freetype/src/smooth/ftsmooth.h b/lib/3rdparty/freetype/src/smooth/ftsmooth.h index 62cced44873..3708790df17 100644 --- a/lib/3rdparty/freetype/src/smooth/ftsmooth.h +++ b/lib/3rdparty/freetype/src/smooth/ftsmooth.h @@ -28,15 +28,15 @@ FT_BEGIN_HEADER #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 - 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 diff --git a/lib/3rdparty/freetype/src/smooth/ftspic.c b/lib/3rdparty/freetype/src/smooth/ftspic.c new file mode 100644 index 00000000000..aa547fceb6d --- /dev/null +++ b/lib/3rdparty/freetype/src/smooth/ftspic.c @@ -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/lib/3rdparty/freetype/src/base/_ftbase_ros.c b/lib/3rdparty/freetype/src/smooth/ftspic.h similarity index 55% rename from lib/3rdparty/freetype/src/base/_ftbase_ros.c rename to lib/3rdparty/freetype/src/smooth/ftspic.h index e1d32483287..c7e0ce9d892 100644 --- a/lib/3rdparty/freetype/src/base/_ftbase_ros.c +++ b/lib/3rdparty/freetype/src/smooth/ftspic.h @@ -1,11 +1,11 @@ /***************************************************************************/ /* */ -/* ftbase.c */ +/* ftspic.h */ /* */ -/* Single object library component (body only). */ +/* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* 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 */ @@ -16,27 +16,35 @@ /***************************************************************************/ -#include <ft2build.h> +#ifndef __FTSPIC_H__ +#define __FTSPIC_H__ -#define FT_MAKE_OPTION_SINGLE_OBJECT + +FT_BEGIN_HEADER -#define FT_MulFix FT_MulFix_wrong -#include "ftcalc.c" -#undef FT_MulFix -#include "_ftmulfix_ros.c" +#include FT_INTERNAL_PIC_H -#include "ftdbgmem.c" -#include "ftgloadr.c" -#include "ftnames.c" -#include "ftobjs.c" -#include "ftoutln.c" -#include "ftrfork.c" -#include "ftstream.c" -#include "fttrigon.c" -#include "ftutil.c" +#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__ */ -#if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON ) -#include <ftmac.c> -#endif /* END */ diff --git a/lib/3rdparty/freetype/src/smooth/module.mk b/lib/3rdparty/freetype/src/smooth/module.mk index 05ad4ba0a89..47f6c040764 100644 --- a/lib/3rdparty/freetype/src/smooth/module.mk +++ b/lib/3rdparty/freetype/src/smooth/module.mk @@ -16,11 +16,11 @@ 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) -$(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) -$(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 diff --git a/lib/3rdparty/freetype/src/smooth/smooth.c b/lib/3rdparty/freetype/src/smooth/smooth.c index ff6be3e4007..a8ac51f9f8c 100644 --- a/lib/3rdparty/freetype/src/smooth/smooth.c +++ b/lib/3rdparty/freetype/src/smooth/smooth.c @@ -19,6 +19,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> +#include "ftspic.c" #include "ftgrays.c" #include "ftsmooth.c" diff --git a/lib/3rdparty/freetype/src/tools/apinames.c b/lib/3rdparty/freetype/src/tools/apinames.c index f08919bee6c..7f191e19c91 100644 --- a/lib/3rdparty/freetype/src/tools/apinames.c +++ b/lib/3rdparty/freetype/src/tools/apinames.c @@ -10,7 +10,7 @@ * 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, 2009 * * This code is explicitly placed into the public domain. * @@ -26,7 +26,7 @@ #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 */ @@ -44,7 +44,7 @@ panic( const char* message ) } -typedef struct +typedef struct NameRec_ { char* name; unsigned int hash; @@ -191,7 +191,7 @@ names_dump( FILE* out, /* 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 */ @@ -265,7 +265,7 @@ read_header_file( FILE* file, int verbose ) if ( p > name ) { if ( verbose ) - fprintf( stderr, ">>> %.*s\n", p-name, name ); + fprintf( stderr, ">>> %.*s\n", (int)(p - name), name ); names_add( name, p ); } diff --git a/lib/3rdparty/freetype/src/tools/chktrcmp.py b/lib/3rdparty/freetype/src/tools/chktrcmp.py new file mode 100644 index 00000000000..d0f342e6bdd --- /dev/null +++ b/lib/3rdparty/freetype/src/tools/chktrcmp.py @@ -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] ) + diff --git a/lib/3rdparty/freetype/src/tools/docmaker/content.py b/lib/3rdparty/freetype/src/tools/docmaker/content.py index b14c52edefd..b398955b81d 100644 --- a/lib/3rdparty/freetype/src/tools/docmaker/content.py +++ b/lib/3rdparty/freetype/src/tools/docmaker/content.py @@ -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. @@ -34,6 +35,13 @@ re_code_end = re.compile( r"(\s*)}\s*$" ) 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. @@ -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'. # -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: @@ -56,15 +64,15 @@ class DocCode: 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 - def dump_lines( self, margin=0, width=60 ): + def dump_lines( self, margin = 0, width = 60 ): result = [] for l in self.lines: - result.append( " "*margin + l ) + result.append( " " * margin + l ) return result @@ -75,34 +83,34 @@ class DocCode: # # '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: - l = string.strip(l) + l = string.strip( 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 - 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: - ln = len(word) + ln = len( word ) if col > 0: - ln = ln+1 + ln = ln + 1 if col + ln > width: - result.append( " "*margin + cur ) + result.append( " " * margin + cur ) cur = word - col = len(word) + col = len( word ) else: if col > 0: cur = cur + " " @@ -110,31 +118,29 @@ class DocPara: col = col + ln if col > 0: - result.append( " "*margin + cur ) + result.append( " " * margin + cur ) 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 # -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.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, @@ -142,14 +148,13 @@ class DocField: # start = 0 mode = mode_none - for l in lines: + for l in lines: # are we parsing a code sequence ? if mode == mode_code: - 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 @@ -169,9 +174,8 @@ class DocField: cur_lines = [] # switch to code extraction mode - margin = len(m.group(1)) + margin = len( m.group( 1 ) ) mode = mode_code - 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 ) - 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 + "----" @@ -205,9 +208,10 @@ class DocField: p.dump( prefix ) first = 0 - def dump_lines( self, margin=0, width=60 ): + def dump_lines( self, margin = 0, width = 60 ): result = [] nl = None + for p in self.items: if nl: result.append( "" ) @@ -217,17 +221,19 @@ class DocField: return result + + # 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 @@ -245,10 +251,10 @@ class DocMarkup: 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 ) @@ -256,51 +262,48 @@ class DocMarkup: 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] - 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:] - 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( " " ) - 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.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: - 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 @@ -311,15 +314,15 @@ class DocSection: self.title = "ERROR" self.chapter = None - def add_def( self, block ): + def add_def( self, block ): self.defs.append( block ) - def add_block( self, block ): + def add_block( self, block ): 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: @@ -329,49 +332,51 @@ class DocSection: 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 ) -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 - 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 ) - self.sections[ section_name ] = section - self.section = section + self.sections[section_name] = section + self.section = section 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 ) - def reset( self ): + def reset( self ): """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 - 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 ) @@ -381,8 +386,7 @@ class ContentProcessor: 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 @@ -394,9 +398,9 @@ class ContentProcessor: 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 ? @@ -404,7 +408,7 @@ class ContentProcessor: 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 ) @@ -413,28 +417,25 @@ class ContentProcessor: return self.markups - 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 = [] - m = n+1 + m = n + 1 while m < count and not blocks[m].content: follow.append( blocks[m] ) - m = m+1 + m = m + 1 doc_block = DocBlock( source, follow, self ) - def finish( self ): - # 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: - 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: - sys.stderr.write( "WARNING: chapter '" + + sys.stderr.write( "WARNING: chapter '" + \ 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.append(sec) + others.append( sec ) # 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() - 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: @@ -491,7 +491,6 @@ class DocBlock: except: pass - # 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 = m.group(1) + name = m.group( 1 ) self.name = name except: pass - # detect new section starts if self.type == "section": + # detect new section starts processor.set_section( self.name ) processor.section.add_def( self ) - - # detect new chapter elif self.type == "chapter": + # detect new chapter processor.add_chapter( self ) - else: processor.section.add_block( self ) @@ -523,6 +520,11 @@ class DocBlock: 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 @@ -530,7 +532,7 @@ class DocBlock: # 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 @@ -538,25 +540,22 @@ class DocBlock: 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() - - - 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: - if m.tag == string.lower(tag_name): + if m.tag == string.lower( tag_name ): 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 ) @@ -564,21 +563,18 @@ class DocBlock: 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 [] - - 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 ) - - 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 diff --git a/lib/3rdparty/freetype/src/tools/docmaker/docbeauty.py b/lib/3rdparty/freetype/src/tools/docmaker/docbeauty.py index 55c43297f1f..3ddf4a94a15 100644 --- a/lib/3rdparty/freetype/src/tools/docmaker/docbeauty.py +++ b/lib/3rdparty/freetype/src/tools/docmaker/docbeauty.py @@ -1,23 +1,24 @@ #!/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. # -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 + content_processor = ContentProcessor() -def beautify_block( block ): +def beautify_block( block ): if block.content: content_processor.reset() @@ -30,7 +31,7 @@ def beautify_block( block ): first = 0 # now beautify the documentation "borders" themselves - lines = [ " /*************************************************************************" ] + lines = [" /*************************************************************************"] for l in text: lines.append( " *" + l ) lines.append( " */" ) @@ -38,9 +39,9 @@ def beautify_block( block ): block.lines = lines -def usage(): +def usage(): 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" @@ -48,16 +49,15 @@ def usage(): print " --backup : same as -b" -def main( argv ): +def main( argv ): """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 ) @@ -80,16 +80,19 @@ def main( argv ): 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 ) + for block in source_processor.blocks: beautify_block( block ) + new_name = filename + ".new" ok = None + try: file = open( new_name, "wt" ) for block in source_processor.blocks: @@ -100,6 +103,7 @@ def main( argv ): except: ok = 0 + # if called from the command line # if __name__ == '__main__': diff --git a/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py b/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py index d34b6e8f96b..1d9de9fbff2 100644 --- a/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py +++ b/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py @@ -1,6 +1,6 @@ #!/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 @@ -24,9 +24,9 @@ import utils import sys, os, time, string, glob, getopt -def usage(): +def usage(): 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\"'" @@ -38,16 +38,15 @@ def usage(): print " --prefix : same as -p, as in '--prefix=ft2'" -def main( argv ): +def main( argv ): """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 ) @@ -76,7 +75,7 @@ def main( argv ): if opt[0] in ( "-p", "--prefix" ): project_prefix = opt[1] - check_output( ) + check_output() # create context and processor source_processor = SourceProcessor() diff --git a/lib/3rdparty/freetype/src/tools/docmaker/formatter.py b/lib/3rdparty/freetype/src/tools/docmaker/formatter.py index 363410efc76..f62ce676c15 100644 --- a/lib/3rdparty/freetype/src/tools/docmaker/formatter.py +++ b/lib/3rdparty/freetype/src/tools/docmaker/formatter.py @@ -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 * @@ -14,10 +14,9 @@ from utils import * # 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 @@ -25,7 +24,7 @@ class Formatter: 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 ) @@ -36,26 +35,22 @@ class Formatter: for field in markup.fields: self.add_identifier( field.name, block ) - 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 ): - # duplicate name !! - sys.stderr.write( \ + # duplicate name! + sys.stderr.write( \ "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 - # # Formatting the table of contents # - def toc_enter( self ): pass @@ -78,7 +73,6 @@ class Formatter: pass def toc_dump( self, toc_filename = None, index_filename = None ): - 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_chapter_exit ( chap ) + self.toc_chapter_exit( chap ) self.toc_index( index_filename ) @@ -105,7 +99,6 @@ class Formatter: # # Formatting the index # - def index_enter( self ): pass @@ -119,7 +112,6 @@ class Formatter: pass def index_dump( self, index_filename = None ): - 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 ) - self.index_name_exit ( name ) + self.index_name_exit( name ) self.index_exit() @@ -162,9 +154,7 @@ class Formatter: def section_exit( self, section ): pass - def section_dump( self, section, section_filename = None ): - 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: - block = self.identifiers[ name ] + block = self.identifiers[name] 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.field_exit ( field, markup, block ) + self.field_exit( field, markup, block ) self.markup_exit( markup, block ) self.block_exit( block ) - self.section_exit ( section ) + self.section_exit( section ) if output: close_output( output ) - - def section_dump_all( self ): + def section_dump_all( self ): for section in self.sections: self.section_dump( section ) - # - # Formatting a block - # - # eof diff --git a/lib/3rdparty/freetype/src/tools/docmaker/sources.py b/lib/3rdparty/freetype/src/tools/docmaker/sources.py index 09ff7f9970d..7b68c07019d 100644 --- a/lib/3rdparty/freetype/src/tools/docmaker/sources.py +++ b/lib/3rdparty/freetype/src/tools/docmaker/sources.py @@ -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> # # @@ -18,10 +18,8 @@ # 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 ## -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""" - 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''' - \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''' @@ -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 '/' - \s*$ # eventually followed by whitespace + \s*$ # probably followed by whitespace ''' re_source_block_format1 = SourceBlockFormat( 1, start, column, start ) + # # 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 - \s*$ # eventually followed by whitespace + \s*$ # probably followed by whitespace ''' 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''' - \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 ) + # # 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 # -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 @@ -175,18 +174,19 @@ re_source_keywords = re.compile( '''\\b ( typedef | \#else | \#endif ) \\b''', re.VERBOSE ) + ################################################################ ## ## 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 ## -## - normal sources lines, include comments +## - normal sources lines, including comments ## ## 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) ## -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 @@ -218,24 +219,22 @@ class SourceBlock: 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: - 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 - 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 - def dump( self ): - + def dump( self ): if self.content: print "{{{content start---" for l in self.content: @@ -245,17 +244,18 @@ class SourceBlock: fmt = "" if self.format: - fmt = repr(self.format.id) + " " + fmt = repr( self.format.id ) + " " for line in self.lines: print line + ################################################################ ## ## 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. ## @@ -267,7 +267,7 @@ class SourceBlock: ## - normal sources lines, include comments ## ## -class SourceProcessor: +class SourceProcessor: def __init__( self ): """initialize a source processor""" @@ -281,39 +281,33 @@ class SourceProcessor: self.blocks = [] self.format = None - 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.format = None - self.lineno = 0 - self.lines = [] + self.format = None + self.lineno = 0 + self.lines = [] 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 ) - 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() - 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 @@ -325,22 +319,18 @@ class SourceProcessor: # 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: - 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 ) - - - 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 ) @@ -348,9 +338,8 @@ class SourceProcessor: self.format = None self.lines = [] - # 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() diff --git a/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py b/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py index 04dfba3f46a..fffa120973d 100644 --- a/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py +++ b/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py @@ -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 * @@ -7,17 +7,19 @@ from formatter import * import time + # 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"> -<title>""" +<title>\ +""" -html_header_2= """ API Reference +html_header_2 = """\ + API Reference -

""" +""" + +html_header_3 = """ + + + +
[
[Index][TOC]
+

\ +""" -html_header_3=""" API Reference

+html_header_5t = """\ +">Index] + +

\ """ +html_header_6 = """\ + API Reference

+""" # The HTML footer used by all generated pages. -# html_footer = """\ -""" +\ +""" # The header and footer used for each section. -# section_title_header = "

" section_title_footer = "

" # The header and footer used for code segments. -# code_header = '
'
 code_footer = '
' # Paragraph header and footer. -# para_header = "

" para_footer = "

" # Block header and footer. -# block_header = '
' block_footer_start = """\

- -
[
[Index] [TOC]
""" # Description header/footer. -# description_header = '
' description_footer = "

" # Marker header/inter/footer combination. -# marker_header = '
' marker_inter = "
" marker_footer = "
" +# Header location header/footer. +header_location_header = '
' +header_location_footer = "

" + # Source code extracts header/footer. -# source_header = '
\n'
 source_footer = "\n

" # Chapter header/inter/footer. -# chapter_header = '

' chapter_inter = '

  • ' chapter_footer = '
' @@ -114,86 +140,108 @@ chapter_footer = '' index_footer_start = """\
-
[TOC]
""" +# TOC footer. +toc_footer_start = """\ +
+ + +
[Index]
+""" + # source language keyword coloration/styling -# keyword_prefix = '' keyword_suffix = '' section_synopsis_header = '

Synopsis

' section_synopsis_footer = '' + # Translate a single line of source to HTML. This will convert # a "<" into "<.", ">" into ">.", etc. -# -def html_quote( line ): - result = string.replace( line, "&", "&" ) +def html_quote( line ): + result = string.replace( line, "&", "&" ) result = string.replace( result, "<", "<" ) result = string.replace( result, ">", ">" ) return result # same as 'html_quote', but ignores left and right brackets -# -def html_quote0( line ): +def html_quote0( line ): return string.replace( line, "&", "&" ) -def dump_html_code( lines, prefix = "" ): +def dump_html_code( lines, prefix = "" ): # 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. - # 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, -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 ) - 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 = "" - 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 = "
generated on " + \ - time.asctime( time.localtime( time.time() ) ) + \ - "
" + 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 = "
generated on " + \ + time.asctime( time.localtime( time.time() ) ) + \ + "
" + html_footer 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_html_words( self, words ): """ convert a series of simple words into some HTML text """ line = "" @@ -204,16 +252,14 @@ class HtmlFormatter(Formatter): return line - 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: - 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 '' + name + '' + rest @@ -226,34 +272,34 @@ class HtmlFormatter(Formatter): # 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 '' + name + '' + 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 '' + name + '' + rest - return html_quote(word) - + return html_quote( word ) 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 = re.sub( r"(^|\W)`(.*?)'(\W|$)", - r'\1‘\2’\3', + line = re.sub( r"(^|\W)`(.*?)'(\W|$)", \ + r'\1‘\2’\3', \ line ) + # convert tilde into non-breakable space + line = string.replace( line, "~", " " ) return para_header + line + para_footer - 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 - 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' ) - 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: - print "

"+field.name+"

" + print "
" + field.name + "" print self.make_html_items( field.items ) if field.name: print "
" - - 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: - 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 + '' + name + '' - - 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 - - elif self.identifiers.has_key(name): + elif self.identifiers.has_key( name ): # this is a known identifier block = self.identifiers[name] result = result + prefix + '' + name + '' + self.make_block_url( block ) + '">' + name + '' else: - result = result + html_quote(line[:length]) + result = result + html_quote( line[:length] ) line = line[length:] else: - result = result + html_quote(line) + result = result + html_quote( line ) line = [] return result - - def print_html_field_list( self, fields ): + def print_html_field_list( self, fields ): + print "

" print "" for field in fields: - if len(field.name) > 22: - print "" + if len( field.name ) > 22: + print "" print "" print "
"+field.name+"
" + field.name + "
" else: print "
" + field.name + "" @@ -335,8 +375,7 @@ class HtmlFormatter(Formatter): print "
" - - def print_html_markup( self, markup ): + def print_html_markup( self, markup ): 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 ) - else: if table_fields: self.print_html_field_list( table_fields ) @@ -359,9 +397,8 @@ class HtmlFormatter(Formatter): # # Formatting the index # - def index_enter( self ): - print self.html_header + print self.html_index_header 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 ): - # 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 "" - for r in range(rows): + for r in range( rows ): line = "" - 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] @@ -391,14 +427,15 @@ class HtmlFormatter(Formatter): print "
" - print index_footer_start + \ + print index_footer_start + \ self.file_prefix + "toc.html" + \ index_footer_end + print self.html_footer + self.index_items = {} def index_dump( self, index_filename = None ): - 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 ): - print self.html_header + print self.html_toc_header print "

Table of Contents

" 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 "" def toc_section_enter( self, section ): - print "
" + print '
' print '' + \ section.title + '' @@ -427,12 +464,18 @@ class HtmlFormatter(Formatter): def toc_chapter_exit( self, chapter ): print "
" - print chapter_footer + print chapter_footer def toc_index( self, index_filename ): - print chapter_header + 'Global Index' + chapter_inter + chapter_footer + print chapter_header + \ + 'Global Index' + \ + chapter_inter + chapter_footer 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 ): @@ -459,7 +502,7 @@ class HtmlFormatter(Formatter): 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 @@ -501,12 +544,26 @@ class HtmlFormatter(Formatter): # 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 - 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" + \ - block_footer_middle + self.file_prefix + "toc.html" + \ + block_footer_middle + self.file_prefix + "toc.html" + \ block_footer_end - 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' ) diff --git a/lib/3rdparty/freetype/src/tools/docmaker/utils.py b/lib/3rdparty/freetype/src/tools/docmaker/utils.py index e751c563186..1d96658c7d5 100644 --- a/lib/3rdparty/freetype/src/tools/docmaker/utils.py +++ b/lib/3rdparty/freetype/src/tools/docmaker/utils.py @@ -1,4 +1,4 @@ -# Utils (c) 2002, 2004, 2007 David Turner +# Utils (c) 2002, 2004, 2007, 2008 David Turner # 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. # -def index_sort( s1, s2 ): +def index_sort( s1, s2 ): if not s1: return -1 @@ -41,9 +41,10 @@ def index_sort( s1, s2 ): return 0 + # 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: @@ -51,12 +52,11 @@ def sort_order_list( input_list, order_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. # -def open_output( filename ): +def open_output( filename ): 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". # -def close_output( output ): +def close_output( output ): 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 ): - sys.stderr.write( "argument" + " '" + output_dir + "' " + + sys.stderr.write( "argument" + " '" + output_dir + "' " + \ "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: @@ -102,9 +103,8 @@ def file_exists( pathname ): return result -def make_file_list( args = None ): +def make_file_list( args = None ): """builds a list of input files from command-line arguments""" - file_list = [] # sys.stderr.write( repr( sys.argv[1 :] ) + '\n' ) diff --git a/lib/3rdparty/freetype/src/tools/ftrandom/ftrandom.c b/lib/3rdparty/freetype/src/tools/ftrandom/ftrandom.c index fcff27bc350..4daac0dc1d4 100644 --- a/lib/3rdparty/freetype/src/tools/ftrandom/ftrandom.c +++ b/lib/3rdparty/freetype/src/tools/ftrandom/ftrandom.c @@ -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: @@ -151,8 +151,8 @@ 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 ) @@ -162,8 +162,8 @@ 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 ); diff --git a/lib/3rdparty/freetype/src/tools/glnames.py b/lib/3rdparty/freetype/src/tools/glnames.py index 9a6da383172..55573b22fe8 100644 --- a/lib/3rdparty/freetype/src/tools/glnames.py +++ b/lib/3rdparty/freetype/src/tools/glnames.py @@ -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, @@ -21,7 +21,7 @@ usage: %s 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. """ @@ -5011,7 +5011,7 @@ def dump_array( the_array, write, 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 = "" @@ -5067,7 +5067,7 @@ def main(): 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" ) @@ -5117,6 +5117,9 @@ def main(): * 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" ) @@ -5219,6 +5222,8 @@ def main(): return 0; } +#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ + """ ) if 0: # generate unit test, or don't diff --git a/lib/3rdparty/freetype/src/tools/test_afm.c b/lib/3rdparty/freetype/src/tools/test_afm.c index d53cb332562..f5f99363cab 100644 --- a/lib/3rdparty/freetype/src/tools/test_afm.c +++ b/lib/3rdparty/freetype/src/tools/test_afm.c @@ -63,7 +63,7 @@ int dummy_get_index( const char* name, - FT_UInt len, + FT_Offset len, void* user_data ) { if ( len ) diff --git a/lib/3rdparty/freetype/src/truetype/Jamfile b/lib/3rdparty/freetype/src/truetype/Jamfile index a166909f4cc..a8cccfe1372 100644 --- a/lib/3rdparty/freetype/src/truetype/Jamfile +++ b/lib/3rdparty/freetype/src/truetype/Jamfile @@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) truetype ; if $(FT2_MULTI) { - _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ; + _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ttpic ; } else { diff --git a/lib/3rdparty/freetype/src/truetype/module.mk b/lib/3rdparty/freetype/src/truetype/module.mk index 3b05afc7fda..baee81a7730 100644 --- a/lib/3rdparty/freetype/src/truetype/module.mk +++ b/lib/3rdparty/freetype/src/truetype/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/truetype/truetype.c b/lib/3rdparty/freetype/src/truetype/truetype.c index b36473a72df..4bd1209787e 100644 --- a/lib/3rdparty/freetype/src/truetype/truetype.c +++ b/lib/3rdparty/freetype/src/truetype/truetype.c @@ -19,6 +19,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include +#include "ttpic.c" #include "ttdriver.c" /* driver interface */ #include "ttpload.c" /* tables loader */ #include "ttgload.c" /* glyph loader */ diff --git a/lib/3rdparty/freetype/src/truetype/ttdriver.c b/lib/3rdparty/freetype/src/truetype/ttdriver.c index c2cf45298a5..d723b57ae9d 100644 --- a/lib/3rdparty/freetype/src/truetype/ttdriver.c +++ b/lib/3rdparty/freetype/src/truetype/ttdriver.c @@ -4,7 +4,8 @@ /* */ /* 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 */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,7 +21,6 @@ #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 @@ -41,6 +41,7 @@ #include "tterrors.h" +#include "ttpic.h" /*************************************************************************/ /* */ @@ -125,6 +126,49 @@ #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; + } + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -229,7 +273,7 @@ /* 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). */ @@ -255,14 +299,35 @@ if ( !size ) return TT_Err_Invalid_Size_Handle; - if ( !face || glyph_index >= (FT_UInt)face->num_glyphs ) + if ( !face ) + return TT_Err_Invalid_Argument; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( glyph_index >= (FT_UInt)face->num_glyphs && + !face->internal->incremental_interface ) +#else + if ( glyph_index >= (FT_UInt)face->num_glyphs ) +#endif 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 ) ) { - 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 */ @@ -288,14 +353,13 @@ /*************************************************************************/ #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 - }; + ) #endif static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine = @@ -315,22 +379,24 @@ #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 - }; + ) - static const FT_ServiceDescRec tt_services[] = - { - { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE }, #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 - { 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 */ @@ -340,11 +406,13 @@ FT_Module sfntd; SFNT_Service sfnt; - - 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 ( !driver ) + return NULL; + /* only return the default interface from the SFNT module */ sfntd = FT_Get_Module( driver->library, "sfnt" ); if ( sfntd ) @@ -360,18 +428,25 @@ /* 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 - FT_MODULE_DRIVER_HAS_HINTER, +#define TT_HINTER_FLAG FT_MODULE_DRIVER_HAS_HINTER #else - 0, +#define TT_HINTER_FLAG 0 #endif +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS +#define TT_SIZE_SELECT tt_size_select +#else +#define TT_SIZE_SELECT 0 +#endif + + FT_DEFINE_DRIVER(tt_driver_class, + + + FT_MODULE_FONT_DRIVER | + FT_MODULE_DRIVER_SCALABLE | + TT_HINTER_FLAG, + sizeof ( TT_DriverRec ), "truetype", /* driver name */ @@ -383,7 +458,6 @@ tt_driver_init, tt_driver_done, tt_get_interface, - }, sizeof ( TT_FaceRec ), sizeof ( TT_SizeRec ), @@ -396,23 +470,18 @@ 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 */ - 0, /* FT_Face_GetAdvancesFunc */ + tt_get_advances, tt_size_request, -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - tt_size_select -#else - 0 /* FT_Size_SelectFunc */ -#endif - }; + TT_SIZE_SELECT + ) /* END */ diff --git a/lib/3rdparty/freetype/src/truetype/ttdriver.h b/lib/3rdparty/freetype/src/truetype/ttdriver.h index f6f26e4b59a..aae00f2617f 100644 --- a/lib/3rdparty/freetype/src/truetype/ttdriver.h +++ b/lib/3rdparty/freetype/src/truetype/ttdriver.h @@ -27,7 +27,7 @@ FT_BEGIN_HEADER - FT_EXPORT_VAR( const FT_Driver_ClassRec ) tt_driver_class; + FT_DECLARE_DRIVER( tt_driver_class ) FT_END_HEADER diff --git a/lib/3rdparty/freetype/src/truetype/ttgload.c b/lib/3rdparty/freetype/src/truetype/ttgload.c index ae476a41711..57ea0baa770 100644 --- a/lib/3rdparty/freetype/src/truetype/ttgload.c +++ b/lib/3rdparty/freetype/src/truetype/ttgload.c @@ -4,7 +4,8 @@ /* */ /* 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, */ +/* 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -69,17 +70,20 @@ /* `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 ); if ( check && face->postscript.isFixedPitch ) *aw = face->horizontal.advance_Width_Max; + + FT_TRACE5(( " advance width (font units): %d\n", *aw )); + FT_TRACE5(( " left side bearing (font units): %d\n", *lsb )); } @@ -96,12 +100,12 @@ /* 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 ); @@ -131,6 +135,91 @@ #endif + FT_TRACE5(( " advance height (font units): %d\n", *ah )); + FT_TRACE5(( " top side bearing (font units): %d\n", *tsb )); + } + + + static void + tt_get_metrics( TT_Loader loader, + FT_UInt glyph_index ) + { + TT_Face face = (TT_Face)loader->face; + + FT_Short left_bearing = 0, top_bearing = 0; + FT_UShort advance_width = 0, advance_height = 0; + + + 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 + + /* If this is an incrementally loaded font check whether there are */ + /* overriding metrics for this glyph. */ + if ( face->root.internal->incremental_interface && + face->root.internal->incremental_interface->funcs->get_glyph_metrics ) + { + FT_Incremental_MetricsRec metrics; + FT_Error error; + + + metrics.bearing_x = left_bearing; + metrics.bearing_y = 0; + metrics.advance = advance_width; + metrics.advance_v = 0; + + error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( + face->root.internal->incremental_interface->object, + glyph_index, FALSE, &metrics ); + if ( error ) + goto Exit; + + left_bearing = (FT_Short)metrics.bearing_x; + advance_width = (FT_UShort)metrics.advance; + +#if 0 + + /* GWW: Do I do the same for vertical metrics? */ + metrics.bearing_x = 0; + metrics.bearing_y = top_bearing; + metrics.advance = advance_height; + + error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( + face->root.internal->incremental_interface->object, + glyph_index, TRUE, &metrics ); + if ( error ) + goto Exit; + + top_bearing = (FT_Short)metrics.bearing_y; + advance_height = (FT_UShort)metrics.advance; + +#endif /* 0 */ + + } + + Exit: + +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + + loader->left_bearing = left_bearing; + loader->advance = advance_width; + loader->top_bearing = top_bearing; + loader->vadvance = advance_height; + + if ( !loader->linear_def ) + { + loader->linear_def = 1; + loader->linear = advance_width; + } } @@ -267,7 +356,11 @@ 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 ); @@ -313,7 +406,7 @@ 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; @@ -321,7 +414,7 @@ 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; } @@ -378,8 +471,8 @@ 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 ) @@ -401,7 +494,8 @@ 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 */ @@ -413,8 +507,8 @@ 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 ) @@ -436,7 +530,8 @@ 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; @@ -553,10 +648,10 @@ 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 ); } @@ -627,7 +722,13 @@ #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; @@ -639,6 +740,26 @@ /* 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 */ @@ -654,6 +775,9 @@ 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 ); @@ -669,6 +793,10 @@ 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 @@ -702,7 +830,7 @@ 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; @@ -729,7 +857,7 @@ /* 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), @@ -903,15 +1031,15 @@ /* 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_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 ); @@ -1004,7 +1132,7 @@ /* 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; @@ -1027,8 +1155,7 @@ /* 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; @@ -1064,9 +1191,10 @@ static FT_Error load_truetype_glyph( TT_Loader loader, FT_UInt glyph_index, - FT_UInt recurse_count ) + FT_UInt recurse_count, + FT_Bool header_only ) { - FT_Error error; + FT_Error error = TT_Err_Ok; FT_Fixed x_scale, y_scale; FT_ULong offset; TT_Face face = (TT_Face)loader->face; @@ -1084,7 +1212,10 @@ #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; @@ -1110,75 +1241,7 @@ y_scale = 0x10000L; } - /* get metrics, horizontal and vertical */ - { - FT_Short left_bearing = 0, top_bearing = 0; - FT_UShort advance_width = 0, advance_height = 0; - - - Get_HMetrics( face, glyph_index, - (FT_Bool)!( loader->load_flags & - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ), - &left_bearing, - &advance_width ); - Get_VMetrics( face, glyph_index, - (FT_Bool)!( loader->load_flags & - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ), - &top_bearing, - &advance_height ); - -#ifdef FT_CONFIG_OPTION_INCREMENTAL - - /* If this is an incrementally loaded font see if there are */ - /* overriding metrics for this glyph. */ - if ( face->root.internal->incremental_interface && - face->root.internal->incremental_interface->funcs->get_glyph_metrics ) - { - FT_Incremental_MetricsRec metrics; - - - metrics.bearing_x = left_bearing; - metrics.bearing_y = 0; - metrics.advance = advance_width; - error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( - face->root.internal->incremental_interface->object, - glyph_index, FALSE, &metrics ); - if ( error ) - goto Exit; - left_bearing = (FT_Short)metrics.bearing_x; - advance_width = (FT_UShort)metrics.advance; - -#if 0 - - /* GWW: Do I do the same for vertical metrics? */ - metrics.bearing_x = 0; - metrics.bearing_y = top_bearing; - metrics.advance = advance_height; - error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( - face->root.internal->incremental_interface->object, - glyph_index, TRUE, &metrics ); - if ( error ) - goto Exit; - top_bearing = (FT_Short)metrics.bearing_y; - advance_height = (FT_UShort)metrics.advance; - -#endif /* 0 */ - - } - -#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - - loader->left_bearing = left_bearing; - loader->advance = advance_width; - loader->top_bearing = top_bearing; - loader->vadvance = advance_height; - - if ( !loader->linear_def ) - { - loader->linear_def = 1; - loader->linear = advance_width; - } - } + tt_get_metrics( loader, glyph_index ); /* Set `offset' to the start of the glyph relative to the start of */ /* the `glyf' table, and `byte_len' to the length of the glyph in */ @@ -1214,15 +1277,45 @@ offset = tt_face_get_location( face, glyph_index, (FT_UInt*)&loader->byte_len ); - if ( loader->byte_len == 0 ) + if ( loader->byte_len > 0 ) + { +#ifdef FT_CONFIG_OPTION_INCREMENTAL + /* for the incremental interface, `glyf_offset' is always zero */ + if ( !loader->glyf_offset && + !face->root.internal->incremental_interface ) +#else + if ( !loader->glyf_offset ) +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + { + 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 glyph header first */ + error = face->read_glyph_header( loader ); + if ( error || header_only ) + 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.yMax = 0; + if ( header_only ) + goto Exit; + TT_LOADER_SET_PP( loader ); #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT @@ -1260,19 +1353,6 @@ 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 ); /***********************************************************************/ @@ -1281,7 +1361,7 @@ /* 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 ) @@ -1351,8 +1431,11 @@ { 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; } } @@ -1390,21 +1473,16 @@ /*********************************************************************/ { - 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 */ @@ -1413,10 +1491,6 @@ 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 */ @@ -1431,7 +1505,7 @@ num_base_points = gloader->base.outline.n_points; error = load_truetype_glyph( loader, subglyph->index, - recurse_count + 1 ); + recurse_count + 1, FALSE ); if ( error ) goto Exit; @@ -1551,17 +1625,35 @@ 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. */ - if ( face->vertical_info && + if ( face->vertical_info && face->vertical.number_Of_VMetrics > 0 ) { top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax, @@ -1636,37 +1728,19 @@ /* scale the metrics */ if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) ) { - top = FT_MulFix( top, y_scale ); + top = FT_MulFix( top, y_scale ); advance = FT_MulFix( advance, y_scale ); } /* 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; } - /* 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; } @@ -1714,6 +1788,7 @@ glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6; glyph->format = FT_GLYPH_FORMAT_BITMAP; + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { glyph->bitmap_left = metrics.vertBearingX; @@ -1736,7 +1811,8 @@ tt_loader_init( TT_Loader loader, TT_Size size, TT_GlyphSlot glyph, - FT_Int32 load_flags ) + FT_Int32 load_flags, + FT_Bool glyf_table_only ) { TT_Face face; FT_Stream stream; @@ -1750,7 +1826,7 @@ #ifdef TT_USE_BYTECODE_INTERPRETER /* load execution context */ - if ( IS_HINTED( load_flags ) ) + if ( IS_HINTED( load_flags ) && !glyf_table_only ) { TT_ExecContext exec; FT_Bool grayscale; @@ -1819,15 +1895,19 @@ 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; } - loader->glyf_offset = FT_STREAM_POS(); + else + loader->glyf_offset = FT_STREAM_POS(); } /* get face's glyph loader */ + if ( !glyf_table_only ) { FT_GlyphLoader gloader = glyph->internal->loader; @@ -1836,7 +1916,7 @@ loader->gloader = gloader; } - loader->load_flags = load_flags; + loader->load_flags = load_flags; loader->face = (FT_Face)face; loader->size = (FT_Size)size; @@ -1899,7 +1979,25 @@ { error = load_sbit_image( size, glyph, glyph_index, load_flags ); if ( !error ) + { + FT_Face root = &face->root; + + + if ( FT_IS_SCALABLE( root ) ) + { + /* for the bbox we need the header only */ + (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE ); + (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE ); + glyph->linearHoriAdvance = loader.linear; + glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax - + loader.vadvance; + if ( face->postscript.isFixedPitch && + ( load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 ) + glyph->linearHoriAdvance = face->horizontal.advance_Width_Max; + } + return TT_Err_Ok; + } } #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ @@ -1911,7 +2009,7 @@ if ( load_flags & FT_LOAD_SBITS_ONLY ) return TT_Err_Invalid_Argument; - error = tt_loader_init( &loader, size, glyph, load_flags ); + error = tt_loader_init( &loader, size, glyph, load_flags, FALSE ); if ( error ) return error; @@ -1920,7 +2018,7 @@ glyph->outline.flags = 0; /* main loading loop */ - error = load_truetype_glyph( &loader, glyph_index, 0 ); + error = load_truetype_glyph( &loader, glyph_index, 0, FALSE ); if ( !error ) { if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE ) @@ -1939,6 +2037,40 @@ 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 ); } diff --git a/lib/3rdparty/freetype/src/truetype/ttgload.h b/lib/3rdparty/freetype/src/truetype/ttgload.h index b261e97dee0..958d67d20d7 100644 --- a/lib/3rdparty/freetype/src/truetype/ttgload.h +++ b/lib/3rdparty/freetype/src/truetype/ttgload.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -34,6 +34,20 @@ FT_BEGIN_HEADER 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, diff --git a/lib/3rdparty/freetype/src/truetype/ttgxvar.c b/lib/3rdparty/freetype/src/truetype/ttgxvar.c index 0dc2c4f3e4a..ef25aafb5bf 100644 --- a/lib/3rdparty/freetype/src/truetype/ttgxvar.c +++ b/lib/3rdparty/freetype/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -16,30 +16,31 @@ /***************************************************************************/ -/***************************************************************************/ -/* */ -/* 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 @@ -47,11 +48,9 @@ #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 "ttdriver.h" #include "ttpload.h" #include "ttgxvar.h" @@ -95,11 +94,8 @@ #define ALL_POINTS (FT_UShort*)( -1 ) - enum - { - GX_PT_POINTS_ARE_WORDS = 0x80, - GX_PT_POINT_RUN_COUNT_MASK = 0x7F - }; +#define GX_PT_POINTS_ARE_WORDS 0x80 +#define GX_PT_POINT_RUN_COUNT_MASK 0x7F /*************************************************************************/ @@ -158,6 +154,9 @@ 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() ); @@ -166,11 +165,15 @@ { 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() ); } } + Exit: return points; } @@ -205,12 +208,12 @@ /* */ static FT_Short* ft_var_readpackeddeltas( FT_Stream stream, - FT_Int delta_cnt ) + FT_Offset delta_cnt ) { FT_Short *deltas; - FT_Int runcnt; - FT_Int i; - FT_Int j; + FT_UInt runcnt; + FT_Offset i; + FT_UInt j; FT_Memory memory = stream->memory; FT_Error error = TT_Err_Ok; @@ -337,7 +340,8 @@ } - typedef struct GX_GVar_Head_ { + typedef struct GX_GVar_Head_ + { FT_Long version; FT_UShort axisCount; FT_UShort globalCoordCount; @@ -564,7 +568,8 @@ /*************************************************************************/ - typedef struct GX_FVar_Head_ { + typedef struct GX_FVar_Head_ + { FT_Long version; FT_UShort offsetToData; FT_UShort countSizePairs; @@ -576,7 +581,8 @@ } GX_FVar_Head; - typedef struct fvar_axis { + typedef struct fvar_axis_ + { FT_ULong axisTag; FT_ULong minValue; FT_ULong defaultValue; @@ -754,7 +760,7 @@ } 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; @@ -902,13 +908,15 @@ } 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; + 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 */ @@ -1127,7 +1135,7 @@ 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; @@ -1135,7 +1143,7 @@ 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; @@ -1144,7 +1152,7 @@ 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; @@ -1159,7 +1167,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/truetype/ttgxvar.h b/lib/3rdparty/freetype/src/truetype/ttgxvar.h index 706cb4d369b..82dfc4431f2 100644 --- a/lib/3rdparty/freetype/src/truetype/ttgxvar.h +++ b/lib/3rdparty/freetype/src/truetype/ttgxvar.h @@ -84,7 +84,7 @@ FT_BEGIN_HEADER FT_Fixed* normalizedcoords; FT_MM_Var* mmvar; - FT_Int mmvar_len; + FT_Offset mmvar_len; FT_Bool avar_checked; GX_AVarSegment avar_segment; diff --git a/lib/3rdparty/freetype/src/truetype/ttinterp.c b/lib/3rdparty/freetype/src/truetype/ttinterp.c index 85c8529ac73..13aa9a27c4c 100644 --- a/lib/3rdparty/freetype/src/truetype/ttinterp.c +++ b/lib/3rdparty/freetype/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -693,7 +693,7 @@ /* exec :: A handle to the target execution context. */ /* */ /* */ - /* TrueTyoe error code. 0 means success. */ + /* TrueType error code. 0 means success. */ /* */ /* */ /* Only the glyph loader and debugger should call this function. */ @@ -748,6 +748,13 @@ } + /* 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, @@ -761,7 +768,7 @@ 1, 64, 1, TRUE, 68, 0, 0, 9, 3, - 0, FALSE, 2, 1, 1, 1 + 0, FALSE, 0, 1, 1, 1 }; @@ -784,9 +791,9 @@ /* 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; @@ -795,13 +802,10 @@ driver->context = exec; } - Exit: return driver->context; Fail: - FT_FREE( exec ); - - return 0; + return NULL; } @@ -2190,7 +2194,7 @@ 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 ); } @@ -2216,7 +2220,7 @@ 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 ); } @@ -4286,13 +4290,21 @@ 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->opc = n; + rec->opc = (FT_UInt16)n; 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. */ @@ -4549,13 +4561,20 @@ 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 ) - CUR.maxIns = args[0]; + CUR.maxIns = (FT_Byte)args[0]; /* Now skip the whole function definition. */ /* We don't allow nested IDEFs & FDEFs. */ @@ -4821,7 +4840,28 @@ 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; @@ -5071,12 +5111,8 @@ 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; -#endif if ( ( args[0] & 0x200 ) != 0 && CUR.tt_metrics.rotated ) CUR.GS.scan_control = TRUE; @@ -5084,10 +5120,8 @@ 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; -#endif if ( ( args[0] & 0x1000 ) != 0 && CUR.tt_metrics.rotated ) CUR.GS.scan_control = FALSE; @@ -5106,16 +5140,8 @@ 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]; - } } @@ -5428,7 +5454,7 @@ /* 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); @@ -5516,20 +5542,20 @@ { 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 = TT_MulFix14( args[0], 0x4000 ); + dy = TT_MulFix14( (FT_UInt32)args[0], 0x4000 ); } } 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 ) @@ -5695,8 +5721,8 @@ 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]; } @@ -5883,10 +5909,12 @@ 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 + - 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]; } @@ -6211,9 +6239,13 @@ 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 ); } @@ -6257,7 +6289,7 @@ /* Local variables for Ins_IUP: */ - typedef struct + typedef struct IUP_WorkerRec_ { FT_Vector* orgs; /* original and current coordinate */ FT_Vector* curs; /* arrays */ @@ -6370,7 +6402,7 @@ { scale_valid = 1; scale = TT_MULDIV( org2 + delta2 - ( org1 + delta1 ), - 0x10000, orus2 - orus1 ); + 0x10000L, orus2 - orus1 ); } x = ( org1 + delta1 ) + @@ -6434,6 +6466,9 @@ 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++; diff --git a/lib/3rdparty/freetype/src/truetype/ttobjs.c b/lib/3rdparty/freetype/src/truetype/ttobjs.c index 0294a1b7e66..11d662d2d49 100644 --- a/lib/3rdparty/freetype/src/truetype/ttobjs.c +++ b/lib/3rdparty/freetype/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -18,9 +18,7 @@ #include #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H #include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H @@ -144,6 +142,40 @@ #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; + } + + /*************************************************************************/ /* */ /* */ @@ -180,7 +212,7 @@ 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; @@ -206,7 +238,7 @@ } #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. */ @@ -218,29 +250,37 @@ 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; - if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE ) + if ( FT_IS_SCALABLE( ttface ) ) { #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_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 ) - 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 @@ -262,38 +302,8 @@ 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 ) - { - 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 && @@ -325,12 +335,18 @@ 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 ) @@ -595,18 +611,15 @@ /* 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++ ) - metrics2->compensations[i] = 0; + metrics->compensations[i] = 0; } /* allocate function defs, instruction defs, cvt, and storage area */ @@ -669,7 +682,7 @@ 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. */ @@ -694,8 +707,9 @@ error = tt_size_run_prep( size ); if ( !error ) - size->cvt_ready = 1; + size->cvt_ready = 1; } + Exit: return error; } diff --git a/lib/3rdparty/freetype/src/truetype/ttobjs.h b/lib/3rdparty/freetype/src/truetype/ttobjs.h index 6971013af90..30c8669cb2d 100644 --- a/lib/3rdparty/freetype/src/truetype/ttobjs.h +++ b/lib/3rdparty/freetype/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -99,6 +99,10 @@ FT_BEGIN_HEADER 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; @@ -190,45 +194,13 @@ FT_BEGIN_HEADER } 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 */ - /* 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 */ diff --git a/lib/3rdparty/freetype/src/truetype/ttpic.c b/lib/3rdparty/freetype/src/truetype/ttpic.c new file mode 100644 index 00000000000..27ec4a1d5e5 --- /dev/null +++ b/lib/3rdparty/freetype/src/truetype/ttpic.c @@ -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 +#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/lib/3rdparty/freetype/src/truetype/ttpic.h b/lib/3rdparty/freetype/src/truetype/ttpic.h new file mode 100644 index 00000000000..84de0fee9e3 --- /dev/null +++ b/lib/3rdparty/freetype/src/truetype/ttpic.h @@ -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 */ diff --git a/lib/3rdparty/freetype/src/truetype/ttpload.c b/lib/3rdparty/freetype/src/truetype/ttpload.c index 9d3381bf056..a311b03c00c 100644 --- a/lib/3rdparty/freetype/src/truetype/ttpload.c +++ b/lib/3rdparty/freetype/src/truetype/ttpload.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -58,18 +58,23 @@ /* */ /* 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_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 ); - 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 " )); @@ -82,23 +87,65 @@ if ( face->header.Index_To_Loc_Format != 0 ) { + shift = 2; + if ( table_len >= 0x40000L ) { - FT_TRACE2(( "table too large!\n" )); + FT_TRACE2(( "table too large\n" )); error = TT_Err_Invalid_Table; goto Exit; } - face->num_locations = (FT_UInt)( table_len >> 2 ); + face->num_locations = table_len >> shift; } else { + shift = 1; + if ( table_len >= 0x20000L ) { - FT_TRACE2(( "table too large!\n" )); + FT_TRACE2(( "table too large\n" )); 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 )); + } + } } /* @@ -156,12 +203,14 @@ } } - /* 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 @@ -216,7 +265,7 @@ 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; @@ -301,7 +350,7 @@ face->font_program_size = 0; error = TT_Err_Ok; - FT_TRACE2(( "is missing!\n" )); + FT_TRACE2(( "is missing\n" )); } else { @@ -362,7 +411,7 @@ face->cvt_program_size = 0; error = TT_Err_Ok; - FT_TRACE2(( "is missing!\n" )); + FT_TRACE2(( "is missing\n" )); } else { diff --git a/lib/3rdparty/freetype/src/type1/module.mk b/lib/3rdparty/freetype/src/type1/module.mk index baf98c00ea5..ade0210d76c 100644 --- a/lib/3rdparty/freetype/src/type1/module.mk +++ b/lib/3rdparty/freetype/src/type1/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/type1/t1afm.c b/lib/3rdparty/freetype/src/type1/t1afm.c index b81a8df83ab..ef343901a44 100644 --- a/lib/3rdparty/freetype/src/type1/t1afm.c +++ b/lib/3rdparty/freetype/src/type1/t1afm.c @@ -4,7 +4,7 @@ /* */ /* 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, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -50,13 +50,17 @@ /* 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; + /* PS string/name length must be < 16-bit */ + if ( len > 0xFFFFU ) + return 0; + for ( n = 0; n < type1->num_glyphs; n++ ) { char* gname = (char*)type1->glyph_names[n]; @@ -88,7 +92,12 @@ 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; } @@ -276,13 +285,15 @@ { t1_font->font_bbox = fi->FontBBox; - t1_face->bbox.xMin = fi->FontBBox.xMin >> 16; - t1_face->bbox.yMin = fi->FontBBox.yMin >> 16; - t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFFU ) >> 16; - t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFFU ) >> 16; + t1_face->bbox.xMin = fi->FontBBox.xMin >> 16; + t1_face->bbox.yMin = fi->FontBBox.yMin >> 16; + /* no `U' suffix here to 0xFFFF! */ + t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16; + t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 16; - t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000U ) >> 16 ); - t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000U ) >> 16 ); + /* no `U' suffix here to 0x8000! */ + t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000 ) >> 16 ); + t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 ); if ( fi->NumKernPair ) { diff --git a/lib/3rdparty/freetype/src/type1/t1driver.c b/lib/3rdparty/freetype/src/type1/t1driver.c index 3ca21dc1783..8c398eee228 100644 --- a/lib/3rdparty/freetype/src/type1/t1driver.c +++ b/lib/3rdparty/freetype/src/type1/t1driver.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -84,6 +84,7 @@ return 0; } + static const FT_Service_GlyphDictRec t1_service_glyph_dict = { (FT_GlyphDict_GetNameFunc) t1_get_glyph_name, @@ -91,10 +92,10 @@ }; - /* - * POSTSCRIPT NAME SERVICE - * - */ + /* + * POSTSCRIPT NAME SERVICE + * + */ static const char* t1_get_ps_name( T1_Face face ) @@ -102,16 +103,17 @@ return (const char*) face->type1.font_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 = @@ -125,17 +127,28 @@ #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; - 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; } @@ -143,6 +156,7 @@ t1_ps_has_glyph_names( FT_Face face ) { FT_UNUSED( face ); + return 1; } @@ -152,17 +166,20 @@ 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, + (PS_GetFontExtraFunc) t1_ps_get_font_extra, (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 = { @@ -170,10 +187,11 @@ }; #endif - /* - * SERVICE LIST - * - */ + + /* + * SERVICE LIST + * + */ static const FT_ServiceDescRec t1_services[] = { @@ -304,7 +322,7 @@ (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 }; diff --git a/lib/3rdparty/freetype/src/type1/t1driver.h b/lib/3rdparty/freetype/src/type1/t1driver.h index ad429440de9..9fecbeb0f8f 100644 --- a/lib/3rdparty/freetype/src/type1/t1driver.h +++ b/lib/3rdparty/freetype/src/type1/t1driver.h @@ -26,6 +26,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/type1/t1gload.c b/lib/3rdparty/freetype/src/type1/t1gload.c index e08a4289742..f3fad4f5df7 100644 --- a/lib/3rdparty/freetype/src/type1/t1gload.c +++ b/lib/3rdparty/freetype/src/type1/t1gload.c @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */ /* 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 #include "t1gload.h" +#include FT_INTERNAL_CALC_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_OUTLINE_H @@ -62,6 +63,11 @@ 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; @@ -70,10 +76,9 @@ /* 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 */ @@ -92,22 +97,22 @@ #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; - 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; - decoder->builder.advance.y = 0; + metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x ); + metrics.bearing_y = 0; + metrics.advance = FIXED_TO_INT( decoder->builder.advance.x ); + metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y ); + + 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.advance.x = INT_TO_FIXED( metrics.advance ); + decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v ); } #endif /* FT_CONFIG_OPTION_INCREMENTAL */ @@ -202,6 +207,63 @@ } + 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, @@ -225,7 +287,12 @@ #endif +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( glyph_index >= (FT_UInt)face->root.num_glyphs && + !face->root.internal->incremental_interface ) +#else if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ { error = T1_Err_Invalid_Argument; goto Exit; @@ -236,8 +303,16 @@ 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; @@ -303,11 +378,14 @@ 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 { @@ -317,14 +395,26 @@ /* 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 */ - metrics->vertAdvance = ( face->type1.font_bbox.yMax - - face->type1.font_bbox.yMin ) >> 16; - glyph->root.linearVertAdvance = metrics->vertAdvance; + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + { + /* make up vertical ones */ + metrics->vertAdvance = ( face->type1.font_bbox.yMax - + face->type1.font_bbox.yMin ) >> 16; + glyph->root.linearVertAdvance = metrics->vertAdvance; + } + else + { + metrics->vertAdvance = + FIXED_TO_INT( decoder.builder.advance.y ); + glyph->root.linearVertAdvance = + FIXED_TO_INT( decoder.builder.advance.y ); + } glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; @@ -371,8 +461,8 @@ } /* 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 */ @@ -384,9 +474,12 @@ metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; - /* make up vertical ones */ - ft_synthesize_vertical_metrics( metrics, - metrics->vertAdvance ); + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + { + /* make up vertical ones */ + ft_synthesize_vertical_metrics( metrics, + metrics->vertAdvance ); + } } /* Set control data to the glyph charstrings. Note that this is */ diff --git a/lib/3rdparty/freetype/src/type1/t1gload.h b/lib/3rdparty/freetype/src/type1/t1gload.h index de87896dc0e..100df06e8e3 100644 --- a/lib/3rdparty/freetype/src/type1/t1gload.h +++ b/lib/3rdparty/freetype/src/type1/t1gload.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -31,6 +31,13 @@ FT_BEGIN_HEADER 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, diff --git a/lib/3rdparty/freetype/src/type1/t1load.c b/lib/3rdparty/freetype/src/type1/t1load.c index 55177eed438..d867e942c95 100644 --- a/lib/3rdparty/freetype/src/type1/t1load.c +++ b/lib/3rdparty/freetype/src/type1/t1load.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -65,6 +65,7 @@ #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" @@ -213,10 +214,6 @@ } -#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 */ @@ -230,7 +227,7 @@ 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 ) { @@ -241,8 +238,7 @@ 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], @@ -250,7 +246,7 @@ } } - return axismap->design_points[axismap->num_points - 1]; + return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] ); } @@ -332,13 +328,13 @@ 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].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' ); @@ -348,16 +344,15 @@ 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 ) - 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; @@ -504,7 +499,7 @@ 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 ); } @@ -656,8 +651,8 @@ } 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; @@ -674,7 +669,7 @@ 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; @@ -687,6 +682,15 @@ 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 ) @@ -835,8 +839,8 @@ } 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; @@ -852,9 +856,9 @@ 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; } @@ -941,6 +945,12 @@ } 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; @@ -1130,7 +1140,7 @@ 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; } @@ -1265,6 +1275,19 @@ 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 { @@ -1310,9 +1333,9 @@ 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 ); @@ -1346,18 +1369,17 @@ 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; - /* 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; @@ -1397,7 +1419,10 @@ 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; @@ -1603,15 +1628,11 @@ } } - 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 ( 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 */ @@ -1680,7 +1701,7 @@ /* 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"; @@ -1718,7 +1739,7 @@ goto Fail; /* we added a glyph. */ - loader->num_glyphs = n + 1; + loader->num_glyphs += 1; } return; @@ -2132,7 +2153,7 @@ #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; } @@ -2161,8 +2182,8 @@ /* 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++ ) @@ -2188,25 +2209,14 @@ { if ( charcode < min_char ) min_char = charcode; - if ( charcode > max_char ) - max_char = charcode; + if ( charcode >= max_char ) + max_char = charcode + 1; } 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; diff --git a/lib/3rdparty/freetype/src/type1/t1objs.c b/lib/3rdparty/freetype/src/type1/t1objs.c index 3d08336c600..b1de6871967 100644 --- a/lib/3rdparty/freetype/src/type1/t1objs.c +++ b/lib/3rdparty/freetype/src/type1/t1objs.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -17,6 +17,7 @@ #include +#include FT_INTERNAL_CALC_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_Error error = 0; + FT_Error error = T1_Err_Ok; PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); @@ -191,72 +192,75 @@ 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 - /* 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 - /* 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 - /* 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 - /* release unicode map, if any */ + /* release unicode map, if any */ #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 - face->root.family_name = 0; - face->root.style_name = 0; - } + face->root.family_name = NULL; + face->root.style_name = NULL; } @@ -298,7 +302,6 @@ FT_UNUSED( num_params ); FT_UNUSED( params ); - FT_UNUSED( face_index ); FT_UNUSED( stream ); @@ -324,7 +327,7 @@ 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; @@ -341,7 +344,7 @@ 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 | @@ -356,11 +359,18 @@ /* 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; - /* 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; @@ -369,6 +379,9 @@ if ( full ) { + FT_Bool the_same = TRUE; + + while ( *full ) { if ( *full == *family ) @@ -384,12 +397,17 @@ family++; else { + the_same = FALSE; + if ( !*family ) root->style_name = full; break; } } } + + if ( the_same ) + root->style_name = (char *)"Regular"; } } else @@ -399,6 +417,15 @@ 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 ) @@ -414,10 +441,11 @@ root->num_fixed_sizes = 0; root->available_sizes = 0; - root->bbox.xMin = type1->font_bbox.xMin >> 16; - root->bbox.yMin = type1->font_bbox.yMin >> 16; - root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFFU ) >> 16; - root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFFU ) >> 16; + root->bbox.xMin = type1->font_bbox.xMin >> 16; + root->bbox.yMin = type1->font_bbox.yMin >> 16; + /* no `U' suffix here to 0xFFFF! */ + root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFF ) >> 16; + root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFF ) >> 16; /* Set units_per_EM if we didn't set it in parse_font_matrix. */ if ( !root->units_per_EM ) @@ -441,9 +469,9 @@ /* 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 - error = 0; /* clear error */ + error = T1_Err_Ok; /* clear error */ } root->max_advance_height = root->height; @@ -465,7 +493,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/type1/t1parse.c b/lib/3rdparty/freetype/src/type1/t1parse.c index 1b252c74833..2a762279fd3 100644 --- a/lib/3rdparty/freetype/src/type1/t1parse.c +++ b/lib/3rdparty/freetype/src/type1/t1parse.c @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -35,7 +35,6 @@ #include #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_POSTSCRIPT_AUX_H @@ -65,14 +64,16 @@ /*************************************************************************/ + /* see Adobe Technical Note 5040.Download_Fonts.pdf */ + 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_Long size; + FT_ULong size; *atag = 0; @@ -82,7 +83,7 @@ { if ( tag == 0x8001U || tag == 0x8002U ) { - if ( !FT_READ_LONG_LE( size ) ) + if ( !FT_READ_ULONG_LE( size ) ) *asize = size; } @@ -100,22 +101,25 @@ { FT_Error error; FT_UShort tag; - FT_Long size; + FT_ULong dummy; 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; + /* 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 ) ) { - error = 0; + error = T1_Err_Ok; if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 ) error = T1_Err_Unknown_File_Format; @@ -136,7 +140,7 @@ { FT_Error error; FT_UShort tag; - FT_Long size; + FT_ULong size; psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory ); @@ -170,19 +174,19 @@ /* 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. */ /* */ - /* 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. */ /* */ - /* 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; @@ -217,7 +221,7 @@ } 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; @@ -260,7 +264,7 @@ 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 ) @@ -293,13 +297,13 @@ /* 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; } - if ( FT_STREAM_SEEK( start_pos ) || + if ( FT_STREAM_SEEK( start_pos ) || FT_ALLOC( parser->private_dict, parser->private_len ) ) goto Fail; @@ -349,8 +353,8 @@ 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; } @@ -393,23 +397,26 @@ T1_Skip_PS_Token( parser ); cur = parser->root.cursor; - if ( *cur == '\r' ) - { - cur++; - if ( *cur == '\n' ) - cur++; - } - else if ( *cur == '\n' ) - cur++; - else + + /* according to the Type1 spec, the first cipher byte must not be */ + /* an ASCII whitespace character code (blank, tab, carriage return */ + /* or line feed). We have seen Type 1 fonts with two line feed */ + /* characters... So skip now all whitespace character codes. */ + while ( cur < limit && + ( *cur == ' ' || + *cur == '\t' || + *cur == '\r' || + *cur == '\n' ) ) + ++cur; + if ( cur >= limit ) { - 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; } - size = (FT_Long)( parser->base_len - ( cur - parser->base_dict ) ); + size = parser->base_len - ( cur - parser->base_dict ); if ( parser->in_memory ) { diff --git a/lib/3rdparty/freetype/src/type1/t1parse.h b/lib/3rdparty/freetype/src/type1/t1parse.h index 6fa4ca624a2..fb1c8a88308 100644 --- a/lib/3rdparty/freetype/src/type1/t1parse.h +++ b/lib/3rdparty/freetype/src/type1/t1parse.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -64,10 +64,10 @@ FT_BEGIN_HEADER FT_Stream stream; FT_Byte* base_dict; - FT_Long base_len; + FT_ULong base_len; FT_Byte* private_dict; - FT_Long private_len; + FT_ULong private_len; FT_Bool in_pfb; FT_Bool in_memory; diff --git a/lib/3rdparty/freetype/src/type1/t1tokens.h b/lib/3rdparty/freetype/src/type1/t1tokens.h index 788c811b049..2d692f0e619 100644 --- a/lib/3rdparty/freetype/src/type1/t1tokens.h +++ b/lib/3rdparty/freetype/src/type1/t1tokens.h @@ -4,7 +4,7 @@ /* */ /* 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, */ @@ -42,6 +42,13 @@ 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 @@ -87,7 +94,9 @@ 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 diff --git a/lib/3rdparty/freetype/src/type42/module.mk b/lib/3rdparty/freetype/src/type42/module.mk index 8bd40a5cc49..b3f10a8d3c8 100644 --- a/lib/3rdparty/freetype/src/type42/module.mk +++ b/lib/3rdparty/freetype/src/type42/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/type42/rules.mk b/lib/3rdparty/freetype/src/type42/rules.mk index 55630619554..eac1081eb1f 100644 --- a/lib/3rdparty/freetype/src/type42/rules.mk +++ b/lib/3rdparty/freetype/src/type42/rules.mk @@ -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, @@ -32,7 +32,8 @@ T42_DRV_SRC := $(T42_DIR)/t42objs.c \ # 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) diff --git a/lib/3rdparty/freetype/src/type42/t42drivr.c b/lib/3rdparty/freetype/src/type42/t42drivr.c index a6e4cf4b651..820c679612e 100644 --- a/lib/3rdparty/freetype/src/type42/t42drivr.c +++ b/lib/3rdparty/freetype/src/type42/t42drivr.c @@ -4,7 +4,7 @@ /* */ /* 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 */ @@ -49,11 +49,11 @@ #define FT_COMPONENT trace_t42 - /* - * - * GLYPH DICT SERVICE - * - */ + /* + * + * GLYPH DICT SERVICE + * + */ static FT_Error t42_get_glyph_name( T42_Face face, @@ -94,11 +94,11 @@ }; - /* - * - * POSTSCRIPT NAME SERVICE - * - */ + /* + * + * POSTSCRIPT NAME SERVICE + * + */ static const char* t42_get_ps_font_name( T42_Face face ) @@ -113,17 +113,28 @@ }; - /* - * - * 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; + + 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; } @@ -132,6 +143,7 @@ t42_ps_has_glyph_names( FT_Face face ) { FT_UNUSED( face ); + return 1; } @@ -141,6 +153,7 @@ PS_PrivateRec* afont_private ) { *afont_private = ((T42_Face)face)->type1.private_dict; + return T42_Err_Ok; } @@ -148,16 +161,17 @@ 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 }; - /* - * - * SERVICE LIST - * - */ + /* + * + * SERVICE LIST + * + */ static const FT_ServiceDescRec t42_services[] = { diff --git a/lib/3rdparty/freetype/src/type42/t42drivr.h b/lib/3rdparty/freetype/src/type42/t42drivr.h index 98b7410b670..4717e4613f3 100644 --- a/lib/3rdparty/freetype/src/type42/t42drivr.h +++ b/lib/3rdparty/freetype/src/type42/t42drivr.h @@ -25,6 +25,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/type42/t42objs.c b/lib/3rdparty/freetype/src/type42/t42objs.c index db04fde367a..9081ffc6d22 100644 --- a/lib/3rdparty/freetype/src/type42/t42objs.c +++ b/lib/3rdparty/freetype/src/type42/t42objs.c @@ -4,7 +4,8 @@ /* */ /* 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 */ @@ -19,7 +20,6 @@ #include "t42parse.h" #include "t42error.h" #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H #include FT_LIST_H @@ -70,7 +70,7 @@ 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; } @@ -100,8 +100,8 @@ /* 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++ ) @@ -127,13 +127,14 @@ { if ( charcode < min_char ) min_char = charcode; - if ( charcode > max_char ) - max_char = charcode; + if ( charcode >= max_char ) + max_char = charcode + 1; } break; } } } + type1->encoding.code_first = min_char; type1->encoding.code_last = max_char; type1->encoding.num_chars = loader.num_chars; @@ -188,7 +189,7 @@ 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; @@ -202,7 +203,7 @@ 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 | @@ -328,7 +329,7 @@ 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; @@ -392,50 +393,50 @@ 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 - /* 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 - /* 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; } @@ -519,7 +520,7 @@ 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; diff --git a/lib/3rdparty/freetype/src/type42/t42parse.c b/lib/3rdparty/freetype/src/type42/t42parse.c index 7148379644f..13bda64c837 100644 --- a/lib/3rdparty/freetype/src/type42/t42parse.c +++ b/lib/3rdparty/freetype/src/type42/t42parse.c @@ -4,7 +4,8 @@ /* */ /* 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 */ @@ -19,7 +20,6 @@ #include "t42error.h" #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H -#include FT_LIST_H #include FT_INTERNAL_POSTSCRIPT_AUX_H @@ -69,6 +69,13 @@ 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 @@ -296,7 +303,7 @@ 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; } @@ -464,14 +471,14 @@ 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; } } } - typedef enum + typedef enum T42_Load_Status_ { BEFORE_START, BEFORE_TABLE_DIR, @@ -517,7 +524,7 @@ 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; } @@ -562,7 +569,7 @@ 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; } @@ -578,7 +585,7 @@ 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; } @@ -586,7 +593,7 @@ 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; } @@ -597,7 +604,7 @@ 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; } @@ -662,7 +669,7 @@ /* 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; } @@ -709,7 +716,7 @@ 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; } @@ -751,14 +758,14 @@ } 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 ) { - 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; } @@ -818,7 +825,7 @@ 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; } @@ -849,7 +856,7 @@ (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; } @@ -872,7 +879,7 @@ 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; } @@ -976,6 +983,10 @@ 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; diff --git a/lib/3rdparty/freetype/src/type42/t42types.h b/lib/3rdparty/freetype/src/type42/t42types.h index 6626b04458a..c7c2db490df 100644 --- a/lib/3rdparty/freetype/src/type42/t42types.h +++ b/lib/3rdparty/freetype/src/type42/t42types.h @@ -4,7 +4,7 @@ /* */ /* 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 */ @@ -35,7 +35,9 @@ FT_BEGIN_HEADER T1_FontRec type1; const void* psnames; const void* psaux; +#if 0 const void* afm_data; +#endif FT_Byte* ttf_data; FT_ULong ttf_size; FT_Face ttf_face; @@ -48,7 +50,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* __T1TYPES_H__ */ +#endif /* __T42TYPES_H__ */ /* END */ diff --git a/lib/3rdparty/freetype/src/winfonts/module.mk b/lib/3rdparty/freetype/src/winfonts/module.mk index 0ace3ae6de0..b44d7f0570a 100644 --- a/lib/3rdparty/freetype/src/winfonts/module.mk +++ b/lib/3rdparty/freetype/src/winfonts/module.mk @@ -16,7 +16,7 @@ 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 diff --git a/lib/3rdparty/freetype/src/winfonts/winfnt.c b/lib/3rdparty/freetype/src/winfonts/winfnt.c index 4aa974410f3..6b3a4e17f20 100644 --- a/lib/3rdparty/freetype/src/winfonts/winfnt.c +++ b/lib/3rdparty/freetype/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ /* */ /* 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 */ @@ -342,7 +342,7 @@ 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; } @@ -360,9 +360,11 @@ if ( face_index >= font_count ) { - error = FNT_Err_Bad_Argument; + error = FNT_Err_Invalid_Argument; goto Exit; } + else if ( face_index < 0 ) + goto Exit; if ( FT_NEW( face->font ) ) goto Exit; @@ -564,7 +566,7 @@ if ( face_index >= face->root.num_faces ) { - error = FNT_Err_Bad_Argument; + error = FNT_Err_Invalid_Argument; goto Exit; } } @@ -610,13 +612,14 @@ 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; } - static FT_UInt + static FT_UInt32 fnt_cmap_char_next( FNT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -636,7 +639,7 @@ if ( char_code < cmap->count ) { result = cmap->first + char_code; - gindex = char_code + 1; + gindex = (FT_UInt)( char_code + 1 ); } } @@ -652,7 +655,9 @@ (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; @@ -661,16 +666,18 @@ 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; } @@ -690,18 +697,14 @@ /* 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 ( face_index > 0 ) - { - error = FNT_Err_Bad_Argument; - goto Exit; - } - if ( FT_NEW( face->font ) ) goto Exit; @@ -712,6 +715,14 @@ 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 ) @@ -725,6 +736,8 @@ FT_PtrDist family_size; + root->face_index = face_index; + root->face_flags = FT_FACE_FLAG_FIXED_SIZES | FT_FACE_FLAG_HORIZONTAL; @@ -772,7 +785,7 @@ * => 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" )); @@ -820,7 +833,7 @@ 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; } @@ -901,7 +914,7 @@ 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; @@ -967,7 +980,7 @@ 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; } diff --git a/lib/3rdparty/freetype/src/winfonts/winfnt.h b/lib/3rdparty/freetype/src/winfonts/winfnt.h index ca75c9501a2..70a90861abf 100644 --- a/lib/3rdparty/freetype/src/winfonts/winfnt.h +++ b/lib/3rdparty/freetype/src/winfonts/winfnt.h @@ -28,6 +28,10 @@ FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_PIC +#error "this module does not support PIC yet" +#endif + typedef struct WinMZ_HeaderRec_ { FT_UShort magic; diff --git a/subsystems/win32/csrss/win32csr/conio.c b/subsystems/win32/csrss/win32csr/conio.c index 60b93cf9b3f..51e320fdcef 100644 --- a/subsystems/win32/csrss/win32csr/conio.c +++ b/subsystems/win32/csrss/win32csr/conio.c @@ -849,6 +849,15 @@ CSR_API(CsrWriteConsole) } Console = Buff->Header.Console; + if (Console->UnpauseEvent) + { + Status = NtDuplicateObject(GetCurrentProcess(), Console->UnpauseEvent, + ProcessData->Process, &Request->Data.WriteConsoleRequest.UnpauseEvent, + SYNCHRONIZE, 0, 0); + ConioUnlockScreenBuffer(Buff); + return NT_SUCCESS(Status) ? STATUS_PENDING : Status; + } + if(Request->Data.WriteConsoleRequest.Unicode) { Length = WideCharToMultiByte(Console->OutputCodePage, 0, @@ -953,6 +962,7 @@ ConioDeleteConsole(Object_t *Object) } CloseHandle(Console->ActiveEvent); + if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent); DeleteCriticalSection(&Console->Lock); RtlFreeUnicodeString(&Console->Title); IntDeleteAllAliases(Console->Aliases); @@ -967,6 +977,26 @@ CsrInitConsoleSupport(VOID) /* Should call LoadKeyboardLayout */ } +VOID FASTCALL +ConioPause(PCSRSS_CONSOLE Console, UINT Flags) +{ + Console->PauseFlags |= Flags; + if (!Console->UnpauseEvent) + Console->UnpauseEvent = CreateEvent(NULL, TRUE, FALSE, NULL); +} + +VOID FASTCALL +ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags) +{ + Console->PauseFlags &= ~Flags; + if (Console->PauseFlags == 0 && Console->UnpauseEvent) + { + SetEvent(Console->UnpauseEvent); + CloseHandle(Console->UnpauseEvent); + Console->UnpauseEvent = NULL; + } +} + static VOID FASTCALL ConioProcessChar(PCSRSS_CONSOLE Console, ConsoleInput *KeyEventRecord) @@ -974,6 +1004,35 @@ ConioProcessChar(PCSRSS_CONSOLE Console, BOOL updown; ConsoleInput *TempInput; + if (KeyEventRecord->InputEvent.EventType == KEY_EVENT && + KeyEventRecord->InputEvent.Event.KeyEvent.bKeyDown) + { + WORD vk = KeyEventRecord->InputEvent.Event.KeyEvent.wVirtualKeyCode; + if (!(Console->PauseFlags & PAUSED_FROM_KEYBOARD)) + { + DWORD cks = KeyEventRecord->InputEvent.Event.KeyEvent.dwControlKeyState; + if (Console->Mode & ENABLE_LINE_INPUT && + (vk == VK_PAUSE || (vk == 'S' && + (cks & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) && + !(cks & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED))))) + { + ConioPause(Console, PAUSED_FROM_KEYBOARD); + HeapFree(Win32CsrApiHeap, 0, KeyEventRecord); + return; + } + } + else + { + if ((vk < VK_SHIFT || vk > VK_CAPITAL) && vk != VK_LWIN && + vk != VK_RWIN && vk != VK_NUMLOCK && vk != VK_SCROLL) + { + ConioUnpause(Console, PAUSED_FROM_KEYBOARD); + HeapFree(Win32CsrApiHeap, 0, KeyEventRecord); + return; + } + } + } + if (0 != (Console->Mode & (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT))) { switch(KeyEventRecord->InputEvent.Event.KeyEvent.uChar.AsciiChar) diff --git a/subsystems/win32/csrss/win32csr/conio.h b/subsystems/win32/csrss/win32csr/conio.h index 8645351f96a..9b0c6905ce8 100644 --- a/subsystems/win32/csrss/win32csr/conio.h +++ b/subsystems/win32/csrss/win32csr/conio.h @@ -93,6 +93,8 @@ typedef struct tagCSRSS_CONSOLE LIST_ENTRY ProcessList; struct tagALIAS_HEADER *Aliases; CONSOLE_SELECTION_INFO Selection; + BYTE PauseFlags; + HANDLE UnpauseEvent; } CSRSS_CONSOLE; typedef struct ConsoleInput_t @@ -111,10 +113,17 @@ typedef struct ConsoleInput_t #define CONSOLE_MOUSE_SELECTION 0x4 #define CONSOLE_MOUSE_DOWN 0x8 +/* PauseFlags values (internal only) */ +#define PAUSED_FROM_KEYBOARD 0x1 +#define PAUSED_FROM_SCROLLBAR 0x2 +#define PAUSED_FROM_SELECTION 0x4 + NTSTATUS FASTCALL ConioConsoleFromProcessData(PCSRSS_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Console); VOID WINAPI ConioDeleteConsole(Object_t *Object); VOID WINAPI ConioDeleteScreenBuffer(PCSRSS_SCREEN_BUFFER Buffer); VOID WINAPI CsrInitConsoleSupport(VOID); +VOID FASTCALL ConioPause(PCSRSS_CONSOLE Console, UINT Flags); +VOID FASTCALL ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags); void WINAPI ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode); PBYTE FASTCALL ConioCoordToPointer(PCSRSS_SCREEN_BUFFER Buf, ULONG X, ULONG Y); VOID FASTCALL ConioDrawConsole(PCSRSS_CONSOLE Console); diff --git a/subsystems/win32/csrss/win32csr/guiconsole.c b/subsystems/win32/csrss/win32csr/guiconsole.c index b89edbd304e..5398fd40a4e 100644 --- a/subsystems/win32/csrss/win32csr/guiconsole.c +++ b/subsystems/win32/csrss/win32csr/guiconsole.c @@ -844,6 +844,7 @@ GuiConsoleUpdateSelection(PCSRSS_CONSOLE Console, PCOORD coord) } Console->Selection.dwFlags |= CONSOLE_SELECTION_NOT_EMPTY; Console->Selection.srSelection = rc; + ConioPause(Console, PAUSED_FROM_SELECTION); } else { @@ -853,6 +854,7 @@ GuiConsoleUpdateSelection(PCSRSS_CONSOLE Console, PCOORD coord) InvalidateRect(hWnd, &oldRect, FALSE); } Console->Selection.dwFlags = CONSOLE_NO_SELECTION; + ConioUnpause(Console, PAUSED_FROM_SELECTION); } } @@ -1803,6 +1805,11 @@ GuiConsoleHandleScroll(HWND hwnd, UINT uMsg, WPARAM wParam) case SB_THUMBTRACK: sInfo.nPos = sInfo.nTrackPos; + ConioPause(Console, PAUSED_FROM_SCROLLBAR); + break; + + case SB_THUMBPOSITION: + ConioUnpause(Console, PAUSED_FROM_SCROLLBAR); break; case SB_TOP: diff --git a/subsystems/win32/win32k/include/timer.h b/subsystems/win32/win32k/include/timer.h index a41b8c30dbe..8e5bce67c15 100644 --- a/subsystems/win32/win32k/include/timer.h +++ b/subsystems/win32/win32k/include/timer.h @@ -29,6 +29,7 @@ extern PKTIMER MasterTimer; NTSTATUS FASTCALL InitTimerImpl(VOID); BOOL FASTCALL DestroyTimersForThread(PTHREADINFO pti); +BOOL FASTCALL DestroyTimersForWindow(PTHREADINFO pti, PWINDOW_OBJECT Window); BOOL FASTCALL IntKillTimer(PWINDOW_OBJECT Window, UINT_PTR IDEvent, BOOL SystemTimer); UINT_PTR FASTCALL IntSetTimer(PWINDOW_OBJECT Window, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, INT Type); PTIMER FASTCALL FindSystemTimer(PMSG); diff --git a/subsystems/win32/win32k/main/dllmain.c b/subsystems/win32/win32k/main/dllmain.c index 83a3f840612..234dedc52e1 100644 --- a/subsystems/win32/win32k/main/dllmain.c +++ b/subsystems/win32/win32k/main/dllmain.c @@ -290,6 +290,7 @@ Win32kThreadCallback(struct _ETHREAD *Thread, HOOK_DestroyThreadHooks(Thread); /* Cleanup timers */ DestroyTimersForThread(Win32Thread); + KeSetEvent(Win32Thread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); UnregisterThreadHotKeys(Thread); /* what if this co_ func crash in umode? what will clean us up then? */ co_DestroyThreadWindows(Thread); diff --git a/subsystems/win32/win32k/ntuser/defwnd.c b/subsystems/win32/win32k/ntuser/defwnd.c index f5e2bd1fc1d..6cf4fd010c6 100644 --- a/subsystems/win32/win32k/ntuser/defwnd.c +++ b/subsystems/win32/win32k/ntuser/defwnd.c @@ -67,7 +67,7 @@ IntClientShutdown( co_IntSendMessage(WndChild->hSelf, WM_ENDSESSION, KillTimers, lParams); if (KillTimers) { - MsqRemoveTimersWindow(WndChild->pti->MessageQueue, WndChild->hSelf); + DestroyTimersForWindow(WndChild->pti, WndChild); } lResult = MCSR_SHUTDOWNFINISHED; } @@ -90,7 +90,7 @@ IntClientShutdown( co_IntSendMessage(pWindow->hSelf, WM_ENDSESSION, KillTimers, lParams); if (KillTimers) { - MsqRemoveTimersWindow(pWindow->pti->MessageQueue, pWindow->hSelf); + DestroyTimersForWindow(pWindow->pti, pWindow); } lResult = MCSR_SHUTDOWNFINISHED; } diff --git a/subsystems/win32/win32k/ntuser/msgqueue.c b/subsystems/win32/win32k/ntuser/msgqueue.c index e71de5475d7..fe1d9a80af7 100644 --- a/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/subsystems/win32/win32k/ntuser/msgqueue.c @@ -1366,19 +1366,8 @@ co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT WndFil UINT MsgFilterMin, UINT MsgFilterMax) { PVOID WaitObjects[2] = {MessageQueue->NewMessages, &HardwareMessageEvent}; - LARGE_INTEGER TimerExpiry; - PLARGE_INTEGER Timeout; NTSTATUS ret; - if (MsqGetFirstTimerExpiry(MessageQueue, WndFilter, MsgFilterMin, MsgFilterMax, &TimerExpiry)) - { - Timeout = &TimerExpiry; - } - else - { - Timeout = NULL; - } - IdlePing(); // Going to wait so send Idle ping. UserLeaveCo(); @@ -1389,11 +1378,9 @@ co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT WndFil Executive, UserMode, FALSE, - Timeout, + NULL, NULL); - UserEnterCo(); - return ret; } diff --git a/subsystems/win32/win32k/ntuser/timer.c b/subsystems/win32/win32k/ntuser/timer.c index 2d7b8d003d7..e178241f1ea 100644 --- a/subsystems/win32/win32k/ntuser/timer.c +++ b/subsystems/win32/win32k/ntuser/timer.c @@ -216,7 +216,7 @@ IntSetTimer( PWINDOW_OBJECT Window, } pTmr = FindTimer(Window, IDEvent, Type, FALSE); - if (!pTmr) + if ((!pTmr) || (pTmr->flags & TMRF_DELETEPENDING)) { pTmr = CreateTimer(); if (!pTmr) return 0; @@ -240,10 +240,6 @@ IntSetTimer( PWINDOW_OBJECT Window, pTmr->cmsCountdown = Elapse; pTmr->cmsRate = Elapse; - if (pTmr->flags & TMRF_DELETEPENDING) - { - pTmr->flags &= ~TMRF_DELETEPENDING; - } ASSERT(MasterTimer != NULL); // Start the timer thread! @@ -342,6 +338,7 @@ ProcessTimers(VOID) LONG Time; PLIST_ENTRY pLE; PTIMER pTmr = FirstpTmr; + LONG TimerCount = 0; if (!pTmr) return; @@ -354,6 +351,7 @@ ProcessTimers(VOID) do { + TimerCount++; if (pTmr->flags & TMRF_WAITING) { pLE = pTmr->ptmrList.Flink; @@ -426,6 +424,7 @@ ProcessTimers(VOID) TimeLast = Time; UserLeave(); + DPRINT("TimerCount = %d\n", TimerCount); } // @@ -524,6 +523,35 @@ if (Ret == 0) ASSERT(FALSE); return Ret; } +BOOL FASTCALL +DestroyTimersForWindow(PTHREADINFO pti, PWINDOW_OBJECT Window) +{ + PLIST_ENTRY pLE; + PTIMER pTmr = FirstpTmr; + BOOL TimersRemoved = FALSE; + + if ((FirstpTmr == NULL) || (Window == NULL)) + return FALSE; + + KeEnterCriticalRegion(); + + do + { + if ((pTmr) && (pTmr->pti == pti) && (pTmr->pWnd == Window)) + { + pTmr->flags &= ~TMRF_READY; + pTmr->flags |= TMRF_DELETEPENDING; + TimersRemoved = TRUE; + } + pLE = pTmr->ptmrList.Flink; + pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList); + } while (pTmr != FirstpTmr); + + KeLeaveCriticalRegion(); + + return TimersRemoved; +} + BOOL FASTCALL DestroyTimersForThread(PTHREADINFO pti) { @@ -553,7 +581,6 @@ DestroyTimersForThread(PTHREADINFO pti) return TimersRemoved; } - BOOL FASTCALL IntKillTimer(PWINDOW_OBJECT Window, UINT_PTR IDEvent, BOOL SystemTimer) { @@ -568,7 +595,6 @@ IntKillTimer(PWINDOW_OBJECT Window, UINT_PTR IDEvent, BOOL SystemTimer) return pTmr ? TRUE : FALSE; } - // // // Old Kill Timer diff --git a/subsystems/win32/win32k/ntuser/window.c b/subsystems/win32/win32k/ntuser/window.c index ca58a3c9369..6c17e8cb931 100644 --- a/subsystems/win32/win32k/ntuser/window.c +++ b/subsystems/win32/win32k/ntuser/window.c @@ -424,7 +424,7 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window, if(BelongsToThreadData) co_IntSendMessage(Window->hSelf, WM_NCDESTROY, 0, 0); } - MsqRemoveTimersWindow(ThreadData->MessageQueue, Window->hSelf); + DestroyTimersForWindow(ThreadData, Window); HOOK_DestroyThreadHooks(ThreadData->pEThread); // This is needed here too! /* flush the message queue */ @@ -2228,9 +2228,6 @@ AllocErr: if (Size.cy < MinTrack.y) Size.cy = MinTrack.y; } - if (Size.cx < 0) Size.cx = 0; - if (Size.cy < 0) Size.cy = 0; - Wnd->rcWindow.left = Pos.x; Wnd->rcWindow.top = Pos.y; Wnd->rcWindow.right = Pos.x + Size.cx; -- 2.17.1