From b7443856522313177e2f3ff5d056d5519b4fcc75 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Thu, 18 Jan 2018 13:34:21 +0100 Subject: [PATCH] [FREETYPE] Update to v2.9.0 and use this as a chance to slim down our lib a bit. CORE-14220 --- media/doc/3rd Party Files.txt | 2 +- sdk/lib/3rdparty/freetype/CMakeLists.txt | 8 +- sdk/lib/3rdparty/freetype/ChangeLog | 3903 ++++++++--------- sdk/lib/3rdparty/freetype/README | 20 +- sdk/lib/3rdparty/freetype/autogen.sh | 2 +- sdk/lib/3rdparty/freetype/configure | 2 +- sdk/lib/3rdparty/freetype/devel/ft2build.h | 2 +- sdk/lib/3rdparty/freetype/devel/ftoption.h | 58 +- .../include/freetype/config/ftconfig.h | 99 +- .../include/freetype/config/ftheader.h | 128 +- .../include/freetype/config/ftoption.h | 89 +- .../include/freetype/config/ftstdlib.h | 2 +- .../freetype/include/freetype/freetype.h | 245 +- .../freetype/include/freetype/ftadvanc.h | 2 +- .../freetype/include/freetype/ftautoh.h | 533 --- .../freetype/include/freetype/ftbbox.h | 4 +- .../freetype/include/freetype/ftbdf.h | 2 +- .../freetype/include/freetype/ftbitmap.h | 4 +- .../freetype/include/freetype/ftbzip2.h | 2 +- .../freetype/include/freetype/ftcache.h | 17 +- .../freetype/include/freetype/ftcffdrv.h | 321 -- .../freetype/include/freetype/ftchapters.h | 3 + .../freetype/include/freetype/ftcid.h | 4 +- .../freetype/include/freetype/ftdriver.h | 1225 ++++++ .../freetype/include/freetype/fterrdef.h | 2 +- .../freetype/include/freetype/fterrors.h | 2 +- .../freetype/include/freetype/ftfntfmt.h | 2 +- .../freetype/include/freetype/ftgasp.h | 2 +- .../freetype/include/freetype/ftglyph.h | 6 +- .../freetype/include/freetype/ftgxval.h | 10 +- .../freetype/include/freetype/ftgzip.h | 5 +- .../freetype/include/freetype/ftimage.h | 36 +- .../freetype/include/freetype/ftincrem.h | 15 +- .../freetype/include/freetype/ftlcdfil.h | 23 +- .../freetype/include/freetype/ftlist.h | 2 +- .../freetype/include/freetype/ftlzw.h | 2 +- .../freetype/include/freetype/ftmac.h | 2 +- .../3rdparty/freetype/include/freetype/ftmm.h | 110 +- .../freetype/include/freetype/ftmodapi.h | 23 +- .../freetype/include/freetype/ftmoderr.h | 2 +- .../freetype/include/freetype/ftotval.h | 2 +- .../freetype/include/freetype/ftoutln.h | 11 +- .../freetype/include/freetype/ftparams.h | 205 + .../freetype/include/freetype/ftpcfdrv.h | 105 - .../freetype/include/freetype/ftpfr.h | 2 +- .../freetype/include/freetype/ftrender.h | 4 +- .../freetype/include/freetype/ftsizes.h | 2 +- .../freetype/include/freetype/ftsnames.h | 50 +- .../freetype/include/freetype/ftstroke.h | 12 +- .../freetype/include/freetype/ftsynth.h | 2 +- .../freetype/include/freetype/ftsystem.h | 2 +- .../freetype/include/freetype/fttrigon.h | 2 +- .../freetype/include/freetype/ftttdrv.h | 328 -- .../freetype/include/freetype/fttypes.h | 4 +- .../freetype/include/freetype/ftwinfnt.h | 4 +- .../include/freetype/internal/autohint.h | 2 +- .../include/freetype/internal/cffotypes.h | 108 + .../freetype/internal}/cfftypes.h | 9 +- .../include/freetype/internal/ftcalc.h | 2 +- .../include/freetype/internal/ftdebug.h | 2 +- .../freetype/internal/{ftdriver.h => ftdrv.h} | 12 +- .../include/freetype/internal/ftgloadr.h | 2 +- .../include/freetype/internal/ftmemory.h | 4 +- .../include/freetype/internal/ftobjs.h | 83 +- .../include/freetype/internal/ftpic.h | 2 +- .../include/freetype/internal/ftpsprop.h | 48 + .../include/freetype/internal/ftrfork.h | 2 +- .../include/freetype/internal/ftserv.h | 103 +- .../include/freetype/internal/ftstream.h | 6 +- .../include/freetype/internal/fttrace.h | 9 +- .../include/freetype/internal/ftvalid.h | 2 +- .../include/freetype/internal/internal.h | 8 +- .../include/freetype/internal/psaux.h | 501 ++- .../include/freetype/internal/pshints.h | 2 +- .../freetype/internal/services/svbdf.h | 2 +- .../freetype/internal/services/svcfftl.h | 112 + .../freetype/internal/services/svcid.h | 2 +- .../freetype/internal/services/svfntfmt.h | 2 +- .../freetype/internal/services/svgldict.h | 6 +- .../freetype/internal/services/svgxval.h | 2 +- .../freetype/internal/services/svkern.h | 2 +- .../freetype/internal/services/svmetric.h | 2 +- .../include/freetype/internal/services/svmm.h | 57 +- .../freetype/internal/services/svotval.h | 2 +- .../freetype/internal/services/svpfr.h | 2 +- .../freetype/internal/services/svpostnm.h | 2 +- .../freetype/internal/services/svprop.h | 2 +- .../freetype/internal/services/svpscmap.h | 2 +- .../freetype/internal/services/svpsinfo.h | 2 +- .../freetype/internal/services/svsfnt.h | 2 +- .../freetype/internal/services/svttcmap.h | 2 +- .../freetype/internal/services/svtteng.h | 2 +- .../freetype/internal/services/svttglyf.h | 2 +- .../freetype/internal/services/svwinfnt.h | 2 +- .../freetype/include/freetype/internal/sfnt.h | 2 +- .../include/freetype/internal/t1types.h | 2 +- .../include/freetype/internal/tttypes.h | 12 +- .../freetype/include/freetype/t1tables.h | 11 +- .../freetype/include/freetype/ttnameid.h | 4 +- .../freetype/include/freetype/tttables.h | 2 +- .../freetype/include/freetype/tttags.h | 2 +- .../freetype/include/freetype/ttunpat.h | 63 - sdk/lib/3rdparty/freetype/include/ft2build.h | 2 +- sdk/lib/3rdparty/freetype/modules.cfg | 4 +- .../3rdparty/freetype/src/autofit/afangles.c | 2 +- .../3rdparty/freetype/src/autofit/afblue.c | 2 +- .../3rdparty/freetype/src/autofit/afblue.cin | 2 +- .../3rdparty/freetype/src/autofit/afblue.dat | 2 +- .../3rdparty/freetype/src/autofit/afblue.h | 2 +- .../3rdparty/freetype/src/autofit/afblue.hin | 2 +- sdk/lib/3rdparty/freetype/src/autofit/afcjk.c | 6 +- sdk/lib/3rdparty/freetype/src/autofit/afcjk.h | 2 +- .../3rdparty/freetype/src/autofit/afcover.h | 2 +- .../3rdparty/freetype/src/autofit/afdummy.c | 2 +- .../3rdparty/freetype/src/autofit/afdummy.h | 2 +- .../3rdparty/freetype/src/autofit/aferrors.h | 2 +- .../3rdparty/freetype/src/autofit/afglobal.c | 2 +- .../3rdparty/freetype/src/autofit/afglobal.h | 2 +- .../3rdparty/freetype/src/autofit/afhints.c | 15 +- .../3rdparty/freetype/src/autofit/afhints.h | 4 +- .../3rdparty/freetype/src/autofit/afindic.c | 2 +- .../3rdparty/freetype/src/autofit/afindic.h | 2 +- .../3rdparty/freetype/src/autofit/aflatin.c | 2 +- .../3rdparty/freetype/src/autofit/aflatin.h | 2 +- .../3rdparty/freetype/src/autofit/aflatin2.c | 2 +- .../3rdparty/freetype/src/autofit/aflatin2.h | 2 +- .../3rdparty/freetype/src/autofit/afloader.c | 2 +- .../3rdparty/freetype/src/autofit/afloader.h | 2 +- .../3rdparty/freetype/src/autofit/afmodule.c | 4 +- .../3rdparty/freetype/src/autofit/afmodule.h | 2 +- sdk/lib/3rdparty/freetype/src/autofit/afpic.c | 2 +- sdk/lib/3rdparty/freetype/src/autofit/afpic.h | 2 +- .../3rdparty/freetype/src/autofit/afranges.c | 2 +- .../3rdparty/freetype/src/autofit/afranges.h | 2 +- .../3rdparty/freetype/src/autofit/afscript.h | 2 +- .../3rdparty/freetype/src/autofit/afshaper.c | 33 +- .../3rdparty/freetype/src/autofit/afshaper.h | 2 +- .../3rdparty/freetype/src/autofit/afstyles.h | 2 +- .../3rdparty/freetype/src/autofit/aftypes.h | 2 +- .../3rdparty/freetype/src/autofit/afwarp.c | 2 +- .../3rdparty/freetype/src/autofit/afwarp.h | 2 +- .../3rdparty/freetype/src/autofit/afwrtsys.h | 2 +- .../3rdparty/freetype/src/autofit/autofit.c | 2 +- sdk/lib/3rdparty/freetype/src/base/basepic.c | 2 +- sdk/lib/3rdparty/freetype/src/base/basepic.h | 2 +- sdk/lib/3rdparty/freetype/src/base/ftadvanc.c | 16 +- sdk/lib/3rdparty/freetype/src/base/ftapi.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftbase.c | 3 +- sdk/lib/3rdparty/freetype/src/base/ftbase.h | 8 +- sdk/lib/3rdparty/freetype/src/base/ftbbox.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftbdf.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftbitmap.c | 75 +- sdk/lib/3rdparty/freetype/src/base/ftcalc.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftcid.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftdbgmem.c | 10 +- sdk/lib/3rdparty/freetype/src/base/ftdebug.c | 4 +- sdk/lib/3rdparty/freetype/src/base/ftfntfmt.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftfstype.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftgasp.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftgloadr.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftglyph.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftgxval.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftinit.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftlcdfil.c | 55 +- sdk/lib/3rdparty/freetype/src/base/ftmac.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftmm.c | 81 +- sdk/lib/3rdparty/freetype/src/base/ftobjs.c | 472 +- sdk/lib/3rdparty/freetype/src/base/ftotval.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftoutln.c | 6 +- sdk/lib/3rdparty/freetype/src/base/ftpatent.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftpfr.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftpic.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftpsprop.c | 285 ++ sdk/lib/3rdparty/freetype/src/base/ftrfork.c | 4 +- sdk/lib/3rdparty/freetype/src/base/ftsnames.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftstream.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftstroke.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftsynth.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftsystem.c | 2 +- sdk/lib/3rdparty/freetype/src/base/fttrigon.c | 2 +- sdk/lib/3rdparty/freetype/src/base/fttype1.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftutil.c | 2 +- sdk/lib/3rdparty/freetype/src/base/ftwinfnt.c | 2 +- sdk/lib/3rdparty/freetype/src/bdf/README | 2 +- sdk/lib/3rdparty/freetype/src/bdf/bdfdrivr.c | 2 +- sdk/lib/3rdparty/freetype/src/bdf/bdflib.c | 12 +- sdk/lib/3rdparty/freetype/src/bzip2/ftbzip2.c | 2 +- sdk/lib/3rdparty/freetype/src/cache/ftcache.c | 2 +- .../3rdparty/freetype/src/cache/ftcbasic.c | 2 +- .../3rdparty/freetype/src/cache/ftccache.c | 2 +- .../3rdparty/freetype/src/cache/ftccache.h | 2 +- .../3rdparty/freetype/src/cache/ftccback.h | 2 +- sdk/lib/3rdparty/freetype/src/cache/ftccmap.c | 2 +- .../3rdparty/freetype/src/cache/ftcerror.h | 2 +- .../3rdparty/freetype/src/cache/ftcglyph.c | 2 +- .../3rdparty/freetype/src/cache/ftcglyph.h | 2 +- .../3rdparty/freetype/src/cache/ftcimage.c | 2 +- .../3rdparty/freetype/src/cache/ftcimage.h | 2 +- .../3rdparty/freetype/src/cache/ftcmanag.c | 2 +- .../3rdparty/freetype/src/cache/ftcmanag.h | 2 +- sdk/lib/3rdparty/freetype/src/cache/ftcmru.c | 2 +- sdk/lib/3rdparty/freetype/src/cache/ftcmru.h | 2 +- .../3rdparty/freetype/src/cache/ftcsbits.c | 2 +- .../3rdparty/freetype/src/cache/ftcsbits.h | 2 +- sdk/lib/3rdparty/freetype/src/cff/cff.c | 13 +- sdk/lib/3rdparty/freetype/src/cff/cffcmap.c | 2 +- sdk/lib/3rdparty/freetype/src/cff/cffcmap.h | 4 +- sdk/lib/3rdparty/freetype/src/cff/cffdrivr.c | 423 +- sdk/lib/3rdparty/freetype/src/cff/cffdrivr.h | 2 +- sdk/lib/3rdparty/freetype/src/cff/cfferrs.h | 2 +- sdk/lib/3rdparty/freetype/src/cff/cffgload.c | 2623 +---------- sdk/lib/3rdparty/freetype/src/cff/cffgload.h | 187 +- sdk/lib/3rdparty/freetype/src/cff/cffload.c | 66 +- sdk/lib/3rdparty/freetype/src/cff/cffload.h | 9 +- sdk/lib/3rdparty/freetype/src/cff/cffobjs.c | 120 +- sdk/lib/3rdparty/freetype/src/cff/cffobjs.h | 106 +- sdk/lib/3rdparty/freetype/src/cff/cffparse.c | 27 +- sdk/lib/3rdparty/freetype/src/cff/cffparse.h | 4 +- sdk/lib/3rdparty/freetype/src/cff/cffpic.c | 2 +- sdk/lib/3rdparty/freetype/src/cff/cffpic.h | 7 +- sdk/lib/3rdparty/freetype/src/cff/cfftoken.h | 2 +- sdk/lib/3rdparty/freetype/src/cid/ciderrs.h | 2 +- sdk/lib/3rdparty/freetype/src/cid/cidgload.c | 87 +- sdk/lib/3rdparty/freetype/src/cid/cidgload.h | 2 +- sdk/lib/3rdparty/freetype/src/cid/cidload.c | 2 +- sdk/lib/3rdparty/freetype/src/cid/cidload.h | 2 +- sdk/lib/3rdparty/freetype/src/cid/cidobjs.c | 40 +- sdk/lib/3rdparty/freetype/src/cid/cidobjs.h | 2 +- sdk/lib/3rdparty/freetype/src/cid/cidparse.c | 2 +- sdk/lib/3rdparty/freetype/src/cid/cidparse.h | 2 +- sdk/lib/3rdparty/freetype/src/cid/cidriver.c | 22 +- sdk/lib/3rdparty/freetype/src/cid/cidriver.h | 2 +- sdk/lib/3rdparty/freetype/src/cid/cidtoken.h | 2 +- sdk/lib/3rdparty/freetype/src/cid/type1cid.c | 2 +- sdk/lib/3rdparty/freetype/src/gxvalid/README | 12 +- .../3rdparty/freetype/src/gxvalid/gxvalid.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvalid.h | 2 +- .../3rdparty/freetype/src/gxvalid/gxvbsln.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvcommn.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvcommn.h | 2 +- .../3rdparty/freetype/src/gxvalid/gxverror.h | 2 +- .../3rdparty/freetype/src/gxvalid/gxvfeat.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvfeat.h | 2 +- .../3rdparty/freetype/src/gxvalid/gxvfgen.c | 4 +- .../3rdparty/freetype/src/gxvalid/gxvjust.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvkern.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvlcar.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmod.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmod.h | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmort.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmort.h | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmort0.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmort1.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmort2.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmort4.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmort5.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmorx.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmorx.h | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmorx0.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmorx1.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmorx2.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmorx4.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmorx5.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvopbd.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvprop.c | 2 +- .../3rdparty/freetype/src/gxvalid/gxvtrak.c | 2 +- sdk/lib/3rdparty/freetype/src/gzip/ftgzip.c | 2 +- sdk/lib/3rdparty/freetype/src/gzip/zconf.h | 284 -- sdk/lib/3rdparty/freetype/src/lzw/ftlzw.c | 2 +- sdk/lib/3rdparty/freetype/src/lzw/ftzopen.c | 2 +- sdk/lib/3rdparty/freetype/src/lzw/ftzopen.h | 2 +- .../3rdparty/freetype/src/otvalid/otvalid.c | 2 +- .../3rdparty/freetype/src/otvalid/otvalid.h | 2 +- .../3rdparty/freetype/src/otvalid/otvbase.c | 35 +- .../3rdparty/freetype/src/otvalid/otvcommn.c | 30 +- .../3rdparty/freetype/src/otvalid/otvcommn.h | 54 +- .../3rdparty/freetype/src/otvalid/otverror.h | 2 +- .../3rdparty/freetype/src/otvalid/otvgdef.c | 113 +- .../3rdparty/freetype/src/otvalid/otvgpos.c | 56 +- .../3rdparty/freetype/src/otvalid/otvgpos.h | 2 +- .../3rdparty/freetype/src/otvalid/otvgsub.c | 36 +- .../3rdparty/freetype/src/otvalid/otvjstf.c | 2 +- .../3rdparty/freetype/src/otvalid/otvmath.c | 2 +- .../3rdparty/freetype/src/otvalid/otvmod.c | 2 +- .../3rdparty/freetype/src/otvalid/otvmod.h | 2 +- sdk/lib/3rdparty/freetype/src/pcf/pcfdrivr.c | 2 +- sdk/lib/3rdparty/freetype/src/pcf/pcfread.c | 6 +- sdk/lib/3rdparty/freetype/src/pfr/pfr.c | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.c | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.h | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.c | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.h | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrerror.h | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrgload.c | 12 +- sdk/lib/3rdparty/freetype/src/pfr/pfrgload.h | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrload.c | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrload.h | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.c | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.h | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.c | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.h | 2 +- sdk/lib/3rdparty/freetype/src/pfr/pfrtypes.h | 2 +- .../3rdparty/freetype/src/psaux/afmparse.c | 2 +- .../3rdparty/freetype/src/psaux/afmparse.h | 2 +- .../3rdparty/freetype/src/psaux/cffdecode.c | 2370 ++++++++++ .../3rdparty/freetype/src/psaux/cffdecode.h | 64 + .../src/{cff/cf2arrst.c => psaux/psarrst.c} | 10 +- .../src/{cff/cf2arrst.h => psaux/psarrst.h} | 10 +- sdk/lib/3rdparty/freetype/src/psaux/psaux.c | 13 +- .../3rdparty/freetype/src/psaux/psauxerr.h | 2 +- .../3rdparty/freetype/src/psaux/psauxmod.c | 56 +- .../3rdparty/freetype/src/psaux/psauxmod.h | 11 +- .../src/{cff/cf2blues.c => psaux/psblues.c} | 12 +- .../src/{cff/cf2blues.h => psaux/psblues.h} | 10 +- sdk/lib/3rdparty/freetype/src/psaux/psconv.c | 2 +- sdk/lib/3rdparty/freetype/src/psaux/psconv.h | 2 +- .../src/{cff/cf2error.c => psaux/pserror.c} | 6 +- .../src/{cff/cf2error.h => psaux/pserror.h} | 10 +- .../src/{cff/cf2fixed.h => psaux/psfixed.h} | 8 +- .../src/{cff/cf2font.c => psaux/psfont.c} | 85 +- .../src/{cff/cf2font.h => psaux/psfont.h} | 20 +- .../src/{cff/cf2ft.c => psaux/psft.c} | 357 +- .../src/{cff/cf2ft.h => psaux/psft.h} | 108 +- .../src/{cff/cf2glue.h => psaux/psglue.h} | 16 +- .../src/{cff/cf2hints.c => psaux/pshints.c} | 78 +- .../src/{cff/cf2hints.h => psaux/pshints.h} | 9 +- .../src/{cff/cf2intrp.c => psaux/psintrp.c} | 1237 +++++- .../src/{cff/cf2intrp.h => psaux/psintrp.h} | 12 +- sdk/lib/3rdparty/freetype/src/psaux/psobjs.c | 753 +++- sdk/lib/3rdparty/freetype/src/psaux/psobjs.h | 103 +- .../src/{cff/cf2read.c => psaux/psread.c} | 8 +- .../src/{cff/cf2read.h => psaux/psread.h} | 8 +- .../src/{cff/cf2stack.c => psaux/psstack.c} | 12 +- .../src/{cff/cf2stack.h => psaux/psstack.h} | 8 +- .../src/{cff/cf2types.h => psaux/pstypes.h} | 8 +- sdk/lib/3rdparty/freetype/src/psaux/t1cmap.c | 2 +- sdk/lib/3rdparty/freetype/src/psaux/t1cmap.h | 2 +- .../3rdparty/freetype/src/psaux/t1decode.c | 350 +- .../3rdparty/freetype/src/psaux/t1decode.h | 12 +- .../3rdparty/freetype/src/pshinter/pshalgo.c | 4 +- .../3rdparty/freetype/src/pshinter/pshalgo.h | 2 +- .../3rdparty/freetype/src/pshinter/pshglob.c | 2 +- .../3rdparty/freetype/src/pshinter/pshglob.h | 2 +- .../3rdparty/freetype/src/pshinter/pshinter.c | 2 +- .../3rdparty/freetype/src/pshinter/pshmod.c | 2 +- .../3rdparty/freetype/src/pshinter/pshmod.h | 2 +- .../3rdparty/freetype/src/pshinter/pshnterr.h | 2 +- .../3rdparty/freetype/src/pshinter/pshpic.c | 2 +- .../3rdparty/freetype/src/pshinter/pshpic.h | 2 +- .../3rdparty/freetype/src/pshinter/pshrec.c | 2 +- .../3rdparty/freetype/src/pshinter/pshrec.h | 2 +- .../3rdparty/freetype/src/psnames/psmodule.c | 2 +- .../3rdparty/freetype/src/psnames/psmodule.h | 2 +- .../3rdparty/freetype/src/psnames/psnamerr.h | 2 +- .../3rdparty/freetype/src/psnames/psnames.c | 2 +- sdk/lib/3rdparty/freetype/src/psnames/pspic.c | 2 +- sdk/lib/3rdparty/freetype/src/psnames/pspic.h | 2 +- .../3rdparty/freetype/src/psnames/pstables.h | 2 +- sdk/lib/3rdparty/freetype/src/raster/ftmisc.h | 2 +- .../3rdparty/freetype/src/raster/ftraster.c | 2 +- .../3rdparty/freetype/src/raster/ftraster.h | 2 +- .../3rdparty/freetype/src/raster/ftrend1.c | 113 +- .../3rdparty/freetype/src/raster/ftrend1.h | 2 +- sdk/lib/3rdparty/freetype/src/raster/raster.c | 2 +- .../3rdparty/freetype/src/raster/rasterrs.h | 2 +- .../3rdparty/freetype/src/raster/rastpic.c | 2 +- .../3rdparty/freetype/src/raster/rastpic.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/pngshim.c | 61 +- sdk/lib/3rdparty/freetype/src/sfnt/pngshim.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.c | 9 +- sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/sferrors.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/sfnt.c | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.c | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.c | 10 +- sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.c | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.h | 6 +- sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.c | 20 +- sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttcmapc.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttkern.c | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttkern.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttload.c | 4 +- sdk/lib/3rdparty/freetype/src/sfnt/ttload.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.c | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttpost.c | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttpost.h | 2 +- sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.c | 7 +- sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.h | 2 +- .../3rdparty/freetype/src/smooth/ftgrays.c | 83 +- .../3rdparty/freetype/src/smooth/ftgrays.h | 2 +- .../3rdparty/freetype/src/smooth/ftsmerrs.h | 2 +- .../3rdparty/freetype/src/smooth/ftsmooth.c | 307 +- .../3rdparty/freetype/src/smooth/ftsmooth.h | 2 +- sdk/lib/3rdparty/freetype/src/smooth/ftspic.c | 2 +- sdk/lib/3rdparty/freetype/src/smooth/ftspic.h | 2 +- sdk/lib/3rdparty/freetype/src/smooth/smooth.c | 2 +- sdk/lib/3rdparty/freetype/src/tools/afblue.pl | 2 +- .../freetype/src/tools/docmaker/content.py | 33 +- .../freetype/src/tools/docmaker/docmaker.py | 2 +- .../freetype/src/tools/docmaker/formatter.py | 2 +- .../freetype/src/tools/docmaker/sources.py | 4 +- .../freetype/src/tools/docmaker/tohtml.py | 4 +- .../freetype/src/tools/docmaker/utils.py | 2 +- .../3rdparty/freetype/src/tools/glnames.py | 6 +- .../3rdparty/freetype/src/truetype/truetype.c | 2 +- .../3rdparty/freetype/src/truetype/ttdriver.c | 13 +- .../3rdparty/freetype/src/truetype/ttdriver.h | 2 +- .../3rdparty/freetype/src/truetype/tterrors.h | 2 +- .../3rdparty/freetype/src/truetype/ttgload.c | 107 +- .../3rdparty/freetype/src/truetype/ttgload.h | 2 +- .../3rdparty/freetype/src/truetype/ttgxvar.c | 552 ++- .../3rdparty/freetype/src/truetype/ttgxvar.h | 10 +- .../3rdparty/freetype/src/truetype/ttinterp.c | 28 +- .../3rdparty/freetype/src/truetype/ttinterp.h | 2 +- .../3rdparty/freetype/src/truetype/ttobjs.c | 83 +- .../3rdparty/freetype/src/truetype/ttobjs.h | 2 +- .../3rdparty/freetype/src/truetype/ttpic.c | 2 +- .../3rdparty/freetype/src/truetype/ttpic.h | 2 +- .../3rdparty/freetype/src/truetype/ttpload.c | 2 +- .../3rdparty/freetype/src/truetype/ttpload.h | 2 +- .../3rdparty/freetype/src/truetype/ttsubpix.c | 28 +- .../3rdparty/freetype/src/truetype/ttsubpix.h | 2 +- sdk/lib/3rdparty/freetype/src/type1/t1afm.c | 2 +- sdk/lib/3rdparty/freetype/src/type1/t1afm.h | 2 +- .../3rdparty/freetype/src/type1/t1driver.c | 21 +- .../3rdparty/freetype/src/type1/t1driver.h | 2 +- .../3rdparty/freetype/src/type1/t1errors.h | 2 +- sdk/lib/3rdparty/freetype/src/type1/t1gload.c | 120 +- sdk/lib/3rdparty/freetype/src/type1/t1gload.h | 2 +- sdk/lib/3rdparty/freetype/src/type1/t1load.c | 95 +- sdk/lib/3rdparty/freetype/src/type1/t1load.h | 6 +- sdk/lib/3rdparty/freetype/src/type1/t1objs.c | 42 +- sdk/lib/3rdparty/freetype/src/type1/t1objs.h | 8 +- sdk/lib/3rdparty/freetype/src/type1/t1parse.c | 2 +- sdk/lib/3rdparty/freetype/src/type1/t1parse.h | 2 +- .../3rdparty/freetype/src/type1/t1tokens.h | 2 +- sdk/lib/3rdparty/freetype/src/type1/type1.c | 2 +- .../3rdparty/freetype/src/type42/t42drivr.c | 2 +- .../3rdparty/freetype/src/type42/t42drivr.h | 2 +- .../3rdparty/freetype/src/type42/t42error.h | 2 +- .../3rdparty/freetype/src/type42/t42objs.c | 2 +- .../3rdparty/freetype/src/type42/t42objs.h | 2 +- .../3rdparty/freetype/src/type42/t42parse.c | 2 +- .../3rdparty/freetype/src/type42/t42parse.h | 2 +- .../3rdparty/freetype/src/type42/t42types.h | 2 +- sdk/lib/3rdparty/freetype/src/type42/type42.c | 2 +- .../3rdparty/freetype/src/winfonts/fnterrs.h | 2 +- .../3rdparty/freetype/src/winfonts/winfnt.c | 2 +- .../3rdparty/freetype/src/winfonts/winfnt.h | 2 +- 453 files changed, 13131 insertions(+), 9260 deletions(-) delete mode 100644 sdk/lib/3rdparty/freetype/include/freetype/ftautoh.h delete mode 100644 sdk/lib/3rdparty/freetype/include/freetype/ftcffdrv.h create mode 100644 sdk/lib/3rdparty/freetype/include/freetype/ftdriver.h create mode 100644 sdk/lib/3rdparty/freetype/include/freetype/ftparams.h delete mode 100644 sdk/lib/3rdparty/freetype/include/freetype/ftpcfdrv.h delete mode 100644 sdk/lib/3rdparty/freetype/include/freetype/ftttdrv.h create mode 100644 sdk/lib/3rdparty/freetype/include/freetype/internal/cffotypes.h rename sdk/lib/3rdparty/freetype/{src/cff => include/freetype/internal}/cfftypes.h (98%) rename sdk/lib/3rdparty/freetype/include/freetype/internal/{ftdriver.h => ftdrv.h} (98%) create mode 100644 sdk/lib/3rdparty/freetype/include/freetype/internal/ftpsprop.h create mode 100644 sdk/lib/3rdparty/freetype/include/freetype/internal/services/svcfftl.h delete mode 100644 sdk/lib/3rdparty/freetype/include/freetype/ttunpat.h create mode 100644 sdk/lib/3rdparty/freetype/src/base/ftpsprop.c delete mode 100644 sdk/lib/3rdparty/freetype/src/gzip/zconf.h create mode 100644 sdk/lib/3rdparty/freetype/src/psaux/cffdecode.c create mode 100644 sdk/lib/3rdparty/freetype/src/psaux/cffdecode.h rename sdk/lib/3rdparty/freetype/src/{cff/cf2arrst.c => psaux/psarrst.c} (98%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2arrst.h => psaux/psarrst.h} (96%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2blues.c => psaux/psblues.c} (99%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2blues.h => psaux/psblues.h} (97%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2error.c => psaux/pserror.c} (96%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2error.h => psaux/pserror.h} (96%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2fixed.h => psaux/psfixed.h} (97%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2font.c => psaux/psfont.c} (91%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2font.h => psaux/psfont.h} (94%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2ft.c => psaux/psft.c} (65%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2ft.h => psaux/psft.h} (60%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2glue.h => psaux/psglue.h} (96%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2hints.c => psaux/pshints.c} (96%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2hints.h => psaux/pshints.h} (98%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2intrp.c => psaux/psintrp.c} (55%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2intrp.h => psaux/psintrp.h} (95%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2read.c => psaux/psread.c} (97%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2read.h => psaux/psread.h} (96%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2stack.c => psaux/psstack.c} (98%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2stack.h => psaux/psstack.h} (97%) rename sdk/lib/3rdparty/freetype/src/{cff/cf2types.h => psaux/pstypes.h} (96%) diff --git a/media/doc/3rd Party Files.txt b/media/doc/3rd Party Files.txt index 463f347f09f..ccd1a755b8d 100644 --- a/media/doc/3rd Party Files.txt +++ b/media/doc/3rd Party Files.txt @@ -23,7 +23,7 @@ Used Version: 1.1 Website: http://www.geocities.com/dborca/opengl/tc.html Title: FreeType -Used Version: 2.8.1 +Used Version: 2.9.0 Website: http://www.freetype.org Title: Mesa3D diff --git a/sdk/lib/3rdparty/freetype/CMakeLists.txt b/sdk/lib/3rdparty/freetype/CMakeLists.txt index 6a41e3dcf7a..0f2f5a34c34 100644 --- a/sdk/lib/3rdparty/freetype/CMakeLists.txt +++ b/sdk/lib/3rdparty/freetype/CMakeLists.txt @@ -11,12 +11,7 @@ list(APPEND SOURCE src/base/ftbbox.c src/base/ftbitmap.c src/base/ftcalc.c - src/base/ftcid.c - src/base/ftdbgmem.c - src/base/ftdebug.c src/base/ftfntfmt.c - src/base/ftfstype.c - src/base/ftgasp.c src/base/ftgloadr.c src/base/ftglyph.c src/base/ftgxval.c @@ -29,6 +24,7 @@ list(APPEND SOURCE src/base/ftoutln.c src/base/ftpatent.c src/base/ftpfr.c + src/base/ftpsprop.c src/base/ftrfork.c src/base/ftsnames.c src/base/ftstream.c @@ -40,8 +36,6 @@ list(APPEND SOURCE src/base/ftutil.c src/base/ftwinfnt.c src/bdf/bdf.c - src/bzip2/ftbzip2.c - src/cache/ftcache.c src/cff/cff.c src/cid/type1cid.c src/gzip/ftgzip.c diff --git a/sdk/lib/3rdparty/freetype/ChangeLog b/sdk/lib/3rdparty/freetype/ChangeLog index f6de03c78e9..fa38730b732 100644 --- a/sdk/lib/3rdparty/freetype/ChangeLog +++ b/sdk/lib/3rdparty/freetype/ChangeLog @@ -1,3 +1,1811 @@ +2018-01-08 Werner Lemberg + + * Version 2.9 released. + ======================= + + + Tag sources with `VER-2-9'. + + * docs/VERSION.TXT: Add entry for version 2.9. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/windows/ftver.rc, + 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.8.1/2.9/, s/281/29/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 9. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 22:0:16. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + +2018-01-07 Werner Lemberg + + Add check for librt, needed for `ftbench' (#52824). + + * builds/unix/configure.raw (LIB_CLOCK_GETTIME): Define; this will + hold `-lrt' if necessary. + + * builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): New variable. + +2018-01-07 Ewald Hew + + [psaux] Fix Type 1 glyphs with too many stem hints. + + According to the CFF specification, charstrings can have up to 96 stem + hints. Due to hint replacement routines in Type 1 charstrings, some + glyphs are rejected by the Adobe engine, which implements the above + limit. This fix turns off hinting for such glyphs. + + * src/psaux/pshints.c (cf2_hintmap_build): Reset the error from calling + `cf2_hintmask_setAll' on a problematic Type 1 charstring and turn off + hinting. + +2018-01-06 Werner Lemberg + + Add `FT_Done_MM_Var'. + + This is necessary in case the application's memory routines differ + from FreeType. A typical example is a Python application on Windows + that calls FreeType compiled as a DLL via the `ctypes' interface. + + * include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare + and define. + + * docs/CHANGES: Updated. + +2018-01-03 Werner Lemberg + + [truetype] Round offsets of glyph components only if hinting is on. + + * src/truetype/ttgload.c (TT_Process_Composite_Component): Implement + it. + +2018-01-03 Werner Lemberg + + * src/truetype/ttgxvar.c (ft_var_to_design): Remove dead code. + + This is a better fix than the previous commit, which is now + reverted. + +2018-01-03 Alexei Podtelezhnikov + + Move internal LCD-related declarations. + + * include/freetype/ftlcdfil.h (ft_lcd_padding, ft_lcd_filter_fir): + Move from here... + * include/freetype/internal/ftobjs.h: ... to here. + +2018-01-03 Alexei Podtelezhnikov + + * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) + [_MSC_VER]: Limit Visual C++ attributes. + +2018-01-03 Werner Lemberg + + [truetype] Make blend/design coordinate round-tripping work. + + Behdad reported that setting blend coordinates, then getting design + coordinates did incorrectly return the default instance's + coordinates. + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Fix it. + +2017-12-31 Werner Lemberg + + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix endless loop. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4838 + +2017-12-31 Werner Lemberg + + Synchronize other Windows project files. + + * builds/windows/*: Add missing files. + +2017-12-31 Werner Lemberg + + Update Visual C 2010 project files. + + Problem reported by Hin-Tak. + + * builds/windows/vc2010/freetype.vcxproj: Add files `ftbdf.c' and + `ftcid.c'. + Sort entries. + * builds/windows/vc2010/freetype.vcxproj.filter: Ditto. + Fix members of `FT_MODULE' group. + +2017-12-30 Werner Lemberg + + * builds/vms/ftconfig.h: Synchronize with unix `ftconfig.in' file. + +2017-12-28 Werner Lemberg + + * builds/unix/ftconfig.in: Synchronize with main `ftconfig.h' file. + + Reported by Nikolaus. + +2017-12-27 Werner Lemberg + + Fix compiler warnings. + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Make `pitch' and + `new_pitch' unsigned. + + * src/base/ftpsprop.c: Include FT_INTERNAL_POSTSCRIPT_PROPS_H. + +2017-12-27 Werner Lemberg + + Fixes for `make multi'. + + * include/freetype/internal/ftpsprop.h: Use `FT_BASE_CALLBACK'. + (ps_property_get): Harmonize declaration with corresponding + function typedef. + + * include/freety[e/internal/fttrace.h: Add `trace_psprops'. + + * src/base/ftpsprop.c: Include necessary header files. + (FT_COMPONENT): Define. + (ps_property_set): Tag with `FT_BASE_CALLBACK_DEF'. + (ps_property_get): Tag with `FT_BASE_CALLBACK_DEF'. + Harmonize declaration with corresponding function typedef. + +2017-12-27 Werner Lemberg + + Provide support for intra-module callback functions. + + This is needed especially for `make multi' with C++. + + * include/freetype/config/ftconfig.h (FT_BASE_CALLBACK, + FT_BASE_CALLBACK_DEF): New macros. + +2017-12-25 Ewald Hew + + Move PostScript drivers' property handlers to `base'. + + This reduces the amount of duplicated code across PostScript + drivers. + + * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c + ({cff,cid,t1}_property_{get,set}): Moved to... + * include/freetype/internal/ftpsprop.h: ...this new file. + (ps_property_{get,set}): New functions to replace moved ones. + + * src/base/ftpsprop.c: New file that implements above functions. + + * include/freetype/internal/internal.h + (FT_INTERNAL_POSTSCRIPT_PROPS_H): New macro. + + * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: + Updated. + + * src/base/Jamfile, src/base/rules.mk (BASE_SRC), src/base/ftbase.c: + Updated. + +2017-12-20 Werner Lemberg + + Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new. + + We exit early if the current design or blend coordinates are + identical to the new ones. + + * src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design): + Implement it, returning internal error code -1 if there will be no + variation change. + + * src/type1/t1load.c (t1_set_mm_blend): Ditto. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated. + +2017-12-18 Werner Lemberg + + [sfnt] Fix charmap type 2 iterator (#52646). + + The subsetted demo font of the report that exhibits the bug has a + very unusual type 2 cmap for Unicode(!): It contains only two + sub-headers, one for one-byte characters (covering the range 0x20 to + 0xFA), and a second one for higher byte 0x01 (just for character + code U+0131). + + Before this commit, the iterator wasn't able to correctly handle a + sub-header for higher byte 0x01. + + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix character increment + for outer loop. + +2017-12-18 Matthias Clasen + + [truetype] Fix clamping, minor tracing code beautification. + + * src/truetype/ttgxvar.c (ft_var_to_normalized): Trace number of + design coordinates. + Use clamped value. + +2017-12-18 Werner Lemberg + + * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff. + +2017-12-18 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add size guard (#52688). + +2017-12-18 Werner Lemberg + + [truetype] Fix previous commit. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Correctly handle + unhinted phantom points, which must be properly scaled. + +2017-12-18 Werner Lemberg + + [truetype] Don't apply HVAR and VVAR deltas twice (#52683). + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Always adjust + `pp1' to `pp4', except if we have an HVAR and/or VVAR table. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Handle + alternative code branch identically w.r.t. presence of an HVAR + and/or VVAR table. + +2017-12-17 Jonathan Kew + + [truetype] Correctly handle variation font phantom points (#52683). + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix phantom + point indices. + +2017-12-17 Jonathan Kew + + Fix incorrect advance width scaling (#52683). + + * src/base/ftadvance.c (FT_Get_Advances): Always respect the + FT_LOAD_NO_SCALE flag if present. + +2017-12-16 Alexei Podtelezhnikov + + * builds/windows/vc2010/freetype.vcxproj: AfterBuild copy. + * objs/.gitignore: Ignore almost everything. + +2017-12-11 Werner Lemberg + + Fix compiler warning (#52640). + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Remove unused + variable. + +2017-12-08 Azzuro + + * builds/windows/vc2010/freetype.vcxproj: Adjust output directory. + + This allows builds with different configurations in parallel. + +2017-12-08 Werner Lemberg + + Fix `make setup dos', second try (#52622). + + * builds/detect.mk (dos_setup): Don't use literal `>' character at + all. Mixing the different escaping rules from make, dos, and + windows is too fragile. + +2017-12-08 Werner Lemberg + + [docmaker] Fix code section parsing. + + Stuff like + + { + + } + + confused the parser, which incorrectly treated `' as a markup + tag. + + * src/tools/docmaker/content.py (ContentProcessor::process_content): + Apply `re_markup_tags' only outside of code sections. + +2017-12-08 Werner Lemberg + + New `ftdriver.h' file, covering all driver modules. + + This reduces redundancy and increases synergy; it also reduces the + number of header files. + + * include/freetype/config/ftheader.h (FT_DRIVER_H): New macro. + (FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H, + FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to + FT_DRIVER_H. + + * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, + include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h, + include/freetype/ftttdrv.h: Replaced with... + * include/freetype/ftdriver.h: ...this new file. + (FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to... + (FT_HINTING_ADOBE): ... this new macro. + (FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to... + (FT_HINTING_FREETYPE): ... this new macro. + + * src/*/*: Updated accordingly. + +2017-12-08 Werner Lemberg + + Move `ftdriver.h' to `ftdrv.h'. + + * include/freetype/internal/ftdriver.h: Renamed to... + * include/freetype/internal/ftdrv.h: ... this name. + + * include/freetype/internal/internal.h (FT_INTERNAL_DRIVER_H): + Updated. + +2017-12-08 Werner Lemberg + + Fix access to uninitalized memory (#52613). + + Also reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=791317 + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): If increasing the + bitmap size needs a larger bitmap buffer, assure that the new memory + areas are initialized also. + +2017-12-08 Werner Lemberg + + Fix `make setup dos' (#52622). + + * builds/detect.mk (dos_setup): Properly escape literal `>' + character. + +2017-12-07 Werner Lemberg + + Fix C++ compilation. + + * src/psaux/psauxmod.h: Use FT_CALLBACK_TABLE macro where necessary. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix warning. + +2017-12-07 Werner Lemberg + + Fix `make multi'. + + * include/freetype/internal/fttrace.h: Remove unused tracing macros. + s/pshalgo2/pshalgo/. + Add `trace_cffdecode'. + * src/pshinter/pshalgo.c (FT_COMPONENT): Updated. + + * src/cff/cffload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + * src/cff/cffobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H and + FT_SERVICE_CFF_TABLE_LOAD_H. + + * src/cid/cidriver.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + + * src/psaux/cffdecode.c: Include FT_FREETYPE_H and + FT_INTERNAL_DEBUG_H. + (FT_COMPONENT): Define. + * src/psaux/cffdecode.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + * src/psaux/psauxmod.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + Declare `cff_builder_funcs' and `ps_builder_funcs'. + * src/psaux/psft.c: Include `psobjs.h' and `cffdecode.h'. + * src/psaux/psobjs.c : Include `psauxmod.h'. + +2017-12-07 Werner Lemberg + + * include/freetype/config/ftheader.h: Some clean-up. + + This commit removes documentation of deprecated macros and does some + minor streamlining. + +2017-12-06 Werner Lemberg + + * builds/symbian/bld.inf: Updated. + +2017-12-06 Werner Lemberg + + New header file `ftparams.h' that collects all parameter tags. + + * include/freetype/config/ftheader.h (FT_PARAMETER_TAGS_H): New + macro. + (FT_TRUETYPE_UNPATENTED_H, FT_UNPATENTED_HINTING_H): Define it to + `ftparams.h'. + + * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, + include/freetype/ftincrem.h, include/freetype/ftlcdfil.h, + include/freetype/ftsnames.h, include/freetype/ftt1drv.h: Include + FT_PARAMETER_TAGS_H. + Move FT_PARAM_TAG_XXX definitions to... + * include/freetype/ftparams.h: ...this new file. + + * include/freetype/ttunpat.h: Remove. No longer needed. + +2017-12-05 Werner Lemberg + + Improve tracing messages by using singular and plural forms. + + * src/*/*.c: Implement it. + +2017-12-04 Werner Lemberg + + [truetype] Allow shared points in `cvar' table (#52532). + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Implement it by copying + and adjusting the corresponding code from + `TT_Vary_Apply_Glyph_Deltas'. + +2017-11-28 Werner Lemberg + + [truetype] Improving tracing of composite glyphs. + + * src/truetype/ttgload.c (TT_Load_Composite_Glyph) + [FT_DEBUG_LEVEL_TRACE]: Show composite glyph information. + +2017-11-27 Werner Lemberg + + [type1] Allow (again) `/Encoding' with >256 elements (#52464). + + In version 2.6.1, this has been disallowed to better reject + malformed fonts; however, this restriction was too strong. This + time, we only take the first 256 elements into account, since + encoding arrays are always accessed with a 8bit integer, according + to the PostScript Language Reference. + + * src/type1/t1load.c (parse_encoding): Implement it. + +2017-11-27 Jan Alexander Steffens (heftig) + + Fix last commit (#52522). + + * builds/freetype.mk: Set `FT_OPTION_H' and `FTOPTION_FLAG' + properly if we have `ftoption.h' in `BUILD_DIR'. + +2017-11-24 Werner Lemberg + + [unix] Install a massaged `ftoption.h' file (#51780). + + * builds/unix/configure.raw (ftoption_set, ftoption_unset): New + auxiliary functions to construct... + (FTOPTION_H_SED): ... this new variable. + Apply it as a sed argument while copying `ftoption.h' to the + `builds/unix' directory (using `AC_CONFIG_FILES'). + Simplify code of test that checks cpp's computation of bit length + (the test previously created an empty `ftoption.h' file and deleted + it immediately afterwards); without this change, it can happen on my + GNU/Linux box that `configure's execution of `config.status' doesn't + create `ftoption.h' (no idea why this happens). + + * builds/unix/install.mk (install): Install + `builds/unix/ftoption.h'. + + * builds/unix/unix-def.in (DISTCLEAN): Updated. + + * builds/unix/.gitignore: Updated. + +2017-11-23 Tor Andersson + + Silence unused function warnings (#52465). + + Some static function declarations cause unused function warnings if + certain config options are turned off via `ftoption.h'. + + * src/base/ftbase.h, src/base/ftrfork.c, src/sfnt/ttbdf.h, + src/truetype/ttgxvar.h: Add #ifdef guards around these sections. + +2017-11-22 Ewald Hew + + * src/psaux/psft.c (cf2_setGlyphWidth): Check format before setting. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4377 + +2017-11-22 Ewald Hew + + [psaux] Fix CFF advance widths. (#52466) + + Glyph advance widths were being written to the new `PS_Decoder' but not + saved to the underlying format specific decoder. This caused pure CFF + fonts to have bad advance width. + + * include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width' + field to pointer. + Remove unused fields. + * src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy + to reference. + Remove unused. + * src/psaux/psft.c (cf2_setGlyphWidth): Update code. + +2017-11-15 Vlad Tsyrklevich + + * include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type. + +2017-11-14 Nikolaus Waxweiler + + Use Adobe hinting engine for `light' hinting of both CFF and Type 1. + + Since Ewald Hew factored the Adobe hinting engine out of the CFF + driver code, we can now use it on Type 1 (and CID) font formats, as + both have the same hinting philosophy. + + This change activates the Adobe hinter when in LIGHT mode, and + therefore always unless explicitly asking for the auto-hinter. This + makes LIGHT behavior consistent with CFF fonts. As of this commit, + the hinting engine table looks as follows. + + LIGHT NORMAL + ------------------------- + TrueType Auto v40 + CFF Adobe Adobe + Type 1 Adobe Adobe + +2017-11-10 Yuri Levchenko + + * CMakeLists.txt: Add `DISABLE_FORCE_DEBUG_PREFIX' option. + +2017-11-06 Alexei Podtelezhnikov + + * src/base/ftobjs.c (FT_Load_Glyph): Relocate condition. + +2017-11-06 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_set_cell): Fix uninitialized variables. + +2017-11-03 Ewald Hew + + [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251) + + The interpreter in Type 1 mode rewinds the charstring after collecting + all hints for building the initial hintmap (commit d52dd7f). However, + some charstrings use `endchar' in a final subroutine call, rewinding to + the start of that subroutine, and only a small section of the actual + glyph is drawn. + + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Ensure we are on the top level charstring before rewinding. + +2017-11-03 suzuki toshiya + + [truetype] Add more tricky fonts. + + See the report by Yang Yinsen. + https://lists.gnu.org/archive/html/freetype-devel/2017-11/msg00000.html + + * src/truetype/ttobjs.c (trick_names): Add `DFGothic-EB', + `DFGyoSho-Lt', `DFHSGothic-W5', `DFHSMincho-W3' and `DFHSMincho-W7'. + (tt_check_trickyness_sfnt_ids): Add checksums for DFGothic-EB, + DFGyoSho-Lt, DFHSGothic-W5, DFHSMincho-W3 and DFHSMincho-W7. Also + add checksums for DLCLiShu and DLCHayBold which their family names + were already listed but their checksums were previously unknown. + +2017-11-01 Alexei Podtelezhnikov + + [smooth] Fix complex rendering at high ppem. + + We used to split large glyphs into horizontal bands and continue + bisecting them still horizontally if that was not enough. This is + guaranteed to fail when a single scanline cannot fit into the + rendering memory pool. Now we bisect the bands vertically so that + the smallest unit is a column of the band height, which is guranteed + to fit into memory. + + * src/smooth/ftgrays.c (gray_convert_glyph): Implement it. + +2017-10-20 Alexei Podtelezhnikov + + [smooth] Improve complex rendering at high ppem. + + At large sizes almost but not exactly horizontal segments can quickly + drain the rendering pool. This patch at least avoids filling the pool + with trivial cells. Beyond this, we can only increase the pool size. + + Reported, analyzed, and tested by Colin Fahey. + + * src/smooth/ftgrays.c (gray_set_cell): Do not record trivial cells. + +2017-10-20 Alexei Podtelezhnikov + + [base] Improve tracing in FT_Load_Glyph, FT_*_Size. + + * src/base/ftobjs.c (FT_Load_Glyph): Tag tracing messages with + function name, glyph index, and load flags. + (FT_Select_Metrics, FT_Request_Metrics): Remove all tracing. + (FT_Select_Size, FT_Request_Size): Improve tracing. + +2017-10-18 Alexei Podtelezhnikov + + [base] Improve tracing in FT_Render_Glyph. + + * src/base/ftobjs.c (FT_Render_Glyph_Internal): Add total coverage + calculations and downgrade Netpbm dump to bitmap:7. + +2017-10-15 Ewald Hew + + [cff] Fix segfault on missing `psaux' (#52218) + + * src/cff/cffload.c (cff_done_blend): Add a check for possible nullptr. + + * modules.cfg: Update dependency list. + +2017-10-15 Alexei Podtelezhnikov + + [base, cff] Fix MSVC warnings. + + * src/base/ftobjs.c (FT_New_Library): C4702: unreachable code. + (ft_glyphslot_preset_bitmap): C4244: possible loss of data. + * src/cff/cffload.c (cff_blend_doBlend): C4244: possible loss of data. + Turn `sum' into unsigned. + +2017-10-14 Alexei Podtelezhnikov + + [base] Netpbm image tracing. + + * src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size. + (FT_Render_Glyph_Internal): Trace bitmap in Netpbm format. + + * src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing. + +2017-10-14 Alexei Podtelezhnikov + + * builds/windows/ftdebug.c (FT_Message): Print to stderr. + * builds/wince/ftdebug.c (FT_Message): Ditto. + +2017-10-14 Behdad Esfahbod + + [afshaper] Delay creating `hb_set' objects until needed. + + In runs on Noto Naskh Arabic, this results in 89 sets created + instead of 340 before. Makes auto-hinter setup with HarfBuzz + enabled 20% to 30% faster. + + * src/autofit/afshaper.c (af_shaper_get_coverage): Implement it. + +2017-10-12 Ewald Hew + + [type1, cid] Add hinting engine switch. + + Implement property service in `type1' and `cid' drivers to allow + switching between FreeType or Adobe hinting engine when both are + available. + + * src/cid/cidriver.c (cid_property_{set,get}, cid_services), + src/type1/t1driver.c (t1_property_{set,get}, t1_services): Add + Properties service. + + * src/cid/cidobjs.c (cid_driver_init), src/type1/t1objs.c + (T1_Driver_Init): Add default property values. + +2017-10-12 Ewald Hew + + Add T1_CONFIG_OPTION_OLD_ENGINE configuration option. + + This controls whether the old Type 1 engine gets compiled into FreeType. + It is disabled by default. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (T1_CONFIG_OPTION_OLD_ENGINE): New macro. + + * include/freetype/internal/psaux.h (PS_Decoder): Remove unused field. + * include/freetype/internal/psaux.h, src/cid/cidgload.c + (cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c + (ps_builder_add_point), src/psaux/t1decode.c + (t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph, + t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h, + src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround + relevant code with macro. + Minor code changes. + +2017-10-12 Ewald Hew + + Extract width parsing from Type 1 parser. + + Duplicate the fast advance width calculations from the old parser. + This is to facilitate adding options for compiling out the old parser. + + * src/psaux/t1decode.{c,h} (t1_decoder_parse_metrics): New function. + * include/freetype/internal/psaux.h (T1_Decoder_Funcs): New entry + `parse_metrics'. + * src/psaux/psauxmod.c: Set the new entry. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String), + src/cid/cidgload.c (cid_load_glyph): Separate + conditional for selecting engine. + +2017-10-09 Werner Lemberg + + * src/base/ftoutln.c (FT_Outline_Translate): Fix integer overflow. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=772775 + +2017-10-08 Werner Lemberg + + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3579 + +2017-10-07 Werner Lemberg + + [sfnt] Adjust behaviour of PS font names for variation fonts. + + * src/sfnt/sfdriver.c (sfnt_get_var_ps_name): Use a named instance's + PS name only if no variation is applied. + +2017-10-07 Werner Lemberg + + [cff, truetype] Adjust behaviour of named instances. + + This commit completely separates the interaction between named + instances and variation functions. In particular, resetting the + variation returns to the current named instance (if set) and not to + the base font. + + As a side effect, variation functions no longer change the named + instance index. + + * src/cff/cffobjs.c (cff_face_init): Use MM service's `set_instance' + function. + Also apply `MVAR' table to named instances. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add cast. + (tt_set_mm_blend): No longer check whether requested variation + coincides with a named instance. + (TT_Set_Var_Design): Use current named instance for default + coordinates. + * src/truetype/ttobjs.c (tt_face_init): Use `TT_Set_Named_Instance'. + +2017-10-07 Werner Lemberg + + Make `FT_Set_Named_Instance' work. + + * src/cff/cffdrivr.c (cff_set_instance): New function. + (cff_service_multi_masters): Register it. + + * src/truetype/ttgxvar.c (TT_Set_Named_Instance): New function. + * src/truetype/ttgxvar.h: Updated. + * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Register + it. + + * src/type1/t1load.c (T1_Reset_MM_Blend): New function. + * src/type1/t1load.h: Updated. + * src/type1/t1driver.c (t1_service_multi_masters): Register it. + +2017-10-07 Werner Lemberg + + Make `FT_FACE_FLAG_VARIATION' work. + + * include/freetype/internal/tttypes.h (TT_Face): Remove + `is_default_instance'; this can be replaced with a combination of + `FT_IS_VARIATION' and `FT_IS_INSTANCE'. + + * src/cff/cffdrivr.c (cff_get_advances): Updated. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name), src/sfnt/sfobjs.c + (sfnt_init_face): Updated. + + * src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c + (TT_Process_Simple_Glyph, load_truetype_glyph, IS_DEFAULT_INSTANCE), + src/truetype/ttgxvar.c (tt_set_mm_blend): Updated. + * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): + Handle `FT_FACE_FLAG_VARIATION'. + + * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Handle + `FT_FACE_FLAG_VARIATION'. + +2017-10-07 Werner Lemberg + + New function `FT_Set_Named_Instance'. + + No effect yet. + + * src/base/ftmm.c (FT_Set_Named_Instance): New function. + + * include/freetype/ftmm.h: Updated. + +2017-10-07 Werner Lemberg + + Add macros for checking whether a font variation is active. + + * include/freetype/freetype.h (FT_FACE_FLAG_VARIATION, + FT_IS_VARIATION): New macros. + No effect yet. + +2017-10-07 Werner Lemberg + + Add framework for setting named instance in MM service. + + * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): + New function typedef. + (MultiMasters): Add `set_instance' member. + (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. + + * src/cff/cffdrivr.c (cff_service_multi_masters), + src/truetype/ttdriver (tt_service_gx_multi_masters), + src/type1/t1driver.c (t1_service_multi_masters): Updated. + +2017-10-07 Werner Lemberg + + [type1] Minor code shuffling. + + * src/type1/t1load.c (T1_Set_MM_Blend): Make it a wrapper of... + (t1_set_mm_blend): ...this new function. + (T1_Set_MM_Design): Use `t1_set_mm_blend'. + +2017-10-05 Werner Lemberg + + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Fix integer + overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3539 + +2017-10-05 Werner Lemberg + + Fix compiler warnings. + + * src/cff/cffdrivr.c (cff_ps_get_font_extra): Avoid code that relies + on numeric overflow. + Add cast. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix variable + types, add cast. + +2017-10-04 John Tytgat + + [cff] Add support for `FSType'. + + * include/freetype/internal/cfftypes.h (CFF_FontRec): Add + `font_extra' entry. + + * src/cff/cffdrivr.c (cff_ps_get_font_extra): New function to + retrieve FSType info from the embedded PostScript data. + (cff_service_ps_info): Register function. + + * src/cff/cffload.c (cff_font_done): Free `font_extra'. + +2017-09-30 Alexei Podtelezhnikov + + Signedness fixes in bitmap presetting. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3514. + + * src/raster/ftrend1.c (ft_raster1_render): Exlicitly signed height. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Explicitly unsigned + subtraction. + +2017-09-29 Alexei Podtelezhnikov + + Bitmap metrics presetting [2/2]. + + * src/base/ftobjs.c (FT_Load_Glyph): Preset the bitmap metrics when + appropriate but `FT_Render_Glyph' is not called. + * include/freetype/freetype.h (FT_GlyphSlotRec): Document the change. + +2017-09-28 Alexei Podtelezhnikov + + [smooth, raster] Miscellaneous cleanups. + + * src/raster/ftrend1.c (ft_raster1_render): Clean up the exit. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Reduce + translations and clean up the exit. + (ft_smooth_render_lcd, ft_smooth_render_lcd): Remove unused `error'. + +2017-09-28 Ben Wagner + + [truetype] Really, really fix #52082. + + * src/truetype/ttinterp.c (Ins_MDRP): Correct conditional. + +2017-09-28 Werner Lemberg + + * src/psaux/psintrp.c (cf2_doStems): Fix integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3510 + +2017-09-28 Ewald Hew + + * src/cid/cidgload.c (cid_slot_load_glyph): Fix memory leak. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3489 + +2017-09-28 Alexei Podtelezhnikov + + Bitmap metrics presetting [1/2]. + + This mainly just extracts the code for presetting the bitmap metrics + from the monochrome, grayscale, and LCD renderers into a separate + function. + + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): New function that + calculates prospective bitmap metrics for the given rendering mode. + * include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap): + Declare it. + + * src/base/ftlcdfil.c (ft_lcd_padding): New helper function that adds + padding to CBox taking into account pecularities of LCD rendering. + * include/freetype/ftlcdfil.h (ft_lcd_padding): Declare it. + + * src/raster/ftrend1.c (ft_raster1_render): Reworked to use + `ft_glyphslot_preset_bitmap'. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. + (ft_smooth_render_lcd, ft_smooth_render_lcd): The pixel_mode setting + is moved to `ft_glyphslot_preset_bitmap'. + +2017-09-28 Ewald Hew + + [psaux] Fix compiler warning. + + * src/psaux/pshints.c (cf2_hintmap_dump): Add switch for tracing + code. + +2017-09-27 Werner Lemberg + + * src/sfnt/ttload.c (tt_face_load_font_dir): Fix compiler warning. + +2017-09-25 Werner Lemberg + + [psaux] Fix compiler warnings. + + * src/psaux/psft.c (cf2_initLocalRegionBuffer): Remove redundant + test. + + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Add casts. + + * src/psaux/psobjs.c (ps_decoder_init): Add cast. + +2017-09-25 Ewald Hew + + [psaux] Minor fixes. + + * include/freetype/internal/psaux.h, src/psaux/psobjs.{c,h}: + Rearrange `ps_builder_init' arguments to conventional order. + + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Add a check and + notice for `SubFont' in Type 1 mode. + +2017-09-25 Ewald Hew + + [psaux] Move `psdecode' into `psobjs'. + + As the former only contains a single procedure, move it into + `psobjs' for simplicity. Also change the parameter order to the + conventional one. + + * src/psaux/psdecode.c (ps_decoder_init): Moved to... + * src/psaux/psobjs.c: ...Here. + * src/psaux/psdecode.h, src/psaux/psobjs.h: Ditto. + + * include/freetype/internal/psaux.h (PSAux_ServiceRec): Update + `ps_decoder_init' function signature. + + * src/cff/cffgload.c, src/cid/cidgload.c, src/type1/t1gload.c: + Update calls. + + * src/psaux/psaux.c, src/psaux/psauxmod.c: Update includes. + + * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC): + Update file references. + +2017-09-25 Ewald Hew + + [psaux] Fix Type 1 hinting. + + Type 1 hinting breaks sometimes when mid-charstring hints should + have been in the initial hintmap. This fix adds a preprocessing + pass that reads all hints and builds the correct initial hintmap + first, before proceeding to build the glyph outline. + + * src/psaux/psintrp.c (cf2_interpT2CharString): New + `initial_map_ready' boolean flag. + Ignore outline commands and hint changes on first pass. + : Add section to build hintmap and rewind. + +2017-09-25 Ewald Hew + + [psaux] Add tracing for hints. + + * src/psaux/pshints.c (cf2_hintmap_dump): New function. + (cf2_hintmap_insertHint): Trace incoming and inserted hints. + (cf2_hintmap_build): Dump hintmap before and after hint adjustment. + +2017-09-25 Ewald Hew + + [psaux] Minor fixes. + + * src/psaux/psintrp.c (cf2_interpT2CharString): Fix check for pop + results. + s/font->decoder/decoder/ where necessary. + : Use + offset parameter in `cf2_doStems' instead of doing correction for + left-sidebearing. + +2017-09-25 Ewald Hew + + [cid] Use the new engine. + + * src/cid/cidgload.c: Update includes. + (cid_load_glyph, cid_slot_load_glyph): Implement changes to glyph + loading code as with `type1' module. + +2017-09-25 Ewald Hew + + [cid] Add Adobe engine configuration. + + This is similar to what was done in the `type1' module. + + * src/cid/cidriver.c (t1cid_driver_class): Update declaration. + * src/cid/cidobjs.c: Include FT_TYPE1_DRIVER_H. + (cid_driver_init): Update code. + +2017-09-25 Ewald Hew + + [psaux] Change subfont synthesis for CID fonts. + + Change `t1_make_subfont' to take in the Private dict record as an + argument. This is because Type 1 and CID font records in FreeType + have this in different places. + + * src/psaux/psobjs.c (t1_make_subfont): Change `T1_Face' to + `FT_Face' so that CID is also accepted. + Take `PS_Private' as an argument and let caller figure out where the + Private dict actually is. + Update references. + + * include/freetype/internal/psaux.h, src/psaux/psobjs.h: Update + declaration. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Update + call. + +2017-09-25 Ewald Hew + + [type1] Switch to Adobe engine. + + * src/type1/t1objs.c (T1_Driver_Init): Set default to Adobe engine. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (seac). + + This concludes the changes needed to add Type 1 support. + + * src/psaux/psintrp.c: Update includes. + (cf2_interpT2CharString) : Implement this similarly to + implied seac for CFF. + + * src/psaux/t1decode.c (t1_lookup_glyph_by_stdcharcode_ps): New + function to look up the glyph index. + + * src/psaux/psft.c (cf2_getT1SeacComponent, + cf2_freeT1SeacComponent): New functions to get the charstrings for + seac components. + + * src/psaux/t1decode.h, src/psaux/psft.h: Update declarations. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (flex in callothersubr). + + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Fix Flex feature handling (OtherSubrs 0, 1, + 2). + : Do not actually move the `glyphPath' while doing + flex. This is to avoid closing the current contour. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (callothersubr). + + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Copy code from + `t1_decoder_parse_charstrings' (in `t1decode.c'). + OtherSubr 3 (change hints) should reset the hintmask, so that the + new hints are applied. + Fix function calls and stack access. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (pop). + + * src/psaux/psintrp.c (cf2_interpT2CharString): Change how unhandled + OtherSubr results are stored. Implement the PostScript stack using + an array. + : Ensure that the stack is not cleared after getting + `OtherSubr' results. + Fix stack access. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (callsubr). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Type 1 mode. + + * src/psaux/psft.c (cf2_initLocalRegionBuffer): Add Type 1 mode. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (div, four-byte numbers). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : Add + Type 1 mode. Type 1 requires large integers to be followed by + `div'; cf. `Adobe Type 1 Font Format', section 6.2. + : Push Type 1 four-byte numbers as `Int' always. This is + to ensure `div' and `callsubr' get values they can use. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (hints). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : Add correction for left sidebearing in Type 1 mode. + Allow adding hints mid-charstring. + : Translate into equivalent commands + for three normal stem hints. This requires some recalculation of + stem positions. + Correction for left sidebearing. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (hsbw, sbw). + + * src/psaux/psintrp.c (cf2_doStems): `hsbw' or `sbw' must be the + first operation in a Type 1 charstring. + (cf2_interpT2CharString): Remove unused variables. + : `hsbw' or `sbw' + must be the first operation in a Type 1 charstring. + : Fix data access and add correction for + left sidebearing. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (setcurrentpoint). + + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Fix stack access. + +2017-09-25 Ewald Hew + + [psaux] Extend Adobe interpreter (closepath). + + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Use the right builder function. We can use the `haveWidth' boolean + already present, instead of implementing `parse_state'. + +2017-09-25 Ewald Hew + + [psaux] Add Type 1 operations to Adobe CFF interpreter. + + The following Type 1 specific ops have been added (copied from + `t1decode'): + + closepath + vstem3 + hstem3 + seac + sbw + callothersubr + pop + setcurrentpoint + hsbw + + The following require a Type 1 mode, because of differences in + specification: + + hstem + vstem + vmoveto + callsubr + div + rmoveto + hmoveto + Numbers + + The subsequent commits will implement these changes and adapt + accesses of data and objects to the new interpreter. + + NOTE: Will not compile in the meantime! + + * src/psaux/psintrp.c: Add opcodes to enum. + (cf2_interpT2CharString): Copy relevant code over from + `t1_decoder_parse_charstrings' (in `t1decode.c'). + +2017-09-25 Ewald Hew + + [type1] Fixes for rendering. + + The Type 1 advance width calculation passes null for glyph slot, + etc, which can cause null pointer access in the new interpreter. + Fall back to the old one for now. + + Fix the large glyph retry code and ensure hinting and scaling flags + are set properly. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add a + check for metrics_only. + Set the `force_scaling' flag. + (T1_Parse_Glyph): Updated. + (T1_Load_Glyph): Add `hinting' and `scaled' flags. + +2017-09-25 Ewald Hew + + [psaux] Add missing objects (2/2). + + Synthesize a `SubFont' object for Type 1 fonts. This is used in the + interpreter to access Private dict data, which are stored in + different places for Type 1 and CFF. This allows the same data to + be used in either mode. + + * src/psaux/psobjs.c (t1_make_subfont): New procedure to copy + required values to a dummy `CFF_SubFont' object. This is similar to + `cff_make_private_dict'. + * src/psaux/psobjs.h: Add the new declaration. + + * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Ditto. + Add this to the PSAux Service for future use with CID fonts. + + * src/type1/t1gload.c: Include FT_INTERNAL_CFF_TYPES_H. + (T1_Parse_Glyph_And_Get_Char_String): Add the call. + +2017-09-25 Ewald Hew + + [psaux] Add missing objects for Type 1 (1/2). + + Move `CF2_Font' instance to `PS_Decoder'. This is the context for + the interpreter and since it is currently stored in `CFF_Font', is + unavailable in Type 1 mode. + + * include/freetype/internal/psaux.h (T1_Decoder, PS_Decoder): New + `cf2_instance' field. + + * src/psaux/psdecode.c (ps_decoder_init): Copy `cf2_instance' to + `PS_Decoder'. + + * src/psaux/t1decode.c (t1_decoder_done): Add finalization code. + + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Update accesses. + +2017-09-25 Ewald Hew + + Allow `type1' module to use the Adobe engine. + + Add the callback and some conditionals to switch between the two + engines. + + * include/freetype/internal/psaux.h (T1_Decoder_FuncsRec): Change + function declarations. + * src/psaux/psauxmod.c (T1_Decoder_FuncsRec): Register the + callbacks. + + * src/psaux/psobjs.c (ps_builder_add_point): Add conditionals for + number conversion. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add code + to choose which renderer to use. + + * src/cid/cidgload.c (cid_load_glyph): Update call. + * src/base/ftobjs.c, src/psaux/psobjs.c, src/type1/t1gload.c: Update + includes. + +2017-09-25 Ewald Hew + + [type1] Add Adobe engine configuration. + + Use the previously changed PS_Driver in type1 module to store + hinting engine configuration. + + * include/freetype/ftt1drv.h: New file. + Duplicate and rename config options from CFF. + * include/freetype/config/ftheader.h (FT_TYPE1_DRIVER_H): New macro. + + * src/type1/t1driver.c (t1_driver_class): Update declaration. + * src/type1/t1objs.c: Include FT_TYPE1_DRIVER_H. + (T1_Driver_Init): Update code. + +2017-09-25 Ewald Hew + + [cff] Move and rename `CFF_Driver'. + + This is so that we can use the same hinting engine parameters for + Type 1. + + * include/freetype/internal/cffotypes.h (CFF_Driver): Rename and + move to... + * include/freetype/internal/psaux.h (PS_Driver): ...here. + + * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffload.c, + src/cff/cffobjs.c, src/cff/cffobjs.h, src/psaux/psft.c, + src/psaux/psobjs.c: Update references. + +2017-09-25 Ewald Hew + + [psaux, type1] Reorganize object fields. + + Make some fields more generic, so that we can access them the same + way regardless of Type 1 or CFF. + + * include/freetype/internal/psaux.h (PS_Builder): Change `TT_Face' + to `FT_Face'. + Remove unused fields. + + * src/psaux/psft.c: Update all accesses of `PS_Builder.face'. + Add some asserts to guard against casting `T1_Face' as `TT_Face'. + + * src/type1/t1objs.h (T1_GlyphSlot): Reorder fields to follow + `CFF_GlyphSlot', so that we can pretend they are the same in the + interpreter. + + * src/psaux/psobjs.c (ps_builder_init, ps_builder_add_point): + Updated with above changes. + +2017-09-25 Ewald Hew + + [psaux] Prepare for Type 1 mode. + + Add some checks for Type 1 data passing through. + + * src/psaux/psfont.h (CF2_Font): Add `isT1' flag. + * src/psaux/psfont.c (cf2_font_setup): Skip the variations and blend + code which is not applicable for Type 1. + + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Avoid accessing + `decoder->cff' in Type 1 mode. + Copy `is_t1' flag to `CF2_Font'. + +2017-09-25 Ewald Hew + + [psaux, cff] Use the new objects. + + * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix + switching between new and old engines. + + * src/cff/cffgload.c, src/cff/cffparse.c: Update calls. + + * src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h, + src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all + to use new objects. + +2017-09-24 Ewald Hew + + [psaux] Objects for new interpreter (part 2). + + Make the new objects copy over values. They are essentially wrapper + types for the different decoders/builders. + + * include/freetype/internal/psaux.h: Update declarations. + (PS_Builder): Add `is_t1' flag. + (PS_Decoder_{Get,Free}_Glyph_Callback): Renamed to... + (CFF_Decoder_{Get,Free}_Glyph_Callback: ... this. + (PS_Decoder): Updated. + Add `t1_parse_callback' member. + (PSAux_ServiceRec): Add `ps_decoder_init' member. + + * src/psaux/psdecode.h, src/psaux/psobjs.h: Update declarations. + + * src/psaux/psdecode.c, src/psaux/psobjs.c: Implement copy with two + modes. + + * src/psaux/psauxmod.c: Add builder and decoder functions to `PSAux' + service. + +2017-09-24 Ewald Hew + + [psaux] Add objects for new interpreter. + + Introduce `PS_Decoder' and `PS_Builder' which include all fields + from either Type 1 or CFF decoders/builders. + + * include/freetype/internal/psaux.h (PS_Builder, PS_Decoder): New + structs. + + * src/psaux/psobjs.c, src/psaux/psobjs.h: Add `PS_Builder' + functions. + + * src/psaux/psdecode.c, src/psaux/psdecode.h: New files to hold + `PS_Decoder' initialization functions. + + * src/psaux/psaux.c, src/psaux/Jamfile (_sources), + src/psaux/rules.mk (PSAUX_DRV_SRC): Updated. + +2017-09-24 Ewald Hew + + [psaux] Rename files. + + Replace the `cf2' file name prefix with `ps' as the Adobe engine + will be used for both PostScript Types 1 and 2 (CFF) instead of just + CFF. + + s/cf2/ps/ for all following. + + * src/psaux/cf2*: Rename files. + * src/psaux/*: Update includes. + + * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRC_SRC, + PSAUX_DRV_H): Update file references. + +2017-09-24 Ewald Hew + + [psaux] Minor fix. + + Use `MultiMasters' service in `psaux' instead of a call to `cff'. + The project builds if CFF_CONFIG_OPTION_OLD_ENGINE is not defined. + + * src/psaux/cf2ft.c: Update includes. + (cf2_getNormalizedVector): Use `mm->get_var_blend' instead of + `cff_get_var_blend'. + +2017-09-24 Ewald Hew + + [psaux, cff] Move `cff_random' into `psaux' service. + + NOTE: Does not compile! + + Minor fix to allow both `cff' and `psaux' to use `cff_random'. + + * src/cff/cffload.c (cff_random): Move to... + * src/psaux/psobjs.c: Here. + * src/cff/cffload.h: Move corresponding declaration to + `src/psaux/psobjs.h'. + + * include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the + function here... + * src/psaux/psauxmod.c: And here. + + * src/cff/cffload.c, src/psaux/cf2intrp.c: Update code. + +2017-09-24 Ewald Hew + + [cff] Move struct declarations to `freetype/internal'. + + NOTE: Does not compile! + + This is so that the CFF functions moved to `psaux' can access the + same structs that they need. + + * src/cff/cfftypes.h: Moved to... + * include/freetype/internal/cfftypes.h: ...Here. + + * src/cff/cffobjs.h: Moved the struct declarations to... + * include/freetype/internal/cffotypes.h: ... this new file. + + * include/freetype/internal/internal.h (FT_INTERNAL_CFF_TYPES_H, + FT_INTERNAL_CFF_OBJECT_TYPES_H): New macros. + + * src/cff/cffcmap.h, src/cff/cffdrivr.c, src/cff/cffgload.c, + src/cff/cffgload.h, src/cff/cffload.h, src/cff/cffobjs.c, + src/cff/cffobjs.h, src/cff/cffparse.h, src/psaux/psobjs.h, + include/freetype/internal/psaux.h, + include/freetype/internal/services/svcfftl.h: Update includes. + + * src/cff/rules.mk (CFF_DRV_H): Updated. + +2017-09-24 Ewald Hew + + [psaux, cff] Add new service for inter-module calls. + + NOTE: Does not compile! + + This is to allow CFF functions moved to `psaux' to call functions + declared in `src/cff/cffload.h'. + + * include/freetype/internal/services/svcfftl.h: New file, setting up + a `CFFLoad' service. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10, + FT_DEFINE_SERVICEDESCREC): New macros. + (FT_SERVICE_CFF_TABLE_LOAD_H): New macro. + + * src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service. + + * src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h + (CF2_FontRec): Add service interface. + + * src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c, + src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service. + +2017-09-24 Ewald Hew + + [psaux, cff] Add callbacks for inter-module calls. + + NOTE: Does not compile! + + * include/freetype/internal/psaux.h: Add function pointer + declarations. + + * src/psaux/cffdecode.c (cff_decoder_init): Update to take in + callbacks. + * src/psaux/cffdecode.h: Ditto. + + * src/cff/cffgload.c (cff_compute_max_advance, cff_slot_load): + Update calls to pass in callbacks. + * src/psaux/cf2ft.c, src/psaux/cffdecode.c: Use them. + +2017-09-24 Ewald Hew + + [psaux, cff] Create new `PSAux' service interface entries. + + NOTE: Does not compile! + + * include/freetype/internal/psaux.h: Include + FT_INTERNAL_TRUETYPE_TYPES_H. + (CFF_Builder_FuncsRec, CFF_Decocer_FuncsRec): New function tables. + (CFF_Builder): Updated. + Fix for forward declaration. + (PSAux_ServiceRec): New field `cff_decoder_funcs'. + + * src/psaux/psauxmod.c (cff_builder_funcs, cff_decoder_funcs): New + function tables. + (PSAux_Interface): Updated. + + * include/freetype/internal/tttypes.h (TT_FaceRec): Add `psaux' + service interface. + + * src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffparse.c: Update + function calls to use psaux service. + +2017-09-24 Ewald Hew + + [psaux, cff] Move CFF builder components into `psaux' module. + + NOTE: Does not compile! + + * src/cff/cffgload.c + (cff_builder_{init,done,add_point,add_point1,add_contour,start_point,close_contour}, + cff_check_points): Move to... + * src/psaux/psobjs.c: Here. + + * src/cff/cffgload.h: Move corresponding declarations to + `src/psaux/psobjs.h'. + + * src/cff/cffgload.h (CFF_Builder): Move struct declaration to... + * include/freetype/internal/psaux.h: Here. + +2017-09-24 Ewald Hew + + [psaux, cff] Move CFF decoder components into `psaux' module. + + NOTE: Does not compile! + + * src/cff/cffgload.c (CFF_Operator, + CFF_COUNT_{CHECK_WIDTH,EXACT,CLEAR_STACK}, cff_argument_counts, + cff_operator_seac, cff_compute_bias, + cff_lookup_glyph_by_stdcharcode, + cff_decoder_{parse_charstrings,init,prepare}): Move to... + * src/psaux/cffdecode.c: This new file. + + * src/cff/cffgload.h: Move corresponding declarations to... + * src/psaux/cffdecode.h: This new file. + + * src/cff/cffgload.h (CFF_MAX_{OPERANDS,SUBRS_CALLS,TRANS_ELEMENTS}, + CFF_Decoder_Zone, CFF_Decoder): Move declarations to... + * include/freetype/internal/psaux.h: Here. + + * src/psaux/cf2ft.h: Update include. + + * src/psaux/psaux.c, src/psaux/rules.mk (PSAUX_DRV_SRC): Update with + the new file. + +2017-09-24 Ewald Hew + + [psaux, cff] Move Adobe's engine components into `psaux' module. + + This is the first patch of a sequence to move the Type 2 charstring + processing capability from the `cff' module to the `psaux' module. + + NOTE: Does not compile! + + * src/cff/cf2*: Move these files to... + * src/psaux/cf2*: Here. + + * src/cff/Jamfile (_sources), src/cff/rules.mk (CFF_DRV_SRC, + CFF_DRV_H), src/cff/cff.c, src/cff/cffgload.c: Remove file + references. + + * src/psaux/Jamfile (_sources), src/psaux/rules.mk, src/psaux/psaux.c + (PSAUX_DRV_SRC, PSAUX_DRV_H): Add file references. + +2017-09-24 Alexei Podtelezhnikov + + Tweak per-face LCD filtering controls. + + Thing are simpler with a NULL-function pointer. + + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New + pointer to the filter function. + (FT_LibraryRec): Remove unused `lcd_filter'. + (FT_Bitmap_LcdFilterFunc, ft_lcd_filter_fir): Move from here... + * include/freetype/ftlcdfil.h (FT_Bitmap_LcdFilterFunc, + ft_lcd_filter_fir): ... to here. + + * src/base/ftobjs.c (ft_open_face_internal): NULL-initialize the + per-face filter. + (FT_Face_Properties): Set it. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Simplify. + + * src/base/ftlcdfil.c (ft_lcd_filter_fir, FT_Libary_SetLcdFilter): + Minor. + +2017-09-24 Jonathan Kew + + [sfnt] Fix `premultiply_data' (#52092). + + * src/sfnt/pngshim.c (premultiply_data): Don't use vector extension + if we have less than 16 bytes of data. + +2017-09-24 Werner Lemberg + + [otvalid] Fix handling of ValueRecords. + + For GPOS pair positioning format 1 the description of ValueRecords + in the OpenType specification (1.8.2, from today) is wrong – the + offset has to be taken from the parent structure; in this case the + `PairSet' table. + + * src/otvalid/otvgpos.c (otv_PairSet_validate): Set `extra3'. + (otv_PairPos_validate): Adjust. + +2017-09-23 Werner Lemberg + + [otvalid] Handle `GSUB' and `GPOS' v1.1 tables. + + * src/otvalid/otvgsub.c (otv_GSUB_validate), src/otvalid/otvgpos.c + (otv_GPOS_validate): Implement it. + +2017-09-23 Werner Lemberg + + [otvalid] Update common table handling to OpenType 1.8.2. + + * src/otvalid/otvcommn.c (otv_Device_validate): Handle + VariationIndex subtable. + (otv_Lookup_validate): Handle MarkFilteringSet. + +2017-09-23 Alexei Podtelezhnikov + + [build] Windows-style DLL versioning. + + * build/windows/ftver.rc: New VERSIONINFO resource. + * build/windows/vc2010/freetype.vcxproj: Further improvements. + +2017-09-23 Ben Wagner + + [truetype] Really fix #52082. + + * src/truetype/ttinterp.c (Ins_MDRP): Correct conditional. + +2017-09-23 Werner Lemberg + + [otvalid] Handle `GDEF' v1.2 and v1.3 tables. + + No validation of variation stuff yet. + + * src/otvalid/otvgdef.c (otv_MarkGlyphSets_validate): New function. + (otv_GDEF_validate): Implement it. + +2017-09-22 Werner Lemberg + + [otvalid] Handle `BASE' v1.1 table. + + No validation of variation stuff yet. + + * src/otvalid/otvbase.c (otv_BASE_validate): Implement it. + +2017-09-22 Werner Lemberg + + [otvalid] Macros for 32bit offset support. + + * src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE32, + OTV_OPTIONAL_OFFSET32, OTV_SIZE_CHECK32): New macros. + +2017-09-21 Alexei Podtelezhnikov + + [build] Simplify Visual C++ 2010 project. + + * build/windows/vc2010/freetype.vcxproj: Remove fake singlethreaded + configurations and tweak. + +2017-09-21 Werner Lemberg + + [truetype] Integer overflow (#52082). + + * src/truetype/ttinterp.c (Ins_MDRP): Avoid FT_ABS. + +2017-09-21 Werner Lemberg + + [sfnt] Fix postscript name for default instance of variation fonts. + + Problem reported by Behdad. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Test + `is_default_instance'. + +2017-09-21 Werner Lemberg + + [truetype] Fix `mmvar' array pointers, part 2. + + The previous commit was incomplete. + + * src/truetype/ttgxvar.c: Properly initialize sub-array offsets for + `master' also. + +2017-09-21 Werner Lemberg + + [truetype] Fix `mmvar' array pointers. + + Without this change, clang's AddressSanitizer reports many runtime + errors due to misaligned addresses. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use multiples of pointer + size for sub-array offsets into `mmvar'. + +2017-09-20 Werner Lemberg + + [truetype] Integer overflows. + + Changes triggered by + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3429 + + * src/truetype/ttinterp.c (Ins_SHPIX, Ins_DELTAP): Use NEG_LONG. + (Ins_MIAP): Use SUB_LONG. + +2017-09-19 Alexei Podtelezhnikov + + [build] Fix DLL builds in Visual C++ project. + + * build/windows/vc2010/freetype.vcxproj: Use DynamicLibrary in Debug + and Release configurations. + * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) + [_DLL]: Use Visual C++ extensions. + +2017-09-19 John Tytgat + + [cff] Fix family name logic of pure CFF fontdata (#52056). + + 1. If `FamilyName' is present in the CFF font, use this for + FT_Face's `family_name'. + 2. Otherwise, use the face name and chop off any subset prefix. + 3. If at this point FT_Face's `family_name' is set, use this + together with the full name to determine the style. + 4. Otherwise, use `CIDFontName' as FT_Face's `family_name'. + 5. If we don't have a valid style, use "Regular". + + Previously, FT_Face's `family_name' entry for pure CFF fontdata + nearly always was the fontname itself, instead of the `FamilyName' + entry in the CFF font (assuming there is one). + + * src/cff/cffobjs.c (cff_face_init) [pure_cff]: Implement it. + +2017-09-18 Alexei Podtelezhnikov + + [build] Declutter Visual C++ 2010-2017 project. + + * build/windows/vc2010/freetype.vcxproj: Use MaxSpeed (/02) + optimization for Release configuration throughout the project. + 2017-09-16 Werner Lemberg * Version 2.8.1 released. @@ -1405,7 +3213,7 @@ Reported by Earnestly in - http://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html + https://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html 2017-04-27 Werner Lemberg @@ -1742,7 +3550,7 @@ Problem reported by 張俊芝 <418092625@qq.com> in - http://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html + https://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html 2017-03-30 Werner Lemberg @@ -3117,2099 +4925,10 @@ * src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count. (ft_var_load_avar): Fix tracing message. -2016-12-30 Werner Lemberg - - * Version 2.7.1 released. - ========================= - - - Tag sources with `VER-2-7-1'. - - * docs/VERSION.TXT: Add entry for version 2.7.1. - - * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, - builds/windows/vc2005/index.html, - builds/windows/vc2008/freetype.vcproj, - builds/windows/vc2008/index.html, - builds/windows/vc2010/freetype.vcxproj, - builds/windows/vc2010/index.html, - builds/windows/visualc/freetype.dsp, - builds/windows/visualc/freetype.vcproj, - builds/windows/visualc/index.html, - builds/windows/visualce/freetype.dsp, - builds/windows/visualce/freetype.vcproj, - builds/windows/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.7/2.7.1/, s/27/271/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. - - * builds/unix/configure.raw (version_info): Set to 19:0:13. - * CMakeLists.txt (VERSION_PATCH): Set to 1. - -2016-12-30 Werner Lemberg - - [ftfuzzer] Replace `rand' with an xorshift algorithm. - - * src/tools/ftfuzzer/ftfuzzer.cc: Don't include `stdlib.h'. - (Random): Implement and use a 32bit `xorshift' algorithm. - -2016-12-30 Werner Lemberg - - [ftfuzzer] Restrict number of tested bitmap strikes. - - Malformed fonts often have large values for the number of bitmap - strikes, and FreeType doesn't check the validity of all bitmap - strikes in advance. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=353 - - * src/tools/ftfuzzer/ftfuzzer.cc: Include `stdlib.h' for `rand'. - (Random): Small class to provide n randomly selected numbers - (without repetition) out of the value set [1,N]. - (LLVMFuzzerTestOneInput): Use it to test only up to 10 bitmap - strikes. - -2016-12-29 Werner Lemberg - - [truetype] Variation font API stability issues. - - Make some functions work before a call to `TT_Set_MM_Blend'. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if - we don't blend. - (TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we - don't blend. - -2016-12-29 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=348 - -2016-12-29 Werner Lemberg - - [truetype] Tracing fixes. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): Emit correct - information. - (TT_Set_Var_Design): Fix typo. - (TT_Get_Var_Design): Fix typos. - -2016-12-29 Werner Lemberg - - */*: Use `0.5f' for tracing 16.16 numbers. - -2016-12-29 Werner Lemberg - - [pcf] Protect against gzip bombs. - - Fix suggested by Kostya; reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=345 - - * src/pcf/pcfread.c (pcf_read_TOC): Limit number of TOC entries to - 1024. - -2016-12-28 Werner Lemberg - - [psnames] Only declare, not define, data in `pstables.h' (#49949). - - Pdfium includes `pstables.h' a second time; moving the definition - from `pstables.h' to `psmodule.c' saves more than 60kByte data - segment space for this case. - - * src/tools/glnames.py (StringTable::dump, - StringTable::dump_sublist, dump_encoding, dump_array): Emit - additional code to only define tables if `DEFINE_PS_TABLES' is set. - - * src/psnames/pstables.h: Regenerated. - * src/psnames/psmodule.c (DEFINE_PS_TABLES): Define. - -2016-12-28 Werner Lemberg - - [cff] Catch `blend' op in non-variant fonts. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=334 - - * src/cff/cf2intrp.c (cf2_interpT2CharString) : Don't - allow `blend' op for non-variant fonts. - -2016-12-28 Werner Lemberg - - [cff] Better check of number of blends. - - * src/cff/cf2intrp.c (cf2_interpT2CharString) , - src/cff/cffparse.c (cff_parse_blend): Compare number of blends with - stack size. - -2016-12-27 Werner Lemberg - - Documentation updates. - - * docs/CHANGES: Add missing information. - - * docs/formats.txt: Rewritten and updated. - -2016-12-27 Werner Lemberg - - [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'. - - * src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement. - (TT_Set_Var_Design): Fix tracing. - - * src/type1/t1load.c (T1_Get_Var_Design): Implement. - -2016-12-24 Werner Lemberg - - * src/truetype/ttpload.c (tt_face_load_hdmx): Ignore `version'. - - Problem reported by 張俊芝 <418092625@qq.com>. - -2016-12-24 Werner Lemberg - - * src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values. - - Some fonts seem to have the `version' field in the wrong byte order. - - Problem reported by 張俊芝 <418092625@qq.com>. - -2016-12-24 Werner Lemberg - - * src/truetype/ttpload.c (tt_face_load_loca): Sanitize table length. - - This trivial fix allows us to accept more fonts. - - Problem reported by 張俊芝 <418092625@qq.com>. - -2016-12-24 Werner Lemberg - - * src/sfnt/sfobjs.c (sfnt_init_face): Fix tracing. - -2016-12-22 Werner Lemberg - - * CMakeLists.txt: Make it work with cmake 2.8.11.2 (#49909). - -2016-12-22 Werner Lemberg - - Ensure used preprocessor symbols are defined (#49790). - - * builds/unix/ftconfig.in, builds/vms/ftconfig.h, - include/freetype/config/ftconfig.h: Check `__GNUC__', `__IBMC__', - and `__SUNPRO_C' correctly. - -2016-12-22 Werner Lemberg - - * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Check `count'. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=308 - -2016-12-22 Werner Lemberg - - [cff] Protect against invalid `vsindex' and `blend' values. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=305 - - * src/cff/cf2intrp.c (cf2_interpT2CharString) : Implement it. - -2016-12-22 Werner Lemberg - - [ftfuzzer] Always use Adobe CFF engine. - - * src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement - it. - -2016-12-21 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. - - I should really stop coding late in the evening... - - Thanks again to Ben for checking. - -2016-12-21 Werner Lemberg - - [autofit] Support variation fonts. - - (This ChangeLog entry was added later on.) - - * src/autofit/afglobal.c (af_face_globals_free): Remove useless - code. - - * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, - * FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, - FT_Set_Var_Blend_Coordinates): Finalize - auto-hinter data to enforce recomputation. Note that this is a - brute-force method which should be improved. - -2016-12-21 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. - - Don't apply deltas twice for non-phantom points. - - Spotted by Ben Wagner. - -2016-12-21 Werner Lemberg - - [cff, truetype] Another try for #49829. - - * src/cff/cffdrivr.c: Don't include - `FT_SERVICE_METRICS_VARIATIONS_H'. - (cff_get_advances): Use `ttface->variation_support'. - - * src/truetype/ttdriver.c (tt_get_advances): Use - `ttface->variation_support'. - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Use `ttface->variation_support'. - -2016-12-21 Werner Lemberg - - [truetype, sfnt] Introduce font variation flags to `TT_Face'. - - * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): - New macros describing available functionality of various OpenType - tables related to font variation. - (TT_Face): New fields `variation_support' and `mvar_support', - replacing and extending `use_fvar'. - - * src/sfnt/sfobjs.c (sfnt_init_face, sfnt_load_face): Use - `variation_support'. - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Set `variation_support' - field. - (TT_Vary_Apply_Glyph_Deltas): Updated. - -2016-12-21 Werner Lemberg - - [base] Improve sanity check for Mac resources (#49888). - - * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Abort if `rlen' is not - positive. - -2016-12-20 Werner Lemberg - - [base] More sanity checks for Mac resources. - - We use - - https://github.com/kreativekorp/ksfl/wiki/Macintosh-Resource-File-Format - - and - - https://developer.apple.com/legacy/library/documentation/mac/pdf/MoreMacintoshToolbox.pdf#page=151 - - as references. - - * include/freetype/internal/ftrfork.h (FT_RFork_Ref): Use FT_Short - for `res_id'. - - * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Extract map length - and use it to improve sanity checks. - Follow the specification more closely;in particular, all data types - are signed, not unsigned. - (FT_Raccess_Get_DataOffsets): Follow the specification more closely; - in particular, all data types are signed, not unsigned. - Add some sanity checks. - -2016-12-20 Werner Lemberg - - [truetype] Improve logic for getting fast advance widths. - - * src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c - (tt_get_advances): Use `is_default_instance' for test; this gets - recomputed after changing blend coordinates. - -2016-12-20 Ben Wagner - Werner Lemberg - - [truetype] Fix linear metrics of GX variation fonts (#49829). - - When asking for an unhinted non-default variations, - `linearVertAdvance' is currently the value from the `hmtx' table - instead of the actual value after applying the variation. `HVAR' - support fixes this, but fonts will exist without that table and will - need sane fallback. - - Problem also reported as - - https://bugs.chromium.org/p/skia/issues/detail?id=5917 - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Implement linear advance adjustments if `HVAR' - or `VVAR' tables are missing. - -2016-12-20 Werner Lemberg - - [cff, truetype] Fast advance width retrieval for fonts with HVAR. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM. - - * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (cff_get_advances): Test for HVAR and VVAR. - - * src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR. - -2016-12-18 Werner Lemberg - - [base] Fix invalid mac font recursion. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=304 - - * src/base/ftobjs.c (FT_Open_Face): Code moved to... - (ft_open_face_internal): ... this function. - Add a parameter to control whether we try special Mac font handling - in case of failure. - (FT_Open_Face, FT_New_Face, FT_New_Memory_Face, - open_face_from_buffer): Use `ft_open_face_internal'. - -2016-12-18 Werner Lemberg - - * src/cff/cffobjs.c (cff_face_init): Make named instances work. - -2016-12-18 Werner Lemberg - - [truetype, cff] Extend `get_var_blend' function of MM service. - - In particular, we need access to named instance data. - - * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): - Add argument for `FT_MM_Var'. - - * src/cff/cffload.c (cff_get_var_blend): Updated. - * src/cff/cffload.h: Updated. - - * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. - - * src/truetype/ttgxvar.c (tt_get_var_blend): Updated. - Accept value `NULL' for arguments. - * src/truetype/ttgxvar.h: Updated. - -2016-12-18 Werner Lemberg - - [sfnt] Handle `fvar' with zero axes as a non-MM font. - - This is better behaviour than exiting with an error. - - * include/freetype/internal/tttypes.h (TT_Face): Add `use_fvar' - field. - - * src/sfnt/sfobjs.c (sfnt_init_face): Compute `use_fvar', also - updating the validation code. - Use `use_fvar' to compute FT_FACE_FLAG_MULTIPLE_MASTERS. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Remove `fvar' validation - code. - -2016-12-18 Werner Lemberg - - Minor GX code shuffling. - - * include/freetype/internal/tttypes.h (TT_Face): Move - `is_default_instance' into TT_CONFIG_OPTION_GX_VAR_SUPPORT - block. - - * src/sfnt/sfobjs.c (sfnt_init_face): Updated. - * src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): New macro. - (TT_Load_Glyph): Use it. - -2016-12-18 Werner Lemberg - - [cff] Better handling of non-CFF font formats. - - * src/cff/cffload.c (cff_font_load): Pure CFFs don't have a - signature, so return `FT_Err_Unknown_File_Format' more often. - -2016-12-17 Werner Lemberg - - * src/cff/cffload.c (cff_build_blend_vector): Remove redundant code. - -2016-12-17 Werner Lemberg - - * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code. - -2016-12-17 Werner Lemberg - - [sfnt, truetype] Various sanitizing fixes. - - * src/sfnt/sfobjs.c (sfnt_init_face): If the axis count in `fvar' is - zero, set `num_instances' to zero. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Handle `fvar' table with - zero axes as invalid. - - * src/truetype/ttobjs.c (tt_face_init): Improve logic of loading - `loca', `cvt', `fpgm', and `prep' table. - -2016-12-17 Werner Lemberg - - Improve tracing of `FT_Open_Face'. - - * src/base/ftobjs.c (FT_Open_Face): Return info on number of - available faces and numbered instances, or the indices of the - requested face and numbered instance. - - * src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts. - -2016-12-17 Werner Lemberg - - * src/cff/cffload.c (cff_load_private_dict): Always init `blend'. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=295 - -2016-12-16 Werner Lemberg - - [truetype] Fix `cvar' sanity test. - - Reported by Dave Arnold. - - * src/truetype/ttgxvar.c (tt_face_vary_cvt): Use tuple count mask. - -2016-12-16 Werner Lemberg - - [cff, truetype] Remove compiler warnings; fix `make multi'. - - * src/cff/cf2font.h: Include `cffload.h'. - - * src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and - FT_SERVICE_MULTIPLE_MASTERS_H. - (cff_vstore_load): Eliminate `vsSize'. - (cff_load_private_dict): Tag as `FT_LOCAL_DEF'. - - * src/cff/cffload.h: Include `cffobjs.h'. - Provide declaration for `cff_load_private_dict'. - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate - `minorVersion' and `map_offset'. - -2016-12-16 Werner Lemberg - - [cff] Fix heap buffer overflow (#49858). - - * src/cff/cffparse.c (cff_parser_run): Add one more stack size - check. - -2016-12-15 Werner Lemberg - - Fix clang warnings. - - * src/cff/cffload.c (cff_blend_doBlend): Add cast. - (cff_subfont_load): Set `error' correctly. - - * src/sfnt/ttmtx.c (tt_face_get_metrics): Typo. - -2016-12-15 Dave Arnold - Werner Lemberg - - [cff] Implement CFF2 support (2/2). - - The font variation code. All parts dependent on the GX code in the - `truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - In other words, you can still compile the `cff' module without - defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2 - support without font variation). - - * src/cff/cf2font.c (cf2_font_setup): Add support for font - variation. - * src/cff/cf2font.h (CF2_Font): Add fields for variation data. - - * src/cff/cf2ft.c (cf2_free_instance): Free blend data. - (cf2_getVStore, cf2_getNormalizedVector): New functions. - * src/cff/cf2ft.h: Updated. - - * src/cff/cf2intrp.c: Include `cffload.h'. - (cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with... - (cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values. - (cf2_doBlend): New function. - (cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes. - - * src/cff/cffload.c (FT_fdot14ToFixed): New macro. - (cff_vstore_done, cff_vstore_load): New functions. - (cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector, - cff_blend_check_vector): New functions. - (cff_load_private_dict): Add arguments for blend vector. - Handle blend data. - (cff_subfont_load, cff_subfont_done): Updated. - (cff_font_load): Handle CFF2 variation store data. - (cff_font_done): Updated. - * src/cff/cffload.h: Include `cffparse.h'. - Updated. - - * src/cff/cffobjs.c (cff_face_done): Updated. - - * src/cff/cffparse.c: Include `cffload.h'. - (cff_parse_num): Handle internal value 255. - (cff_parse_vsindex, cff_parse_blend): New functions. - (CFF_FIELD_BLEND): New macro. - (cff_parser_run): Updated. - * src/cff/cffparse.h (cff_kind_blend): New enum value. - - * src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend' - dictionary values. - - * src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion, - CFF_VStore, CFF_Blend): New structures. - (CFF_FontRecDict): Add `vstore_offset' field. - (CFF_Private): Add `vsindex' field. - (CFF_SubFont): Add fields for blend data. - (CFF_Font): Add `vstore' field. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar', - since glyph variation data is directly embedded. - (TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts. - -2016-12-15 Dave Arnold - Werner Lemberg - - [cff] Implement CFF2 support (1/2). - - This commit does not contain the blend code for font variation - support, which follows in another commit. - - You should ignore whitespace while inspecting this commit. - - * include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2' - member. - - * src/cff/cf2font.h (CF2_Font): Add `isCFF2' member. - - * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2' - flag. - (cf2_getMaxstack): New function. - * src/cff/cf2ft.h: Updated. - - * src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum. - (cf2_interpT2CharString): Handle CFF2 differences. - Add tracing message for errors. - - * src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index): - Update for CFF2. - - * src/cff/cffload.c (FT_FIXED_ONE): New macro. - (cff_index_init, cff_index_load_offsets, cff_index_access_element, - cff_index_get_name, cff_ft_select_get, cff_load_private_dict, - cff_subfont_load, cff_font_load): Handle CFF2. - * src/cff/cffload.h: Updated. - - * src/cff/cffobjs.c (cff_face_init): Handle CFF2. - - * src/cff/cffparse.c (cff_parse_maxstack): New function. - (CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed - * src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New - macros. - (CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New - macros. - - * src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend - stuff). - - * src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field. - (CFF_FontRecDict): Add `maxstack' field. - (CFF_Private): Add `subfont' field. - (CFF_Font): Add `top_dict_length' and `cff2' fields. - - * src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table. - -2016-12-15 Werner Lemberg - Dave Arnold - - [truetype] Provide HVAR advance width variation as a service. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent - double adjustment of advance width. - - * src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (tt_face_get_metrics): Apply metrics variations. - -2016-12-15 Dave Arnold - Werner Lemberg - - [truetype] Provide function to apply `HVAR' advance width variation. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): New function. - * src/truetype/ttgxvar.h: Updated. - -2016-12-15 Dave Arnold - Werner Lemberg - - [truetype] Add `HVAR' table parsing. - - Note that this is not complete yet; it only handles advance width - variation. - - Activation of the code follows in another commit. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member. - - * src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion, - GX_HVStore, GX_WidthMap): New auxiliary structures for... - (GX_HVarTable): ... HVAR main structure. - (GX_BlendRec): Add data for HVAR loading. - - * src/truetype/ttgxvar.c (FT_FIXED_ONE, FT_fdot14ToFixed, - FT_intToFixed, FT_fixedToInt): New macros. - (ft_var_load_hvar): New function. - (TT_Get_MM_Var): Updated. - (tt_done_blend): Deallocate HVAR data. - -2016-12-15 Dave Arnold - - [cff] Extend number parsing. - - The forthcoming CFF2 support needs a dynamic parsing limit. - - * src/cff/cffparse.c (cff_parse_num, do_fixed, cff_parse_fixed, - cff_parse_fixed_scaled, cff_parse_fixed_dynamic): Add argument for - parser. - (cff_parse_font_matrix, cff_parse_font_bbox, cff_parse_private_dict, - cff_parse_multiple_master, cff_parse_cid_ros, cff_parser_run): Updated. - - * src/cff/cffparse.h (cff_parse_num): Export locally. - -2016-12-15 Dave Arnold - - [cff] Implement dynamic stack size for Adobe engine. - - This also adds `cf2_stack_setReal' and `cf2_stack_pop', needed for - the forthcoming CFF2 support. - - * src/cff/cf2stack.c (cf2_stack_init): Add argument for stack size. - (cf2_stack_free): Deallocate stack. - (cf2_stack_count, cf2_stack_pushInt, cf2_stack_pushFixed, - cf2_stack_popInt, cf2_stack_popFixed, cf2_stack_getReal, - cf2_stack_clear): Updated. - (cf2_stack_setReal, cf2_stack_pop): New functions. - - * src/cff/cf2stack.h (CF2_Stack): Add `stackSize' member. - Update function declarations. - - * src/cff/cf2intrp.c (cf2_interpT2CharString): Updated. - - * src/cff/cffparse.c (cff_parser_init): Add parameter for stack - size; return error code. - (cff_parser_done): New function. - (cff_parser_run): Updated. - - * src/cff/cffparse.h (CFF_Parser): Add `stackSize' member and make - `stack' a pointer. - Update function declarations. - - * src/cff/cffload.c (cff_load_private_dict, cff_subfont_load): - Updated. - -2016-12-15 Dave Arnold - Werner Lemberg - - [cff] Code shuffling. - - * src/cff/cfftypes.h (CFF_Font): Add `library' and `base_offset' - fields. - - * src/cff/cffload.c (cff_subfont_load): Change last argument to - `CFF_Font' - Split off parsing of private dictionary into... - (cff_load_private_dict): ...this new function. - (cff_font_load): Updated. - -2016-12-14 Werner Lemberg - - [sfnt, truetype] Add framework for Metrics Variations service. - - No effect yet; service functions will be implemented later on. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * include/freetype/internal/services/svmetric.h: New file. - - * include/freetype/internal/ftserv.h - (FT_SERVICE_METRICS_VARIATIONS_H): New macro. - - * include/freetype/internal/tttypes.h (TT_Face): New field `var'. - - * src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (sfnt_init_face): Initialize `face->var'. - - * src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (tt_service_metrics_variations): New service. - (tt_services): Updated. - - * src/truetype/ttpic.h: Updated. - -2016-12-14 Werner Lemberg - - [cff] Add Multiple Masters service. - - The code simply uses the MM functions from the `truetype' module. - - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - - * include/freetype/internal/tttypes.h (TT_Face): New field `mm'. - - * src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. - (cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var, - cff_set_var_design, cff_get_var_design): New functions. - (cff_service_multi_masters): New service. - (cff_services): Updated. - - * src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New - functions. - * src/cff/cffload.h: Updated. - - * src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro. - - * src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. - (sfnt_init_face): Initialize `face->mm'. - -2016-12-14 Werner Lemberg - - Extend functionality of `ft_module_get_service'. - - It can now differentiate between local and global searches. - - * src/base/ftobjs.c (ft_module_get_service): Add `global' argument. - (FT_Get_TrueType_Engine_Type): Updated. - - * src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated. - - * include/freetype/internal/ftobjs.h: Updated. - * include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE): - Updated. - -2016-12-14 Werner Lemberg - - * src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning. - -2016-12-14 Dave Arnold - Werner Lemberg - - [sfnt, cff] Minor preparations. - - * include/freetype/tttags.h (TTAG_CFF2, TTAG_HVAR, TTAG_MVAR, - TTAG_VVAR): New SFNT table tags. - - * src/cff/cf2fixed.h (CF2_FIXED_ONE, CF2_FIXED_EPSILON): Add cast. - -2016-12-10 Werner Lemberg - - [truetype, type1] Add `get_var_blend' to MM service. - - For internal use; we want to share code between the forthcoming CFF2 - support and TrueType. - - * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): - New typedef. - (MultiMasters): Add `get_var_blend'. - (FT_Service_MultiMasters): Updated. - - * src/truetype/ttgxvar.c (tt_get_var_blend): New function. - * src/truetype/ttgxvar.h: Updated. - - * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. - * src/type1/t1driver.c (t1_service_multi_masters): Updated. - -2016-12-10 Werner Lemberg - - [truetype, type1] Add `done_blend' to MM service. - - For internal use; we want to share code between the forthcoming CFF2 - support and TrueType. - - * include/freetype/internal/services/svmm.h (FT_Done_Blend_Func): - New typedef. - (MultiMasters): Add `done_blend'. - (FT_Service_MultiMasters): Updated. - - * src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument. - * src/truetype/ttgxvar.h: Updated. - - * src/truetype/ttobjs.c (TT_Face_Done): Updated. - - * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. - * src/type1/t1driver.c (t1_service_multi_masters): Updated. - -2016-12-09 Werner Lemberg - - [sfnt] Revert change from 2016-12-08. - - I missed the functionality of `ft_module_get_service', which makes - the change unnecessary. - -2016-12-08 Werner Lemberg - - Add framework to support services with 8 functions. - - We will need this for CFF variation font support. - - * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC8): - New macro. - -2016-12-08 Werner Lemberg - - [sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface. - - CFF2 fonts will need access to those two functions. - - * include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H. - (SFNT_Interface): Add `get_glyph_name' and `get_name_index' members. - (FT_DEFINE_SFNT_INTERFACE): Updated. - - * src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index): - Fix signatures to exactly correspond to the glyph dict service - function typedefs. - (sfnt_interface): Updated. - -2016-12-06 Dave Arnold - - Add `FT_Get_Var_Design_Coordinates' function. - - Note that the low-level functions aren't implemented yet. - - * include/freetype/ftmm.h: Declare. - - * include/freetype/internal/services/svmm.h - (FT_Get_Var_Design_Func): New typedef. - (MultiMasters): New MM service function `get_var_design'. - (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. - Update all callers. - - * src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement. - - * src/truetype/ttdriver.c: Updated. - - * src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to - handle `get_var_design' service. - * src/truetype/ttgxvar.h: Updated. - - * src/type1/t1driver.c: Updated. - - * src/type1/t1load.c (T1_Get_Var_Design): New dump function to - handle `get_var_design' service. - * src/type1/t1load.h: Updated. - -2016-12-06 Werner Lemberg - - * src/type1/t1load.c (parse_subrs): Fix memory leak. - - The `subrs' keyword might erroneously occur multiple times. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=231 - -2016-12-01 Werner Lemberg - - [gzip] Improve building with external zlib (#49673). - - Building FreeType with external zlib 1.2.8 makes msvc 14 stop with - the following error. - - ftgzip.c - zlib-1.2.8\zlib.h(86): error C2061: - syntax error: identifier 'z_const' - zlib-1.2.8\zlib.h(94): error C2054: - expected '(' to follow 'z_const' - zlib-1.2.8\zlib.h(94): error C2085: - 'msg': not in formal parameter list - ... - zlib-1.2.8\zlib.h(877): fatal error C1003: - error count exceeds 100; stopping compilation - - The error happens because FreeType keeps an own copy of zlib-1.1.4 - under `src/gzip'. When building `src/gzip/ftgzip.c' with - FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses - - #include - - which correctly finds an external `zlib.h', but `zlib.h' itself has - a line - - #include "zconf.h" - - which makes Visual Studio 2015 find `src/gzip/zconf.h' while - compiling the files in `src/gzip'. - - * src/gzip/zconf.h: Rename to... - * src/gzip/ftzconf.h: ... this. - * src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated. - -2016-12-01 Oleksandr Chekhovskyi - - [autofit] Fix Emscripten crash (patch #9180). - - Function calls through pointers must use a matching signature to - work on Emscripten, since such calls are dispatched through lookup - tables grouped by signature. - - * src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Fix - typedef. - -2016-11-29 Werner Lemberg - - [smooth] Revert previous commit. Already fixed with 6ca54c64. - -2016-11-29 Werner Lemberg - - [smooth] Avoid conditional jump on uninitialized value (#49711). - - * src/smooth/ftgrays.c (gray_raster_render): Initialize `worker'. - -2016-11-27 Nikolaus Waxweiler - - [autofit] Code shuffling. - - Also improve some comments and remove unused code. - - No functional change. - - * src/autofit/afloader.c (af_loader_load_g): Merged with... - (af_loader_load_glyph): ...this function. - Split off emboldening code into... - (af_loader_embolden_glyph_in_slot): ... this function. - -2016-11-17 Werner Lemberg - - Better support of LLP64 systems with gcc (and clang). - - * builds/unix/configure.raw: Call `AC_TYPE_LONG_LONG_INT'. - - * builds/unix/ftconfig.in (FT_LONG64): Enable for LLP64 systems (and - suppress warnings) even without `FT_CONFIG_OPTION_FORCE_INT64'. - -2016-11-10 Werner Lemberg - - Fix `lcd_weights' array size. - - * include/freetype/internal/ftobjs.h (FT_LibraryRec): Do it. - - Reported by Nikolaus. - -2016-11-06 Werner Lemberg - - * src/base/ftobjs.c (FT_Render_Glyph_Internal): Fix tracing. - -2016-11-06 Werner Lemberg - - [sfnt] Improve FT_LOAD_BITMAP_METRICS_ONLY for `sbix' format. - - It's unavoidable to call the PNG engine, but to get the metrics it - is sufficient to read the PNG image's header only. - - * src/sfnt/pngshim.c (Load_SBit_Png): Add argument to control the - allocation of the glyph slot. - * src/sfnt/pngshim.h: Updated. - * src/sfnt/ttsbit.c (tt_sbit_decoder_load_png, - tt_face_load_sbix_image, tt_face_load_sbit_image): Updated. - -2016-11-06 Werner Lemberg - - [sfnt] Speed up `sbix' lookup. - - This also fixes a bug introduced in 2016-10-01 which prevents - display of embedded bitmap fonts that use the `sbix' format. - - * src/sfnt/ttsbit.c (tt_face_load_sbit): Store `sbix' size and - offset also in `ebdt_size' and `ebdt_start', respectively. This - makes the test for an embedded bitmap data table succeed for this - format. - - (tt_face_load_strike_metrics) : Use - `ebdt_size' and `ebdt_start' - (tt_face_load_sbix_image): Ditto. - -2016-11-06 Seigo Nonaka - Werner Lemberg - - Introduce a way of quickly retrieving (embedded) bitmap metrics. - - `FT_Load_Glyph' doesn't generate a bitmap for a non-bitmap glyph - until the user calls `FT_Render_Glyph'. However, it always - allocates memory for bitmaps and copies or decodes the contents of a - bitmap glyph, which can be quite slow for PNG data. - - * include/freetype/freetype.h (FT_LOAD_BITMAP_METRICS_ONLY): New - macro. - - * src/base/ftobjs.c (FT_Load_Glyph): Unset FT_LOAD_RENDER if - FT_LOAD_BITMAP_METRICS_ONLY is used. - - * src/sfnt/ttsbit.c (tt_sbit_decoder_alloc_bitmap, - tt_sbit_decoder_load_bitmap): Add argument to control allocation of - the glyph slot. - (tt_sbit_decoder_load_image, tt_sbit_decoder_load_compound, - tt_face_load_sbit_image): Updated. - - * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Quickly exit if - `FT_LOAD_BITMAP_METRICS_ONLY' is set. - - * src/pfr/pfrsbit.c, src/pfr/pfrsbit.h (pfr_slot_load_bitmap): Add - argument to control allocation of the glyph slot. - * src/pfr/pfrobjs (pfr_slot_load): Updated. - - * src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto. - - * docs/CHANGES: Updated. - -2016-11-06 Werner Lemberg - - Synchronize with gnulib (#49448). - - * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in, - builds/vms/ftconfig.h (FT_TYPEOF): Update code to use definition in - current version of `intprops.h'. - Other minor synchronization to reduce code differences between the - three files. - -2016-11-03 Behdad Esfahbod - - [truetype] Clamp variation requests to valid range. - - This is required by OpenType 1.8; it also avoids rounding surprises. - - * src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates - outside of the allowed range to always stay within the range instead - of producing an error. - -2016-10-29 Werner Lemberg - - [truetype] Remove clang warnings. - - * src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for - loop counter handling. - - * src/truetype/ttinterp.c: Updated. - (Ins_SCANTYPE): Use signed constant. - (TT_RunIns): Ensure `num_twilight_points' is 16bit. - -2016-10-27 Werner Lemberg - - [truetype] Fix commit from 2014-11-24. - - Problem reported by Hin-Tak Leung . - - * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking - logic. - -2016-10-26 Werner Lemberg - - Add `FT_Get_{MM,Var}_Blend_Coordinates' functions. - - * include/freetype/ftmm.h: Declare. - - * include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func): - New typedef. - (MultiMasters): New MM service function `get_mm_blend'. - (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. - Update all callers. - - * src/base/ftmm.c (FT_Get_MM_Blend_Coordinates, - FT_Get_Var_Blend_Coordinates): Implement. - - * src/truetype/ttdriver.c: Updated. - - * src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle - `get_mm_blend' service. - * src/truetype/ttgxvar.h: Updated. - - * src/type1/t1driver.c: Updated. - - * src/type1/t1load.c (T1_Get_MM_Blend): New function to handle - `get_mm_blend' service. - * src/type1/t1load.h: Updated. - - * docs/CHANGES: Document. - -2016-10-26 Werner Lemberg - - * src/type1/t1load.c (parse_subrs): Fix limit check. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81 - -2016-10-25 Alexei Podtelezhnikov - - [cff] Correct cmap format reporting (#24819). - - * src/cff/cffdrivr.c (cff_get_cmap_info): Throw an error on synthetic - charmap instead of guessing its format and language. - -2016-10-22 Werner Lemberg - - [truetype] Fix SCANTYPE instruction (#49394). - - * src/truetype/ttinterp.c (Ins_SCANTYPE): Only use lower 16bits. - -2016-10-22 Werner Lemberg - - [sfnt] Improve handling of invalid post 2.5 tables [#49393]. - - * src/sfnt/ttpost.c (load_format_25): We need at least a single - table entry. - -2016-10-14 Werner Lemberg - - [truetype] Fix handling of `cvar' table data. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53 - - * src/truetype/ttgxvar.c (tt_face_vary_cvt): Ignore invalid CVT - indices. - -2016-10-11 Werner Lemberg - - [psaux] Fix handling of invalid flex subrs. - - Problem reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52 - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings) - : Set `flex_state' after error checking. - -2016-10-11 Werner Lemberg - - * src/truetype/ttgxvar.c (tt_done_blend): Fix deallocation. - -2016-10-08 Werner Lemberg - - * src/cid/cidload.c (cid_face_open): Properly propagate `error'. - -2016-10-08 Werner Lemberg - - [cid] Fix parsing of subr offsets. - - Bug introduced 2016-05-16. - - * src/cid/cidparse.c (cid_parser_new): Fix off-by-one error. - -2016-10-01 Werner Lemberg - - [sfnt] Disable bitmap strikes if we don't have a bitmap data table. - - * src/sfnt/ttsbit.c (tt_face_load_sbit): Check whether we have - a bitmap data table. - -2016-10-01 Alexei Podtelezhnikov - - [smooth] Remove impossibility. - - * src/smooth/ftgrays.c (TWorker): Rearrange fields. - (gray_convert_glyph): Remove impossible condition and clean up. - -2016-09-29 Werner Lemberg - - [pcf] Enrich family name with foundry name and glyph width info. - - This is a very old patch from openSuSE (from 2006, submitted to - FreeType in 2011) that I forgot to apply. - - https://build.opensuse.org/package/view_file/openSUSE:Factory/freetype2/freetype2-bitmap-foundry.patch - - Prepend the foundry name plus a space to the family name. There are - many fonts just called `Fixed' which look completely different, and - which have nothing to do with each other. When selecting `Fixed' in - KDE or Gnome one gets results that appear rather random, the style - changes often if one changes the size and one cannot select some - fonts at all. - - We also check whether we have `wide' characters; all put together, - we get family names like `Sony Fixed' or `Misc Fixed Wide'. - - * src/pcf/pcfread.c (pcf_load_font): Implement it. - - * docs/CHANGES: Document it. - -2016-09-29 Werner Lemberg - - [ftfuzzer] Speed up. - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Don't - check for embedded bitmaps if we have a non-default instance. - -2016-09-29 Werner Lemberg - - [truetype] Disallow bitmap strikes for non-default instances. - - Also speed up access of default instances if GX variations are - active. - - * include/freetype/internal/tttypes.h (TT_FaceRec): Add - `is_default_instance' member. - - * src/sfnt/sfobjs.c (sfnt_init_face): Initialize - `is_default_instance'. - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Add test for default instance. - (TT_Load_Glyph): Load embedded bitmaps for default instance only. - - * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Compute - `is_default_instance'. - -2016-09-29 Werner Lemberg - - [truetype] Clean up `TT_Face' structure. - - * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused - fields `horz_metrics' and `vert_metrics'. - Update documentation. - - * src/sfnt/sfobjs.c (sfnt_done_face): Updated. - -2016-09-28 Werner Lemberg - - More FT_ZERO usage. - - * src/gxvalid/gxvcommn.c (gxv_ClassTable_validate): - s/ft_memset/FT_MEM_ZERO/. - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): - s/ft_memset/FT_ARRAY_ZERO/. - - * src/raster/ftraster.c (FT_ZERO): Define. - (ft_black_new): Use it. - * src/raster/ftrend1.c (ft_raster1_get_cbox): - s/FT_MEM_ZERO/FT_ZERO/. - - * src/smooth/ftgrays.c (FT_ZERO): Define. - (gray_raster_new): Use it. - * src/smooth/ftsmooth.c (ft_smooth_get_cbox): - s/FT_MEM_ZERO/FT_ZERO/. - -2016-09-28 Werner Lemberg - - */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate. - -2016-09-27 Werner Lemberg - - [truetype] Trace number of executed opcodes. - - * src/truetype/ttinterp.c (TT_RunIns): Implement it. - -2016-09-27 Werner Lemberg - - [truetype] Speed up `TT_Load_Glyph'. - - This avoids additional calls to `tt_face_lookup_table' for the - `glyf' table, which can be expensive. - - * include/freetype/internal/tttypes.h (TT_LoaderRec): Move - `glyf_offset' field to ... - (TT_FaceRec): ... this structure. - * src/truetype/ttgload.c (load_truetype_glyph): Updated. - (tt_loader_init): Move initialization of `glyf_offset' to ... - * src/truetype/ttpload.c (tt_face_load_loca): ... this function. - -2016-09-27 Werner Lemberg - - [truetype] Introduce dynamic limits for some bytecode opcodes. - - This speeds up FreeType's handling of malformed fonts. - - * src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number - of twilight points, the total number of negative jumps, and the - total number of loops in LOOPCALL opcodes. The values are based on - the number of points and entries in the CVT table. - (Ins_JMPR): Test negative jump counter. - (Ins_LOOPCALL): Test loopcall counter. - - * src/truetype/ttinterp.h (TT_ExecContext): Updated. - - * docs/CHANGES: Updated. - -2016-09-25 Werner Lemberg - - [truetype] Sanitize only last entry of `loca' table. - - Without this patch, a loca sequence like `0 100000 0 100000 ...', - where value 100000 is larger than the `glyf' table size, makes - FreeType handle the whole `glyf' table as a single glyph again and - again, which is certainly invalid (and can be very slow, too). - - * src/truetype/ttpload.c (tt_face_get_location): Implement. - Improve tracing messages. - -2016-09-25 Werner Lemberg - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Fix typo. - -2016-09-24 Werner Lemberg - - [autofit] Tracing fixes. - - * src/autofit/afmodule.c (af_autofitter_load_glyph): Call dumping - functions only if we actually do tracing. - -2016-09-22 Alexei Podtelezhnikov - - [smooth] Reduce divisions in the line renderer. - - We don't need some divisions if a line segments stays within a single - row or a single column of pixels. - - * src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions - conditional. - -2016-09-15 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table. - -2016-09-14 Alexei Podtelezhnikov - - [smooth] Another tiny speed-up. - - * src/smooth/ftgrays.c (gray_find_cell): Merge into... - (gray_record_cell): ... this function. - -2016-09-11 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code. - -2016-09-11 Alexei Podtelezhnikov - - [smooth] Fix valgrind warning and reoptimize. - - The algorithm calls `gray_set_cell' at the start of each new contour - or when the contours cross the cell boundaries. Double-checking for - that is wasteful. - - * src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell. - (gray_convert_glyph): Remove initialization introduced by 44b172e88. - -2016-09-10 Werner Lemberg - - [sfnt] Fix previous commit. - - Problems reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40 - - We now map the strike index right before accessing the physical - data, not earlier. - - * src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map' - after creating the map so that... - - * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function - can be used before and after setting up `sbit_strike_map'. - (tt_face_set_sbit_strike): Revert change. - (tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index. - - * src/truetype/ttdriver.c (tt_size_select): Revert change. - -2016-09-09 Werner Lemberg - - [ftfuzzer] Minor improvements. - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Ignore - invalid strikes. - Use better values for call to `FT_Set_Char_Size'. - -2016-09-09 Werner Lemberg - - [sfnt] Don't provide (completely) broken strike data. - - FreeType tries to sanitize strike header data; we now reject - completely broken ones. - - * include/freetype/internal/tttypes.h (TT_FaceRec): New - `sbit_strike_map' array pointer. - - * src/base/ftobjs.c (FT_Match_Size): Reject matches where either - width or height would be zero. - Add tracing message in case of error. - - * src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map', - only using (more or less) valid strike header data for - FT_Face's `available_sizes' array. - (sfnt_done_face): Updated. - - * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use - `sbit_strike_map'. - (tt_face_load_strike_metrics): Improve tracing. - - * src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'. - -2016-09-08 Werner Lemberg - - * Version 2.7 released. - ======================= - - - Tag sources with `VER-2-7'. - - * docs/VERSION.TXT: Add entry for version 2.7. - - * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, - builds/windows/vc2005/index.html, - builds/windows/vc2008/freetype.vcproj, - builds/windows/vc2008/index.html, - builds/windows/vc2010/freetype.vcxproj, - builds/windows/vc2010/index.html, - builds/windows/visualc/freetype.dsp, - builds/windows/visualc/freetype.vcproj, - builds/windows/visualc/index.html, - builds/windows/visualce/freetype.dsp, - builds/windows/visualce/freetype.vcproj, - builds/windows/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.6.5/2.7/, s/265/27/. - - * include/freetype/freetype.h (FREETYPE_MINOR): Set to 7. - (FREETYPE_PATCH): Set to 0. - - * builds/unix/configure.raw (version_info): Set to 18:6:12. - * CMakeLists.txt (VERSION_MINOR): Set to 7. - (VERSION_PATCH): Set to 0. - - * docs/CHANGES: Updated. - -2016-09-08 Werner Lemberg - - * src/truetype/ttinterp.c: Include `ttgxvar.h'. - - This fixes the `multi' build. - -2016-09-08 Werner Lemberg - - [autofit] Another improvement to Armenian support. - - Suggested by Hrant H Papazian . - - * src/autofit/afscript.h: Use better suited characters to derive - default stem widths. - -2016-09-07 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_hline): Micro-optimize. - -2016-09-06 Alexei Podtelezhnikov - - [smooth] Operate in absolute bitmap coordinates. - - Simpler bitmap addressing improves performance by 1.5%. - - * src/smooth/ftgrays.c (gray_TWorker): Remove count fields. - (gray_dump_cells, gray_find_cell, gray_set_cell, gray_hline, - gray_sweep, gray_convert_glyph, gray_raster_render): Updated. - -2016-09-06 Alexei Podtelezhnikov - - [smooth] Improve contour start (take 2). - - * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly - instead of... - (gray_start_cell): ... this function, which is removed. - (gray_convert_glyph): Make initial y-coordinate invalid. - -2016-09-06 Werner Lemberg - - [type1] MM fonts support exactly zero named instances (#48748). - - * src/type1/t1load.c (T1_Get_MM_Var): Set `num_namedstyles' to zero. - -2016-09-06 Jonathan Kew - - [cff] Fix uninitialized memory. - - Problem reported as - - https://bugzilla.mozilla.org/show_bug.cgi?id=1270288 - - * src/cff/cf2intrp.c (cf2_interpT2CharString): Initialize `storage' - array to handle a `get' opcode without a previous `put'. - -2016-09-05 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_move_to, gray_start_cell): Revert. - -2016-09-05 Alexei Podtelezhnikov - - [smooth] Improve contour start. - - * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly - instead of... - (gray_start_cell): ... this function, which is removed. - -2016-09-05 Werner Lemberg - - [cff] Fix memory initialization. - - * src/cff/cf2stack.c (cf2_stack_init): Use `FT_NEW'. The `Q' - variants of FreeType's memory allocation macros don't do zeroing. - -2016-09-05 Werner Lemberg - - [ftrandom] Minor improvements. - - * src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): New macro, set to - 500. - - * src/tools/ftrandom/Makefile (CFLAGS): Split off include - directories to ... - (INCLUDES): ... this new variable. - (LDFLAGS): New variable. - (ftrandom.o, ftrandom): Updated. - -2016-09-05 Werner Lemberg - - [autofit] Improve Armenian support. - - Thanks to Hrant H Papazian for help. - - * src/autofit/afblue.dat (AF_BLUE_STRING_ARMENIAN_*): Improve - selection of characters. - - * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. - -2016-09-04 Werner Lemberg - - [ftrandom] Improve Makefile. - - It now supports both a normal build (`./configure && make') and a - development build (`make devel'). - - * src/tools/ftrandom/Makefile (VPATH): Set it so that - `libfreetype.a' gets searched in both `objs' (for the development - build) and `objs/.libs' (for a normal build which uses libtool). - (LIBS): Add missing libraries. - (ftrandom.o): New rule. - (ftrandom): Use automatic variables. - -2016-09-03 Werner Lemberg - - [truetype] More fixes for handling of GX deltas. - - Problems reported by Bob Taylor . - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix rough - sanity test for glyph variation array header size. - Always set stream position before reading packed x and y deltas. - Fix thinko w.r.t. `localpoints' array. - -2016-09-03 Werner Lemberg - - [ftrandom] Various fixes. - - * src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better - default. - (error_fraction): Make it of type `double' to work as advertized – - this was completely broken. - Update all related code. - (error_count, fcnt): Make it unsigned to fix compiler warnings. - Update all related code. - (fontlist): Change `len' member to `long' to fix compiler warnings. - (FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag - unused variables. - (TestFace, FindFonts, copyfont, do_test): Fix compiler warnings. - (ExecuteTest): Ditto. - Call `FT_Done_FreeType'. - (getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned - int'. - (usage): Improve output. - (main): Fix compiler warnings. - - * src/tools/ftrandom/README: Updated. - -2016-09-03 Werner Lemberg - - [base] Avoid negative bitmap strike dimensions (#48985). - - * src/base/ftobjs.c (FT_Open_Face): Check whether negation was - actually successful. For example, this can fail for value - -32768 if the type is `signed short'. If there are problems, - disable the strike. - -2016-09-03 Werner Lemberg - - [cff] Avoid null pointer passed to FT_MEM_COPY (#48984). - - * src/cff/cffload.c (cff_index_get_name): Check `byte_len'. - -2016-09-02 Werner Lemberg - - [unix] Enable 64bit support in file system access (#48962). - - * builds/unix/configure.raw: Call `AC_SYS_LARGEFILE'. - -2016-09-02 Werner Lemberg - - [sfnt] Avoid left shift of negative value (#48980). - - * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Use unsigned - constant. - -2016-09-02 Werner Lemberg - - * src/smooth/ftgrays.c (gray_hline): Fix clang compiler warnings. - -2016-09-02 Werner Lemberg - - Some preparations for the next release. - - * include/freetype/config/ftoption.h - (TT_CONFIG_OPTION_SUBPIXEL_HINTING): Enable. - - * docs/CHANGES: Updated. - -2016-09-01 Alexei Podtelezhnikov - - [smooth] Simplify span rendering more. - - It turns out that there is significant cost associated with `FT_Span' - creation and calls to `gray_render_span' because it happens so - frequently. This removes these steps from our internal use but leaves - it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain - is about 5%. - - * src/smooth/ftgrays.c (gray_render_span): Removed. The code is - migrated to... - (gray_hline): ... here. - -2016-08-30 Alexei Podtelezhnikov - - [smooth] Streamline pixmap drawing a bit more. - - Zero coverage is unlikely (1 out of 256) to warrant checking. This - gives 0.5% speed improvement in rendering simple glyphs. - - * src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks. - -2016-08-29 Alexei Podtelezhnikov - - [smooth] Streamline pixmap drawing. - - This gives 2% speed improvement in rendering simple glyphs. - - * src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a - pointer to its bottom-left and pitch to be used in... - (gray_TWorker): ... here. - (gray_render_span): Move pixmap flow check from here... - (gray_raster_render): .. to here. - -2016-08-27 Alexei Podtelezhnikov - - [smooth] Reduce stack of band boundaries. - - * src/smooth/ftgrays.c (gray_TBand): Removed. - (gray_convert_glyph): Updated to stack band boundaries concisely. - -2016-08-26 Werner Lemberg - - * src/cid/cidload.c (cid_face_open): Improve handling of `SDBytes'. - -2016-08-26 Werner Lemberg - - [cid] Fix commit from 2016-05-16. - - * src/cid/cidparse.c (cid_parser_new): Fix off-by-one errors. - -2016-08-26 Werner Lemberg - - [sfnt] Cache offset and size to bitmap data table. - - This commit avoids `EBDT' and friends being looked up again and - again while loading a single embedded bitmap. - - * include/freetype/internal/tttypes.h (TT_FaceRec) - [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and - `ebdt_size'. - - * src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ... - (tt_face_load_sbit): ... this function; also store the table size - and offset. - -2016-08-26 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_raster_render): Minor tweaks. - -2016-08-26 Werner Lemberg - - [type1] Fix heap buffer overflow. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36 - - * src/type1/t1load.c (parse_charstrings): Reject fonts that don't - contain glyph names. - -2016-08-25 Werner Lemberg - - [sfnt] Fix previous commit (#48901). - - * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Thinkos. - -2016-08-25 Werner Lemberg - - [sfnt] Speed up handling of invalid format 4 cmaps. - - * src/sfnt/ttcmap.c (tt_cmap4_next, tt_cmap4_char_map_binary): Add - tests for `num_glyph' from `tt_cmap4_char_map_linear'. - -2016-08-25 Werner Lemberg - - * include/freetype/internal/ftdriver.h: Remove unused typedefs. - -2016-08-22 Alexei Podtelezhnikov - - [smooth] Simplify span rendering. - - This removes unnecessary complexity of span merging and buffering. - Instead, the spans are rendered as they come, speeding up the - rendering by about 5% as a result. - - * src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed. - (gray_TWorker): Remove span buffer and related fields. - (gray_sweep, gray_hline): Updated. - - * include/freetype/ftimage.h: Remove documentation note about - `FT_MAX_GRAY_SPANS', which was never in `ftoption.h' and is now gone. - -2016-08-16 Werner Lemberg - - [truetype] Fix `MPS' instruction. - - According to Greg Hitchcock, MPS in DWrite really returns the point - size. - - * src/truetype/ttobjs.h (TT_SizeRec): Add `point_size' member. - - * src/truetype/ttdriver.c (tt_size_request): Set `point_size'. - - * src/truetype/ttinterp.h (TT_ExecContextRec): Add `pointSize' - member. - - * src/truetype/ttinterp.c (TT_Load_Context): Updated. - (Ins_MPS): Fix instruction. - -2016-08-16 Werner Lemberg - - [lzw] Optimize last commit. - - * src/lzw/ftzopen.c (ft_lzwstate_get_code): Move check into - conditional clause. - -2016-08-16 Werner Lemberg - - [lzw] Avoid invalid left shift. - - Reported as - - https://bugzilla.mozilla.org/show_bug.cgi?id=1295366 - - * src/lzw/ftzopen.c (ft_lzwstate_get_code): Limit `num_bits'. - -2016-08-16 Werner Lemberg - - [lzw] Avoid buffer overrun. - - Reported as - - https://bugzilla.mozilla.org/show_bug.cgi?id=1273283 - - * src/lzw/ftzopen.c (ft_lzwstate_refill): Ensure `buf_size' doesn't - underflow. - -2016-08-16 Werner Lemberg - - [truetype] Fix compiler warning. - - * src/truetype/ttgload.c (load_truetype_glyph): Add cast. - -2016-08-13 Werner Lemberg - - [winfonts] Avoid zero bitmap width and height. - - Reported as - - https://bugzilla.mozilla.org/show_bug.cgi?id=1272173 - - * src/winfonts/winfnt.c (FNT_Face_Init): Check zero pixel height. - (FNT_Load_Glyph): Check for zero pitch. - -2016-08-11 Alexei Podtelezhnikov - - * src/truetype/ttinterp.c (Pop_Push_Count): Revert changes. - -2016-08-11 Alexei Podtelezhnikov - - * src/truetype/ttinterp.c (TT_RunIns): Minor and formatting. - -2016-08-11 Alexei Podtelezhnikov - - * src/truetype/ttinterp.c (Pop_Push_Count): Fix some entries. - -2016-08-10 Peter Klotz - - * src/smooth/ftgrays.c (gray_hline): Fix uninitialized access. - -2016-08-10 Werner Lemberg - - [sfnt] Use correct type for `italicAngle' field (#48732). - - * src/sfnt/ttload.c (tt_face_load_post): Fix types. - -2016-08-06 Jon Spencer - - [sfnt] Fix `FT_Get_Advance' for bitmap strikes. - - `FT_Get_Advance' returns 0 for bitmap fonts. It first gets the - advance value from the font table and then scales it by the - `font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't - set that value for bitmap fonts and the advance gets scaled to zero. - - Taken from - - https://github.com/behdad/harfbuzz/issues/252 - - * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) - : Set scale values. - -2016-08-06 Behdad Esfahbod - - [truetype] Fix GX variation handling of composites. - - * src/truetype/ttgload.c (load_truetype_glyph) - [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check `ARGS_ARE_XY_VALUES' flag. - -2016-08-05 Alexei Podtelezhnikov - - [smooth] Minor refactoring. - - * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line): - Updated. - -2016-07-29 Werner Lemberg - - [sfnt, truetype] Don't abort on invalid `maxComponentDepth'. - - Since 2016-05-16 we detect infinite recursion directly. - - * src/sfnt/ttload.c (tt_face_load_maxp): Don't adjust - `maxComponentDepth'. - * src/truetype/ttgload.c (load_truetype_glyph): Don't abort if - `maxComponentDepth' is not valid. Instead, simply adjust its value - and emit a tracing message. - -2016-07-26 Werner Lemberg - - * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor. - - No functional change. - -2016-07-22 Hin-Tak Leung - - [truetype] Record the end of IDEFs. - - To match the logic in FDEF. The value of the end is only used for - bound-checking in `Ins_JMPR', so it may not have been obvious that - it was not recorded. Tested (as part of Font Validator 2.0) all the - fonts on Fedora and did not see any change. - - * src/truetype/ttinterp.c (Ins_IDEF): Updated. - -2016-07-19 Werner Lemberg - - [truetype] Sanitizer fix, second try. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary - tests and use only one slot more. - -2016-07-19 Werner Lemberg - - [truetype] Sanitizer fix. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Increase array - to fix nested loops. - -2016-07-18 Werner Lemberg - - [truetype] Make GETDATA work only for GX fonts. - - * src/truetype/ttinterp.c (opcode_name): Updated. - (Ins_GETDATA): Only define for `TT_CONFIG_OPTION_GX_VAR_SUPPORT'. - (TT_RunIns): Updated. - -2016-07-17 Werner Lemberg - - [truetype] Add support for Apple's - - GETDATA[], opcode 0x92 - - bytecode instruction. It always returns 17, and we have absolutely - no idea what it is good for... - - * src/truetype/ttinterp.c (Pop_Push_Count, opcode_name): Updated. - (Ins_GETDATA): New function. - (TT_RunIns): Add it. - -2016-07-16 Werner Lemberg - - [truetype] Add bytecode support for GX variation fonts. - - This commit implements undocumented (but confirmed) stuff from - Apple's old bytecode engine. - - GETVARIATION[], opcode 0x91 - This opcode pushes normalized variation coordinates for all axes - onto the stack (in 2.14 format). Coordinate of first axis gets - pushed first. - - GETINFO[], selector bit 3 - If GX variation support is enabled, bit 10 of the result is set - to 1. - - * src/truetype/ttinterp.c: Include FT_MULTIPLE_MASTERS_H. - (opcode_name) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. - (Ins_GETINFO) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle selector - bit 3, checking support for variation glyph hinting. - (Ins_GETVARIATION) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function - to implement opcode 0x91. - (TT_RunIns) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle opcode 0x91. - -2016-07-16 Werner Lemberg - - [truetype] Fix GETINFO bytecode instruction. - - * src/truetype/ttinterp.c (Ins_GETINFO): Fix return value for - stretching information. - -2016-07-16 Behdad Esfahbod - - [truetype] Make all glyphs in `Zycon' GX font work. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary - tests. - -2016-07-16 Werner Lemberg - - [truetype] Fix GX delta tracing. - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Trace - relative point movements. - -2016-07-16 Behdad Esfahbod - - [truetype] More fixes for GX. - - This finally fixes the rendering of the cyclist and the lizard in - the `Zycon' font. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point - index is always cumulative. - - (tt_handle_deltas): Rename to... - (tt_interpolate_deltas): ... This. - Add new parameter for output point array. - Update caller. - - (TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds - the intermediate results of `tt_interpolate_deltas' that are to be - added to `outline->points'. - -2016-07-15 Werner Lemberg - - * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko. - - `max_pos' is always larger than `min_pos' so `FT_ABS' is not needed. - - Reported by Alexei. - -2016-07-16 Nikolaus Waxweiler - - * src/truetype/ttinterp.c (Ins_MIRP): Fix copy-and-paste error. - - Problem reported by Hin-Tak Leung. - -2016-07-15 Werner Lemberg - - [autofit] Update and improve segment and edge tracing. - - * src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace - `delta' also. - Don't show first point of segment as a replacement for `pos'; this - is (a) misleading, since the difference to `pos' can be almost - arbitrarily large in corner cases, and (b) it is better to have all - segment data in font units instead of a single value given in output - space coordinates. - Improve layout. - (af_glyph_hints_dump_edges): Show px->units and units->px conversion - values for convenience. - Improve layout. - -2016-07-15 Werner Lemberg - - [autofit] For edges, reject segments wider than 1px (#41334). - - * src/autofit/afhints.h (AF_SegmentRec): New member `delta'. - - * src/autofit/aflatin.c (af_latin_hints_compute_segments): Compute - `delta'. - (af_latin_hints_compute_edges): Reject segments with a delta larger - than 0.5px. - -2016-07-14 Werner Lemberg - - * include/freetype/freetype.h (FT_IS_NAMED_INSTANCE): New macro. - -2016-07-14 Werner Lemberg - - [sfnt] Fix `face_index' value in `FT_Face' for named instances. - - * src/sfnt/sfobjs.c (sfnt_init_face): Don't strip off higher 16bits. - -2016-07-14 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix tracing. - -2016-07-14 Behdad Esfahbod - - [truetype] Fix gxvar delta interpolation. - - The coordinates of the base font should be used for interpolation - purposes, NOT the current points (i.e., the result of accumulation - of previous deltas). - - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize - `points_org' before looping over all tuples. - ---------------------------------------------------------------------------- -Copyright 2016-2017 by +Copyright 2016-2018 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/sdk/lib/3rdparty/freetype/README b/sdk/lib/3rdparty/freetype/README index 35324b0a784..1e7ea97d418 100644 --- a/sdk/lib/3rdparty/freetype/README +++ b/sdk/lib/3rdparty/freetype/README @@ -1,7 +1,7 @@ - FreeType 2.8.1 - ============== + FreeType 2.9 + ============ - Homepage: http://www.freetype.org + Homepage: https://www.freetype.org FreeType is a freely available software library to render fonts. @@ -20,17 +20,17 @@ documentation is available as a separate package from our sites. Go to - http://download.savannah.gnu.org/releases/freetype/ + https://download.savannah.gnu.org/releases/freetype/ and download one of the following files. - freetype-doc-2.8.1.tar.bz2 - freetype-doc-2.8.1.tar.gz - ftdoc281.zip + freetype-doc-2.9.tar.bz2 + freetype-doc-2.9.tar.gz + ftdoc29.zip To view the documentation online, go to - http://www.freetype.org/freetype2/documentation.html + https://www.freetype.org/freetype2/documentation.html Mailing Lists @@ -46,7 +46,7 @@ The lists are moderated; see - http://www.freetype.org/contact.html + https://www.freetype.org/contact.html how to subscribe. @@ -71,7 +71,7 @@ ---------------------------------------------------------------------- -Copyright 2006-2017 by +Copyright 2006-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/sdk/lib/3rdparty/freetype/autogen.sh b/sdk/lib/3rdparty/freetype/autogen.sh index 31c1534bc51..ab90e641763 100644 --- a/sdk/lib/3rdparty/freetype/autogen.sh +++ b/sdk/lib/3rdparty/freetype/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2005-2017 by +# Copyright 2005-2018 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/sdk/lib/3rdparty/freetype/configure b/sdk/lib/3rdparty/freetype/configure index 68dbd9919b4..8ee0d402957 100644 --- a/sdk/lib/3rdparty/freetype/configure +++ b/sdk/lib/3rdparty/freetype/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2002-2017 by +# Copyright 2002-2018 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/sdk/lib/3rdparty/freetype/devel/ft2build.h b/sdk/lib/3rdparty/freetype/devel/ft2build.h index c805cf98997..1d17141b2ba 100644 --- a/sdk/lib/3rdparty/freetype/devel/ft2build.h +++ b/sdk/lib/3rdparty/freetype/devel/ft2build.h @@ -4,7 +4,7 @@ /* */ /* FreeType 2 build and setup macros (development version). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/devel/ftoption.h b/sdk/lib/3rdparty/freetype/devel/ftoption.h index 79aaf4e7617..d66e6e06a86 100644 --- a/sdk/lib/3rdparty/freetype/devel/ftoption.h +++ b/sdk/lib/3rdparty/freetype/devel/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -268,48 +268,6 @@ FT_BEGIN_HEADER #define FT_CONFIG_OPTION_USE_HARFBUZZ - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* 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 */ - - /*************************************************************************/ /* */ /* Glyph Postscript Names handling */ @@ -669,7 +627,7 @@ FT_BEGIN_HEADER /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ /* defined. */ /* */ - /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ /* */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */ @@ -689,7 +647,7 @@ FT_BEGIN_HEADER /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ - /* http://www.microsoft.com/typography/otspec/glyf.htm */ + /* https://www.microsoft.com/typography/otspec/glyf.htm */ /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED @@ -786,6 +744,16 @@ FT_BEGIN_HEADER #undef T1_CONFIG_OPTION_NO_MM_SUPPORT + /*************************************************************************/ + /* */ + /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the type1 driver module. */ + /* */ +//#define T1_CONFIG_OPTION_OLD_ENGINE + + /*************************************************************************/ /*************************************************************************/ /**** ****/ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/config/ftconfig.h b/sdk/lib/3rdparty/freetype/include/freetype/config/ftconfig.h index 889aebf5ab8..031b4bfdc4b 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/config/ftconfig.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* ANSI-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -73,11 +73,11 @@ FT_BEGIN_HEADER /* The size of an `int' type. */ #if FT_UINT_MAX == 0xFFFFUL -#define FT_SIZEOF_INT (16 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT ) #elif FT_UINT_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_INT (32 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT ) #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_INT (64 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT ) #else #error "Unsupported size of `int' type!" #endif @@ -85,11 +85,11 @@ FT_BEGIN_HEADER /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ /* DM642) is recognized but avoided. */ #if FT_ULONG_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT ) #else #error "Unsupported size of `long' type!" #endif @@ -236,12 +236,12 @@ FT_BEGIN_HEADER #endif -#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT ) typedef signed int FT_Int32; typedef unsigned int FT_UInt32; -#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT ) typedef signed long FT_Int32; typedef unsigned long FT_UInt32; @@ -252,12 +252,12 @@ FT_BEGIN_HEADER /* look up an integer type that is at least 32 bits */ -#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT ) typedef int FT_Fast; typedef unsigned int FT_UFast; -#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT ) typedef long FT_Fast; typedef unsigned long FT_UFast; @@ -267,7 +267,7 @@ FT_BEGIN_HEADER /* determine whether we have a 64-bit int type for platforms without */ /* Autoconf */ -#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) +#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT ) /* FT_LONG64 must be defined if a 64-bit type is available */ #define FT_LONG64 @@ -365,6 +365,14 @@ FT_BEGIN_HEADER #endif + /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */ + /* a function that gets used only within the scope of a module. */ + /* Normally, both the header and source code files for such a */ + /* function are within a single module directory. */ + /* */ + /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */ + /* FT_LOCAL_ARRAY_DEF. */ + /* */ #ifdef FT_MAKE_OPTION_SINGLE_OBJECT #define FT_LOCAL( x ) static x @@ -386,6 +394,12 @@ FT_BEGIN_HEADER #define FT_LOCAL_ARRAY_DEF( x ) const x + /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */ + /* functions that are used in more than a single module. In the */ + /* current setup this implies that the declaration is in a header */ + /* file in the `include/freetype/internal' directory, and the */ + /* function body is in a file in `src/base'. */ + /* */ #ifndef FT_BASE #ifdef __cplusplus @@ -408,6 +422,37 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ + /* When compiling FreeType as a DLL, some systems/compilers need a */ + /* special attribute in front OR after the return type of function */ + /* declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. */ + /* */ + /* To export a variable, use FT_EXPORT_VAR. */ + /* */ #ifndef FT_EXPORT #ifdef __cplusplus @@ -416,6 +461,17 @@ FT_BEGIN_HEADER #define FT_EXPORT( x ) extern x #endif +#ifndef __REACTOS__ +#ifdef _MSC_VER +#undef FT_EXPORT +#ifdef _DLL +#define FT_EXPORT( x ) __declspec( dllexport ) x +#else +#define FT_EXPORT( x ) __declspec( dllimport ) x +#endif +#endif +#endif /* !__REACTOS__ */ + #endif /* !FT_EXPORT */ @@ -440,6 +496,7 @@ FT_BEGIN_HEADER #endif /* !FT_EXPORT_VAR */ + /* The following macros are needed to compile the library with a */ /* C++ compiler and with 16bit compilers. */ /* */ @@ -451,7 +508,13 @@ FT_BEGIN_HEADER /* functions which are accessed by (global) function pointers. */ /* */ /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ + /* FT_CALLBACK_DEF is used to _define_ a callback function, */ + /* located in the same source code file as the structure that uses */ + /* it. */ + /* */ + /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */ + /* and define a callback function, respectively, in a similar way */ + /* as FT_BASE and FT_BASE_DEF work. */ /* */ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ /* contains pointers to callback functions. */ @@ -471,6 +534,16 @@ FT_BEGIN_HEADER #endif #endif /* FT_CALLBACK_DEF */ +#ifndef FT_BASE_CALLBACK +#ifdef __cplusplus +#define FT_BASE_CALLBACK( x ) extern "C" x +#define FT_BASE_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_BASE_CALLBACK( x ) extern x +#define FT_BASE_CALLBACK_DEF( x ) x +#endif +#endif /* FT_BASE_CALLBACK */ + #ifndef FT_CALLBACK_TABLE #ifdef __cplusplus #define FT_CALLBACK_TABLE extern "C" diff --git a/sdk/lib/3rdparty/freetype/include/freetype/config/ftheader.h b/sdk/lib/3rdparty/freetype/include/freetype/config/ftheader.h index d491af57c3a..702f77cc422 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/config/ftheader.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ /* */ /* Build macros of the FreeType 2 library. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -315,6 +315,19 @@ #define FT_RENDER_H + /************************************************************************* + * + * @macro: + * FT_DRIVER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the driver modules. + * + */ +#define FT_DRIVER_H + + /************************************************************************* * * @macro: @@ -324,8 +337,10 @@ * A macro used in #include statements to name the file containing * structures and macros related to the auto-hinting module. * + * Deprecated since version 2.9; use @FT_DRIVER_H instead. + * */ -#define FT_AUTOHINTER_H +#define FT_AUTOHINTER_H FT_DRIVER_H /************************************************************************* @@ -337,8 +352,10 @@ * A macro used in #include statements to name the file containing * structures and macros related to the CFF driver module. * + * Deprecated since version 2.9; use @FT_DRIVER_H instead. + * */ -#define FT_CFF_DRIVER_H +#define FT_CFF_DRIVER_H FT_DRIVER_H /************************************************************************* @@ -350,8 +367,10 @@ * A macro used in #include statements to name the file containing * structures and macros related to the TrueType driver module. * + * Deprecated since version 2.9; use @FT_DRIVER_H instead. + * */ -#define FT_TRUETYPE_DRIVER_H +#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H /************************************************************************* @@ -363,8 +382,10 @@ * A macro used in #include statements to name the file containing * structures and macros related to the PCF driver module. * + * Deprecated since version 2.9; use @FT_DRIVER_H instead. + * */ -#define FT_PCF_DRIVER_H +#define FT_PCF_DRIVER_H FT_DRIVER_H /************************************************************************* @@ -554,63 +575,6 @@ #define FT_CACHE_H - /************************************************************************* - * - * @macro: - * FT_CACHE_IMAGE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `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 - * store small glyph bitmaps, as it will use less memory. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * glyph image-related cache declarations. - * - */ -#define FT_CACHE_IMAGE_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_CACHE_SMALL_BITMAPS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `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 - * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, - * including scalable outlines. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * small bitmaps-related cache declarations. - * - */ -#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_CACHE_CHARMAP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `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. - * - */ -#define FT_CACHE_CHARMAP_H FT_CACHE_H - - /************************************************************************* * * @macro: @@ -760,17 +724,6 @@ #define FT_LCD_FILTER_H - /************************************************************************* - * - * @macro: - * FT_UNPATENTED_HINTING_H - * - * @description: - * Deprecated. - */ -#define FT_UNPATENTED_HINTING_H - - /************************************************************************* * * @macro: @@ -809,25 +762,30 @@ /* */ + /* These header files don't need to be included by the user. */ #define FT_ERROR_DEFINITIONS_H +#define FT_PARAMETER_TAGS_H + /* Deprecated macros. */ +#define FT_UNPATENTED_HINTING_H +#define FT_TRUETYPE_UNPATENTED_H + + /* FT_CACHE_H is the only header file needed for the cache subsystem. */ +#define FT_CACHE_IMAGE_H FT_CACHE_H +#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H +#define FT_CACHE_CHARMAP_H FT_CACHE_H /* The internals of the cache sub-system are no longer exposed. We */ /* default to FT_CACHE_H at the moment just in case, but we know of */ /* no rogue client that uses them. */ /* */ -#define FT_CACHE_MANAGER_H -#define FT_CACHE_INTERNAL_MRU_H -#define FT_CACHE_INTERNAL_MANAGER_H -#define FT_CACHE_INTERNAL_CACHE_H -#define FT_CACHE_INTERNAL_GLYPH_H -#define FT_CACHE_INTERNAL_IMAGE_H -#define FT_CACHE_INTERNAL_SBITS_H - - -#define FT_INCREMENTAL_H - -#define FT_TRUETYPE_UNPATENTED_H +#define FT_CACHE_MANAGER_H FT_CACHE_H +#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H +#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H +#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H +#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H +#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H +#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H /* diff --git a/sdk/lib/3rdparty/freetype/include/freetype/config/ftoption.h b/sdk/lib/3rdparty/freetype/include/freetype/config/ftoption.h index dc78c2f4709..28888510811 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/config/ftoption.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/config/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -75,19 +75,17 @@ FT_BEGIN_HEADER /*************************************************************************/ - /*************************************************************************/ + /*#***********************************************************************/ /* */ /* If you enable this configuration option, FreeType recognizes an */ /* environment variable called `FREETYPE_PROPERTIES', which can be used */ /* to control the various font drivers and modules. The controllable */ - /* properties are listed in the section `Controlling FreeType Modules' */ - /* in the reference's table of contents; currently there are properties */ - /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */ - /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */ + /* properties are listed in the section @properties. */ /* */ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */ /* multiple lines for better readability). */ /* */ + /* { */ /* */ /* ':' */ /* '=' */ @@ -95,6 +93,7 @@ FT_BEGIN_HEADER /* ':' */ /* '=' */ /* ... */ + /* } */ /* */ /* Example: */ /* */ @@ -211,6 +210,10 @@ FT_BEGIN_HEADER /* Do not #undef this macro here since the build system might define */ /* it for certain configurations only. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ @@ -227,6 +230,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_BZIP2 */ @@ -252,6 +259,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_PNG */ @@ -265,51 +276,13 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_HARFBUZZ */ - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* 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 */ - - /*************************************************************************/ /* */ /* Glyph Postscript Names handling */ @@ -678,7 +651,7 @@ FT_BEGIN_HEADER /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ /* defined. */ /* */ - /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ /* */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 @@ -698,7 +671,7 @@ FT_BEGIN_HEADER /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ - /* http://www.microsoft.com/typography/otspec/glyf.htm */ + /* https://www.microsoft.com/typography/otspec/glyf.htm */ /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED @@ -795,6 +768,16 @@ FT_BEGIN_HEADER #undef T1_CONFIG_OPTION_NO_MM_SUPPORT + /*************************************************************************/ + /* */ + /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the type1 driver module. */ + /* */ +/* #define T1_CONFIG_OPTION_OLD_ENGINE */ + + /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -810,8 +793,8 @@ FT_BEGIN_HEADER /* possible to set up the default values of the four control points that */ /* define the stem darkening behaviour of the (new) CFF engine. For */ /* more details please read the documentation of the */ - /* `darkening-parameters' property of the cff driver module (file */ - /* `ftcffdrv.h'), which allows the control at run-time. */ + /* `darkening-parameters' property (file `ftdriver.h'), which allows the */ + /* control at run-time. */ /* */ /* Do *not* undefine these macros! */ /* */ @@ -899,7 +882,7 @@ FT_BEGIN_HEADER /* */ /* This experimental option is active only if the rendering mode is */ /* FT_RENDER_MODE_LIGHT; you can switch warping on and off with the */ - /* `warping' property of the auto-hinter (see file `ftautoh.h' for more */ + /* `warping' property of the auto-hinter (see file `ftdriver.h' for more */ /* information; by default it is switched off). */ /* */ #define AF_CONFIG_OPTION_USE_WARPER diff --git a/sdk/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h b/sdk/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h index 05a4845fd54..42f9a06e439 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h @@ -5,7 +5,7 @@ /* ANSI-specific library and header configuration file (specification */ /* only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/freetype.h b/sdk/lib/3rdparty/freetype/include/freetype/freetype.h index b0c261799af..eda95e2abe4 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/freetype.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/freetype.h @@ -4,7 +4,7 @@ /* */ /* FreeType high-level API and common types (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -138,6 +138,7 @@ FT_BEGIN_HEADER /* FT_FACE_FLAG_TRICKY */ /* FT_FACE_FLAG_KERNING */ /* FT_FACE_FLAG_MULTIPLE_MASTERS */ + /* FT_FACE_FLAG_VARIATION */ /* FT_FACE_FLAG_GLYPH_NAMES */ /* FT_FACE_FLAG_EXTERNAL_STREAM */ /* FT_FACE_FLAG_HINTER */ @@ -147,14 +148,16 @@ FT_BEGIN_HEADER /* FT_HAS_KERNING */ /* FT_HAS_FIXED_SIZES */ /* FT_HAS_GLYPH_NAMES */ - /* FT_HAS_MULTIPLE_MASTERS */ /* FT_HAS_COLOR */ + /* FT_HAS_MULTIPLE_MASTERS */ /* */ /* FT_IS_SFNT */ /* FT_IS_SCALABLE */ /* FT_IS_FIXED_WIDTH */ /* FT_IS_CID_KEYED */ /* FT_IS_TRICKY */ + /* FT_IS_NAMED_INSTANCE */ + /* FT_IS_VARIATION */ /* */ /* FT_STYLE_FLAG_BOLD */ /* FT_STYLE_FLAG_ITALIC */ @@ -648,7 +651,7 @@ FT_BEGIN_HEADER /* FT_ENCODING_MS_SYMBOL :: */ /* Microsoft Symbol encoding, used to encode mathematical symbols */ /* and wingdings. For more information, see */ - /* `http://www.microsoft.com/typography/otspec/recom.htm', */ + /* `https://www.microsoft.com/typography/otspec/recom.htm', */ /* `http://www.kostis.net/charsets/symbol.htm', and */ /* `http://www.kostis.net/charsets/wingding.htm'. */ /* */ @@ -657,7 +660,7 @@ FT_BEGIN_HEADER /* */ /* FT_ENCODING_SJIS :: */ /* Shift JIS encoding for Japanese. More info at */ - /* `http://en.wikipedia.org/wiki/Shift_JIS'. See note on */ + /* `https://en.wikipedia.org/wiki/Shift_JIS'. See note on */ /* multi-byte encodings below. */ /* */ /* FT_ENCODING_PRC :: */ @@ -673,7 +676,7 @@ FT_BEGIN_HEADER /* Corresponds to the Korean encoding system known as Extended */ /* Wansung (MS Windows code page 949). */ /* For more information see */ - /* `http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */ + /* `https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */ /* */ /* FT_ENCODING_JOHAB :: */ /* The Korean standard character set (KS~C 5601-1992), which */ @@ -749,7 +752,7 @@ FT_BEGIN_HEADER /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */ /* be needed to be able to distinguish Apple encoding variants. See */ /* */ - /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ + /* https://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. */ @@ -888,34 +891,41 @@ FT_BEGIN_HEADER /* are set to~0 if there is only one face in */ /* the font file. */ /* */ - /* Bits 16-30 are relevant to GX and OpenType */ - /* variation fonts only, holding the named */ - /* instance index for the current face index */ - /* (starting with value~1; value~0 indicates */ - /* font access without a named instance). For */ - /* non-variation fonts, bits 16-30 are */ - /* ignored. If we have the third named */ - /* instance of face~4, say, `face_index' is */ - /* set to 0x00030004. */ + /* [Since 2.6.1] Bits 16-30 are relevant to GX */ + /* and OpenType variation fonts only, holding */ + /* the named instance index for the current */ + /* face index (starting with value~1; value~0 */ + /* indicates font access without a named */ + /* instance). For non-variation fonts, bits */ + /* 16-30 are ignored. If we have the third */ + /* named instance of face~4, say, `face_index' */ + /* is set to 0x00030004. */ /* */ /* Bit 31 is always zero (this is, */ /* `face_index' is always a positive value). */ /* */ + /* [Since 2.9] Changing the design coordinates */ + /* with @FT_Set_Var_Design_Coordinates or */ + /* @FT_Set_Var_Blend_Coordinates does not */ + /* influence the named instance index value */ + /* (only @FT_Set_Named_Instance does that). */ + /* */ /* face_flags :: A set of bit flags that give important */ /* information about the face; see */ /* @FT_FACE_FLAG_XXX for the details. */ /* */ /* style_flags :: The lower 16~bits contain a set of bit */ /* flags indicating the style of the face; see */ - /* @FT_STYLE_FLAG_XXX for the details. Bits */ - /* 16-30 hold the number of named instances */ - /* available for the current face if we have a */ - /* GX or OpenType variation (sub)font. Bit 31 */ - /* is always zero (this is, `style_flags' is */ - /* always a positive value). Note that a */ - /* variation font has always at least one */ - /* named instance, namely the default */ - /* instance. */ + /* @FT_STYLE_FLAG_XXX for the details. */ + /* */ + /* [Since 2.6.1] Bits 16-30 hold the number */ + /* of named instances available for the */ + /* current face if we have a GX or OpenType */ + /* variation (sub)font. Bit 31 is always zero */ + /* (this is, `style_flags' is always a */ + /* positive value). Note that a variation */ + /* font has always at least one named */ + /* instance, namely the default instance. */ /* */ /* num_glyphs :: The number of glyphs in the face. If the */ /* face is scalable and has sbits (see */ @@ -1052,6 +1062,9 @@ FT_BEGIN_HEADER /* `descender', `height', `underline_position', and */ /* `underline_thickness'. */ /* */ + /* Especially for TrueType fonts see also the documentation for */ + /* @FT_Size_Metrics. */ + /* */ typedef struct FT_FaceRec_ { FT_Long num_faces; @@ -1212,8 +1225,15 @@ FT_BEGIN_HEADER /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ /* */ /* FT_FACE_FLAG_COLOR :: */ - /* The face has color glyph tables. To access color glyphs use */ - /* @FT_LOAD_COLOR. */ + /* [Since 2.5.1] The face has color glyph tables. To access color */ + /* glyphs use @FT_LOAD_COLOR. */ + /* */ + /* FT_FACE_FLAG_VARIATION :: */ + /* [Since 2.9] Set if the current face (or named instance) has been */ + /* altered with @FT_Set_MM_Design_Coordinates, */ + /* @FT_Set_Var_Design_Coordinates, or */ + /* @FT_Set_Var_Blend_Coordinates. This flag is unset by a call to */ + /* @FT_Set_Named_Instance. */ /* */ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) @@ -1230,6 +1250,7 @@ FT_BEGIN_HEADER #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) #define FT_FACE_FLAG_TRICKY ( 1L << 13 ) #define FT_FACE_FLAG_COLOR ( 1L << 14 ) +#define FT_FACE_FLAG_VARIATION ( 1L << 15 ) /************************************************************************* @@ -1391,11 +1412,37 @@ FT_BEGIN_HEADER * A macro that returns true whenever a face object is a named instance * of a GX or OpenType variation font. * + * [Since 2.9] Changing the design coordinates with + * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does + * not influence the return value of this macro (only + * @FT_Set_Named_Instance does that). + * + * @since: + * 2.7 + * */ #define FT_IS_NAMED_INSTANCE( face ) \ ( (face)->face_index & 0x7FFF0000L ) + /************************************************************************* + * + * @macro: + * FT_IS_VARIATION( face ) + * + * @description: + * A macro that returns true whenever a face object has been altered + * by @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or + * @FT_Set_Var_Blend_Coordinates. + * + * @since: + * 2.9 + * + */ +#define FT_IS_VARIATION( face ) \ + ( (face)->face_flags & FT_FACE_FLAG_VARIATION ) + + /************************************************************************* * * @macro: @@ -1437,6 +1484,9 @@ FT_BEGIN_HEADER * A macro that returns true whenever a face object contains * tables for color glyphs. * + * @since: + * 2.5.1 + * */ #define FT_HAS_COLOR( face ) \ ( (face)->face_flags & FT_FACE_FLAG_COLOR ) @@ -1534,7 +1584,7 @@ FT_BEGIN_HEADER /* to the following. */ /* */ /* { */ - /* scaled_ascender = FT_MulFix( face->root.ascender, */ + /* scaled_ascender = FT_MulFix( face->ascender, */ /* size_metrics->y_scale ); */ /* } */ /* */ @@ -1548,6 +1598,43 @@ FT_BEGIN_HEADER /* */ /* The `FT_Size_Metrics' structure is valid for bitmap fonts also. */ /* */ + /* */ + /* *TrueType* *fonts* *with* *native* *bytecode* *hinting* */ + /* */ + /* All applications that handle TrueType fonts with native hinting */ + /* must be aware that TTFs expect different rounding of vertical font */ + /* dimensions. The application has to cater for this, especially if */ + /* it wants to rely on a TTF's vertical data (for example, to */ + /* properly align box characters vertically). */ + /* */ + /* Only the application knows _in_ _advance_ that it is going to use */ + /* native hinting for TTFs! FreeType, on the other hand, selects the */ + /* hinting mode not at the time of creating an @FT_Size object but */ + /* much later, namely while calling @FT_Load_Glyph. */ + /* */ + /* Here is some pseudo code that illustrates a possible solution. */ + /* */ + /* { */ + /* font_format = FT_Get_Font_Format( face ); */ + /* */ + /* if ( !strcmp( font_format, "TrueType" ) && */ + /* do_native_bytecode_hinting ) */ + /* { */ + /* ascender = ROUND( FT_MulFix( face->ascender, */ + /* size_metrics->y_scale ) ); */ + /* descender = ROUND( FT_MulFix( face->descender, */ + /* size_metrics->y_scale ) ); */ + /* } */ + /* else */ + /* { */ + /* ascender = size_metrics->ascender; */ + /* descender = size_metrics->descender; */ + /* } */ + /* */ + /* height = size_metrics->height; */ + /* max_advance = size_metrics->max_advance; */ + /* } */ + /* */ typedef struct FT_Size_Metrics_ { FT_UShort x_ppem; /* horizontal pixels per EM */ @@ -1689,17 +1776,13 @@ FT_BEGIN_HEADER /* @FT_GLYPH_FORMAT_COMPOSITE, but other values */ /* are possible. */ /* */ - /* bitmap :: This field is used as a bitmap descriptor */ - /* when the slot format is */ - /* @FT_GLYPH_FORMAT_BITMAP. Note that the */ - /* address and content of the bitmap buffer can */ - /* change between calls of @FT_Load_Glyph and a */ - /* few other functions. */ + /* bitmap :: This field is used as a bitmap descriptor. */ + /* Note that the address and content of the */ + /* bitmap buffer can change between calls of */ + /* @FT_Load_Glyph and a few other functions. */ /* */ /* bitmap_left :: The bitmap's left bearing expressed in */ - /* integer pixels. Only valid if the format is */ - /* @FT_GLYPH_FORMAT_BITMAP, this is, if the */ - /* glyph slot contains a bitmap. */ + /* integer pixels. */ /* */ /* bitmap_top :: The bitmap's top bearing expressed in integer */ /* pixels. This is the distance from the */ @@ -1746,7 +1829,9 @@ 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 */ - /* formats). */ + /* formats). [Since 2.9] The prospective bitmap metrics are */ + /* calculated according to @FT_LOAD_TARGET_XXX and other flags even */ + /* for the outline glyph, even if @FT_LOAD_RENDER is not set. */ /* */ /* This image can later be converted into a bitmap by calling */ /* @FT_Render_Glyph. This function searches the current renderer for */ @@ -1895,8 +1980,8 @@ FT_BEGIN_HEADER /* */ /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */ /* set, this function reads the `FREETYPE_PROPERTIES' environment */ - /* variable to control driver properties. See sections @auto_hinter, */ - /* @cff_driver, @pcf_driver, and @tt_driver for more. */ + /* variable to control driver properties. See section @properties */ + /* for more. */ /* */ FT_EXPORT( FT_Error ) FT_Init_FreeType( FT_Library *alibrary ); @@ -2155,14 +2240,14 @@ FT_BEGIN_HEADER /* with value~0). Set it to~0 if there is only one */ /* face in the font file. */ /* */ - /* Bits 16-30 are relevant to GX and OpenType variation */ - /* fonts only, specifying the named instance index for */ - /* the current face index (starting with value~1; */ - /* value~0 makes FreeType ignore named instances). For */ - /* non-variation fonts, bits 16-30 are ignored. */ - /* Assuming that you want to access the third named */ - /* instance in face~4, `face_index' should be set to */ - /* 0x00030004. If you want to access face~4 without */ + /* [Since 2.6.1] Bits 16-30 are relevant to GX and */ + /* OpenType variation fonts only, specifying the named */ + /* instance index for the current face index (starting */ + /* with value~1; value~0 makes FreeType ignore named */ + /* instances). For non-variation fonts, bits 16-30 are */ + /* ignored. Assuming that you want to access the third */ + /* named instance in face~4, `face_index' should be set */ + /* to 0x00030004. If you want to access face~4 without */ /* variation handling, simply set `face_index' to */ /* value~4. */ /* */ @@ -2869,26 +2954,26 @@ FT_BEGIN_HEADER * Disable the auto-hinter. See also the note below. * * FT_LOAD_COLOR :: - * Load embedded color bitmap images. The resulting color bitmaps, - * if available, will have the @FT_PIXEL_MODE_BGRA format. If the - * flag is not set and color bitmaps are found, they are converted - * to 256-level gray bitmaps transparently, using the + * [Since 2.5] Load embedded color bitmap images. The resulting color + * bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format. + * If the flag is not set and color bitmaps are found, they are + * converted to 256-level gray bitmaps transparently, using the * @FT_PIXEL_MODE_GRAY format. * * FT_LOAD_COMPUTE_METRICS :: - * Compute glyph metrics from the glyph data, without the use of - * bundled metrics tables (for example, the `hdmx' table in TrueType - * fonts). This flag is mainly used by font validating or font - * editing applications, which need to ignore, verify, or edit those - * tables. + * [Since 2.6.1] Compute glyph metrics from the glyph data, without + * the use of bundled metrics tables (for example, the `hdmx' table in + * TrueType fonts). This flag is mainly used by font validating or + * font editing applications, which need to ignore, verify, or edit + * those tables. * * Currently, this flag is only implemented for TrueType fonts. * * FT_LOAD_BITMAP_METRICS_ONLY :: - * Request loading of the metrics and bitmap image information of a - * (possibly embedded) bitmap glyph without allocating or copying - * the bitmap image data itself. No effect if the target glyph is - * not a bitmap image. + * [Since 2.7.1] Request loading of the metrics and bitmap image + * information of a (possibly embedded) bitmap glyph without + * allocating or copying the bitmap image data itself. No effect if + * the target glyph is not a bitmap image. * * This flag unsets @FT_LOAD_RENDER. * @@ -3471,7 +3556,14 @@ FT_BEGIN_HEADER /* retrieve it. FreeType follows Adobe TechNote #5902, `Generating */ /* PostScript Names for Fonts Using OpenType Font Variations'. */ /* */ - /* http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5902.AdobePSNameGeneration.html */ + /* https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html */ + /* */ + /* [Since 2.9] Special PostScript names for named instances are only */ + /* returned if the named instance is set with @FT_Set_Named_Instance */ + /* (and the font has corresponding entries in its `fvar' table). If */ + /* @FT_IS_VARIATION returns true, the algorithmically derived */ + /* PostScript name is provided, not looking up special entries for */ + /* named instances. */ /* */ FT_EXPORT( const char* ) FT_Get_Postscript_Name( FT_Face face ); @@ -3702,17 +3794,17 @@ FT_BEGIN_HEADER * Note that only a subset of the available properties can be * controlled. * - * * Stem darkening (@FT_PARAM_TAG_STEM_DARKENING, corresponding to the - * property `no-stem-darkening' provided by the `autofit' and `cff' - * modules; see @no-stem-darkening[autofit] and - * @no-stem-darkening[cff]). + * * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the + * property `no-stem-darkening' provided by the `autofit', `cff', + * `type1', and `t1cid' modules; see @no-stem-darkening). * - * * LCD filter weights (@FT_PARAM_TAG_LCD_FILTER_WEIGHTS, corresponding + * * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding * to function @FT_Library_SetLcdFilterWeights). * - * * Seed value for the CFF `random' operator - * (@FT_PARAM_TAG_RANDOM_SEED, corresponding to the `random-seed' - * property provided by the `cff' module; see @random-seed). + * * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID + * `random' operator, corresponding to the `random-seed' property + * provided by the `cff', `type1', and `t1cid' modules; see + * @random-seed). * * Pass NULL as `data' in @FT_Parameter for a given tag to reset the * option and use the library or module default again. @@ -3775,6 +3867,9 @@ FT_BEGIN_HEADER * FT_Face_Properties( face, 1, &property ); * } * + * @since: + * 2.8 + * */ FT_EXPORT( FT_Error ) FT_Face_Properties( FT_Face face, @@ -3899,7 +3994,7 @@ FT_BEGIN_HEADER /* and subsetting restrictions associated with a font. */ /* */ /* See */ - /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */ + /* https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */ /* for more details. */ /* */ /* */ @@ -3999,9 +4094,9 @@ FT_BEGIN_HEADER /* Sequences' (IVS), collected in the `Ideographic Variation */ /* Database' (IVD). */ /* */ - /* http://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */ - /* http://unicode.org/reports/tr37/ */ - /* http://unicode.org/ivd/ */ + /* https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */ + /* https://unicode.org/reports/tr37/ */ + /* https://unicode.org/ivd/ */ /* */ /* To date (January 2017), the character with the most ideographic */ /* variations is U+9089, having 32 such IVS. */ @@ -4456,8 +4551,8 @@ FT_BEGIN_HEADER * */ #define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 8 -#define FREETYPE_PATCH 1 +#define FREETYPE_MINOR 9 +#define FREETYPE_PATCH 0 /*************************************************************************/ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftadvanc.h b/sdk/lib/3rdparty/freetype/include/freetype/ftadvanc.h index dea96e0db43..f78e8b1a9d1 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftadvanc.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftadvanc.h @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (specification only). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftautoh.h b/sdk/lib/3rdparty/freetype/include/freetype/ftautoh.h deleted file mode 100644 index 2bb675ae460..00000000000 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftautoh.h +++ /dev/null @@ -1,533 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftautoh.h */ -/* */ -/* FreeType API for controlling the auto-hinter (specification only). */ -/* */ -/* Copyright 2012-2017 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 FTAUTOH_H_ -#define FTAUTOH_H_ - -#include -#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: - * auto_hinter - * - * @title: - * The auto-hinter - * - * @abstract: - * Controlling the auto-hinting module. - * - * @description: - * While FreeType's auto-hinter doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * Note that the auto-hinter's module name is `autofitter' for - * historical reasons. - * - */ - - - /************************************************************************** - * - * @property: - * glyph-to-script-map - * - * @description: - * *Experimental* *only* - * - * The auto-hinter provides various script modules to hint glyphs. - * Examples of supported scripts are Latin or CJK. Before a glyph is - * auto-hinted, the Unicode character map of the font gets examined, and - * the script is then determined based on Unicode character ranges, see - * below. - * - * OpenType fonts, however, often provide much more glyphs than - * character codes (small caps, superscripts, ligatures, swashes, etc.), - * to be controlled by so-called `features'. Handling OpenType features - * can be quite complicated and thus needs a separate library on top of - * FreeType. - * - * The mapping between glyph indices and scripts (in the auto-hinter - * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an - * array with `num_glyphs' elements, as found in the font's @FT_Face - * structure. The `glyph-to-script-map' property returns a pointer to - * this array, which can be modified as needed. Note that the - * modification should happen before the first glyph gets processed by - * the auto-hinter so that the global analysis of the font shapes - * actually uses the modified mapping. - * - * The following example code demonstrates how to access it (omitting - * the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_Prop_GlyphToScriptMap prop; - * - * - * FT_Init_FreeType( &library ); - * FT_New_Face( library, "foo.ttf", 0, &face ); - * - * prop.face = face; - * - * FT_Property_Get( library, "autofitter", - * "glyph-to-script-map", &prop ); - * - * // adjust `prop.map' as needed right here - * - * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); - * } - * - */ - - - /************************************************************************** - * - * @enum: - * FT_AUTOHINTER_SCRIPT_XXX - * - * @description: - * *Experimental* *only* - * - * A list of constants used for the @glyph-to-script-map property to - * specify the script submodule the auto-hinter should use for hinting a - * particular glyph. - * - * @values: - * FT_AUTOHINTER_SCRIPT_NONE :: - * Don't auto-hint this glyph. - * - * FT_AUTOHINTER_SCRIPT_LATIN :: - * Apply the latin auto-hinter. For the auto-hinter, `latin' is a - * very broad term, including Cyrillic and Greek also since characters - * from those scripts share the same design constraints. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+0020 - U+007F // Basic Latin (no control characters) - * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) - * U+0100 - U+017F // Latin Extended-A - * U+0180 - U+024F // Latin Extended-B - * U+0250 - U+02AF // IPA Extensions - * U+02B0 - U+02FF // Spacing Modifier Letters - * U+0300 - U+036F // Combining Diacritical Marks - * U+0370 - U+03FF // Greek and Coptic - * U+0400 - U+04FF // Cyrillic - * U+0500 - U+052F // Cyrillic Supplement - * U+1D00 - U+1D7F // Phonetic Extensions - * U+1D80 - U+1DBF // Phonetic Extensions Supplement - * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement - * U+1E00 - U+1EFF // Latin Extended Additional - * U+1F00 - U+1FFF // Greek Extended - * U+2000 - U+206F // General Punctuation - * U+2070 - U+209F // Superscripts and Subscripts - * U+20A0 - U+20CF // Currency Symbols - * U+2150 - U+218F // Number Forms - * U+2460 - U+24FF // Enclosed Alphanumerics - * U+2C60 - U+2C7F // Latin Extended-C - * U+2DE0 - U+2DFF // Cyrillic Extended-A - * U+2E00 - U+2E7F // Supplemental Punctuation - * U+A640 - U+A69F // Cyrillic Extended-B - * U+A720 - U+A7FF // Latin Extended-D - * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) - * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols - * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement - * } - * - * FT_AUTOHINTER_SCRIPT_CJK :: - * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old - * Vietnamese, and some other scripts. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+1100 - U+11FF // Hangul Jamo - * U+2E80 - U+2EFF // CJK Radicals Supplement - * U+2F00 - U+2FDF // Kangxi Radicals - * U+2FF0 - U+2FFF // Ideographic Description Characters - * U+3000 - U+303F // CJK Symbols and Punctuation - * U+3040 - U+309F // Hiragana - * U+30A0 - U+30FF // Katakana - * U+3100 - U+312F // Bopomofo - * U+3130 - U+318F // Hangul Compatibility Jamo - * U+3190 - U+319F // Kanbun - * U+31A0 - U+31BF // Bopomofo Extended - * U+31C0 - U+31EF // CJK Strokes - * U+31F0 - U+31FF // Katakana Phonetic Extensions - * U+3200 - U+32FF // Enclosed CJK Letters and Months - * U+3300 - U+33FF // CJK Compatibility - * U+3400 - U+4DBF // CJK Unified Ideographs Extension A - * U+4DC0 - U+4DFF // Yijing Hexagram Symbols - * U+4E00 - U+9FFF // CJK Unified Ideographs - * U+A960 - U+A97F // Hangul Jamo Extended-A - * U+AC00 - U+D7AF // Hangul Syllables - * U+D7B0 - U+D7FF // Hangul Jamo Extended-B - * U+F900 - U+FAFF // CJK Compatibility Ideographs - * U+FE10 - U+FE1F // Vertical forms - * U+FE30 - U+FE4F // CJK Compatibility Forms - * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms - * U+1B000 - U+1B0FF // Kana Supplement - * U+1D300 - U+1D35F // Tai Xuan Hing Symbols - * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement - * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B - * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C - * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D - * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement - * } - * - * FT_AUTOHINTER_SCRIPT_INDIC :: - * Apply the indic auto-hinter, covering all major scripts from the - * Indian sub-continent and some other related scripts like Thai, Lao, - * or Tibetan. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+0900 - U+0DFF // Indic Range - * U+0F00 - U+0FFF // Tibetan - * U+1900 - U+194F // Limbu - * U+1B80 - U+1BBF // Sundanese - * U+A800 - U+A82F // Syloti Nagri - * U+ABC0 - U+ABFF // Meetei Mayek - * U+11800 - U+118DF // Sharada - * } - * - * Note that currently Indic support is rudimentary only, missing blue - * zone support. - * - */ -#define FT_AUTOHINTER_SCRIPT_NONE 0 -#define FT_AUTOHINTER_SCRIPT_LATIN 1 -#define FT_AUTOHINTER_SCRIPT_CJK 2 -#define FT_AUTOHINTER_SCRIPT_INDIC 3 - - - /************************************************************************** - * - * @struct: - * FT_Prop_GlyphToScriptMap - * - * @description: - * *Experimental* *only* - * - * The data exchange structure for the @glyph-to-script-map property. - * - */ - typedef struct FT_Prop_GlyphToScriptMap_ - { - FT_Face face; - FT_UShort* map; - - } FT_Prop_GlyphToScriptMap; - - - /************************************************************************** - * - * @property: - * fallback-script - * - * @description: - * *Experimental* *only* - * - * If no auto-hinter script module can be assigned to a glyph, a - * fallback script gets assigned to it (see also the - * @glyph-to-script-map property). By default, this is - * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, - * this fallback value can be changed. - * - * { - * FT_Library library; - * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "fallback-script", &fallback_script ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map that eventually uses the - * fallback script value gets triggered either by setting or reading a - * face-specific property like @glyph-to-script-map, or by auto-hinting - * any glyph from that face. In particular, if you have already created - * an @FT_Face structure but not loaded any glyph (using the - * auto-hinter), a change of the fallback script will affect this face. - * - */ - - - /************************************************************************** - * - * @property: - * default-script - * - * @description: - * *Experimental* *only* - * - * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make - * the HarfBuzz library access OpenType features for getting better - * glyph coverages, this property sets the (auto-fitter) script to be - * used for the default (OpenType) script data of a font's GSUB table. - * Features for the default script are intended for all scripts not - * explicitly handled in GSUB; an example is a `dlig' feature, - * containing the combination of the characters `T', `E', and `L' to - * form a `TEL' ligature. - * - * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the - * `default-script' property, this default value can be changed. - * - * { - * FT_Library library; - * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "default-script", &default_script ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map that eventually uses the - * default script value gets triggered either by setting or reading a - * face-specific property like @glyph-to-script-map, or by auto-hinting - * any glyph from that face. In particular, if you have already created - * an @FT_Face structure but not loaded any glyph (using the - * auto-hinter), a change of the default script will affect this face. - * - */ - - - /************************************************************************** - * - * @property: - * increase-x-height - * - * @description: - * For ppem values in the range 6~<= ppem <= `increase-x-height', round - * up the font's x~height much more often than normally. If the value - * is set to~0, which is the default, this feature is switched off. Use - * this property to improve the legibility of small font sizes if - * necessary. - * - * { - * FT_Library library; - * FT_Face face; - * FT_Prop_IncreaseXHeight prop; - * - * - * FT_Init_FreeType( &library ); - * FT_New_Face( library, "foo.ttf", 0, &face ); - * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); - * - * prop.face = face; - * prop.limit = 14; - * - * FT_Property_Set( library, "autofitter", - * "increase-x-height", &prop ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * Set this value right after calling @FT_Set_Char_Size, but before - * loading any glyph (using the auto-hinter). - * - */ - - - /************************************************************************** - * - * @struct: - * FT_Prop_IncreaseXHeight - * - * @description: - * The data exchange structure for the @increase-x-height property. - * - */ - typedef struct FT_Prop_IncreaseXHeight_ - { - FT_Face face; - FT_UInt limit; - - } FT_Prop_IncreaseXHeight; - - - /************************************************************************** - * - * @property: - * warping - * - * @description: - * *Experimental* *only* - * - * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to - * activate the warp hinting code in the auto-hinter, this property - * switches warping on and off. - * - * Warping only works in `normal' auto-hinting mode replacing it. - * The idea of the code is to slightly scale and shift a glyph along - * the non-hinted dimension (which is usually the horizontal axis) so - * that as much of its segments are aligned (more or less) to the grid. - * To find out a glyph's optimal scaling and shifting value, various - * parameter combinations are tried and scored. - * - * By default, warping is off. The example below shows how to switch on - * warping (omitting the error handling). - * - * { - * FT_Library library; - * FT_Bool warping = 1; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "warping", &warping ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * - * The warping code can also change advance widths. Have a look at the - * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure - * for details on improving inter-glyph distances while rendering. - * - * Since warping is a global property of the auto-hinter it is best to - * change its value before rendering any face. Otherwise, you should - * reload all faces that get auto-hinted in `normal' hinting mode. - * - */ - - - /************************************************************************** - * - * @property: - * no-stem-darkening[autofit] - * - * @description: - * *Experimental* *only*, *requires* *linear* *alpha* *blending* *and* - * *gamma* *correction* - * - * Stem darkening emboldens glyphs at smaller sizes to make them more - * readable on common low-DPI screens when using linear alpha blending - * and gamma correction, see @FT_Render_Glyph. When not using linear - * alpha blending and gamma correction, glyphs will appear heavy and - * fuzzy! - * - * Gamma correction essentially lightens fonts since shades of grey are - * shifted to higher pixel values (=~higher brightness) to match the - * original intention to the reality of our screens. The side-effect is - * that glyphs `thin out'. Mac OS~X and Adobe's proprietary font - * rendering library implement a counter-measure: stem darkening at - * smaller sizes where shades of gray dominate. By emboldening a glyph - * slightly in relation to its pixel size, individual pixels get higher - * coverage of filled-in outlines and are therefore `blacker'. This - * counteracts the `thinning out' of glyphs, making text remain readable - * at smaller sizes. All glyphs that pass through the auto-hinter will - * be emboldened unless this property is set to TRUE. - * - * See the description of the CFF driver for algorithmic details. Total - * consistency with the CFF driver is currently not achieved because the - * emboldening method differs and glyphs must be scaled down on the - * Y-axis to keep outline points inside their precomputed blue zones. - * The smaller the size (especially 9ppem and down), the higher the loss - * of emboldening versus the CFF driver. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable similar to the CFF driver. It can also be set per face - * using @FT_Face_Properties with @FT_PARAM_TAG_STEM_DARKENING. - * - */ - - - /************************************************************************** - * - * @constant: - * FT_PARAM_TAG_STEM_DARKENING - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding Boolean argument specifies whether to apply stem - * darkening, overriding the global default values or the values set up - * with @FT_Property_Set (see @no-stem-darkening[autofit] and - * @no-stem-darkening[cff]). - * - * This is a passive setting that only takes effect if the font driver - * or autohinter honors it, which the CFF driver always does, but the - * autohinter only in `light' hinting mode (as of version 2.7.0). - * - */ -#define FT_PARAM_TAG_STEM_DARKENING \ - FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) - - - /************************************************************************** - * - * @property: - * darkening-parameters[autofit] - * - * @description: - * *Experimental* *only* - * - * See the description of the CFF driver for details. This - * implementation appropriates the - * CFF_CONFIG_OPTION_DARKENING_PARAMETER_* #defines for consistency. - * Note the differences described in @no-stem-darkening[autofit]. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable similar to the CFF driver. - */ - - - /* */ - - -FT_END_HEADER - -#endif /* FTAUTOH_H_ */ - - -/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftbbox.h b/sdk/lib/3rdparty/freetype/include/freetype/ftbbox.h index f03bdc1e1e4..f9eb70b1373 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftbbox.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftbbox.h @@ -4,7 +4,7 @@ /* */ /* FreeType exact bbox computation (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 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 @@ FT_BEGIN_HEADER /* Compute the exact bounding box of an outline. This is slower */ /* than computing the control box. However, it uses an advanced */ /* algorithm that returns _very_ quickly when the two boxes */ - /* coincide. Otherwise, the outline Bézier arcs are traversed to */ + /* coincide. Otherwise, the outline Bezier arcs are traversed to */ /* extract their extrema. */ /* */ /* */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftbdf.h b/sdk/lib/3rdparty/freetype/include/freetype/ftbdf.h index 3d3106bad03..1b6dea65863 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftbdf.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftbdf.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftbitmap.h b/sdk/lib/3rdparty/freetype/include/freetype/ftbitmap.h index 04b2402ad0f..a43187cad47 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftbitmap.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftbitmap.h @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -97,7 +97,7 @@ FT_BEGIN_HEADER FT_EXPORT( FT_Error ) FT_Bitmap_Copy( FT_Library library, const FT_Bitmap *source, - FT_Bitmap *target); + FT_Bitmap *target ); /*************************************************************************/ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftbzip2.h b/sdk/lib/3rdparty/freetype/include/freetype/ftbzip2.h index 9147a790a42..6edfa031b50 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftbzip2.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftbzip2.h @@ -4,7 +4,7 @@ /* */ /* Bzip2-compressed stream support. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* Joel Klinghed. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftcache.h b/sdk/lib/3rdparty/freetype/include/freetype/ftcache.h index 5ff3ccf4042..52d5f00e068 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftcache.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftcache.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache subsystem (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -540,13 +540,6 @@ FT_BEGIN_HEADER FTC_FaceID face_id ); - /*************************************************************************/ - /* */ - /*
*/ - /* cache_subsystem */ - /* */ - /*************************************************************************/ - /************************************************************************* * * @type: @@ -623,14 +616,6 @@ FT_BEGIN_HEADER FT_UInt32 char_code ); - /*************************************************************************/ - /* */ - /*
*/ - /* cache_subsystem */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftcffdrv.h b/sdk/lib/3rdparty/freetype/include/freetype/ftcffdrv.h deleted file mode 100644 index 477b6ddb184..00000000000 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftcffdrv.h +++ /dev/null @@ -1,321 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftcffdrv.h */ -/* */ -/* FreeType API for controlling the CFF driver (specification only). */ -/* */ -/* Copyright 2013-2017 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 FTCFFDRV_H_ -#define FTCFFDRV_H_ - -#include -#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: - * cff_driver - * - * @title: - * The CFF driver - * - * @abstract: - * Controlling the CFF driver module. - * - * @description: - * While FreeType's CFF driver doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The list below gives the available properties - * together with the necessary macros and structures. - * - * The CFF driver's module name is `cff'. - * - * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* - * - * The rasterizer is positioning horizontal features (e.g., ascender - * height & x-height, or crossbars) on the pixel grid and minimizing the - * amount of antialiasing applied to them, while placing vertical - * features (vertical stems) on the pixel grid without hinting, thus - * representing the stem position and weight accurately. Sometimes the - * vertical stems may be only partially black. In this context, - * `antialiasing' means that stems are not positioned exactly on pixel - * borders, causing a fuzzy appearance. - * - * There are two principles behind this approach. - * - * 1) No hinting in the horizontal direction: Unlike `superhinted' - * TrueType, which changes glyph widths to accommodate regular - * inter-glyph spacing, Adobe's approach is `faithful to the design' in - * representing both the glyph width and the inter-glyph spacing - * designed for the font. This makes the screen display as close as it - * can be to the result one would get with infinite resolution, while - * preserving what is considered the key characteristics of each glyph. - * Note that the distances between unhinted and grid-fitted positions at - * small sizes are comparable to kerning values and thus would be - * noticeable (and distracting) while reading if hinting were applied. - * - * One of the reasons to not hint horizontally is antialiasing for LCD - * screens: The pixel geometry of modern displays supplies three - * vertical sub-pixels as the eye moves horizontally across each visible - * pixel. On devices where we can be certain this characteristic is - * present a rasterizer can take advantage of the sub-pixels to add - * increments of weight. In Western writing systems this turns out to - * be the more critical direction anyway; the weights and spacing of - * vertical stems (see above) are central to Armenian, Cyrillic, Greek, - * and Latin type designs. Even when the rasterizer uses greyscale - * antialiasing instead of color (a necessary compromise when one - * doesn't know the screen characteristics), the unhinted vertical - * features preserve the design's weight and spacing much better than - * aliased type would. - * - * 2) Alignment in the vertical direction: Weights and spacing along the - * y~axis are less critical; what is much more important is the visual - * alignment of related features (like cap-height and x-height). The - * sense of alignment for these is enhanced by the sharpness of grid-fit - * edges, while the cruder vertical resolution (full pixels instead of - * 1/3 pixels) is less of a problem. - * - * On the technical side, horizontal alignment zones for ascender, - * x-height, and other important height values (traditionally called - * `blue zones') as defined in the font are positioned independently, - * each being rounded to the nearest pixel edge, taking care of - * overshoot suppression at small sizes, stem darkening, and scaling. - * - * Hstems (this is, hint values defined in the font to help align - * horizontal features) that fall within a blue zone are said to be - * `captured' and are aligned to that zone. Uncaptured stems are moved - * in one of four ways, top edge up or down, bottom edge up or down. - * Unless there are conflicting hstems, the smallest movement is taken - * to minimize distortion. - * - * @order: - * hinting-engine[cff] - * no-stem-darkening[cff] - * darkening-parameters[cff] - * random-seed - * - */ - - - /************************************************************************** - * - * @property: - * hinting-engine[cff] - * - * @description: - * Thanks to Adobe, which contributed a new hinting (and parsing) - * engine, an application can select between `freetype' and `adobe' if - * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration - * macro isn't defined, `hinting-engine' does nothing. - * - * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is - * defined, and `adobe' otherwise. - * - * The following example code demonstrates how to select Adobe's hinting - * engine (omitting the error handling). - * - * { - * FT_Library library; - * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "hinting-engine", &hinting_engine ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values `adobe' or `freetype'). - */ - - - /************************************************************************** - * - * @enum: - * FT_CFF_HINTING_XXX - * - * @description: - * A list of constants used for the @hinting-engine[cff] property to - * select the hinting engine for CFF fonts. - * - * @values: - * FT_CFF_HINTING_FREETYPE :: - * Use the old FreeType hinting engine. - * - * FT_CFF_HINTING_ADOBE :: - * Use the hinting engine contributed by Adobe. - * - */ -#define FT_CFF_HINTING_FREETYPE 0 -#define FT_CFF_HINTING_ADOBE 1 - - - /************************************************************************** - * - * @property: - * no-stem-darkening[cff] - * - * @description: - * By default, the Adobe CFF engine darkens stems at smaller sizes, - * regardless of hinting, to enhance contrast. This feature requires - * a rendering system with proper gamma correction. Setting this - * property, stem darkening gets switched off. - * - * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. - * - * { - * FT_Library library; - * FT_Bool no_stem_darkening = TRUE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "no-stem-darkening", &no_stem_darkening ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * It can also be set per face using @FT_Face_Properties with - * @FT_PARAM_TAG_STEM_DARKENING. - * - */ - - - /************************************************************************** - * - * @property: - * darkening-parameters[cff] - * - * @description: - * By default, the Adobe CFF engine darkens stems as follows (if the - * `no-stem-darkening' property isn't set): - * - * { - * stem width <= 0.5px: darkening amount = 0.4px - * stem width = 1px: darkening amount = 0.275px - * stem width = 1.667px: darkening amount = 0.275px - * stem width >= 2.333px: darkening amount = 0px - * } - * - * and piecewise linear in-between. At configuration time, these four - * control points can be set with the macro - * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'. At runtime, the control - * points can be changed using the `darkening-parameters' property, as - * the following example demonstrates. - * - * { - * FT_Library library; - * FT_Int darken_params[8] = { 500, 300, // x1, y1 - * 1000, 200, // x2, y2 - * 1500, 100, // x3, y3 - * 2000, 0 }; // x4, y4 - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "darkening-parameters", darken_params ); - * } - * - * The x~values give the stem width, and the y~values the darkening - * amount. The unit is 1000th of pixels. All coordinate values must be - * positive; the x~values must be monotonically increasing; the - * y~values must be monotonically decreasing and smaller than or - * equal to 500 (corresponding to half a pixel); the slope of each - * linear piece must be shallower than -1 (e.g., -.4). - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable, using eight comma-separated integers without spaces. Here - * the above example, using `\' to break the line for readability. - * - * { - * FREETYPE_PROPERTIES=\ - * cff:darkening-parameters=500,300,1000,200,1500,100,2000,0 - * } - */ - - - /************************************************************************** - * - * @property: - * random-seed - * - * @description: - * By default, the seed value for the CFF `random' operator is set to a - * random value. However, mainly for debugging purposes, it is often - * necessary to use a known value as a seed so that the pseudo-random - * number sequences generated by `random' are repeatable. - * - * The `random-seed' property does that. Its argument is a signed 32bit - * integer; if the value is zero or negative, the seed given by the - * `intitialRandomSeed' private DICT operator in a CFF file gets used - * (or a default value if there is no such operator). If the value is - * positive, use it instead of `initialRandomSeed', which is - * consequently ignored. - * - * @note: - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable. It can also be set per face using @FT_Face_Properties with - * @FT_PARAM_TAG_RANDOM_SEED. - * - */ - - - /************************************************************************** - * - * @constant: - * FT_PARAM_TAG_RANDOM_SEED - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding 32bit signed integer argument overrides the CFF - * module's random seed value with a face-specific one; see - * @random-seed. - * - */ -#define FT_PARAM_TAG_RANDOM_SEED \ - FT_MAKE_TAG( 's', 'e', 'e', 'd' ) - - - /* */ - - -FT_END_HEADER - - -#endif /* FTCFFDRV_H_ */ - - -/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftchapters.h b/sdk/lib/3rdparty/freetype/include/freetype/ftchapters.h index a0a121b0a17..51257bb7ca8 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftchapters.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftchapters.h @@ -76,8 +76,11 @@ /* */ /* auto_hinter */ /* cff_driver */ +/* t1_cid_driver */ /* tt_driver */ /* pcf_driver */ +/* properties */ +/* parameter_tags */ /* */ /***************************************************************************/ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftcid.h b/sdk/lib/3rdparty/freetype/include/freetype/ftcid.h index 4adcbeeda99..5e9100a67cb 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftcid.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftcid.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing CID font information (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Dereg Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -87,7 +87,7 @@ FT_BEGIN_HEADER FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, const char* *registry, const char* *ordering, - FT_Int *supplement); + FT_Int *supplement ); /********************************************************************** diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftdriver.h b/sdk/lib/3rdparty/freetype/include/freetype/ftdriver.h new file mode 100644 index 00000000000..02d104dc3ce --- /dev/null +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftdriver.h @@ -0,0 +1,1225 @@ +/***************************************************************************/ +/* */ +/* ftdriver.h */ +/* */ +/* FreeType API for controlling driver modules (specification only). */ +/* */ +/* Copyright 2017-2018 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 FTDRIVER_H_ +#define FTDRIVER_H_ + +#include +#include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_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: + * auto_hinter + * + * @title: + * The auto-hinter + * + * @abstract: + * Controlling the auto-hinting module. + * + * @description: + * While FreeType's auto-hinter doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * Note that the auto-hinter's module name is `autofitter' for + * historical reasons. + * + * Available properties are @increase-x-height, @no-stem-darkening + * (experimental), @darkening-parameters (experimental), @warping + * (experimental), @glyph-to-script-map (experimental), @fallback-script + * (experimental), and @default-script (experimental), as documented in + * the @properties section. + * + */ + + + /************************************************************************** + * + * @section: + * cff_driver + * + * @title: + * The CFF driver + * + * @abstract: + * Controlling the CFF driver module. + * + * @description: + * While FreeType's CFF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. + * + * The CFF driver's module name is `cff'. + * + * Available properties are @hinting-engine, @no-stem-darkening, + * @darkening-parameters, and @random-seed, as documented in the + * @properties section. + * + * + * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* + * + * The rasterizer is positioning horizontal features (e.g., ascender + * height & x-height, or crossbars) on the pixel grid and minimizing the + * amount of antialiasing applied to them, while placing vertical + * features (vertical stems) on the pixel grid without hinting, thus + * representing the stem position and weight accurately. Sometimes the + * vertical stems may be only partially black. In this context, + * `antialiasing' means that stems are not positioned exactly on pixel + * borders, causing a fuzzy appearance. + * + * There are two principles behind this approach. + * + * 1) No hinting in the horizontal direction: Unlike `superhinted' + * TrueType, which changes glyph widths to accommodate regular + * inter-glyph spacing, Adobe's approach is `faithful to the design' in + * representing both the glyph width and the inter-glyph spacing + * designed for the font. This makes the screen display as close as it + * can be to the result one would get with infinite resolution, while + * preserving what is considered the key characteristics of each glyph. + * Note that the distances between unhinted and grid-fitted positions at + * small sizes are comparable to kerning values and thus would be + * noticeable (and distracting) while reading if hinting were applied. + * + * One of the reasons to not hint horizontally is antialiasing for LCD + * screens: The pixel geometry of modern displays supplies three + * vertical sub-pixels as the eye moves horizontally across each visible + * pixel. On devices where we can be certain this characteristic is + * present a rasterizer can take advantage of the sub-pixels to add + * increments of weight. In Western writing systems this turns out to + * be the more critical direction anyway; the weights and spacing of + * vertical stems (see above) are central to Armenian, Cyrillic, Greek, + * and Latin type designs. Even when the rasterizer uses greyscale + * antialiasing instead of color (a necessary compromise when one + * doesn't know the screen characteristics), the unhinted vertical + * features preserve the design's weight and spacing much better than + * aliased type would. + * + * 2) Alignment in the vertical direction: Weights and spacing along the + * y~axis are less critical; what is much more important is the visual + * alignment of related features (like cap-height and x-height). The + * sense of alignment for these is enhanced by the sharpness of grid-fit + * edges, while the cruder vertical resolution (full pixels instead of + * 1/3 pixels) is less of a problem. + * + * On the technical side, horizontal alignment zones for ascender, + * x-height, and other important height values (traditionally called + * `blue zones') as defined in the font are positioned independently, + * each being rounded to the nearest pixel edge, taking care of + * overshoot suppression at small sizes, stem darkening, and scaling. + * + * Hstems (this is, hint values defined in the font to help align + * horizontal features) that fall within a blue zone are said to be + * `captured' and are aligned to that zone. Uncaptured stems are moved + * in one of four ways, top edge up or down, bottom edge up or down. + * Unless there are conflicting hstems, the smallest movement is taken + * to minimize distortion. + * + */ + + + /************************************************************************** + * + * @section: + * pcf_driver + * + * @title: + * The PCF driver + * + * @abstract: + * Controlling the PCF driver module. + * + * @description: + * While FreeType's PCF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. Right now, there is a single property + * @no-long-family-names available if FreeType is compiled with + * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. + * + * The PCF driver's module name is `pcf'. + * + */ + + + /************************************************************************** + * + * @section: + * t1_cid_driver + * + * @title: + * The Type 1 and CID drivers + * + * @abstract: + * Controlling the Type~1 and CID driver modules. + * + * @description: + * It is possible to control the behaviour of FreeType's Type~1 and + * Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get. + * + * Behind the scenes, both drivers use the Adobe CFF engine for hinting; + * however, the used properties must be specified separately. + * + * The Type~1 driver's module name is `type1'; the CID driver's module + * name is `t1cid'. + * + * Available properties are @hinting-engine, @no-stem-darkening, + * @darkening-parameters, and @random-seed, as documented in the + * @properties section. + * + * Please see the @cff_driver section for more details on the new + * hinting engine. + * + */ + + + /************************************************************************** + * + * @section: + * tt_driver + * + * @title: + * The TrueType driver + * + * @abstract: + * Controlling the TrueType driver module. + * + * @description: + * While FreeType's TrueType driver doesn't expose API functions by + * itself, it is possible to control its behaviour with @FT_Property_Set + * and @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * The TrueType driver's module name is `truetype'. + * + * A single property @interpreter-version is available, as documented in + * the @properties section. + * + * We start with a list of definitions, kindly provided by Greg + * Hitchcock. + * + * _Bi-Level_ _Rendering_ + * + * Monochromatic rendering, exclusively used in the early days of + * TrueType by both Apple and Microsoft. Microsoft's GDI interface + * supported hinting of the right-side bearing point, such that the + * advance width could be non-linear. Most often this was done to + * achieve some level of glyph symmetry. To enable reasonable + * performance (e.g., not having to run hinting on all glyphs just to + * get the widths) there was a bit in the head table indicating if the + * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to + * cache hinting widths across multiple sizes and device aspect ratios. + * + * _Font_ _Smoothing_ + * + * Microsoft's GDI implementation of anti-aliasing. Not traditional + * anti-aliasing as the outlines were hinted before the sampling. The + * widths matched the bi-level rendering. + * + * _ClearType_ _Rendering_ + * + * Technique that uses physical subpixels to improve rendering on LCD + * (and other) displays. Because of the higher resolution, many methods + * of improving symmetry in glyphs through hinting the right-side + * bearing were no longer necessary. This lead to what GDI calls + * `natural widths' ClearType, see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting + * has extra resolution, most non-linearity went away, but it is still + * possible for hints to change the advance widths in this mode. + * + * _ClearType_ _Compatible_ _Widths_ + * + * One of the earliest challenges with ClearType was allowing the + * implementation in GDI to be selected without requiring all UI and + * documents to reflow. To address this, a compatible method of + * rendering ClearType was added where the font hints are executed once + * to determine the width in bi-level rendering, and then re-run in + * ClearType, with the difference in widths being absorbed in the font + * hints for ClearType (mostly in the white space of hints); see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by + * definition, compatible width ClearType allows for non-linear widths, + * but only when the bi-level version has non-linear widths. + * + * _ClearType_ _Subpixel_ _Positioning_ + * + * One of the nice benefits of ClearType is the ability to more crisply + * display fractional widths; unfortunately, the GDI model of integer + * bitmaps did not support this. However, the WPF and Direct Write + * frameworks do support fractional widths. DWrite calls this `natural + * mode', not to be confused with GDI's `natural widths'. Subpixel + * positioning, in the current implementation of Direct Write, + * unfortunately does not support hinted advance widths, see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the + * TrueType interpreter fully allows the advance width to be adjusted in + * this mode, just the DWrite client will ignore those changes. + * + * _ClearType_ _Backward_ _Compatibility_ + * + * This is a set of exceptions made in the TrueType interpreter to + * minimize hinting techniques that were problematic with the extra + * resolution of ClearType; see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and + * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. + * This technique is not to be confused with ClearType compatible + * widths. ClearType backward compatibility has no direct impact on + * changing advance widths, but there might be an indirect impact on + * disabling some deltas. This could be worked around in backward + * compatibility mode. + * + * _Native_ _ClearType_ _Mode_ + * + * (Not to be confused with `natural widths'.) This mode removes all + * the exceptions in the TrueType interpreter when running with + * ClearType. Any issues on widths would still apply, though. + * + */ + + + /************************************************************************** + * + * @section: + * properties + * + * @title: + * Driver properties + * + * @abstract: + * Controlling driver modules. + * + * @description: + * Driver modules can be controlled by setting and unsetting properties, + * using the functions @FT_Property_Set and @FT_Property_Get. This + * section documents the available properties, together with auxiliary + * macros and structures. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_HINTING_XXX + * + * @description: + * A list of constants used for the @hinting-engine property to + * select the hinting engine for CFF, Type~1, and CID fonts. + * + * @values: + * FT_HINTING_FREETYPE :: + * Use the old FreeType hinting engine. + * + * FT_HINTING_ADOBE :: + * Use the hinting engine contributed by Adobe. + * + * @since: + * 2.9 + * + */ +#define FT_HINTING_FREETYPE 0 +#define FT_HINTING_ADOBE 1 + + /* these constants (introduced in 2.4.12) are deprecated */ +#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE +#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE + + + /************************************************************************** + * + * @property: + * hinting-engine + * + * @description: + * Thanks to Adobe, which contributed a new hinting (and parsing) + * engine, an application can select between `freetype' and `adobe' if + * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration + * macro isn't defined, `hinting-engine' does nothing. + * + * The same holds for the Type~1 and CID modules if compiled with + * T1_CONFIG_OPTION_OLD_ENGINE. + * + * For the `cff' module, the default engine is `freetype' if + * CFF_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe' otherwise. + * + * For both the `type1' and `t1cid' modules, the default engine is + * `freetype' if T1_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe' + * otherwise. + * + * The following example code demonstrates how to select Adobe's hinting + * engine for the `cff' module (omitting the error handling). + * + * { + * FT_Library library; + * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "hinting-engine", &hinting_engine ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values `adobe' or `freetype'). + * + * @since: + * 2.4.12 (for `cff' module) + * + * 2.9 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * no-stem-darkening + * + * @description: + * All glyphs that pass through the auto-hinter will be emboldened + * unless this property is set to TRUE. The same is true for the CFF, + * Type~1, and CID font modules if the `Adobe' engine is selected (which + * is the default). + * + * Stem darkening emboldens glyphs at smaller sizes to make them more + * readable on common low-DPI screens when using linear alpha blending + * and gamma correction, see @FT_Render_Glyph. When not using linear + * alpha blending and gamma correction, glyphs will appear heavy and + * fuzzy! + * + * Gamma correction essentially lightens fonts since shades of grey are + * shifted to higher pixel values (=~higher brightness) to match the + * original intention to the reality of our screens. The side-effect is + * that glyphs `thin out'. Mac OS~X and Adobe's proprietary font + * rendering library implement a counter-measure: stem darkening at + * smaller sizes where shades of gray dominate. By emboldening a glyph + * slightly in relation to its pixel size, individual pixels get higher + * coverage of filled-in outlines and are therefore `blacker'. This + * counteracts the `thinning out' of glyphs, making text remain readable + * at smaller sizes. + * + * By default, the Adobe engines for CFF, Type~1, and CID fonts darken + * stems at smaller sizes, regardless of hinting, to enhance contrast. + * Setting this property, stem darkening gets switched off. + * + * For the auto-hinter, stem-darkening is experimental currently and + * thus switched off by default (this is, `no-stem-darkening' is set to + * TRUE by default). Total consistency with the CFF driver is not + * achieved right now because the emboldening method differs and glyphs + * must be scaled down on the Y-axis to keep outline points inside their + * precomputed blue zones. The smaller the size (especially 9ppem and + * down), the higher the loss of emboldening versus the CFF driver. + * + * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is + * set. + * + * { + * FT_Library library; + * FT_Bool no_stem_darkening = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "no-stem-darkening", &no_stem_darkening ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * It can also be set per face using @FT_Face_Properties with + * @FT_PARAM_TAG_STEM_DARKENING. + * + * @since: + * 2.4.12 (for `cff' module) + * + * 2.6.2 (for `autofitter' module) + * + * 2.9 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * darkening-parameters + * + * @description: + * By default, the Adobe hinting engine, as used by the CFF, Type~1, and + * CID font drivers, darkens stems as follows (if the + * `no-stem-darkening' property isn't set): + * + * { + * stem width <= 0.5px: darkening amount = 0.4px + * stem width = 1px: darkening amount = 0.275px + * stem width = 1.667px: darkening amount = 0.275px + * stem width >= 2.333px: darkening amount = 0px + * } + * + * and piecewise linear in-between. At configuration time, these four + * control points can be set with the macro + * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'; the CFF, Type~1, and CID + * drivers share these values. At runtime, the control points can be + * changed using the `darkening-parameters' property, as the following + * example demonstrates for the Type~1 driver. + * + * { + * FT_Library library; + * FT_Int darken_params[8] = { 500, 300, // x1, y1 + * 1000, 200, // x2, y2 + * 1500, 100, // x3, y3 + * 2000, 0 }; // x4, y4 + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "type1", + * "darkening-parameters", darken_params ); + * } + * + * The x~values give the stem width, and the y~values the darkening + * amount. The unit is 1000th of pixels. All coordinate values must be + * positive; the x~values must be monotonically increasing; the + * y~values must be monotonically decreasing and smaller than or + * equal to 500 (corresponding to half a pixel); the slope of each + * linear piece must be shallower than -1 (e.g., -.4). + * + * The auto-hinter provides this property, too, as an experimental + * feature. See @no-stem-darkening for more. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable, using eight comma-separated integers without spaces. Here + * the above example, using `\' to break the line for readability. + * + * { + * FREETYPE_PROPERTIES=\ + * type1:darkening-parameters=500,300,1000,200,1500,100,2000,0 + * } + * + * @since: + * 2.5.1 (for `cff' module) + * + * 2.6.2 (for `autofitter' module) + * + * 2.9 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * random-seed + * + * @description: + * By default, the seed value for the CFF `random' operator and the + * similar `0 28 callothersubr pop' command for the Type~1 and CID + * drivers is set to a random value. However, mainly for debugging + * purposes, it is often necessary to use a known value as a seed so + * that the pseudo-random number sequences generated by `random' are + * repeatable. + * + * The `random-seed' property does that. Its argument is a signed 32bit + * integer; if the value is zero or negative, the seed given by the + * `intitialRandomSeed' private DICT operator in a CFF file gets used + * (or a default value if there is no such operator). If the value is + * positive, use it instead of `initialRandomSeed', which is + * consequently ignored. + * + * @note: + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable. It can also be set per face using @FT_Face_Properties with + * @FT_PARAM_TAG_RANDOM_SEED. + * + * @since: + * 2.8 (for `cff' module) + * + * 2.9 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * no-long-family-names + * + * @description: + * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling + * FreeType, the PCF driver constructs long family names. + * + * There are many PCF fonts just called `Fixed' which look completely + * different, and which have nothing to do with each other. When + * selecting `Fixed' in KDE or Gnome one gets results that appear rather + * random, the style changes often if one changes the size and one + * cannot select some fonts at all. The improve this situation, the PCF + * module prepends the foundry name (plus a space) to the family name. + * It also checks whether there are `wide' characters; all put together, + * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed. + * + * If `no-long-family-names' is set, this feature gets switched off. + * + * { + * FT_Library library; + * FT_Bool no_long_family_names = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "pcf", + * "no-long-family-names", + * &no_long_family_names ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * + * @since: + * 2.8 + */ + + + /************************************************************************** + * + * @enum: + * TT_INTERPRETER_VERSION_XXX + * + * @description: + * A list of constants used for the @interpreter-version property to + * select the hinting engine for Truetype fonts. + * + * The numeric value in the constant names represents the version + * number as returned by the `GETINFO' bytecode instruction. + * + * @values: + * TT_INTERPRETER_VERSION_35 :: + * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in + * Windows~98; only grayscale and B/W rasterizing is supported. + * + * TT_INTERPRETER_VERSION_38 :: + * Version~38 corresponds to MS rasterizer v.1.9; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as can + * be found, for example, in the Internet Explorer~9 running on + * Windows~7). It is used in FreeType to select the `Infinality' + * subpixel hinting code. The code may be removed in a future + * version. + * + * TT_INTERPRETER_VERSION_40 :: + * Version~40 corresponds to MS rasterizer v.2.1; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as can + * be found, for example, in Microsoft's Edge Browser on Windows~10). + * It is used in FreeType to select the `minimal' subpixel hinting + * code, a stripped-down and higher performance version of the + * `Infinality' code. + * + * @note: + * This property controls the behaviour of the bytecode interpreter + * and thus how outlines get hinted. It does *not* control how glyph + * get rasterized! In particular, it does not control subpixel color + * filtering. + * + * If FreeType has not been compiled with the configuration option + * TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes + * an `FT_Err_Unimplemented_Feature' error. + * + * Depending on the graphics framework, Microsoft uses different + * bytecode and rendering engines. As a consequence, the version + * numbers returned by a call to the `GETINFO' bytecode instruction are + * more convoluted than desired. + * + * Here are two tables that try to shed some light on the possible + * values for the MS rasterizer engine, together with the additional + * features introduced by it. + * + * { + * GETINFO framework version feature + * ------------------------------------------------------------------- + * 3 GDI (Win 3.1), v1.0 16-bit, first version + * TrueImage + * 33 GDI (Win NT 3.1), v1.5 32-bit + * HP Laserjet + * 34 GDI (Win 95) v1.6 font smoothing, + * new SCANTYPE opcode + * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET + * bits in composite glyphs + * 36 MGDI (Win CE 2) v1.6+ classic ClearType + * 37 GDI (XP and later), v1.8 ClearType + * GDI+ old (before Vista) + * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType, + * WPF Y-direction ClearType, + * additional error checking + * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags + * in GETINFO opcode, + * bug fixes + * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag + * DWrite (Win 8) in GETINFO opcode, + * Gray ClearType + * } + * + * The `version' field gives a rough orientation only, since some + * applications provided certain features much earlier (as an example, + * Microsoft Reader used subpixel and Y-direction ClearType already in + * Windows 2000). Similarly, updates to a given framework might include + * improved hinting support. + * + * { + * version sampling rendering comment + * x y x y + * -------------------------------------------------------------- + * v1.0 normal normal B/W B/W bi-level + * v1.6 high high gray gray grayscale + * v1.8 high normal color-filter B/W (GDI) ClearType + * v1.9 high high color-filter gray Color ClearType + * v2.1 high normal gray B/W Gray ClearType + * v2.1 high high gray gray Gray ClearType + * } + * + * Color and Gray ClearType are the two available variants of + * `Y-direction ClearType', meaning grayscale rasterization along the + * Y-direction; the name used in the TrueType specification for this + * feature is `symmetric smoothing'. `Classic ClearType' is the + * original algorithm used before introducing a modified version in + * Win~XP. Another name for v1.6's grayscale rendering is `font + * smoothing', and `Color ClearType' is sometimes also called `DWrite + * ClearType'. To differentiate between today's Color ClearType and the + * earlier ClearType variant with B/W rendering along the vertical axis, + * the latter is sometimes called `GDI ClearType'. + * + * `Normal' and `high' sampling describe the (virtual) resolution to + * access the rasterized outline after the hinting process. `Normal' + * means 1 sample per grid line (i.e., B/W). In the current Microsoft + * implementation, `high' means an extra virtual resolution of 16x16 (or + * 16x1) grid lines per pixel for bytecode instructions like `MIRP'. + * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid + * lines for color filtering if Color ClearType is activated. + * + * Note that `Gray ClearType' is essentially the same as v1.6's + * grayscale rendering. However, the GETINFO instruction handles it + * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1 + * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing), + * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for + * the version~1 gasp table exclusively (like Color ClearType), while + * v1.6 only respects the values of version~0 (bits 0 and~1). + * + * Keep in mind that the features of the above interpreter versions + * might not map exactly to FreeType features or behavior because it is + * a fundamentally different library with different internals. + * + */ +#define TT_INTERPRETER_VERSION_35 35 +#define TT_INTERPRETER_VERSION_38 38 +#define TT_INTERPRETER_VERSION_40 40 + + + /************************************************************************** + * + * @property: + * interpreter-version + * + * @description: + * Currently, three versions are available, two representing the + * bytecode interpreter with subpixel hinting support (old `Infinality' + * code and new stripped-down and higher performance `minimal' code) and + * one without, respectively. The default is subpixel support if + * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support + * otherwise (since it isn't available then). + * + * If subpixel hinting is on, many TrueType bytecode instructions behave + * differently compared to B/W or grayscale rendering (except if `native + * ClearType' is selected by the font). Microsoft's main idea is to + * render at a much increased horizontal resolution, then sampling down + * the created output to subpixel precision. However, many older fonts + * are not suited to this and must be specially taken care of by + * applying (hardcoded) tweaks in Microsoft's interpreter. + * + * Details on subpixel hinting and some of the necessary tweaks can be + * found in Greg Hitchcock's whitepaper at + * `https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. + * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, + * or 6x5 supersampling) like discussed in the paper. Depending on the + * chosen interpreter, it simply ignores instructions on vertical stems + * to arrive at very similar results. + * + * The following example code demonstrates how to deactivate subpixel + * hinting (omitting the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "truetype", + * "interpreter-version", + * &interpreter_version ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values `35', `38', or `40'). + * + * @since: + * 2.5 + */ + + + /************************************************************************** + * + * @property: + * glyph-to-script-map + * + * @description: + * *Experimental* *only* + * + * The auto-hinter provides various script modules to hint glyphs. + * Examples of supported scripts are Latin or CJK. Before a glyph is + * auto-hinted, the Unicode character map of the font gets examined, and + * the script is then determined based on Unicode character ranges, see + * below. + * + * OpenType fonts, however, often provide much more glyphs than + * character codes (small caps, superscripts, ligatures, swashes, etc.), + * to be controlled by so-called `features'. Handling OpenType features + * can be quite complicated and thus needs a separate library on top of + * FreeType. + * + * The mapping between glyph indices and scripts (in the auto-hinter + * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an + * array with `num_glyphs' elements, as found in the font's @FT_Face + * structure. The `glyph-to-script-map' property returns a pointer to + * this array, which can be modified as needed. Note that the + * modification should happen before the first glyph gets processed by + * the auto-hinter so that the global analysis of the font shapes + * actually uses the modified mapping. + * + * The following example code demonstrates how to access it (omitting + * the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_GlyphToScriptMap prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * + * prop.face = face; + * + * FT_Property_Get( library, "autofitter", + * "glyph-to-script-map", &prop ); + * + * // adjust `prop.map' as needed right here + * + * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); + * } + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @enum: + * FT_AUTOHINTER_SCRIPT_XXX + * + * @description: + * *Experimental* *only* + * + * A list of constants used for the @glyph-to-script-map property to + * specify the script submodule the auto-hinter should use for hinting a + * particular glyph. + * + * @values: + * FT_AUTOHINTER_SCRIPT_NONE :: + * Don't auto-hint this glyph. + * + * FT_AUTOHINTER_SCRIPT_LATIN :: + * Apply the latin auto-hinter. For the auto-hinter, `latin' is a + * very broad term, including Cyrillic and Greek also since characters + * from those scripts share the same design constraints. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0020 - U+007F // Basic Latin (no control characters) + * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) + * U+0100 - U+017F // Latin Extended-A + * U+0180 - U+024F // Latin Extended-B + * U+0250 - U+02AF // IPA Extensions + * U+02B0 - U+02FF // Spacing Modifier Letters + * U+0300 - U+036F // Combining Diacritical Marks + * U+0370 - U+03FF // Greek and Coptic + * U+0400 - U+04FF // Cyrillic + * U+0500 - U+052F // Cyrillic Supplement + * U+1D00 - U+1D7F // Phonetic Extensions + * U+1D80 - U+1DBF // Phonetic Extensions Supplement + * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement + * U+1E00 - U+1EFF // Latin Extended Additional + * U+1F00 - U+1FFF // Greek Extended + * U+2000 - U+206F // General Punctuation + * U+2070 - U+209F // Superscripts and Subscripts + * U+20A0 - U+20CF // Currency Symbols + * U+2150 - U+218F // Number Forms + * U+2460 - U+24FF // Enclosed Alphanumerics + * U+2C60 - U+2C7F // Latin Extended-C + * U+2DE0 - U+2DFF // Cyrillic Extended-A + * U+2E00 - U+2E7F // Supplemental Punctuation + * U+A640 - U+A69F // Cyrillic Extended-B + * U+A720 - U+A7FF // Latin Extended-D + * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) + * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols + * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_CJK :: + * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old + * Vietnamese, and some other scripts. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+1100 - U+11FF // Hangul Jamo + * U+2E80 - U+2EFF // CJK Radicals Supplement + * U+2F00 - U+2FDF // Kangxi Radicals + * U+2FF0 - U+2FFF // Ideographic Description Characters + * U+3000 - U+303F // CJK Symbols and Punctuation + * U+3040 - U+309F // Hiragana + * U+30A0 - U+30FF // Katakana + * U+3100 - U+312F // Bopomofo + * U+3130 - U+318F // Hangul Compatibility Jamo + * U+3190 - U+319F // Kanbun + * U+31A0 - U+31BF // Bopomofo Extended + * U+31C0 - U+31EF // CJK Strokes + * U+31F0 - U+31FF // Katakana Phonetic Extensions + * U+3200 - U+32FF // Enclosed CJK Letters and Months + * U+3300 - U+33FF // CJK Compatibility + * U+3400 - U+4DBF // CJK Unified Ideographs Extension A + * U+4DC0 - U+4DFF // Yijing Hexagram Symbols + * U+4E00 - U+9FFF // CJK Unified Ideographs + * U+A960 - U+A97F // Hangul Jamo Extended-A + * U+AC00 - U+D7AF // Hangul Syllables + * U+D7B0 - U+D7FF // Hangul Jamo Extended-B + * U+F900 - U+FAFF // CJK Compatibility Ideographs + * U+FE10 - U+FE1F // Vertical forms + * U+FE30 - U+FE4F // CJK Compatibility Forms + * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms + * U+1B000 - U+1B0FF // Kana Supplement + * U+1D300 - U+1D35F // Tai Xuan Hing Symbols + * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement + * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B + * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C + * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D + * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_INDIC :: + * Apply the indic auto-hinter, covering all major scripts from the + * Indian sub-continent and some other related scripts like Thai, Lao, + * or Tibetan. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0900 - U+0DFF // Indic Range + * U+0F00 - U+0FFF // Tibetan + * U+1900 - U+194F // Limbu + * U+1B80 - U+1BBF // Sundanese + * U+A800 - U+A82F // Syloti Nagri + * U+ABC0 - U+ABFF // Meetei Mayek + * U+11800 - U+118DF // Sharada + * } + * + * Note that currently Indic support is rudimentary only, missing blue + * zone support. + * + * @since: + * 2.4.11 + * + */ +#define FT_AUTOHINTER_SCRIPT_NONE 0 +#define FT_AUTOHINTER_SCRIPT_LATIN 1 +#define FT_AUTOHINTER_SCRIPT_CJK 2 +#define FT_AUTOHINTER_SCRIPT_INDIC 3 + + + /************************************************************************** + * + * @struct: + * FT_Prop_GlyphToScriptMap + * + * @description: + * *Experimental* *only* + * + * The data exchange structure for the @glyph-to-script-map property. + * + * @since: + * 2.4.11 + * + */ + typedef struct FT_Prop_GlyphToScriptMap_ + { + FT_Face face; + FT_UShort* map; + + } FT_Prop_GlyphToScriptMap; + + + /************************************************************************** + * + * @property: + * fallback-script + * + * @description: + * *Experimental* *only* + * + * If no auto-hinter script module can be assigned to a glyph, a + * fallback script gets assigned to it (see also the + * @glyph-to-script-map property). By default, this is + * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, + * this fallback value can be changed. + * + * { + * FT_Library library; + * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "fallback-script", &fallback_script ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map that eventually uses the + * fallback script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the fallback script will affect this face. + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @property: + * default-script + * + * @description: + * *Experimental* *only* + * + * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make + * the HarfBuzz library access OpenType features for getting better + * glyph coverages, this property sets the (auto-fitter) script to be + * used for the default (OpenType) script data of a font's GSUB table. + * Features for the default script are intended for all scripts not + * explicitly handled in GSUB; an example is a `dlig' feature, + * containing the combination of the characters `T', `E', and `L' to + * form a `TEL' ligature. + * + * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the + * `default-script' property, this default value can be changed. + * + * { + * FT_Library library; + * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "default-script", &default_script ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map that eventually uses the + * default script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the default script will affect this face. + * + * @since: + * 2.5.3 + * + */ + + + /************************************************************************** + * + * @property: + * increase-x-height + * + * @description: + * For ppem values in the range 6~<= ppem <= `increase-x-height', round + * up the font's x~height much more often than normally. If the value + * is set to~0, which is the default, this feature is switched off. Use + * this property to improve the legibility of small font sizes if + * necessary. + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_IncreaseXHeight prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); + * + * prop.face = face; + * prop.limit = 14; + * + * FT_Property_Set( library, "autofitter", + * "increase-x-height", &prop ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * Set this value right after calling @FT_Set_Char_Size, but before + * loading any glyph (using the auto-hinter). + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @struct: + * FT_Prop_IncreaseXHeight + * + * @description: + * The data exchange structure for the @increase-x-height property. + * + */ + typedef struct FT_Prop_IncreaseXHeight_ + { + FT_Face face; + FT_UInt limit; + + } FT_Prop_IncreaseXHeight; + + + /************************************************************************** + * + * @property: + * warping + * + * @description: + * *Experimental* *only* + * + * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to + * activate the warp hinting code in the auto-hinter, this property + * switches warping on and off. + * + * Warping only works in `normal' auto-hinting mode replacing it. + * The idea of the code is to slightly scale and shift a glyph along + * the non-hinted dimension (which is usually the horizontal axis) so + * that as much of its segments are aligned (more or less) to the grid. + * To find out a glyph's optimal scaling and shifting value, various + * parameter combinations are tried and scored. + * + * By default, warping is off. The example below shows how to switch on + * warping (omitting the error handling). + * + * { + * FT_Library library; + * FT_Bool warping = 1; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "warping", &warping ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * + * The warping code can also change advance widths. Have a look at the + * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure + * for details on improving inter-glyph distances while rendering. + * + * Since warping is a global property of the auto-hinter it is best to + * change its value before rendering any face. Otherwise, you should + * reload all faces that get auto-hinted in `normal' hinting mode. + * + * @since: + * 2.6 + * + */ + + + /* */ + + +FT_END_HEADER + + +#endif /* FTDRIVER_H_ */ + + +/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/fterrdef.h b/sdk/lib/3rdparty/freetype/include/freetype/fterrdef.h index 6a6dc85b870..8ffd346ca8f 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/fterrdef.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ /* */ /* FreeType error codes (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/fterrors.h b/sdk/lib/3rdparty/freetype/include/freetype/fterrors.h index ae382c419f7..f6ee5c24e28 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/fterrors.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/fterrors.h @@ -4,7 +4,7 @@ /* */ /* FreeType error code handling (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftfntfmt.h b/sdk/lib/3rdparty/freetype/include/freetype/ftfntfmt.h index 337758328a6..cc86efac23b 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftfntfmt.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftfntfmt.h @@ -4,7 +4,7 @@ /* */ /* Support functions for font formats. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftgasp.h b/sdk/lib/3rdparty/freetype/include/freetype/ftgasp.h index ce18d647844..9b54fc86a08 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftgasp.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftgasp.h @@ -4,7 +4,7 @@ /* */ /* Access of TrueType's `gasp' table (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftglyph.h b/sdk/lib/3rdparty/freetype/include/freetype/ftglyph.h index db1a2c8ba5a..5f3fc009cd4 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftglyph.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftglyph.h @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -347,10 +347,10 @@ FT_BEGIN_HEADER /* */ /* */ /* Return a glyph's `control box'. The control box encloses all the */ - /* outline's points, including Bézier control points. Though it */ + /* outline's points, including Bezier 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 */ - /* that contains Bézier outside arcs). */ + /* that contains Bezier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftgxval.h b/sdk/lib/3rdparty/freetype/include/freetype/ftgxval.h index f239c71eb1b..8382d599545 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftgxval.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftgxval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -101,15 +101,15 @@ FT_BEGIN_HEADER * The number of tables checked in this module. Use it as a parameter * for the `table-length' argument of function @FT_TrueTypeGX_Validate. */ -#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) +#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 ) /* */ /* Up to 0x1000 is used by otvalid. Ox2xxx is reserved for feature OT extension. */ -#define FT_VALIDATE_GX_START 0x4000 -#define FT_VALIDATE_GX_BITFIELD( tag ) \ - ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) +#define FT_VALIDATE_GX_START 0x4000 +#define FT_VALIDATE_GX_BITFIELD( tag ) \ + ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) /********************************************************************** diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftgzip.h b/sdk/lib/3rdparty/freetype/include/freetype/ftgzip.h index bd5ceaab9f3..db033da0ed2 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftgzip.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftgzip.h @@ -4,7 +4,7 @@ /* */ /* Gzip-compressed stream support. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -129,6 +129,9 @@ FT_BEGIN_HEADER * @note: * This function may return `FT_Err_Unimplemented_Feature' if your build * of FreeType was not compiled with zlib support. + * + * @since: + * 2.5.1 */ FT_EXPORT( FT_Error ) FT_Gzip_Uncompress( FT_Memory memory, diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftimage.h b/sdk/lib/3rdparty/freetype/include/freetype/ftimage.h index 1c789e5a44c..79ede1959d7 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftimage.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftimage.h @@ -5,7 +5,7 @@ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -169,13 +169,13 @@ FT_BEGIN_HEADER /* @FT_RENDER_MODE_LCD_V. */ /* */ /* FT_PIXEL_MODE_BGRA :: */ - /* An image with four 8-bit channels per pixel, representing a */ - /* color image (such as emoticons) with alpha channel. For each */ - /* pixel, the format is BGRA, which means, the blue channel comes */ - /* first in memory. The color channels are pre-multiplied and in */ - /* the sRGB colorspace. For example, full red at half-translucent */ - /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */ - /* See also @FT_LOAD_COLOR. */ + /* [Since 2.5] An image with four 8-bit channels per pixel, */ + /* representing a color image (such as emoticons) with alpha */ + /* channel. For each pixel, the format is BGRA, which means, the */ + /* blue channel comes first in memory. The color channels are */ + /* pre-multiplied and in the sRGB colorspace. For example, full */ + /* red at half-translucent opacity will be represented as */ + /* `00,00,80,80', not `00,00,FF,80'. See also @FT_LOAD_COLOR. */ /* */ typedef enum FT_Pixel_Mode_ { @@ -301,11 +301,11 @@ FT_BEGIN_HEADER /* 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 */ + /* i.e., a Bezier control point, while it is `on' if */ /* set. */ /* */ /* Bit~1 is meaningful for `off' points only. If set, */ - /* it indicates a third-order Bézier arc control point; */ + /* it indicates a third-order Bezier arc control point; */ /* and a second-order control point if unset. */ /* */ /* If bit~2 is set, bits 5-7 contain the drop-out mode */ @@ -532,7 +532,7 @@ FT_BEGIN_HEADER /* 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 */ + /* A `conic to' is emitted to indicate a second-order Bezier arc in */ /* the outline. */ /* */ /* */ @@ -564,12 +564,12 @@ FT_BEGIN_HEADER /* A function pointer type used to describe the signature of a `cubic */ /* to' function during outline walking or decomposition. */ /* */ - /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ + /* A `cubic to' is emitted to indicate a third-order Bezier arc. */ /* */ /* */ - /* control1 :: A pointer to the first Bézier control point. */ + /* control1 :: A pointer to the first Bezier control point. */ /* */ - /* control2 :: A pointer to the second Bézier control point. */ + /* control2 :: A pointer to the second Bezier control point. */ /* */ /* to :: A pointer to the target end point. */ /* */ @@ -595,16 +595,16 @@ FT_BEGIN_HEADER /* */ /* */ /* A structure to hold various function pointers used during outline */ - /* decomposition in order to emit segments, conic, and cubic Béziers. */ + /* decomposition in order to emit segments, conic, and cubic Beziers. */ /* */ /* */ /* move_to :: The `move to' emitter. */ /* */ /* line_to :: The segment emitter. */ /* */ - /* conic_to :: The second-order Bézier arc emitter. */ + /* conic_to :: The second-order Bezier arc emitter. */ /* */ - /* cubic_to :: The third-order Bézier arc emitter. */ + /* cubic_to :: The third-order Bezier arc emitter. */ /* */ /* shift :: The shift that is applied to coordinates before they */ /* are sent to the emitter. */ @@ -701,7 +701,7 @@ FT_BEGIN_HEADER /* */ /* FT_GLYPH_FORMAT_OUTLINE :: */ /* The glyph image is a vectorial outline made of line segments */ - /* and Bézier arcs; it can be described as an @FT_Outline; you */ + /* and Bezier arcs; it can be described as an @FT_Outline; you */ /* generally want to access the `outline' field of the */ /* @FT_GlyphSlotRec structure to read it. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftincrem.h b/sdk/lib/3rdparty/freetype/include/freetype/ftincrem.h index f6ae2baed6c..44619f941e7 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftincrem.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftincrem.h @@ -4,7 +4,7 @@ /* */ /* FreeType incremental loading (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 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 #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -331,18 +332,6 @@ FT_BEGIN_HEADER 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. - * - */ -#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) - /* */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftlcdfil.h b/sdk/lib/3rdparty/freetype/include/freetype/ftlcdfil.h index bdaf9af9060..2a27196cbb8 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftlcdfil.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftlcdfil.h @@ -5,7 +5,7 @@ /* FreeType API for color filtering of subpixel bitmap glyphs */ /* (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 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 #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -280,23 +281,6 @@ FT_BEGIN_HEADER unsigned char *weights ); - /************************************************************************** - * - * @constant: - * FT_PARAM_TAG_LCD_FILTER_WEIGHTS - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding argument specifies the five LCD filter weights for a - * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding - * the global default values or the values set up with - * @FT_Library_SetLcdFilterWeights. - * - */ -#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ - FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) - - /* * @type: * FT_LcdFiveTapFilter @@ -305,6 +289,9 @@ FT_BEGIN_HEADER * A typedef for passing the five LCD filter weights to * @FT_Face_Properties within an @FT_Parameter structure. * + * @since: + * 2.8 + * */ #define FT_LCD_FILTER_FIVE_TAPS 5 diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftlist.h b/sdk/lib/3rdparty/freetype/include/freetype/ftlist.h index 5309cb18ba5..117473b96a2 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftlist.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftlist.h @@ -4,7 +4,7 @@ /* */ /* Generic list support for FreeType (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftlzw.h b/sdk/lib/3rdparty/freetype/include/freetype/ftlzw.h index a82c95e7c9f..1615912d62a 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftlzw.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftlzw.h @@ -4,7 +4,7 @@ /* */ /* LZW-compressed stream support. */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftmac.h b/sdk/lib/3rdparty/freetype/include/freetype/ftmac.h index a1656eec0e2..c1e497ca2db 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftmac.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftmac.h @@ -4,7 +4,7 @@ /* */ /* Additional Mac-specific API. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftmm.h b/sdk/lib/3rdparty/freetype/include/freetype/ftmm.h index 80ac98d6123..9948102c14f 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftmm.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftmm.h @@ -4,7 +4,7 @@ /* */ /* FreeType Multiple Master font interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -286,7 +286,7 @@ FT_BEGIN_HEADER /* */ /* amaster :: The variation descriptor. */ /* Allocates a data structure, which the user must */ - /* deallocate with `free' after use. */ + /* deallocate with a call to @FT_Done_MM_Var after use. */ /* */ /* */ /* FreeType error code. 0~means success. */ @@ -296,6 +296,26 @@ FT_BEGIN_HEADER FT_MM_Var* *amaster ); + /*************************************************************************/ + /* */ + /* */ + /* FT_Done_MM_Var */ + /* */ + /* */ + /* Free the memory allocated by @FT_Get_MM_Var. */ + /* */ + /* */ + /* library :: A handle of the face's parent library object that was */ + /* used in the call to @FT_Get_MM_Var to create `amaster'. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Done_MM_Var( FT_Library library, + FT_MM_Var *amaster ); + + /*************************************************************************/ /* */ /* */ @@ -323,9 +343,13 @@ FT_BEGIN_HEADER /* FreeType error code. 0~means success. */ /* */ /* */ - /* To reset all axes to the default values, call the function with */ - /* `num_coords' set to zero and `coords' set to NULL (new feature in */ - /* FreeType version 2.8.1). */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, @@ -358,9 +382,15 @@ FT_BEGIN_HEADER /* FreeType error code. 0~means success. */ /* */ /* */ - /* To reset all axes to the default values, call the function with */ - /* `num_coords' set to zero and `coords' set to NULL (new feature in */ - /* FreeType version 2.8.1). */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* [Since 2.9] `Default values' means the currently selected named */ + /* instance (or the base font if no named instance is selected). */ + /* */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Var_Design_Coordinates( FT_Face face, @@ -392,6 +422,9 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -427,9 +460,15 @@ FT_BEGIN_HEADER /* FreeType error code. 0~means success. */ /* */ /* */ - /* To reset all axes to the default values, call the function with */ - /* `num_coords' set to zero and `coords' set to NULL (new feature in */ - /* FreeType version 2.8.1). */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* [Since 2.9] `Default values' means the currently selected named */ + /* instance (or the base font if no named instance is selected). */ + /* */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, @@ -462,6 +501,9 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, @@ -490,6 +532,9 @@ FT_BEGIN_HEADER /* */ /* This is another name of @FT_Get_MM_Blend_Coordinates. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Blend_Coordinates( FT_Face face, FT_UInt num_coords, @@ -509,6 +554,9 @@ FT_BEGIN_HEADER /* FT_VAR_AXIS_FLAG_HIDDEN :: */ /* The variation axis should not be exposed to user interfaces. */ /* */ + /* */ + /* 2.8.1 */ + /* */ #define FT_VAR_AXIS_FLAG_HIDDEN 1 @@ -534,11 +582,51 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 2.8.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Axis_Flags( FT_MM_Var* master, FT_UInt axis_index, FT_UInt* flags ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_Set_Named_Instance */ + /* */ + /* */ + /* Set or change the current named instance. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* instance_index :: The index of the requested instance, starting */ + /* with value 1. If set to value 0, FreeType */ + /* switches to font access without a named */ + /* instance. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + /* */ + /* The function uses the value of `instance_index' to set bits 16-30 */ + /* of the face's `face_index' field. It also resets any variation */ + /* applied to the font, and the @FT_FACE_FLAG_VARIATION bit of the */ + /* face's `face_flags' field gets reset to zero (i.e., */ + /* @FT_IS_VARIATION will return false). */ + /* */ + /* For Adobe MM fonts (which don't have named instances) this */ + /* function simply resets the current face to the default instance. */ + /* */ + /* */ + /* 2.9 */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Named_Instance( FT_Face face, + FT_UInt instance_index ); + /* */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftmodapi.h b/sdk/lib/3rdparty/freetype/include/freetype/ftmodapi.h index 4147aadf8b2..a6eb876ebe3 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftmodapi.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ /* */ /* FreeType modules public interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -323,16 +323,15 @@ FT_BEGIN_HEADER * The module name. * * property_name :: - * The property name. Properties are described in the `Synopsis' - * subsection of the module's documentation. + * The property name. Properties are described in section + * @properties. * * Note that only a few modules have properties. * * value :: * A generic pointer to a variable or structure that gives the new * value of the property. The exact definition of `value' is - * dependent on the property; see the `Synopsis' subsection of the - * module's documentation. + * dependent on the property; see section @properties. * * @return: * FreeType error code. 0~means success. @@ -390,15 +389,14 @@ FT_BEGIN_HEADER * The module name. * * property_name :: - * The property name. Properties are described in the `Synopsis' - * subsection of the module's documentation. + * The property name. Properties are described in section + * @properties. * * @inout: * value :: * A generic pointer to a variable or structure that gives the * value of the property. The exact definition of `value' is - * dependent on the property; see the `Synopsis' subsection of the - * module's documentation. + * dependent on the property; see section @properties. * * @return: * FreeType error code. 0~means success. @@ -446,8 +444,8 @@ FT_BEGIN_HEADER /* */ /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */ /* set, this function reads the `FREETYPE_PROPERTIES' environment */ - /* variable to control driver properties. See sections @auto_hinter, */ - /* @cff_driver, @pcf_driver, and @tt_driver for more. */ + /* variable to control driver properties. See section @properties */ + /* for more. */ /* */ /* If the compilation option is not set, this function does nothing. */ /* */ @@ -475,6 +473,9 @@ FT_BEGIN_HEADER /* */ /* library :: A handle to a new library object. */ /* */ + /* */ + /* 2.8 */ + /* */ FT_EXPORT( void ) FT_Set_Default_Properties( FT_Library library ); diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftmoderr.h b/sdk/lib/3rdparty/freetype/include/freetype/ftmoderr.h index 7f608375e8b..e0fc1312bd4 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftmoderr.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftotval.h b/sdk/lib/3rdparty/freetype/include/freetype/ftotval.h index b5d27cfe743..26731c2b9f5 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftotval.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftotval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating OpenType tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftoutln.h b/sdk/lib/3rdparty/freetype/include/freetype/ftoutln.h index 56f56a9603e..89389a49b7c 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftoutln.h +++ b/sdk/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-2017 by */ +/* Copyright 1996-2018 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 /* */ /* */ /* Walk over an outline's structure to decompose it into individual */ - /* segments and Bézier arcs. This function also emits `move to' */ + /* segments and Bezier arcs. This function also emits `move to' */ /* operations to indicate the start of new contours in the outline. */ /* */ /* */ @@ -190,9 +190,6 @@ FT_BEGIN_HEADER /* If the outline's `owner' field is not set, only the outline */ /* descriptor will be released. */ /* */ - /* The reason why this function takes an `library' parameter is */ - /* simply to use ft_mem_free(). */ - /* */ FT_EXPORT( FT_Error ) FT_Outline_Done( FT_Library library, FT_Outline* outline ); @@ -232,10 +229,10 @@ FT_BEGIN_HEADER /* */ /* */ /* Return an outline's `control box'. The control box encloses all */ - /* the outline's points, including Bézier control points. Though it */ + /* the outline's points, including Bezier 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 */ - /* that contains Bézier outside arcs). */ + /* that contains Bezier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftparams.h b/sdk/lib/3rdparty/freetype/include/freetype/ftparams.h new file mode 100644 index 00000000000..5a9006c505d --- /dev/null +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftparams.h @@ -0,0 +1,205 @@ +/***************************************************************************/ +/* */ +/* ftparams.h */ +/* */ +/* FreeType API for possible FT_Parameter tags (specification only). */ +/* */ +/* Copyright 2017-2018 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 FTPARAMS_H_ +#define FTPARAMS_H_ + +#include +#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: + * parameter_tags + * + * @title: + * Parameter Tags + * + * @abstract: + * Macros for driver property and font loading parameter tags. + * + * @description: + * This section contains macros for the @FT_Parameter structure that are + * used with various functions to activate some special functionality or + * different behaviour of various components of FreeType. + * + */ + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic + * family names in the `name' table (introduced in OpenType version + * 1.4). Use this for backward compatibility with legacy systems that + * have a four-faces-per-family restriction. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ + FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) + + + /* this constant is deprecated */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic + * subfamily names in the `name' table (introduced in OpenType version + * 1.4). Use this for backward compatibility with legacy systems that + * have a four-faces-per-family restriction. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ + FT_MAKE_TAG( 'i', 'g', 'p', 's' ) + + + /* this constant is deprecated */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_INCREMENTAL + * + * @description: + * An @FT_Parameter tag to be used with @FT_Open_Face to indicate + * incremental glyph loading. + * + */ +#define FT_PARAM_TAG_INCREMENTAL \ + FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_LCD_FILTER_WEIGHTS + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding argument specifies the five LCD filter weights for a + * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding + * the global default values or the values set up with + * @FT_Library_SetLcdFilterWeights. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ + FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_RANDOM_SEED + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding 32bit signed integer argument overrides the font + * driver's random seed value with a face-specific one; see + * @random-seed. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_RANDOM_SEED \ + FT_MAKE_TAG( 's', 'e', 'e', 'd' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_STEM_DARKENING + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding Boolean argument specifies whether to apply stem + * darkening, overriding the global default values or the values set up + * with @FT_Property_Set (see @no-stem-darkening). + * + * This is a passive setting that only takes effect if the font driver + * or autohinter honors it, which the CFF, Type~1, and CID drivers + * always do, but the autohinter only in `light' hinting mode (as of + * version 2.9). + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_STEM_DARKENING \ + FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_UNPATENTED_HINTING + * + * @description: + * Deprecated, no effect. + * + * Previously: A constant used as the tag of an @FT_Parameter structure to + * indicate that unpatented methods only should be used by the TrueType + * bytecode interpreter for a typeface opened by @FT_Open_Face. + * + */ +#define FT_PARAM_TAG_UNPATENTED_HINTING \ + FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) + + + /* */ + + +FT_END_HEADER + + +#endif /* FTPARAMS_H_ */ + + +/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftpcfdrv.h b/sdk/lib/3rdparty/freetype/include/freetype/ftpcfdrv.h deleted file mode 100644 index 6622c936fb7..00000000000 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftpcfdrv.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftpcfdrv.h */ -/* */ -/* FreeType API for controlling the PCF driver (specification only). */ -/* */ -/* Copyright 2017 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 FTPCFDRV_H_ -#define FTPCFDRV_H_ - -#include -#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: - * pcf_driver - * - * @title: - * The PCF driver - * - * @abstract: - * Controlling the PCF driver module. - * - * @description: - * While FreeType's PCF driver doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. Right now, there is a single property - * `no-long-family-names' available if FreeType is compiled with - * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. - * - * The PCF driver's module name is `pcf'. - * - */ - - - /************************************************************************** - * - * @property: - * no-long-family-names - * - * @description: - * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling - * FreeType, the PCF driver constructs long family names. - * - * There are many PCF fonts just called `Fixed' which look completely - * different, and which have nothing to do with each other. When - * selecting `Fixed' in KDE or Gnome one gets results that appear rather - * random, the style changes often if one changes the size and one - * cannot select some fonts at all. The improve this situation, the PCF - * module prepends the foundry name (plus a space) to the family name. - * It also checks whether there are `wide' characters; all put together, - * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed. - * - * If `no-long-family-names' is set, this feature gets switched off. - * - * { - * FT_Library library; - * FT_Bool no_long_family_names = TRUE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "pcf", - * "no-long-family-names", - * &no_long_family_names ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * - */ - - -FT_END_HEADER - - -#endif /* FTPCFDRV_H_ */ - - -/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftpfr.h b/sdk/lib/3rdparty/freetype/include/freetype/ftpfr.h index f2a6ae9349a..ce60eb4a8ad 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftpfr.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftpfr.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftrender.h b/sdk/lib/3rdparty/freetype/include/freetype/ftrender.h index 960837580ac..fa8ad22b987 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftrender.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftrender.h @@ -4,7 +4,7 @@ /* */ /* FreeType renderer modules public interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -88,7 +88,7 @@ FT_BEGIN_HEADER typedef FT_Error (*FT_Renderer_RenderFunc)( FT_Renderer renderer, FT_GlyphSlot slot, - FT_UInt mode, + FT_Render_Mode mode, const FT_Vector* origin ); typedef FT_Error diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftsizes.h b/sdk/lib/3rdparty/freetype/include/freetype/ftsizes.h index 2f3958a8578..72cb08bf2a7 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftsizes.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftsizes.h @@ -4,7 +4,7 @@ /* */ /* FreeType size objects management (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftsnames.h b/sdk/lib/3rdparty/freetype/include/freetype/ftsnames.h index a3165405768..8eb8d70ff7f 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftsnames.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftsnames.h @@ -7,7 +7,7 @@ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 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 #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -189,6 +190,9 @@ FT_BEGIN_HEADER /* Please refer to the TrueType or OpenType specification for more */ /* details. */ /* */ + /* */ + /* 2.8 */ + /* */ typedef struct FT_SfntLangTag_ { FT_Byte* string; /* this string is *not* null-terminated! */ @@ -229,53 +233,15 @@ FT_BEGIN_HEADER /* invalid format~1 language ID values, FT_Err_Invalid_Argument is */ /* returned. */ /* */ + /* */ + /* 2.8 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Sfnt_LangTag( FT_Face face, FT_UInt langID, FT_SfntLangTag *alangTag ); - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY - * - * @description: - * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic - * family names in the `name' table (introduced in OpenType version - * 1.4). Use this for backward compatibility with legacy systems that - * have a four-faces-per-family restriction. - * - */ -#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ - FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) - - - /* this constant is deprecated */ -#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ - FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY - * - * @description: - * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic - * subfamily names in the `name' table (introduced in OpenType version - * 1.4). Use this for backward compatibility with legacy systems that - * have a four-faces-per-family restriction. - * - */ -#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ - FT_MAKE_TAG( 'i', 'g', 'p', 's' ) - - - /* this constant is deprecated */ -#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ - FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY - /* */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftstroke.h b/sdk/lib/3rdparty/freetype/include/freetype/ftstroke.h index 4a20667c5e9..44b6fbe19ff 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftstroke.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftstroke.h @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -466,7 +466,7 @@ FT_BEGIN_HEADER * FT_Stroker_ConicTo * * @description: - * `Draw' a single quadratic Bézier in the stroker's current sub-path, + * `Draw' a single quadratic Bezier in the stroker's current sub-path, * from the last position. * * @input: @@ -474,7 +474,7 @@ FT_BEGIN_HEADER * The target stroker handle. * * control :: - * A pointer to a Bézier control point. + * A pointer to a Bezier control point. * * to :: * A pointer to the destination point. @@ -498,7 +498,7 @@ FT_BEGIN_HEADER * FT_Stroker_CubicTo * * @description: - * `Draw' a single cubic Bézier in the stroker's current sub-path, + * `Draw' a single cubic Bezier in the stroker's current sub-path, * from the last position. * * @input: @@ -506,10 +506,10 @@ FT_BEGIN_HEADER * The target stroker handle. * * control1 :: - * A pointer to the first Bézier control point. + * A pointer to the first Bezier control point. * * control2 :: - * A pointer to second Bézier control point. + * A pointer to second Bezier control point. * * to :: * A pointer to the destination point. diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftsynth.h b/sdk/lib/3rdparty/freetype/include/freetype/ftsynth.h index 1863fa2383e..ff9fb43d964 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftsynth.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ /* FreeType synthesizing code for emboldening and slanting */ /* (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftsystem.h b/sdk/lib/3rdparty/freetype/include/freetype/ftsystem.h index 1aa4762ad65..f6b1629ef23 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftsystem.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftsystem.h @@ -4,7 +4,7 @@ /* */ /* FreeType low-level system interface definition (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/fttrigon.h b/sdk/lib/3rdparty/freetype/include/freetype/fttrigon.h index 89f0350675a..2e3f3f1f737 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/fttrigon.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/fttrigon.h @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftttdrv.h b/sdk/lib/3rdparty/freetype/include/freetype/ftttdrv.h deleted file mode 100644 index 26bc5e966ae..00000000000 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftttdrv.h +++ /dev/null @@ -1,328 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftttdrv.h */ -/* */ -/* FreeType API for controlling the TrueType driver */ -/* (specification only). */ -/* */ -/* Copyright 2013-2017 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 FTTTDRV_H_ -#define FTTTDRV_H_ - -#include -#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: - * tt_driver - * - * @title: - * The TrueType driver - * - * @abstract: - * Controlling the TrueType driver module. - * - * @description: - * While FreeType's TrueType driver doesn't expose API functions by - * itself, it is possible to control its behaviour with @FT_Property_Set - * and @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * The TrueType driver's module name is `truetype'. - * - * We start with a list of definitions, kindly provided by Greg - * Hitchcock. - * - * _Bi-Level_ _Rendering_ - * - * Monochromatic rendering, exclusively used in the early days of - * TrueType by both Apple and Microsoft. Microsoft's GDI interface - * supported hinting of the right-side bearing point, such that the - * advance width could be non-linear. Most often this was done to - * achieve some level of glyph symmetry. To enable reasonable - * performance (e.g., not having to run hinting on all glyphs just to - * get the widths) there was a bit in the head table indicating if the - * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to - * cache hinting widths across multiple sizes and device aspect ratios. - * - * _Font_ _Smoothing_ - * - * Microsoft's GDI implementation of anti-aliasing. Not traditional - * anti-aliasing as the outlines were hinted before the sampling. The - * widths matched the bi-level rendering. - * - * _ClearType_ _Rendering_ - * - * Technique that uses physical subpixels to improve rendering on LCD - * (and other) displays. Because of the higher resolution, many methods - * of improving symmetry in glyphs through hinting the right-side - * bearing were no longer necessary. This lead to what GDI calls - * `natural widths' ClearType, see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting - * has extra resolution, most non-linearity went away, but it is still - * possible for hints to change the advance widths in this mode. - * - * _ClearType_ _Compatible_ _Widths_ - * - * One of the earliest challenges with ClearType was allowing the - * implementation in GDI to be selected without requiring all UI and - * documents to reflow. To address this, a compatible method of - * rendering ClearType was added where the font hints are executed once - * to determine the width in bi-level rendering, and then re-run in - * ClearType, with the difference in widths being absorbed in the font - * hints for ClearType (mostly in the white space of hints); see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by - * definition, compatible width ClearType allows for non-linear widths, - * but only when the bi-level version has non-linear widths. - * - * _ClearType_ _Subpixel_ _Positioning_ - * - * One of the nice benefits of ClearType is the ability to more crisply - * display fractional widths; unfortunately, the GDI model of integer - * bitmaps did not support this. However, the WPF and Direct Write - * frameworks do support fractional widths. DWrite calls this `natural - * mode', not to be confused with GDI's `natural widths'. Subpixel - * positioning, in the current implementation of Direct Write, - * unfortunately does not support hinted advance widths, see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the - * TrueType interpreter fully allows the advance width to be adjusted in - * this mode, just the DWrite client will ignore those changes. - * - * _ClearType_ _Backward_ _Compatibility_ - * - * This is a set of exceptions made in the TrueType interpreter to - * minimize hinting techniques that were problematic with the extra - * resolution of ClearType; see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and - * http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. - * This technique is not to be confused with ClearType compatible - * widths. ClearType backward compatibility has no direct impact on - * changing advance widths, but there might be an indirect impact on - * disabling some deltas. This could be worked around in backward - * compatibility mode. - * - * _Native_ _ClearType_ _Mode_ - * - * (Not to be confused with `natural widths'.) This mode removes all - * the exceptions in the TrueType interpreter when running with - * ClearType. Any issues on widths would still apply, though. - * - */ - - - /************************************************************************** - * - * @property: - * interpreter-version - * - * @description: - * Currently, three versions are available, two representing the - * bytecode interpreter with subpixel hinting support (old `Infinality' - * code and new stripped-down and higher performance `minimal' code) and - * one without, respectively. The default is subpixel support if - * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support - * otherwise (since it isn't available then). - * - * If subpixel hinting is on, many TrueType bytecode instructions behave - * differently compared to B/W or grayscale rendering (except if `native - * ClearType' is selected by the font). Microsoft's main idea is to - * render at a much increased horizontal resolution, then sampling down - * the created output to subpixel precision. However, many older fonts - * are not suited to this and must be specially taken care of by - * applying (hardcoded) tweaks in Microsoft's interpreter. - * - * Details on subpixel hinting and some of the necessary tweaks can be - * found in Greg Hitchcock's whitepaper at - * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. - * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, - * or 6x5 supersampling) like discussed in the paper. Depending on the - * chosen interpreter, it simply ignores instructions on vertical stems - * to arrive at very similar results. - * - * The following example code demonstrates how to deactivate subpixel - * hinting (omitting the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "truetype", - * "interpreter-version", - * &interpreter_version ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values `35', `38', or `40'). - */ - - - /************************************************************************** - * - * @enum: - * TT_INTERPRETER_VERSION_XXX - * - * @description: - * A list of constants used for the @interpreter-version property to - * select the hinting engine for Truetype fonts. - * - * The numeric value in the constant names represents the version - * number as returned by the `GETINFO' bytecode instruction. - * - * @values: - * TT_INTERPRETER_VERSION_35 :: - * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in - * Windows~98; only grayscale and B/W rasterizing is supported. - * - * TT_INTERPRETER_VERSION_38 :: - * Version~38 corresponds to MS rasterizer v.1.9; it is roughly - * equivalent to the hinting provided by DirectWrite ClearType (as can - * be found, for example, in the Internet Explorer~9 running on - * Windows~7). It is used in FreeType to select the `Infinality' - * subpixel hinting code. The code may be removed in a future - * version. - * - * TT_INTERPRETER_VERSION_40 :: - * Version~40 corresponds to MS rasterizer v.2.1; it is roughly - * equivalent to the hinting provided by DirectWrite ClearType (as can - * be found, for example, in Microsoft's Edge Browser on Windows~10). - * It is used in FreeType to select the `minimal' subpixel hinting - * code, a stripped-down and higher performance version of the - * `Infinality' code. - * - * @note: - * This property controls the behaviour of the bytecode interpreter - * and thus how outlines get hinted. It does *not* control how glyph - * get rasterized! In particular, it does not control subpixel color - * filtering. - * - * If FreeType has not been compiled with the configuration option - * TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes - * an `FT_Err_Unimplemented_Feature' error. - * - * Depending on the graphics framework, Microsoft uses different - * bytecode and rendering engines. As a consequence, the version - * numbers returned by a call to the `GETINFO' bytecode instruction are - * more convoluted than desired. - * - * Here are two tables that try to shed some light on the possible - * values for the MS rasterizer engine, together with the additional - * features introduced by it. - * - * { - * GETINFO framework version feature - * ------------------------------------------------------------------- - * 3 GDI (Win 3.1), v1.0 16-bit, first version - * TrueImage - * 33 GDI (Win NT 3.1), v1.5 32-bit - * HP Laserjet - * 34 GDI (Win 95) v1.6 font smoothing, - * new SCANTYPE opcode - * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET - * bits in composite glyphs - * 36 MGDI (Win CE 2) v1.6+ classic ClearType - * 37 GDI (XP and later), v1.8 ClearType - * GDI+ old (before Vista) - * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType, - * WPF Y-direction ClearType, - * additional error checking - * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags - * in GETINFO opcode, - * bug fixes - * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag - * DWrite (Win 8) in GETINFO opcode, - * Gray ClearType - * } - * - * The `version' field gives a rough orientation only, since some - * applications provided certain features much earlier (as an example, - * Microsoft Reader used subpixel and Y-direction ClearType already in - * Windows 2000). Similarly, updates to a given framework might include - * improved hinting support. - * - * { - * version sampling rendering comment - * x y x y - * -------------------------------------------------------------- - * v1.0 normal normal B/W B/W bi-level - * v1.6 high high gray gray grayscale - * v1.8 high normal color-filter B/W (GDI) ClearType - * v1.9 high high color-filter gray Color ClearType - * v2.1 high normal gray B/W Gray ClearType - * v2.1 high high gray gray Gray ClearType - * } - * - * Color and Gray ClearType are the two available variants of - * `Y-direction ClearType', meaning grayscale rasterization along the - * Y-direction; the name used in the TrueType specification for this - * feature is `symmetric smoothing'. `Classic ClearType' is the - * original algorithm used before introducing a modified version in - * Win~XP. Another name for v1.6's grayscale rendering is `font - * smoothing', and `Color ClearType' is sometimes also called `DWrite - * ClearType'. To differentiate between today's Color ClearType and the - * earlier ClearType variant with B/W rendering along the vertical axis, - * the latter is sometimes called `GDI ClearType'. - * - * `Normal' and `high' sampling describe the (virtual) resolution to - * access the rasterized outline after the hinting process. `Normal' - * means 1 sample per grid line (i.e., B/W). In the current Microsoft - * implementation, `high' means an extra virtual resolution of 16x16 (or - * 16x1) grid lines per pixel for bytecode instructions like `MIRP'. - * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid - * lines for color filtering if Color ClearType is activated. - * - * Note that `Gray ClearType' is essentially the same as v1.6's - * grayscale rendering. However, the GETINFO instruction handles it - * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1 - * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing), - * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for - * the version~1 gasp table exclusively (like Color ClearType), while - * v1.6 only respects the values of version~0 (bits 0 and~1). - * - * Keep in mind that the features of the above interpreter versions - * might not map exactly to FreeType features or behavior because it is - * a fundamentally different library with different internals. - * - */ -#define TT_INTERPRETER_VERSION_35 35 -#define TT_INTERPRETER_VERSION_38 38 -#define TT_INTERPRETER_VERSION_40 40 - - /* */ - - -FT_END_HEADER - - -#endif /* FTTTDRV_H_ */ - - -/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/fttypes.h b/sdk/lib/3rdparty/freetype/include/freetype/fttypes.h index eab8adaad48..f638c2e54fd 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/fttypes.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/fttypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType simple types definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -425,7 +425,7 @@ FT_BEGIN_HEADER /* The address of the FreeType object that is under finalization. */ /* Its client data is accessed through its `generic' field. */ /* */ - typedef void (*FT_Generic_Finalizer)(void* object); + typedef void (*FT_Generic_Finalizer)( void* object ); /*************************************************************************/ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ftwinfnt.h b/sdk/lib/3rdparty/freetype/include/freetype/ftwinfnt.h index 1eeef6c8ba2..461c65b7791 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ftwinfnt.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ftwinfnt.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing Windows fnt-specific data. */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -78,7 +78,7 @@ FT_BEGIN_HEADER * Mac Roman encoding. * * FT_WinFNT_ID_OEM :: - * From Michael Pöttgen : + * From Michael Poettgen : * * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM * is used for the charset of vector fonts, like `modern.fon', diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/autohint.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/autohint.h index bae83e73843..f4d308f68c2 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/autohint.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/autohint.h @@ -4,7 +4,7 @@ /* */ /* High-level `autohint' module-specific interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/cffotypes.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/cffotypes.h new file mode 100644 index 00000000000..57e7591d41a --- /dev/null +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/cffotypes.h @@ -0,0 +1,108 @@ +/***************************************************************************/ +/* */ +/* cffotypes.h */ +/* */ +/* Basic OpenType/CFF object type definitions (specification). */ +/* */ +/* Copyright 2017-2018 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 CFFOTYPES_H_ +#define CFFOTYPES_H_ + +#include +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_INTERNAL_TRUETYPE_TYPES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_INTERNAL_POSTSCRIPT_HINTS_H + + +FT_BEGIN_HEADER + + + typedef TT_Face CFF_Face; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Size */ + /* */ + /* */ + /* A handle to an OpenType size object. */ + /* */ + typedef struct CFF_SizeRec_ + { + FT_SizeRec root; + FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */ + + } CFF_SizeRec, *CFF_Size; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_GlyphSlot */ + /* */ + /* */ + /* A handle to an OpenType glyph slot object. */ + /* */ + typedef struct CFF_GlyphSlotRec_ + { + FT_GlyphSlotRec root; + + FT_Bool hint; + FT_Bool scaled; + + FT_Fixed x_scale; + FT_Fixed y_scale; + + } CFF_GlyphSlotRec, *CFF_GlyphSlot; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Internal */ + /* */ + /* */ + /* 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; + + + /*************************************************************************/ + /* */ + /* Subglyph transformation record. */ + /* */ + typedef struct CFF_Transform_ + { + FT_Fixed xx, xy; /* transformation matrix coefficients */ + FT_Fixed yx, yy; + FT_F26Dot6 ox, oy; /* offsets */ + + } CFF_Transform; + + +FT_END_HEADER + + +#endif /* CFFOTYPES_H_ */ + + +/* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cfftypes.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/cfftypes.h similarity index 98% rename from sdk/lib/3rdparty/freetype/src/cff/cfftypes.h rename to sdk/lib/3rdparty/freetype/include/freetype/internal/cfftypes.h index 74f569f08b8..7c07e1a3768 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cfftypes.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/cfftypes.h @@ -5,7 +5,7 @@ /* Basic OpenType/CFF type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,6 +27,7 @@ #include FT_INTERNAL_SERVICE_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_INTERNAL_TYPE1_TYPES_H FT_BEGIN_HEADER @@ -381,6 +382,9 @@ FT_BEGIN_HEADER /* interface to Postscript Names service */ FT_Service_PsCMaps psnames; + /* interface to CFFLoad service */ + const void* cffload; + /* since version 2.3.0 */ PS_FontInfoRec* font_info; /* font info dictionary */ @@ -394,6 +398,9 @@ FT_BEGIN_HEADER /* since version 2.7.1 */ CFF_VStoreRec vstore; /* parsed vstore structure */ + /* since version 2.9 */ + PS_FontExtraRec* font_extra; + } CFF_FontRec; diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h index 8b35f03d887..818a812359d 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h index 5dcd2b17400..292a4eedb8b 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftdrv.h similarity index 98% rename from sdk/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h rename to sdk/lib/3rdparty/freetype/include/freetype/internal/ftdrv.h index e82fa8d41f3..58dd35a9337 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftdrv.h @@ -1,10 +1,10 @@ /***************************************************************************/ /* */ -/* ftdriver.h */ +/* ftdrv.h */ /* */ -/* FreeType font driver interface (specification). */ +/* FreeType internal font driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,8 +16,8 @@ /***************************************************************************/ -#ifndef FTDRIVER_H_ -#define FTDRIVER_H_ +#ifndef FTDRV_H_ +#define FTDRV_H_ #include @@ -394,7 +394,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* FTDRIVER_H_ */ +#endif /* FTDRV_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h index f41c3df5541..a002fdbfca3 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h index 59e5b58a572..054eaec31f7 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ /* */ /* The FreeType memory management macros (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -210,7 +210,7 @@ extern "C++" NULL, \ &error ) ) -#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \ +#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ (FT_Long)(itmsz), \ (FT_Long)(oldcnt), \ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h index 4231be238a3..37c6baffe6f 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -85,9 +85,9 @@ FT_BEGIN_HEADER : y + ( 3 * x >> 3 ) ) /* we use FT_TYPEOF to suppress signedness compilation warnings */ -#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) ) -#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n)/2, n ) -#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n)-1, n ) +#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) ) +#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n) / 2, n ) +#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n) - 1, n ) #define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 ) #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) @@ -156,7 +156,7 @@ FT_BEGIN_HEADER } FT_CMapRec; /* typecase any pointer to a charmap handle */ -#define FT_CMAP( x ) ((FT_CMap)( x )) +#define FT_CMAP( x ) ( (FT_CMap)( x ) ) /* obvious macros */ #define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id @@ -312,6 +312,27 @@ FT_BEGIN_HEADER FT_CMap_Done( FT_CMap cmap ); + /* adds LCD padding to Min and Max boundaries */ + FT_BASE( void ) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ); + +#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, + FT_Render_Mode render_mode, + FT_Byte* weights ); + + + /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ + FT_BASE( void ) + ft_lcd_filter_fir( FT_Bitmap* bitmap, + FT_Render_Mode mode, + FT_LcdFiveTapFilter weights ); + +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + /*************************************************************************/ /* */ /* */ @@ -369,9 +390,10 @@ FT_BEGIN_HEADER /* operator. Value~0 means to use the font's value. Value~-1 */ /* means to use the CFF driver's default. */ /* */ - /* lcd_weights :: */ - /* Overrides the library default with custom weights for the 5-tap */ - /* FIR filter. `{0, 0, 0, 0, 0}' means to use the library default. */ + /* lcd_weights :: */ + /* lcd_filter_func :: */ + /* If subpixel rendering is activated, the LCD filtering weights */ + /* and callback function. */ /* */ /* refcount :: */ /* A counter initialized to~1 at the time an @FT_Face structure is */ @@ -393,8 +415,10 @@ FT_BEGIN_HEADER FT_Char no_stem_darkening; FT_Int32 random_seed; + #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_LcdFiveTapFilter lcd_weights; /* preset or custom filter weights */ + FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */ + FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ #endif FT_Int refcount; @@ -516,7 +540,8 @@ FT_BEGIN_HEADER /* typecast an object to an FT_Module */ -#define FT_MODULE( x ) ((FT_Module)( x )) +#define FT_MODULE( x ) ( (FT_Module)(x) ) + #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library #define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory @@ -602,9 +627,9 @@ FT_BEGIN_HEADER /* a few macros used to perform easy typecasts with minimal brain damage */ -#define FT_FACE( x ) ((FT_Face)(x)) -#define FT_SIZE( x ) ((FT_Size)(x)) -#define FT_SLOT( x ) ((FT_GlyphSlot)(x)) +#define FT_FACE( x ) ( (FT_Face)(x) ) +#define FT_SIZE( x ) ( (FT_Size)(x) ) +#define FT_SLOT( x ) ( (FT_GlyphSlot)(x) ) #define FT_FACE_DRIVER( x ) FT_FACE( x )->driver #define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library @@ -705,6 +730,12 @@ FT_BEGIN_HEADER ft_glyphslot_free_bitmap( FT_GlyphSlot slot ); + /* Preset bitmap metrics of an outline glyphslot prior to rendering. */ + FT_BASE( void ) + ft_glyphslot_preset_bitmap( FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ); + /* Allocate a new bitmap buffer in a glyph slot. */ FT_BASE( FT_Error ) ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot, @@ -731,10 +762,10 @@ FT_BEGIN_HEADER /*************************************************************************/ -#define FT_RENDERER( x ) ((FT_Renderer)( x )) -#define FT_GLYPH( x ) ((FT_Glyph)( x )) -#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x )) -#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x )) +#define FT_RENDERER( x ) ( (FT_Renderer)(x) ) +#define FT_GLYPH( x ) ( (FT_Glyph)(x) ) +#define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) ) +#define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) ) typedef struct FT_RendererRec_ @@ -765,7 +796,7 @@ FT_BEGIN_HEADER /* typecast a module into a driver easily */ -#define FT_DRIVER( x ) ((FT_Driver)(x)) +#define FT_DRIVER( x ) ( (FT_Driver)(x) ) /* typecast a module as a driver, and get its driver class */ #define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz @@ -821,18 +852,6 @@ FT_BEGIN_HEADER #define FT_DEBUG_HOOK_TRUETYPE 0 - typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, - FT_Render_Mode render_mode, - FT_Byte* weights ); - - - /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ - FT_BASE( void ) - ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, - FT_LcdFiveTapFilter weights ); - - /*************************************************************************/ /* */ /* */ @@ -878,9 +897,6 @@ FT_BEGIN_HEADER /* interpreter. Currently, only the TrueType */ /* bytecode debugger uses this. */ /* */ - /* lcd_filter :: If subpixel rendering is activated, the */ - /* selected LCD filter mode. */ - /* */ /* lcd_weights :: If subpixel rendering is activated, the LCD */ /* filter weights, if any. */ /* */ @@ -915,7 +931,6 @@ FT_BEGIN_HEADER FT_DebugHook_Func debug_hooks[4]; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_LcdFilter lcd_filter; FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */ FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ #endif diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftpic.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftpic.h index 0d43ed20f77..5214f059891 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftpic.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (declaration). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftpsprop.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftpsprop.h new file mode 100644 index 00000000000..abbb62862b3 --- /dev/null +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftpsprop.h @@ -0,0 +1,48 @@ +/***************************************************************************/ +/* */ +/* ftpsprop.h */ +/* */ +/* Get and set properties of PostScript drivers (specification). */ +/* */ +/* Copyright 2017-2018 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 FTPSPROP_H_ +#define FTPSPROP_H_ + + +#include +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + FT_BASE_CALLBACK( FT_Error ) + ps_property_set( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value, + FT_Bool value_is_string ); + + FT_BASE_CALLBACK( FT_Error ) + ps_property_get( FT_Module module, /* PS_Driver */ + const char* property_name, + void* value ); + + +FT_END_HEADER + + +#endif /* FTPSPROP_H_ */ + + +/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h index 25a44a44876..1aca48a0e7b 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftserv.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftserv.h index 71ef9cac3a1..e01c1679b51 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftserv.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -330,6 +330,32 @@ FT_BEGIN_HEADER { NULL, NULL } \ }; +#define FT_DEFINE_SERVICEDESCREC10( 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, \ + serv_id_7, serv_data_7, \ + serv_id_8, serv_data_8, \ + serv_id_9, serv_data_9, \ + serv_id_10, serv_data_10 ) \ + 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 }, \ + { serv_id_7, serv_data_7 }, \ + { serv_id_8, serv_data_8 }, \ + { serv_id_9, serv_data_9 }, \ + { serv_id_10, serv_data_10 }, \ + { NULL, NULL } \ + }; + #else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_SERVICEDESCREC1( class_, \ @@ -557,7 +583,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -608,7 +634,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -662,7 +688,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -719,7 +745,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -755,6 +781,68 @@ FT_BEGIN_HEADER return FT_Err_Ok; \ } +#define FT_DEFINE_SERVICEDESCREC10( 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, \ + serv_id_7, serv_data_7, \ + serv_id_8, serv_data_8, \ + serv_id_9, serv_data_9, \ + serv_id_10, serv_data_10 ) \ + 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 = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 11 ) ) \ + 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 = serv_id_7; \ + clazz[ 6].serv_data = serv_data_7; \ + clazz[ 7].serv_id = serv_id_8; \ + clazz[ 7].serv_data = serv_data_8; \ + clazz[ 8].serv_id = serv_id_9; \ + clazz[ 8].serv_data = serv_data_9; \ + clazz[ 9].serv_id = serv_id_10; \ + clazz[ 9].serv_data = serv_data_10; \ + clazz[10].serv_id = NULL; \ + clazz[10].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } + #endif /* FT_CONFIG_OPTION_PIC */ @@ -898,7 +986,9 @@ FT_BEGIN_HEADER */ #define FT_SERVICE_BDF_H +#define FT_SERVICE_CFF_TABLE_LOAD_H #define FT_SERVICE_CID_H +#define FT_SERVICE_FONT_FORMAT_H #define FT_SERVICE_GLYPH_DICT_H #define FT_SERVICE_GX_VALIDATE_H #define FT_SERVICE_KERNING_H @@ -912,10 +1002,9 @@ FT_BEGIN_HEADER #define FT_SERVICE_PROPERTIES_H #define FT_SERVICE_SFNT_H #define FT_SERVICE_TRUETYPE_ENGINE_H +#define FT_SERVICE_TRUETYPE_GLYF_H #define FT_SERVICE_TT_CMAP_H #define FT_SERVICE_WINFNT_H -#define FT_SERVICE_FONT_FORMAT_H -#define FT_SERVICE_TRUETYPE_GLYF_H /* */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftstream.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftstream.h index 3e2c07b269d..f90002fe774 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftstream.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ /* */ /* Stream handling (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -165,8 +165,8 @@ FT_BEGIN_HEADER #define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) ) -#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \ - FT_BYTE_U16( p, 1, 0) ) +#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8 ) | \ + FT_BYTE_U16( p, 1, 0 ) ) #define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \ FT_BYTE_U16( p, 1, 0 ) ) diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/fttrace.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/fttrace.h index caf5fc9460b..8092e41fd73 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/fttrace.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ /* */ /* Tracing handling (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -39,6 +39,7 @@ 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) */ FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */ +FT_TRACE_DEF( psprops ) /* PS driver properties (ftpsprop.c) */ /* Cache sub-system */ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ @@ -66,20 +67,19 @@ FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */ FT_TRACE_DEF( t1afm ) FT_TRACE_DEF( t1driver ) FT_TRACE_DEF( t1gload ) -FT_TRACE_DEF( t1hint ) FT_TRACE_DEF( t1load ) FT_TRACE_DEF( t1objs ) FT_TRACE_DEF( t1parse ) /* PostScript helper module `psaux' */ FT_TRACE_DEF( t1decode ) +FT_TRACE_DEF( cffdecode ) FT_TRACE_DEF( psobjs ) FT_TRACE_DEF( psconv ) /* PostScript hinting module `pshinter' */ FT_TRACE_DEF( pshrec ) -FT_TRACE_DEF( pshalgo1 ) -FT_TRACE_DEF( pshalgo2 ) +FT_TRACE_DEF( pshalgo ) /* Type 2 driver components */ FT_TRACE_DEF( cffdriver ) @@ -96,7 +96,6 @@ FT_TRACE_DEF( cf2interp ) FT_TRACE_DEF( t42 ) /* CID driver components */ -FT_TRACE_DEF( cidafm ) FT_TRACE_DEF( ciddriver ) FT_TRACE_DEF( cidgload ) FT_TRACE_DEF( cidload ) diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftvalid.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftvalid.h index df6f7c5778d..cad47a556d3 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/ftvalid.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/ftvalid.h @@ -4,7 +4,7 @@ /* */ /* FreeType validation support (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/internal.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/internal.h index 02046813a32..8f546e443ba 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/internal.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/internal.h @@ -4,7 +4,7 @@ /* */ /* Internal header files (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,7 +31,7 @@ #define FT_INTERNAL_DEBUG_H #define FT_INTERNAL_CALC_H #define FT_INTERNAL_HASH_H -#define FT_INTERNAL_DRIVER_H +#define FT_INTERNAL_DRIVER_H #define FT_INTERNAL_TRACE_H #define FT_INTERNAL_GLYPH_LOADER_H #define FT_INTERNAL_SFNT_H @@ -44,9 +44,13 @@ #define FT_INTERNAL_POSTSCRIPT_AUX_H #define FT_INTERNAL_POSTSCRIPT_HINTS_H +#define FT_INTERNAL_POSTSCRIPT_PROPS_H #define FT_INTERNAL_AUTOHINT_H +#define FT_INTERNAL_CFF_TYPES_H +#define FT_INTERNAL_CFF_OBJECTS_TYPES_H + #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/psaux.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/psaux.h index 935eb1a9c72..f77380d25ff 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/psaux.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/psaux.h @@ -5,7 +5,7 @@ /* Auxiliary functions and data structures related to PostScript fonts */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,12 +25,32 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TYPE1_TYPES_H #include FT_INTERNAL_HASH_H +#include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H + FT_BEGIN_HEADER + /***********************************************************************/ + /* */ + /* PostScript modules driver class. */ + /* */ + typedef struct PS_DriverRec_ + { + FT_DriverRec root; + + FT_UInt hinting_engine; + FT_Bool no_stem_darkening; + FT_Int darken_params[8]; + FT_Int32 random_seed; + + } PS_DriverRec, *PS_Driver; + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -439,6 +459,202 @@ FT_BEGIN_HEADER } PS_ParserRec; + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct PS_Builder_ PS_Builder; + typedef const struct PS_Builder_FuncsRec_* PS_Builder_Funcs; + + typedef struct PS_Builder_FuncsRec_ + { + void + (*init)( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ); + + void + (*done)( PS_Builder* builder ); + + } PS_Builder_FuncsRec; + + + /*************************************************************************/ + /* */ + /* */ + /* PS_Builder */ + /* */ + /* */ + /* A structure used during glyph loading to store its outline. */ + /* */ + /* */ + /* memory :: The current memory object. */ + /* */ + /* face :: The current face object. */ + /* */ + /* glyph :: The current glyph slot. */ + /* */ + /* loader :: XXX */ + /* */ + /* base :: The base glyph outline. */ + /* */ + /* current :: The current glyph outline. */ + /* */ + /* pos_x :: The horizontal translation (if composite glyph). */ + /* */ + /* pos_y :: The vertical translation (if composite glyph). */ + /* */ + /* left_bearing :: The left side bearing point. */ + /* */ + /* advance :: The horizontal advance vector. */ + /* */ + /* bbox :: Unused. */ + /* */ + /* path_begun :: A flag which indicates that a new path has begun. */ + /* */ + /* load_points :: If this flag is not set, no points are loaded. */ + /* */ + /* no_recurse :: Set but not used. */ + /* */ + /* metrics_only :: A boolean indicating that we only want to compute */ + /* the metrics of a given glyph, not load all of its */ + /* points. */ + /* */ + /* is_t1 :: Set if current font type is Type 1. */ + /* */ + /* funcs :: An array of function pointers for the builder. */ + /* */ + struct PS_Builder_ + { + FT_Memory memory; + FT_Face face; + CFF_GlyphSlot glyph; + FT_GlyphLoader loader; + FT_Outline* base; + FT_Outline* current; + + FT_Pos* pos_x; + FT_Pos* pos_y; + + FT_Vector* left_bearing; + FT_Vector* advance; + + FT_BBox* bbox; /* bounding box */ + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; + + FT_Bool metrics_only; + FT_Bool is_t1; + + PS_Builder_FuncsRec funcs; + + }; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS DECODER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define PS_MAX_OPERANDS 48 +#define PS_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ + /* only 10 are allowed but there exist */ + /* fonts like `HiraKakuProN-W3.ttf' */ + /* (Hiragino Kaku Gothic ProN W3; */ + /* 8.2d6e1; 2014-12-19) that exceed */ + /* this limit */ + + /* execution context charstring zone */ + + typedef struct PS_Decoder_Zone_ + { + FT_Byte* base; + FT_Byte* limit; + FT_Byte* cursor; + + } PS_Decoder_Zone; + + + typedef FT_Error + (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face, + FT_UInt glyph_index, + FT_Byte** pointer, + FT_ULong* length ); + + typedef void + (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face, + FT_Byte** pointer, + FT_ULong length ); + + + typedef struct PS_Decoder_ + { + PS_Builder builder; + + FT_Fixed stack[PS_MAX_OPERANDS + 1]; + FT_Fixed* top; + + PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1]; + PS_Decoder_Zone* zone; + + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; + + CFF_Font cff; + CFF_SubFont current_subfont; /* for current glyph_index */ + FT_Generic* cf2_instance; + + FT_Pos* glyph_width; + FT_Bool width_only; + FT_Int num_hints; + + FT_UInt num_locals; + FT_UInt num_globals; + + FT_Int locals_bias; + FT_Int globals_bias; + + FT_Byte** locals; + FT_Byte** globals; + + FT_Byte** glyph_names; /* for pure CFF fonts only */ + FT_UInt num_glyphs; /* number of glyphs in font */ + + FT_Render_Mode hint_mode; + + FT_Bool seac; + + CFF_Decoder_Get_Glyph_Callback get_glyph_callback; + CFF_Decoder_Free_Glyph_Callback free_glyph_callback; + + /* Type 1 stuff */ + FT_Service_PsCMaps psnames; /* for seac */ + + FT_Int lenIV; /* internal for sub routine calls */ + FT_UInt* locals_len; /* array of subrs length (optional) */ + FT_Hash locals_hash; /* used if `num_subrs' was massaged */ + + FT_Matrix font_matrix; + FT_Vector font_offset; + + PS_Blend blend; /* for multiple master support */ + + FT_Long* buildchar; + FT_UInt len_buildchar; + + } PS_Decoder; + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -653,10 +869,23 @@ FT_BEGIN_HEADER void (*done)( T1_Decoder decoder ); +#ifdef T1_CONFIG_OPTION_OLD_ENGINE FT_Error - (*parse_charstrings)( T1_Decoder decoder, - FT_Byte* base, - FT_UInt len ); + (*parse_charstrings_old)( T1_Decoder decoder, + FT_Byte* base, + FT_UInt len ); +#else + FT_Error + (*parse_metrics)( T1_Decoder decoder, + FT_Byte* base, + FT_UInt len ); +#endif + + FT_Error + (*parse_charstrings)( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); + } T1_Decoder_FuncsRec; @@ -700,9 +929,258 @@ FT_BEGIN_HEADER FT_Bool seac; + FT_Generic cf2_instance; + } T1_DecoderRec; + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct CFF_Builder_ CFF_Builder; + + + typedef FT_Error + (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder, + FT_Int count ); + + typedef void + (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + typedef FT_Error + (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + typedef FT_Error + (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + typedef void + (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder ); + + typedef FT_Error + (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder ); + + typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs; + + typedef struct CFF_Builder_FuncsRec_ + { + void + (*init)( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ); + + void + (*done)( CFF_Builder* builder ); + + CFF_Builder_Check_Points_Func check_points; + CFF_Builder_Add_Point_Func add_point; + CFF_Builder_Add_Point1_Func add_point1; + CFF_Builder_Add_Contour_Func add_contour; + CFF_Builder_Start_Point_Func start_point; + CFF_Builder_Close_Contour_Func close_contour; + + } CFF_Builder_FuncsRec; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Builder */ + /* */ + /* */ + /* A structure used during glyph loading to store its outline. */ + /* */ + /* */ + /* memory :: The current memory object. */ + /* */ + /* face :: The current face object. */ + /* */ + /* glyph :: The current glyph slot. */ + /* */ + /* loader :: The current glyph loader. */ + /* */ + /* base :: The base glyph outline. */ + /* */ + /* current :: The current glyph outline. */ + /* */ + /* pos_x :: The horizontal translation (if composite glyph). */ + /* */ + /* pos_y :: The vertical translation (if composite glyph). */ + /* */ + /* left_bearing :: The left side bearing point. */ + /* */ + /* advance :: The horizontal advance vector. */ + /* */ + /* bbox :: Unused. */ + /* */ + /* path_begun :: A flag which indicates that a new path has begun. */ + /* */ + /* load_points :: If this flag is not set, no points are loaded. */ + /* */ + /* no_recurse :: Set but not used. */ + /* */ + /* metrics_only :: A boolean indicating that we only want to compute */ + /* the metrics of a given glyph, not load all of its */ + /* points. */ + /* */ + /* hints_funcs :: Auxiliary pointer for hinting. */ + /* */ + /* hints_globals :: Auxiliary pointer for hinting. */ + /* */ + /* funcs :: A table of method pointers for this object. */ + /* */ + struct CFF_Builder_ + { + FT_Memory memory; + TT_Face face; + CFF_GlyphSlot glyph; + FT_GlyphLoader loader; + FT_Outline* base; + FT_Outline* current; + + FT_Pos pos_x; + FT_Pos pos_y; + + FT_Vector left_bearing; + FT_Vector advance; + + FT_BBox bbox; /* bounding box */ + + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; + + FT_Bool metrics_only; + + void* hints_funcs; /* hinter-specific */ + void* hints_globals; /* hinter-specific */ + + CFF_Builder_FuncsRec funcs; + }; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF DECODER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + +#define CFF_MAX_OPERANDS 48 +#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ + /* only 10 are allowed but there exist */ + /* fonts like `HiraKakuProN-W3.ttf' */ + /* (Hiragino Kaku Gothic ProN W3; */ + /* 8.2d6e1; 2014-12-19) that exceed */ + /* this limit */ +#define CFF_MAX_TRANS_ELEMENTS 32 + + /* execution context charstring zone */ + + typedef struct CFF_Decoder_Zone_ + { + FT_Byte* base; + FT_Byte* limit; + FT_Byte* cursor; + + } CFF_Decoder_Zone; + + + typedef struct CFF_Decoder_ + { + CFF_Builder builder; + CFF_Font cff; + + FT_Fixed stack[CFF_MAX_OPERANDS + 1]; + FT_Fixed* top; + + CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1]; + CFF_Decoder_Zone* zone; + + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; + + FT_Pos glyph_width; + FT_Pos nominal_width; + + FT_Bool read_width; + FT_Bool width_only; + FT_Int num_hints; + FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; + + FT_UInt num_locals; + FT_UInt num_globals; + + FT_Int locals_bias; + FT_Int globals_bias; + + FT_Byte** locals; + FT_Byte** globals; + + FT_Byte** glyph_names; /* for pure CFF fonts only */ + FT_UInt num_glyphs; /* number of glyphs in font */ + + FT_Render_Mode hint_mode; + + FT_Bool seac; + + CFF_SubFont current_subfont; /* for current glyph_index */ + + CFF_Decoder_Get_Glyph_Callback get_glyph_callback; + CFF_Decoder_Free_Glyph_Callback free_glyph_callback; + + } CFF_Decoder; + + + typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs; + + typedef struct CFF_Decoder_FuncsRec_ + { + void + (*init)( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback ); + + FT_Error + (*prepare)( CFF_Decoder* decoder, + CFF_Size size, + FT_UInt glyph_index ); + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + FT_Error + (*parse_charstrings_old)( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ); +#endif + + FT_Error + (*parse_charstrings)( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); + + } CFF_Decoder_FuncsRec; + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -810,11 +1288,26 @@ FT_BEGIN_HEADER FT_Offset length, FT_UShort seed ); + FT_UInt32 + (*cff_random)( FT_UInt32 r ); + + void + (*ps_decoder_init)( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ); + + void + (*t1_make_subfont)( FT_Face face, + PS_Private priv, + CFF_SubFont subfont ); + T1_CMap_Classes t1_cmap_classes; /* fields after this comment line were added after version 2.1.10 */ const AFM_Parser_FuncsRec* afm_parser_funcs; + const CFF_Decoder_FuncsRec* cff_decoder_funcs; + } PSAux_ServiceRec, *PSAux_Service; /* backward compatible type definition */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/pshints.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/pshints.h index 49116eb4439..d29314ec2ef 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/pshints.h +++ b/sdk/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-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h index eeebf67da1a..4a9ec200755 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h @@ -4,7 +4,7 @@ /* */ /* The FreeType BDF services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svcfftl.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svcfftl.h new file mode 100644 index 00000000000..db623e68405 --- /dev/null +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svcfftl.h @@ -0,0 +1,112 @@ +/***************************************************************************/ +/* */ +/* svcfftl.h */ +/* */ +/* The FreeType CFF tables loader service (specification). */ +/* */ +/* Copyright 2017-2018 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 SVCFFTL_H_ +#define SVCFFTL_H_ + +#include FT_INTERNAL_SERVICE_H +#include FT_INTERNAL_CFF_TYPES_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_CFF_LOAD "cff-load" + + + typedef FT_UShort + (*FT_Get_Standard_Encoding_Func)( FT_UInt charcode ); + + typedef FT_Error + (*FT_Load_Private_Dict_Func)( CFF_Font font, + CFF_SubFont subfont, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + typedef FT_Byte + (*FT_FD_Select_Get_Func)( CFF_FDSelect fdselect, + FT_UInt glyph_index ); + + typedef FT_Bool + (*FT_Blend_Check_Vector_Func)( CFF_Blend blend, + FT_UInt vsindex, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + typedef FT_Error + (*FT_Blend_Build_Vector_Func)( CFF_Blend blend, + FT_UInt vsindex, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + + FT_DEFINE_SERVICE( CFFLoad ) + { + FT_Get_Standard_Encoding_Func get_standard_encoding; + FT_Load_Private_Dict_Func load_private_dict; + FT_FD_Select_Get_Func fd_select_get; + FT_Blend_Check_Vector_Func blend_check_vector; + FT_Blend_Build_Vector_Func blend_build_vector; + }; + + +#ifndef FT_CONFIG_OPTION_PIC + +#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ ) \ + static const FT_Service_CFFLoadRec class_ = \ + { \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ \ + }; + +#else /* FT_CONFIG_OPTION_PIC */ + +#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Service_CFFLoadRec* clazz ) \ + { \ + clazz->get_standard_encoding = get_standard_encoding_; \ + clazz->load_private_dict = load_private_dict_; \ + clazz->fd_select_get = fd_select_get_; \ + clazz->blend_check_vector = blend_check_vector_; \ + clazz->blend_build_vector = blend_build_vector_; \ + } + +#endif /* FT_CONFIG_OPTION_PIC */ + + +FT_END_HEADER + + +#endif + + +/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h index cce94d8df68..cb59ac6a295 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h @@ -4,7 +4,7 @@ /* */ /* The FreeType CID font services (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Derek Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svfntfmt.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svfntfmt.h index 376d9255bbe..3b732be1a17 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svfntfmt.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svfntfmt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType font format service (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h index 0cd13618d86..f1a68e31107 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph dictionary services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 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 #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ get_name_, \ - name_index_) \ + name_index_ ) \ static const FT_Service_GlyphDictRec class_ = \ { \ get_name_, name_index_ \ @@ -66,7 +66,7 @@ FT_BEGIN_HEADER #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ get_name_, \ - name_index_) \ + name_index_ ) \ void \ FT_Init_Class_ ## class_( FT_Library library, \ FT_Service_GlyphDictRec* clazz ) \ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svgxval.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svgxval.h index 71bfa97af86..ed79ebeaa8e 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svgxval.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svgxval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svkern.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svkern.h index b8344e96e9c..c7e8f6ef275 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svkern.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svkern.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Kerning service (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svmetric.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svmetric.h index 1f7d5ddd0c5..abaacddbbe7 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svmetric.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svmetric.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services for metrics variations (specification). */ /* */ -/* Copyright 2016-2017 by */ +/* Copyright 2016-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h index 1d51cd90904..bcbb38e2ce2 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Multiple Masters and GX var services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -48,11 +48,15 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); + /* use return value -1 to indicate that the new coordinates */ + /* are equal to the current ones; no changes are thus needed */ typedef FT_Error (*FT_Set_Var_Design_Func)( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); + /* use return value -1 to indicate that the new coordinates */ + /* are equal to the current ones; no changes are thus needed */ typedef FT_Error (*FT_Set_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, @@ -63,6 +67,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Fixed* coords ); + typedef FT_Error + (*FT_Set_Instance_Func)( FT_Face face, + FT_UInt instance_index ); + typedef FT_Error (*FT_Get_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, @@ -88,6 +96,7 @@ FT_BEGIN_HEADER FT_Get_MM_Var_Func get_mm_var; FT_Set_Var_Design_Func set_var_design; FT_Get_Var_Design_Func get_var_design; + FT_Set_Instance_Func set_instance; /* for internal use; only needed for code sharing between modules */ FT_Get_Var_Blend_Func get_var_blend; @@ -97,27 +106,29 @@ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_blend_, \ - get_mm_var_, \ - set_var_design_, \ - get_var_design_, \ - get_var_blend_, \ - done_blend_ ) \ - static const FT_Service_MultiMastersRec class_ = \ - { \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_blend_, \ - get_mm_var_, \ - set_var_design_, \ - get_var_design_, \ - get_var_blend_, \ - done_blend_ \ +#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_blend_, \ + get_mm_var_, \ + set_var_design_, \ + get_var_design_, \ + set_instance_, \ + get_var_blend_, \ + done_blend_ ) \ + static const FT_Service_MultiMastersRec class_ = \ + { \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_blend_, \ + get_mm_var_, \ + set_var_design_, \ + get_var_design_, \ + set_instance_, \ + get_var_blend_, \ + done_blend_ \ }; #else /* FT_CONFIG_OPTION_PIC */ @@ -130,6 +141,7 @@ FT_BEGIN_HEADER get_mm_var_, \ set_var_design_, \ get_var_design_, \ + set_instance_, \ get_var_blend_, \ done_blend_ ) \ void \ @@ -142,6 +154,7 @@ FT_BEGIN_HEADER clazz->get_mm_var = get_mm_var_; \ clazz->set_var_design = set_var_design_; \ clazz->get_var_design = get_var_design_; \ + clazz->set_instance = set_instance_; \ clazz->get_var_blend = get_var_blend_; \ clazz->done_blend = done_blend_; \ } diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svotval.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svotval.h index ac84abee46e..31294296a6d 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svotval.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svotval.h @@ -4,7 +4,7 @@ /* */ /* The FreeType OpenType validation service (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpfr.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpfr.h index c9a182fe39b..e65d57e91ba 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpfr.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpfr.h @@ -4,7 +4,7 @@ /* */ /* Internal PFR service functions (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h index 022cdec1955..4a49d8b0532 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript name services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svprop.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svprop.h index eb2d4eed156..adc0bcf4398 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svprop.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svprop.h @@ -4,7 +4,7 @@ /* */ /* The FreeType property service (specification). */ /* */ -/* Copyright 2012-2017 by */ +/* Copyright 2012-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h index b32122e5d6b..5589575b92a 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript charmap service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h index 0220ce529c4..408f406dfa2 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript info service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h index 49d18e43e08..e8b37bc47f8 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType SFNT table loading service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h index 30f7feec71a..cd0e6fda6f9 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType/sfnt cmap extra information service. */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* Masatake YAMATO, Redhat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svtteng.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svtteng.h index e4b368ad40f..92e3c541f53 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svtteng.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svtteng.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType engine query service (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h index b7793059fdf..16fac1ca18b 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType glyph service. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svwinfnt.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svwinfnt.h index c94b7e1073e..80d481cbd11 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svwinfnt.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/services/svwinfnt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Windows FNT/FONT service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/sfnt.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/sfnt.h index b8667a003af..fb1e327aeb0 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/sfnt.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/t1types.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/t1types.h index b2e35d42d15..2118e336749 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/t1types.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ /* Basic Type1/Type2 type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/internal/tttypes.h b/sdk/lib/3rdparty/freetype/include/freetype/internal/tttypes.h index c0758e25fc4..10dd336a899 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/internal/tttypes.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -148,7 +148,7 @@ FT_BEGIN_HEADER /* */ /* See */ /* */ - /* http://www.w3.org/TR/WOFF/#WOFFHeader */ + /* https://www.w3.org/TR/WOFF/#WOFFHeader */ /* */ typedef struct WOFF_HeaderRec_ { @@ -1299,10 +1299,6 @@ FT_BEGIN_HEADER /* variation tables (rather like Multiple */ /* Master data). */ /* */ - /* is_default_instance :: Set if the glyph outlines can be used */ - /* unmodified (i.e., without applying glyph */ - /* variation deltas). */ - /* */ /* variation_support :: Flags that indicate which OpenType */ /* functionality related to font variation */ /* support is present, valid, and usable. */ @@ -1445,6 +1441,9 @@ FT_BEGIN_HEADER void* var; #endif + /* a typeless pointer to the PostScript Aux service */ + void* psaux; + /***********************************************************************/ /* */ @@ -1509,7 +1508,6 @@ FT_BEGIN_HEADER FT_Bool doblend; GX_Blend blend; - FT_Bool is_default_instance; /* since 2.7.1 */ FT_UInt32 variation_support; /* since 2.7.1 */ const char* var_postscript_prefix; /* since 2.7.2 */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/t1tables.h b/sdk/lib/3rdparty/freetype/include/freetype/t1tables.h index 3f6b36e1089..3503c2616bd 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/t1tables.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/t1tables.h @@ -5,7 +5,7 @@ /* Basic Type 1/Type 2 tables definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -554,6 +554,9 @@ FT_BEGIN_HEADER /* T1_ENCODING_TYPE_ISOLATIN1 :: */ /* T1_ENCODING_TYPE_EXPERT :: */ /* */ + /* */ + /* 2.4.8 */ + /* */ typedef enum T1_EncodingType_ { T1_ENCODING_TYPE_NONE = 0, @@ -622,6 +625,9 @@ FT_BEGIN_HEADER /* PS_DICT_FS_TYPE :: */ /* PS_DICT_ITALIC_ANGLE :: */ /* */ + /* */ + /* 2.4.8 */ + /* */ typedef enum PS_Dict_Keys_ { /* conventionally in the font dictionary */ @@ -743,6 +749,9 @@ FT_BEGIN_HEADER * If the font's format is not PostScript-based, this function returns * the `FT_Err_Invalid_Argument' error code. * + * @since: + * 2.4.8 + * */ FT_EXPORT( FT_Long ) FT_Get_PS_Font_Value( FT_Face face, diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ttnameid.h b/sdk/lib/3rdparty/freetype/include/freetype/ttnameid.h index 494d6771868..8605183dc70 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/ttnameid.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/ttnameid.h @@ -4,7 +4,7 @@ /* */ /* TrueType name ID definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -437,7 +437,7 @@ FT_BEGIN_HEADER * * The canonical source for Microsoft's IDs is * - * http://www.microsoft.com/globaldev/reference/lcid-all.mspx , + * https://www.microsoft.com/globaldev/reference/lcid-all.mspx , * * however, we only provide macros for language identifiers present in * the OpenType specification: Microsoft has abandoned the concept of diff --git a/sdk/lib/3rdparty/freetype/include/freetype/tttables.h b/sdk/lib/3rdparty/freetype/include/freetype/tttables.h index 58312044cad..ce6a61779c4 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/tttables.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/tttables.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/tttags.h b/sdk/lib/3rdparty/freetype/include/freetype/tttags.h index b7d3bac0f10..e5cee68a159 100644 --- a/sdk/lib/3rdparty/freetype/include/freetype/tttags.h +++ b/sdk/lib/3rdparty/freetype/include/freetype/tttags.h @@ -4,7 +4,7 @@ /* */ /* Tags for TrueType and OpenType tables (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/include/freetype/ttunpat.h b/sdk/lib/3rdparty/freetype/include/freetype/ttunpat.h deleted file mode 100644 index f5e417089e7..00000000000 --- a/sdk/lib/3rdparty/freetype/include/freetype/ttunpat.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************/ -/* */ -/* ttunpat.h */ -/* */ -/* Definitions for the unpatented TrueType hinting system. */ -/* Obsolete, retained for backward compatibility. */ -/* */ -/* Copyright 2003-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Written by Graham Asher */ -/* */ -/* 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 TTUNPAT_H_ -#define TTUNPAT_H_ - - -#include -#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 - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_UNPATENTED_HINTING - * - * @description: - * Deprecated. - * - * Previously: A constant used as the tag of an @FT_Parameter structure to - * indicate that unpatented methods only should be used by the TrueType - * bytecode interpreter for a typeface opened by @FT_Open_Face. - * - */ -#define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) - - /* */ - - -FT_END_HEADER - - -#endif /* TTUNPAT_H_ */ - - -/* END */ diff --git a/sdk/lib/3rdparty/freetype/include/ft2build.h b/sdk/lib/3rdparty/freetype/include/ft2build.h index e7d808f3f4b..e7ce99bc946 100644 --- a/sdk/lib/3rdparty/freetype/include/ft2build.h +++ b/sdk/lib/3rdparty/freetype/include/ft2build.h @@ -4,7 +4,7 @@ /* */ /* FreeType 2 build and setup macros. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/modules.cfg b/sdk/lib/3rdparty/freetype/modules.cfg index 517111efeb6..6ce0f3edbe2 100644 --- a/sdk/lib/3rdparty/freetype/modules.cfg +++ b/sdk/lib/3rdparty/freetype/modules.cfg @@ -1,6 +1,6 @@ # modules.cfg # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -42,7 +42,7 @@ FONT_MODULES += type1 # CFF/OpenType font driver. # -# This driver needs the `sfnt', `pshinter', and `psnames' modules. +# This driver needs the `sfnt', `psaux', `pshinter', and `psnames' modules. FONT_MODULES += cff # Type 1 CID-keyed font driver. diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afangles.c b/sdk/lib/3rdparty/freetype/src/autofit/afangles.c index ccdae841362..c65a3ae23e9 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afangles.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afangles.c @@ -5,7 +5,7 @@ /* Routines used to compute vector angles with limited accuracy */ /* and very high speed. It also contains sorting routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afblue.c b/sdk/lib/3rdparty/freetype/src/autofit/afblue.c index fedeacf7975..61ab7957f0c 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afblue.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afblue.c @@ -7,7 +7,7 @@ /* */ /* Auto-fitter data for blue strings (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afblue.cin b/sdk/lib/3rdparty/freetype/src/autofit/afblue.cin index f9080c54d4e..4913e2eb6f2 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afblue.cin +++ b/sdk/lib/3rdparty/freetype/src/autofit/afblue.cin @@ -4,7 +4,7 @@ /* */ /* Auto-fitter data for blue strings (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afblue.dat b/sdk/lib/3rdparty/freetype/src/autofit/afblue.dat index f62eb82a1ad..d3cc4284b87 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afblue.dat +++ b/sdk/lib/3rdparty/freetype/src/autofit/afblue.dat @@ -2,7 +2,7 @@ // // Auto-fitter data for blue strings. // -// Copyright 2013-2017 by +// Copyright 2013-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afblue.h b/sdk/lib/3rdparty/freetype/src/autofit/afblue.h index 99ef51cd4ae..56b591aa8df 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afblue.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afblue.h @@ -7,7 +7,7 @@ /* */ /* Auto-fitter data for blue strings (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afblue.hin b/sdk/lib/3rdparty/freetype/src/autofit/afblue.hin index 268bcbc531e..682147cb30d 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afblue.hin +++ b/sdk/lib/3rdparty/freetype/src/autofit/afblue.hin @@ -4,7 +4,7 @@ /* */ /* Auto-fitter data for blue strings (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afcjk.c b/sdk/lib/3rdparty/freetype/src/autofit/afcjk.c index aada728876b..dc77ed49e0e 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afcjk.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afcjk.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK writing system (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,9 +16,9 @@ /***************************************************************************/ /* - * The algorithm is based on akito's autohint patch, available here: + * The algorithm is based on akito's autohint patch, archived at * - * http://www.kde.gr.jp/~akito/patch/freetype2/ + * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/ * */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afcjk.h b/sdk/lib/3rdparty/freetype/src/autofit/afcjk.h index 84f892f909b..d229c0c9cff 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afcjk.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afcjk.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK writing system (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afcover.h b/sdk/lib/3rdparty/freetype/src/autofit/afcover.h index 1b18c666abf..6eeb8fc9fb7 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afcover.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afcover.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter coverages (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afdummy.c b/sdk/lib/3rdparty/freetype/src/autofit/afdummy.c index 61c32db5bfb..f30c517cbb3 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afdummy.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afdummy.c @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afdummy.h b/sdk/lib/3rdparty/freetype/src/autofit/afdummy.h index ebaa7d76ea2..b382acd92ae 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afdummy.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afdummy.h @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/aferrors.h b/sdk/lib/3rdparty/freetype/src/autofit/aferrors.h index dde182f3c8f..e5de54360f7 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/aferrors.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/aferrors.h @@ -4,7 +4,7 @@ /* */ /* Autofitter error codes (specification only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afglobal.c b/sdk/lib/3rdparty/freetype/src/autofit/afglobal.c index 85bef001f74..3d09c53e8a0 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afglobal.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afglobal.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter routines to compute global hinting values (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afglobal.h b/sdk/lib/3rdparty/freetype/src/autofit/afglobal.h index de6142ea261..489ed46d9ee 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afglobal.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afglobal.h @@ -5,7 +5,7 @@ /* Auto-fitter routines to compute global hinting values */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afhints.c b/sdk/lib/3rdparty/freetype/src/autofit/afhints.c index 1b21c06c2c7..0666dbc8e20 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afhints.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afhints.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -314,8 +314,12 @@ AF_DUMP(( "Table of points:\n" )); if ( hints->num_points ) + { AF_DUMP(( " index hedge hseg vedge vseg flags " + /* " XXXXX XXXXX XXXXX XXXXX XXXXX XXXXXX" */ " xorg yorg xscale yscale xfit yfit" )); + /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */ + } else AF_DUMP(( " (none)\n" )); @@ -420,9 +424,14 @@ dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); if ( axis->num_segments ) + { AF_DUMP(( " index pos delta dir from to " + /* " XXXXX XXXXX XXXXX XXXXX XXXX XXXX" */ " link serif edge" + /* " XXXX XXXXX XXXX" */ " height extra flags\n" )); + /* " XXXXXX XXXXX XXXXXXXXXXX" */ + } else AF_DUMP(( " (none)\n" )); @@ -564,8 +573,12 @@ 10.0 * hints->y_scale / 65536.0 / 64.0 )); if ( axis->num_edges ) + { AF_DUMP(( " index pos dir link serif" + /* " XXXXX XXXX.XX XXXXX XXXX XXXXX" */ " blue opos pos flags\n" )); + /* " X XXXX.XX XXXX.XX XXXXXXXXXXX" */ + } else AF_DUMP(( " (none)\n" )); diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afhints.h b/sdk/lib/3rdparty/freetype/src/autofit/afhints.h index 16638b10308..3326ebc44e7 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afhints.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afhints.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 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 @@ FT_BEGIN_HEADER * * by David Turner and Werner Lemberg * - * http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf + * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf * * with appropriate updates. * diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afindic.c b/sdk/lib/3rdparty/freetype/src/autofit/afindic.c index 23be46ed515..dfbea5f34c1 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afindic.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afindic.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic writing system (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Rahul Bhalerao , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afindic.h b/sdk/lib/3rdparty/freetype/src/autofit/afindic.h index ec9e2631617..5688738e6e0 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afindic.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afindic.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for Indic writing system */ /* (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Rahul Bhalerao , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/aflatin.c b/sdk/lib/3rdparty/freetype/src/autofit/aflatin.c index 0ed8eb4f60c..7690e1e803a 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/aflatin.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/aflatin.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin writing system (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/aflatin.h b/sdk/lib/3rdparty/freetype/src/autofit/aflatin.h index d80e125ddcd..432cccce4e2 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/aflatin.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/aflatin.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for latin writing system */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/aflatin2.c b/sdk/lib/3rdparty/freetype/src/autofit/aflatin2.c index fb424451165..5c713781189 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/aflatin2.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/aflatin2.c @@ -9,7 +9,7 @@ /* */ /* Auto-fitter hinting routines for latin writing system (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/aflatin2.h b/sdk/lib/3rdparty/freetype/src/autofit/aflatin2.h index 2d0b154f580..0129dc707e6 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/aflatin2.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/aflatin2.h @@ -10,7 +10,7 @@ /* Auto-fitter hinting routines for latin writing system */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afloader.c b/sdk/lib/3rdparty/freetype/src/autofit/afloader.c index 067ebd17f63..a55550b3385 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afloader.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afloader.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afloader.h b/sdk/lib/3rdparty/freetype/src/autofit/afloader.h index 2578abed165..d4d72d15830 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afloader.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afloader.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afmodule.c b/sdk/lib/3rdparty/freetype/src/autofit/afmodule.c index 7a3d5ba6c92..4b994c3dc54 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afmodule.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afmodule.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 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 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H -#include FT_AUTOHINTER_H +#include FT_DRIVER_H #include FT_SERVICE_PROPERTIES_H diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afmodule.h b/sdk/lib/3rdparty/freetype/src/autofit/afmodule.h index 0571d14d591..56f64eaf231 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afmodule.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afmodule.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afpic.c b/sdk/lib/3rdparty/freetype/src/autofit/afpic.c index 3125e03e27e..d48d016a0e8 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afpic.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afpic.h b/sdk/lib/3rdparty/freetype/src/autofit/afpic.h index 8cd33921232..0c734567859 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afpic.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afranges.c b/sdk/lib/3rdparty/freetype/src/autofit/afranges.c index 7f37eea1e00..1355c5e7cc3 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afranges.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afranges.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afranges.h b/sdk/lib/3rdparty/freetype/src/autofit/afranges.h index 72d9eaad2c3..ba3b5e7ccbc 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afranges.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afranges.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afscript.h b/sdk/lib/3rdparty/freetype/src/autofit/afscript.h index cb815dbb40a..6ac193f6a71 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afscript.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afscript.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter scripts (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afshaper.c b/sdk/lib/3rdparty/freetype/src/autofit/afshaper.c index d259964217a..f30828173cf 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afshaper.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afshaper.c @@ -4,7 +4,7 @@ /* */ /* HarfBuzz interface for accessing OpenType features (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -104,10 +104,10 @@ { hb_face_t* face; - hb_set_t* gsub_lookups; /* GSUB lookups for a given script */ - hb_set_t* gsub_glyphs; /* glyphs covered by GSUB lookups */ - hb_set_t* gpos_lookups; /* GPOS lookups for a given script */ - hb_set_t* gpos_glyphs; /* glyphs covered by GPOS lookups */ + hb_set_t* gsub_lookups = NULL; /* GSUB lookups for a given script */ + hb_set_t* gsub_glyphs = NULL; /* glyphs covered by GSUB lookups */ + hb_set_t* gpos_lookups = NULL; /* GPOS lookups for a given script */ + hb_set_t* gpos_glyphs = NULL; /* glyphs covered by GPOS lookups */ hb_script_t script; const hb_tag_t* coverage_tags; @@ -127,11 +127,6 @@ face = hb_font_get_face( globals->hb_font ); - gsub_lookups = hb_set_create(); - gsub_glyphs = hb_set_create(); - gpos_lookups = hb_set_create(); - gpos_glyphs = hb_set_create(); - coverage_tags = coverages[style_class->coverage]; script = scripts[style_class->script]; @@ -168,6 +163,7 @@ script_tags[1] = HB_TAG_NONE; } + gsub_lookups = hb_set_create(); hb_ot_layout_collect_lookups( face, HB_OT_TAG_GSUB, script_tags, @@ -178,13 +174,6 @@ if ( hb_set_is_empty( gsub_lookups ) ) goto Exit; /* nothing to do */ - hb_ot_layout_collect_lookups( face, - HB_OT_TAG_GPOS, - script_tags, - NULL, - coverage_tags, - gpos_lookups ); - FT_TRACE4(( "GSUB lookups (style `%s'):\n" " ", af_style_names[style_class->style] )); @@ -193,6 +182,7 @@ count = 0; #endif + gsub_glyphs = hb_set_create(); for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE @@ -220,10 +210,19 @@ " ", af_style_names[style_class->style] )); + gpos_lookups = hb_set_create(); + hb_ot_layout_collect_lookups( face, + HB_OT_TAG_GPOS, + script_tags, + NULL, + coverage_tags, + gpos_lookups ); + #ifdef FT_DEBUG_LEVEL_TRACE count = 0; #endif + gpos_glyphs = hb_set_create(); for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afshaper.h b/sdk/lib/3rdparty/freetype/src/autofit/afshaper.h index 9185d190031..7efd9f6a4e6 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afshaper.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afshaper.h @@ -4,7 +4,7 @@ /* */ /* HarfBuzz interface for accessing OpenType features (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afstyles.h b/sdk/lib/3rdparty/freetype/src/autofit/afstyles.h index 281559eea2c..e2688b3fc25 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afstyles.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afstyles.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter styles (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/aftypes.h b/sdk/lib/3rdparty/freetype/src/autofit/aftypes.h index 718dab70b64..a50013439bf 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/aftypes.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/aftypes.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter types (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afwarp.c b/sdk/lib/3rdparty/freetype/src/autofit/afwarp.c index f99aa6d9874..2a75ea7b35f 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afwarp.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/afwarp.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afwarp.h b/sdk/lib/3rdparty/freetype/src/autofit/afwarp.h index 2e85cbd851a..520b1be907c 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afwarp.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afwarp.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/afwrtsys.h b/sdk/lib/3rdparty/freetype/src/autofit/afwrtsys.h index 86749a2a830..4675f3242d1 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/afwrtsys.h +++ b/sdk/lib/3rdparty/freetype/src/autofit/afwrtsys.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter writing systems (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/autofit/autofit.c b/sdk/lib/3rdparty/freetype/src/autofit/autofit.c index bbedad7b5f5..c1605160a1c 100644 --- a/sdk/lib/3rdparty/freetype/src/autofit/autofit.c +++ b/sdk/lib/3rdparty/freetype/src/autofit/autofit.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/basepic.c b/sdk/lib/3rdparty/freetype/src/base/basepic.c index 57fb8169ad1..bc804064416 100644 --- a/sdk/lib/3rdparty/freetype/src/base/basepic.c +++ b/sdk/lib/3rdparty/freetype/src/base/basepic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for base. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/basepic.h b/sdk/lib/3rdparty/freetype/src/base/basepic.h index 258d4ce2ba6..492d1ede564 100644 --- a/sdk/lib/3rdparty/freetype/src/base/basepic.h +++ b/sdk/lib/3rdparty/freetype/src/base/basepic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for base. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftadvanc.c b/sdk/lib/3rdparty/freetype/src/base/ftadvanc.c index 1557607fc53..230c84d6ad4 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftadvanc.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftadvanc.c @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (body). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -116,9 +116,12 @@ FT_Int32 flags, FT_Fixed *padvances ) { + FT_Error error = FT_Err_Ok; + FT_Face_GetAdvancesFunc func; - FT_UInt num, end, nn; - FT_Error error = FT_Err_Ok; + + FT_UInt num, end, nn; + FT_Int factor; if ( !face ) @@ -152,16 +155,17 @@ return FT_THROW( Unimplemented_Feature ); flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; + factor = ( flags & FT_LOAD_NO_SCALE ) ? 1 : 1024; for ( nn = 0; nn < count; nn++ ) { error = FT_Load_Glyph( face, start + nn, flags ); if ( error ) break; - /* scale from 26.6 to 16.16 */ + /* scale from 26.6 to 16.16, unless NO_SCALE was requested */ padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) - ? face->glyph->advance.y * 1024 - : face->glyph->advance.x * 1024; + ? face->glyph->advance.y * factor + : face->glyph->advance.x * factor; } return error; diff --git a/sdk/lib/3rdparty/freetype/src/base/ftapi.c b/sdk/lib/3rdparty/freetype/src/base/ftapi.c index 4262d37e399..32d6e95d199 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftapi.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftapi.c @@ -4,7 +4,7 @@ /* */ /* The FreeType compatibility functions (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftbase.c b/sdk/lib/3rdparty/freetype/src/base/ftbase.c index 55f7359942f..a1bdbaf6eac 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftbase.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftbase.c @@ -4,7 +4,7 @@ /* */ /* Single object library component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 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 "ftobjs.c" #include "ftoutln.c" #include "ftpic.c" +#include "ftpsprop.c" #include "ftrfork.c" #include "ftsnames.c" #include "ftstream.c" diff --git a/sdk/lib/3rdparty/freetype/src/base/ftbase.h b/sdk/lib/3rdparty/freetype/src/base/ftbase.h index 2072284f060..7e8cfad9590 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftbase.h +++ b/sdk/lib/3rdparty/freetype/src/base/ftbase.h @@ -2,9 +2,9 @@ /* */ /* ftbase.h */ /* */ -/* The FreeType private functions used in base module (specification). */ +/* Private functions used in the `base' module (specification). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,6 +27,8 @@ FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_MAC_FONTS + /* MacOS resource fork cannot exceed 16MB at least for Carbon code; */ /* see https://support.microsoft.com/en-us/kb/130437 */ #define FT_MAC_RFORK_MAX_LEN 0x00FFFFFFUL @@ -65,6 +67,8 @@ FT_BEGIN_HEADER ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index ); #endif +#endif /* FT_CONFIG_OPTION_MAC_FONTS */ + FT_END_HEADER diff --git a/sdk/lib/3rdparty/freetype/src/base/ftbbox.c b/sdk/lib/3rdparty/freetype/src/base/ftbbox.c index 6e19da63cb3..151e85c97a5 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftbbox.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftbbox.c @@ -4,7 +4,7 @@ /* */ /* FreeType bbox computation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftbdf.c b/sdk/lib/3rdparty/freetype/src/base/ftbdf.c index 40f0ca2bb80..c4ea502fbc2 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftbdf.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftbdf.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftbitmap.c b/sdk/lib/3rdparty/freetype/src/base/ftbitmap.c index 19585ec3069..5bfc13e2445 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftbitmap.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftbitmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -153,38 +153,36 @@ FT_UInt ypixels ) { FT_Error error; - int pitch; - int new_pitch; + unsigned int pitch; + unsigned int new_pitch; FT_UInt bpp; - FT_UInt i, width, height; + FT_UInt width, height; unsigned char* buffer = NULL; width = bitmap->width; height = bitmap->rows; - pitch = bitmap->pitch; - if ( pitch < 0 ) - pitch = -pitch; + pitch = (unsigned int)FT_ABS( bitmap->pitch ); switch ( bitmap->pixel_mode ) { case FT_PIXEL_MODE_MONO: bpp = 1; - new_pitch = (int)( ( width + xpixels + 7 ) >> 3 ); + new_pitch = ( width + xpixels + 7 ) >> 3; break; case FT_PIXEL_MODE_GRAY2: bpp = 2; - new_pitch = (int)( ( width + xpixels + 3 ) >> 2 ); + new_pitch = ( width + xpixels + 3 ) >> 2; break; case FT_PIXEL_MODE_GRAY4: bpp = 4; - new_pitch = (int)( ( width + xpixels + 1 ) >> 1 ); + new_pitch = ( width + xpixels + 1 ) >> 1; break; case FT_PIXEL_MODE_GRAY: case FT_PIXEL_MODE_LCD: case FT_PIXEL_MODE_LCD_V: bpp = 8; - new_pitch = (int)( width + xpixels ); + new_pitch = width + xpixels; break; default: return FT_THROW( Invalid_Glyph_Format ); @@ -194,7 +192,7 @@ if ( ypixels == 0 && new_pitch <= pitch ) { /* zero the padding */ - FT_UInt bit_width = (FT_UInt)pitch * 8; + FT_UInt bit_width = pitch * 8; FT_UInt bit_last = ( width + xpixels ) * bpp; @@ -235,31 +233,58 @@ { FT_UInt len = ( width * bpp + 7 ) >> 3; + unsigned char* in = bitmap->buffer; + unsigned char* out = buffer; - for ( i = 0; i < bitmap->rows; i++ ) - FT_MEM_COPY( buffer + (FT_UInt)new_pitch * ( ypixels + i ), - bitmap->buffer + (FT_UInt)pitch * i, - len ); + unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; + unsigned int delta = new_pitch - pitch; + + + FT_MEM_ZERO( out, new_pitch * ypixels ); + out += new_pitch * ypixels; + + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += pitch; + + FT_MEM_ZERO( out, delta ); + out += delta; + } } else { FT_UInt len = ( width * bpp + 7 ) >> 3; + unsigned char* in = bitmap->buffer; + unsigned char* out = buffer; - for ( i = 0; i < bitmap->rows; i++ ) - FT_MEM_COPY( buffer + (FT_UInt)new_pitch * i, - bitmap->buffer + (FT_UInt)pitch * i, - len ); + unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; + unsigned int delta = new_pitch - pitch; + + + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += pitch; + + FT_MEM_ZERO( out, delta ); + out += delta; + } + + FT_MEM_ZERO( out, new_pitch * ypixels ); } FT_FREE( bitmap->buffer ); bitmap->buffer = buffer; - if ( bitmap->pitch < 0 ) - new_pitch = -new_pitch; - /* set pitch only, width and height are left untouched */ - bitmap->pitch = new_pitch; + if ( bitmap->pitch < 0 ) + bitmap->pitch = -(int)new_pitch; + else + bitmap->pitch = (int)new_pitch; return FT_Err_Ok; } @@ -444,7 +469,7 @@ * A gamma of 2.2 is fair to assume. And then, we need to * undo the premultiplication too. * - * http://accessibility.kde.org/hsl-adjusted.php + * https://accessibility.kde.org/hsl-adjusted.php * * We do the computation with integers only, applying a gamma of 2.0. * We guarantee 32-bit arithmetic to avoid overflow but the resulting diff --git a/sdk/lib/3rdparty/freetype/src/base/ftcalc.c b/sdk/lib/3rdparty/freetype/src/base/ftcalc.c index 00d63c6e6ba..f4ff45f8ef1 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftcalc.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftcalc.c @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftcid.c b/sdk/lib/3rdparty/freetype/src/base/ftcid.c index 398396b8453..f5184649bfb 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftcid.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftcid.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing CID font information. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Derek Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftdbgmem.c b/sdk/lib/3rdparty/freetype/src/base/ftdbgmem.c index 242246bfd12..c33d8acb4e1 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftdbgmem.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ /* */ /* Memory debugger (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -826,7 +826,7 @@ FT_Int result = 0; - if ( getenv( "FT2_DEBUG_MEMORY" ) ) + if ( ft_getenv( "FT2_DEBUG_MEMORY" ) ) { table = ft_mem_table_new( memory ); if ( table ) @@ -839,7 +839,7 @@ memory->realloc = ft_mem_debug_realloc; memory->free = ft_mem_debug_free; - p = getenv( "FT2_ALLOC_TOTAL_MAX" ); + p = ft_getenv( "FT2_ALLOC_TOTAL_MAX" ); if ( p ) { FT_Long total_max = ft_strtol( p, NULL, 10 ); @@ -852,7 +852,7 @@ } } - p = getenv( "FT2_ALLOC_COUNT_MAX" ); + p = ft_getenv( "FT2_ALLOC_COUNT_MAX" ); if ( p ) { FT_Long total_count = ft_strtol( p, NULL, 10 ); @@ -865,7 +865,7 @@ } } - p = getenv( "FT2_KEEP_ALIVE" ); + p = ft_getenv( "FT2_KEEP_ALIVE" ); if ( p ) { FT_Long keep_alive = ft_strtol( p, NULL, 10 ); diff --git a/sdk/lib/3rdparty/freetype/src/base/ftdebug.c b/sdk/lib/3rdparty/freetype/src/base/ftdebug.c index 20c617089ff..fe263091014 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftdebug.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 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 @@ FT_BASE_DEF( void ) ft_debug_init( void ) { - const char* ft2_debug = getenv( "FT2_DEBUG" ); + const char* ft2_debug = ft_getenv( "FT2_DEBUG" ); if ( ft2_debug ) diff --git a/sdk/lib/3rdparty/freetype/src/base/ftfntfmt.c b/sdk/lib/3rdparty/freetype/src/base/ftfntfmt.c index dcbeba0053a..a2900ceb098 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftfntfmt.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftfntfmt.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for font formats (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftfstype.c b/sdk/lib/3rdparty/freetype/src/base/ftfstype.c index cec4fb30250..e6cdf6e2ec6 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftfstype.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftfstype.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file to access FSType data (body). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftgasp.c b/sdk/lib/3rdparty/freetype/src/base/ftgasp.c index 477b72558cd..4f80bba630c 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftgasp.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftgasp.c @@ -4,7 +4,7 @@ /* */ /* Access of TrueType's `gasp' table (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftgloadr.c b/sdk/lib/3rdparty/freetype/src/base/ftgloadr.c index 8134003b4b6..47202496b9c 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftgloadr.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftgloadr.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftglyph.c b/sdk/lib/3rdparty/freetype/src/base/ftglyph.c index 3f78a8c36b5..6759aa25d0e 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftglyph.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftgxval.c b/sdk/lib/3rdparty/freetype/src/base/ftgxval.c index ff24d336df6..19e2d6acb5a 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftgxval.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftgxval.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftinit.c b/sdk/lib/3rdparty/freetype/src/base/ftinit.c index b3b08fa5416..1fa4721094a 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftinit.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftinit.c @@ -4,7 +4,7 @@ /* */ /* FreeType initialization layer (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftlcdfil.c b/sdk/lib/3rdparty/freetype/src/base/ftlcdfil.c index 60c813fd9e0..5c38911a907 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftlcdfil.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for color filtering of subpixel bitmap glyphs (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,8 +31,41 @@ #define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) ) + + /* add padding according to filter weights */ + FT_BASE_DEF (void) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ) + { + FT_Byte* lcd_weights; + FT_Bitmap_LcdFilterFunc lcd_filter_func; + + + /* Per-face LCD filtering takes priority if set up. */ + if ( slot->face && slot->face->internal->lcd_filter_func ) + { + lcd_weights = slot->face->internal->lcd_weights; + lcd_filter_func = slot->face->internal->lcd_filter_func; + } + else + { + lcd_weights = slot->library->lcd_weights; + lcd_filter_func = slot->library->lcd_filter_func; + } + + if ( lcd_filter_func == ft_lcd_filter_fir ) + { + *Min -= lcd_weights[0] ? 43 : + lcd_weights[1] ? 22 : 0; + *Max += lcd_weights[4] ? 43 : + lcd_weights[3] ? 22 : 0; + } + } + + /* FIR filter used by the default and light filters */ - FT_BASE( void ) + FT_BASE_DEF( void ) ft_lcd_filter_fir( FT_Bitmap* bitmap, FT_Render_Mode mode, FT_LcdFiveTapFilter weights ) @@ -305,21 +338,21 @@ return FT_THROW( Invalid_Argument ); } - library->lcd_filter = filter; - return FT_Err_Ok; } #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - FT_BASE( void ) - ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, - FT_LcdFiveTapFilter weights ) + /* add padding according to accommodate outline shifts */ + FT_BASE_DEF (void) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ) { - FT_UNUSED( bitmap ); - FT_UNUSED( mode ); - FT_UNUSED( weights ); + FT_UNUSED( slot ); + + *Min -= 21; + *Max += 21; } diff --git a/sdk/lib/3rdparty/freetype/src/base/ftmac.c b/sdk/lib/3rdparty/freetype/src/base/ftmac.c index 4e76585e5f5..fd4c0cc274f 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftmac.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftmac.c @@ -8,7 +8,7 @@ /* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */ /* classic platforms built by MPW. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftmm.c b/sdk/lib/3rdparty/freetype/src/base/ftmm.c index 43877ece45b..800441bcac8 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftmm.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftmm.c @@ -4,7 +4,7 @@ /* */ /* Multiple Master font support (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -145,6 +145,25 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Done_MM_Var( FT_Library library, + FT_MM_Var* amaster ) + { + FT_Memory memory; + + + if ( !library ) + return FT_THROW( Invalid_Library_Handle ); + + memory = library->memory; + FT_FREE( amaster ); + + return FT_Err_Ok; + } + + /* documentation is in ftmm.h */ FT_EXPORT_DEF( FT_Error ) @@ -203,6 +222,10 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_var_design ) error = service_mm->set_var_design( face, num_coords, coords ); + + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; } if ( !error ) @@ -275,6 +298,10 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); + + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; } if ( !error ) @@ -322,6 +349,10 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); + + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; } if ( !error ) @@ -426,4 +457,52 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Set_Named_Instance( FT_Face face, + FT_UInt instance_index ) + { + FT_Error error; + + FT_Service_MultiMasters service_mm = NULL; + FT_Service_MetricsVariations service_mvar = NULL; + + + /* check of `face' delayed to `ft_face_get_mm_service' */ + + error = ft_face_get_mm_service( face, &service_mm ); + if ( !error ) + { + error = FT_ERR( Invalid_Argument ); + if ( service_mm->set_instance ) + error = service_mm->set_instance( face, instance_index ); + } + + if ( !error ) + { + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) + service_mvar->metrics_adjust( face ); + } + + /* enforce recomputation of auto-hinting data */ + if ( !error && face->autohint.finalizer ) + { + face->autohint.finalizer( face->autohint.data ); + face->autohint.data = NULL; + } + + if ( !error ) + { + face->face_index = ( instance_index << 16 ) | + ( face->face_index & 0xFFFFL ); + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } + + return error; + } + + /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftobjs.c b/sdk/lib/3rdparty/freetype/src/base/ftobjs.c index 6db8136cfce..8d07e35ae37 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftobjs.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftobjs.c @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,12 +19,16 @@ #include #include FT_LIST_H #include FT_OUTLINE_H +#include FT_FONT_FORMATS_H + #include FT_INTERNAL_VALIDATE_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_RFORK_H #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */ +#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */ +#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Driver */ + #include FT_TRUETYPE_TABLES_H #include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_IDS_H @@ -37,8 +41,7 @@ #include FT_SERVICE_KERNING_H #include FT_SERVICE_TRUETYPE_ENGINE_H -#include FT_AUTOHINTER_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H #ifdef FT_CONFIG_OPTION_MAC_FONTS #include "ftbase.h" @@ -327,6 +330,138 @@ } + FT_BASE_DEF( void ) + ft_glyphslot_preset_bitmap( FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ) + { + FT_Outline* outline = &slot->outline; + FT_Bitmap* bitmap = &slot->bitmap; + + FT_Pixel_Mode pixel_mode; + + FT_BBox cbox; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; + FT_Pos x_left, y_top; + FT_Pos width, height, pitch; + + + if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) + return; + + if ( origin ) + { + x_shift = origin->x; + y_shift = origin->y; + } + + /* compute the control box, and grid-fit it, */ + /* taking into account the origin shift */ + FT_Outline_Get_CBox( outline, &cbox ); + + cbox.xMin += x_shift; + cbox.yMin += y_shift; + cbox.xMax += x_shift; + cbox.yMax += y_shift; + + switch ( mode ) + { + case FT_RENDER_MODE_MONO: + pixel_mode = FT_PIXEL_MODE_MONO; +#if 1 + /* undocumented but confirmed: bbox values get rounded */ + /* unless the rounded box can collapse for a narrow glyph */ + if ( cbox.xMax - cbox.xMin < 64 ) + { + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); + } + else + { + cbox.xMin = FT_PIX_ROUND_LONG( cbox.xMin ); + cbox.xMax = FT_PIX_ROUND_LONG( cbox.xMax ); + } + + if ( cbox.yMax - cbox.yMin < 64 ) + { + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); + } + else + { + cbox.yMin = FT_PIX_ROUND_LONG( cbox.yMin ); + cbox.yMax = FT_PIX_ROUND_LONG( cbox.yMax ); + } +#else + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); +#endif + break; + + case FT_RENDER_MODE_LCD: + pixel_mode = FT_PIXEL_MODE_LCD; + ft_lcd_padding( &cbox.xMin, &cbox.xMax, slot ); + goto Round; + + case FT_RENDER_MODE_LCD_V: + pixel_mode = FT_PIXEL_MODE_LCD_V; + ft_lcd_padding( &cbox.yMin, &cbox.yMax, slot ); + goto Round; + + case FT_RENDER_MODE_NORMAL: + case FT_RENDER_MODE_LIGHT: + default: + pixel_mode = FT_PIXEL_MODE_GRAY; + Round: + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); + } + + x_shift = SUB_LONG( x_shift, cbox.xMin ); + y_shift = SUB_LONG( y_shift, cbox.yMin ); + + x_left = cbox.xMin >> 6; + y_top = cbox.yMax >> 6; + + width = ( (FT_ULong)cbox.xMax - (FT_ULong)cbox.xMin ) >> 6; + height = ( (FT_ULong)cbox.yMax - (FT_ULong)cbox.yMin ) >> 6; + + switch ( pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + pitch = ( ( width + 15 ) >> 4 ) << 1; + break; + + case FT_PIXEL_MODE_LCD: + width *= 3; + pitch = FT_PAD_CEIL( width, 4 ); + break; + + case FT_PIXEL_MODE_LCD_V: + height *= 3; + /* fall through */ + + case FT_PIXEL_MODE_GRAY: + default: + pitch = width; + } + + slot->bitmap_left = (FT_Int)x_left; + slot->bitmap_top = (FT_Int)y_top; + + bitmap->pixel_mode = (unsigned char)pixel_mode; + bitmap->num_grays = 256; + bitmap->width = (unsigned int)width; + bitmap->rows = (unsigned int)height; + bitmap->pitch = pitch; + } + + FT_BASE_DEF( void ) ft_glyphslot_set_bitmap( FT_GlyphSlot slot, FT_Byte* buffer ) @@ -669,9 +804,13 @@ * 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 and/or rotations by integer multiples of 90 degrees. + * - Do only auto-hinting if we have + * + * - a hinter module, + * - a scalable font format dealing with outlines, + * - not a tricky font, and + * - no transforms except simple slants and/or rotations by + * integer multiples of 90 degrees. * * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't * have a native font hinter. @@ -701,8 +840,15 @@ else { FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); + FT_Bool is_light_type1; + /* only the new Adobe engine (for both CFF and Type 1) is `light'; */ + /* we use `strstr' to catch both `Type 1' and `CID Type 1' */ + is_light_type1 = + ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL && + ((PS_Driver)driver)->hinting_engine == FT_HINTING_ADOBE; + /* the check for `num_locations' assures that we actually */ /* test for instructions in a TTF and not in a CFF-based OTF */ /* */ @@ -710,8 +856,9 @@ /* check the size of the `fpgm' and `prep' tables, too -- */ /* the assumption is that there don't exist real TTFs where */ /* both `fpgm' and `prep' tables are missing */ - if ( ( mode == FT_RENDER_MODE_LIGHT && - !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || + if ( ( mode == FT_RENDER_MODE_LIGHT && + ( !FT_DRIVER_HINTS_LIGHTLY( driver ) && + !is_light_type1 ) ) || ( FT_IS_SFNT( face ) && ttface->num_locations && ttface->max_profile.maxSizeOfInstructions == 0 && @@ -731,8 +878,8 @@ /* XXX: This is really a temporary hack that should disappear */ /* promptly with FreeType 2.1! */ /* */ - if ( FT_HAS_FIXED_SIZES( face ) && - ( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) + if ( FT_HAS_FIXED_SIZES( face ) && + ( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) { error = driver->clazz->load_glyph( slot, face->size, glyph_index, @@ -800,7 +947,7 @@ /* compute the linear advance in 16.16 pixels */ if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 && - ( FT_IS_SCALABLE( face ) ) ) + FT_IS_SCALABLE( face ) ) { FT_Size_Metrics* metrics = &face->size->metrics; @@ -848,28 +995,37 @@ } } - 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? */ + /* do we need to render the image or preset the bitmap now? */ if ( !error && + ( load_flags & FT_LOAD_NO_SCALE ) == 0 && slot->format != FT_GLYPH_FORMAT_BITMAP && - slot->format != FT_GLYPH_FORMAT_COMPOSITE && - load_flags & FT_LOAD_RENDER ) + slot->format != FT_GLYPH_FORMAT_COMPOSITE ) { FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); - if ( mode == FT_RENDER_MODE_NORMAL && - (load_flags & FT_LOAD_MONOCHROME ) ) + if ( mode == FT_RENDER_MODE_NORMAL && + load_flags & FT_LOAD_MONOCHROME ) mode = FT_RENDER_MODE_MONO; - error = FT_Render_Glyph( slot, mode ); + if ( load_flags & FT_LOAD_RENDER ) + error = FT_Render_Glyph( slot, mode ); + else + ft_glyphslot_preset_bitmap( slot, mode, NULL ); } + FT_TRACE5(( "FT_Load_Glyph: index %d, flags %x\n", + glyph_index, load_flags )); + FT_TRACE5(( " x advance: %f\n", slot->advance.x / 64.0 )); + FT_TRACE5(( " y advance: %f\n", slot->advance.y / 64.0 )); + FT_TRACE5(( " linear x advance: %f\n", + slot->linearHoriAdvance / 65536.0 )); + FT_TRACE5(( " linear y advance: %f\n", + slot->linearVertAdvance / 65536.0 )); + FT_TRACE5(( " bitmap %dx%d, mode %d\n", + slot->bitmap.width, slot->bitmap.rows, + slot->bitmap.pixel_mode )); + Exit: return error; } @@ -2441,7 +2597,8 @@ internal->no_stem_darkening = -1; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - ft_memset( internal->lcd_weights, 0, FT_LCD_FILTER_FIVE_TAPS ); + /* Per-face filtering can only be set up by FT_Face_Properties */ + internal->lcd_filter_func = NULL; #endif } @@ -2864,18 +3021,6 @@ metrics->height = bsize->height << 6; metrics->max_advance = bsize->x_ppem; } - - FT_TRACE5(( "FT_Select_Metrics:\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } @@ -2984,18 +3129,6 @@ metrics->x_scale = 1L << 16; metrics->y_scale = 1L << 16; } - - FT_TRACE5(( "FT_Request_Metrics:\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } @@ -3005,6 +3138,7 @@ FT_Select_Size( FT_Face face, FT_Int strike_index ) { + FT_Error error = FT_Err_Ok; FT_Driver_Class clazz; @@ -3018,36 +3152,37 @@ if ( clazz->select_size ) { - FT_Error error; - - error = clazz->select_size( face->size, (FT_ULong)strike_index ); -#ifdef FT_DEBUG_LEVEL_TRACE - { - FT_Size_Metrics* metrics = &face->size->metrics; + FT_TRACE5(( "FT_Select_Size (%s driver):\n", + face->driver->root.clazz->module_name )); + } + else + { + FT_Select_Metrics( face, (FT_ULong)strike_index ); - - FT_TRACE5(( "FT_Select_Size (font driver's `select_size'):\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); - } -#endif - - return error; + FT_TRACE5(( "FT_Select_Size:\n" )); } - FT_Select_Metrics( face, (FT_ULong)strike_index ); +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Size_Metrics* metrics = &face->size->metrics; - return FT_Err_Ok; + + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + } +#endif + + return error; } @@ -3057,6 +3192,7 @@ FT_Request_Size( FT_Face face, FT_Size_Request req ) { + FT_Error error = FT_Err_Ok; FT_Driver_Class clazz; FT_ULong strike_index; @@ -3076,55 +3212,52 @@ if ( clazz->request_size ) { - FT_Error error; - - error = clazz->request_size( face->size, req ); -#ifdef FT_DEBUG_LEVEL_TRACE - { - FT_Size_Metrics* metrics = &face->size->metrics; - - - FT_TRACE5(( "FT_Request_Size (font driver's `request_size'):\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); - } -#endif - - return error; + FT_TRACE5(( "FT_Request_Size (%s driver):\n", + face->driver->root.clazz->module_name )); } - - /* - * The reason that a driver doesn't have `request_size' defined is - * either that the scaling here suffices or that the supported formats - * are bitmap-only and size matching is not implemented. - * - * In the latter case, a simple size matching is done. - */ - if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) ) + else if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) ) { - FT_Error error; - - + /* + * The reason that a driver doesn't have `request_size' defined is + * either that the scaling here suffices or that the supported formats + * are bitmap-only and size matching is not implemented. + * + * In the latter case, a simple size matching is done. + */ error = FT_Match_Size( face, req, 0, &strike_index ); if ( error ) return error; return FT_Select_Size( face, (FT_Int)strike_index ); } + else + { + FT_Request_Metrics( face, req ); - FT_Request_Metrics( face, req ); + FT_TRACE5(( "FT_Request_Size:\n" )); + } - return FT_Err_Ok; +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Size_Metrics* metrics = &face->size->metrics; + + + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + } +#endif + + return error; } @@ -3653,16 +3786,11 @@ { #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING if ( properties->data ) + { ft_memcpy( face->internal->lcd_weights, properties->data, FT_LCD_FILTER_FIVE_TAPS ); - else - { - /* Value NULL indicates `no custom weights, use library */ - /* defaults', signaled by filling the weight field with zeros. */ - ft_memset( face->internal->lcd_weights, - 0, - FT_LCD_FILTER_FIVE_TAPS ); + face->internal->lcd_filter_func = ft_lcd_filter_fir; } #else error = FT_THROW( Unimplemented_Feature ); @@ -4414,43 +4542,97 @@ */ /* we use FT_TRACE3 in this block */ - if ( ft_trace_levels[trace_bitmap] >= 3 ) + if ( !error && + ft_trace_levels[trace_bitmap] >= 3 && + slot->bitmap.buffer ) { + FT_Bitmap bitmap; + FT_Error err; + + + FT_Bitmap_Init( &bitmap ); + /* we convert to a single bitmap format for computing the checksum */ - if ( !error && slot->bitmap.buffer ) + /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */ + err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 ); + if ( !err ) { - FT_Bitmap bitmap; - FT_Error err; + MD5_CTX ctx; + unsigned char md5[16]; + unsigned long coverage = 0; + int i, j; + int rows = (int)bitmap.rows; + int pitch = bitmap.pitch; - FT_Bitmap_Init( &bitmap ); + FT_TRACE3(( "FT_Render_Glyph: bitmap %dx%d, mode %d\n", + rows, pitch, slot->bitmap.pixel_mode )); - /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */ - err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 ); - if ( !err ) - { - MD5_CTX ctx; - unsigned char md5[16]; - int i; - unsigned int rows = bitmap.rows; - unsigned int pitch = (unsigned int)bitmap.pitch; + for ( i = 0; i < rows; i++ ) + for ( j = 0; j < pitch; j++ ) + coverage += bitmap.buffer[i * pitch + j]; + FT_TRACE3(( " Total coverage: %lu\n", coverage )); - MD5_Init( &ctx ); - if ( bitmap.buffer ) - MD5_Update( &ctx, bitmap.buffer, rows * pitch ); - MD5_Final( md5, &ctx ); + MD5_Init( &ctx ); + if ( bitmap.buffer ) + MD5_Update( &ctx, bitmap.buffer, + (unsigned long)rows * (unsigned long)pitch ); + MD5_Final( md5, &ctx ); - FT_TRACE3(( "MD5 checksum for %dx%d bitmap:\n" - " ", - rows, pitch )); - for ( i = 0; i < 16; i++ ) - FT_TRACE3(( "%02X", md5[i] )); - FT_TRACE3(( "\n" )); - } - - FT_Bitmap_Done( library, &bitmap ); + FT_TRACE3(( " MD5 checksum: " )); + for ( i = 0; i < 16; i++ ) + FT_TRACE3(( "%02X", md5[i] )); + FT_TRACE3(( "\n" )); } + + FT_Bitmap_Done( library, &bitmap ); + } + + /* + * Dump bitmap in Netpbm format (PBM or PGM). + */ + + /* we use FT_TRACE7 in this block */ + if ( !error && + ft_trace_levels[trace_bitmap] >= 7 && + slot->bitmap.rows < 128U && + slot->bitmap.width < 128U && + slot->bitmap.buffer ) + { + int rows = (int)slot->bitmap.rows; + int width = (int)slot->bitmap.width; + int pitch = slot->bitmap.pitch; + int i, j, m; + unsigned char* topleft = slot->bitmap.buffer; + + if ( pitch < 0 ) + topleft -= pitch * ( rows - 1 ); + + FT_TRACE7(( "Netpbm image: start\n" )); + switch ( slot->bitmap.pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + FT_TRACE7(( "P1 %d %d\n", width, rows )); + for ( i = 0; i < rows; i++ ) + { + for ( j = 0; j < width; ) + for ( m = 128; m > 0 && j < width; m >>= 1, j++ ) + FT_TRACE7(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 )); + FT_TRACE7(( "\n" )); + } + break; + + default: + FT_TRACE7(( "P2 %d %d 255\n", width, rows )); + for ( i = 0; i < rows; i++ ) + { + for ( j = 0; j < width; j += 1 ) + FT_TRACE7(( " %3u", topleft[i * pitch + j] )); + FT_TRACE7(( "\n" )); + } + } + FT_TRACE7(( "Netpbm image: end\n" )); } #undef FT_COMPONENT @@ -4995,9 +5177,9 @@ #ifdef FT_CONFIG_OPTION_PIC Fail: ft_pic_container_destroy( library ); -#endif FT_FREE( library ); return error; +#endif } diff --git a/sdk/lib/3rdparty/freetype/src/base/ftotval.c b/sdk/lib/3rdparty/freetype/src/base/ftotval.c index 5fa098691e8..a2944a7950c 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftotval.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftotval.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating OpenType tables (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftoutln.c b/sdk/lib/3rdparty/freetype/src/base/ftoutln.c index 9ceb9cf1ba7..9c29ade92fb 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftoutln.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftoutln.c @@ -4,7 +4,7 @@ /* */ /* FreeType outline management (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -540,8 +540,8 @@ for ( n = 0; n < outline->n_points; n++ ) { - vec->x += xOffset; - vec->y += yOffset; + vec->x = ADD_LONG( vec->x, xOffset ); + vec->y = ADD_LONG( vec->y, yOffset ); vec++; } } diff --git a/sdk/lib/3rdparty/freetype/src/base/ftpatent.c b/sdk/lib/3rdparty/freetype/src/base/ftpatent.c index 9900f99bfcd..e23ee2e3f48 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftpatent.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftpatent.c @@ -5,7 +5,7 @@ /* FreeType API for checking patented TrueType bytecode instructions */ /* (body). Obsolete, retained for backward compatibility. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftpfr.c b/sdk/lib/3rdparty/freetype/src/base/ftpfr.c index 5cc0b707264..bfe13520eb9 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftpfr.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftpfr.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftpic.c b/sdk/lib/3rdparty/freetype/src/base/ftpic.c index 0f84fddc98b..1492e1809a5 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftpic.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (body). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftpsprop.c b/sdk/lib/3rdparty/freetype/src/base/ftpsprop.c new file mode 100644 index 00000000000..459b5e6054c --- /dev/null +++ b/sdk/lib/3rdparty/freetype/src/base/ftpsprop.c @@ -0,0 +1,285 @@ +/***************************************************************************/ +/* */ +/* ftpsprop.c */ +/* */ +/* Get and set properties of PostScript drivers (body). */ +/* See `ftdriver.h' for available properties. */ +/* */ +/* Copyright 2017-2018 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 +#include FT_DRIVER_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_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_psprops + + + FT_BASE_CALLBACK_DEF( FT_Error ) + ps_property_set( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value, + FT_Bool value_is_string ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + +#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_UNUSED( value_is_string ); +#endif + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params; + FT_Int x1, y1, x2, y2, x3, y3, x4, y4; + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_Int dp[8]; + + + if ( value_is_string ) + { + const char* s = (const char*)value; + char* ep; + int i; + + + /* eight comma-separated numbers */ + for ( i = 0; i < 7; i++ ) + { + dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( *ep != ',' || s == ep ) + return FT_THROW( Invalid_Argument ); + + s = ep + 1; + } + + dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) + return FT_THROW( Invalid_Argument ); + + darken_params = dp; + } + else +#endif + darken_params = (FT_Int*)value; + + x1 = darken_params[0]; + y1 = darken_params[1]; + x2 = darken_params[2]; + y2 = darken_params[3]; + x3 = darken_params[4]; + y3 = darken_params[5]; + x4 = darken_params[6]; + y4 = darken_params[7]; + + if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || + y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || + x1 > x2 || x2 > x3 || x3 > x4 || + y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) + return FT_THROW( Invalid_Argument ); + + driver->darken_params[0] = x1; + driver->darken_params[1] = y1; + driver->darken_params[2] = x2; + driver->darken_params[3] = y2; + driver->darken_params[4] = x3; + driver->darken_params[5] = y3; + driver->darken_params[6] = x4; + driver->darken_params[7] = y4; + + return error; + } + + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { +#if defined( CFF_CONFIG_OPTION_OLD_ENGINE ) || \ + defined( T1_CONFIG_OPTION_OLD_ENGINE ) + const char* module_name = module->clazz->module_name; +#endif + + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + if ( !ft_strcmp( s, "adobe" ) ) + driver->hinting_engine = FT_HINTING_ADOBE; + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + else if ( !ft_strcmp( module_name, "cff" ) && + !ft_strcmp( s, "freetype" ) ) + driver->hinting_engine = FT_HINTING_FREETYPE; +#endif + +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + else if ( ( !ft_strcmp( module_name, "type1" ) || + !ft_strcmp( module_name, "t1cid" ) ) && + !ft_strcmp( s, "freetype" ) ) + driver->hinting_engine = FT_HINTING_FREETYPE; +#endif + + else + return FT_THROW( Invalid_Argument ); + } + else +#endif /* FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES */ + { + FT_UInt* hinting_engine = (FT_UInt*)value; + + + if ( *hinting_engine == FT_HINTING_ADOBE +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + || ( *hinting_engine == FT_HINTING_FREETYPE && + !ft_strcmp( module_name, "cff" ) ) +#endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + || ( *hinting_engine == FT_HINTING_FREETYPE && + ( !ft_strcmp( module_name, "type1" ) || + !ft_strcmp( module_name, "t1cid" ) ) ) +#endif + ) + driver->hinting_engine = *hinting_engine; + else + error = FT_ERR( Unimplemented_Feature ); + + return error; + } + } + + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + long nsd = ft_strtol( s, NULL, 10 ); + + + if ( !nsd ) + driver->no_stem_darkening = FALSE; + else + driver->no_stem_darkening = TRUE; + } + else +#endif + { + FT_Bool* no_stem_darkening = (FT_Bool*)value; + + + driver->no_stem_darkening = *no_stem_darkening; + } + + return error; + } + + else if ( !ft_strcmp( property_name, "random-seed" ) ) + { + FT_Int32 random_seed; + + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); + } + else +#endif + random_seed = *(FT_Int32*)value; + + if ( random_seed < 0 ) + random_seed = 0; + + driver->random_seed = random_seed; + + return error; + } + + FT_TRACE0(( "ps_property_set: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + FT_BASE_CALLBACK_DEF( FT_Error ) + ps_property_get( FT_Module module, /* PS_Driver */ + const char* property_name, + void* value ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params = driver->darken_params; + FT_Int* val = (FT_Int*)value; + + + val[0] = darken_params[0]; + val[1] = darken_params[1]; + val[2] = darken_params[2]; + val[3] = darken_params[3]; + val[4] = darken_params[4]; + val[5] = darken_params[5]; + val[6] = darken_params[6]; + val[7] = darken_params[7]; + + return error; + } + + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { + FT_UInt hinting_engine = driver->hinting_engine; + FT_UInt* val = (FT_UInt*)value; + + + *val = hinting_engine; + + return error; + } + + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { + FT_Bool no_stem_darkening = driver->no_stem_darkening; + FT_Bool* val = (FT_Bool*)value; + + + *val = no_stem_darkening; + + return error; + } + + FT_TRACE0(( "ps_property_get: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + +/* END */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftrfork.c b/sdk/lib/3rdparty/freetype/src/base/ftrfork.c index f5ad2874d8f..c3a2b9151ac 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftrfork.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftrfork.c @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */ @@ -478,7 +478,7 @@ } -#ifndef FT_MACINTOSH +#if defined( FT_CONFIG_OPTION_MAC_FONTS ) && !defined( FT_MACINTOSH ) static FT_RFork_Rule raccess_get_rule_type_from_rule_index( FT_Library library, FT_UInt rule_index ) diff --git a/sdk/lib/3rdparty/freetype/src/base/ftsnames.c b/sdk/lib/3rdparty/freetype/src/base/ftsnames.c index 36094500889..90ea1e2be7b 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftsnames.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftsnames.c @@ -7,7 +7,7 @@ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftstream.c b/sdk/lib/3rdparty/freetype/src/base/ftstream.c index a3f8c8b3c9e..18df7dcfef6 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftstream.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftstream.c @@ -4,7 +4,7 @@ /* */ /* I/O stream support (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftstroke.c b/sdk/lib/3rdparty/freetype/src/base/ftstroke.c index d32de0d62bb..6ae18190679 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftstroke.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftstroke.c @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftsynth.c b/sdk/lib/3rdparty/freetype/src/base/ftsynth.c index 5cf386f48d8..c28346707bd 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftsynth.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftsynth.c @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftsystem.c b/sdk/lib/3rdparty/freetype/src/base/ftsystem.c index 324f949a495..6adebdb9383 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftsystem.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* ANSI-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/fttrigon.c b/sdk/lib/3rdparty/freetype/src/base/fttrigon.c index 7a4d17c8296..d6dd098c426 100644 --- a/sdk/lib/3rdparty/freetype/src/base/fttrigon.c +++ b/sdk/lib/3rdparty/freetype/src/base/fttrigon.c @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/fttype1.c b/sdk/lib/3rdparty/freetype/src/base/fttype1.c index 4d16a6371a5..aa8f8ccbbb4 100644 --- a/sdk/lib/3rdparty/freetype/src/base/fttype1.c +++ b/sdk/lib/3rdparty/freetype/src/base/fttype1.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for PS names support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftutil.c b/sdk/lib/3rdparty/freetype/src/base/ftutil.c index 7bd5bee87c4..4de5f2c145d 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftutil.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftutil.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for memory and list management (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/base/ftwinfnt.c b/sdk/lib/3rdparty/freetype/src/base/ftwinfnt.c index 05baa02da6a..11bd28afb7a 100644 --- a/sdk/lib/3rdparty/freetype/src/base/ftwinfnt.c +++ b/sdk/lib/3rdparty/freetype/src/base/ftwinfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing Windows FNT specific info (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/bdf/README b/sdk/lib/3rdparty/freetype/src/bdf/README index b761aba2b28..996ac2d2aae 100644 --- a/sdk/lib/3rdparty/freetype/src/bdf/README +++ b/sdk/lib/3rdparty/freetype/src/bdf/README @@ -13,7 +13,7 @@ This code implements a BDF driver for the FreeType library, following the Adobe Specification V 2.2. The specification of the BDF font format is available from Adobe's web site: - http://partners.adobe.com/public/developer/en/font/5005.BDF_Spec.pdf + https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5005.BDF_Spec.pdf Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org). They do not define vertical metrics, because the X Consortium BDF diff --git a/sdk/lib/3rdparty/freetype/src/bdf/bdfdrivr.c b/sdk/lib/3rdparty/freetype/src/bdf/bdfdrivr.c index fb778100072..ca937f89ce3 100644 --- a/sdk/lib/3rdparty/freetype/src/bdf/bdfdrivr.c +++ b/sdk/lib/3rdparty/freetype/src/bdf/bdfdrivr.c @@ -813,7 +813,7 @@ THE SOFTWARE. bitmap->rows = glyph.bbx.height; bitmap->width = glyph.bbx.width; - if ( glyph.bpr > INT_MAX ) + if ( glyph.bpr > FT_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 */ diff --git a/sdk/lib/3rdparty/freetype/src/bdf/bdflib.c b/sdk/lib/3rdparty/freetype/src/bdf/bdflib.c index bf10887fd46..2f5c99d5448 100644 --- a/sdk/lib/3rdparty/freetype/src/bdf/bdflib.c +++ b/sdk/lib/3rdparty/freetype/src/bdf/bdflib.c @@ -705,11 +705,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( ULONG_MAX - 9 ) / 10 ) + if ( v < ( FT_ULONG_MAX - 9 ) / 10 ) v = v * 10 + a2i[(int)*s]; else { - v = ULONG_MAX; + v = FT_ULONG_MAX; break; } } @@ -738,11 +738,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( LONG_MAX - 9 ) / 10 ) + if ( v < ( FT_LONG_MAX - 9 ) / 10 ) v = v * 10 + a2i[(int)*s]; else { - v = LONG_MAX; + v = FT_LONG_MAX; break; } } @@ -763,11 +763,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( USHRT_MAX - 9 ) / 10 ) + if ( v < ( FT_USHORT_MAX - 9 ) / 10 ) v = (unsigned short)( v * 10 + a2i[(int)*s] ); else { - v = USHRT_MAX; + v = FT_USHORT_MAX; break; } } diff --git a/sdk/lib/3rdparty/freetype/src/bzip2/ftbzip2.c b/sdk/lib/3rdparty/freetype/src/bzip2/ftbzip2.c index 7fc71e7079a..16019485a9b 100644 --- a/sdk/lib/3rdparty/freetype/src/bzip2/ftbzip2.c +++ b/sdk/lib/3rdparty/freetype/src/bzip2/ftbzip2.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* Joel Klinghed. */ /* */ /* based on `src/gzip/ftgzip.c' */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcache.c b/sdk/lib/3rdparty/freetype/src/cache/ftcache.c index 8226188314b..1b425af911f 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcache.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcache.c @@ -4,7 +4,7 @@ /* */ /* The FreeType Caching sub-system (body only). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcbasic.c b/sdk/lib/3rdparty/freetype/src/cache/ftcbasic.c index e804776ab4e..994aa12286f 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcbasic.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType basic cache interface (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftccache.c b/sdk/lib/3rdparty/freetype/src/cache/ftccache.c index 37dc3abb1df..12ec585a253 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftccache.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftccache.c @@ -4,7 +4,7 @@ /* */ /* The FreeType internal cache interface (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftccache.h b/sdk/lib/3rdparty/freetype/src/cache/ftccache.h index d3c11ce082c..859c547e466 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftccache.h +++ b/sdk/lib/3rdparty/freetype/src/cache/ftccache.h @@ -4,7 +4,7 @@ /* */ /* FreeType internal cache interface (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftccback.h b/sdk/lib/3rdparty/freetype/src/cache/ftccback.h index 2681e8c0226..e51d8d6e559 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftccback.h +++ b/sdk/lib/3rdparty/freetype/src/cache/ftccback.h @@ -4,7 +4,7 @@ /* */ /* Callback functions of the caching sub-system (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftccmap.c b/sdk/lib/3rdparty/freetype/src/cache/ftccmap.c index 2fa84979c83..d20b0f48fe7 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftccmap.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftccmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType CharMap cache (body) */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcerror.h b/sdk/lib/3rdparty/freetype/src/cache/ftcerror.h index 84fe52f546a..a26cd5935bc 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcerror.h +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcerror.h @@ -4,7 +4,7 @@ /* */ /* Caching sub-system error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcglyph.c b/sdk/lib/3rdparty/freetype/src/cache/ftcglyph.c index d2468f2f43c..782cc0ed09e 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcglyph.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType Glyph Image (FT_Glyph) cache (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcglyph.h b/sdk/lib/3rdparty/freetype/src/cache/ftcglyph.h index cab58ed311e..23c24d223f4 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcglyph.h +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcglyph.h @@ -4,7 +4,7 @@ /* */ /* FreeType abstract glyph cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcimage.c b/sdk/lib/3rdparty/freetype/src/cache/ftcimage.c index 359f818cce2..77a100153e0 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcimage.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcimage.c @@ -4,7 +4,7 @@ /* */ /* FreeType Image cache (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcimage.h b/sdk/lib/3rdparty/freetype/src/cache/ftcimage.h index 14049af9d27..24a221053b0 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcimage.h +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcimage.h @@ -4,7 +4,7 @@ /* */ /* FreeType Generic Image cache (specification) */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcmanag.c b/sdk/lib/3rdparty/freetype/src/cache/ftcmanag.c index edec2b6b5b9..2bcd9df5026 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcmanag.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcmanag.c @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcmanag.h b/sdk/lib/3rdparty/freetype/src/cache/ftcmanag.h index 556842e131c..b4b47553568 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcmanag.h +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcmanag.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcmru.c b/sdk/lib/3rdparty/freetype/src/cache/ftcmru.c index e293269f2f1..1087be4d890 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcmru.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcmru.c @@ -4,7 +4,7 @@ /* */ /* FreeType MRU support (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcmru.h b/sdk/lib/3rdparty/freetype/src/cache/ftcmru.h index c4c330d558b..82396b917d0 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcmru.h +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcmru.h @@ -4,7 +4,7 @@ /* */ /* Simple MRU list-cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcsbits.c b/sdk/lib/3rdparty/freetype/src/cache/ftcsbits.c index 2f9336decd5..018f1ecdb71 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcsbits.c +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ /* */ /* FreeType sbits manager (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cache/ftcsbits.h b/sdk/lib/3rdparty/freetype/src/cache/ftcsbits.h index 1e15ce9764c..206a1bb3fc3 100644 --- a/sdk/lib/3rdparty/freetype/src/cache/ftcsbits.h +++ b/sdk/lib/3rdparty/freetype/src/cache/ftcsbits.h @@ -4,7 +4,7 @@ /* */ /* A small-bitmap cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cff.c b/sdk/lib/3rdparty/freetype/src/cff/cff.c index 397f6dfafe9..1a755d5dadd 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cff.c +++ b/sdk/lib/3rdparty/freetype/src/cff/cff.c @@ -4,7 +4,7 @@ /* */ /* FreeType OpenType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,15 +27,4 @@ #include "cffload.c" #include "cffobjs.c" -#include "cf2arrst.c" -#include "cf2blues.c" -#include "cf2error.c" -#include "cf2font.c" -#include "cf2ft.c" -#include "cf2hints.c" -#include "cf2intrp.c" -#include "cf2read.c" -#include "cf2stack.c" - - /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffcmap.c b/sdk/lib/3rdparty/freetype/src/cff/cffcmap.c index 4adce7a54d9..e45ae1127bf 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffcmap.c +++ b/sdk/lib/3rdparty/freetype/src/cff/cffcmap.c @@ -4,7 +4,7 @@ /* */ /* CFF character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffcmap.h b/sdk/lib/3rdparty/freetype/src/cff/cffcmap.h index 7792e042483..856a43dd1b9 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffcmap.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cffcmap.h @@ -4,7 +4,7 @@ /* */ /* CFF character mapping table (cmap) support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,7 +19,7 @@ #ifndef CFFCMAP_H_ #define CFFCMAP_H_ -#include "cffobjs.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffdrivr.c b/sdk/lib/3rdparty/freetype/src/cff/cffdrivr.c index 38bfc2ca3dd..df896848da4 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffdrivr.c +++ b/sdk/lib/3rdparty/freetype/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ /* */ /* OpenType font driver implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,16 +21,20 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H #include FT_SERVICE_CID_H #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_TT_CMAP_H +#include FT_SERVICE_CFF_TABLE_LOAD_H #include "cffdrivr.h" #include "cffgload.h" #include "cffload.h" #include "cffcmap.h" #include "cffparse.h" +#include "cffobjs.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_SERVICE_MULTIPLE_MASTERS_H @@ -43,7 +47,7 @@ #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_PROPERTIES_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H /*************************************************************************/ @@ -214,8 +218,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without VVAR table */ - if ( !ttface->is_default_instance && - !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && + !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -237,8 +241,10 @@ &dummy, &ah ); - FT_TRACE5(( " idx %d: advance height %d font units\n", - start + nn, ah )); + FT_TRACE5(( " idx %d: advance height %d font unit%s\n", + start + nn, + ah, + ah == 1 ? "" : "s" )); advances[nn] = ah; } } @@ -246,8 +252,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without HVAR table */ - if ( !ttface->is_default_instance && - !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && + !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -266,8 +272,10 @@ &dummy, &aw ); - FT_TRACE5(( " idx %d: advance width %d font units\n", - start + nn, aw )); + FT_TRACE5(( " idx %d: advance width %d font unit%s\n", + start + nn, + aw, + aw == 1 ? "" : "s" )); advances[nn] = aw; } } @@ -493,11 +501,89 @@ } + static FT_Error + cff_ps_get_font_extra( CFF_Face face, + PS_FontExtraRec* afont_extra ) + { + CFF_Font cff = (CFF_Font)face->extra.data; + FT_Error error = FT_Err_Ok; + + + if ( cff && cff->font_extra == NULL ) + { + CFF_FontRecDict dict = &cff->top_font.font_dict; + PS_FontExtraRec* font_extra = NULL; + FT_Memory memory = face->root.memory; + FT_String* embedded_postscript; + + + if ( FT_ALLOC( font_extra, sizeof ( *font_extra ) ) ) + goto Fail; + + font_extra->fs_type = 0U; + + embedded_postscript = cff_index_get_sid_string( + cff, + dict->embedded_postscript ); + if ( embedded_postscript ) + { + FT_String* start_fstype; + FT_String* start_def; + + + /* Identify the XYZ integer in `/FSType XYZ def' substring. */ + if ( ( start_fstype = ft_strstr( embedded_postscript, + "/FSType" ) ) != NULL && + ( start_def = ft_strstr( start_fstype + + sizeof ( "/FSType" ) - 1, + "def" ) ) != NULL ) + { + FT_String* s; + + + for ( s = start_fstype + sizeof ( "/FSType" ) - 1; + s != start_def; + s++ ) + { + if ( *s >= '0' && *s <= '9' ) + { + if ( font_extra->fs_type >= ( FT_USHORT_MAX - 9 ) / 10 ) + { + /* Overflow - ignore the FSType value. */ + font_extra->fs_type = 0U; + break; + } + + font_extra->fs_type *= 10; + font_extra->fs_type += (FT_UShort)( *s - '0' ); + } + else if ( *s != ' ' && *s != '\n' && *s != '\r' ) + { + /* Non-whitespace character between `/FSType' and next `def' */ + /* - ignore the FSType value. */ + font_extra->fs_type = 0U; + break; + } + } + } + } + + cff->font_extra = font_extra; + } + + if ( cff ) + *afont_extra = *cff->font_extra; + + Fail: + return error; + } + + FT_DEFINE_SERVICE_PSINFOREC( cff_service_ps_info, (PS_GetFontInfoFunc) cff_ps_get_font_info, /* ps_get_font_info */ - (PS_GetFontExtraFunc) NULL, /* ps_get_font_extra */ + (PS_GetFontExtraFunc) cff_ps_get_font_extra, /* ps_get_font_extra */ (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, /* ps_has_glyph_names */ /* unsupported with CFF fonts */ (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */ @@ -735,231 +821,12 @@ * PROPERTY SERVICE * */ - static FT_Error - cff_property_set( FT_Module module, /* CFF_Driver */ - const char* property_name, - const void* value, - FT_Bool value_is_string ) - { - FT_Error error = FT_Err_Ok; - CFF_Driver driver = (CFF_Driver)module; - -#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_UNUSED( value_is_string ); -#endif - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params; - FT_Int x1, y1, x2, y2, x3, y3, x4, y4; - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_Int dp[8]; - - - if ( value_is_string ) - { - const char* s = (const char*)value; - char* ep; - int i; - - - /* eight comma-separated numbers */ - for ( i = 0; i < 7; i++ ) - { - dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( *ep != ',' || s == ep ) - return FT_THROW( Invalid_Argument ); - - s = ep + 1; - } - - dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) - return FT_THROW( Invalid_Argument ); - - darken_params = dp; - } - else -#endif - darken_params = (FT_Int*)value; - - x1 = darken_params[0]; - y1 = darken_params[1]; - x2 = darken_params[2]; - y2 = darken_params[3]; - x3 = darken_params[4]; - y3 = darken_params[5]; - x4 = darken_params[6]; - y4 = darken_params[7]; - - if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || - y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || - x1 > x2 || x2 > x3 || x3 > x4 || - y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) - return FT_THROW( Invalid_Argument ); - - driver->darken_params[0] = x1; - driver->darken_params[1] = y1; - driver->darken_params[2] = x2; - driver->darken_params[3] = y2; - driver->darken_params[4] = x3; - driver->darken_params[5] = y3; - driver->darken_params[6] = x4; - driver->darken_params[7] = y4; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - if ( !ft_strcmp( s, "adobe" ) ) - driver->hinting_engine = FT_CFF_HINTING_ADOBE; -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - else if ( !ft_strcmp( s, "freetype" ) ) - driver->hinting_engine = FT_CFF_HINTING_FREETYPE; -#endif - else - return FT_THROW( Invalid_Argument ); - } - else -#endif - { - FT_UInt* hinting_engine = (FT_UInt*)value; - - - if ( *hinting_engine == FT_CFF_HINTING_ADOBE -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - || *hinting_engine == FT_CFF_HINTING_FREETYPE -#endif - ) - driver->hinting_engine = *hinting_engine; - else - error = FT_ERR( Unimplemented_Feature ); - - return error; - } - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - long nsd = ft_strtol( s, NULL, 10 ); - - - if ( !nsd ) - driver->no_stem_darkening = FALSE; - else - driver->no_stem_darkening = TRUE; - } - else -#endif - { - FT_Bool* no_stem_darkening = (FT_Bool*)value; - - - driver->no_stem_darkening = *no_stem_darkening; - } - - return error; - } - else if ( !ft_strcmp( property_name, "random-seed" ) ) - { - FT_Int32 random_seed; - - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); - } - else -#endif - random_seed = *(FT_Int32*)value; - - if ( random_seed < 0 ) - random_seed = 0; - - driver->random_seed = random_seed; - - return error; - } - - FT_TRACE0(( "cff_property_set: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - - - static FT_Error - cff_property_get( FT_Module module, /* CFF_Driver */ - const char* property_name, - const void* value ) - { - FT_Error error = FT_Err_Ok; - CFF_Driver driver = (CFF_Driver)module; - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params = driver->darken_params; - FT_Int* val = (FT_Int*)value; - - - val[0] = darken_params[0]; - val[1] = darken_params[1]; - val[2] = darken_params[2]; - val[3] = darken_params[3]; - val[4] = darken_params[4]; - val[5] = darken_params[5]; - val[6] = darken_params[6]; - val[7] = darken_params[7]; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { - FT_UInt hinting_engine = driver->hinting_engine; - FT_UInt* val = (FT_UInt*)value; - - - *val = hinting_engine; - - return error; - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { - FT_Bool no_stem_darkening = driver->no_stem_darkening; - FT_Bool* val = (FT_Bool*)value; - - - *val = no_stem_darkening; - - return error; - } - - FT_TRACE0(( "cff_property_get: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - FT_DEFINE_SERVICE_PROPERTIESREC( cff_service_properties, - (FT_Properties_SetFunc)cff_property_set, /* set_property */ - (FT_Properties_GetFunc)cff_property_get ) /* get_property */ + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT @@ -1028,6 +895,17 @@ } + static FT_Error + cff_set_instance( CFF_Face face, + FT_UInt instance_index ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->set_instance( FT_FACE( face ), instance_index ); + } + + FT_DEFINE_SERVICE_MULTIMASTERSREC( cff_service_multi_masters, @@ -1038,6 +916,7 @@ (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */ (FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */ (FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */ + (FT_Set_Instance_Func) cff_set_instance, /* set_instance */ (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ (FT_Done_Blend_Func) cff_done_blend /* done_blend */ @@ -1088,6 +967,22 @@ #endif + /* + * CFFLOAD SERVICE + * + */ + + FT_DEFINE_SERVICE_CFFLOADREC( + cff_service_cff_load, + + (FT_Get_Standard_Encoding_Func)cff_get_standard_encoding, + (FT_Load_Private_Dict_Func) cff_load_private_dict, + (FT_FD_Select_Get_Func) cff_fd_select_get, + (FT_Blend_Check_Vector_Func) cff_blend_check_vector, + (FT_Blend_Build_Vector_Func) cff_blend_build_vector + ) + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1102,6 +997,34 @@ #if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \ defined TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_DEFINE_SERVICEDESCREC10( + cff_services, + + FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, + FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET, + FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET, + FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, + FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, + FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, + FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET + ) +#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES + FT_DEFINE_SERVICEDESCREC8( + cff_services, + + FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, + FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, + FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, + FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, + FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET + ) +#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_DEFINE_SERVICEDESCREC9( cff_services, @@ -1110,46 +1033,22 @@ FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET, FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) -#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES +#else FT_DEFINE_SERVICEDESCREC7( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET - ) -#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC8( - cff_services, - - FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET, - FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET, - FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET - ) -#else - FT_DEFINE_SERVICEDESCREC6( - cff_services, - - FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #endif @@ -1208,7 +1107,7 @@ FT_MODULE_DRIVER_HAS_HINTER | FT_MODULE_DRIVER_HINTS_LIGHTLY, - sizeof ( CFF_DriverRec ), + sizeof ( PS_DriverRec ), "cff", 0x10000L, 0x20000L, diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffdrivr.h b/sdk/lib/3rdparty/freetype/src/cff/cffdrivr.h index 05381e66db9..ad7c3ad70a8 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffdrivr.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cffdrivr.h @@ -4,7 +4,7 @@ /* */ /* High-level OpenType driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cfferrs.h b/sdk/lib/3rdparty/freetype/src/cff/cfferrs.h index 40808c10513..b2e1bfaf9db 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cfferrs.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cfferrs.h @@ -4,7 +4,7 @@ /* */ /* CFF error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffgload.c b/sdk/lib/3rdparty/freetype/src/cff/cffgload.c index 20f3a2c28e9..c58471ce861 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffgload.c +++ b/sdk/lib/3rdparty/freetype/src/cff/cffgload.c @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,13 +21,12 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_OUTLINE_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H -#include "cffobjs.h" #include "cffload.h" #include "cffgload.h" -#include "cf2ft.h" /* for cf2_decoder_parse_charstrings */ #include "cfferrs.h" @@ -42,623 +41,6 @@ #define FT_COMPONENT trace_cffgload -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - - typedef enum CFF_Operator_ - { - cff_op_unknown = 0, - - cff_op_rmoveto, - cff_op_hmoveto, - cff_op_vmoveto, - - cff_op_rlineto, - cff_op_hlineto, - cff_op_vlineto, - - cff_op_rrcurveto, - cff_op_hhcurveto, - cff_op_hvcurveto, - cff_op_rcurveline, - cff_op_rlinecurve, - cff_op_vhcurveto, - cff_op_vvcurveto, - - cff_op_flex, - cff_op_hflex, - cff_op_hflex1, - cff_op_flex1, - - cff_op_endchar, - - cff_op_hstem, - cff_op_vstem, - cff_op_hstemhm, - cff_op_vstemhm, - - cff_op_hintmask, - cff_op_cntrmask, - cff_op_dotsection, /* deprecated, acts as no-op */ - - cff_op_abs, - cff_op_add, - cff_op_sub, - cff_op_div, - cff_op_neg, - cff_op_random, - cff_op_mul, - cff_op_sqrt, - - cff_op_blend, - - cff_op_drop, - cff_op_exch, - cff_op_index, - cff_op_roll, - cff_op_dup, - - cff_op_put, - cff_op_get, - cff_op_store, - cff_op_load, - - cff_op_and, - cff_op_or, - cff_op_not, - cff_op_eq, - cff_op_ifelse, - - cff_op_callsubr, - 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 - - } CFF_Operator; - - -#define CFF_COUNT_CHECK_WIDTH 0x80 -#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[] = - { - 0, /* unknown */ - - 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */ - 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, - 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, - - 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */ - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - - 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */ - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - - 13, /* flex */ - 7, - 9, - 11, - - 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */ - - 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */ - 2 | CFF_COUNT_CHECK_WIDTH, - 2 | CFF_COUNT_CHECK_WIDTH, - 2 | CFF_COUNT_CHECK_WIDTH, - - 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */ - 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */ - 0, /* dotsection */ - - 1, /* abs */ - 2, - 2, - 2, - 1, - 0, - 2, - 1, - - 1, /* blend */ - - 1, /* drop */ - 2, - 1, - 2, - 1, - - 2, /* put */ - 1, - 4, - 3, - - 2, /* and */ - 2, - 1, - 2, - 4, - - 1, /* callsubr */ - 1, - 0, - - 2, /* hsbw */ - 0, - 0, - 0, - 5, /* seac */ - 4, /* sbw */ - 2 /* setcurrentpoint */ - }; - -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /********** *********/ - /********** *********/ - /********** GENERIC CHARSTRING PARSING *********/ - /********** *********/ - /********** *********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* cff_builder_init */ - /* */ - /* */ - /* Initializes a given glyph builder. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* glyph :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting is active. */ - /* */ - static void - cff_builder_init( CFF_Builder* builder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot glyph, - FT_Bool hinting ) - { - builder->path_begun = 0; - builder->load_points = 1; - - builder->face = face; - builder->glyph = glyph; - builder->memory = face->root.memory; - - if ( glyph ) - { - FT_GlyphLoader loader = glyph->root.internal->loader; - - - builder->loader = loader; - builder->base = &loader->base.outline; - builder->current = &loader->current.outline; - FT_GlyphLoader_Rewind( loader ); - - builder->hints_globals = NULL; - builder->hints_funcs = NULL; - - if ( hinting && size ) - { - FT_Size ftsize = FT_SIZE( size ); - CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; - - - if ( internal ) - { - builder->hints_globals = (void *)internal->topfont; - builder->hints_funcs = glyph->root.internal->glyph_hints; - } - } - } - - builder->pos_x = 0; - builder->pos_y = 0; - - builder->left_bearing.x = 0; - builder->left_bearing.y = 0; - builder->advance.x = 0; - builder->advance.y = 0; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_builder_done */ - /* */ - /* */ - /* Finalizes a given glyph builder. Its contents can still be used */ - /* after the call, but the function saves important information */ - /* within the corresponding glyph slot. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to finalize. */ - /* */ - static void - cff_builder_done( CFF_Builder* builder ) - { - CFF_GlyphSlot glyph = builder->glyph; - - - if ( glyph ) - glyph->root.outline = *builder->base; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_compute_bias */ - /* */ - /* */ - /* Computes the bias value in dependence of the number of glyph */ - /* subroutines. */ - /* */ - /* */ - /* in_charstring_type :: The `CharstringType' value of the top DICT */ - /* dictionary. */ - /* */ - /* num_subrs :: The number of glyph subroutines. */ - /* */ - /* */ - /* The bias value. */ - static FT_Int - cff_compute_bias( FT_Int in_charstring_type, - FT_UInt num_subrs ) - { - FT_Int result; - - - if ( in_charstring_type == 1 ) - result = 0; - else if ( num_subrs < 1240 ) - result = 107; - else if ( num_subrs < 33900U ) - result = 1131; - else - result = 32768U; - - return result; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_decoder_init */ - /* */ - /* */ - /* Initializes a given glyph decoder. */ - /* */ - /* */ - /* decoder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size 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, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode ) - { - CFF_Font cff = (CFF_Font)face->extra.data; - - - /* clear everything */ - FT_ZERO( decoder ); - - /* initialize builder */ - cff_builder_init( &decoder->builder, face, size, slot, hinting ); - - /* initialize Type2 decoder */ - decoder->cff = cff; - decoder->num_globals = cff->global_subrs_index.count; - decoder->globals = cff->global_subrs; - 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 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_Builder *builder = &decoder->builder; - CFF_Font cff = (CFF_Font)builder->face->extra.data; - CFF_SubFont sub = &cff->top_font; - FT_Error error = FT_Err_Ok; - - - /* manage CID fonts */ - if ( cff->num_subfonts ) - { - FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); - - - if ( fd_index >= cff->num_subfonts ) - { - FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } - - FT_TRACE3(( " in subfont %d:\n", fd_index )); - - sub = cff->subfonts[fd_index]; - - if ( builder->hints_funcs && size ) - { - FT_Size ftsize = FT_SIZE( size ); - CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; - - - /* for CFFs without subfonts, this value has already been set */ - builder->hints_globals = (void *)internal->subfonts[fd_index]; - } - } - - decoder->num_locals = sub->local_subrs_index.count; - decoder->locals = sub->local_subrs; - 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; - - decoder->current_subfont = sub; - - Exit: - return error; - } - - - /* check that there is enough space for `count' more points */ - FT_LOCAL_DEF( FT_Error ) - cff_check_points( CFF_Builder* builder, - FT_Int count ) - { - return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); - } - - - /* add a new point, do not check space */ - FT_LOCAL_DEF( void ) - cff_builder_add_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y, - FT_Byte flag ) - { - FT_Outline* outline = builder->current; - - - if ( builder->load_points ) - { - FT_Vector* point = outline->points + outline->n_points; - FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; - -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); - - - if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) - { - point->x = x >> 16; - point->y = y >> 16; - } - else -#endif - { - /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ - point->x = x >> 10; - point->y = y >> 10; - } - *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); - } - - outline->n_points++; - } - - - /* check space for a new on-curve point, then add it */ - FT_LOCAL_DEF( FT_Error ) - cff_builder_add_point1( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ) - { - FT_Error error; - - - error = cff_check_points( builder, 1 ); - if ( !error ) - cff_builder_add_point( builder, x, y, 1 ); - - return error; - } - - - /* check space for a new contour, then add it */ - static FT_Error - cff_builder_add_contour( CFF_Builder* builder ) - { - FT_Outline* outline = builder->current; - FT_Error error; - - - if ( !builder->load_points ) - { - outline->n_contours++; - return FT_Err_Ok; - } - - error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); - if ( !error ) - { - if ( outline->n_contours > 0 ) - outline->contours[outline->n_contours - 1] = - (short)( outline->n_points - 1 ); - - outline->n_contours++; - } - - return error; - } - - - /* if a path was begun, add its first on-curve point */ - FT_LOCAL_DEF( FT_Error ) - cff_builder_start_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ) - { - FT_Error error = FT_Err_Ok; - - - /* test whether we are building a new contour */ - if ( !builder->path_begun ) - { - builder->path_begun = 1; - error = cff_builder_add_contour( builder ); - if ( !error ) - error = cff_builder_add_point1( builder, x, y ); - } - - return error; - } - - - /* close the current contour */ - FT_LOCAL_DEF( void ) - cff_builder_close_contour( CFF_Builder* builder ) - { - FT_Outline* outline = builder->current; - FT_Int first; - - - if ( !outline ) - return; - - 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_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; - - - /* `delete' last point only if it coincides with the first */ - /* point and if it is not a control point (which can happen). */ - if ( p1->x == p2->x && p1->y == p2->y ) - if ( *control == FT_CURVE_TAG_ON ) - outline->n_points--; - } - - if ( outline->n_contours > 0 ) - { - /* Don't add contours only consisting of one point, i.e., */ - /* check whether begin point and last point are the same. */ - if ( first == outline->n_points - 1 ) - { - outline->n_contours--; - outline->n_points--; - } - else - outline->contours[outline->n_contours - 1] = - (short)( outline->n_points - 1 ); - } - } - - - FT_LOCAL_DEF( FT_Int ) - cff_lookup_glyph_by_stdcharcode( CFF_Font cff, - FT_Int charcode ) - { - FT_UInt n; - FT_UShort glyph_sid; - - - /* CID-keyed fonts don't have glyph names */ - if ( !cff->charset.sids ) - return -1; - - /* check range of standard char code */ - if ( charcode < 0 || charcode > 255 ) - return -1; - - /* Get code to SID mapping from `cff_standard_encoding'. */ - glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode ); - - for ( n = 0; n < cff->num_glyphs; n++ ) - { - if ( cff->charset.sids[n] == glyph_sid ) - return (FT_Int)n; - } - - return -1; - } - - FT_LOCAL_DEF( FT_Error ) cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, @@ -730,1950 +112,6 @@ } -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - - static FT_Error - cff_operator_seac( CFF_Decoder* decoder, - FT_Pos asb, - FT_Pos adx, - FT_Pos ady, - FT_Int bchar, - FT_Int achar ) - { - FT_Error error; - CFF_Builder* builder = &decoder->builder; - FT_Int bchar_index, achar_index; - TT_Face face = decoder->builder.face; - FT_Vector left_bearing, advance; - FT_Byte* charstring; - FT_ULong charstring_len; - FT_Pos glyph_width; - - - if ( decoder->seac ) - { - FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); - return FT_THROW( 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. */ - /* They use the character code, not the glyph index, in this case. */ - if ( face->root.internal->incremental_interface ) - { - bchar_index = bchar; - achar_index = achar; - } - else -#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - { - CFF_Font cff = (CFF_Font)(face->extra.data); - - - bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar ); - achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar ); - } - - if ( bchar_index < 0 || achar_index < 0 ) - { - FT_ERROR(( "cff_operator_seac:" - " invalid seac character code arguments\n" )); - return FT_THROW( Syntax_Error ); - } - - /* If we are trying to load a composite glyph, do not load the */ - /* accent character and return the array of subglyphs. */ - if ( builder->no_recurse ) - { - FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph; - FT_GlyphLoader loader = glyph->internal->loader; - FT_SubGlyph subg; - - - /* reallocate subglyph array if necessary */ - error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); - if ( error ) - goto Exit; - - subg = loader->current.subglyphs; - - /* subglyph 0 = base character */ - subg->index = bchar_index; - subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | - FT_SUBGLYPH_FLAG_USE_MY_METRICS; - subg->arg1 = 0; - subg->arg2 = 0; - subg++; - - /* subglyph 1 = accent character */ - subg->index = achar_index; - subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; - subg->arg1 = (FT_Int)( adx >> 16 ); - subg->arg2 = (FT_Int)( ady >> 16 ); - - /* set up remaining glyph fields */ - glyph->num_subglyphs = 2; - glyph->subglyphs = loader->base.subglyphs; - glyph->format = FT_GLYPH_FORMAT_COMPOSITE; - - loader->current.num_subglyphs = 2; - } - - FT_GlyphLoader_Prepare( builder->loader ); - - /* First load `bchar' in builder */ - error = cff_get_glyph_data( face, (FT_UInt)bchar_index, - &charstring, &charstring_len ); - if ( !error ) - { - /* the seac operator must not be nested */ - decoder->seac = TRUE; - error = cff_decoder_parse_charstrings( decoder, charstring, - charstring_len, 0 ); - decoder->seac = FALSE; - - cff_free_glyph_data( face, &charstring, charstring_len ); - - if ( error ) - goto Exit; - } - - /* 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 - asb; - builder->pos_y = ady; - - /* Now load `achar' on top of the base outline. */ - error = cff_get_glyph_data( face, (FT_UInt)achar_index, - &charstring, &charstring_len ); - if ( !error ) - { - /* the seac operator must not be nested */ - decoder->seac = TRUE; - error = cff_decoder_parse_charstrings( decoder, charstring, - charstring_len, 0 ); - decoder->seac = FALSE; - - cff_free_glyph_data( face, &charstring, charstring_len ); - - if ( error ) - goto Exit; - } - - /* 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; - - Exit: - return error; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_decoder_parse_charstrings */ - /* */ - /* */ - /* Parses a given Type 2 charstrings program. */ - /* */ - /* */ - /* decoder :: The current Type 1 decoder. */ - /* */ - /* */ - /* charstring_base :: The base of the charstring stream. */ - /* */ - /* charstring_len :: The length in bytes of the charstring stream. */ - /* */ - /* in_dict :: Set to 1 if function is called from top or */ - /* private DICT (needed for Multiple Master CFFs). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL_DEF( FT_Error ) - cff_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len, - FT_Bool in_dict ) - { - FT_Error error; - CFF_Decoder_Zone* zone; - FT_Byte* ip; - FT_Byte* limit; - CFF_Builder* builder = &decoder->builder; - FT_Pos x, y; - FT_Fixed* stack; - FT_Int charstring_type = - decoder->cff->top_font.font_dict.charstring_type; - FT_UShort num_designs = - decoder->cff->top_font.font_dict.num_designs; - FT_UShort num_axes = - decoder->cff->top_font.font_dict.num_axes; - - T2_Hints_Funcs hinter; - - - /* set default width */ - decoder->num_hints = 0; - decoder->read_width = 1; - - /* initialize the decoder */ - decoder->top = decoder->stack; - decoder->zone = decoder->zones; - zone = decoder->zones; - stack = decoder->top; - - hinter = (T2_Hints_Funcs)builder->hints_funcs; - - builder->path_begun = 0; - - zone->base = charstring_base; - limit = zone->limit = charstring_base + charstring_len; - ip = zone->cursor = zone->base; - - error = FT_Err_Ok; - - x = builder->pos_x; - y = builder->pos_y; - - /* begin hints recording session, if any */ - if ( hinter ) - hinter->open( hinter->hints ); - - /* now execute loop */ - while ( ip < limit ) - { - CFF_Operator op; - FT_Byte v; - - - /********************************************************************/ - /* */ - /* Decode operator or operand */ - /* */ - v = *ip++; - if ( v >= 32 || v == 28 ) - { - FT_Int shift = 16; - FT_Int32 val; - - - /* this is an operand, push it on the stack */ - - /* if we use shifts, all computations are done with unsigned */ - /* values; the conversion to a signed value is the last step */ - if ( v == 28 ) - { - if ( ip + 1 >= limit ) - goto Syntax_Error; - val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] ); - ip += 2; - } - else if ( v < 247 ) - val = (FT_Int32)v - 139; - else if ( v < 251 ) - { - if ( ip >= limit ) - goto Syntax_Error; - val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108; - } - else if ( v < 255 ) - { - if ( ip >= limit ) - goto Syntax_Error; - val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108; - } - else - { - if ( ip + 3 >= limit ) - goto Syntax_Error; - val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | - ( (FT_UInt32)ip[1] << 16 ) | - ( (FT_UInt32)ip[2] << 8 ) | - (FT_UInt32)ip[3] ); - ip += 4; - if ( charstring_type == 2 ) - shift = 0; - } - if ( decoder->top - stack >= CFF_MAX_OPERANDS ) - goto Stack_Overflow; - - val = (FT_Int32)( (FT_UInt32)val << shift ); - *decoder->top++ = val; - -#ifdef FT_DEBUG_LEVEL_TRACE - if ( !( val & 0xFFFFL ) ) - FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) )); - else - FT_TRACE4(( " %.5f", val / 65536.0 )); -#endif - - } - 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; - - - /* find operator */ - op = cff_op_unknown; - - switch ( v ) - { - case 1: - op = cff_op_hstem; - break; - case 3: - op = cff_op_vstem; - break; - case 4: - op = cff_op_vmoveto; - break; - case 5: - op = cff_op_rlineto; - break; - case 6: - op = cff_op_hlineto; - break; - case 7: - op = cff_op_vlineto; - break; - case 8: - op = cff_op_rrcurveto; - break; - case 9: - op = cff_op_closepath; - break; - case 10: - op = cff_op_callsubr; - break; - case 11: - op = cff_op_return; - break; - case 12: - { - if ( ip >= limit ) - goto Syntax_Error; - v = *ip++; - - switch ( v ) - { - 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; - case 4: - op = cff_op_or; - break; - 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; - case 9: - op = cff_op_abs; - break; - case 10: - op = cff_op_add; - break; - case 11: - op = cff_op_sub; - break; - case 12: - op = cff_op_div; - break; - case 13: - op = cff_op_load; - break; - case 14: - op = cff_op_neg; - break; - case 15: - op = cff_op_eq; - break; - case 16: - op = cff_op_callothersubr; - break; - case 17: - op = cff_op_pop; - break; - case 18: - op = cff_op_drop; - break; - case 20: - op = cff_op_put; - break; - case 21: - op = cff_op_get; - break; - case 22: - op = cff_op_ifelse; - break; - case 23: - op = cff_op_random; - break; - case 24: - op = cff_op_mul; - break; - case 26: - op = cff_op_sqrt; - break; - case 27: - op = cff_op_dup; - break; - case 28: - op = cff_op_exch; - break; - case 29: - op = cff_op_index; - break; - case 30: - op = cff_op_roll; - break; - case 33: - op = cff_op_setcurrentpoint; - break; - case 34: - op = cff_op_hflex; - break; - case 35: - op = cff_op_flex; - break; - case 36: - op = cff_op_hflex1; - break; - case 37: - op = cff_op_flex1; - break; - default: - FT_TRACE4(( " unknown op (12, %d)\n", v )); - break; - } - } - break; - case 13: - op = cff_op_hsbw; - break; - case 14: - op = cff_op_endchar; - break; - case 16: - op = cff_op_blend; - break; - case 18: - op = cff_op_hstemhm; - break; - case 19: - op = cff_op_hintmask; - break; - case 20: - op = cff_op_cntrmask; - break; - case 21: - op = cff_op_rmoveto; - break; - case 22: - op = cff_op_hmoveto; - break; - case 23: - op = cff_op_vstemhm; - break; - case 24: - op = cff_op_rcurveline; - break; - case 25: - op = cff_op_rlinecurve; - break; - case 26: - op = cff_op_vvcurveto; - break; - case 27: - op = cff_op_hhcurveto; - break; - case 29: - op = cff_op_callgsubr; - break; - case 30: - op = cff_op_vhcurveto; - break; - case 31: - op = cff_op_hvcurveto; - break; - default: - FT_TRACE4(( " unknown op (%d)\n", v )); - break; - } - - if ( op == cff_op_unknown ) - continue; - - /* in Multiple Master CFFs, T2 charstrings can appear in */ - /* dictionaries, but some operators are prohibited */ - if ( in_dict ) - { - switch ( op ) - { - case cff_op_hstem: - case cff_op_vstem: - case cff_op_vmoveto: - case cff_op_rlineto: - case cff_op_hlineto: - case cff_op_vlineto: - case cff_op_rrcurveto: - case cff_op_hstemhm: - case cff_op_hintmask: - case cff_op_cntrmask: - case cff_op_rmoveto: - case cff_op_hmoveto: - case cff_op_vstemhm: - case cff_op_rcurveline: - case cff_op_rlinecurve: - case cff_op_vvcurveto: - case cff_op_hhcurveto: - case cff_op_vhcurveto: - case cff_op_hvcurveto: - case cff_op_hflex: - case cff_op_flex: - case cff_op_hflex1: - case cff_op_flex1: - case cff_op_callsubr: - case cff_op_callgsubr: - goto MM_Error; - - default: - break; - } - } - - /* check arguments */ - req_args = cff_argument_counts[op]; - if ( req_args & CFF_COUNT_CHECK_WIDTH ) - { - if ( num_args > 0 && decoder->read_width ) - { - /* If `nominal_width' is non-zero, the number is really a */ - /* difference against `nominal_width'. Else, the number here */ - /* is truly a width, not a difference against `nominal_width'. */ - /* If the font does not set `nominal_width', then */ - /* `nominal_width' defaults to zero, and so we can set */ - /* `glyph_width' to `nominal_width' plus number on the stack */ - /* -- for either case. */ - - FT_Int set_width_ok; - - - switch ( op ) - { - case cff_op_hmoveto: - case cff_op_vmoveto: - set_width_ok = num_args & 2; - break; - - case cff_op_hstem: - case cff_op_vstem: - case cff_op_hstemhm: - case cff_op_vstemhm: - case cff_op_rmoveto: - case cff_op_hintmask: - case cff_op_cntrmask: - set_width_ok = num_args & 1; - break; - - 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 = in_dict - ? 0 - : ( ( num_args == 5 ) || ( num_args == 1 ) ); - break; - - default: - set_width_ok = 0; - break; - } - - if ( set_width_ok ) - { - 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--; - } - } - - decoder->read_width = 0; - req_args = 0; - } - - 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: - case cff_op_vstem: - case cff_op_hstemhm: - case cff_op_vstemhm: - /* the number of arguments is always even here */ - 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 - ( num_args & ~1 ) ); - - decoder->num_hints += num_args / 2; - args = stack; - break; - - case cff_op_hintmask: - case cff_op_cntrmask: - FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" )); - - /* implement vstem when needed -- */ - /* the specification doesn't say it, but this also works */ - /* with the 'cntrmask' operator */ - /* */ - if ( num_args > 0 ) - { - if ( hinter ) - hinter->stems( hinter->hints, - 0, - num_args / 2, - args - ( num_args & ~1 ) ); - - decoder->num_hints += num_args / 2; - } - - /* In a valid charstring there must be at least one byte */ - /* after `hintmask' or `cntrmask' (e.g., for a `return' */ - /* instruction). Additionally, there must be space for */ - /* `num_hints' bits. */ - - if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit ) - goto Syntax_Error; - - if ( hinter ) - { - if ( op == cff_op_hintmask ) - hinter->hintmask( hinter->hints, - (FT_UInt)builder->current->n_points, - (FT_UInt)decoder->num_hints, - ip ); - else - hinter->counter( hinter->hints, - (FT_UInt)decoder->num_hints, - ip ); - } - -#ifdef FT_DEBUG_LEVEL_TRACE - { - FT_UInt maskbyte; - - - 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; -#endif - args = stack; - break; - - case cff_op_rmoveto: - FT_TRACE4(( " rmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - x = ADD_LONG( x, args[-2] ); - y = ADD_LONG( y, args[-1] ); - args = stack; - break; - - case cff_op_vmoveto: - FT_TRACE4(( " vmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - y = ADD_LONG( y, args[-1] ); - args = stack; - break; - - case cff_op_hmoveto: - FT_TRACE4(( " hmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - x = ADD_LONG( x, args[-1] ); - args = stack; - break; - - case cff_op_rlineto: - FT_TRACE4(( " rlineto\n" )); - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_args / 2 ) ) - goto Fail; - - if ( num_args < 2 ) - goto Stack_Underflow; - - args -= num_args & ~1; - while ( args < decoder->top ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 1 ); - args += 2; - } - args = stack; - break; - - case cff_op_hlineto: - case cff_op_vlineto: - { - FT_Int phase = ( op == cff_op_hlineto ); - - - FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" - : " vlineto\n" )); - - if ( num_args < 0 ) - goto Stack_Underflow; - - /* there exist subsetted fonts (found in PDFs) */ - /* which call `hlineto' without arguments */ - if ( num_args == 0 ) - break; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_args ) ) - goto Fail; - - args = stack; - while ( args < decoder->top ) - { - if ( phase ) - x = ADD_LONG( x, args[0] ); - else - y = ADD_LONG( y, args[0] ); - - if ( cff_builder_add_point1( builder, x, y ) ) - goto Fail; - - args++; - phase ^= 1; - } - args = stack; - } - break; - - case cff_op_rrcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " rrcurveto\n" )); - - if ( num_args < 6 ) - goto Stack_Underflow; - - nargs = num_args - num_args % 6; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, nargs / 2 ) ) - goto Fail; - - args -= nargs; - while ( args < decoder->top ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[2] ); - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[4] ); - y = ADD_LONG( y, args[5] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 6; - } - args = stack; - } - break; - - case cff_op_vvcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " vvcurveto\n" )); - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - args -= nargs; - - if ( nargs & 1 ) - { - x = ADD_LONG( x, args[0] ); - args++; - nargs--; - } - - if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) - goto Fail; - - while ( args < decoder->top ) - { - y = ADD_LONG( y, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 4; - } - args = stack; - } - break; - - case cff_op_hhcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " hhcurveto\n" )); - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - args -= nargs; - if ( nargs & 1 ) - { - y = ADD_LONG( y, args[0] ); - args++; - nargs--; - } - - if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) - goto Fail; - - while ( args < decoder->top ) - { - x = ADD_LONG( x, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[3] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 4; - } - args = stack; - } - break; - - case cff_op_vhcurveto: - case cff_op_hvcurveto: - { - FT_Int phase; - FT_Int nargs; - - - FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" - : " hvcurveto\n" )); - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - args -= nargs; - if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) ) - goto Stack_Underflow; - - phase = ( op == cff_op_hvcurveto ); - - while ( nargs >= 4 ) - { - nargs -= 4; - if ( phase ) - { - x = ADD_LONG( x, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - y = ADD_LONG( y, args[3] ); - if ( nargs == 1 ) - x = ADD_LONG( x, args[4] ); - cff_builder_add_point( builder, x, y, 1 ); - } - else - { - y = ADD_LONG( y, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[3] ); - if ( nargs == 1 ) - y = ADD_LONG( y, args[4] ); - cff_builder_add_point( builder, x, y, 1 ); - } - args += 4; - phase ^= 1; - } - args = stack; - } - break; - - case cff_op_rlinecurve: - { - FT_Int num_lines; - FT_Int nargs; - - - FT_TRACE4(( " rlinecurve\n" )); - - if ( num_args < 8 ) - goto Stack_Underflow; - - nargs = num_args & ~1; - num_lines = ( nargs - 6 ) / 2; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_lines + 3 ) ) - goto Fail; - - args -= nargs; - - /* first, add the line segments */ - while ( num_lines > 0 ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 2; - num_lines--; - } - - /* then the curve */ - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[2] ); - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[4] ); - y = ADD_LONG( y, args[5] ); - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - } - break; - - case cff_op_rcurveline: - { - FT_Int num_curves; - FT_Int nargs; - - - FT_TRACE4(( " rcurveline\n" )); - - 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 ) || - cff_check_points( builder, num_curves * 3 + 2 ) ) - goto Fail; - - args -= nargs; - - /* first, add the curves */ - while ( num_curves > 0 ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[2] ); - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 0 ); - - x = ADD_LONG( x, args[4] ); - y = ADD_LONG( y, args[5] ); - cff_builder_add_point( builder, x, y, 1 ); - - args += 6; - num_curves--; - } - - /* then the final line */ - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - } - break; - - case cff_op_hflex1: - { - FT_Pos start_y; - - - 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 */ - /* needs to be added */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's y position for later use */ - start_y = y; - - /* first control point */ - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* second control point */ - x = ADD_LONG( x, args[2] ); - y = ADD_LONG( y, args[3] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* join point; on curve, with y-value the same as the last */ - /* control point's y-value */ - x = ADD_LONG( x, args[4] ); - cff_builder_add_point( builder, x, y, 1 ); - - /* third control point, with y-value the same as the join */ - /* point's y-value */ - x = ADD_LONG( x, args[5] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* fourth control point */ - x = ADD_LONG( x, args[6] ); - y = ADD_LONG( y, args[7] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* ending point, with y-value the same as the start */ - x = ADD_LONG( x, args[8] ); - y = start_y; - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - case cff_op_hflex: - { - FT_Pos start_y; - - - FT_TRACE4(( " hflex\n" )); - - /* adding six more points; 4 control points, 2 on-curve points */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's y-position for later use */ - start_y = y; - - /* first control point */ - x = ADD_LONG( x, args[0] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* second control point */ - x = ADD_LONG( x, args[1] ); - y = ADD_LONG( y, args[2] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* join point; on curve, with y-value the same as the last */ - /* control point's y-value */ - x = ADD_LONG( x, args[3] ); - cff_builder_add_point( builder, x, y, 1 ); - - /* third control point, with y-value the same as the join */ - /* point's y-value */ - x = ADD_LONG( x, args[4] ); - cff_builder_add_point( builder, x, y, 0 ); - - /* fourth control point */ - x = ADD_LONG( x, args[5] ); - y = start_y; - cff_builder_add_point( builder, x, y, 0 ); - - /* ending point, with y-value the same as the start point's */ - /* y-value -- we don't add this point, though */ - x = ADD_LONG( x, args[6] ); - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - 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_Fixed* temp; - - - FT_TRACE4(( " flex1\n" )); - - /* adding six more points; 4 control points, 2 on-curve points */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's x, y position for later use */ - start_x = x; - start_y = y; - - /* XXX: figure out whether this is supposed to be a horizontal */ - /* or vertical flex; the Type 2 specification is vague... */ - - temp = args; - - /* grab up to the last argument */ - for ( count = 5; count > 0; count-- ) - { - dx = ADD_LONG( dx, temp[0] ); - dy = ADD_LONG( dy, temp[1] ); - temp += 2; - } - - if ( dx < 0 ) - dx = -dx; - if ( dy < 0 ) - dy = -dy; - - /* strange test, but here it is... */ - horizontal = ( dx > dy ); - - for ( count = 5; count > 0; count-- ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, - (FT_Bool)( count == 3 ) ); - args += 2; - } - - /* is last operand an x- or y-delta? */ - if ( horizontal ) - { - x = ADD_LONG( x, args[0] ); - y = start_y; - } - else - { - x = start_x; - y = ADD_LONG( y, args[0] ); - } - - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - case cff_op_flex: - { - FT_UInt count; - - - FT_TRACE4(( " flex\n" )); - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - for ( count = 6; count > 0; count-- ) - { - x = ADD_LONG( x, args[0] ); - y = ADD_LONG( y, args[1] ); - cff_builder_add_point( builder, x, y, - (FT_Bool)( count == 4 || count == 1 ) ); - args += 2; - } - - args = stack; - } - 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: - /* in dictionaries, `endchar' simply indicates end of data */ - if ( in_dict ) - return error; - - FT_TRACE4(( " endchar\n" )); - - /* We are going to emulate the seac operator. */ - if ( num_args >= 4 ) - { - /* Save glyph width so that the subglyphs don't overwrite it. */ - FT_Pos glyph_width = decoder->glyph_width; - - - error = cff_operator_seac( decoder, - 0L, args[-4], args[-3], - (FT_Int)( args[-2] >> 16 ), - (FT_Int)( args[-1] >> 16 ) ); - - decoder->glyph_width = glyph_width; - } - else - { - cff_builder_close_contour( builder ); - - /* close hints recording session */ - if ( hinter ) - { - if ( hinter->close( hinter->hints, - (FT_UInt)builder->current->n_points ) ) - goto Syntax_Error; - - /* apply hints to the loaded glyph outline now */ - error = hinter->apply( hinter->hints, - builder->current, - (PSH_Globals)builder->hints_globals, - decoder->hint_mode ); - if ( error ) - goto Fail; - } - - /* add current outline to the glyph slot */ - FT_GlyphLoader_Add( builder->loader ); - } - - /* return now! */ - FT_TRACE4(( "\n" )); - return error; - - case cff_op_abs: - FT_TRACE4(( " abs\n" )); - - if ( args[0] < 0 ) - { - if ( args[0] == FT_LONG_MIN ) - args[0] = FT_LONG_MAX; - else - args[0] = -args[0]; - } - args++; - break; - - case cff_op_add: - FT_TRACE4(( " add\n" )); - - args[0] = ADD_LONG( args[0], args[1] ); - args++; - break; - - case cff_op_sub: - FT_TRACE4(( " sub\n" )); - - args[0] = SUB_LONG( args[0], args[1] ); - args++; - break; - - case cff_op_div: - FT_TRACE4(( " div\n" )); - - args[0] = FT_DivFix( args[0], args[1] ); - args++; - break; - - case cff_op_neg: - FT_TRACE4(( " neg\n" )); - - if ( args[0] == FT_LONG_MIN ) - args[0] = FT_LONG_MAX; - args[0] = -args[0]; - args++; - break; - - case cff_op_random: - FT_TRACE4(( " random\n" )); - - /* only use the lower 16 bits of `random' */ - /* to generate a number in the range (0;1] */ - args[0] = (FT_Fixed) - ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); - args++; - - decoder->current_subfont->random = - cff_random( decoder->current_subfont->random ); - break; - - case cff_op_mul: - FT_TRACE4(( " mul\n" )); - - args[0] = FT_MulFix( args[0], args[1] ); - args++; - break; - - case cff_op_sqrt: - FT_TRACE4(( " sqrt\n" )); - - if ( args[0] > 0 ) - { - FT_Fixed root = args[0]; - FT_Fixed new_root; - - - for (;;) - { - new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1; - if ( new_root == root ) - break; - root = new_root; - } - args[0] = new_root; - } - else - args[0] = 0; - args++; - break; - - case cff_op_drop: - /* nothing */ - FT_TRACE4(( " drop\n" )); - - break; - - case cff_op_exch: - { - FT_Fixed tmp; - - - FT_TRACE4(( " exch\n" )); - - tmp = args[0]; - args[0] = args[1]; - args[1] = tmp; - args += 2; - } - break; - - case cff_op_index: - { - FT_Int idx = (FT_Int)( args[0] >> 16 ); - - - FT_TRACE4(( " index\n" )); - - if ( idx < 0 ) - idx = 0; - else if ( idx > num_args - 2 ) - idx = num_args - 2; - args[0] = args[-( idx + 1 )]; - args++; - } - break; - - case cff_op_roll: - { - FT_Int count = (FT_Int)( args[0] >> 16 ); - FT_Int idx = (FT_Int)( args[1] >> 16 ); - - - FT_TRACE4(( " roll\n" )); - - if ( count <= 0 ) - count = 1; - - args -= count; - if ( args < stack ) - goto Stack_Underflow; - - if ( idx >= 0 ) - { - while ( idx > 0 ) - { - FT_Fixed tmp = args[count - 1]; - FT_Int i; - - - for ( i = count - 2; i >= 0; i-- ) - args[i + 1] = args[i]; - args[0] = tmp; - idx--; - } - } - else - { - while ( idx < 0 ) - { - FT_Fixed tmp = args[0]; - FT_Int i; - - - for ( i = 0; i < count - 1; i++ ) - args[i] = args[i + 1]; - args[count - 1] = tmp; - idx++; - } - } - args += count; - } - break; - - case cff_op_dup: - FT_TRACE4(( " dup\n" )); - - args[1] = args[0]; - args += 2; - break; - - case cff_op_put: - { - FT_Fixed val = args[0]; - FT_Int idx = (FT_Int)( args[1] >> 16 ); - - - FT_TRACE4(( " put\n" )); - - /* the Type2 specification before version 16-March-2000 */ - /* didn't give a hard-coded size limit of the temporary */ - /* storage array; instead, an argument of the */ - /* `MultipleMaster' operator set the size */ - if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) - decoder->buildchar[idx] = val; - } - break; - - case cff_op_get: - { - FT_Int idx = (FT_Int)( args[0] >> 16 ); - FT_Fixed val = 0; - - - FT_TRACE4(( " get\n" )); - - if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) - val = decoder->buildchar[idx]; - - args[0] = val; - args++; - } - break; - - case cff_op_store: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, this is a no-op */ - FT_TRACE4(( " store\n")); - break; - - case cff_op_load: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - { - FT_Int reg_idx = (FT_Int)args[0]; - FT_Int idx = (FT_Int)args[1]; - FT_Int count = (FT_Int)args[2]; - - - FT_TRACE4(( " load\n" )); - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, we store a vector [1 0 0 ...] in the */ - /* temporary storage array regardless of the Registry index */ - if ( reg_idx >= 0 && reg_idx <= 2 && - idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS && - count >= 0 && count <= num_axes ) - { - FT_Int end, i; - - - end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS ); - - if ( idx < end ) - decoder->buildchar[idx] = 1 << 16; - - for ( i = idx + 1; i < end; i++ ) - decoder->buildchar[i] = 0; - } - } - break; - - case cff_op_blend: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - { - FT_Int num_results = (FT_Int)( args[0] >> 16 ); - - - FT_TRACE4(( " blend\n" )); - - if ( num_results < 0 ) - goto Syntax_Error; - - if ( num_results * (FT_Int)num_designs > num_args ) - goto Stack_Underflow; - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, return the `num_results' values of the */ - /* first master */ - args -= num_results * ( num_designs - 1 ); - num_args -= num_results * ( num_designs - 1 ); - } - break; - - case cff_op_dotsection: - /* this operator is deprecated and ignored by the parser */ - 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 = - ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) ); - - decoder->builder.left_bearing.x = args[0]; - decoder->builder.left_bearing.y = 0; - - x = ADD_LONG( 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 = - ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) ); - - decoder->builder.left_bearing.x = args[0]; - decoder->builder.left_bearing.y = args[1]; - - x = ADD_LONG( decoder->builder.pos_x, args[0] ); - y = ADD_LONG( 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 = ADD_LONG( decoder->builder.pos_x, args[0] ); - y = ADD_LONG( 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. */ - /* */ - /* XXX Fix return arguments (see discussion below). */ - args -= 2 + ( args[-2] >> 16 ); - if ( args < stack ) - goto Stack_Underflow; - 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" )); - - /* XXX Increasing `args' is wrong: After a certain number of */ - /* `pop's we get a stack overflow. Reason for doing it is */ - /* code like this (actually found in a CFF font): */ - /* */ - /* 17 1 3 callothersubr */ - /* pop */ - /* callsubr */ - /* */ - /* Since we handle `callothersubr' as a no-op, and */ - /* `callsubr' needs at least one argument, `pop' can't be a */ - /* no-op too as it basically should be. */ - /* */ - /* The right solution would be to provide real support for */ - /* `callothersubr' as done in `t1decode.c', however, given */ - /* the fact that CFF fonts with `pop' are invalid, it is */ - /* questionable whether it is worth the time. */ - args++; - break; - - case cff_op_and: - { - FT_Fixed cond = ( args[0] && args[1] ); - - - FT_TRACE4(( " and\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_or: - { - FT_Fixed cond = ( args[0] || args[1] ); - - - FT_TRACE4(( " or\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_not: - { - FT_Fixed cond = !args[0]; - - - FT_TRACE4(( " not\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_eq: - { - FT_Fixed cond = ( args[0] == args[1] ); - - - FT_TRACE4(( " eq\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_ifelse: - { - FT_Fixed cond = ( args[2] <= args[3] ); - - - FT_TRACE4(( " ifelse\n" )); - - if ( !cond ) - args[0] = args[1]; - args++; - } - break; - - case cff_op_callsubr: - { - FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + - decoder->locals_bias ); - - - FT_TRACE4(( " callsubr (idx %d, entering level %d)\n", - idx, - zone - decoder->zones + 1 )); - - if ( idx >= decoder->num_locals ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invalid local subr index\n" )); - goto Syntax_Error; - } - - if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " too many nested subrs\n" )); - goto Syntax_Error; - } - - zone->cursor = ip; /* save current instruction pointer */ - - zone++; - zone->base = decoder->locals[idx]; - zone->limit = decoder->locals[idx + 1]; - zone->cursor = zone->base; - - if ( !zone->base || zone->limit == zone->base ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invoking empty subrs\n" )); - goto Syntax_Error; - } - - decoder->zone = zone; - ip = zone->base; - limit = zone->limit; - } - break; - - case cff_op_callgsubr: - { - FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + - decoder->globals_bias ); - - - FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n", - idx, - zone - decoder->zones + 1 )); - - if ( idx >= decoder->num_globals ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invalid global subr index\n" )); - goto Syntax_Error; - } - - if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " too many nested subrs\n" )); - goto Syntax_Error; - } - - zone->cursor = ip; /* save current instruction pointer */ - - zone++; - zone->base = decoder->globals[idx]; - zone->limit = decoder->globals[idx + 1]; - zone->cursor = zone->base; - - if ( !zone->base || zone->limit == zone->base ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invoking empty subrs\n" )); - goto Syntax_Error; - } - - decoder->zone = zone; - ip = zone->base; - limit = zone->limit; - } - break; - - case cff_op_return: - FT_TRACE4(( " return (leaving level %d)\n", - decoder->zone - decoder->zones )); - - if ( decoder->zone <= decoder->zones ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " unexpected return\n" )); - goto Syntax_Error; - } - - decoder->zone--; - zone = decoder->zone; - ip = zone->cursor; - limit = zone->limit; - break; - - default: - FT_ERROR(( "Unimplemented opcode: %d", ip[-1] )); - - if ( ip[-1] == 12 ) - FT_ERROR(( " %d", ip[0] )); - FT_ERROR(( "\n" )); - - return FT_THROW( Unimplemented_Feature ); - } - - decoder->top = args; - - if ( decoder->top - stack >= CFF_MAX_OPERANDS ) - goto Stack_Overflow; - - } /* general operator processing */ - - } /* while ip < limit */ - - FT_TRACE4(( "..end..\n\n" )); - - Fail: - return error; - - MM_Error: - FT_TRACE4(( "cff_decoder_parse_charstrings:" - " invalid opcode found in top DICT charstring\n")); - return FT_THROW( Invalid_File_Format ); - - Syntax_Error: - FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" )); - return FT_THROW( Invalid_File_Format ); - - Stack_Underflow: - FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" )); - return FT_THROW( Too_Few_Arguments ); - - Stack_Overflow: - FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" )); - return FT_THROW( Stack_Overflow ); - } - -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ - - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -2704,11 +142,14 @@ FT_Int glyph_index; CFF_Font cff = (CFF_Font)face->other; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; + *max_advance = 0; /* Initialize load decoder */ - cff_decoder_init( &decoder, face, 0, 0, 0, 0 ); + decoder_funcs->init( &decoder, face, 0, 0, 0, 0, 0, 0 ); decoder.builder.metrics_only = 1; decoder.builder.load_points = 0; @@ -2727,12 +168,12 @@ &charstring, &charstring_len ); if ( !error ) { - error = cff_decoder_prepare( &decoder, size, glyph_index ); + error = decoder_funcs->prepare( &decoder, size, glyph_index ); if ( !error ) - error = cff_decoder_parse_charstrings( &decoder, - charstring, - charstring_len, - 0 ); + error = decoder_funcs->parse_charstrings_old( &decoder, + charstring, + charstring_len, + 0 ); cff_free_glyph_data( face, &charstring, &charstring_len ); } @@ -2758,10 +199,14 @@ { FT_Error error; CFF_Decoder decoder; + PS_Decoder psdecoder; TT_Face face = (TT_Face)glyph->root.face; FT_Bool hinting, scaled, force_scaling; CFF_Font cff = (CFF_Font)face->extra.data; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; + FT_Matrix font_matrix; FT_Vector font_offset; @@ -2951,7 +396,7 @@ { #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); #endif @@ -2959,8 +404,10 @@ FT_ULong charstring_len; - cff_decoder_init( &decoder, face, size, glyph, hinting, - FT_LOAD_TARGET_MODE( load_flags ) ); + decoder_funcs->init( &decoder, face, size, glyph, hinting, + FT_LOAD_TARGET_MODE( load_flags ), + cff_get_glyph_data, + cff_free_glyph_data ); /* this is for pure CFFs */ if ( load_flags & FT_LOAD_ADVANCE_ONLY ) @@ -2975,23 +422,25 @@ if ( error ) goto Glyph_Build_Finished; - error = cff_decoder_prepare( &decoder, size, glyph_index ); + error = decoder_funcs->prepare( &decoder, size, glyph_index ); if ( error ) goto Glyph_Build_Finished; #ifdef CFF_CONFIG_OPTION_OLD_ENGINE /* choose which CFF renderer to use */ - if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) - error = cff_decoder_parse_charstrings( &decoder, - charstring, - charstring_len, - 0 ); + if ( driver->hinting_engine == FT_HINTING_FREETYPE ) + error = decoder_funcs->parse_charstrings_old( &decoder, + charstring, + charstring_len, + 0 ); else #endif { - error = cf2_decoder_parse_charstrings( &decoder, - charstring, - charstring_len ); + psaux->ps_decoder_init( &psdecoder, &decoder, FALSE ); + + error = decoder_funcs->parse_charstrings( &psdecoder, + charstring, + charstring_len ); /* Adobe's engine uses 16.16 numbers everywhere; */ /* as a consequence, glyphs larger than 2000ppem get rejected */ @@ -3004,9 +453,9 @@ force_scaling = TRUE; glyph->hint = hinting; - error = cf2_decoder_parse_charstrings( &decoder, - charstring, - charstring_len ); + error = decoder_funcs->parse_charstrings( &psdecoder, + charstring, + charstring_len ); } } @@ -3044,7 +493,7 @@ Glyph_Build_Finished: /* save new glyph tables, if no error */ if ( !error ) - cff_builder_done( &decoder.builder ); + decoder.builder.funcs.done( &decoder.builder ); /* XXX: anything to do for broken glyph entry? */ } diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffgload.h b/sdk/lib/3rdparty/freetype/src/cff/cffgload.h index 0fa93b43985..803f3974fc7 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffgload.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cffgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,119 +22,11 @@ #include #include FT_FREETYPE_H -#include "cffobjs.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER - -#define CFF_MAX_OPERANDS 48 -#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ - /* only 10 are allowed but there exist */ - /* fonts like `HiraKakuProN-W3.ttf' */ - /* (Hiragino Kaku Gothic ProN W3; */ - /* 8.2d6e1; 2014-12-19) that exceed */ - /* this limit */ -#define CFF_MAX_TRANS_ELEMENTS 32 - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Builder */ - /* */ - /* */ - /* A structure used during glyph loading to store its outline. */ - /* */ - /* */ - /* memory :: The current memory object. */ - /* */ - /* face :: The current face object. */ - /* */ - /* glyph :: The current glyph slot. */ - /* */ - /* loader :: The current glyph loader. */ - /* */ - /* base :: The base glyph outline. */ - /* */ - /* current :: The current glyph outline. */ - /* */ - /* pos_x :: The horizontal translation (if composite glyph). */ - /* */ - /* pos_y :: The vertical translation (if composite glyph). */ - /* */ - /* left_bearing :: The left side bearing point. */ - /* */ - /* advance :: The horizontal advance vector. */ - /* */ - /* bbox :: Unused. */ - /* */ - /* path_begun :: A flag which indicates that a new path has begun. */ - /* */ - /* load_points :: If this flag is not set, no points are loaded. */ - /* */ - /* no_recurse :: Set but not used. */ - /* */ - /* metrics_only :: A boolean indicating that we only want to compute */ - /* the metrics of a given glyph, not load all of its */ - /* points. */ - /* */ - /* hints_funcs :: Auxiliary pointer for hinting. */ - /* */ - /* hints_globals :: Auxiliary pointer for hinting. */ - /* */ - typedef struct CFF_Builder_ - { - FT_Memory memory; - TT_Face face; - CFF_GlyphSlot glyph; - FT_GlyphLoader loader; - FT_Outline* base; - FT_Outline* current; - - FT_Pos pos_x; - FT_Pos pos_y; - - FT_Vector left_bearing; - FT_Vector advance; - - FT_BBox bbox; /* bounding box */ - FT_Bool path_begun; - FT_Bool load_points; - FT_Bool no_recurse; - - FT_Bool metrics_only; - - void* hints_funcs; /* hinter-specific */ - void* hints_globals; /* hinter-specific */ - - } CFF_Builder; - - - FT_LOCAL( FT_Error ) - cff_check_points( CFF_Builder* builder, - FT_Int count ); - - FT_LOCAL( void ) - cff_builder_add_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y, - FT_Byte flag ); - FT_LOCAL( FT_Error ) - cff_builder_add_point1( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ); - FT_LOCAL( FT_Error ) - cff_builder_start_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ); - FT_LOCAL( void ) - cff_builder_close_contour( CFF_Builder* builder ); - - - FT_LOCAL( FT_Int ) - cff_lookup_glyph_by_stdcharcode( CFF_Font cff, - FT_Int charcode ); FT_LOCAL( FT_Error ) cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, @@ -146,74 +38,6 @@ FT_BEGIN_HEADER FT_ULong length ); - /* execution context charstring zone */ - - typedef struct CFF_Decoder_Zone_ - { - FT_Byte* base; - FT_Byte* limit; - FT_Byte* cursor; - - } CFF_Decoder_Zone; - - - typedef struct CFF_Decoder_ - { - CFF_Builder builder; - CFF_Font cff; - - FT_Fixed stack[CFF_MAX_OPERANDS + 1]; - FT_Fixed* top; - - CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1]; - CFF_Decoder_Zone* zone; - - FT_Int flex_state; - FT_Int num_flex_vectors; - FT_Vector flex_vectors[7]; - - FT_Pos glyph_width; - FT_Pos nominal_width; - - FT_Bool read_width; - FT_Bool width_only; - FT_Int num_hints; - FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; - - FT_UInt num_locals; - FT_UInt num_globals; - - FT_Int locals_bias; - FT_Int globals_bias; - - FT_Byte** locals; - FT_Byte** globals; - - FT_Byte** glyph_names; /* for pure CFF fonts only */ - FT_UInt num_glyphs; /* number of glyphs in font */ - - FT_Render_Mode hint_mode; - - FT_Bool seac; - - CFF_SubFont current_subfont; /* for current glyph_index */ - - } CFF_Decoder; - - - FT_LOCAL( void ) - cff_decoder_init( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode ); - - 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 */ /* Compute the maximum advance width of a font through quick parsing */ @@ -223,13 +47,6 @@ FT_BEGIN_HEADER #endif /* 0 */ -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - FT_LOCAL( FT_Error ) - cff_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len, - FT_Bool in_dict ); -#endif FT_LOCAL( FT_Error ) cff_slot_load( CFF_GlyphSlot glyph, diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffload.c b/sdk/lib/3rdparty/freetype/src/cff/cffload.c index 12420384af2..ba49793dc8a 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffload.c +++ b/sdk/lib/3rdparty/freetype/src/cff/cffload.c @@ -4,7 +4,7 @@ /* */ /* OpenType and CFF data/program tables loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 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_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_TYPE1_TABLES_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_MULTIPLE_MASTERS_H @@ -1297,7 +1298,9 @@ if ( numOperands > count ) { - FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d args\n", count )); + FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d argument%s\n", + count, + count == 1 ? "" : "s" )); error = FT_THROW( Stack_Underflow ); goto Exit; @@ -1345,19 +1348,14 @@ for ( i = 0; i < numBlends; i++ ) { const FT_Int32* weight = &blend->BV[1]; - FT_Int32 sum; + FT_UInt32 sum; /* convert inputs to 16.16 fixed point */ - sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536; + sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000; for ( j = 1; j < blend->lenBV; j++ ) - sum = ADD_INT32( - sum, - FT_MulFix( - *weight++, - cff_parse_num( parser, - &parser->stack[delta++] ) * 65536 ) ); + sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++; /* point parser stack to new value on blend_stack */ parser->stack[i + base] = subFont->blend_top; @@ -1367,10 +1365,10 @@ /* opcode in both CFF and CFF2 DICTs. See `cff_parse_num' for */ /* decode of this, which rounds to an integer. */ *subFont->blend_top++ = 255; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0xFF000000U ) >> 24; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0x00FF0000U ) >> 16; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0x0000FF00U ) >> 8; - *subFont->blend_top++ = (FT_UInt32)sum & 0x000000FFU; + *subFont->blend_top++ = (FT_Byte)( sum >> 24 ); + *subFont->blend_top++ = (FT_Byte)( sum >> 16 ); + *subFont->blend_top++ = (FT_Byte)( sum >> 8 ); + *subFont->blend_top++ = (FT_Byte)sum; } /* leave only numBlends results on parser stack */ @@ -1558,13 +1556,13 @@ FT_UInt lenNDV, FT_Fixed* NDV ) { - if ( !blend->builtBV || - blend->lastVsindex != vsindex || - blend->lenNDV != lenNDV || - ( lenNDV && - memcmp( NDV, - blend->lastNDV, - lenNDV * sizeof ( *NDV ) ) != 0 ) ) + if ( !blend->builtBV || + blend->lastVsindex != vsindex || + blend->lenNDV != lenNDV || + ( lenNDV && + ft_memcmp( NDV, + blend->lastNDV, + lenNDV * sizeof ( *NDV ) ) != 0 ) ) { /* need to build blend vector */ return TRUE; @@ -1600,7 +1598,8 @@ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - mm->done_blend( FT_FACE( face ) ); + if (mm) + mm->done_blend( FT_FACE( face ) ); } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ @@ -1945,18 +1944,6 @@ } - FT_LOCAL_DEF( FT_UInt32 ) - cff_random( FT_UInt32 r ) - { - /* a 32bit version of the `xorshift' algorithm */ - r ^= r << 13; - r ^= r >> 17; - r ^= r << 5; - - return r; - } - - /* There are 3 ways to call this function, distinguished by code. */ /* */ /* . CFF_CODE_TOPDICT for either a CFF Top DICT or a CFF Font DICT */ @@ -1980,6 +1967,8 @@ CFF_FontRecDict top = &subfont->font_dict; CFF_Private priv = &subfont->private_dict; + PSAux_Service psaux = (PSAux_Service)face->psaux; + FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT || code == CFF2_CODE_FONTDICT ); FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK @@ -2085,7 +2074,7 @@ */ if ( face->root.internal->random_seed == -1 ) { - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); subfont->random = (FT_UInt32)driver->random_seed; @@ -2094,7 +2083,7 @@ do { driver->random_seed = - (FT_Int32)cff_random( (FT_UInt32)driver->random_seed ); + (FT_Int32)psaux->cff_random( (FT_UInt32)driver->random_seed ); } while ( driver->random_seed < 0 ); } @@ -2107,7 +2096,8 @@ do { face->root.internal->random_seed = - (FT_Int32)cff_random( (FT_UInt32)face->root.internal->random_seed ); + (FT_Int32)psaux->cff_random( + (FT_UInt32)face->root.internal->random_seed ); } while ( face->root.internal->random_seed < 0 ); } @@ -2548,6 +2538,8 @@ font->cf2_instance.finalizer( font->cf2_instance.data ); FT_FREE( font->cf2_instance.data ); } + + FT_FREE( font->font_extra ); } diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffload.h b/sdk/lib/3rdparty/freetype/src/cff/cffload.h index c745e8127b3..14d14e21122 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffload.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cffload.h @@ -4,7 +4,7 @@ /* */ /* OpenType & CFF data/program tables loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,9 +21,9 @@ #include -#include "cfftypes.h" +#include FT_INTERNAL_CFF_TYPES_H #include "cffparse.h" -#include "cffobjs.h" /* for CFF_Face */ +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */ FT_BEGIN_HEADER @@ -61,9 +61,6 @@ FT_BEGIN_HEADER FT_UInt cid ); - FT_LOCAL( FT_UInt32 ) - cff_random( FT_UInt32 r ); - FT_LOCAL( FT_Error ) cff_font_load( FT_Library library, FT_Stream stream, diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffobjs.c b/sdk/lib/3rdparty/freetype/src/cff/cffobjs.c index 61613933ff7..a2d7aec65ef 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffobjs.c +++ b/sdk/lib/3rdparty/freetype/src/cff/cffobjs.c @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,13 +25,15 @@ #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_MULTIPLE_MASTERS_H #include FT_SERVICE_MULTIPLE_MASTERS_H +#include FT_SERVICE_METRICS_VARIATIONS_H #endif +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H #include "cffobjs.h" #include "cffload.h" #include "cffcmap.h" @@ -39,6 +41,9 @@ #include "cfferrs.h" +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_SERVICE_CFF_TABLE_LOAD_H + /*************************************************************************/ /* */ @@ -408,7 +413,7 @@ remove_subset_prefix( FT_String* name ) { FT_Int32 idx = 0; - FT_Int32 length = (FT_Int32)strlen( name ) + 1; + FT_Int32 length = (FT_Int32)ft_strlen( name ) + 1; FT_Bool continue_search = 1; @@ -445,8 +450,8 @@ FT_Int32 family_name_length, style_name_length; - family_name_length = (FT_Int32)strlen( family_name ); - style_name_length = (FT_Int32)strlen( style_name ); + family_name_length = (FT_Int32)ft_strlen( family_name ); + style_name_length = (FT_Int32)ft_strlen( style_name ); if ( family_name_length > style_name_length ) { @@ -493,14 +498,16 @@ SFNT_Service sfnt; FT_Service_PsCMaps psnames; PSHinter_Service pshinter; + PSAux_Service psaux; + FT_Service_CFFLoad cffload; FT_Bool pure_cff = 1; FT_Bool cff2 = 0; FT_Bool sfnt_format = 0; FT_Library library = cffface->driver->root.library; - sfnt = (SFNT_Service)FT_Get_Module_Interface( - library, "sfnt" ); + sfnt = (SFNT_Service)FT_Get_Module_Interface( library, + "sfnt" ); if ( !sfnt ) { FT_ERROR(( "cff_face_init: cannot access `sfnt' module\n" )); @@ -510,8 +517,20 @@ FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); - pshinter = (PSHinter_Service)FT_Get_Module_Interface( - library, "pshinter" ); + pshinter = (PSHinter_Service)FT_Get_Module_Interface( library, + "pshinter" ); + + psaux = (PSAux_Service)FT_Get_Module_Interface( library, + "psaux" ); + if ( !psaux ) + { + FT_ERROR(( "cff_face_init: cannot access `psaux' module\n" )); + error = FT_THROW( Missing_Module ); + goto Exit; + } + face->psaux = psaux; + + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); FT_TRACE2(( "CFF driver\n" )); @@ -614,6 +633,7 @@ cff->pshinter = pshinter; cff->psnames = psnames; + cff->cffload = cffload; cffface->face_index = face_index & 0xFFFF; @@ -690,50 +710,22 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var; - FT_Int instance_index = face_index >> 16; + FT_UInt instance_index = (FT_UInt)face_index >> 16; if ( FT_HAS_MULTIPLE_MASTERS( cffface ) && mm && instance_index > 0 ) { - FT_MM_Var* mm_var; - - - error = mm->get_mm_var( cffface, NULL ); + error = mm->set_instance( cffface, instance_index ); if ( error ) goto Exit; - mm->get_var_blend( cffface, NULL, NULL, NULL, &mm_var ); - - if ( mm_var->namedstyle ) - { - FT_Var_Named_Style* named_style; - FT_String* style_name; - - - /* in `face_index', the instance index starts with value 1 */ - named_style = mm_var->namedstyle + instance_index - 1; - error = sfnt->get_name( face, - (FT_UShort)named_style->strid, - &style_name ); - if ( error ) - goto Exit; - - /* set style name; if already set, replace it */ - if ( face->root.style_name ) - FT_FREE( face->root.style_name ); - face->root.style_name = style_name; - - /* finally, select the named instance */ - error = mm->set_var_design( cffface, - mm_var->num_axis, - named_style->coords ); - if ( error ) - goto Exit; - } + if ( var ) + var->metrics_adjust( cffface ); } } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ @@ -876,7 +868,8 @@ cffface->height = (FT_Short)( ( cffface->units_per_EM * 12 ) / 10 ); if ( cffface->height < cffface->ascender - cffface->descender ) - cffface->height = (FT_Short)( cffface->ascender - cffface->descender ); + cffface->height = (FT_Short)( cffface->ascender - + cffface->descender ); cffface->underline_position = (FT_Short)( dict->underline_position >> 16 ); @@ -884,28 +877,33 @@ (FT_Short)( dict->underline_thickness >> 16 ); /* retrieve font family & style name */ - cffface->family_name = cff_index_get_name( - cff, - (FT_UInt)( face_index & 0xFFFF ) ); + if ( dict->family_name ) + { + char* family_name; + + + family_name = cff_index_get_sid_string( cff, dict->family_name ); + if ( family_name ) + cffface->family_name = cff_strcpy( memory, family_name ); + } + + if ( !cffface->family_name ) + { + cffface->family_name = cff_index_get_name( + cff, + (FT_UInt)( face_index & 0xFFFF ) ); + if ( cffface->family_name ) + remove_subset_prefix( cffface->family_name ); + } + if ( cffface->family_name ) { char* full = cff_index_get_sid_string( cff, dict->full_name ); char* fullp = full; char* family = cffface->family_name; - char* family_name = NULL; - remove_subset_prefix( cffface->family_name ); - - if ( dict->family_name ) - { - family_name = cff_index_get_sid_string( cff, - dict->family_name ); - if ( family_name ) - family = family_name; - } - /* We try to extract the style name from the full name. */ /* We need to ignore spaces and dashes during the search. */ if ( full && family ) @@ -1159,16 +1157,16 @@ FT_LOCAL_DEF( FT_Error ) cff_driver_init( FT_Module module ) /* CFF_Driver */ { - CFF_Driver driver = (CFF_Driver)module; + PS_Driver driver = (PS_Driver)module; FT_UInt32 seed; /* set default property values, cf. `ftcffdrv.h' */ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - driver->hinting_engine = FT_CFF_HINTING_FREETYPE; + driver->hinting_engine = FT_HINTING_FREETYPE; #else - driver->hinting_engine = FT_CFF_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; #endif driver->no_stem_darkening = TRUE; diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffobjs.h b/sdk/lib/3rdparty/freetype/src/cff/cffobjs.h index 1dba694c532..616a25b3b59 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffobjs.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cffobjs.h @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,111 +21,11 @@ #include -#include FT_INTERNAL_OBJECTS_H -#include "cfftypes.h" -#include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* */ - /* CFF_Driver */ - /* */ - /* */ - /* A handle to an OpenType driver object. */ - /* */ - typedef struct CFF_DriverRec_* CFF_Driver; - - typedef TT_Face CFF_Face; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Size */ - /* */ - /* */ - /* A handle to an OpenType size object. */ - /* */ - typedef struct CFF_SizeRec_ - { - FT_SizeRec root; - FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */ - - } CFF_SizeRec, *CFF_Size; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_GlyphSlot */ - /* */ - /* */ - /* A handle to an OpenType glyph slot object. */ - /* */ - typedef struct CFF_GlyphSlotRec_ - { - FT_GlyphSlotRec root; - - FT_Bool hint; - FT_Bool scaled; - - FT_Fixed x_scale; - FT_Fixed y_scale; - - } CFF_GlyphSlotRec, *CFF_GlyphSlot; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Internal */ - /* */ - /* */ - /* 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; - - - /*************************************************************************/ - /* */ - /* Subglyph transformation record. */ - /* */ - typedef struct CFF_Transform_ - { - FT_Fixed xx, xy; /* transformation matrix coefficients */ - FT_Fixed yx, yy; - FT_F26Dot6 ox, oy; /* offsets */ - - } CFF_Transform; - - - /***********************************************************************/ - /* */ - /* CFF driver class. */ - /* */ - typedef struct CFF_DriverRec_ - { - FT_DriverRec root; - - FT_UInt hinting_engine; - FT_Bool no_stem_darkening; - FT_Int darken_params[8]; - FT_Int32 random_seed; - - } CFF_DriverRec; - - FT_LOCAL( FT_Error ) cff_size_init( FT_Size size ); /* CFF_Size */ @@ -171,10 +71,10 @@ FT_BEGIN_HEADER /* Driver functions */ /* */ FT_LOCAL( FT_Error ) - cff_driver_init( FT_Module module ); /* CFF_Driver */ + cff_driver_init( FT_Module module ); /* PS_Driver */ FT_LOCAL( void ) - cff_driver_done( FT_Module module ); /* CFF_Driver */ + cff_driver_done( FT_Module module ); /* PS_Driver */ FT_END_HEADER diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffparse.c b/sdk/lib/3rdparty/freetype/src/cff/cffparse.c index 9d7bf6d22c8..b9611cf548a 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffparse.c +++ b/sdk/lib/3rdparty/freetype/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,10 +21,10 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #include "cfferrs.h" #include "cffpic.h" -#include "cffgload.h" #include "cffload.h" @@ -949,7 +949,9 @@ goto Exit; } - FT_TRACE4(( " %d values blended\n", numBlends )); + FT_TRACE4(( " %d value%s blended\n", + numBlends, + numBlends == 1 ? "" : "s" )); error = cff_blend_doBlend( subFont, parser, numBlends ); @@ -1299,9 +1301,14 @@ FT_Byte* start, FT_Byte* limit ) { +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + PSAux_Service psaux; +#endif + FT_Byte* p = start; FT_Error error = FT_Err_Ok; FT_Library library = parser->library; + FT_UNUSED( library ); @@ -1388,10 +1395,16 @@ cff_rec.top_font.font_dict.num_axes = parser->num_axes; decoder.cff = &cff_rec; - error = cff_decoder_parse_charstrings( &decoder, - charstring_base, - charstring_len, - 1 ); + psaux = (PSAux_Service)FT_Get_Module_Interface( library, "psaux" ); + if ( !psaux ) + { + FT_ERROR(( "cff_parser_run: cannot access `psaux' module\n" )); + error = FT_THROW( Missing_Module ); + goto Exit; + } + + error = psaux->cff_decoder_funcs->parse_charstrings_old( + &decoder, charstring_base, charstring_len, 1 ); /* Now copy the stack data in the temporary decoder object, */ /* converting it back to charstring number representations */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffparse.h b/sdk/lib/3rdparty/freetype/src/cff/cffparse.h index 83d1bba45f2..8a8caeca446 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffparse.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cffparse.h @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (specification) */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,7 +21,7 @@ #include -#include "cfftypes.h" +#include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_OBJECTS_H diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffpic.c b/sdk/lib/3rdparty/freetype/src/cff/cffpic.c index 4e9ba12b3fe..08b74c7cf20 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffpic.c +++ b/sdk/lib/3rdparty/freetype/src/cff/cffpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cffpic.h b/sdk/lib/3rdparty/freetype/src/cff/cffpic.h index 5db39cd6272..8ba4203a8de 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cffpic.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cffpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,7 +22,6 @@ #include FT_INTERNAL_PIC_H - #ifndef FT_CONFIG_OPTION_PIC #define CFF_SERVICE_PS_INFO_GET cff_service_ps_info @@ -34,6 +33,7 @@ #define CFF_SERVICES_GET cff_services #define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters #define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations +#define CFF_SERVICE_CFF_LOAD_GET cff_service_cff_load #define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec #define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec #define CFF_FIELD_HANDLERS_GET cff_field_handlers @@ -65,6 +65,7 @@ FT_BEGIN_HEADER FT_Service_PropertiesRec cff_service_properties; FT_Service_MultiMastersRec cff_service_multi_masters; FT_Service_MetricsVariationsRec cff_service_metrics_variations; + FT_Service_CFFLoadRec cff_service_cff_load; FT_CMap_ClassRec cff_cmap_encoding_class_rec; FT_CMap_ClassRec cff_cmap_unicode_class_rec; @@ -92,6 +93,8 @@ FT_BEGIN_HEADER ( GET_PIC( library )->cff_service_multi_masters ) #define CFF_SERVICE_METRICS_VAR_GET \ ( GET_PIC( library )->cff_service_metrics_variations ) +#define CFF_SERVICE_CFF_LOAD_GET \ + ( GET_PIC( library )->cff_service_cff_load ) #define CFF_CMAP_ENCODING_CLASS_REC_GET \ ( GET_PIC( library )->cff_cmap_encoding_class_rec ) #define CFF_CMAP_UNICODE_CLASS_REC_GET \ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cfftoken.h b/sdk/lib/3rdparty/freetype/src/cff/cfftoken.h index 3222e933f1d..fec1ca20bde 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cfftoken.h +++ b/sdk/lib/3rdparty/freetype/src/cff/cfftoken.h @@ -4,7 +4,7 @@ /* */ /* CFF token definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/ciderrs.h b/sdk/lib/3rdparty/freetype/src/cid/ciderrs.h index 709dc8cd1e4..a5a86e3fc68 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/ciderrs.h +++ b/sdk/lib/3rdparty/freetype/src/cid/ciderrs.h @@ -4,7 +4,7 @@ /* */ /* CID error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidgload.c b/sdk/lib/3rdparty/freetype/src/cid/cidgload.c index 7d6a96b5886..dbc116c585e 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidgload.c +++ b/sdk/lib/3rdparty/freetype/src/cid/cidgload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,6 +24,10 @@ #include FT_OUTLINE_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_DRIVER_H + #include "ciderrs.h" @@ -52,9 +56,11 @@ FT_ULong glyph_length = 0; PSAux_Service psaux = (PSAux_Service)face->psaux; + FT_Bool force_scaling = FALSE; + #ifdef FT_CONFIG_OPTION_INCREMENTAL - FT_Incremental_InterfaceRec *inc = - face->root.internal->incremental_interface; + FT_Incremental_InterfaceRec *inc = + face->root.internal->incremental_interface; #endif @@ -169,9 +175,57 @@ if ( decoder->lenIV >= 0 ) psaux->t1_decrypt( charstring, glyph_length, 4330 ); - error = decoder->funcs.parse_charstrings( - decoder, charstring + cs_offset, - glyph_length - cs_offset ); + /* choose which renderer to use */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + if ( ( (PS_Driver)FT_FACE_DRIVER( face ) )->hinting_engine == + FT_HINTING_FREETYPE || + decoder->builder.metrics_only ) + error = psaux->t1_decoder_funcs->parse_charstrings_old( + decoder, + charstring + cs_offset, + glyph_length - cs_offset ); +#else + if ( decoder->builder.metrics_only ) + error = psaux->t1_decoder_funcs->parse_metrics( + decoder, + charstring + cs_offset, + glyph_length - cs_offset ); +#endif + else + { + PS_Decoder psdecoder; + CFF_SubFontRec subfont; + + + psaux->ps_decoder_init( &psdecoder, decoder, TRUE ); + + psaux->t1_make_subfont( FT_FACE( face ), + &dict->private_dict, + &subfont ); + psdecoder.current_subfont = &subfont; + + error = psaux->t1_decoder_funcs->parse_charstrings( + &psdecoder, + charstring + cs_offset, + glyph_length - cs_offset ); + + /* Adobe's engine uses 16.16 numbers everywhere; */ + /* as a consequence, glyphs larger than 2000ppem get rejected */ + if ( FT_ERR_EQ( error, Glyph_Too_Big ) ) + { + /* this time, we retry unhinted and scale up the glyph later on */ + /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */ + /* 0x400 for both `x_scale' and `y_scale' in this case) */ + ((CID_GlyphSlot)decoder->builder.glyph)->hint = FALSE; + + force_scaling = TRUE; + + error = psaux->t1_decoder_funcs->parse_charstrings( + &psdecoder, + charstring + cs_offset, + glyph_length - cs_offset ); + } + } } #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -200,6 +254,8 @@ Exit: FT_FREE( charstring ); + ((CID_GlyphSlot)decoder->builder.glyph)->scaled = force_scaling; + return error; } @@ -294,10 +350,12 @@ #endif CID_Face face = (CID_Face)cidglyph->face; FT_Bool hinting; + FT_Bool scaled; PSAux_Service psaux = (PSAux_Service)face->psaux; FT_Matrix font_matrix; FT_Vector font_offset; + FT_Bool must_finish_decoder = FALSE; if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) @@ -317,7 +375,10 @@ hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); + scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); + glyph->hint = hinting; + glyph->scaled = scaled; cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; error = psaux->t1_decoder_funcs->init( &decoder, @@ -335,6 +396,8 @@ /* TODO: initialize decoder.len_buildchar and decoder.buildchar */ /* if we ever support CID-keyed multiple master fonts */ + must_finish_decoder = TRUE; + /* set up the decoder */ decoder.builder.no_recurse = FT_BOOL( ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) ); @@ -343,12 +406,18 @@ if ( error ) goto Exit; + /* copy flags back for forced scaling */ + hinting = glyph->hint; + scaled = glyph->scaled; + font_matrix = decoder.font_matrix; font_offset = decoder.font_offset; /* save new glyph tables */ psaux->t1_decoder_funcs->done( &decoder ); + must_finish_decoder = FALSE; + /* now set the metrics -- this is rather simple, as */ /* the left side bearing is the xMin, and the top side */ /* bearing the yMax */ @@ -416,7 +485,7 @@ metrics->vertAdvance += font_offset.y; } - if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) + if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || scaled ) { /* scale the outline and the metrics */ FT_Int n; @@ -457,6 +526,10 @@ } Exit: + + if ( must_finish_decoder ) + psaux->t1_decoder_funcs->done( &decoder ); + #ifdef __REACTOS__ free(&decoder); #undef decoder diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidgload.h b/sdk/lib/3rdparty/freetype/src/cid/cidgload.h index 7f816b5bc7b..4811852ae43 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidgload.h +++ b/sdk/lib/3rdparty/freetype/src/cid/cidgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidload.c b/sdk/lib/3rdparty/freetype/src/cid/cidload.c index ff0722110db..27cd09b3c35 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidload.c +++ b/sdk/lib/3rdparty/freetype/src/cid/cidload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidload.h b/sdk/lib/3rdparty/freetype/src/cid/cidload.h index 45a0e6df25b..3f8bd08620a 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidload.h +++ b/sdk/lib/3rdparty/freetype/src/cid/cidload.h @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidobjs.c b/sdk/lib/3rdparty/freetype/src/cid/cidobjs.c index ceda8ff97f0..77afe1c8751 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidobjs.c +++ b/sdk/lib/3rdparty/freetype/src/cid/cidobjs.c @@ -4,7 +4,7 @@ /* */ /* CID objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 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_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_DRIVER_H #include "ciderrs.h" @@ -463,9 +464,42 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - cid_driver_init( FT_Module driver ) + cid_driver_init( FT_Module module ) { - FT_UNUSED( driver ); + PS_Driver driver = (PS_Driver)module; + + FT_UInt32 seed; + + + /* set default property values, cf. `ftt1drv.h' */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + driver->hinting_engine = FT_HINTING_FREETYPE; +#else + driver->hinting_engine = FT_HINTING_ADOBE; +#endif + + driver->no_stem_darkening = TRUE; + + driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; + driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; + driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2; + driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2; + driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3; + driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3; + driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4; + driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4; + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&module ^ + (FT_Offset)(char*)module->memory ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + + driver->random_seed = (FT_Int32)seed; + if ( driver->random_seed < 0 ) + driver->random_seed = -driver->random_seed; + else if ( driver->random_seed == 0 ) + driver->random_seed = 123456789; return FT_Err_Ok; } diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidobjs.h b/sdk/lib/3rdparty/freetype/src/cid/cidobjs.h index 8bcf886e10d..0221f017dd2 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidobjs.h +++ b/sdk/lib/3rdparty/freetype/src/cid/cidobjs.h @@ -4,7 +4,7 @@ /* */ /* CID objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidparse.c b/sdk/lib/3rdparty/freetype/src/cid/cidparse.c index 007609bbdfb..b1c7f3cb2c9 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidparse.c +++ b/sdk/lib/3rdparty/freetype/src/cid/cidparse.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 parser (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidparse.h b/sdk/lib/3rdparty/freetype/src/cid/cidparse.h index 20bebb942ba..61602f76741 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidparse.h +++ b/sdk/lib/3rdparty/freetype/src/cid/cidparse.h @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 parser (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidriver.c b/sdk/lib/3rdparty/freetype/src/cid/cidriver.c index bb611a961ee..d9faf353ea4 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidriver.c +++ b/sdk/lib/3rdparty/freetype/src/cid/cidriver.c @@ -4,7 +4,7 @@ /* */ /* CID driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,6 +20,7 @@ #include "cidriver.h" #include "cidgload.h" #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H #include "ciderrs.h" @@ -27,6 +28,10 @@ #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_CID_H +#include FT_SERVICE_PROPERTIES_H +#include FT_DRIVER_H + +#include FT_INTERNAL_POSTSCRIPT_AUX_H /*************************************************************************/ @@ -167,6 +172,18 @@ }; + /* + * PROPERTY SERVICE + * + */ + + FT_DEFINE_SERVICE_PROPERTIESREC( + cid_service_properties, + + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ + + /* * SERVICE LIST * @@ -178,6 +195,7 @@ { 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 }, + { FT_SERVICE_ID_PROPERTIES, &cid_service_properties }, { NULL, NULL } }; @@ -200,7 +218,7 @@ FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof ( FT_DriverRec ), + sizeof ( PS_DriverRec ), "t1cid", /* module name */ 0x10000L, /* version 1.0 of driver */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidriver.h b/sdk/lib/3rdparty/freetype/src/cid/cidriver.h index 76640c57ba5..59d9ded9015 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidriver.h +++ b/sdk/lib/3rdparty/freetype/src/cid/cidriver.h @@ -4,7 +4,7 @@ /* */ /* High-level CID driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/cidtoken.h b/sdk/lib/3rdparty/freetype/src/cid/cidtoken.h index 653cc5586ef..b0e2dac6aaf 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/cidtoken.h +++ b/sdk/lib/3rdparty/freetype/src/cid/cidtoken.h @@ -4,7 +4,7 @@ /* */ /* CID token definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cid/type1cid.c b/sdk/lib/3rdparty/freetype/src/cid/type1cid.c index 93e6f810dba..61770e3f1e2 100644 --- a/sdk/lib/3rdparty/freetype/src/cid/type1cid.c +++ b/sdk/lib/3rdparty/freetype/src/cid/type1cid.c @@ -4,7 +4,7 @@ /* */ /* FreeType OpenType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/README b/sdk/lib/3rdparty/freetype/src/gxvalid/README index 200f66cb129..af8128e0e79 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/README +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/README @@ -287,11 +287,11 @@ gxvalid: TrueType GX validator 4-5. invalid feature number (117/183) ------------------------------------- - The GX/AAT extension can include 255 different layout features, but - popular layout features are predefined (see - http://developer.apple.com/fonts/Registry/index.html). Some fonts - include feature numbers which are incompatible with the predefined - feature registry. + The GX/AAT extension can include 255 different layout features, + but popular layout features are predefined (see + https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html). + Some fonts include feature numbers which are incompatible with the + predefined feature registry. In our survey, there are 140 fonts including `feat' table. @@ -518,7 +518,7 @@ gxvalid: TrueType GX validator ------------------------------------------------------------------------ -Copyright 2004-2017 by +Copyright 2004-2018 by suzuki toshiya, Masatake YAMATO, Red hat K.K., David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvalid.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvalid.c index da485141d37..d0577a247eb 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvalid.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvalid.c @@ -4,7 +4,7 @@ /* */ /* FreeType validator for TrueTypeGX/AAT tables (body only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvalid.h b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvalid.h index 78116ef85a9..19f03799822 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvalid.h +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvalid.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT table validation (specification only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c index 81dff7304dc..c367d384834 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvbsln.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT bsln table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c index db0a91ea742..b96601108b6 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common tables validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h index 10b1c800f02..8e4ff9cafc0 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common tables validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxverror.h b/sdk/lib/3rdparty/freetype/src/gxvalid/gxverror.h index 80a2b8a2625..d1151258a97 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxverror.h +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxverror.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT validation module error codes (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c index 2e3ec6f9bec..2c805d1d119 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfeat.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT feat table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfeat.h b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfeat.h index 8c0e847eb7a..2d943806c11 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfeat.h +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfeat.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT feat table validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfgen.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfgen.c index 8cc08cd9c3e..840c0f3524a 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfgen.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvfgen.c @@ -5,7 +5,7 @@ /* Generate feature registry data for gxv `feat' validator. */ /* This program is derived from gxfeatreg.c in gxlayout. */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file may only be used, */ @@ -21,7 +21,7 @@ /* gxfeatreg.c */ /* */ /* Database of font features pre-defined by Apple Computer, Inc. */ -/* http://developer.apple.com/fonts/Registry/ */ +/* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html */ /* (body). */ /* */ /* Copyright 2003 by */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvjust.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvjust.c index c8cfd83eacd..00c4293195b 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvjust.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvjust.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT just table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvkern.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvkern.c index 9f9037387d2..9c0efd7a4f6 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvkern.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvkern.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT kern table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c index 775d5229f2f..0f261a9ace3 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvlcar.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT lcar table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmod.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmod.c index 84e9275baf2..1a3c862927d 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmod.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's TrueTypeGX/AAT validation module implementation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmod.h b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmod.h index df25e60cb28..745c62e1054 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmod.h +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmod.h @@ -5,7 +5,7 @@ /* FreeType's TrueTypeGX/AAT validation module implementation */ /* (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort.c index 184a6317c0d..b361cb2b9d7 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT mort table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort.h b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort.h index d0543adcc5f..d8030645e99 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort.h +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common definition for mort table (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c index a75fad7768c..95cf53d5ebf 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort0.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type0 (Indic Script Rearrangement) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c index 361ef2262d0..a7683a17b0b 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort1.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type1 (Contextual Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c index c17e51e3236..c23c2775a15 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort2.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type2 (Ligature Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c index 041bab369f7..9d21a5fc29d 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort4.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type4 (Non-Contextual Glyph Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c index 4751eceaa07..42cb428aa88 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmort5.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type5 (Contextual Glyph Insertion) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c index 2bb4f3b8b1a..9fd6e6b971e 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT morx table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx.h b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx.h index 20cec586724..6d9925e92b2 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx.h +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common definition for morx table (specification). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c index e0a0a92438e..302261b7fa2 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx0.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type0 (Indic Script Rearrangement) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c index 9afebdbfa85..890ca74b1d1 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx1.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type1 (Contextual Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c index 3a60cf68a41..3135031d457 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type2 (Ligature Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx4.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx4.c index 29555685af6..1e2397b0c57 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx4.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx4.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c index 05c11417ef3..db4f9290c8e 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvmorx5.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type5 (Contextual Glyph Insertion) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c index 11580d8b2a8..e2c167ea599 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvopbd.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT opbd table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvprop.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvprop.c index 7d398b7e665..a67b6bdd009 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvprop.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvprop.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT prop table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c index dd498255654..d501b5014b5 100644 --- a/sdk/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c +++ b/sdk/lib/3rdparty/freetype/src/gxvalid/gxvtrak.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT trak table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/gzip/ftgzip.c b/sdk/lib/3rdparty/freetype/src/gzip/ftgzip.c index c487786d993..f8011c2dd82 100644 --- a/sdk/lib/3rdparty/freetype/src/gzip/ftgzip.c +++ b/sdk/lib/3rdparty/freetype/src/gzip/ftgzip.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/gzip/zconf.h b/sdk/lib/3rdparty/freetype/src/gzip/zconf.h deleted file mode 100644 index 3abf0ba03b0..00000000000 --- a/sdk/lib/3rdparty/freetype/src/gzip/zconf.h +++ /dev/null @@ -1,284 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef _ZCONF_H -#define _ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table - -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 -#endif -#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) -# ifndef __32BIT__ -# define __32BIT__ -# endif -#endif -#if defined(__MSDOS__) && !defined(MSDOS) -# 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). - */ -#if defined(MSDOS) && !defined(__32BIT__) -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) -# define STDC -#endif -#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) -# ifndef STDC -# define STDC -# endif -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Old Borland C and LCC incorrectly complains about missing returns: */ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) -# define NEED_DUMMY_RETURN -#endif - -#if defined(__LCC__) -# define NEED_DUMMY_RETURN -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -#endif -#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) -# ifndef __32BIT__ -# define SMALL_MEDIUM -# define FAR _far -# endif -#endif - -/* Compile with -DZLIB_DLL for Windows DLL support */ -#if defined(ZLIB_DLL) -# if defined(_WINDOWS) || defined(WINDOWS) -# ifdef FAR -# undef FAR -# endif -# include -# define ZEXPORT(x) x WINAPI -# ifdef WIN32 -# define ZEXPORTVA(x) x WINAPIV -# else -# define ZEXPORTVA(x) x FAR _cdecl _export -# endif -# endif -# if defined (__BORLANDC__) -# if (__BORLANDC__ >= 0x0500) && defined (WIN32) -# include -# define ZEXPORT(x) x __declspec(dllexport) WINAPI -# define ZEXPORTRVA(x) x __declspec(dllexport) WINAPIV -# else -# if defined (_Windows) && defined (__DLL__) -# define ZEXPORT(x) x _export -# define ZEXPORTVA(x) x _export -# endif -# endif -# endif -#endif - - -#ifndef ZEXPORT -# define ZEXPORT(x) static x -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA(x) static x -#endif -#ifndef ZEXTERN -# define ZEXTERN(x) static x -#endif -#ifndef ZEXTERNDEF -# define ZEXTERNDEF(x) static x -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(MACOS) && !defined(TARGET_OS_MAC) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#ifdef HAVE_UNISTD_H -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(inflate_blocks,"INBL") -# pragma map(inflate_blocks_new,"INBLNE") -# pragma map(inflate_blocks_free,"INBLFR") -# pragma map(inflate_blocks_reset,"INBLRE") -# pragma map(inflate_codes_free,"INCOFR") -# pragma map(inflate_codes,"INCO") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_flush,"INFLU") -# pragma map(inflate_mask,"INMA") -# pragma map(inflate_set_dictionary,"INSEDI2") -# pragma map(inflate_copyright,"INCOPY") -# pragma map(inflate_trees_bits,"INTRBI") -# pragma map(inflate_trees_dynamic,"INTRDY") -# pragma map(inflate_trees_fixed,"INTRFI") -# pragma map(inflate_trees_free,"INTRFR") -#endif - -#endif /* _ZCONF_H */ diff --git a/sdk/lib/3rdparty/freetype/src/lzw/ftlzw.c b/sdk/lib/3rdparty/freetype/src/lzw/ftlzw.c index 941f6cef4c9..cb46f93c68e 100644 --- a/sdk/lib/3rdparty/freetype/src/lzw/ftlzw.c +++ b/sdk/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-2017 by */ +/* Copyright 2004-2018 by */ /* Albert Chin-A-Young. */ /* */ /* based on code in `src/gzip/ftgzip.c' */ diff --git a/sdk/lib/3rdparty/freetype/src/lzw/ftzopen.c b/sdk/lib/3rdparty/freetype/src/lzw/ftzopen.c index 486c546c146..2b868ba9f2d 100644 --- a/sdk/lib/3rdparty/freetype/src/lzw/ftzopen.c +++ b/sdk/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-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/lzw/ftzopen.h b/sdk/lib/3rdparty/freetype/src/lzw/ftzopen.h index a108862c0a5..4fd267eb90f 100644 --- a/sdk/lib/3rdparty/freetype/src/lzw/ftzopen.h +++ b/sdk/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-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvalid.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvalid.c index 312751a1f48..4423ca10128 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvalid.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvalid.c @@ -4,7 +4,7 @@ /* */ /* FreeType validator for OpenType tables (body only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvalid.h b/sdk/lib/3rdparty/freetype/src/otvalid/otvalid.h index f2969ccccca..d7801abae50 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvalid.h +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvalid.h @@ -4,7 +4,7 @@ /* */ /* OpenType table validation (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvbase.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvbase.c index 3adad8439c7..a01d45c707a 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvbase.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvbase.c @@ -4,7 +4,7 @@ /* */ /* OpenType BASE table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -284,22 +284,41 @@ OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; FT_UInt table_size; + FT_UShort version; OTV_OPTIONAL_TABLE( HorizAxis ); OTV_OPTIONAL_TABLE( VertAxis ); + OTV_OPTIONAL_TABLE32( itemVarStore ); + otvalid->root = ftvalid; FT_TRACE3(( "validating BASE table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 6 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; - table_size = 6; + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 8; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 4 ); + break; + + case 1: + OTV_LIMIT_CHECK( 8 ); + table_size += 4; + break; + + default: + FT_INVALID_FORMAT; + } OTV_OPTIONAL_OFFSET( HorizAxis ); OTV_SIZE_CHECK( HorizAxis ); @@ -311,6 +330,14 @@ if ( VertAxis ) otv_Axis_validate( table + VertAxis, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( itemVarStore ); + OTV_SIZE_CHECK32( itemVarStore ); + if ( itemVarStore ) + OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvcommn.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvcommn.c index 3407d2ad4ab..0ccfb03c08a 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvcommn.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvcommn.c @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -313,19 +313,26 @@ OTV_NAME_ENTER( "Device" ); - OTV_LIMIT_CHECK( 8 ); + OTV_LIMIT_CHECK( 6 ); StartSize = FT_NEXT_USHORT( p ); EndSize = FT_NEXT_USHORT( p ); DeltaFormat = FT_NEXT_USHORT( p ); - if ( DeltaFormat < 1 || DeltaFormat > 3 ) - FT_INVALID_FORMAT; + if ( DeltaFormat == 0x8000U ) + { + /* VariationIndex, nothing to do */ + } + else + { + if ( DeltaFormat < 1 || DeltaFormat > 3 ) + FT_INVALID_FORMAT; - if ( EndSize < StartSize ) - FT_INVALID_DATA; + if ( EndSize < StartSize ) + FT_INVALID_DATA; - count = EndSize - StartSize + 1; - OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */ + count = EndSize - StartSize + 1; + OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */ + } OTV_EXIT; } @@ -347,7 +354,7 @@ OTV_Validator otvalid ) { FT_Bytes p = table; - FT_UInt LookupType, SubTableCount; + FT_UInt LookupType, LookupFlag, SubTableCount; OTV_Validate_Func validate; @@ -355,7 +362,7 @@ OTV_LIMIT_CHECK( 6 ); LookupType = FT_NEXT_USHORT( p ); - p += 2; /* skip LookupFlag */ + LookupFlag = FT_NEXT_USHORT( p ); SubTableCount = FT_NEXT_USHORT( p ); OTV_TRACE(( " (type %d)\n", LookupType )); @@ -373,6 +380,9 @@ for ( ; SubTableCount > 0; SubTableCount-- ) validate( table + FT_NEXT_USHORT( p ), otvalid ); + if ( LookupFlag & 0x10 ) + OTV_LIMIT_CHECK( 2 ); /* MarkFilteringSet */ + OTV_EXIT; } diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvcommn.h b/sdk/lib/3rdparty/freetype/src/otvalid/otvcommn.h index 10a603ebb93..a392784cf19 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvcommn.h +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -67,29 +67,38 @@ FT_BEGIN_HEADER #undef FT_INVALID_ -#define FT_INVALID_( _error ) \ +#define FT_INVALID_( _error ) \ ft_validator_error( otvalid->root, FT_THROW( _error ) ) #define OTV_OPTIONAL_TABLE( _table ) FT_UShort _table; \ FT_Bytes _table ## _p +#define OTV_OPTIONAL_TABLE32( _table ) FT_ULong _table; \ + FT_Bytes _table ## _p + #define OTV_OPTIONAL_OFFSET( _offset ) \ FT_BEGIN_STMNT \ _offset ## _p = p; \ _offset = FT_NEXT_USHORT( p ); \ FT_END_STMNT -#define OTV_LIMIT_CHECK( _count ) \ - FT_BEGIN_STMNT \ +#define OTV_OPTIONAL_OFFSET32( _offset ) \ + FT_BEGIN_STMNT \ + _offset ## _p = p; \ + _offset = FT_NEXT_ULONG( p ); \ + FT_END_STMNT + +#define OTV_LIMIT_CHECK( _count ) \ + FT_BEGIN_STMNT \ if ( p + (_count) > otvalid->root->limit ) \ - FT_INVALID_TOO_SHORT; \ + FT_INVALID_TOO_SHORT; \ FT_END_STMNT #define OTV_SIZE_CHECK( _size ) \ FT_BEGIN_STMNT \ if ( _size > 0 && _size < table_size ) \ { \ - if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ + if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ FT_INVALID_OFFSET; \ else \ { \ @@ -102,12 +111,33 @@ FT_BEGIN_HEADER " set to zero.\n" \ "\n", #_size )); \ \ - /* always assume 16bit entities */ \ _size = pp[0] = pp[1] = 0; \ } \ } \ FT_END_STMNT +#define OTV_SIZE_CHECK32( _size ) \ + FT_BEGIN_STMNT \ + if ( _size > 0 && _size < table_size ) \ + { \ + if ( otvalid->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 )); \ + \ + _size = pp[0] = pp[1] = pp[2] = pp[3] = 0; \ + } \ + } \ + FT_END_STMNT + #define OTV_NAME_(x) #x #define OTV_NAME(x) OTV_NAME_(x) @@ -146,11 +176,11 @@ FT_BEGIN_HEADER #define OTV_INIT otvalid->debug_indent = 0 -#define OTV_ENTER \ - FT_BEGIN_STMNT \ - otvalid->debug_indent += 2; \ - FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ - FT_TRACE4(( "%s table\n", \ +#define OTV_ENTER \ + FT_BEGIN_STMNT \ + otvalid->debug_indent += 2; \ + FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ + FT_TRACE4(( "%s table\n", \ otvalid->debug_function_name[otvalid->nesting_level] )); \ FT_END_STMNT diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otverror.h b/sdk/lib/3rdparty/freetype/src/otvalid/otverror.h index 699903987cc..2fcf42e3875 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otverror.h +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otverror.h @@ -4,7 +4,7 @@ /* */ /* OpenType validation module error codes (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvgdef.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvgdef.c index 27b9a69ca88..08f3171541f 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvgdef.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvgdef.c @@ -4,7 +4,7 @@ /* */ /* OpenType GDEF table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 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 @@ OTV_LIMIT_CHECK( GlyphCount * 2 ); otvalid->nesting_level++; - func = otvalid->func[otvalid->nesting_level]; + func = otvalid->func[otvalid->nesting_level]; otvalid->extra1 = 0; for ( ; GlyphCount > 0; GlyphCount-- ) @@ -133,6 +133,40 @@ } + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** MARK GLYPH SETS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + otv_MarkGlyphSets_validate( FT_Bytes table, + OTV_Validator otvalid ) + { + FT_Bytes p = table; + FT_UInt MarkGlyphSetCount; + + + OTV_NAME_ENTER( "MarkGlyphSets" ); + + p += 2; /* skip Format */ + + OTV_LIMIT_CHECK( 2 ); + MarkGlyphSetCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (MarkGlyphSetCount = %d)\n", MarkGlyphSetCount )); + + OTV_LIMIT_CHECK( MarkGlyphSetCount * 4 ); /* CoverageOffsets */ + + for ( ; MarkGlyphSetCount > 0; MarkGlyphSetCount-- ) + otv_Coverage_validate( table + FT_NEXT_ULONG( p ), otvalid, -1 ); + + OTV_EXIT; + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -152,14 +186,18 @@ { OTV_ValidatorRec otvalidrec; OTV_Validator otvalid = &otvalidrec; - FT_Bytes p = table; + FT_Bytes p = table; FT_UInt table_size; - FT_Bool need_MarkAttachClassDef; + FT_UShort version; + FT_Bool need_MarkAttachClassDef = 1; OTV_OPTIONAL_TABLE( GlyphClassDef ); OTV_OPTIONAL_TABLE( AttachListOffset ); OTV_OPTIONAL_TABLE( LigCaretListOffset ); OTV_OPTIONAL_TABLE( MarkAttachClassDef ); + OTV_OPTIONAL_TABLE( MarkGlyphSetsDef ); + + OTV_OPTIONAL_TABLE32( itemVarStore ); otvalid->root = ftvalid; @@ -167,24 +205,49 @@ FT_TRACE3(( "validating GDEF table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 12 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; - /* MarkAttachClassDef has been added to the OpenType */ - /* specification without increasing GDEF's version, */ - /* so we use this ugly hack to find out whether the */ - /* table is needed actually. */ + version = FT_NEXT_USHORT( p ); /* minorVersion */ - need_MarkAttachClassDef = FT_BOOL( - otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || - otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); + table_size = 10; + switch ( version ) + { + case 0: + /* MarkAttachClassDef has been added to the OpenType */ + /* specification without increasing GDEF's version, */ + /* so we use this ugly hack to find out whether the */ + /* table is needed actually. */ - if ( need_MarkAttachClassDef ) - table_size = 12; /* OpenType >= 1.2 */ - else - table_size = 10; /* OpenType < 1.2 */ + need_MarkAttachClassDef = FT_BOOL( + otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || + otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); + + if ( need_MarkAttachClassDef ) + { + OTV_LIMIT_CHECK( 8 ); + table_size += 2; + } + else + OTV_LIMIT_CHECK( 6 ); /* OpenType < 1.2 */ + + break; + + case 2: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; + + case 3: + OTV_LIMIT_CHECK( 14 ); + table_size += 8; + break; + + default: + FT_INVALID_FORMAT; + } otvalid->glyph_count = glyph_count; @@ -217,6 +280,22 @@ otv_ClassDef_validate( table + MarkAttachClassDef, otvalid ); } + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET( MarkGlyphSetsDef ); + OTV_SIZE_CHECK( MarkGlyphSetsDef ); + if ( MarkGlyphSetsDef ) + otv_MarkGlyphSets_validate( table + MarkGlyphSetsDef, otvalid ); + } + + if ( version > 2 ) + { + OTV_OPTIONAL_OFFSET32( itemVarStore ); + OTV_SIZE_CHECK32( itemVarStore ); + if ( itemVarStore ) + OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvgpos.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvgpos.c index 0fbcc2077cb..696b35cae62 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvgpos.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvgpos.c @@ -4,7 +4,7 @@ /* */ /* OpenType GPOS table validation (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -130,7 +130,7 @@ otv_MarkArray_validate( table + Array1, otvalid ); otvalid->nesting_level++; - func = otvalid->func[otvalid->nesting_level]; + func = otvalid->func[otvalid->nesting_level]; otvalid->extra1 = ClassCount; func( table + Array2, otvalid ); @@ -218,10 +218,6 @@ OTV_LIMIT_CHECK( 2 ); OTV_OPTIONAL_OFFSET( device ); - /* XXX: this value is usually too small, especially if the current */ - /* ValueRecord is part of an array -- getting the correct table */ - /* size is probably not worth the trouble */ - table_size = p - otvalid->extra3; OTV_SIZE_CHECK( device ); @@ -271,7 +267,7 @@ case 3: { - FT_UInt table_size; + FT_UInt table_size; OTV_OPTIONAL_TABLE( XDeviceTable ); OTV_OPTIONAL_TABLE( YDeviceTable ); @@ -426,6 +422,8 @@ /*************************************************************************/ /*************************************************************************/ + /* sets otvalid->extra3 (pointer to base table) */ + static void otv_PairSet_validate( FT_Bytes table, FT_UInt format1, @@ -438,6 +436,8 @@ OTV_NAME_ENTER( "PairSet" ); + otvalid->extra3 = table; + OTV_LIMIT_CHECK( 2 ); PairValueCount = FT_NEXT_USHORT( p ); @@ -483,8 +483,6 @@ OTV_TRACE(( " (format %d)\n", PosFormat )); - otvalid->extra3 = table; - switch ( PosFormat ) { case 1: /* PairPosFormat1 */ @@ -537,7 +535,9 @@ otv_ClassDef_validate( table + ClassDef2, otvalid ); OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 * - ( len_value1 + len_value2 ) ); + ( len_value1 + len_value2 ) ); + + otvalid->extra3 = table; /* Class1Record */ for ( ; ClassCount1 > 0; ClassCount1-- ) @@ -985,20 +985,42 @@ { OTV_ValidatorRec validrec; OTV_Validator otvalid = &validrec; - FT_Bytes p = table; + FT_Bytes p = table; + FT_UInt table_size; + FT_UShort version; FT_UInt ScriptList, FeatureList, LookupList; + OTV_OPTIONAL_TABLE32( featureVariations ); + otvalid->root = ftvalid; FT_TRACE3(( "validating GPOS table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 10 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 10; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 6 ); + break; + + case 1: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; + + default: + FT_INVALID_FORMAT; + } + ScriptList = FT_NEXT_USHORT( p ); FeatureList = FT_NEXT_USHORT( p ); LookupList = FT_NEXT_USHORT( p ); @@ -1014,6 +1036,14 @@ otv_ScriptList_validate( table + ScriptList, table + FeatureList, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( featureVariations ); + OTV_SIZE_CHECK32( featureVariations ); + if ( featureVariations ) + OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvgpos.h b/sdk/lib/3rdparty/freetype/src/otvalid/otvgpos.h index 99b0ad39159..95f9ac3ee85 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvgpos.h +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvgpos.h @@ -4,7 +4,7 @@ /* */ /* OpenType GPOS table validator (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvgsub.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvgsub.c index f9bd8dc5d80..d35ea67f309 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvgsub.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvgsub.c @@ -4,7 +4,7 @@ /* */ /* OpenType GSUB table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -552,19 +552,41 @@ OTV_ValidatorRec otvalidrec; OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; + FT_UInt table_size; + FT_UShort version; FT_UInt ScriptList, FeatureList, LookupList; + OTV_OPTIONAL_TABLE32( featureVariations ); + otvalid->root = ftvalid; FT_TRACE3(( "validating GSUB table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 10 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 10; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 6 ); + break; + + case 1: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; + + default: + FT_INVALID_FORMAT; + } + ScriptList = FT_NEXT_USHORT( p ); FeatureList = FT_NEXT_USHORT( p ); LookupList = FT_NEXT_USHORT( p ); @@ -580,6 +602,14 @@ otv_ScriptList_validate( table + ScriptList, table + FeatureList, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( featureVariations ); + OTV_SIZE_CHECK32( featureVariations ); + if ( featureVariations ) + OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvjstf.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvjstf.c index 57a38f95c9e..94d4af90f6f 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvjstf.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvjstf.c @@ -4,7 +4,7 @@ /* */ /* OpenType JSTF table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvmath.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvmath.c index a14d3697008..b9800f60a26 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvmath.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvmath.c @@ -4,7 +4,7 @@ /* */ /* OpenType MATH table validation (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Written by George Williams. */ diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvmod.c b/sdk/lib/3rdparty/freetype/src/otvalid/otvmod.c index 35ffc43d3a5..89ee449d16d 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvmod.c +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's OpenType validation module implementation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/otvalid/otvmod.h b/sdk/lib/3rdparty/freetype/src/otvalid/otvmod.h index 30d401ddca3..6917bccee5d 100644 --- a/sdk/lib/3rdparty/freetype/src/otvalid/otvmod.h +++ b/sdk/lib/3rdparty/freetype/src/otvalid/otvmod.h @@ -5,7 +5,7 @@ /* FreeType's OpenType validation module implementation */ /* (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pcf/pcfdrivr.c b/sdk/lib/3rdparty/freetype/src/pcf/pcfdrivr.c index 169f75e9506..0119d94853a 100644 --- a/sdk/lib/3rdparty/freetype/src/pcf/pcfdrivr.c +++ b/sdk/lib/3rdparty/freetype/src/pcf/pcfdrivr.c @@ -50,7 +50,7 @@ THE SOFTWARE. #include FT_SERVICE_BDF_H #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_PROPERTIES_H -#include FT_PCF_DRIVER_H +#include FT_DRIVER_H /*************************************************************************/ diff --git a/sdk/lib/3rdparty/freetype/src/pcf/pcfread.c b/sdk/lib/3rdparty/freetype/src/pcf/pcfread.c index da216b05f4b..537da0dc79b 100644 --- a/sdk/lib/3rdparty/freetype/src/pcf/pcfread.c +++ b/sdk/lib/3rdparty/freetype/src/pcf/pcfread.c @@ -840,7 +840,7 @@ THE SOFTWARE. FT_TRACE4(( "pcf_get_bitmaps:\n" " format: 0x%lX\n" " (%s, %s,\n" - " padding=%d bits, scanning=%d bits)\n", + " padding=%d bit%s, scanning=%d bit%s)\n", format, PCF_BYTE_ORDER( format ) == MSBFirst ? "most significant byte first" @@ -849,7 +849,9 @@ THE SOFTWARE. ? "most significant bit first" : "least significant bit first", 8 << PCF_GLYPH_PAD_INDEX( format ), - 8 << PCF_SCAN_UNIT_INDEX( format ) )); + ( 8 << PCF_GLYPH_PAD_INDEX( format ) ) == 1 ? "" : "s", + 8 << PCF_SCAN_UNIT_INDEX( format ), + ( 8 << PCF_SCAN_UNIT_INDEX( format ) ) == 1 ? "" : "s" )); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return FT_THROW( Invalid_File_Format ); diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfr.c b/sdk/lib/3rdparty/freetype/src/pfr/pfr.c index 4f31f5d9bc0..1760882fcdb 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfr.c +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfr.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver component. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.c b/sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.c index 1d6b15be484..60643780a16 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.c +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR cmap handling (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.h b/sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.h index 957bf65b4c3..c70a0c83c50 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.h +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrcmap.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR cmap handling (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.c b/sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.c index 195cdb76acb..6c7e50128a2 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.c +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver interface (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.h b/sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.h index b81d56017e0..cab852789b9 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.h +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrdrivr.h @@ -4,7 +4,7 @@ /* */ /* High-level Type PFR driver interface (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrerror.h b/sdk/lib/3rdparty/freetype/src/pfr/pfrerror.h index ef044e32c9e..7027c818e89 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrerror.h +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrerror.h @@ -4,7 +4,7 @@ /* */ /* PFR error codes (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrgload.c b/sdk/lib/3rdparty/freetype/src/pfr/pfrgload.c index 93f5fc70908..b7990196b6e 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrgload.c +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrgload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR glyph loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -756,8 +756,10 @@ count = glyph->num_subs - old_count; - FT_TRACE4(( "compound glyph with %d elements (offset %lu):\n", - count, offset )); + FT_TRACE4(( "compound glyph with %d element%s (offset %lu):\n", + count, + count == 1 ? "" : "s", + offset )); /* now, load each individual glyph */ for ( n = 0; n < count; n++ ) @@ -810,7 +812,9 @@ /* proceed to next sub-glyph */ } - FT_TRACE4(( "end compound glyph with %d elements\n", count )); + FT_TRACE4(( "end compound glyph with %d element%s\n", + count, + count == 1 ? "" : "s" )); } else { diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrgload.h b/sdk/lib/3rdparty/freetype/src/pfr/pfrgload.h index 66123238717..01f48d7706a 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrgload.h +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrgload.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR glyph loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrload.c b/sdk/lib/3rdparty/freetype/src/pfr/pfrload.c index 4f841658285..2776da462a8 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrload.c +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrload.h b/sdk/lib/3rdparty/freetype/src/pfr/pfrload.h index f9475ae0629..36e809a762c 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrload.h +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrload.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.c b/sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.c index 514af8050d2..737b97b5ff2 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.c +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.h b/sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.h index d6ad6562dfc..59c709f58d0 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.h +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrobjs.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.c b/sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.c index 54e7d0e6cc5..ba909ddca75 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.c +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR bitmap loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.h b/sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.h index fc270f50a8f..07b27bc06cc 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.h +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrsbit.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR bitmap loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pfr/pfrtypes.h b/sdk/lib/3rdparty/freetype/src/pfr/pfrtypes.h index c3d542c2094..058d6aadc9a 100644 --- a/sdk/lib/3rdparty/freetype/src/pfr/pfrtypes.h +++ b/sdk/lib/3rdparty/freetype/src/pfr/pfrtypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR data structures (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/afmparse.c b/sdk/lib/3rdparty/freetype/src/psaux/afmparse.c index ff2cc8cf082..0c33d5949bc 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/afmparse.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/afmparse.c @@ -4,7 +4,7 @@ /* */ /* AFM parser (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/afmparse.h b/sdk/lib/3rdparty/freetype/src/psaux/afmparse.h index cd2beb7804d..86f852a2477 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/afmparse.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/afmparse.h @@ -4,7 +4,7 @@ /* */ /* AFM parser (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/cffdecode.c b/sdk/lib/3rdparty/freetype/src/psaux/cffdecode.c new file mode 100644 index 00000000000..80d622c0e1b --- /dev/null +++ b/sdk/lib/3rdparty/freetype/src/psaux/cffdecode.c @@ -0,0 +1,2370 @@ +/***************************************************************************/ +/* */ +/* cffdecode.c */ +/* */ +/* PostScript CFF (Type 2) decoding routines (body). */ +/* */ +/* Copyright 2017-2018 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 +#include FT_FREETYPE_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_SERVICE_H +#include FT_SERVICE_CFF_TABLE_LOAD_H + +#include "cffdecode.h" +#include "psobjs.h" + +#include "psauxerr.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_cffdecode + + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + + typedef enum CFF_Operator_ + { + cff_op_unknown = 0, + + cff_op_rmoveto, + cff_op_hmoveto, + cff_op_vmoveto, + + cff_op_rlineto, + cff_op_hlineto, + cff_op_vlineto, + + cff_op_rrcurveto, + cff_op_hhcurveto, + cff_op_hvcurveto, + cff_op_rcurveline, + cff_op_rlinecurve, + cff_op_vhcurveto, + cff_op_vvcurveto, + + cff_op_flex, + cff_op_hflex, + cff_op_hflex1, + cff_op_flex1, + + cff_op_endchar, + + cff_op_hstem, + cff_op_vstem, + cff_op_hstemhm, + cff_op_vstemhm, + + cff_op_hintmask, + cff_op_cntrmask, + cff_op_dotsection, /* deprecated, acts as no-op */ + + cff_op_abs, + cff_op_add, + cff_op_sub, + cff_op_div, + cff_op_neg, + cff_op_random, + cff_op_mul, + cff_op_sqrt, + + cff_op_blend, + + cff_op_drop, + cff_op_exch, + cff_op_index, + cff_op_roll, + cff_op_dup, + + cff_op_put, + cff_op_get, + cff_op_store, + cff_op_load, + + cff_op_and, + cff_op_or, + cff_op_not, + cff_op_eq, + cff_op_ifelse, + + cff_op_callsubr, + 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 + + } CFF_Operator; + + +#define CFF_COUNT_CHECK_WIDTH 0x80 +#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[] = + { + 0, /* unknown */ + + 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */ + 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, + 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, + + 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */ + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + + 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */ + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + + 13, /* flex */ + 7, + 9, + 11, + + 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */ + + 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */ + 2 | CFF_COUNT_CHECK_WIDTH, + 2 | CFF_COUNT_CHECK_WIDTH, + 2 | CFF_COUNT_CHECK_WIDTH, + + 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */ + 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */ + 0, /* dotsection */ + + 1, /* abs */ + 2, + 2, + 2, + 1, + 0, + 2, + 1, + + 1, /* blend */ + + 1, /* drop */ + 2, + 1, + 2, + 1, + + 2, /* put */ + 1, + 4, + 3, + + 2, /* and */ + 2, + 1, + 2, + 4, + + 1, /* callsubr */ + 1, + 0, + + 2, /* hsbw */ + 0, + 0, + 0, + 5, /* seac */ + 4, /* sbw */ + 2 /* setcurrentpoint */ + }; + + + static FT_Error + cff_operator_seac( CFF_Decoder* decoder, + FT_Pos asb, + FT_Pos adx, + FT_Pos ady, + FT_Int bchar, + FT_Int achar ) + { + FT_Error error; + CFF_Builder* builder = &decoder->builder; + FT_Int bchar_index, achar_index; + TT_Face face = decoder->builder.face; + FT_Vector left_bearing, advance; + FT_Byte* charstring; + FT_ULong charstring_len; + FT_Pos glyph_width; + + + if ( decoder->seac ) + { + FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); + return FT_THROW( 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. */ + /* They use the character code, not the glyph index, in this case. */ + if ( face->root.internal->incremental_interface ) + { + bchar_index = bchar; + achar_index = achar; + } + else +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + { + CFF_Font cff = (CFF_Font)(face->extra.data); + + + bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar ); + achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar ); + } + + if ( bchar_index < 0 || achar_index < 0 ) + { + FT_ERROR(( "cff_operator_seac:" + " invalid seac character code arguments\n" )); + return FT_THROW( Syntax_Error ); + } + + /* If we are trying to load a composite glyph, do not load the */ + /* accent character and return the array of subglyphs. */ + if ( builder->no_recurse ) + { + FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph; + FT_GlyphLoader loader = glyph->internal->loader; + FT_SubGlyph subg; + + + /* reallocate subglyph array if necessary */ + error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); + if ( error ) + goto Exit; + + subg = loader->current.subglyphs; + + /* subglyph 0 = base character */ + subg->index = bchar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | + FT_SUBGLYPH_FLAG_USE_MY_METRICS; + subg->arg1 = 0; + subg->arg2 = 0; + subg++; + + /* subglyph 1 = accent character */ + subg->index = achar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; + subg->arg1 = (FT_Int)( adx >> 16 ); + subg->arg2 = (FT_Int)( ady >> 16 ); + + /* set up remaining glyph fields */ + glyph->num_subglyphs = 2; + glyph->subglyphs = loader->base.subglyphs; + glyph->format = FT_GLYPH_FORMAT_COMPOSITE; + + loader->current.num_subglyphs = 2; + } + + FT_GlyphLoader_Prepare( builder->loader ); + + /* First load `bchar' in builder */ + error = decoder->get_glyph_callback( face, (FT_UInt)bchar_index, + &charstring, &charstring_len ); + if ( !error ) + { + /* the seac operator must not be nested */ + decoder->seac = TRUE; + error = cff_decoder_parse_charstrings( decoder, charstring, + charstring_len, 0 ); + decoder->seac = FALSE; + + decoder->free_glyph_callback( face, &charstring, charstring_len ); + + if ( error ) + goto Exit; + } + + /* 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 - asb; + builder->pos_y = ady; + + /* Now load `achar' on top of the base outline. */ + error = decoder->get_glyph_callback( face, (FT_UInt)achar_index, + &charstring, &charstring_len ); + if ( !error ) + { + /* the seac operator must not be nested */ + decoder->seac = TRUE; + error = cff_decoder_parse_charstrings( decoder, charstring, + charstring_len, 0 ); + decoder->seac = FALSE; + + decoder->free_glyph_callback( face, &charstring, charstring_len ); + + if ( error ) + goto Exit; + } + + /* 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; + + Exit: + return error; + } + +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********** *********/ + /********** *********/ + /********** GENERIC CHARSTRING PARSING *********/ + /********** *********/ + /********** *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* */ + /* cff_compute_bias */ + /* */ + /* */ + /* Computes the bias value in dependence of the number of glyph */ + /* subroutines. */ + /* */ + /* */ + /* in_charstring_type :: The `CharstringType' value of the top DICT */ + /* dictionary. */ + /* */ + /* num_subrs :: The number of glyph subroutines. */ + /* */ + /* */ + /* The bias value. */ + static FT_Int + cff_compute_bias( FT_Int in_charstring_type, + FT_UInt num_subrs ) + { + FT_Int result; + + + if ( in_charstring_type == 1 ) + result = 0; + else if ( num_subrs < 1240 ) + result = 107; + else if ( num_subrs < 33900U ) + result = 1131; + else + result = 32768U; + + return result; + } + + + FT_LOCAL_DEF( FT_Int ) + cff_lookup_glyph_by_stdcharcode( CFF_Font cff, + FT_Int charcode ) + { + FT_UInt n; + FT_UShort glyph_sid; + + FT_Service_CFFLoad cffload; + + + /* CID-keyed fonts don't have glyph names */ + if ( !cff->charset.sids ) + return -1; + + /* check range of standard char code */ + if ( charcode < 0 || charcode > 255 ) + return -1; + +#if 0 + /* retrieve cffload from list of current modules */ + FT_Service_CFFLoad cffload; + + + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); + if ( !cffload ) + { + FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:" + " the `cffload' module is not available\n" )); + return FT_THROW( Unimplemented_Feature ); + } +#endif + + cffload = (FT_Service_CFFLoad)cff->cffload; + + /* Get code to SID mapping from `cff_standard_encoding'. */ + glyph_sid = cffload->get_standard_encoding( (FT_UInt)charcode ); + + for ( n = 0; n < cff->num_glyphs; n++ ) + { + if ( cff->charset.sids[n] == glyph_sid ) + return (FT_Int)n; + } + + return -1; + } + + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + + /*************************************************************************/ + /* */ + /* */ + /* cff_decoder_parse_charstrings */ + /* */ + /* */ + /* Parses a given Type 2 charstrings program. */ + /* */ + /* */ + /* decoder :: The current Type 1 decoder. */ + /* */ + /* */ + /* charstring_base :: The base of the charstring stream. */ + /* */ + /* charstring_len :: The length in bytes of the charstring stream. */ + /* */ + /* in_dict :: Set to 1 if function is called from top or */ + /* private DICT (needed for Multiple Master CFFs). */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + cff_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ) + { + FT_Error error; + CFF_Decoder_Zone* zone; + FT_Byte* ip; + FT_Byte* limit; + CFF_Builder* builder = &decoder->builder; + FT_Pos x, y; + FT_Fixed* stack; + FT_Int charstring_type = + decoder->cff->top_font.font_dict.charstring_type; + FT_UShort num_designs = + decoder->cff->top_font.font_dict.num_designs; + FT_UShort num_axes = + decoder->cff->top_font.font_dict.num_axes; + + T2_Hints_Funcs hinter; + + + /* set default width */ + decoder->num_hints = 0; + decoder->read_width = 1; + + /* initialize the decoder */ + decoder->top = decoder->stack; + decoder->zone = decoder->zones; + zone = decoder->zones; + stack = decoder->top; + + hinter = (T2_Hints_Funcs)builder->hints_funcs; + + builder->path_begun = 0; + + zone->base = charstring_base; + limit = zone->limit = charstring_base + charstring_len; + ip = zone->cursor = zone->base; + + error = FT_Err_Ok; + + x = builder->pos_x; + y = builder->pos_y; + + /* begin hints recording session, if any */ + if ( hinter ) + hinter->open( hinter->hints ); + + /* now execute loop */ + while ( ip < limit ) + { + CFF_Operator op; + FT_Byte v; + + + /********************************************************************/ + /* */ + /* Decode operator or operand */ + /* */ + v = *ip++; + if ( v >= 32 || v == 28 ) + { + FT_Int shift = 16; + FT_Int32 val; + + + /* this is an operand, push it on the stack */ + + /* if we use shifts, all computations are done with unsigned */ + /* values; the conversion to a signed value is the last step */ + if ( v == 28 ) + { + if ( ip + 1 >= limit ) + goto Syntax_Error; + val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] ); + ip += 2; + } + else if ( v < 247 ) + val = (FT_Int32)v - 139; + else if ( v < 251 ) + { + if ( ip >= limit ) + goto Syntax_Error; + val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108; + } + else if ( v < 255 ) + { + if ( ip >= limit ) + goto Syntax_Error; + val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108; + } + else + { + if ( ip + 3 >= limit ) + goto Syntax_Error; + val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); + ip += 4; + if ( charstring_type == 2 ) + shift = 0; + } + if ( decoder->top - stack >= CFF_MAX_OPERANDS ) + goto Stack_Overflow; + + val = (FT_Int32)( (FT_UInt32)val << shift ); + *decoder->top++ = val; + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( !( val & 0xFFFFL ) ) + FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) )); + else + FT_TRACE4(( " %.5f", val / 65536.0 )); +#endif + + } + 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; + + + /* find operator */ + op = cff_op_unknown; + + switch ( v ) + { + case 1: + op = cff_op_hstem; + break; + case 3: + op = cff_op_vstem; + break; + case 4: + op = cff_op_vmoveto; + break; + case 5: + op = cff_op_rlineto; + break; + case 6: + op = cff_op_hlineto; + break; + case 7: + op = cff_op_vlineto; + break; + case 8: + op = cff_op_rrcurveto; + break; + case 9: + op = cff_op_closepath; + break; + case 10: + op = cff_op_callsubr; + break; + case 11: + op = cff_op_return; + break; + case 12: + if ( ip >= limit ) + goto Syntax_Error; + v = *ip++; + + switch ( v ) + { + 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; + case 4: + op = cff_op_or; + break; + 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; + case 9: + op = cff_op_abs; + break; + case 10: + op = cff_op_add; + break; + case 11: + op = cff_op_sub; + break; + case 12: + op = cff_op_div; + break; + case 13: + op = cff_op_load; + break; + case 14: + op = cff_op_neg; + break; + case 15: + op = cff_op_eq; + break; + case 16: + op = cff_op_callothersubr; + break; + case 17: + op = cff_op_pop; + break; + case 18: + op = cff_op_drop; + break; + case 20: + op = cff_op_put; + break; + case 21: + op = cff_op_get; + break; + case 22: + op = cff_op_ifelse; + break; + case 23: + op = cff_op_random; + break; + case 24: + op = cff_op_mul; + break; + case 26: + op = cff_op_sqrt; + break; + case 27: + op = cff_op_dup; + break; + case 28: + op = cff_op_exch; + break; + case 29: + op = cff_op_index; + break; + case 30: + op = cff_op_roll; + break; + case 33: + op = cff_op_setcurrentpoint; + break; + case 34: + op = cff_op_hflex; + break; + case 35: + op = cff_op_flex; + break; + case 36: + op = cff_op_hflex1; + break; + case 37: + op = cff_op_flex1; + break; + default: + FT_TRACE4(( " unknown op (12, %d)\n", v )); + break; + } + break; + case 13: + op = cff_op_hsbw; + break; + case 14: + op = cff_op_endchar; + break; + case 16: + op = cff_op_blend; + break; + case 18: + op = cff_op_hstemhm; + break; + case 19: + op = cff_op_hintmask; + break; + case 20: + op = cff_op_cntrmask; + break; + case 21: + op = cff_op_rmoveto; + break; + case 22: + op = cff_op_hmoveto; + break; + case 23: + op = cff_op_vstemhm; + break; + case 24: + op = cff_op_rcurveline; + break; + case 25: + op = cff_op_rlinecurve; + break; + case 26: + op = cff_op_vvcurveto; + break; + case 27: + op = cff_op_hhcurveto; + break; + case 29: + op = cff_op_callgsubr; + break; + case 30: + op = cff_op_vhcurveto; + break; + case 31: + op = cff_op_hvcurveto; + break; + default: + FT_TRACE4(( " unknown op (%d)\n", v )); + break; + } + + if ( op == cff_op_unknown ) + continue; + + /* in Multiple Master CFFs, T2 charstrings can appear in */ + /* dictionaries, but some operators are prohibited */ + if ( in_dict ) + { + switch ( op ) + { + case cff_op_hstem: + case cff_op_vstem: + case cff_op_vmoveto: + case cff_op_rlineto: + case cff_op_hlineto: + case cff_op_vlineto: + case cff_op_rrcurveto: + case cff_op_hstemhm: + case cff_op_hintmask: + case cff_op_cntrmask: + case cff_op_rmoveto: + case cff_op_hmoveto: + case cff_op_vstemhm: + case cff_op_rcurveline: + case cff_op_rlinecurve: + case cff_op_vvcurveto: + case cff_op_hhcurveto: + case cff_op_vhcurveto: + case cff_op_hvcurveto: + case cff_op_hflex: + case cff_op_flex: + case cff_op_hflex1: + case cff_op_flex1: + case cff_op_callsubr: + case cff_op_callgsubr: + goto MM_Error; + + default: + break; + } + } + + /* check arguments */ + req_args = cff_argument_counts[op]; + if ( req_args & CFF_COUNT_CHECK_WIDTH ) + { + if ( num_args > 0 && decoder->read_width ) + { + /* If `nominal_width' is non-zero, the number is really a */ + /* difference against `nominal_width'. Else, the number here */ + /* is truly a width, not a difference against `nominal_width'. */ + /* If the font does not set `nominal_width', then */ + /* `nominal_width' defaults to zero, and so we can set */ + /* `glyph_width' to `nominal_width' plus number on the stack */ + /* -- for either case. */ + + FT_Int set_width_ok; + + + switch ( op ) + { + case cff_op_hmoveto: + case cff_op_vmoveto: + set_width_ok = num_args & 2; + break; + + case cff_op_hstem: + case cff_op_vstem: + case cff_op_hstemhm: + case cff_op_vstemhm: + case cff_op_rmoveto: + case cff_op_hintmask: + case cff_op_cntrmask: + set_width_ok = num_args & 1; + break; + + 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 = in_dict + ? 0 + : ( ( num_args == 5 ) || ( num_args == 1 ) ); + break; + + default: + set_width_ok = 0; + break; + } + + if ( set_width_ok ) + { + 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--; + } + } + + decoder->read_width = 0; + req_args = 0; + } + + 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: + case cff_op_vstem: + case cff_op_hstemhm: + case cff_op_vstemhm: + /* the number of arguments is always even here */ + 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 - ( num_args & ~1 ) ); + + decoder->num_hints += num_args / 2; + args = stack; + break; + + case cff_op_hintmask: + case cff_op_cntrmask: + FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" )); + + /* implement vstem when needed -- */ + /* the specification doesn't say it, but this also works */ + /* with the 'cntrmask' operator */ + /* */ + if ( num_args > 0 ) + { + if ( hinter ) + hinter->stems( hinter->hints, + 0, + num_args / 2, + args - ( num_args & ~1 ) ); + + decoder->num_hints += num_args / 2; + } + + /* In a valid charstring there must be at least one byte */ + /* after `hintmask' or `cntrmask' (e.g., for a `return' */ + /* instruction). Additionally, there must be space for */ + /* `num_hints' bits. */ + + if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit ) + goto Syntax_Error; + + if ( hinter ) + { + if ( op == cff_op_hintmask ) + hinter->hintmask( hinter->hints, + (FT_UInt)builder->current->n_points, + (FT_UInt)decoder->num_hints, + ip ); + else + hinter->counter( hinter->hints, + (FT_UInt)decoder->num_hints, + ip ); + } + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt maskbyte; + + + 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; +#endif + args = stack; + break; + + case cff_op_rmoveto: + FT_TRACE4(( " rmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + x = ADD_LONG( x, args[-2] ); + y = ADD_LONG( y, args[-1] ); + args = stack; + break; + + case cff_op_vmoveto: + FT_TRACE4(( " vmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + y = ADD_LONG( y, args[-1] ); + args = stack; + break; + + case cff_op_hmoveto: + FT_TRACE4(( " hmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + x = ADD_LONG( x, args[-1] ); + args = stack; + break; + + case cff_op_rlineto: + FT_TRACE4(( " rlineto\n" )); + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_args / 2 ) ) + goto Fail; + + if ( num_args < 2 ) + goto Stack_Underflow; + + args -= num_args & ~1; + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + args += 2; + } + args = stack; + break; + + case cff_op_hlineto: + case cff_op_vlineto: + { + FT_Int phase = ( op == cff_op_hlineto ); + + + FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" + : " vlineto\n" )); + + if ( num_args < 0 ) + goto Stack_Underflow; + + /* there exist subsetted fonts (found in PDFs) */ + /* which call `hlineto' without arguments */ + if ( num_args == 0 ) + break; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_args ) ) + goto Fail; + + args = stack; + while ( args < decoder->top ) + { + if ( phase ) + x = ADD_LONG( x, args[0] ); + else + y = ADD_LONG( y, args[0] ); + + if ( cff_builder_add_point1( builder, x, y ) ) + goto Fail; + + args++; + phase ^= 1; + } + args = stack; + } + break; + + case cff_op_rrcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " rrcurveto\n" )); + + if ( num_args < 6 ) + goto Stack_Underflow; + + nargs = num_args - num_args % 6; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, nargs / 2 ) ) + goto Fail; + + args -= nargs; + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 6; + } + args = stack; + } + break; + + case cff_op_vvcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " vvcurveto\n" )); + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 4n or 4n+1, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + args -= nargs; + + if ( nargs & 1 ) + { + x = ADD_LONG( x, args[0] ); + args++; + nargs--; + } + + if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) + goto Fail; + + while ( args < decoder->top ) + { + y = ADD_LONG( y, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 4; + } + args = stack; + } + break; + + case cff_op_hhcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " hhcurveto\n" )); + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 4n or 4n+1, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + args -= nargs; + if ( nargs & 1 ) + { + y = ADD_LONG( y, args[0] ); + args++; + nargs--; + } + + if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) + goto Fail; + + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 4; + } + args = stack; + } + break; + + case cff_op_vhcurveto: + case cff_op_hvcurveto: + { + FT_Int phase; + FT_Int nargs; + + + FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" + : " hvcurveto\n" )); + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + args -= nargs; + if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) ) + goto Stack_Underflow; + + phase = ( op == cff_op_hvcurveto ); + + while ( nargs >= 4 ) + { + nargs -= 4; + if ( phase ) + { + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + y = ADD_LONG( y, args[3] ); + if ( nargs == 1 ) + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + } + else + { + y = ADD_LONG( y, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[3] ); + if ( nargs == 1 ) + y = ADD_LONG( y, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + } + args += 4; + phase ^= 1; + } + args = stack; + } + break; + + case cff_op_rlinecurve: + { + FT_Int num_lines; + FT_Int nargs; + + + FT_TRACE4(( " rlinecurve\n" )); + + if ( num_args < 8 ) + goto Stack_Underflow; + + nargs = num_args & ~1; + num_lines = ( nargs - 6 ) / 2; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_lines + 3 ) ) + goto Fail; + + args -= nargs; + + /* first, add the line segments */ + while ( num_lines > 0 ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 2; + num_lines--; + } + + /* then the curve */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + } + break; + + case cff_op_rcurveline: + { + FT_Int num_curves; + FT_Int nargs; + + + FT_TRACE4(( " rcurveline\n" )); + + 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 ) || + cff_check_points( builder, num_curves * 3 + 2 ) ) + goto Fail; + + args -= nargs; + + /* first, add the curves */ + while ( num_curves > 0 ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 6; + num_curves--; + } + + /* then the final line */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + } + break; + + case cff_op_hflex1: + { + FT_Pos start_y; + + + 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 */ + /* needs to be added */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's y position for later use */ + start_y = y; + + /* first control point */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* second control point */ + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* join point; on curve, with y-value the same as the last */ + /* control point's y-value */ + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + + /* third control point, with y-value the same as the join */ + /* point's y-value */ + x = ADD_LONG( x, args[5] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* fourth control point */ + x = ADD_LONG( x, args[6] ); + y = ADD_LONG( y, args[7] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* ending point, with y-value the same as the start */ + x = ADD_LONG( x, args[8] ); + y = start_y; + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + case cff_op_hflex: + { + FT_Pos start_y; + + + FT_TRACE4(( " hflex\n" )); + + /* adding six more points; 4 control points, 2 on-curve points */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's y-position for later use */ + start_y = y; + + /* first control point */ + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* second control point */ + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* join point; on curve, with y-value the same as the last */ + /* control point's y-value */ + x = ADD_LONG( x, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + /* third control point, with y-value the same as the join */ + /* point's y-value */ + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* fourth control point */ + x = ADD_LONG( x, args[5] ); + y = start_y; + cff_builder_add_point( builder, x, y, 0 ); + + /* ending point, with y-value the same as the start point's */ + /* y-value -- we don't add this point, though */ + x = ADD_LONG( x, args[6] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + 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_Fixed* temp; + + + FT_TRACE4(( " flex1\n" )); + + /* adding six more points; 4 control points, 2 on-curve points */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's x, y position for later use */ + start_x = x; + start_y = y; + + /* XXX: figure out whether this is supposed to be a horizontal */ + /* or vertical flex; the Type 2 specification is vague... */ + + temp = args; + + /* grab up to the last argument */ + for ( count = 5; count > 0; count-- ) + { + dx = ADD_LONG( dx, temp[0] ); + dy = ADD_LONG( dy, temp[1] ); + temp += 2; + } + + if ( dx < 0 ) + dx = -dx; + if ( dy < 0 ) + dy = -dy; + + /* strange test, but here it is... */ + horizontal = ( dx > dy ); + + for ( count = 5; count > 0; count-- ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, + (FT_Bool)( count == 3 ) ); + args += 2; + } + + /* is last operand an x- or y-delta? */ + if ( horizontal ) + { + x = ADD_LONG( x, args[0] ); + y = start_y; + } + else + { + x = start_x; + y = ADD_LONG( y, args[0] ); + } + + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + case cff_op_flex: + { + FT_UInt count; + + + FT_TRACE4(( " flex\n" )); + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + for ( count = 6; count > 0; count-- ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, + (FT_Bool)( count == 4 || count == 1 ) ); + args += 2; + } + + args = stack; + } + 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: + /* in dictionaries, `endchar' simply indicates end of data */ + if ( in_dict ) + return error; + + FT_TRACE4(( " endchar\n" )); + + /* We are going to emulate the seac operator. */ + if ( num_args >= 4 ) + { + /* Save glyph width so that the subglyphs don't overwrite it. */ + FT_Pos glyph_width = decoder->glyph_width; + + + error = cff_operator_seac( decoder, + 0L, args[-4], args[-3], + (FT_Int)( args[-2] >> 16 ), + (FT_Int)( args[-1] >> 16 ) ); + + decoder->glyph_width = glyph_width; + } + else + { + cff_builder_close_contour( builder ); + + /* close hints recording session */ + if ( hinter ) + { + if ( hinter->close( hinter->hints, + (FT_UInt)builder->current->n_points ) ) + goto Syntax_Error; + + /* apply hints to the loaded glyph outline now */ + error = hinter->apply( hinter->hints, + builder->current, + (PSH_Globals)builder->hints_globals, + decoder->hint_mode ); + if ( error ) + goto Fail; + } + + /* add current outline to the glyph slot */ + FT_GlyphLoader_Add( builder->loader ); + } + + /* return now! */ + FT_TRACE4(( "\n" )); + return error; + + case cff_op_abs: + FT_TRACE4(( " abs\n" )); + + if ( args[0] < 0 ) + { + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; + else + args[0] = -args[0]; + } + args++; + break; + + case cff_op_add: + FT_TRACE4(( " add\n" )); + + args[0] = ADD_LONG( args[0], args[1] ); + args++; + break; + + case cff_op_sub: + FT_TRACE4(( " sub\n" )); + + args[0] = SUB_LONG( args[0], args[1] ); + args++; + break; + + case cff_op_div: + FT_TRACE4(( " div\n" )); + + args[0] = FT_DivFix( args[0], args[1] ); + args++; + break; + + case cff_op_neg: + FT_TRACE4(( " neg\n" )); + + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; + args[0] = -args[0]; + args++; + break; + + case cff_op_random: + FT_TRACE4(( " random\n" )); + + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + args[0] = (FT_Fixed) + ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); + args++; + + decoder->current_subfont->random = + cff_random( decoder->current_subfont->random ); + break; + + case cff_op_mul: + FT_TRACE4(( " mul\n" )); + + args[0] = FT_MulFix( args[0], args[1] ); + args++; + break; + + case cff_op_sqrt: + FT_TRACE4(( " sqrt\n" )); + + if ( args[0] > 0 ) + { + FT_Fixed root = args[0]; + FT_Fixed new_root; + + + for (;;) + { + new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1; + if ( new_root == root ) + break; + root = new_root; + } + args[0] = new_root; + } + else + args[0] = 0; + args++; + break; + + case cff_op_drop: + /* nothing */ + FT_TRACE4(( " drop\n" )); + + break; + + case cff_op_exch: + { + FT_Fixed tmp; + + + FT_TRACE4(( " exch\n" )); + + tmp = args[0]; + args[0] = args[1]; + args[1] = tmp; + args += 2; + } + break; + + case cff_op_index: + { + FT_Int idx = (FT_Int)( args[0] >> 16 ); + + + FT_TRACE4(( " index\n" )); + + if ( idx < 0 ) + idx = 0; + else if ( idx > num_args - 2 ) + idx = num_args - 2; + args[0] = args[-( idx + 1 )]; + args++; + } + break; + + case cff_op_roll: + { + FT_Int count = (FT_Int)( args[0] >> 16 ); + FT_Int idx = (FT_Int)( args[1] >> 16 ); + + + FT_TRACE4(( " roll\n" )); + + if ( count <= 0 ) + count = 1; + + args -= count; + if ( args < stack ) + goto Stack_Underflow; + + if ( idx >= 0 ) + { + while ( idx > 0 ) + { + FT_Fixed tmp = args[count - 1]; + FT_Int i; + + + for ( i = count - 2; i >= 0; i-- ) + args[i + 1] = args[i]; + args[0] = tmp; + idx--; + } + } + else + { + while ( idx < 0 ) + { + FT_Fixed tmp = args[0]; + FT_Int i; + + + for ( i = 0; i < count - 1; i++ ) + args[i] = args[i + 1]; + args[count - 1] = tmp; + idx++; + } + } + args += count; + } + break; + + case cff_op_dup: + FT_TRACE4(( " dup\n" )); + + args[1] = args[0]; + args += 2; + break; + + case cff_op_put: + { + FT_Fixed val = args[0]; + FT_Int idx = (FT_Int)( args[1] >> 16 ); + + + FT_TRACE4(( " put\n" )); + + /* the Type2 specification before version 16-March-2000 */ + /* didn't give a hard-coded size limit of the temporary */ + /* storage array; instead, an argument of the */ + /* `MultipleMaster' operator set the size */ + if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) + decoder->buildchar[idx] = val; + } + break; + + case cff_op_get: + { + FT_Int idx = (FT_Int)( args[0] >> 16 ); + FT_Fixed val = 0; + + + FT_TRACE4(( " get\n" )); + + if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) + val = decoder->buildchar[idx]; + + args[0] = val; + args++; + } + break; + + case cff_op_store: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, this is a no-op */ + FT_TRACE4(( " store\n" )); + break; + + case cff_op_load: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + { + FT_Int reg_idx = (FT_Int)args[0]; + FT_Int idx = (FT_Int)args[1]; + FT_Int count = (FT_Int)args[2]; + + + FT_TRACE4(( " load\n" )); + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, we store a vector [1 0 0 ...] in the */ + /* temporary storage array regardless of the Registry index */ + if ( reg_idx >= 0 && reg_idx <= 2 && + idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS && + count >= 0 && count <= num_axes ) + { + FT_Int end, i; + + + end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS ); + + if ( idx < end ) + decoder->buildchar[idx] = 1 << 16; + + for ( i = idx + 1; i < end; i++ ) + decoder->buildchar[i] = 0; + } + } + break; + + case cff_op_blend: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + { + FT_Int num_results = (FT_Int)( args[0] >> 16 ); + + + FT_TRACE4(( " blend\n" )); + + if ( num_results < 0 ) + goto Syntax_Error; + + if ( num_results * (FT_Int)num_designs > num_args ) + goto Stack_Underflow; + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, return the `num_results' values of the */ + /* first master */ + args -= num_results * ( num_designs - 1 ); + num_args -= num_results * ( num_designs - 1 ); + } + break; + + case cff_op_dotsection: + /* this operator is deprecated and ignored by the parser */ + 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 = + ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) ); + + decoder->builder.left_bearing.x = args[0]; + decoder->builder.left_bearing.y = 0; + + x = ADD_LONG( 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 = + ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) ); + + decoder->builder.left_bearing.x = args[0]; + decoder->builder.left_bearing.y = args[1]; + + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( 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 = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( 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. */ + /* */ + /* XXX Fix return arguments (see discussion below). */ + args -= 2 + ( args[-2] >> 16 ); + if ( args < stack ) + goto Stack_Underflow; + 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" )); + + /* XXX Increasing `args' is wrong: After a certain number of */ + /* `pop's we get a stack overflow. Reason for doing it is */ + /* code like this (actually found in a CFF font): */ + /* */ + /* 17 1 3 callothersubr */ + /* pop */ + /* callsubr */ + /* */ + /* Since we handle `callothersubr' as a no-op, and */ + /* `callsubr' needs at least one argument, `pop' can't be a */ + /* no-op too as it basically should be. */ + /* */ + /* The right solution would be to provide real support for */ + /* `callothersubr' as done in `t1decode.c', however, given */ + /* the fact that CFF fonts with `pop' are invalid, it is */ + /* questionable whether it is worth the time. */ + args++; + break; + + case cff_op_and: + { + FT_Fixed cond = ( args[0] && args[1] ); + + + FT_TRACE4(( " and\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_or: + { + FT_Fixed cond = ( args[0] || args[1] ); + + + FT_TRACE4(( " or\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_not: + { + FT_Fixed cond = !args[0]; + + + FT_TRACE4(( " not\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_eq: + { + FT_Fixed cond = ( args[0] == args[1] ); + + + FT_TRACE4(( " eq\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_ifelse: + { + FT_Fixed cond = ( args[2] <= args[3] ); + + + FT_TRACE4(( " ifelse\n" )); + + if ( !cond ) + args[0] = args[1]; + args++; + } + break; + + case cff_op_callsubr: + { + FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + decoder->locals_bias ); + + + FT_TRACE4(( " callsubr (idx %d, entering level %d)\n", + idx, + zone - decoder->zones + 1 )); + + if ( idx >= decoder->num_locals ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invalid local subr index\n" )); + goto Syntax_Error; + } + + if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " too many nested subrs\n" )); + goto Syntax_Error; + } + + zone->cursor = ip; /* save current instruction pointer */ + + zone++; + zone->base = decoder->locals[idx]; + zone->limit = decoder->locals[idx + 1]; + zone->cursor = zone->base; + + if ( !zone->base || zone->limit == zone->base ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invoking empty subrs\n" )); + goto Syntax_Error; + } + + decoder->zone = zone; + ip = zone->base; + limit = zone->limit; + } + break; + + case cff_op_callgsubr: + { + FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + decoder->globals_bias ); + + + FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n", + idx, + zone - decoder->zones + 1 )); + + if ( idx >= decoder->num_globals ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invalid global subr index\n" )); + goto Syntax_Error; + } + + if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " too many nested subrs\n" )); + goto Syntax_Error; + } + + zone->cursor = ip; /* save current instruction pointer */ + + zone++; + zone->base = decoder->globals[idx]; + zone->limit = decoder->globals[idx + 1]; + zone->cursor = zone->base; + + if ( !zone->base || zone->limit == zone->base ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invoking empty subrs\n" )); + goto Syntax_Error; + } + + decoder->zone = zone; + ip = zone->base; + limit = zone->limit; + } + break; + + case cff_op_return: + FT_TRACE4(( " return (leaving level %d)\n", + decoder->zone - decoder->zones )); + + if ( decoder->zone <= decoder->zones ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " unexpected return\n" )); + goto Syntax_Error; + } + + decoder->zone--; + zone = decoder->zone; + ip = zone->cursor; + limit = zone->limit; + break; + + default: + FT_ERROR(( "Unimplemented opcode: %d", ip[-1] )); + + if ( ip[-1] == 12 ) + FT_ERROR(( " %d", ip[0] )); + FT_ERROR(( "\n" )); + + return FT_THROW( Unimplemented_Feature ); + } + + decoder->top = args; + + if ( decoder->top - stack >= CFF_MAX_OPERANDS ) + goto Stack_Overflow; + + } /* general operator processing */ + + } /* while ip < limit */ + + FT_TRACE4(( "..end..\n\n" )); + + Fail: + return error; + + MM_Error: + FT_TRACE4(( "cff_decoder_parse_charstrings:" + " invalid opcode found in top DICT charstring\n")); + return FT_THROW( Invalid_File_Format ); + + Syntax_Error: + FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" )); + return FT_THROW( Invalid_File_Format ); + + Stack_Underflow: + FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" )); + return FT_THROW( Too_Few_Arguments ); + + Stack_Overflow: + FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" )); + return FT_THROW( Stack_Overflow ); + } + +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /* */ + /* */ + /* cff_decoder_init */ + /* */ + /* */ + /* Initializes a given glyph decoder. */ + /* */ + /* */ + /* decoder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size 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, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback ) + { + CFF_Font cff = (CFF_Font)face->extra.data; + + + /* clear everything */ + FT_ZERO( decoder ); + + /* initialize builder */ + cff_builder_init( &decoder->builder, face, size, slot, hinting ); + + /* initialize Type2 decoder */ + decoder->cff = cff; + decoder->num_globals = cff->global_subrs_index.count; + decoder->globals = cff->global_subrs; + decoder->globals_bias = cff_compute_bias( + cff->top_font.font_dict.charstring_type, + decoder->num_globals ); + + decoder->hint_mode = hint_mode; + + decoder->get_glyph_callback = get_callback; + decoder->free_glyph_callback = free_callback; + } + + + /* 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_Builder *builder = &decoder->builder; + CFF_Font cff = (CFF_Font)builder->face->extra.data; + CFF_SubFont sub = &cff->top_font; + FT_Error error = FT_Err_Ok; + + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)cff->cffload; + + + /* manage CID fonts */ + if ( cff->num_subfonts ) + { + FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select, + glyph_index ); + + + if ( fd_index >= cff->num_subfonts ) + { + FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + FT_TRACE3(( " in subfont %d:\n", fd_index )); + + sub = cff->subfonts[fd_index]; + + if ( builder->hints_funcs && size ) + { + FT_Size ftsize = FT_SIZE( size ); + CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; + + + /* for CFFs without subfonts, this value has already been set */ + builder->hints_globals = (void *)internal->subfonts[fd_index]; + } + } + + decoder->num_locals = sub->local_subrs_index.count; + decoder->locals = sub->local_subrs; + 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; + + decoder->current_subfont = sub; + + Exit: + return error; + } + + +/* END */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/cffdecode.h b/sdk/lib/3rdparty/freetype/src/psaux/cffdecode.h new file mode 100644 index 00000000000..0d4f5fef631 --- /dev/null +++ b/sdk/lib/3rdparty/freetype/src/psaux/cffdecode.h @@ -0,0 +1,64 @@ +/***************************************************************************/ +/* */ +/* cffdecode.h */ +/* */ +/* PostScript CFF (Type 2) decoding routines (specification). */ +/* */ +/* Copyright 2017-2018 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 CFFDECODE_H_ +#define CFFDECODE_H_ + + +#include +#include FT_INTERNAL_POSTSCRIPT_AUX_H + + +FT_BEGIN_HEADER + + FT_LOCAL( void ) + cff_decoder_init( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback ); + + FT_LOCAL( FT_Error ) + cff_decoder_prepare( CFF_Decoder* decoder, + CFF_Size size, + FT_UInt glyph_index ); + + + FT_LOCAL( FT_Int ) + cff_lookup_glyph_by_stdcharcode( CFF_Font cff, + FT_Int charcode ); + + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + FT_LOCAL( FT_Error ) + cff_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ); +#endif + + +FT_END_HEADER + +#endif + + +/* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2arrst.c b/sdk/lib/3rdparty/freetype/src/psaux/psarrst.c similarity index 98% rename from sdk/lib/3rdparty/freetype/src/cff/cf2arrst.c rename to sdk/lib/3rdparty/freetype/src/psaux/psarrst.c index 6796450fe10..a8780947f9d 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2arrst.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psarrst.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2arrst.c */ +/* psarrst.c */ /* */ /* Adobe's code for Array Stacks (body). */ /* */ @@ -36,13 +36,13 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2arrst.h" +#include "psglue.h" +#include "psarrst.h" -#include "cf2error.h" +#include "pserror.h" /* diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2arrst.h b/sdk/lib/3rdparty/freetype/src/psaux/psarrst.h similarity index 96% rename from sdk/lib/3rdparty/freetype/src/cff/cf2arrst.h rename to sdk/lib/3rdparty/freetype/src/psaux/psarrst.h index 3c21a3b6727..b3568eb61fc 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2arrst.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psarrst.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2arrst.h */ +/* psarrst.h */ /* */ /* Adobe's code for Array Stacks (specification). */ /* */ @@ -36,11 +36,11 @@ /***************************************************************************/ -#ifndef CF2ARRST_H_ -#define CF2ARRST_H_ +#ifndef PSARRST_H_ +#define PSARRST_H_ -#include "cf2error.h" +#include "pserror.h" FT_BEGIN_HEADER @@ -94,7 +94,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2ARRST_H_ */ +#endif /* PSARRST_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/psaux.c b/sdk/lib/3rdparty/freetype/src/psaux/psaux.c index c373aa7d5b7..fb447fcdbbc 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/psaux.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psaux.c @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,6 +25,17 @@ #include "psobjs.c" #include "t1cmap.c" #include "t1decode.c" +#include "cffdecode.c" + +#include "psarrst.c" +#include "psblues.c" +#include "pserror.c" +#include "psfont.c" +#include "psft.c" +#include "pshints.c" +#include "psintrp.c" +#include "psread.c" +#include "psstack.c" /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/psauxerr.h b/sdk/lib/3rdparty/freetype/src/psaux/psauxerr.h index 1d7ac6001b1..cc33fd2eeac 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/psauxerr.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ /* */ /* PS auxiliary module error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/psauxmod.c b/sdk/lib/3rdparty/freetype/src/psaux/psauxmod.c index 1f589cefc21..ee497085cc2 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/psauxmod.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript module implementation (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,8 @@ #include "psobjs.h" #include "t1decode.h" #include "t1cmap.h" +#include "psft.h" +#include "cffdecode.h" #ifndef T1_CONFIG_OPTION_NO_AFM #include "afmparse.h" @@ -59,6 +61,14 @@ }; + FT_CALLBACK_TABLE_DEF + const PS_Builder_FuncsRec ps_builder_funcs = + { + ps_builder_init, /* init */ + ps_builder_done /* done */ + }; + + FT_CALLBACK_TABLE_DEF const T1_Builder_FuncsRec t1_builder_funcs = { @@ -77,9 +87,14 @@ FT_CALLBACK_TABLE_DEF const T1_Decoder_FuncsRec t1_decoder_funcs = { - t1_decoder_init, /* init */ - t1_decoder_done, /* done */ - t1_decoder_parse_charstrings /* parse_charstrings */ + t1_decoder_init, /* init */ + t1_decoder_done, /* done */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + t1_decoder_parse_charstrings, /* parse_charstrings_old */ +#else + t1_decoder_parse_metrics, /* parse_metrics */ +#endif + cf2_decoder_parse_charstrings /* parse_charstrings */ }; @@ -104,6 +119,34 @@ }; + FT_CALLBACK_TABLE_DEF + const CFF_Builder_FuncsRec cff_builder_funcs = + { + cff_builder_init, /* init */ + cff_builder_done, /* done */ + + cff_check_points, /* check_points */ + cff_builder_add_point, /* add_point */ + cff_builder_add_point1, /* add_point1 */ + cff_builder_add_contour, /* add_contour */ + cff_builder_start_point, /* start_point */ + cff_builder_close_contour /* close_contour */ + }; + + + FT_CALLBACK_TABLE_DEF + const CFF_Decoder_FuncsRec cff_decoder_funcs = + { + cff_decoder_init, /* init */ + cff_decoder_prepare, /* prepare */ + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + cff_decoder_parse_charstrings, /* parse_charstrings_old */ +#endif + cf2_decoder_parse_charstrings /* parse_charstrings */ + }; + + static const PSAux_Interface psaux_interface = { @@ -112,6 +155,9 @@ &t1_builder_funcs, &t1_decoder_funcs, t1_decrypt, + cff_random, + ps_decoder_init, + t1_make_subfont, (const T1_CMap_ClassesRec*) &t1_cmap_classes, @@ -120,6 +166,8 @@ #else 0, #endif + + &cff_decoder_funcs, }; diff --git a/sdk/lib/3rdparty/freetype/src/psaux/psauxmod.h b/sdk/lib/3rdparty/freetype/src/psaux/psauxmod.h index 926f37eba5d..f30978f0220 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/psauxmod.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript module implementation (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,6 +23,8 @@ #include #include FT_MODULE_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H + FT_BEGIN_HEADER @@ -31,6 +33,13 @@ FT_BEGIN_HEADER #endif + FT_CALLBACK_TABLE + const CFF_Builder_FuncsRec cff_builder_funcs; + + FT_CALLBACK_TABLE + const PS_Builder_FuncsRec ps_builder_funcs; + + FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class; diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2blues.c b/sdk/lib/3rdparty/freetype/src/psaux/psblues.c similarity index 99% rename from sdk/lib/3rdparty/freetype/src/cff/cf2blues.c rename to sdk/lib/3rdparty/freetype/src/psaux/psblues.c index c491f2f9e5c..ae39d03c777 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2blues.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psblues.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2blues.c */ +/* psblues.c */ /* */ /* Adobe's code for handling Blue Zones (body). */ /* */ @@ -36,12 +36,12 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2blues.h" -#include "cf2hints.h" -#include "cf2font.h" +#include "psblues.h" +#include "pshints.h" +#include "psfont.h" /*************************************************************************/ @@ -67,7 +67,7 @@ CF2_Font font ) { /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; + PS_Decoder* decoder = font->decoder; CF2_Fixed zoneHeight; CF2_Fixed maxZoneHeight = 0; diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2blues.h b/sdk/lib/3rdparty/freetype/src/psaux/psblues.h similarity index 97% rename from sdk/lib/3rdparty/freetype/src/cff/cf2blues.h rename to sdk/lib/3rdparty/freetype/src/psaux/psblues.h index a6bcd9de578..25ef6849c77 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2blues.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psblues.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2blues.h */ +/* psblues.h */ /* */ /* Adobe's code for handling Blue Zones (specification). */ /* */ @@ -65,11 +65,11 @@ */ -#ifndef CF2BLUES_H_ -#define CF2BLUES_H_ +#ifndef PSBLUES_H_ +#define PSBLUES_H_ -#include "cf2glue.h" +#include "psglue.h" FT_BEGIN_HEADER @@ -179,7 +179,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2BLUES_H_ */ +#endif /* PSBLUES_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/psconv.c b/sdk/lib/3rdparty/freetype/src/psaux/psconv.c index d125b0834a4..a03385000df 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/psconv.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psconv.c @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/psconv.h b/sdk/lib/3rdparty/freetype/src/psaux/psconv.h index cab254ac5a1..d643ffcfc2c 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/psconv.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psconv.h @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2error.c b/sdk/lib/3rdparty/freetype/src/psaux/pserror.c similarity index 96% rename from sdk/lib/3rdparty/freetype/src/cff/cf2error.c rename to sdk/lib/3rdparty/freetype/src/psaux/pserror.c index e3dd69f50d1..9169e5222d0 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2error.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/pserror.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2error.c */ +/* pserror.c */ /* */ /* Adobe's code for error handling (body). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#include "cf2ft.h" -#include "cf2error.h" +#include "psft.h" +#include "pserror.h" FT_LOCAL_DEF( void ) diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2error.h b/sdk/lib/3rdparty/freetype/src/psaux/pserror.h similarity index 96% rename from sdk/lib/3rdparty/freetype/src/cff/cf2error.h rename to sdk/lib/3rdparty/freetype/src/psaux/pserror.h index d2c770d2974..13d52062bf3 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2error.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/pserror.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2error.h */ +/* pserror.h */ /* */ /* Adobe's code for error handling (specification). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2ERROR_H_ -#define CF2ERROR_H_ +#ifndef PSERROR_H_ +#define PSERROR_H_ #include FT_MODULE_ERRORS_H @@ -50,7 +50,7 @@ #include FT_ERRORS_H -#include "cf2ft.h" +#include "psft.h" FT_BEGIN_HEADER @@ -113,7 +113,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2ERROR_H_ */ +#endif /* PSERROR_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2fixed.h b/sdk/lib/3rdparty/freetype/src/psaux/psfixed.h similarity index 97% rename from sdk/lib/3rdparty/freetype/src/cff/cf2fixed.h rename to sdk/lib/3rdparty/freetype/src/psaux/psfixed.h index a041184bda8..219589e7fc7 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2fixed.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psfixed.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2fixed.h */ +/* psfixed.h */ /* */ /* Adobe's code for Fixed Point Mathematics (specification only). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2FIXED_H_ -#define CF2FIXED_H_ +#ifndef PSFIXED_H_ +#define PSFIXED_H_ FT_BEGIN_HEADER @@ -89,7 +89,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FIXED_H_ */ +#endif /* PSFIXED_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2font.c b/sdk/lib/3rdparty/freetype/src/psaux/psfont.c similarity index 91% rename from sdk/lib/3rdparty/freetype/src/cff/cf2font.c rename to sdk/lib/3rdparty/freetype/src/psaux/psfont.c index 4ac71a8d715..dde67a739d6 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2font.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psfont.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.c */ +/* psfont.c */ /* */ /* Adobe's code for font instances (body). */ /* */ @@ -39,12 +39,12 @@ #include #include FT_INTERNAL_CALC_H -#include "cf2ft.h" +#include "psft.h" -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2error.h" -#include "cf2intrp.h" +#include "psglue.h" +#include "psfont.h" +#include "pserror.h" +#include "psintrp.h" /* Compute a stem darkening amount in character space. */ @@ -243,7 +243,7 @@ const CF2_Matrix* transform ) { /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; + PS_Decoder* decoder = font->decoder; FT_Bool needExtraSetup = FALSE; @@ -260,7 +260,6 @@ CF2_UInt lenNormalizedV = 0; FT_Fixed* normalizedV = NULL; - /* clear previous error */ font->error = FT_Err_Ok; @@ -273,46 +272,52 @@ needExtraSetup = TRUE; } - /* check for variation vectors */ - vstore = cf2_getVStore( decoder ); - hasVariations = ( vstore->dataCount != 0 ); - - if ( hasVariations ) + if ( !font->isT1 ) { -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* check whether Private DICT in this subfont needs to be reparsed */ - font->error = cf2_getNormalizedVector( decoder, - &lenNormalizedV, - &normalizedV ); - if ( font->error ) - return; + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; - if ( cff_blend_check_vector( &subFont->blend, - subFont->private_dict.vsindex, - lenNormalizedV, - normalizedV ) ) + + /* check for variation vectors */ + vstore = cf2_getVStore( decoder ); + hasVariations = ( vstore->dataCount != 0 ); + + if ( hasVariations ) { - /* blend has changed, reparse */ - cff_load_private_dict( decoder->cff, - subFont, - lenNormalizedV, - normalizedV ); - needExtraSetup = TRUE; - } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* check whether Private DICT in this subfont needs to be reparsed */ + font->error = cf2_getNormalizedVector( decoder, + &lenNormalizedV, + &normalizedV ); + if ( font->error ) + return; + + if ( cffload->blend_check_vector( &subFont->blend, + subFont->private_dict.vsindex, + lenNormalizedV, + normalizedV ) ) + { + /* blend has changed, reparse */ + cffload->load_private_dict( decoder->cff, + subFont, + lenNormalizedV, + normalizedV ); + needExtraSetup = TRUE; + } #endif - /* copy from subfont */ - font->blend.font = subFont->blend.font; + /* copy from subfont */ + font->blend.font = subFont->blend.font; - /* clear state of charstring blend */ - font->blend.usedBV = FALSE; + /* clear state of charstring blend */ + font->blend.usedBV = FALSE; - /* initialize value for charstring */ - font->vsindex = subFont->private_dict.vsindex; + /* initialize value for charstring */ + font->vsindex = subFont->private_dict.vsindex; - /* store vector inputs for blends in charstring */ - font->lenNDV = lenNormalizedV; - font->NDV = normalizedV; + /* store vector inputs for blends in charstring */ + font->lenNDV = lenNormalizedV; + font->NDV = normalizedV; + } } /* if ppem has changed, we need to recompute some cached data */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2font.h b/sdk/lib/3rdparty/freetype/src/psaux/psfont.h similarity index 94% rename from sdk/lib/3rdparty/freetype/src/cff/cf2font.h rename to sdk/lib/3rdparty/freetype/src/psaux/psfont.h index 17ecd17bbb6..e611ac4bdc8 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2font.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psfont.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.h */ +/* psfont.h */ /* */ /* Adobe's code for font instances (specification). */ /* */ @@ -36,13 +36,14 @@ /***************************************************************************/ -#ifndef CF2FONT_H_ -#define CF2FONT_H_ +#ifndef PSFONT_H_ +#define PSFONT_H_ -#include "cf2ft.h" -#include "cf2blues.h" -#include "cffload.h" +#include FT_SERVICE_CFF_TABLE_LOAD_H + +#include "psft.h" +#include "psblues.h" FT_BEGIN_HEADER @@ -64,6 +65,7 @@ FT_BEGIN_HEADER FT_Memory memory; FT_Error error; /* shared error for this instance */ + FT_Bool isT1; FT_Bool isCFF2; CF2_RenderingFlags renderingFlags; @@ -89,7 +91,7 @@ FT_BEGIN_HEADER /* FreeType related members */ CF2_OutlineRec outline; /* freetype glyph outline functions */ - CFF_Decoder* decoder; + PS_Decoder* decoder; CFF_SubFont lastSubfont; /* FreeType parsed data; */ /* top font or subfont */ @@ -111,6 +113,8 @@ FT_BEGIN_HEADER /* counterclockwise winding */ CF2_BluesRec blues; /* computed zone data */ + + FT_Service_CFFLoad cffload; /* pointer to cff functions */ }; @@ -124,7 +128,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FONT_H_ */ +#endif /* PSFONT_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2ft.c b/sdk/lib/3rdparty/freetype/src/psaux/psft.c similarity index 65% rename from sdk/lib/3rdparty/freetype/src/cff/cf2ft.c rename to sdk/lib/3rdparty/freetype/src/psaux/psft.c index c6c00d16239..1f750174a1c 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2ft.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psft.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2ft.c */ +/* psft.c */ /* */ /* FreeType Glue Component to Adobe's Interpreter (body). */ /* */ @@ -36,11 +36,20 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2font.h" -#include "cf2error.h" +#include "psfont.h" +#include "pserror.h" +#include "psobjs.h" +#include "cffdecode.h" + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#endif + +#include FT_SERVICE_CFF_TABLE_LOAD_H #define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ @@ -83,12 +92,13 @@ cf2_setGlyphWidth( CF2_Outline outline, CF2_Fixed width ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); - decoder->glyph_width = cf2_fixedToInt( width ); + if ( !decoder->builder.is_t1 ) + *decoder->glyph_width = cf2_fixedToInt( width ); } @@ -122,8 +132,8 @@ const CF2_CallbackParams params ) { /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; (void)params; /* only used in debug mode */ @@ -134,7 +144,7 @@ builder = &outline->decoder->builder; /* note: two successive moves simply close the contour twice */ - cff_builder_close_contour( builder ); + ps_builder_close_contour( builder ); builder->path_begun = 0; } @@ -146,8 +156,8 @@ FT_Error error; /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; FT_ASSERT( outline && outline->decoder ); @@ -159,9 +169,9 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - error = cff_builder_start_point( builder, - params->pt0.x, - params->pt0.y ); + error = ps_builder_start_point( builder, + params->pt0.x, + params->pt0.y ); if ( error ) { if ( !*callbacks->error ) @@ -170,10 +180,10 @@ } } - /* `cff_builder_add_point1' includes a check_points call for one point */ - error = cff_builder_add_point1( builder, - params->pt1.x, - params->pt1.y ); + /* `ps_builder_add_point1' includes a check_points call for one point */ + error = ps_builder_add_point1( builder, + params->pt1.x, + params->pt1.y ); if ( error ) { if ( !*callbacks->error ) @@ -190,8 +200,8 @@ FT_Error error; /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; FT_ASSERT( outline && outline->decoder ); @@ -203,9 +213,9 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - error = cff_builder_start_point( builder, - params->pt0.x, - params->pt0.y ); + error = ps_builder_start_point( builder, + params->pt0.x, + params->pt0.y ); if ( error ) { if ( !*callbacks->error ) @@ -215,7 +225,7 @@ } /* prepare room for 3 points: 2 off-curve, 1 on-curve */ - error = cff_check_points( builder, 3 ); + error = ps_builder_check_points( builder, 3 ); if ( error ) { if ( !*callbacks->error ) @@ -223,15 +233,15 @@ return; } - cff_builder_add_point( builder, - params->pt1.x, - params->pt1.y, 0 ); - cff_builder_add_point( builder, - params->pt2.x, - params->pt2.y, 0 ); - cff_builder_add_point( builder, - params->pt3.x, - params->pt3.y, 1 ); + ps_builder_add_point( builder, + params->pt1.x, + params->pt1.y, 0 ); + ps_builder_add_point( builder, + params->pt2.x, + params->pt2.y, 0 ); + ps_builder_add_point( builder, + params->pt3.x, + params->pt3.y, 1 ); } @@ -253,11 +263,11 @@ /* get scaling and hint flag from GlyphSlot */ static void - cf2_getScaleAndHintFlag( CFF_Decoder* decoder, - CF2_Fixed* x_scale, - CF2_Fixed* y_scale, - FT_Bool* hinted, - FT_Bool* scaled ) + cf2_getScaleAndHintFlag( PS_Decoder* decoder, + CF2_Fixed* x_scale, + CF2_Fixed* y_scale, + FT_Bool* hinted, + FT_Bool* scaled ) { FT_ASSERT( decoder && decoder->builder.glyph ); @@ -284,47 +294,60 @@ /* get units per em from `FT_Face' */ /* TODO: should handle font matrix concatenation? */ static FT_UShort - cf2_getUnitsPerEm( CFF_Decoder* decoder ) + cf2_getUnitsPerEm( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->builder.face ); - FT_ASSERT( decoder->builder.face->root.units_per_EM ); + FT_ASSERT( decoder->builder.face->units_per_EM ); - return decoder->builder.face->root.units_per_EM; + return decoder->builder.face->units_per_EM; } /* Main entry point: Render one glyph. */ FT_LOCAL_DEF( FT_Error ) - cf2_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len ) + cf2_decoder_parse_charstrings( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ) { FT_Memory memory; FT_Error error = FT_Err_Ok; CF2_Font font; + FT_Bool is_t1 = decoder->builder.is_t1; - FT_ASSERT( decoder && decoder->cff ); + + FT_ASSERT( decoder && + ( is_t1 || decoder->cff ) ); + + if ( is_t1 && !decoder->current_subfont ) + { + FT_ERROR(( "cf2_decoder_parse_charstrings (Type 1): " + "SubFont missing. Use `t1_make_subfont' first\n" )); + return FT_THROW( Invalid_Table ); + } memory = decoder->builder.memory; /* CF2 data is saved here across glyphs */ - font = (CF2_Font)decoder->cff->cf2_instance.data; + font = (CF2_Font)decoder->cf2_instance->data; /* on first glyph, allocate instance structure */ - if ( !decoder->cff->cf2_instance.data ) + if ( !decoder->cf2_instance->data ) { - decoder->cff->cf2_instance.finalizer = + decoder->cf2_instance->finalizer = (FT_Generic_Finalizer)cf2_free_instance; - if ( FT_ALLOC( decoder->cff->cf2_instance.data, + if ( FT_ALLOC( decoder->cf2_instance->data, sizeof ( CF2_FontRec ) ) ) return FT_THROW( Out_Of_Memory ); - font = (CF2_Font)decoder->cff->cf2_instance.data; + font = (CF2_Font)decoder->cf2_instance->data; font->memory = memory; + if ( !is_t1 ) + font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload; + /* initialize a client outline, to be shared by each glyph rendered */ cf2_outline_init( &font->outline, font->memory, &font->error ); } @@ -337,13 +360,13 @@ { /* build parameters for Adobe engine */ - CFF_Builder* builder = &decoder->builder; - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + PS_Builder* builder = &decoder->builder; + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); FT_Bool no_stem_darkening_driver = driver->no_stem_darkening; FT_Char no_stem_darkening_font = - builder->face->root.internal->no_stem_darkening; + builder->face->internal->no_stem_darkening; /* local error */ FT_Error error2 = FT_Err_Ok; @@ -372,8 +395,14 @@ &hinted, &scaled ); - /* copy isCFF2 boolean from TT_Face to CF2_Font */ - font->isCFF2 = builder->face->is_cff2; + if ( is_t1 ) + font->isCFF2 = FALSE; + else + { + /* copy isCFF2 boolean from TT_Face to CF2_Font */ + font->isCFF2 = ((TT_Face)builder->face)->is_cff2; + } + font->isT1 = is_t1; font->renderingFlags = 0; if ( hinted ) @@ -416,7 +445,7 @@ /* get pointer to current FreeType subfont (based on current glyphID) */ FT_LOCAL_DEF( CFF_SubFont ) - cf2_getSubfont( CFF_Decoder* decoder ) + cf2_getSubfont( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -426,7 +455,7 @@ /* get pointer to VStore structure */ FT_LOCAL_DEF( CFF_VStore ) - cf2_getVStore( CFF_Decoder* decoder ) + cf2_getVStore( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->cff ); @@ -436,7 +465,7 @@ /* get maxstack value from CFF2 Top DICT */ FT_LOCAL_DEF( FT_UInt ) - cf2_getMaxstack( CFF_Decoder* decoder ) + cf2_getMaxstack( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->cff ); @@ -450,25 +479,33 @@ /* */ /* Note: Uses FT_Fixed not CF2_Fixed for the vector. */ FT_LOCAL_DEF( FT_Error ) - cf2_getNormalizedVector( CFF_Decoder* decoder, + cf2_getNormalizedVector( PS_Decoder* decoder, CF2_UInt *len, FT_Fixed* *vec ) { + TT_Face face; + FT_Service_MultiMasters mm; + + FT_ASSERT( decoder && decoder->builder.face ); FT_ASSERT( vec && len ); + FT_ASSERT( !decoder->builder.is_t1 ); - return cff_get_var_blend( decoder->builder.face, len, NULL, vec, NULL ); + face = (TT_Face)decoder->builder.face; + mm = (FT_Service_MultiMasters)face->mm; + + return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL ); } #endif /* get `y_ppem' from `CFF_Size' */ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getPpemY( CFF_Decoder* decoder ) + cf2_getPpemY( PS_Decoder* decoder ) { - FT_ASSERT( decoder && - decoder->builder.face && - decoder->builder.face->root.size ); + FT_ASSERT( decoder && + decoder->builder.face && + decoder->builder.face->size ); /* * Note that `y_ppem' can be zero if there wasn't a call to @@ -480,7 +517,7 @@ * */ return cf2_intToFixed( - decoder->builder.face->root.size->metrics.y_ppem ); + decoder->builder.face->size->metrics.y_ppem ); } @@ -488,7 +525,7 @@ /* FreeType stores these as integer font units */ /* (note: variable names seem swapped) */ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getStdVW( CFF_Decoder* decoder ) + cf2_getStdVW( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -498,7 +535,7 @@ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getStdHW( CFF_Decoder* decoder ) + cf2_getStdHW( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -509,10 +546,10 @@ /* note: FreeType stores 1000 times the actual value for `BlueScale' */ FT_LOCAL_DEF( void ) - cf2_getBlueMetrics( CFF_Decoder* decoder, - CF2_Fixed* blueScale, - CF2_Fixed* blueShift, - CF2_Fixed* blueFuzz ) + cf2_getBlueMetrics( PS_Decoder* decoder, + CF2_Fixed* blueScale, + CF2_Fixed* blueShift, + CF2_Fixed* blueFuzz ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -529,9 +566,9 @@ /* get blue values counts and arrays; the FreeType parser has validated */ /* the counts and verified that each is an even number */ FT_LOCAL_DEF( void ) - cf2_getBlueValues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getBlueValues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -542,9 +579,9 @@ FT_LOCAL_DEF( void ) - cf2_getOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -555,9 +592,9 @@ FT_LOCAL_DEF( void ) - cf2_getFamilyBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getFamilyBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -568,9 +605,9 @@ FT_LOCAL_DEF( void ) - cf2_getFamilyOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getFamilyOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -581,7 +618,7 @@ FT_LOCAL_DEF( CF2_Int ) - cf2_getLanguageGroup( CFF_Decoder* decoder ) + cf2_getLanguageGroup( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -592,9 +629,9 @@ /* convert unbiased subroutine index to `CF2_Buffer' and */ /* return 0 on success */ FT_LOCAL_DEF( CF2_Int ) - cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ) + cf2_initGlobalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ) { CF2_UInt idx; @@ -620,9 +657,9 @@ /* convert AdobeStandardEncoding code to CF2_Buffer; */ /* used for seac component */ FT_LOCAL_DEF( FT_Error ) - cf2_getSeacComponent( CFF_Decoder* decoder, - CF2_Int code, - CF2_Buffer buf ) + cf2_getSeacComponent( PS_Decoder* decoder, + CF2_Int code, + CF2_Buffer buf ) { CF2_Int gid; FT_Byte* charstring; @@ -631,13 +668,14 @@ FT_ASSERT( decoder ); + FT_ASSERT( !decoder->builder.is_t1 ); FT_ZERO( buf ); #ifdef FT_CONFIG_OPTION_INCREMENTAL /* Incremental fonts don't necessarily have valid charsets. */ /* They use the character code, not the glyph index, in this case. */ - if ( decoder->builder.face->root.internal->incremental_interface ) + if ( decoder->builder.face->internal->incremental_interface ) gid = code; else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ @@ -647,10 +685,10 @@ return FT_THROW( Invalid_Glyph_Format ); } - error = cff_get_glyph_data( decoder->builder.face, - (CF2_UInt)gid, - &charstring, - &len ); + error = decoder->get_glyph_callback( (TT_Face)decoder->builder.face, + (CF2_UInt)gid, + &charstring, + &len ); /* TODO: for now, just pass the FreeType error through */ if ( error ) return error; @@ -667,21 +705,92 @@ FT_LOCAL_DEF( void ) - cf2_freeSeacComponent( CFF_Decoder* decoder, - CF2_Buffer buf ) + cf2_freeSeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ) { FT_ASSERT( decoder ); + FT_ASSERT( !decoder->builder.is_t1 ); - cff_free_glyph_data( decoder->builder.face, - (FT_Byte**)&buf->start, - (FT_ULong)( buf->end - buf->start ) ); + decoder->free_glyph_callback( (TT_Face)decoder->builder.face, + (FT_Byte**)&buf->start, + (FT_ULong)( buf->end - buf->start ) ); + } + + + FT_LOCAL_DEF( FT_Error ) + cf2_getT1SeacComponent( PS_Decoder* decoder, + FT_UInt glyph_index, + CF2_Buffer buf ) + { + FT_Data glyph_data; + FT_Error error = FT_Err_Ok; + T1_Face face = (T1_Face)decoder->builder.face; + T1_Font type1 = &face->type1; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + FT_Incremental_InterfaceRec *inc = + face->root.internal->incremental_interface; + + + /* For incremental fonts get the character data using the */ + /* callback function. */ + if ( inc ) + error = inc->funcs->get_glyph_data( inc->object, + glyph_index, &glyph_data ); + else +#endif + /* For ordinary fonts get the character data stored in the face record. */ + { + glyph_data.pointer = type1->charstrings[glyph_index]; + glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index]; + } + + if ( !error ) + { + FT_Byte* charstring_base = (FT_Byte*)glyph_data.pointer; + FT_ULong charstring_len = (FT_ULong)glyph_data.length; + + + FT_ASSERT( charstring_base + charstring_len >= charstring_base ); + + FT_ZERO( buf ); + buf->start = + buf->ptr = charstring_base; + buf->end = charstring_base + charstring_len; + } + + return error; + } + + + FT_LOCAL_DEF( void ) + cf2_freeT1SeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ) + { + T1_Face face; + FT_Data data; + + + FT_ASSERT( decoder ); + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + face = (T1_Face)decoder->builder.face; + + data.pointer = buf->start; + data.length = (FT_Int)( buf->end - buf->start ); + + if ( face->root.internal->incremental_interface ) + face->root.internal->incremental_interface->funcs->free_glyph_data( + face->root.internal->incremental_interface->object, + &data ); +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ } FT_LOCAL_DEF( CF2_Int ) - cf2_initLocalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ) + cf2_initLocalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ) { CF2_UInt idx; @@ -696,16 +805,42 @@ FT_ASSERT( decoder->locals ); - buf->start = - buf->ptr = decoder->locals[idx]; - buf->end = decoder->locals[idx + 1]; + buf->start = decoder->locals[idx]; + + if ( decoder->builder.is_t1 ) + { + /* The Type 1 driver stores subroutines without the seed bytes. */ + /* The CID driver stores subroutines with seed bytes. This */ + /* case is taken care of when decoder->subrs_len == 0. */ + if ( decoder->locals_len ) + buf->end = buf->start + decoder->locals_len[idx]; + else + { + /* We are using subroutines from a CID font. We must adjust */ + /* for the seed bytes. */ + buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 ); + buf->end = decoder->locals[idx + 1]; + } + + if ( !buf->start ) + { + FT_ERROR(( "cf2_initLocalRegionBuffer (Type 1 mode):" + " invoking empty subrs\n" )); + } + } + else + { + buf->end = decoder->locals[idx + 1]; + } + + buf->ptr = buf->start; return FALSE; /* success */ } FT_LOCAL_DEF( CF2_Fixed ) - cf2_getDefaultWidthX( CFF_Decoder* decoder ) + cf2_getDefaultWidthX( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -715,7 +850,7 @@ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getNominalWidthX( CFF_Decoder* decoder ) + cf2_getNominalWidthX( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -727,7 +862,7 @@ FT_LOCAL_DEF( void ) cf2_outline_reset( CF2_Outline outline ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); @@ -741,12 +876,12 @@ FT_LOCAL_DEF( void ) cf2_outline_close( CF2_Outline outline ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); - cff_builder_close_contour( &decoder->builder ); + ps_builder_close_contour( &decoder->builder ); FT_GlyphLoader_Add( decoder->builder.loader ); } diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2ft.h b/sdk/lib/3rdparty/freetype/src/psaux/psft.h similarity index 60% rename from sdk/lib/3rdparty/freetype/src/cff/cf2ft.h rename to sdk/lib/3rdparty/freetype/src/psaux/psft.h index b054a6e950c..ab172110bb6 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2ft.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psft.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2ft.h */ +/* psft.h */ /* */ /* FreeType Glue Component to Adobe's Interpreter (specification). */ /* */ @@ -36,11 +36,11 @@ /***************************************************************************/ -#ifndef CF2FT_H_ -#define CF2FT_H_ +#ifndef PSFT_H_ +#define PSFT_H_ -#include "cf2types.h" +#include "pstypes.h" /* TODO: disable asserts for now */ @@ -49,88 +49,96 @@ #include FT_SYSTEM_H -#include "cf2glue.h" -#include "cffgload.h" /* for CFF_Decoder */ +#include "psglue.h" +#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Decoder */ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - cf2_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len ); + cf2_decoder_parse_charstrings( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); FT_LOCAL( CFF_SubFont ) - cf2_getSubfont( CFF_Decoder* decoder ); + cf2_getSubfont( PS_Decoder* decoder ); FT_LOCAL( CFF_VStore ) - cf2_getVStore( CFF_Decoder* decoder ); + cf2_getVStore( PS_Decoder* decoder ); FT_LOCAL( FT_UInt ) - cf2_getMaxstack( CFF_Decoder* decoder ); + cf2_getMaxstack( PS_Decoder* decoder ); #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_LOCAL( FT_Error ) - cf2_getNormalizedVector( CFF_Decoder* decoder, - CF2_UInt *len, - FT_Fixed* *vec ); + cf2_getNormalizedVector( PS_Decoder* decoder, + CF2_UInt *len, + FT_Fixed* *vec ); #endif FT_LOCAL( CF2_Fixed ) - cf2_getPpemY( CFF_Decoder* decoder ); + cf2_getPpemY( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getStdVW( CFF_Decoder* decoder ); + cf2_getStdVW( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getStdHW( CFF_Decoder* decoder ); + cf2_getStdHW( PS_Decoder* decoder ); FT_LOCAL( void ) - cf2_getBlueMetrics( CFF_Decoder* decoder, - CF2_Fixed* blueScale, - CF2_Fixed* blueShift, - CF2_Fixed* blueFuzz ); + cf2_getBlueMetrics( PS_Decoder* decoder, + CF2_Fixed* blueScale, + CF2_Fixed* blueShift, + CF2_Fixed* blueFuzz ); FT_LOCAL( void ) - cf2_getBlueValues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getBlueValues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getFamilyBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getFamilyBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getFamilyOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getFamilyOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( CF2_Int ) - cf2_getLanguageGroup( CFF_Decoder* decoder ); + cf2_getLanguageGroup( PS_Decoder* decoder ); FT_LOCAL( CF2_Int ) - cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ); + cf2_initGlobalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ); FT_LOCAL( FT_Error ) - cf2_getSeacComponent( CFF_Decoder* decoder, - CF2_Int code, - CF2_Buffer buf ); + cf2_getSeacComponent( PS_Decoder* decoder, + CF2_Int code, + CF2_Buffer buf ); FT_LOCAL( void ) - cf2_freeSeacComponent( CFF_Decoder* decoder, - CF2_Buffer buf ); + cf2_freeSeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ); FT_LOCAL( CF2_Int ) - cf2_initLocalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ); + cf2_initLocalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ); FT_LOCAL( CF2_Fixed ) - cf2_getDefaultWidthX( CFF_Decoder* decoder ); + cf2_getDefaultWidthX( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getNominalWidthX( CFF_Decoder* decoder ); + cf2_getNominalWidthX( PS_Decoder* decoder ); + FT_LOCAL( FT_Error ) + cf2_getT1SeacComponent( PS_Decoder* decoder, + FT_UInt glyph_index, + CF2_Buffer buf ); + FT_LOCAL( void ) + cf2_freeT1SeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ); + /* * FreeType client outline * @@ -139,7 +147,7 @@ FT_BEGIN_HEADER typedef struct CF2_OutlineRec_ { CF2_OutlineCallbacksRec root; /* base class must be first */ - CFF_Decoder* decoder; + PS_Decoder* decoder; } CF2_OutlineRec, *CF2_Outline; @@ -153,7 +161,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FT_H_ */ +#endif /* PSFT_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2glue.h b/sdk/lib/3rdparty/freetype/src/psaux/psglue.h similarity index 96% rename from sdk/lib/3rdparty/freetype/src/cff/cf2glue.h rename to sdk/lib/3rdparty/freetype/src/psaux/psglue.h index 56a7c248f4e..5545e12a5bf 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2glue.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psglue.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2glue.h */ +/* psglue.h */ /* */ /* Adobe's code for shared stuff (specification only). */ /* */ @@ -36,15 +36,15 @@ /***************************************************************************/ -#ifndef CF2GLUE_H_ -#define CF2GLUE_H_ +#ifndef PSGLUE_H_ +#define PSGLUE_H_ /* common includes for other modules */ -#include "cf2error.h" -#include "cf2fixed.h" -#include "cf2arrst.h" -#include "cf2read.h" +#include "pserror.h" +#include "psfixed.h" +#include "psarrst.h" +#include "psread.h" FT_BEGIN_HEADER @@ -138,7 +138,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2GLUE_H_ */ +#endif /* PSGLUE_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2hints.c b/sdk/lib/3rdparty/freetype/src/psaux/pshints.c similarity index 96% rename from sdk/lib/3rdparty/freetype/src/cff/cf2hints.c rename to sdk/lib/3rdparty/freetype/src/psaux/pshints.c index 656eb2cff17..36151964253 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2hints.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/pshints.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2hints.c */ +/* pshints.c */ /* */ /* Adobe's code for handling CFF hints (body). */ /* */ @@ -36,13 +36,13 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2hints.h" -#include "cf2intrp.h" +#include "psglue.h" +#include "psfont.h" +#include "pshints.h" +#include "psintrp.h" /*************************************************************************/ @@ -299,6 +299,36 @@ } + static void + cf2_hintmap_dump( CF2_HintMap hintmap ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + CF2_UInt i; + + + FT_TRACE6(( " index csCoord dsCoord scale flags\n" )); + + for ( i = 0; i < hintmap->count; i++ ) + { + CF2_Hint hint = &hintmap->edge[i]; + + + FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n", + hint->index, + hint->csCoord / 65536.0, + hint->dsCoord / ( hint->scale * 1.0 ), + hint->scale, + ( cf2_hint_isPair( hint ) ? "p" : "g" ), + ( cf2_hint_isTop( hint ) ? "t" : "b" ), + ( cf2_hint_isLocked( hint ) ? "L" : ""), + ( cf2_hint_isSynthetic( hint ) ? "S" : "" ) )); + } +#else + FT_UNUSED( hintmap ); +#endif + } + + /* transform character space coordinate to device space using hint map */ static CF2_Fixed cf2_hintmap_map( CF2_HintMap hintmap, @@ -612,6 +642,14 @@ break; } + FT_TRACE7(( " Got hint at %.2f (%.2f)\n", + firstHintEdge->csCoord / 65536.0, + firstHintEdge->dsCoord / 65536.0 )); + if ( isPair ) + FT_TRACE7(( " Got hint at %.2f (%.2f)\n", + secondHintEdge->csCoord / 65536.0, + secondHintEdge->dsCoord / 65536.0 )); + /* * Discard any hints that overlap in character space. Most often, this * is while building the initial map, where captured hints from all @@ -731,11 +769,20 @@ hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */ hintmap->count += 1; + FT_TRACE7(( " Inserting hint %.2f (%.2f)\n", + firstHintEdge->csCoord / 65536.0, + firstHintEdge->dsCoord / 65536.0 )); + if ( isPair ) { /* insert second edge */ hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */ hintmap->count += 1; + + FT_TRACE7(( " Inserting hint %.2f (%.2f)\n", + secondHintEdge->csCoord / 65536.0, + secondHintEdge->dsCoord / 65536.0 )); + } } @@ -795,7 +842,15 @@ cf2_arrstack_size( hStemHintArray ) + cf2_arrstack_size( vStemHintArray ) ); if ( !cf2_hintmask_isValid( hintMask ) ) + { + if ( font->isT1 ) + { + /* no error, just continue unhinted */ + *hintMask->error = FT_Err_Ok; + hintmap->hinted = FALSE; + } return; /* too many stem hints */ + } } /* begin by clearing the map */ @@ -970,6 +1025,12 @@ } } + FT_TRACE6(( initialMap ? "flags: [p]air [g]host [t]op " + "[b]ottom [L]ocked [S]ynthetic\n" + "Initial hintmap\n" + : "Hints:\n" )); + cf2_hintmap_dump( hintmap ); + /* * Note: The following line is a convenient place to break when * debugging hinting. Examine `hintmap->edge' for the list of @@ -982,6 +1043,9 @@ /* adjust positions of hint edges that are not locked to blue zones */ cf2_hintmap_adjustHints( hintmap ); + FT_TRACE6(( "(adjusted)\n" )); + cf2_hintmap_dump( hintmap ); + /* save the position of all hints that were used in this hint map; */ /* if we use them again, we'll locate them in the same position */ if ( !initialMap ) @@ -1146,7 +1210,7 @@ * second segment. * Let `w 'be the zero-based vector from `u1' to `v1'. * `perp' is the `perpendicular dot product'; see - * http://mathworld.wolfram.com/PerpDotProduct.html. + * https://mathworld.wolfram.com/PerpDotProduct.html. * `s' is the parameter for the parametric line for the first segment * (`u'). * diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2hints.h b/sdk/lib/3rdparty/freetype/src/psaux/pshints.h similarity index 98% rename from sdk/lib/3rdparty/freetype/src/cff/cf2hints.h rename to sdk/lib/3rdparty/freetype/src/psaux/pshints.h index a8984542a01..92e37e98aef 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2hints.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/pshints.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2hints.h */ +/* pshints.h */ /* */ /* Adobe's code for handling CFF hints (body). */ /* */ @@ -36,9 +36,8 @@ /***************************************************************************/ -#ifndef CF2HINTS_H_ -#define CF2HINTS_H_ - +#ifndef PSHINT_H_ +#define PSHINT_H_ FT_BEGIN_HEADER @@ -283,7 +282,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2HINTS_H_ */ +#endif /* PSHINT_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2intrp.c b/sdk/lib/3rdparty/freetype/src/psaux/psintrp.c similarity index 55% rename from sdk/lib/3rdparty/freetype/src/cff/cf2intrp.c rename to sdk/lib/3rdparty/freetype/src/psaux/psintrp.c index 9635ef2d99c..5c0ee784924 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2intrp.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psintrp.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2intrp.c */ +/* psintrp.c */ /* */ /* Adobe's CFF Interpreter (body). */ /* */ @@ -36,18 +36,20 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H +#include FT_SERVICE_CFF_TABLE_LOAD_H -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2stack.h" -#include "cf2hints.h" -#include "cf2intrp.h" +#include "psglue.h" +#include "psfont.h" +#include "psstack.h" +#include "pshints.h" +#include "psintrp.h" -#include "cf2error.h" +#include "pserror.h" -#include "cffload.h" +#include "psobjs.h" /* for cff_random */ +#include "t1decode.h" /* for t1 seac */ /*************************************************************************/ @@ -205,11 +207,11 @@ cf2_cmdHLINETO, /* 6 */ cf2_cmdVLINETO, /* 7 */ cf2_cmdRRCURVETO, /* 8 */ - cf2_cmdRESERVED_9, /* 9 */ + cf2_cmdCLOSEPATH, /* 9 T1 only */ cf2_cmdCALLSUBR, /* 10 */ cf2_cmdRETURN, /* 11 */ cf2_cmdESC, /* 12 */ - cf2_cmdRESERVED_13, /* 13 */ + cf2_cmdHSBW, /* 13 T1 only */ cf2_cmdENDCHAR, /* 14 */ cf2_cmdVSINDEX, /* 15 */ cf2_cmdBLEND, /* 16 */ @@ -233,13 +235,13 @@ enum { cf2_escDOTSECTION, /* 0 */ - cf2_escRESERVED_1, /* 1 */ - cf2_escRESERVED_2, /* 2 */ + cf2_escVSTEM3, /* 1 T1 only */ + cf2_escHSTEM3, /* 2 T1 only */ cf2_escAND, /* 3 */ cf2_escOR, /* 4 */ cf2_escNOT, /* 5 */ - cf2_escRESERVED_6, /* 6 */ - cf2_escRESERVED_7, /* 7 */ + cf2_escSEAC, /* 6 T1 only */ + cf2_escSBW, /* 7 T1 only */ cf2_escRESERVED_8, /* 8 */ cf2_escABS, /* 9 */ cf2_escADD, /* 10 like otherADD */ @@ -248,8 +250,8 @@ cf2_escRESERVED_13, /* 13 */ cf2_escNEG, /* 14 */ cf2_escEQ, /* 15 */ - cf2_escRESERVED_16, /* 16 */ - cf2_escRESERVED_17, /* 17 */ + cf2_escCALLOTHERSUBR,/* 16 T1 only */ + cf2_escPOP, /* 17 T1 only */ cf2_escDROP, /* 18 */ cf2_escRESERVED_19, /* 19 */ cf2_escPUT, /* 20 like otherPUT */ @@ -265,7 +267,7 @@ cf2_escROLL, /* 30 */ cf2_escRESERVED_31, /* 31 */ cf2_escRESERVED_32, /* 32 */ - cf2_escRESERVED_33, /* 33 */ + cf2_escSETCURRENTPT, /* 33 T1 only */ cf2_escHFLEX, /* 34 */ cf2_escFLEX, /* 35 */ cf2_escHFLEX1, /* 36 */ @@ -290,10 +292,13 @@ /* variable accumulates delta values from operand stack */ CF2_Fixed position = hintOffset; + if ( font->isT1 && !font->decoder->flex_state && !*haveWidth ) + FT_ERROR(( "cf2_doStems (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); - if ( hasWidthArg && !*haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + - cf2_getNominalWidthX( font->decoder ); + if ( !font->isT1 && hasWidthArg && !*haveWidth ) + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + cf2_getNominalWidthX( font->decoder ) ); if ( font->decoder->width_only ) goto exit; @@ -476,7 +481,7 @@ FT_Error lastError = FT_Err_Ok; /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; + PS_Decoder* decoder = font->decoder; FT_Error* error = &font->error; FT_Memory memory = font->memory; @@ -484,6 +489,15 @@ CF2_Fixed scaleY = font->innerTransform.d; CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder ); + /* stuff for Type 1 */ + FT_Int known_othersubr_result_cnt = 0; + FT_Bool large_int = FALSE; + FT_Bool initial_map_ready = FALSE; + +#define PS_STORAGE_SIZE 3 + CF2_F16Dot16 results[PS_STORAGE_SIZE]; /* for othersubr results */ + FT_Int result_cnt = 0; + /* save this for hinting seac accents */ CF2_Fixed hintOriginY = curY; @@ -492,6 +506,7 @@ FT_Byte op1; /* first opcode byte */ CF2_F16Dot16 storage[CF2_STORAGE_SIZE]; /* for `put' and `get' */ + CF2_F16Dot16 flexStore[6]; /* for Type 1 flex */ /* instruction limit; 20,000,000 matches Avalon */ FT_UInt32 instructionLimit = 20000000UL; @@ -510,15 +525,12 @@ CF2_ArrStackRec vStemHintArray; CF2_HintMaskRec hintMask; -#ifdef __REACTOS__ - CF2_GlyphPathRec *glyphPath = malloc(sizeof(CF2_GlyphPathRec)); -/* Ugly but it allows us to reduce the diff */ -#define glyphPath (*glyphPath) -#else CF2_GlyphPathRec glyphPath; -#endif + FT_ZERO( &storage ); + FT_ZERO( &results ); + FT_ZERO( &flexStore ); /* initialize the remaining objects */ cf2_arrstack_init( &subrStack, @@ -611,6 +623,10 @@ /* main interpreter loop */ while ( 1 ) { + if ( font->isT1 ) + FT_ASSERT( known_othersubr_result_cnt == 0 || + result_cnt == 0 ); + if ( cf2_buf_isEnd( charstring ) ) { /* If we've reached the end of the charstring, simulate a */ @@ -632,6 +648,44 @@ op1 = cf2_cmdRESERVED_0; } + if ( font->isT1 ) + { + if ( !initial_map_ready && + !( op1 == cf2_cmdHSTEM || + op1 == cf2_cmdVSTEM || + op1 == cf2_cmdHSBW || + op1 == cf2_cmdCALLSUBR || + op1 == cf2_cmdRETURN || + op1 == cf2_cmdESC || + op1 == cf2_cmdENDCHAR || + op1 >= 32 /* Numbers */ ) ) + { + /* Skip outline commands first time round. */ + /* `endchar' will trigger initial hintmap build */ + /* and rewind the charstring. */ + cf2_stack_clear( opStack ); + continue; + } + + if ( result_cnt > 0 && + !( op1 == cf2_cmdCALLSUBR || + op1 == cf2_cmdRETURN || + op1 == cf2_cmdESC || + op1 >= 32 /* Numbers */ ) ) + { + /* all operands have been transferred by previous pops */ + result_cnt = 0; + } + + if ( large_int && !( op1 >= 32 || op1 == cf2_escDIV ) ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no `div' after large integer\n" )); + + large_int = FALSE; + } + } + /* check for errors once per loop */ if ( *error ) goto exit; @@ -647,8 +701,6 @@ { case cf2_cmdRESERVED_0: case cf2_cmdRESERVED_2: - case cf2_cmdRESERVED_9: - case cf2_cmdRESERVED_13: case cf2_cmdRESERVED_17: /* we may get here if we have a prior error */ FT_TRACE4(( " unknown op (%d)\n", op1 )); @@ -694,15 +746,15 @@ } /* check cached blend vector */ - if ( cff_blend_check_vector( &font->blend, - font->vsindex, - font->lenNDV, - font->NDV ) ) + if ( font->cffload->blend_check_vector( &font->blend, + font->vsindex, + font->lenNDV, + font->NDV ) ) { - lastError = cff_blend_build_vector( &font->blend, - font->vsindex, - font->lenNDV, - font->NDV ); + lastError = font->cffload->blend_build_vector( &font->blend, + font->vsindex, + font->lenNDV, + font->NDV ); if ( lastError ) goto exit; } @@ -725,22 +777,28 @@ case cf2_cmdHSTEM: FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" )); - /* never add hints after the mask is computed */ - if ( cf2_hintmask_isValid( &hintMask ) ) + if ( !font->isT1 ) { - FT_TRACE4(( "cf2_interpT2CharString:" - " invalid horizontal hint mask\n" )); - break; + /* never add hints after the mask is computed */ + /* except if in Type 1 mode (no hintmask op) */ + if ( cf2_hintmask_isValid( &hintMask ) ) + { + FT_TRACE4(( "cf2_interpT2CharString:" + " invalid horizontal hint mask\n" )); + break; + } } + /* add left-sidebearing correction in Type 1 mode */ cf2_doStems( font, opStack, &hStemHintArray, width, &haveWidth, - 0 ); + font->isT1 ? decoder->builder.left_bearing->y + : 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; break; @@ -749,22 +807,28 @@ case cf2_cmdVSTEM: FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" )); - /* never add hints after the mask is computed */ - if ( cf2_hintmask_isValid( &hintMask ) ) + if ( !font->isT1 ) { - FT_TRACE4(( "cf2_interpT2CharString:" - " invalid vertical hint mask\n" )); - break; + /* never add hints after the mask is computed */ + /* except if in Type 1 mode (no hintmask op) */ + if ( cf2_hintmask_isValid( &hintMask ) ) + { + FT_TRACE4(( "cf2_interpT2CharString:" + " invalid vertical hint mask\n" )); + break; + } } + /* add left-sidebearing correction in Type 1 mode */ cf2_doStems( font, opStack, &vStemHintArray, width, &haveWidth, - 0 ); + font->isT1 ? decoder->builder.left_bearing->x + : 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; break; @@ -772,6 +836,10 @@ case cf2_cmdVMOVETO: FT_TRACE4(( " vmoveto\n" )); + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), nominalWidthX ); @@ -779,7 +847,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); @@ -883,6 +951,20 @@ } continue; /* no need to clear stack again */ + case cf2_cmdCLOSEPATH: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (%d)\n", op1 )); + else + { + FT_TRACE4(( " closepath" )); + + /* if there is no path, `closepath' is a no-op */ + ps_builder_close_contour( &decoder->builder ); + + haveWidth = TRUE; + } + break; + case cf2_cmdCALLGSUBR: case cf2_cmdCALLSUBR: { @@ -892,7 +974,8 @@ FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr" : " callsubr" )); - if ( charstringIndex > CF2_MAX_SUBR ) + if ( ( !font->isT1 && charstringIndex > CF2_MAX_SUBR ) || + ( font->isT1 && charstringIndex > T1_MAX_SUBRS_CALLS ) ) { /* max subr plus one for charstring */ lastError = FT_THROW( Invalid_Glyph_Format ); @@ -908,6 +991,18 @@ /* set up the new CFF region and pointer */ subrNum = cf2_stack_popInt( opStack ); + if ( font->isT1 && decoder->locals_hash ) + { + size_t* val = ft_hash_num_lookup( subrNum, + decoder->locals_hash ); + + + if ( val ) + subrNum = *val; + else + subrNum = -1; + } + switch ( op1 ) { case cf2_cmdCALLGSUBR: @@ -1065,20 +1160,13 @@ } continue; - /* these opcodes are reserved in both CFF & CFF2 */ - case cf2_escRESERVED_1: - case cf2_escRESERVED_2: - case cf2_escRESERVED_6: - case cf2_escRESERVED_7: + /* these opcodes are always reserved */ case cf2_escRESERVED_8: case cf2_escRESERVED_13: - case cf2_escRESERVED_16: - case cf2_escRESERVED_17: case cf2_escRESERVED_19: case cf2_escRESERVED_25: case cf2_escRESERVED_31: case cf2_escRESERVED_32: - case cf2_escRESERVED_33: FT_TRACE4(( " unknown op (12, %d)\n", op2 )); break; @@ -1086,9 +1174,15 @@ { if ( font->isCFF2 || op2 >= cf2_escRESERVED_38 ) FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else if ( font->isT1 && result_cnt > 0 && op2 != cf2_escPOP ) + { + /* all operands have been transferred by previous pops */ + result_cnt = 0; + } else { - /* second switch for 2-byte operators handles just CFF */ + /* second switch for 2-byte operators handles */ + /* CFF and Type 1 */ switch ( op2 ) { @@ -1098,6 +1192,58 @@ break; + case cf2_escVSTEM3: + case cf2_escHSTEM3: + /* + * Type 1: Type 2: + * x0 dx0 x1 dx1 x2 dx2 vstem3 x dx {dxa dxb}* vstem + * y0 dy0 y1 dy1 y2 dy2 hstem3 y dy {dya dyb}* hstem + * relative to lsb point relative to zero + * + */ + { + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + CF2_F16Dot16 v0, v1, v2; + + FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 ); + + + FT_TRACE4(( isV ? " vstem3\n" + : " hstem3\n" )); + + FT_ASSERT( cf2_stack_count( opStack ) == 6 ); + + v0 = cf2_stack_getReal( opStack, 0 ); + v1 = cf2_stack_getReal( opStack, 2 ); + v2 = cf2_stack_getReal( opStack, 4 ); + + cf2_stack_setReal( + opStack, 2, + SUB_INT32( SUB_INT32( v1, v0 ), + cf2_stack_getReal( opStack, 1 ) ) ); + cf2_stack_setReal( + opStack, 4, + SUB_INT32( SUB_INT32( v2, v1 ), + cf2_stack_getReal( opStack, 3 ) ) ); + + /* add left-sidebearing correction */ + cf2_doStems( font, + opStack, + isV ? &vStemHintArray : &hStemHintArray, + width, + &haveWidth, + isV ? decoder->builder.left_bearing->x + : decoder->builder.left_bearing->y ); + + if ( decoder->width_only ) + goto exit; + } + } + break; + case cf2_escAND: { CF2_F16Dot16 arg1; @@ -1141,6 +1287,239 @@ } continue; /* do not clear the stack */ + case cf2_escSEAC: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_Error error2; + CF2_Int bchar_index, achar_index; + FT_Vector left_bearing, advance; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + T1_Face face = (T1_Face)decoder->builder.face; +#endif + CF2_BufferRec component; + CF2_Fixed dummyWidth; + + CF2_Int achar = cf2_stack_popInt( opStack ); + CF2_Int bchar = cf2_stack_popInt( opStack ); + + FT_Pos ady = cf2_stack_popFixed ( opStack ); + FT_Pos adx = cf2_stack_popFixed ( opStack ); + FT_Pos asb = cf2_stack_popFixed ( opStack ); + + + FT_TRACE4(( " seac\n" )); + + if ( doingSeac ) + { + FT_ERROR(( " nested seac\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* nested seac */ + } + + if ( decoder->builder.metrics_only ) + { + FT_ERROR(( " unexpected seac\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* unexpected seac */ + } + + /* `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(( + "cf2_interpT2CharString: (Type 1 seac)" + " glyph names table not available in this font\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* seac weirdness */ + adx += decoder->builder.left_bearing->x; + +#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_ps( + decoder, bchar ); + achar_index = t1_lookup_glyph_by_stdcharcode_ps( + decoder, achar ); + } + + if ( bchar_index < 0 || achar_index < 0 ) + { + FT_ERROR(( + "cf2_interpT2CharString: (Type 1 seac)" + " invalid seac character code arguments\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* if we are trying to load a composite glyph, */ + /* do not load the accent character and return */ + /* the array of subglyphs. */ + if ( decoder->builder.no_recurse ) + { + FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; + FT_GlyphLoader loader = glyph->internal->loader; + FT_SubGlyph subg; + + + /* reallocate subglyph array if necessary */ + error2 = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + + subg = loader->current.subglyphs; + + /* subglyph 0 = base character */ + subg->index = bchar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | + FT_SUBGLYPH_FLAG_USE_MY_METRICS; + subg->arg1 = 0; + subg->arg2 = 0; + subg++; + + /* subglyph 1 = accent character */ + subg->index = achar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; + 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; + glyph->subglyphs = loader->base.subglyphs; + glyph->format = FT_GLYPH_FORMAT_COMPOSITE; + + loader->current.num_subglyphs = 2; + + goto exit; + } + + /* First load `bchar' in builder */ + /* now load the unscaled outline */ + + /* prepare loader */ + FT_GlyphLoader_Prepare( decoder->builder.loader ); + + error2 = cf2_getT1SeacComponent( decoder, + (FT_UInt)bchar_index, + &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + 0, + 0, + &dummyWidth ); + cf2_freeT1SeacComponent( decoder, &component ); + + /* save the left bearing and width of the base */ + /* character as they will be erased by the next load */ + + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + + decoder->builder.left_bearing->x = 0; + decoder->builder.left_bearing->y = 0; + + /* Now load `achar' on top of */ + /* the base outline */ + + error2 = cf2_getT1SeacComponent( decoder, + (FT_UInt)achar_index, + &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + adx - asb, + ady, + &dummyWidth ); + cf2_freeT1SeacComponent( decoder, &component ); + + /* restore the left side bearing and */ + /* advance width of the base character */ + + *decoder->builder.left_bearing = left_bearing; + *decoder->builder.advance = advance; + + goto exit; + } + break; + + case cf2_escSBW: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + CF2_Fixed lsb_x, lsb_y; + PS_Builder* builder; + + + FT_TRACE4(( " sbw" )); + + builder = &decoder->builder; + + builder->advance->y = cf2_stack_popFixed( opStack ); + builder->advance->x = cf2_stack_popFixed( opStack ); + + lsb_y = cf2_stack_popFixed( opStack ); + lsb_x = cf2_stack_popFixed( opStack ); + + builder->left_bearing->x = + ADD_INT32( builder->left_bearing->x, lsb_x ); + builder->left_bearing->y = + ADD_INT32( builder->left_bearing->y, lsb_y ); + + haveWidth = TRUE; + + /* the `metrics_only' indicates that we only want */ + /* to compute the glyph's metrics (lsb + advance */ + /* width), not load the rest of it; so exit */ + /* immediately */ + if ( builder->metrics_only ) + goto exit; + + if ( initial_map_ready ) + { + curX = ADD_INT32( curX, lsb_x ); + curY = ADD_INT32( curY, lsb_y ); + } + } + break; + case cf2_escABS: { CF2_F16Dot16 arg; @@ -1198,11 +1577,22 @@ FT_TRACE4(( " div\n" )); - divisor = cf2_stack_popFixed( opStack ); - dividend = cf2_stack_popFixed( opStack ); + if ( font->isT1 && large_int ) + { + divisor = (CF2_F16Dot16)cf2_stack_popInt( opStack ); + dividend = (CF2_F16Dot16)cf2_stack_popInt( opStack ); + + large_int = FALSE; + } + else + { + divisor = cf2_stack_popFixed( opStack ); + dividend = cf2_stack_popFixed( opStack ); + } cf2_stack_pushFixed( opStack, FT_DivFix( dividend, divisor ) ); + } continue; /* do not clear the stack */ @@ -1237,6 +1627,534 @@ } continue; /* do not clear the stack */ + case cf2_escCALLOTHERSUBR: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + CF2_Int subr_no; + CF2_Int arg_cnt; + CF2_UInt count; + CF2_UInt opIdx = 0; + + + FT_TRACE4(( " callothersubr\n" )); + + subr_no = cf2_stack_popInt( opStack ); + arg_cnt = cf2_stack_popInt( opStack ); + + /*******************************************************/ + /* */ + /* remove all operands to callothersubr from the stack */ + /* */ + /* for handled othersubrs, where we know the number of */ + /* arguments, we increase the stack by the value of */ + /* known_othersubr_result_cnt */ + /* */ + /* for unhandled othersubrs the following pops adjust */ + /* the stack pointer as necessary */ + + count = cf2_stack_count( opStack ); + FT_ASSERT( (CF2_UInt)arg_cnt <= count ); + + opIdx += count - (CF2_UInt)arg_cnt; + + known_othersubr_result_cnt = 0; + result_cnt = 0; + + /* XXX TODO: The checks to `arg_count == ' */ + /* might not be correct; an othersubr expects a */ + /* certain number of operands on the PostScript stack */ + /* (as opposed to the T1 stack) but it doesn't have to */ + /* put them there by itself; previous othersubrs might */ + /* have left the operands there if they were not */ + /* followed by an appropriate number of pops */ + /* */ + /* On the other hand, Adobe Reader 7.0.8 for Linux */ + /* doesn't accept a font that contains charstrings */ + /* like */ + /* */ + /* 100 200 2 20 callothersubr */ + /* 300 1 20 callothersubr pop */ + /* */ + /* Perhaps this is the reason why BuildCharArray */ + /* exists. */ + + switch ( subr_no ) + { + case 0: /* end flex feature */ + if ( arg_cnt != 3 ) + goto Unexpected_OtherSubr; + + if ( initial_map_ready && + ( !decoder->flex_state || + decoder->num_flex_vectors != 7 ) ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " unexpected flex end\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* the two `results' are popped */ + /* by the following setcurrentpoint */ + cf2_stack_pushFixed( opStack, curX ); + cf2_stack_pushFixed( opStack, curY ); + known_othersubr_result_cnt = 2; + break; + + case 1: /* start flex feature */ + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + if ( !initial_map_ready ) + break; + + if ( ps_builder_check_points( &decoder->builder, 6 ) ) + goto exit; + + decoder->flex_state = 1; + decoder->num_flex_vectors = 0; + break; + + case 2: /* add flex vectors */ + { + FT_Int idx; + FT_Int idx2; + + + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + if ( !initial_map_ready ) + break; + + if ( !decoder->flex_state ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " missing flex start\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* note that we should not add a point for */ + /* index 0; this will move our current position */ + /* to the flex point without adding any point */ + /* to the outline */ + idx = decoder->num_flex_vectors++; + if ( idx > 0 && idx < 7 ) + { + /* in malformed fonts it is possible to have */ + /* other opcodes in the middle of a flex (which */ + /* don't increase `num_flex_vectors'); we thus */ + /* have to check whether we can add a point */ + + if ( ps_builder_check_points( &decoder->builder, + 1 ) ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* map: 1->2 2->4 3->6 4->2 5->4 6->6 */ + idx2 = ( idx > 3 ? idx - 3 : idx ) * 2; + + flexStore[idx2 - 2] = curX; + flexStore[idx2 - 1] = curY; + + if ( idx == 3 || idx == 6 ) + cf2_glyphpath_curveTo( &glyphPath, + flexStore[0], + flexStore[1], + flexStore[2], + flexStore[3], + flexStore[4], + flexStore[5] ); + } + } + break; + + case 3: /* change hints */ + if ( arg_cnt != 1 ) + goto Unexpected_OtherSubr; + + if ( initial_map_ready ) + { + /* do not clear hints if initial hintmap */ + /* is not ready - we need to collate all */ + cf2_arrstack_clear( &vStemHintArray ); + cf2_arrstack_clear( &hStemHintArray ); + + cf2_hintmask_init( &hintMask, error ); + hintMask.isValid = FALSE; + hintMask.isNew = TRUE; + } + + known_othersubr_result_cnt = 1; + break; + + case 12: + case 13: + /* counter control hints, clear stack */ + cf2_stack_clear( opStack ); + break; + + case 14: + case 15: + case 16: + case 17: + case 18: /* multiple masters */ + { + PS_Blend blend = decoder->blend; + FT_UInt num_points, nn, mm; + CF2_UInt delta; + CF2_UInt values; + + + if ( !blend ) + { + FT_ERROR(( + "cf2_interpT2CharString:" + " unexpected multiple masters operator\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + num_points = (FT_UInt)subr_no - 13 + + ( subr_no == 18 ); + if ( arg_cnt != (FT_Int)( num_points * + blend->num_designs ) ) + { + FT_ERROR(( + "cf2_interpT2CharString:" + " incorrect number of multiple masters arguments\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* We want to compute */ + /* */ + /* a0*w0 + a1*w1 + ... + ak*wk */ + /* */ + /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */ + /* */ + /* However, given that w0 + w1 + ... + wk == 1, we */ + /* can rewrite it easily as */ + /* */ + /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */ + /* */ + /* where k == num_designs-1. */ + /* */ + /* I guess that's why it's written in this `compact' */ + /* form. */ + /* */ + delta = opIdx + num_points; + values = opIdx; + for ( nn = 0; nn < num_points; nn++ ) + { + CF2_Fixed tmp = cf2_stack_getReal( opStack, + values ); + + + for ( mm = 1; mm < blend->num_designs; mm++ ) + tmp = ADD_INT32( tmp, + FT_MulFix( + cf2_stack_getReal( opStack, + delta++ ), + blend->weight_vector[mm] ) ); + + cf2_stack_setReal( opStack, values++, tmp ); + } + cf2_stack_pop( opStack, + (CF2_UInt)arg_cnt - num_points ); + + known_othersubr_result_cnt = (FT_Int)num_points; + break; + } + + case 19: + /* 1 19 callothersubr */ + /* ==> replace elements starting from index */ + /* cvi( ) of BuildCharArray with */ + /* WeightVector */ + { + FT_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 1 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || + (FT_UInt)idx + blend->num_designs > + decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + ft_memcpy( &decoder->buildchar[idx], + blend->weight_vector, + blend->num_designs * + sizeof ( blend->weight_vector[0] ) ); + } + break; + + case 20: + /* 2 20 callothersubr pop */ + /* ==> push + onto T1 stack */ + { + CF2_F16Dot16 summand1; + CF2_F16Dot16 summand2; + + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + summand2 = cf2_stack_popFixed( opStack ); + summand1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + ADD_INT32( summand1, + summand2 ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 21: + /* 2 21 callothersubr pop */ + /* ==> push - onto T1 stack */ + { + CF2_F16Dot16 minuend; + CF2_F16Dot16 subtrahend; + + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + subtrahend = cf2_stack_popFixed( opStack ); + minuend = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + SUB_INT32( minuend, + subtrahend ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 22: + /* 2 22 callothersubr pop */ + /* ==> push * onto T1 stack */ + { + CF2_F16Dot16 factor1; + CF2_F16Dot16 factor2; + + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + factor2 = cf2_stack_popFixed( opStack ); + factor1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + FT_MulFix( factor1, factor2 ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 23: + /* 2 23 callothersubr pop */ + /* ==> push / onto T1 stack */ + { + CF2_F16Dot16 dividend; + CF2_F16Dot16 divisor; + + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + divisor = cf2_stack_popFixed( opStack ); + dividend = cf2_stack_popFixed( opStack ); + + if ( divisor == 0 ) + goto Unexpected_OtherSubr; + + cf2_stack_pushFixed( opStack, + FT_DivFix( dividend, + divisor ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 24: + /* 2 24 callothersubr */ + /* ==> set BuildCharArray[cvi( )] = */ + { + CF2_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 2 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || + (FT_UInt)idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + decoder->buildchar[idx] = + cf2_stack_popFixed( opStack ); + } + break; + + case 25: + /* 1 25 callothersubr pop */ + /* ==> push BuildCharArray[cvi( idx )] */ + /* onto T1 stack */ + { + CF2_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 1 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || + (FT_UInt)idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + cf2_stack_pushFixed( opStack, + decoder->buildchar[idx] ); + known_othersubr_result_cnt = 1; + } + break; + +#if 0 + case 26: + /* mark */ + /* ==> set BuildCharArray[cvi( )] = , */ + /* leave mark on T1 stack */ + /* */ + /* ==> set BuildCharArray[cvi( )] = */ + XXX which routine has left its mark on the + XXX (PostScript) stack?; + break; +#endif + + case 27: + /* 4 27 callothersubr pop */ + /* ==> push onto T1 stack if <= , */ + /* otherwise push */ + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + CF2_F16Dot16 cond1; + CF2_F16Dot16 cond2; + + + if ( arg_cnt != 4 ) + goto Unexpected_OtherSubr; + + cond2 = cf2_stack_popFixed( opStack ); + cond1 = cf2_stack_popFixed( opStack ); + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + cond1 <= cond2 ? arg1 : arg2 ); + known_othersubr_result_cnt = 1; + } + break; + + case 28: + /* 0 28 callothersubr pop */ + /* ==> push random value from interval [0, 1) */ + /* onto stack */ + { + CF2_F16Dot16 r; + + + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + r = (CF2_F16Dot16) + ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); + + decoder->current_subfont->random = + cff_random( decoder->current_subfont->random ); + + cf2_stack_pushFixed( opStack, r ); + known_othersubr_result_cnt = 1; + } + break; + + default: + if ( arg_cnt >= 0 && subr_no >= 0 ) + { + FT_Int i; + + + FT_ERROR(( + "cf2_interpT2CharString (Type 1 mode):" + " unknown othersubr [%d %d], wish me luck\n", + arg_cnt, subr_no )); + + /* store the unused args */ + /* for this unhandled OtherSubr */ + + if ( arg_cnt > PS_STORAGE_SIZE ) + arg_cnt = PS_STORAGE_SIZE; + result_cnt = arg_cnt; + + for ( i = 1; i <= arg_cnt; i++ ) + results[result_cnt - i] = + cf2_stack_popFixed( opStack ); + + break; + } + /* fall through */ + + Unexpected_OtherSubr: + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " invalid othersubr [%d %d]\n", + arg_cnt, subr_no )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + } + continue; /* do not clear the stack */ + + case cf2_escPOP: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_TRACE4(( " pop" )); + + if ( known_othersubr_result_cnt > 0 ) + { + known_othersubr_result_cnt--; + /* ignore, we pushed the operands ourselves */ + continue; + } + + if ( result_cnt == 0 ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no more operands for othersubr\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + result_cnt--; + cf2_stack_pushFixed( opStack, results[result_cnt] ); + } + continue; /* do not clear the stack */ + case cf2_escDROP: FT_TRACE4(( " drop\n" )); @@ -1438,6 +2356,48 @@ } continue; /* do not clear the stack */ + case cf2_escSETCURRENTPT: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_TRACE4(( " setcurrentpoint" )); + + if ( !initial_map_ready ) + break; + + /* 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. */ + + /* 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(( "cf2_interpT2CharString:" + " unexpected `setcurrentpoint'\n" )); + goto Syntax_Error; + } + else + ... +#endif + + curY = cf2_stack_popFixed( opStack ); + curX = cf2_stack_popFixed( opStack ); + + decoder->flex_state = 0; + } + break; + } /* end of 2nd switch checking op2 */ } } @@ -1446,9 +2406,80 @@ break; + case cf2_cmdHSBW: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (%d)\n", op1 )); + else + { + CF2_Fixed lsb_x; + PS_Builder* builder; + + + FT_TRACE4(( " hsbw" )); + + builder = &decoder->builder; + + builder->advance->x = cf2_stack_popFixed( opStack ); + builder->advance->y = 0; + + lsb_x = cf2_stack_popFixed( opStack ); + + builder->left_bearing->x = ADD_INT32( builder->left_bearing->x, + lsb_x ); + + haveWidth = TRUE; + + /* the `metrics_only' indicates that we only want to compute */ + /* the glyph's metrics (lsb + advance width), not load the */ + /* rest of it; so exit immediately */ + if ( builder->metrics_only ) + goto exit; + + if ( initial_map_ready ) + curX = ADD_INT32( curX, lsb_x ); + } + break; + case cf2_cmdENDCHAR: FT_TRACE4(( " endchar\n" )); + if ( font->isT1 && !initial_map_ready ) + { + FT_TRACE5(( "cf2_interpT2CharString (Type 1 mode): " + "Build initial hintmap, rewinding...\n" )); + + /* trigger initial hintmap build */ + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + initial_map_ready = TRUE; + + /* change hints routine - clear for rewind */ + cf2_arrstack_clear( &vStemHintArray ); + cf2_arrstack_clear( &hStemHintArray ); + + cf2_hintmask_init( &hintMask, error ); + hintMask.isValid = FALSE; + hintMask.isNew = TRUE; + + /* rewind charstring */ + /* some charstrings use endchar from a final subroutine call */ + /* without returning, detect these and exit to the top level */ + /* charstring */ + while ( charstringIndex > 0 ) + { + FT_TRACE4(( " return (leaving level %d)\n", charstringIndex )); + + /* restore position in previous charstring */ + charstring = (CF2_Buffer) + cf2_arrstack_getPointer( + &subrStack, + (CF2_UInt)--charstringIndex ); + } + charstring->ptr = charstring->start; + + break; + } + if ( cf2_stack_count( opStack ) == 1 || cf2_stack_count( opStack ) == 5 ) { @@ -1460,14 +2491,15 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; /* close path if still open */ cf2_glyphpath_closeOpenPath( &glyphPath ); - /* disable seac for CFF2 (charstring ending with args on stack) */ - if ( !font->isCFF2 && cf2_stack_count( opStack ) > 1 ) + /* disable seac for CFF2 and Type1 */ + /* (charstring ending with args on stack) */ + if ( !font->isCFF2 && !font->isT1 && cf2_stack_count( opStack ) > 1 ) { /* must be either 4 or 5 -- */ /* this is a (deprecated) implied `seac' operator */ @@ -1548,7 +2580,7 @@ &haveWidth, 0 ); - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; if ( op1 == cf2_cmdHINTMASK ) @@ -1574,13 +2606,7 @@ * discard `counterMask' and `counterHintMap'. * */ -#ifdef __REACTOS__ - CF2_HintMapRec *counterHintMap = malloc(sizeof(CF2_HintMapRec)); -/* Ugly but it allows us to reduce the diff */ -#define counterHintMap (*counterHintMap) -#else CF2_HintMapRec counterHintMap; -#endif CF2_HintMaskRec counterMask; @@ -1601,15 +2627,16 @@ &counterMask, 0, FALSE ); -#ifdef __REACTOS__ - free(&counterHintMap); -#endif } break; case cf2_cmdRMOVETO: FT_TRACE4(( " rmoveto\n" )); + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), nominalWidthX ); @@ -1617,19 +2644,24 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if ( !decoder->flex_state ) + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); break; case cf2_cmdHMOVETO: FT_TRACE4(( " hmoveto\n" )); + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), nominalWidthX ); @@ -1637,7 +2669,7 @@ /* width is defined or default after this */ haveWidth = TRUE; - if ( font->decoder->width_only ) + if ( decoder->width_only ) goto exit; curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); @@ -1933,9 +2965,42 @@ ( byte3 << 8 ) | byte4 ); - FT_TRACE4(( " %.5f", v / 65536.0 )); + /* + * For Type 1: + * + * 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 ` div + * div' or div div'. This is probably + * not allowed anyway. + * + * + div is not checked but should not be + * allowed as the large value remains untouched. + * + */ + if ( font->isT1 ) + { + if ( v > 32000 || v < -32000 ) + { + if ( large_int ) + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no `div' after large integer\n" )); + else + large_int = TRUE; + } - cf2_stack_pushFixed( opStack, v ); + FT_TRACE4(( " %d", v )); + + cf2_stack_pushInt( opStack, (CF2_Int)v ); + } + else + { + FT_TRACE4(( " %.5fF", v / 65536.0 )); + + cf2_stack_pushFixed( opStack, v ); + } } } continue; /* don't clear stack */ @@ -1966,12 +3031,6 @@ FT_TRACE4(( "\n" )); -#ifdef __REACTOS__ - free(&glyphPath); -#undef counterHintMap -#undef glyphPath -#endif - return; } diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2intrp.h b/sdk/lib/3rdparty/freetype/src/psaux/psintrp.h similarity index 95% rename from sdk/lib/3rdparty/freetype/src/cff/cf2intrp.h rename to sdk/lib/3rdparty/freetype/src/psaux/psintrp.h index ec030e89444..4790aaa302a 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2intrp.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psintrp.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.h */ +/* psintrp.h */ /* */ /* Adobe's CFF Interpreter (specification). */ /* */ @@ -36,12 +36,12 @@ /***************************************************************************/ -#ifndef CF2INTRP_H_ -#define CF2INTRP_H_ +#ifndef PSINTRP_H_ +#define PSINTRP_H_ -#include "cf2ft.h" -#include "cf2hints.h" +#include "psft.h" +#include "pshints.h" FT_BEGIN_HEADER @@ -77,7 +77,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2INTRP_H_ */ +#endif /* PSINTRP_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/psobjs.c b/sdk/lib/3rdparty/freetype/src/psaux/psobjs.c index f04edea411a..f54bc7e4164 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/psobjs.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psobjs.c @@ -4,7 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,11 +20,13 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H +#include FT_DRIVER_H #include "psobjs.h" #include "psconv.h" #include "psauxerr.h" +#include "psauxmod.h" /*************************************************************************/ @@ -1758,6 +1760,573 @@ } + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* */ + /* cff_builder_init */ + /* */ + /* */ + /* Initializes a given glyph builder. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* glyph :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting is active. */ + /* */ + FT_LOCAL_DEF( void ) + cff_builder_init( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ) + { + builder->path_begun = 0; + builder->load_points = 1; + + builder->face = face; + builder->glyph = glyph; + builder->memory = face->root.memory; + + if ( glyph ) + { + FT_GlyphLoader loader = glyph->root.internal->loader; + + + builder->loader = loader; + builder->base = &loader->base.outline; + builder->current = &loader->current.outline; + FT_GlyphLoader_Rewind( loader ); + + builder->hints_globals = NULL; + builder->hints_funcs = NULL; + + if ( hinting && size ) + { + FT_Size ftsize = FT_SIZE( size ); + CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; + + if ( internal ) + { + builder->hints_globals = (void *)internal->topfont; + builder->hints_funcs = glyph->root.internal->glyph_hints; + } + } + } + + builder->pos_x = 0; + builder->pos_y = 0; + + builder->left_bearing.x = 0; + builder->left_bearing.y = 0; + builder->advance.x = 0; + builder->advance.y = 0; + + builder->funcs = cff_builder_funcs; + } + + + /*************************************************************************/ + /* */ + /* */ + /* cff_builder_done */ + /* */ + /* */ + /* Finalizes a given glyph builder. Its contents can still be used */ + /* after the call, but the function saves important information */ + /* within the corresponding glyph slot. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to finalize. */ + /* */ + FT_LOCAL_DEF( void ) + cff_builder_done( CFF_Builder* builder ) + { + CFF_GlyphSlot glyph = builder->glyph; + + + if ( glyph ) + glyph->root.outline = *builder->base; + } + + + /* check that there is enough space for `count' more points */ + FT_LOCAL_DEF( FT_Error ) + cff_check_points( CFF_Builder* builder, + FT_Int count ) + { + return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); + } + + + /* add a new point, do not check space */ + FT_LOCAL_DEF( void ) + cff_builder_add_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ) + { + FT_Outline* outline = builder->current; + + + if ( builder->load_points ) + { + FT_Vector* point = outline->points + outline->n_points; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); + + + if ( driver->hinting_engine == FT_HINTING_FREETYPE ) + { + point->x = x >> 16; + point->y = y >> 16; + } + else +#endif + { + /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ + point->x = x >> 10; + point->y = y >> 10; + } + *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); + } + + outline->n_points++; + } + + + /* check space for a new on-curve point, then add it */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_add_point1( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error; + + + error = cff_check_points( builder, 1 ); + if ( !error ) + cff_builder_add_point( builder, x, y, 1 ); + + return error; + } + + + /* check space for a new contour, then add it */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_add_contour( CFF_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Error error; + + + if ( !builder->load_points ) + { + outline->n_contours++; + return FT_Err_Ok; + } + + error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); + if ( !error ) + { + if ( outline->n_contours > 0 ) + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + + outline->n_contours++; + } + + return error; + } + + + /* if a path was begun, add its first on-curve point */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_start_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error = FT_Err_Ok; + + + /* test whether we are building a new contour */ + if ( !builder->path_begun ) + { + builder->path_begun = 1; + error = cff_builder_add_contour( builder ); + if ( !error ) + error = cff_builder_add_point1( builder, x, y ); + } + + return error; + } + + + /* close the current contour */ + FT_LOCAL_DEF( void ) + cff_builder_close_contour( CFF_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Int first; + + + if ( !outline ) + return; + + 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_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; + + + /* `delete' last point only if it coincides with the first */ + /* point and if it is not a control point (which can happen). */ + if ( p1->x == p2->x && p1->y == p2->y ) + if ( *control == FT_CURVE_TAG_ON ) + outline->n_points--; + } + + if ( outline->n_contours > 0 ) + { + /* 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 ); + } + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* */ + /* ps_builder_init */ + /* */ + /* */ + /* Initializes a given glyph builder. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* glyph :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting should be applied. */ + /* */ + FT_LOCAL_DEF( void ) + ps_builder_init( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ) + { + FT_ZERO( ps_builder ); + + if ( is_t1 ) + { + T1_Builder t1builder = (T1_Builder)builder; + + + ps_builder->memory = t1builder->memory; + ps_builder->face = (FT_Face)t1builder->face; + ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph; + ps_builder->loader = t1builder->loader; + ps_builder->base = t1builder->base; + ps_builder->current = t1builder->current; + + ps_builder->pos_x = &t1builder->pos_x; + ps_builder->pos_y = &t1builder->pos_y; + + ps_builder->left_bearing = &t1builder->left_bearing; + ps_builder->advance = &t1builder->advance; + + ps_builder->bbox = &t1builder->bbox; + ps_builder->path_begun = 0; + ps_builder->load_points = t1builder->load_points; + ps_builder->no_recurse = t1builder->no_recurse; + + ps_builder->metrics_only = t1builder->metrics_only; + } + else + { + CFF_Builder* cffbuilder = (CFF_Builder*)builder; + + + ps_builder->memory = cffbuilder->memory; + ps_builder->face = (FT_Face)cffbuilder->face; + ps_builder->glyph = cffbuilder->glyph; + ps_builder->loader = cffbuilder->loader; + ps_builder->base = cffbuilder->base; + ps_builder->current = cffbuilder->current; + + ps_builder->pos_x = &cffbuilder->pos_x; + ps_builder->pos_y = &cffbuilder->pos_y; + + ps_builder->left_bearing = &cffbuilder->left_bearing; + ps_builder->advance = &cffbuilder->advance; + + ps_builder->bbox = &cffbuilder->bbox; + ps_builder->path_begun = cffbuilder->path_begun; + ps_builder->load_points = cffbuilder->load_points; + ps_builder->no_recurse = cffbuilder->no_recurse; + + ps_builder->metrics_only = cffbuilder->metrics_only; + } + + ps_builder->is_t1 = is_t1; + ps_builder->funcs = ps_builder_funcs; + } + + + /*************************************************************************/ + /* */ + /* */ + /* ps_builder_done */ + /* */ + /* */ + /* Finalizes a given glyph builder. Its contents can still be used */ + /* after the call, but the function saves important information */ + /* within the corresponding glyph slot. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to finalize. */ + /* */ + FT_LOCAL_DEF( void ) + ps_builder_done( PS_Builder* builder ) + { + CFF_GlyphSlot glyph = builder->glyph; + + + if ( glyph ) + glyph->root.outline = *builder->base; + } + + + /* check that there is enough space for `count' more points */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_check_points( PS_Builder* builder, + FT_Int count ) + { + return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); + } + + + /* add a new point, do not check space */ + FT_LOCAL_DEF( void ) + ps_builder_add_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ) + { + FT_Outline* outline = builder->current; + + + if ( builder->load_points ) + { + FT_Vector* point = outline->points + outline->n_points; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); + + + if ( !builder->is_t1 && + driver->hinting_engine == FT_HINTING_FREETYPE ) + { + point->x = x >> 16; + point->y = y >> 16; + } + else +#endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE +#ifndef CFF_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); +#endif + if ( builder->is_t1 && + driver->hinting_engine == FT_HINTING_FREETYPE ) + { + point->x = FIXED_TO_INT( x ); + point->y = FIXED_TO_INT( y ); + } + else +#endif + { + /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ + point->x = x >> 10; + point->y = y >> 10; + } + *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); + } + outline->n_points++; + } + + + /* check space for a new on-curve point, then add it */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_add_point1( PS_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error; + + + error = ps_builder_check_points( builder, 1 ); + if ( !error ) + ps_builder_add_point( builder, x, y, 1 ); + + return error; + } + + + /* check space for a new contour, then add it */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_add_contour( PS_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Error error; + + + /* this might happen in invalid fonts */ + if ( !outline ) + { + FT_ERROR(( "ps_builder_add_contour: no outline to add points to\n" )); + return FT_THROW( Invalid_File_Format ); + } + + if ( !builder->load_points ) + { + outline->n_contours++; + return FT_Err_Ok; + } + + error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); + if ( !error ) + { + if ( outline->n_contours > 0 ) + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + + outline->n_contours++; + } + + return error; + } + + + /* if a path was begun, add its first on-curve point */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_start_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error = FT_Err_Ok; + + + /* test whether we are building a new contour */ + if ( !builder->path_begun ) + { + builder->path_begun = 1; + error = ps_builder_add_contour( builder ); + if ( !error ) + error = ps_builder_add_point1( builder, x, y ); + } + + return error; + } + + + /* close the current contour */ + FT_LOCAL_DEF( void ) + ps_builder_close_contour( PS_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Int first; + + + if ( !outline ) + return; + + first = outline->n_contours <= 1 + ? 0 : outline->contours[outline->n_contours - 2] + 1; + + /* in malformed fonts it can happen that a contour was started */ + /* but no points were added */ + if ( outline->n_contours && first == outline->n_points ) + { + outline->n_contours--; + return; + } + + /* We must not include the last point in the path if it */ + /* is located on the first point. */ + if ( outline->n_points > 1 ) + { + FT_Vector* p1 = outline->points + first; + FT_Vector* p2 = outline->points + outline->n_points - 1; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; + + + /* `delete' last point only if it coincides with the first */ + /* point and it is not a control point (which can happen). */ + if ( p1->x == p2->x && p1->y == p2->y ) + if ( *control == FT_CURVE_TAG_ON ) + outline->n_points--; + } + + if ( outline->n_contours > 0 ) + { + /* 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 ); + } + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -1766,6 +2335,176 @@ /*************************************************************************/ /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* */ + /* ps_decoder_init */ + /* */ + /* */ + /* Creates a wrapper decoder for use in the combined */ + /* Type 1 / CFF interpreter. */ + /* */ + /* */ + /* ps_decoder :: A pointer to the decoder to initialize. */ + /* */ + /* */ + /* decoder :: A pointer to the original decoder. */ + /* */ + /* is_t1 :: Flag indicating Type 1 or CFF */ + /* */ + FT_LOCAL_DEF( void ) + ps_decoder_init( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ) + { + FT_ZERO( ps_decoder ); + + if ( is_t1 ) + { + T1_Decoder t1_decoder = (T1_Decoder)decoder; + + + ps_builder_init( &ps_decoder->builder, + &t1_decoder->builder, + is_t1 ); + + ps_decoder->cf2_instance = &t1_decoder->cf2_instance; + ps_decoder->psnames = t1_decoder->psnames; + + ps_decoder->num_glyphs = t1_decoder->num_glyphs; + ps_decoder->glyph_names = t1_decoder->glyph_names; + ps_decoder->hint_mode = t1_decoder->hint_mode; + ps_decoder->blend = t1_decoder->blend; + + ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs; + ps_decoder->locals = t1_decoder->subrs; + ps_decoder->locals_len = t1_decoder->subrs_len; + ps_decoder->locals_hash = t1_decoder->subrs_hash; + + ps_decoder->buildchar = t1_decoder->buildchar; + ps_decoder->len_buildchar = t1_decoder->len_buildchar; + + ps_decoder->lenIV = t1_decoder->lenIV; + } + else + { + CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; + + + ps_builder_init( &ps_decoder->builder, + &cff_decoder->builder, + is_t1 ); + + ps_decoder->cff = cff_decoder->cff; + ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; + ps_decoder->current_subfont = cff_decoder->current_subfont; + + ps_decoder->num_globals = cff_decoder->num_globals; + ps_decoder->globals = cff_decoder->globals; + ps_decoder->globals_bias = cff_decoder->globals_bias; + ps_decoder->num_locals = cff_decoder->num_locals; + ps_decoder->locals = cff_decoder->locals; + ps_decoder->locals_bias = cff_decoder->locals_bias; + + ps_decoder->glyph_width = &cff_decoder->glyph_width; + ps_decoder->width_only = cff_decoder->width_only; + + ps_decoder->hint_mode = cff_decoder->hint_mode; + + ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback; + ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback; + } + } + + + /* Synthesize a SubFont object for Type 1 fonts, for use in the */ + /* new interpreter to access Private dict data. */ + FT_LOCAL_DEF( void ) + t1_make_subfont( FT_Face face, + PS_Private priv, + CFF_SubFont subfont ) + { + CFF_Private cpriv = &subfont->private_dict; + FT_UInt n, count; + + + FT_ZERO( subfont ); + FT_ZERO( cpriv ); + + count = cpriv->num_blue_values = priv->num_blue_values; + for ( n = 0; n < count; n++ ) + cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n]; + + count = cpriv->num_other_blues = priv->num_other_blues; + for ( n = 0; n < count; n++ ) + cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n]; + + count = cpriv->num_family_blues = priv->num_family_blues; + for ( n = 0; n < count; n++ ) + cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n]; + + count = cpriv->num_family_other_blues = priv->num_family_other_blues; + for ( n = 0; n < count; n++ ) + cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n]; + + cpriv->blue_scale = priv->blue_scale; + cpriv->blue_shift = (FT_Pos)priv->blue_shift; + cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz; + + cpriv->standard_width = (FT_Pos)priv->standard_width[0]; + cpriv->standard_height = (FT_Pos)priv->standard_height[0]; + + count = cpriv->num_snap_widths = priv->num_snap_widths; + for ( n = 0; n < count; n++ ) + cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n]; + + count = cpriv->num_snap_heights = priv->num_snap_heights; + for ( n = 0; n < count; n++ ) + cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n]; + + cpriv->force_bold = priv->force_bold; + cpriv->lenIV = priv->lenIV; + cpriv->language_group = priv->language_group; + cpriv->expansion_factor = priv->expansion_factor; + + cpriv->subfont = subfont; + + + /* Initialize the random number generator. */ + if ( face->internal->random_seed != -1 ) + { + /* If we have a face-specific seed, use it. */ + /* If non-zero, update it to a positive value. */ + subfont->random = (FT_UInt32)face->internal->random_seed; + if ( face->internal->random_seed ) + { + do + { + face->internal->random_seed = (FT_Int32)cff_random( + (FT_UInt32)face->internal->random_seed ); + + } while ( face->internal->random_seed < 0 ); + } + } + if ( !subfont->random ) + { + FT_UInt32 seed; + + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&face ^ + (FT_Offset)(char*)&subfont ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + if ( seed == 0 ) + seed = 0x7384; + + subfont->random = seed; + } + } + + FT_LOCAL_DEF( void ) t1_decrypt( FT_Byte* buffer, FT_Offset length, @@ -1779,4 +2518,16 @@ } + FT_LOCAL_DEF( FT_UInt32 ) + cff_random( FT_UInt32 r ) + { + /* a 32bit version of the `xorshift' algorithm */ + r ^= r << 13; + r ^= r >> 17; + r ^= r << 5; + + return r; + } + + /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/psobjs.h b/sdk/lib/3rdparty/freetype/src/psaux/psobjs.h index 202e5b24166..8e0fe5fa4c0 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/psobjs.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psobjs.h @@ -4,7 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 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 #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER @@ -190,6 +191,92 @@ FT_BEGIN_HEADER t1_builder_close_contour( T1_Builder builder ); + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + cff_builder_init( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ); + + FT_LOCAL( void ) + cff_builder_done( CFF_Builder* builder ); + + FT_LOCAL( FT_Error ) + cff_check_points( CFF_Builder* builder, + FT_Int count ); + + FT_LOCAL( void ) + cff_builder_add_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + FT_LOCAL( FT_Error ) + cff_builder_add_point1( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + FT_LOCAL( FT_Error ) + cff_builder_start_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + FT_LOCAL( void ) + cff_builder_close_contour( CFF_Builder* builder ); + + FT_LOCAL( FT_Error ) + cff_builder_add_contour( CFF_Builder* builder ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + ps_builder_init( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ); + + + FT_LOCAL( void ) + ps_builder_done( PS_Builder* builder ); + + FT_LOCAL( FT_Error ) + ps_builder_check_points( PS_Builder* builder, + FT_Int count ); + + FT_LOCAL( void ) + ps_builder_add_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + + FT_LOCAL( FT_Error ) + ps_builder_add_point1( PS_Builder* builder, + FT_Pos x, + FT_Pos y ); + + FT_LOCAL( FT_Error ) + ps_builder_add_contour( PS_Builder* builder ); + + FT_LOCAL( FT_Error ) + ps_builder_start_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y ); + + FT_LOCAL( void ) + ps_builder_close_contour( PS_Builder* builder ); + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -198,12 +285,26 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ + FT_LOCAL( void ) + ps_decoder_init( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ); + + FT_LOCAL( void ) + t1_make_subfont( FT_Face face, + PS_Private priv, + CFF_SubFont subfont ); + FT_LOCAL( void ) t1_decrypt( FT_Byte* buffer, FT_Offset length, FT_UShort seed ); + FT_LOCAL( FT_UInt32 ) + cff_random( FT_UInt32 r ); + + FT_END_HEADER #endif /* PSOBJS_H_ */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2read.c b/sdk/lib/3rdparty/freetype/src/psaux/psread.c similarity index 97% rename from sdk/lib/3rdparty/freetype/src/cff/cf2read.c rename to sdk/lib/3rdparty/freetype/src/psaux/psread.c index 2b429e3eeb0..719863ce178 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2read.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psread.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2read.c */ +/* psread.c */ /* */ /* Adobe's code for stream handling (body). */ /* */ @@ -36,12 +36,12 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" +#include "psglue.h" -#include "cf2error.h" +#include "pserror.h" /* Define CF2_IO_FAIL as 1 to enable random errors and random */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2read.h b/sdk/lib/3rdparty/freetype/src/psaux/psread.h similarity index 96% rename from sdk/lib/3rdparty/freetype/src/cff/cf2read.h rename to sdk/lib/3rdparty/freetype/src/psaux/psread.h index b0b0db803a5..464b29ba743 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2read.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psread.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2read.h */ +/* psread.h */ /* */ /* Adobe's code for stream handling (specification). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2READ_H_ -#define CF2READ_H_ +#ifndef PSREAD_H_ +#define PSREAD_H_ FT_BEGIN_HEADER @@ -62,7 +62,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2READ_H_ */ +#endif /* PSREAD_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2stack.c b/sdk/lib/3rdparty/freetype/src/psaux/psstack.c similarity index 98% rename from sdk/lib/3rdparty/freetype/src/cff/cf2stack.c rename to sdk/lib/3rdparty/freetype/src/psaux/psstack.c index 12a026d21d8..69d063349a1 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2stack.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/psstack.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2stack.c */ +/* psstack.c */ /* */ /* Adobe's code for emulating a CFF stack (body). */ /* */ @@ -36,14 +36,14 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2stack.h" +#include "psglue.h" +#include "psfont.h" +#include "psstack.h" -#include "cf2error.h" +#include "pserror.h" /* Allocate and initialize an instance of CF2_Stack. */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2stack.h b/sdk/lib/3rdparty/freetype/src/psaux/psstack.h similarity index 97% rename from sdk/lib/3rdparty/freetype/src/cff/cf2stack.h rename to sdk/lib/3rdparty/freetype/src/psaux/psstack.h index ef08eefe411..38f7b41c689 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2stack.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/psstack.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2stack.h */ +/* psstack.h */ /* */ /* Adobe's code for emulating a CFF stack (specification). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2STACK_H_ -#define CF2STACK_H_ +#ifndef PSSTACK_H_ +#define PSSTACK_H_ FT_BEGIN_HEADER @@ -115,7 +115,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2STACK_H_ */ +#endif /* PSSTACK_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/cff/cf2types.h b/sdk/lib/3rdparty/freetype/src/psaux/pstypes.h similarity index 96% rename from sdk/lib/3rdparty/freetype/src/cff/cf2types.h rename to sdk/lib/3rdparty/freetype/src/psaux/pstypes.h index 5b7e1239af3..dfbaa3d475b 100644 --- a/sdk/lib/3rdparty/freetype/src/cff/cf2types.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/pstypes.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2types.h */ +/* pstypes.h */ /* */ /* Adobe's code for defining data types (specification only). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2TYPES_H_ -#define CF2TYPES_H_ +#ifndef PSTYPES_H_ +#define PSTYPES_H_ #include #include FT_FREETYPE_H @@ -72,7 +72,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2TYPES_H_ */ +#endif /* PSTYPES_H_ */ /* END */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/t1cmap.c b/sdk/lib/3rdparty/freetype/src/psaux/t1cmap.c index 45b713eb7b0..112a7892bac 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/t1cmap.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ /* */ /* Type 1 character map support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/t1cmap.h b/sdk/lib/3rdparty/freetype/src/psaux/t1cmap.h index 7870245a3a1..4308e31d2d7 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/t1cmap.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ /* */ /* Type 1 character map support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psaux/t1decode.c b/sdk/lib/3rdparty/freetype/src/psaux/t1decode.c index 1250b53f5de..6ad145661f2 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/t1decode.c +++ b/sdk/lib/3rdparty/freetype/src/psaux/t1decode.c @@ -4,7 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -109,6 +109,56 @@ }; + /*************************************************************************/ + /* */ + /* */ + /* t1_lookup_glyph_by_stdcharcode_ps */ + /* */ + /* */ + /* Looks up a given glyph by its StandardEncoding charcode. Used to */ + /* implement the SEAC Type 1 operator in the Adobe engine */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* charcode :: The character code to look for. */ + /* */ + /* */ + /* A glyph index in the font face. Returns -1 if the corresponding */ + /* glyph wasn't found. */ + /* */ + FT_LOCAL_DEF( FT_Int ) + t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder, + FT_Int charcode ) + { + FT_UInt n; + const FT_String* glyph_name; + FT_Service_PsCMaps psnames = decoder->psnames; + + + /* check range of standard char code */ + if ( charcode < 0 || charcode > 255 ) + return -1; + + glyph_name = psnames->adobe_std_strings( + psnames->adobe_std_encoding[charcode]); + + for ( n = 0; n < decoder->num_glyphs; n++ ) + { + FT_String* name = (FT_String*)decoder->glyph_names[n]; + + + if ( name && + name[0] == glyph_name[0] && + ft_strcmp( name, glyph_name ) == 0 ) + return (FT_Int)n; + } + + return -1; + } + + +#ifdef T1_CONFIG_OPTION_OLD_ENGINE /*************************************************************************/ /* */ /* */ @@ -158,6 +208,15 @@ } + /* parse a single Type 1 glyph */ + FT_LOCAL_DEF( FT_Error ) + t1_decoder_parse_glyph( T1_Decoder decoder, + FT_UInt glyph ) + { + return decoder->parse_callback( decoder, glyph ); + } + + /*************************************************************************/ /* */ /* */ @@ -1579,14 +1638,286 @@ return FT_THROW( Stack_Underflow ); } +#else /* T1_CONFIG_OPTION_OLD_ENGINE */ - /* parse a single Type 1 glyph */ + /*************************************************************************/ + /* */ + /* */ + /* t1_decoder_parse_metrics */ + /* */ + /* */ + /* Parses a given Type 1 charstrings program to extract width */ + /* */ + /* */ + /* decoder :: The current Type 1 decoder. */ + /* */ + /* charstring_base :: The base address of the charstring stream. */ + /* */ + /* charstring_len :: The length in bytes of the charstring stream. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ FT_LOCAL_DEF( FT_Error ) - t1_decoder_parse_glyph( T1_Decoder decoder, - FT_UInt glyph ) + t1_decoder_parse_metrics( T1_Decoder decoder, + FT_Byte* charstring_base, + FT_UInt charstring_len ) { - return decoder->parse_callback( decoder, glyph ); + T1_Decoder_Zone zone; + FT_Byte* ip; + FT_Byte* limit; + T1_Builder builder = &decoder->builder; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_Bool bol = TRUE; +#endif + + + /* First of all, initialize the decoder */ + decoder->top = decoder->stack; + decoder->zone = decoder->zones; + zone = decoder->zones; + + builder->parse_state = T1_Parse_Start; + + FT_TRACE4(( "\n" + "Start charstring: get width\n" )); + + zone->base = charstring_base; + limit = zone->limit = charstring_base + charstring_len; + ip = zone->cursor = zone->base; + + /* now, execute loop */ + while ( ip < limit ) + { + FT_Long* top = decoder->top; + T1_Operator op = op_none; + FT_Int32 value = 0; + + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( bol ) + { + FT_TRACE5(( " (%d)", decoder->top - decoder->stack )); + bol = FALSE; + } +#endif + + /*********************************************************************/ + /* */ + /* Decode operator or operand */ + /* */ + /* */ + + /* first of all, decompress operator or value */ + switch ( *ip++ ) + { + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 14: + case 15: + case 21: + case 22: + case 30: + case 31: + goto No_Width; + + case 13: + op = op_hsbw; + break; + + case 12: + if ( ip >= limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " invalid escape (12+EOF)\n" )); + goto Syntax_Error; + } + + switch ( *ip++ ) + { + case 7: + op = op_sbw; + break; + + default: + goto No_Width; + } + break; + + case 255: /* four bytes integer */ + if ( ip + 4 > limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " unexpected EOF in integer\n" )); + goto Syntax_Error; + } + + value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)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 ` div div' or */ + /* div div'. This is probably not allowed */ + /* anyway. */ + if ( value > 32000 || value < -32000 ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " large integer found for width\n" )); + goto Syntax_Error; + } + else + { + value = (FT_Int32)( (FT_UInt32)value << 16 ); + } + + break; + + default: + if ( ip[-1] >= 32 ) + { + if ( ip[-1] < 247 ) + value = (FT_Int32)ip[-1] - 139; + else + { + if ( ++ip > limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " unexpected EOF in integer\n" )); + goto Syntax_Error; + } + + if ( ip[-2] < 251 ) + value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108; + else + value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 ); + } + + value = (FT_Int32)( (FT_UInt32)value << 16 ); + } + else + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " invalid byte (%d)\n", ip[-1] )); + goto Syntax_Error; + } + } + + /*********************************************************************/ + /* */ + /* Push value on stack, or process operator */ + /* */ + /* */ + if ( op == op_none ) + { + if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS ) + { + FT_ERROR(( "t1_decoder_parse_metrics: stack overflow\n" )); + goto Syntax_Error; + } + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( " %d", value / 65536 )); +#endif + + *top++ = value; + decoder->top = top; + } + else /* general operator */ + { + FT_Int num_args = t1_args_count[op]; + + + FT_ASSERT( num_args >= 0 ); + + if ( top - decoder->stack < num_args ) + goto Stack_Underflow; + +#ifdef FT_DEBUG_LEVEL_TRACE + + if ( top - decoder->stack != num_args ) + FT_TRACE0(( "t1_decoder_parse_metrics:" + " too much operands on the stack" + " (seen %d, expected %d)\n", + top - decoder->stack, num_args )); + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + top -= num_args; + + switch ( op ) + { + case op_hsbw: + FT_TRACE4(( " hsbw" )); + + builder->parse_state = T1_Parse_Have_Width; + + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + + builder->advance.x = top[1]; + builder->advance.y = 0; + + /* we only want to compute the glyph's metrics */ + /* (lsb + advance width), not load the rest of */ + /* it; so exit immediately */ + return FT_Err_Ok; + + case op_sbw: + FT_TRACE4(( " sbw" )); + + builder->parse_state = T1_Parse_Have_Width; + + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + builder->left_bearing.y = ADD_LONG( builder->left_bearing.y, + top[1] ); + + builder->advance.x = top[2]; + builder->advance.y = top[3]; + + /* we only want to compute the glyph's metrics */ + /* (lsb + advance width), not load the rest of */ + /* it; so exit immediately */ + return FT_Err_Ok; + + default: + FT_ERROR(( "t1_decoder_parse_metrics:" + " unhandled opcode %d\n", op )); + goto Syntax_Error; + } + + } /* general operator processing */ + + } /* while ip < limit */ + + FT_TRACE4(( "..end..\n\n" )); + + No_Width: + FT_ERROR(( "t1_decoder_parse_metrics:" + " no width, found op %d instead\n", + ip[-1] )); + Syntax_Error: + return FT_THROW( Syntax_Error ); + + Stack_Underflow: + return FT_THROW( Stack_Underflow ); } +#endif /* T1_CONFIG_OPTION_OLD_ENGINE */ /* initialize T1 decoder */ @@ -1641,7 +1972,16 @@ FT_LOCAL_DEF( void ) t1_decoder_done( T1_Decoder decoder ) { + FT_Memory memory = decoder->builder.memory; + + t1_builder_done( &decoder->builder ); + + if ( decoder->cf2_instance.finalizer ) + { + decoder->cf2_instance.finalizer( decoder->cf2_instance.data ); + FT_FREE( decoder->cf2_instance.data ); + } } diff --git a/sdk/lib/3rdparty/freetype/src/psaux/t1decode.h b/sdk/lib/3rdparty/freetype/src/psaux/t1decode.h index 12c27de775d..1d9718d678e 100644 --- a/sdk/lib/3rdparty/freetype/src/psaux/t1decode.h +++ b/sdk/lib/3rdparty/freetype/src/psaux/t1decode.h @@ -4,7 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,7 +31,11 @@ FT_BEGIN_HEADER FT_CALLBACK_TABLE const T1_Decoder_FuncsRec t1_decoder_funcs; + FT_LOCAL( FT_Int ) + t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder, + FT_Int charcode ); +#ifdef T1_CONFIG_OPTION_OLD_ENGINE FT_LOCAL( FT_Error ) t1_decoder_parse_glyph( T1_Decoder decoder, FT_UInt glyph_index ); @@ -40,6 +44,12 @@ FT_BEGIN_HEADER t1_decoder_parse_charstrings( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); +#else + FT_LOCAL( FT_Error ) + t1_decoder_parse_metrics( T1_Decoder decoder, + FT_Byte* charstring_base, + FT_UInt charstring_len ); +#endif FT_LOCAL( FT_Error ) t1_decoder_init( T1_Decoder decoder, diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshalgo.c b/sdk/lib/3rdparty/freetype/src/pshinter/pshalgo.c index 9ad1a3a02a3..b98077c62ef 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshalgo.c +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -26,7 +26,7 @@ #undef FT_COMPONENT -#define FT_COMPONENT trace_pshalgo2 +#define FT_COMPONENT trace_pshalgo #ifdef DEBUG_HINTER diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshalgo.h b/sdk/lib/3rdparty/freetype/src/pshinter/pshalgo.h index 62e97d152b0..c50683fbec6 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshalgo.h +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshglob.c b/sdk/lib/3rdparty/freetype/src/pshinter/pshglob.c index c68770c73a2..29f328d0e6d 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshglob.c +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshglob.c @@ -5,7 +5,7 @@ /* PostScript hinter global hinting management (body). */ /* Inspired by the new auto-hinter module. */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshglob.h b/sdk/lib/3rdparty/freetype/src/pshinter/pshglob.h index 8801cbada46..cf80bf40e64 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshglob.h +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshglob.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinter global hinting management. */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshinter.c b/sdk/lib/3rdparty/freetype/src/pshinter/pshinter.c index 13e07e14854..0eedac452d2 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshinter.c +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshinter.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript Hinting module */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshmod.c b/sdk/lib/3rdparty/freetype/src/pshinter/pshmod.c index 860dc0ae823..0b8f6f99b83 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshmod.c +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript hinter module implementation (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshmod.h b/sdk/lib/3rdparty/freetype/src/pshinter/pshmod.h index 1d2b40fa137..556de2fbc0e 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshmod.h +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshmod.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinter module interface (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshnterr.h b/sdk/lib/3rdparty/freetype/src/pshinter/pshnterr.h index 73d144e34c7..b9d02d2956a 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshnterr.h +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshnterr.h @@ -4,7 +4,7 @@ /* */ /* PS Hinter error codes (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshpic.c b/sdk/lib/3rdparty/freetype/src/pshinter/pshpic.c index c0d3a64f297..465ad31885b 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshpic.c +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshpic.h b/sdk/lib/3rdparty/freetype/src/pshinter/pshpic.h index 8d9a01c9c5d..4469ba87c80 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshpic.h +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshrec.c b/sdk/lib/3rdparty/freetype/src/pshinter/pshrec.c index fff6d342508..6648d13d60f 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshrec.c +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript hints recorder (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/pshinter/pshrec.h b/sdk/lib/3rdparty/freetype/src/pshinter/pshrec.h index e10bc2b1206..7e3dfe0d538 100644 --- a/sdk/lib/3rdparty/freetype/src/pshinter/pshrec.h +++ b/sdk/lib/3rdparty/freetype/src/pshinter/pshrec.h @@ -4,7 +4,7 @@ /* */ /* Postscript (Type1/Type2) hints recorder (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psnames/psmodule.c b/sdk/lib/3rdparty/freetype/src/psnames/psmodule.c index 44ba9ec6ab6..8929ebe751d 100644 --- a/sdk/lib/3rdparty/freetype/src/psnames/psmodule.c +++ b/sdk/lib/3rdparty/freetype/src/psnames/psmodule.c @@ -4,7 +4,7 @@ /* */ /* PSNames module implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psnames/psmodule.h b/sdk/lib/3rdparty/freetype/src/psnames/psmodule.h index 6983b792347..3e94f8b437e 100644 --- a/sdk/lib/3rdparty/freetype/src/psnames/psmodule.h +++ b/sdk/lib/3rdparty/freetype/src/psnames/psmodule.h @@ -4,7 +4,7 @@ /* */ /* High-level PSNames module interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psnames/psnamerr.h b/sdk/lib/3rdparty/freetype/src/psnames/psnamerr.h index f90bf5ea430..14eb76c99cf 100644 --- a/sdk/lib/3rdparty/freetype/src/psnames/psnamerr.h +++ b/sdk/lib/3rdparty/freetype/src/psnames/psnamerr.h @@ -4,7 +4,7 @@ /* */ /* PS names module error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psnames/psnames.c b/sdk/lib/3rdparty/freetype/src/psnames/psnames.c index 22466d62308..febb80d594e 100644 --- a/sdk/lib/3rdparty/freetype/src/psnames/psnames.c +++ b/sdk/lib/3rdparty/freetype/src/psnames/psnames.c @@ -4,7 +4,7 @@ /* */ /* FreeType PSNames module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psnames/pspic.c b/sdk/lib/3rdparty/freetype/src/psnames/pspic.c index 8b9003439b3..85a06f36037 100644 --- a/sdk/lib/3rdparty/freetype/src/psnames/pspic.c +++ b/sdk/lib/3rdparty/freetype/src/psnames/pspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psnames/pspic.h b/sdk/lib/3rdparty/freetype/src/psnames/pspic.h index 14497e73fa4..889780cc032 100644 --- a/sdk/lib/3rdparty/freetype/src/psnames/pspic.h +++ b/sdk/lib/3rdparty/freetype/src/psnames/pspic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/psnames/pstables.h b/sdk/lib/3rdparty/freetype/src/psnames/pstables.h index 2a2b717d8f8..79545ee0396 100644 --- a/sdk/lib/3rdparty/freetype/src/psnames/pstables.h +++ b/sdk/lib/3rdparty/freetype/src/psnames/pstables.h @@ -4,7 +4,7 @@ /* */ /* PostScript glyph names. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/raster/ftmisc.h b/sdk/lib/3rdparty/freetype/src/raster/ftmisc.h index d1e6627ab49..7e401190711 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/ftmisc.h +++ b/sdk/lib/3rdparty/freetype/src/raster/ftmisc.h @@ -5,7 +5,7 @@ /* Miscellaneous macros for stand-alone rasterizer (specification */ /* only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/sdk/lib/3rdparty/freetype/src/raster/ftraster.c b/sdk/lib/3rdparty/freetype/src/raster/ftraster.c index b086a0660e2..7b76cdbed57 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/ftraster.c +++ b/sdk/lib/3rdparty/freetype/src/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/raster/ftraster.h b/sdk/lib/3rdparty/freetype/src/raster/ftraster.h index 6b3050cb3d3..40b5d6d321c 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/ftraster.h +++ b/sdk/lib/3rdparty/freetype/src/raster/ftraster.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/sdk/lib/3rdparty/freetype/src/raster/ftrend1.c b/sdk/lib/3rdparty/freetype/src/raster/ftrend1.c index 185a7f6fc2f..a7ce9731d77 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/ftrend1.c +++ b/sdk/lib/3rdparty/freetype/src/raster/ftrend1.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -97,12 +97,12 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - FT_Outline* outline; - FT_BBox cbox, cbox0; - FT_UInt width, height, pitch; - FT_Bitmap* bitmap; - FT_Memory memory; + FT_Error error = FT_Err_Ok; + FT_Outline* outline = &slot->outline; + FT_Bitmap* bitmap = &slot->bitmap; + FT_Memory memory = render->root.memory; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; FT_Raster_Params params; @@ -121,60 +121,6 @@ return FT_THROW( Cannot_Render_Glyph ); } - outline = &slot->outline; - - /* translate the outline to the new origin if needed */ - if ( origin ) - FT_Outline_Translate( outline, origin->x, origin->y ); - - /* compute the control box, and grid fit it */ - FT_Outline_Get_CBox( outline, &cbox0 ); - - /* undocumented but confirmed: bbox values get rounded */ -#if 1 - cbox.xMin = FT_PIX_ROUND( cbox0.xMin ); - cbox.yMin = FT_PIX_ROUND( cbox0.yMin ); - cbox.xMax = FT_PIX_ROUND( cbox0.xMax ); - cbox.yMax = FT_PIX_ROUND( cbox0.yMax ); -#else - cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); - cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax ); -#endif - - /* If either `width' or `height' round to 0, try */ - /* explicitly rounding up/down. In the case of */ - /* glyphs containing only one very narrow feature, */ - /* this gives the drop-out compensation in the scan */ - /* conversion code a chance to do its stuff. */ - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); - if ( width == 0 ) - { - cbox.xMin = FT_PIX_FLOOR( cbox0.xMin ); - cbox.xMax = FT_PIX_CEIL( cbox0.xMax ); - - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); - } - - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); - if ( height == 0 ) - { - cbox.yMin = FT_PIX_FLOOR( cbox0.yMin ); - cbox.yMax = FT_PIX_CEIL( cbox0.yMax ); - - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); - } - - if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - bitmap = &slot->bitmap; - memory = render->root.memory; - /* release old bitmap buffer */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { @@ -182,39 +128,48 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } - pitch = ( ( width + 15 ) >> 4 ) << 1; - bitmap->pixel_mode = FT_PIXEL_MODE_MONO; + ft_glyphslot_preset_bitmap( slot, mode, origin ); - bitmap->width = width; - bitmap->rows = height; - bitmap->pitch = (int)pitch; - - if ( FT_ALLOC_MULT( bitmap->buffer, height, pitch ) ) + /* allocate new one */ + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; + x_shift = -slot->bitmap_left * 64; + y_shift = ( (FT_Int)bitmap->rows - slot->bitmap_top ) * 64; + + if ( origin ) + { + x_shift += origin->x; + y_shift += origin->y; + } + /* translate outline to render it into the bitmap */ - FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin ); + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, x_shift, y_shift ); /* set up parameters */ params.target = bitmap; params.source = outline; - params.flags = 0; + params.flags = FT_RASTER_FLAG_DEFAULT; /* render outline into the bitmap */ error = render->raster_render( render->raster, ¶ms ); - FT_Outline_Translate( outline, cbox.xMin, cbox.yMin ); - - if ( error ) - goto Exit; - - slot->format = FT_GLYPH_FORMAT_BITMAP; - slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 ); - slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 ); - Exit: + if ( !error ) + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; + else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + { + FT_FREE( bitmap->buffer ); + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; + } + + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, -x_shift, -y_shift ); + return error; } diff --git a/sdk/lib/3rdparty/freetype/src/raster/ftrend1.h b/sdk/lib/3rdparty/freetype/src/raster/ftrend1.h index cff702d140f..2abdf2d703b 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/ftrend1.h +++ b/sdk/lib/3rdparty/freetype/src/raster/ftrend1.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/raster/raster.c b/sdk/lib/3rdparty/freetype/src/raster/raster.c index 46a6690b178..76edd21e1e0 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/raster.c +++ b/sdk/lib/3rdparty/freetype/src/raster/raster.c @@ -4,7 +4,7 @@ /* */ /* FreeType monochrome rasterer module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/raster/rasterrs.h b/sdk/lib/3rdparty/freetype/src/raster/rasterrs.h index 0d646908ad1..22a3e153406 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/rasterrs.h +++ b/sdk/lib/3rdparty/freetype/src/raster/rasterrs.h @@ -4,7 +4,7 @@ /* */ /* monochrome renderer error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/raster/rastpic.c b/sdk/lib/3rdparty/freetype/src/raster/rastpic.c index 7085339b7b4..1dc8981b8a6 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/rastpic.c +++ b/sdk/lib/3rdparty/freetype/src/raster/rastpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/raster/rastpic.h b/sdk/lib/3rdparty/freetype/src/raster/rastpic.h index dcd691310d3..6d0877c4239 100644 --- a/sdk/lib/3rdparty/freetype/src/raster/rastpic.h +++ b/sdk/lib/3rdparty/freetype/src/raster/rastpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/pngshim.c b/sdk/lib/3rdparty/freetype/src/sfnt/pngshim.c index 560db4835af..16020266afd 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/pngshim.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/pngshim.c @@ -4,7 +4,7 @@ /* */ /* PNG Bitmap glyph support. */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* Google, Inc. */ /* Written by Stuart Gill and Behdad Esfahbod. */ /* */ @@ -82,42 +82,45 @@ typedef unsigned short v82 __attribute__(( vector_size( 16 ) )); - /* process blocks of 16 bytes in one rush, which gives a nice speed-up */ - limit = row_info->rowbytes - 16 + 1; - for ( ; i < limit; i += 16 ) + if ( row_info->rowbytes > 15 ) { - unsigned char* base = &data[i]; + /* process blocks of 16 bytes in one rush, which gives a nice speed-up */ + limit = row_info->rowbytes - 16 + 1; + for ( ; i < limit; i += 16 ) + { + unsigned char* base = &data[i]; - v82 s, s0, s1, a; + v82 s, s0, s1, a; - /* clang <= 3.9 can't apply scalar values to vectors */ - /* (or rather, it needs a different syntax) */ - v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; - v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 }; + /* clang <= 3.9 can't apply scalar values to vectors */ + /* (or rather, it needs a different syntax) */ + v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; + v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 }; - v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; - v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF }; - v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; + v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; + v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF }; + v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; - memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ - s0 = s & n0xFF; /* R B R B R B R B */ - s1 = s >> n8; /* G A G A G A G A */ + ft_memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ + s0 = s & n0xFF; /* R B R B R B R B */ + s1 = s >> n8; /* G A G A G A G A */ - a = vector_shuffle( s1, ma ); /* A A A A A A A A */ - s1 |= o1; /* G 1 G 1 G 1 G 1 */ - s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */ + a = vector_shuffle( s1, ma ); /* A A A A A A A A */ + s1 |= o1; /* G 1 G 1 G 1 G 1 */ + s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */ - s0 *= a; - s1 *= a; - s0 += n0x80; - s1 += n0x80; - s0 = ( s0 + ( s0 >> n8 ) ) >> n8; - s1 = ( s1 + ( s1 >> n8 ) ) >> n8; + s0 *= a; + s1 *= a; + s0 += n0x80; + s1 += n0x80; + s0 = ( s0 + ( s0 >> n8 ) ) >> n8; + s1 = ( s1 + ( s1 >> n8 ) ) >> n8; - s = s0 | ( s1 << n8 ); - memcpy( base, &s, 16 ); + s = s0 | ( s1 << n8 ); + ft_memcpy( base, &s, 16 ); + } } #endif /* use `vector_size' */ @@ -234,7 +237,7 @@ return; } - memcpy( data, stream->cursor, length ); + ft_memcpy( data, stream->cursor, length ); FT_FRAME_EXIT(); } diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/pngshim.h b/sdk/lib/3rdparty/freetype/src/sfnt/pngshim.h index 344eceac125..194238c3a20 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/pngshim.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/pngshim.h @@ -4,7 +4,7 @@ /* */ /* PNG Bitmap glyph support. */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* Google, Inc. */ /* Written by Stuart Gill and Behdad Esfahbod. */ /* */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.c b/sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.c index 991433ee4cc..303e1ca9f1a 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -862,7 +862,8 @@ NULL, &mm_var ); - if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) && + !FT_IS_VARIATION( FT_FACE( face ) ) ) { SFNT_Service sfnt = (SFNT_Service)face->sfnt; @@ -1029,7 +1030,9 @@ return face->postscript_name; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( face->blend ) + if ( face->blend && + ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) ) { face->postscript_name = sfnt_get_var_ps_name( face ); return face->postscript_name; diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.h b/sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.h index 38710b60f2e..81c22d28870 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/sfdriver.h @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/sferrors.h b/sdk/lib/3rdparty/freetype/src/sfnt/sferrors.h index 3cf73d725d3..74003d4b38c 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/sferrors.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ /* */ /* SFNT error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/sfnt.c b/sdk/lib/3rdparty/freetype/src/sfnt/sfnt.c index 6cf8c9ef30a..8b9a6b345df 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/sfnt.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ /* */ /* Single object library component. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.c b/sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.c index 8eadd601fd4..db2d816ce68 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.h b/sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.h index 3afb668db02..8f43122d81b 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/sfntpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.c b/sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.c index 69bf0a5c3db..0c917030f37 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ /* */ /* SFNT object management (base). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -962,8 +962,6 @@ FT_Byte* instance_values = NULL; - face->is_default_instance = 1; - instance_index = FT_ABS( face_instance_index ) >> 16; /* test whether current face is a GX font with named instances */ @@ -1686,9 +1684,9 @@ (FT_Short)( face->vertical_info ? face->vertical.advance_Height_Max : root->height ); - /* 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. */ + /* See https://www.microsoft.com/typography/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; diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.h b/sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.h index 705381459ac..1b8d1be5b1a 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/sfobjs.h @@ -4,7 +4,7 @@ /* */ /* SFNT object management (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.c b/sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.c index 2196e3791ec..534201f229f 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.c @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded BDF properties (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.h b/sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.h index 398b620600b..809a6630011 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttbdf.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded BDF properties (specification). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,6 +28,8 @@ FT_BEGIN_HEADER +#ifdef TT_CONFIG_OPTION_BDF + FT_LOCAL( void ) tt_face_free_bdf_props( TT_Face face ); @@ -37,6 +39,8 @@ FT_BEGIN_HEADER const char* property_name, BDF_PropertyRec *aprop ); +#endif /* TT_CONFIG_OPTION_BDF */ + FT_END_HEADER diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.c b/sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.c index b995e5c050a..8cc70f759af 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -518,7 +518,11 @@ if ( offset == 0 ) + { + if ( charcode == 0x100 ) + goto Exit; /* this happens only for a malformed cmap */ goto Next_SubHeader; + } if ( char_lo < start ) { @@ -547,9 +551,19 @@ } } - /* jump to next sub-header, i.e. higher byte value */ + /* If `charcode' is <= 0xFF, retry with `charcode + 1'. If */ + /* `charcode' is 0x100 after the loop, do nothing since we have */ + /* just reached the first sub-header for two-byte character codes. */ + /* */ + /* For all other cases, we jump to the next sub-header and adjust */ + /* `charcode' accordingly. */ Next_SubHeader: - charcode = FT_PAD_FLOOR( charcode, 256 ) + 256; + if ( charcode <= 0xFF ) + charcode++; + else if ( charcode == 0x100 ) + ; + else + charcode = FT_PAD_FLOOR( charcode, 0x100 ) + 0x100; } Exit: diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.h b/sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.h index f7de0437b07..d264d99d2c9 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttcmap.h @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttcmapc.h b/sdk/lib/3rdparty/freetype/src/sfnt/ttcmapc.h index 9a5e70825ed..4980e9dd3dc 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttcmapc.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttcmapc.h @@ -4,7 +4,7 @@ /* */ /* TT CMAP classes definitions (specification only). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttkern.c b/sdk/lib/3rdparty/freetype/src/sfnt/ttkern.c index 53d2436ae5c..68f15a20102 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttkern.c +++ b/sdk/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-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttkern.h b/sdk/lib/3rdparty/freetype/src/sfnt/ttkern.h index db1a30bdb0f..4e45d0964b4 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttkern.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttkern.h @@ -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-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttload.c b/sdk/lib/3rdparty/freetype/src/sfnt/ttload.c index df99baa53e9..a86a546c3dd 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttload.c +++ b/sdk/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-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -338,7 +338,7 @@ SFNT_HeaderRec sfnt; FT_Error error; FT_Memory memory = stream->memory; - FT_UShort nn, valid_entries; + FT_UShort nn, valid_entries = 0; static const FT_Frame_Field offset_table_fields[] = { diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttload.h b/sdk/lib/3rdparty/freetype/src/sfnt/ttload.h index 296da86ed32..f94be8b7bd0 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttload.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttload.h @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.c b/sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.c index 394c6db85cb..6ddda95b567 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.h b/sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.h index 2b93ab2f0e1..ab00acd7952 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttmtx.h @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttpost.c b/sdk/lib/3rdparty/freetype/src/sfnt/ttpost.c index 69929c8d452..f140649993a 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttpost.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ /* PostScript name table processing for TrueType and OpenType fonts */ /* (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttpost.h b/sdk/lib/3rdparty/freetype/src/sfnt/ttpost.h index 722485e32d1..3bec07e4454 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttpost.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttpost.h @@ -5,7 +5,7 @@ /* PostScript name table processing for TrueType and OpenType fonts */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.c b/sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.c index f41847b0af0..53e61756d18 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.c +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Copyright 2013 by Google, Inc. */ @@ -1007,8 +1007,9 @@ goto Fail; } - FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d components\n", - num_components )); + FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d component%s\n", + num_components, + num_components == 1 ? "" : "s" )); for ( nn = 0; nn < num_components; nn++ ) { diff --git a/sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.h b/sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.h index e859ddda452..ce2af3c1628 100644 --- a/sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.h +++ b/sdk/lib/3rdparty/freetype/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/smooth/ftgrays.c b/sdk/lib/3rdparty/freetype/src/smooth/ftgrays.c index d01c981e901..e5fb3c7d52e 100644 --- a/sdk/lib/3rdparty/freetype/src/smooth/ftgrays.c +++ b/sdk/lib/3rdparty/freetype/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ /* */ /* A new `perfect' anti-aliasing renderer (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -370,7 +370,7 @@ typedef ptrdiff_t FT_PtrDist; /* optimize a division and modulo operation on the same parameters */ /* into a single call to `__aeabi_idivmod'. See */ /* */ - /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */ + /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */ #undef FT_DIV_MOD #define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \ FT_BEGIN_STMNT \ @@ -582,8 +582,8 @@ typedef ptrdiff_t FT_PtrDist; if ( ex < ras.min_ex ) ex = ras.min_ex - 1; - /* record the current one if it is valid */ - if ( !ras.invalid ) + /* record the current one if it is valid and substantial */ + if ( !ras.invalid && ( ras.area || ras.cover ) ) gray_record_cell( RAS_VAR ); ras.area = 0; @@ -1300,8 +1300,6 @@ typedef ptrdiff_t FT_PtrDist; int y; - FT_TRACE7(( "gray_sweep: start\n" )); - for ( y = ras.min_ey; y < ras.max_ey; y++ ) { PCell cell = ras.ycells[y - ras.min_ey]; @@ -1327,8 +1325,6 @@ typedef ptrdiff_t FT_PtrDist; if ( cover != 0 ) gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x ); } - - FT_TRACE7(( "gray_sweep: end\n" )); } @@ -1722,8 +1718,11 @@ typedef ptrdiff_t FT_PtrDist; if ( !ras.invalid ) gray_record_cell( RAS_VAR ); - FT_TRACE7(( "band [%d..%d]: %d cells\n", - ras.min_ey, ras.max_ey, ras.num_cells )); + FT_TRACE7(( "band [%d..%d]: %d cell%s\n", + ras.min_ey, + ras.max_ey, + ras.num_cells, + ras.num_cells == 1 ? "" : "s" )); } else { @@ -1740,15 +1739,19 @@ typedef ptrdiff_t FT_PtrDist; static int gray_convert_glyph( RAS_ARG ) { + const TCoord yMin = ras.min_ey; + const TCoord yMax = ras.max_ey; + const TCoord xMin = ras.min_ex; + const TCoord xMax = ras.max_ex; + #ifdef __REACTOS__ TCell *buffer; #else TCell buffer[FT_MAX_GRAY_POOL]; #endif - TCoord band_size = FT_MAX_GRAY_POOL / 8; - TCoord count = ras.max_ey - ras.min_ey; - int num_bands; - TCoord min, max, max_y; + size_t height = (size_t)( yMax - yMin ); + size_t n = FT_MAX_GRAY_POOL / 8; + TCoord y; TCoord bands[32]; /* enough to accommodate bisections */ TCoord* band; @@ -1757,25 +1760,29 @@ typedef ptrdiff_t FT_PtrDist; #endif /* set up vertical bands */ - if ( count > band_size ) + if ( height > n ) { /* two divisions rounded up */ - num_bands = (int)( ( count + band_size - 1) / band_size ); - band_size = ( count + num_bands - 1 ) / num_bands; + n = ( height + n - 1 ) / n; + height = ( height + n - 1 ) / n; } - min = ras.min_ey; - max_y = ras.max_ey; + /* memory management */ + n = ( height * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / sizeof ( TCell ); - for ( ; min < max_y; min = max ) + ras.cells = buffer + n; + ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - n ); + ras.ycells = (PCell*)buffer; + + for ( y = yMin; y < yMax; ) { - max = min + band_size; - if ( max > max_y ) - max = max_y; + ras.min_ey = y; + y += height; + ras.max_ey = FT_MIN( y, yMax ); band = bands; - band[1] = min; - band[0] = max; + band[1] = xMin; + band[0] = xMax; do { @@ -1783,27 +1790,12 @@ typedef ptrdiff_t FT_PtrDist; int error; - /* memory management */ - { - size_t ycount = (size_t)width; - size_t cell_start; - - - cell_start = ( ycount * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / - sizeof ( TCell ); - - ras.cells = buffer + cell_start; - ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - cell_start ); - ras.num_cells = 0; - - ras.ycells = (PCell*)buffer; - while ( ycount ) - ras.ycells[--ycount] = NULL; - } + FT_MEM_ZERO( ras.ycells, height * sizeof ( PCell ) ); + ras.num_cells = 0; ras.invalid = 1; - ras.min_ey = band[1]; - ras.max_ey = band[0]; + ras.min_ex = band[1]; + ras.max_ex = band[0]; error = gray_convert_glyph_inner( RAS_VAR ); @@ -1824,8 +1816,7 @@ typedef ptrdiff_t FT_PtrDist; /* render pool overflow; we will reduce the render band by half */ width >>= 1; - /* This is too complex for a single scanline; there must */ - /* be some problems. */ + /* this should never happen even with tiny rendering pool */ if ( width == 0 ) { FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" )); diff --git a/sdk/lib/3rdparty/freetype/src/smooth/ftgrays.h b/sdk/lib/3rdparty/freetype/src/smooth/ftgrays.h index a5447da1a97..9e11ca675ef 100644 --- a/sdk/lib/3rdparty/freetype/src/smooth/ftgrays.h +++ b/sdk/lib/3rdparty/freetype/src/smooth/ftgrays.h @@ -4,7 +4,7 @@ /* */ /* FreeType smooth renderer declaration */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/smooth/ftsmerrs.h b/sdk/lib/3rdparty/freetype/src/smooth/ftsmerrs.h index a528c61832b..226dc1b0017 100644 --- a/sdk/lib/3rdparty/freetype/src/smooth/ftsmerrs.h +++ b/sdk/lib/3rdparty/freetype/src/smooth/ftsmerrs.h @@ -4,7 +4,7 @@ /* */ /* smooth renderer error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/smooth/ftsmooth.c b/sdk/lib/3rdparty/freetype/src/smooth/ftsmooth.c index 963435de150..ef176bdf1ec 100644 --- a/sdk/lib/3rdparty/freetype/src/smooth/ftsmooth.c +++ b/sdk/lib/3rdparty/freetype/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -97,74 +97,17 @@ const FT_Vector* origin, FT_Render_Mode required_mode ) { - FT_Error error; + FT_Error error = FT_Err_Ok; FT_Outline* outline = &slot->outline; FT_Bitmap* bitmap = &slot->bitmap; FT_Memory memory = render->root.memory; - FT_BBox cbox; FT_Pos x_shift = 0; FT_Pos y_shift = 0; - FT_Pos x_left, y_top; - FT_Pos width, height, pitch; FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); FT_Raster_Params params; - FT_Bool have_outline_shifted = FALSE; - FT_Bool have_buffer = FALSE; - -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - FT_LcdFiveTapFilter lcd_weights = { 0 }; - FT_Bool have_custom_weight = FALSE; - FT_Bitmap_LcdFilterFunc lcd_filter_func = NULL; - - - if ( slot->face ) - { - FT_Char i; - - - for ( i = 0; i < FT_LCD_FILTER_FIVE_TAPS; i++ ) - if ( slot->face->internal->lcd_weights[i] != 0 ) - { - have_custom_weight = TRUE; - break; - } - } - - /* - * The LCD filter can be set library-wide and per-face. Face overrides - * library. If the face filter weights are all zero (the default), it - * means that the library default should be used. - */ - if ( have_custom_weight ) - { - /* - * A per-font filter is set. It always uses the default 5-tap - * in-place FIR filter. - */ - ft_memcpy( lcd_weights, - slot->face->internal->lcd_weights, - FT_LCD_FILTER_FIVE_TAPS ); - lcd_filter_func = ft_lcd_filter_fir; - } - else - { - /* - * The face's lcd_weights is {0, 0, 0, 0, 0}, meaning `use library - * default'. If the library is set to use no LCD filtering - * (lcd_filter_func == NULL), `lcd_filter_func' here is also set to - * NULL and the tests further below pass over the filtering process. - */ - ft_memcpy( lcd_weights, - slot->library->lcd_weights, - FT_LCD_FILTER_FIVE_TAPS ); - lcd_filter_func = slot->library->lcd_filter_func; - } - -#endif /*FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ /* check glyph image format */ if ( slot->format != render->glyph_format ) @@ -180,100 +123,6 @@ goto Exit; } - if ( origin ) - { - x_shift = origin->x; - y_shift = origin->y; - } - - /* compute the control box, and grid fit it */ - /* taking into account the origin shift */ - FT_Outline_Get_CBox( outline, &cbox ); - -#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - /* add minimal padding for LCD rendering */ - if ( hmul ) - { - cbox.xMax += 21; - cbox.xMin -= 21; - } - - if ( vmul ) - { - cbox.yMax += 21; - cbox.yMin -= 21; - } - -#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - /* add minimal padding for LCD filter depending on specific weights */ - if ( lcd_filter_func ) - { - if ( hmul ) - { - cbox.xMax += lcd_weights[4] ? 43 - : lcd_weights[3] ? 22 : 0; - cbox.xMin -= lcd_weights[0] ? 43 - : lcd_weights[1] ? 22 : 0; - } - - if ( vmul ) - { - cbox.yMax += lcd_weights[4] ? 43 - : lcd_weights[3] ? 22 : 0; - cbox.yMin -= lcd_weights[0] ? 43 - : lcd_weights[1] ? 22 : 0; - } - } - -#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift ); - cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax + y_shift ); - - x_shift -= cbox.xMin; - y_shift -= cbox.yMin; - - x_left = cbox.xMin >> 6; - y_top = cbox.yMax >> 6; - - width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; - height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; - - pitch = width; - if ( hmul ) - { - width *= 3; - pitch = FT_PAD_CEIL( width, 4 ); - } - - if ( vmul ) - height *= 3; - - /* - * 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 || - x_left < FT_INT_MIN || y_top < FT_INT_MIN ) - { - error = FT_THROW( Invalid_Pixel_Size ); - goto Exit; - } - - /* Required check is (pitch * height < FT_ULONG_MAX), */ - /* but we care realistic cases only. Always pitch <= width. */ - if ( width > 0x7FFF || height > 0x7FFF ) - { - FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n", - width, height )); - error = FT_THROW( Raster_Overflow ); - goto Exit; - } - /* release old bitmap buffer */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { @@ -281,30 +130,30 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } + ft_glyphslot_preset_bitmap( slot, mode, origin ); + /* allocate new one */ - if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; - else - have_buffer = TRUE; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; - slot->format = FT_GLYPH_FORMAT_BITMAP; - slot->bitmap_left = (FT_Int)x_left; - slot->bitmap_top = (FT_Int)y_top; + x_shift = 64 * -slot->bitmap_left; + y_shift = 64 * -slot->bitmap_top; + if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V ) + y_shift += 64 * (FT_Int)bitmap->rows / 3; + else + y_shift += 64 * (FT_Int)bitmap->rows; - bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; - bitmap->num_grays = 256; - bitmap->width = (unsigned int)width; - bitmap->rows = (unsigned int)height; - bitmap->pitch = pitch; + if ( origin ) + { + x_shift += origin->x; + y_shift += origin->y; + } /* translate outline to render it into the bitmap */ if ( x_shift || y_shift ) - { FT_Outline_Translate( outline, x_shift, y_shift ); - have_outline_shifted = TRUE; - } /* set up parameters */ params.target = bitmap; @@ -351,29 +200,46 @@ if ( error ) goto Exit; - if ( lcd_filter_func ) - lcd_filter_func( bitmap, mode, lcd_weights ); + /* finally apply filtering */ + if ( hmul || vmul ) + { + FT_Byte* lcd_weights; + FT_Bitmap_LcdFilterFunc lcd_filter_func; + + + /* Per-face LCD filtering takes priority if set up. */ + if ( slot->face && slot->face->internal->lcd_filter_func ) + { + lcd_weights = slot->face->internal->lcd_weights; + lcd_filter_func = slot->face->internal->lcd_filter_func; + } + else + { + lcd_weights = slot->library->lcd_weights; + lcd_filter_func = slot->library->lcd_filter_func; + } + + if ( lcd_filter_func ) + lcd_filter_func( bitmap, mode, lcd_weights ); + } #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ if ( hmul ) /* lcd */ { FT_Byte* line; - FT_Byte* temp; - FT_Int i, j; + FT_Byte* temp = NULL; + FT_UInt i, j; + + unsigned int height = bitmap->rows; + unsigned int width = bitmap->width; + int pitch = bitmap->pitch; /* Render 3 separate monochrome bitmaps, shifting the outline */ /* by 1/3 pixel. */ width /= 3; - FT_Outline_Translate( outline, 21, 0 ); - - error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - - FT_Outline_Translate( outline, -21, 0 ); bitmap->buffer += width; error = render->raster_render( render->raster, ¶ms ); @@ -381,15 +247,21 @@ goto Exit; FT_Outline_Translate( outline, -21, 0 ); + x_shift -= 21; bitmap->buffer += width; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 21, 0 ); + FT_Outline_Translate( outline, 42, 0 ); + x_shift += 42; bitmap->buffer -= 2 * width; + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */ /* XXX: It is more efficient to render every third byte above. */ @@ -398,7 +270,7 @@ for ( i = 0; i < height; i++ ) { - line = bitmap->buffer + i * pitch; + line = bitmap->buffer + i * (FT_ULong)pitch; for ( j = 0; j < width; j++ ) { temp[3 * j ] = line[j]; @@ -412,60 +284,59 @@ } else if ( vmul ) /* lcd_v */ { + int pitch = bitmap->pitch; + + /* Render 3 separate monochrome bitmaps, shifting the outline */ /* by 1/3 pixel. Triple the pitch to render on each third row. */ bitmap->pitch *= 3; bitmap->rows /= 3; - FT_Outline_Translate( outline, 0, 21 ); - bitmap->buffer += 2 * pitch; - - error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - - FT_Outline_Translate( outline, 0, -21 ); - bitmap->buffer -= pitch; - - error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - - FT_Outline_Translate( outline, 0, -21 ); - bitmap->buffer -= pitch; + bitmap->buffer += pitch; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; FT_Outline_Translate( outline, 0, 21 ); + y_shift += 21; + bitmap->buffer += pitch; + + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; + + FT_Outline_Translate( outline, 0, -42 ); + y_shift -= 42; + bitmap->buffer -= 2 * pitch; + + error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; bitmap->pitch /= 3; bitmap->rows *= 3; } else /* grayscale */ - { error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - } #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - /* everything is fine; don't deallocate buffer */ - have_buffer = FALSE; - - error = FT_Err_Ok; - Exit: - if ( have_outline_shifted ) - FT_Outline_Translate( outline, -x_shift, -y_shift ); - if ( have_buffer ) + if ( !error ) + { + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; + } + else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_FREE( bitmap->buffer ); slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, -x_shift, -y_shift ); + return error; } @@ -492,14 +363,8 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - - error = ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_LCD ); - if ( !error ) - slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD; - - return error; + return ft_smooth_render_generic( render, slot, mode, origin, + FT_RENDER_MODE_LCD ); } @@ -510,14 +375,8 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - - error = ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_LCD_V ); - if ( !error ) - slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD_V; - - return error; + return ft_smooth_render_generic( render, slot, mode, origin, + FT_RENDER_MODE_LCD_V ); } diff --git a/sdk/lib/3rdparty/freetype/src/smooth/ftsmooth.h b/sdk/lib/3rdparty/freetype/src/smooth/ftsmooth.h index 6dfd65726c6..c76ffc5034e 100644 --- a/sdk/lib/3rdparty/freetype/src/smooth/ftsmooth.h +++ b/sdk/lib/3rdparty/freetype/src/smooth/ftsmooth.h @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/smooth/ftspic.c b/sdk/lib/3rdparty/freetype/src/smooth/ftspic.c index fb89be34885..10f04cf4ccf 100644 --- a/sdk/lib/3rdparty/freetype/src/smooth/ftspic.c +++ b/sdk/lib/3rdparty/freetype/src/smooth/ftspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/smooth/ftspic.h b/sdk/lib/3rdparty/freetype/src/smooth/ftspic.h index 9ddd1c79056..80fb64cff43 100644 --- a/sdk/lib/3rdparty/freetype/src/smooth/ftspic.h +++ b/sdk/lib/3rdparty/freetype/src/smooth/ftspic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/smooth/smooth.c b/sdk/lib/3rdparty/freetype/src/smooth/smooth.c index e0460d9d46d..5249a8931e3 100644 --- a/sdk/lib/3rdparty/freetype/src/smooth/smooth.c +++ b/sdk/lib/3rdparty/freetype/src/smooth/smooth.c @@ -4,7 +4,7 @@ /* */ /* FreeType anti-aliasing rasterer module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/tools/afblue.pl b/sdk/lib/3rdparty/freetype/src/tools/afblue.pl index 027b6304136..7c6f1a7df13 100644 --- a/sdk/lib/3rdparty/freetype/src/tools/afblue.pl +++ b/sdk/lib/3rdparty/freetype/src/tools/afblue.pl @@ -5,7 +5,7 @@ # # Process a blue zone character data file. # -# Copyright 2013-2017 by +# Copyright 2013-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, diff --git a/sdk/lib/3rdparty/freetype/src/tools/docmaker/content.py b/sdk/lib/3rdparty/freetype/src/tools/docmaker/content.py index 283d8151887..c9969dbe5bb 100644 --- a/sdk/lib/3rdparty/freetype/src/tools/docmaker/content.py +++ b/sdk/lib/3rdparty/freetype/src/tools/docmaker/content.py @@ -3,7 +3,7 @@ # # Parse comment blocks to build content blocks (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, @@ -453,15 +453,32 @@ class ContentProcessor: markup_lines = [] first = 1 + margin = -1 + in_code = 0 + for line in content: - found = None - for t in re_markup_tags: - m = t.match( line ) + if in_code: + m = re_code_end.match( line ) + if m and len( m.group( 1 ) ) <= margin: + in_code = 0 + margin = -1 + else: + m = re_code_start.match( line ) if m: - found = string.lower( m.group( 1 ) ) - prefix = len( m.group( 0 ) ) - line = " " * prefix + line[prefix:] # remove markup from line - break + in_code = 1 + margin = len( m.group( 1 ) ) + + found = None + + if not in_code: + for t in re_markup_tags: + m = t.match( line ) + if m: + found = string.lower( m.group( 1 ) ) + prefix = len( m.group( 0 ) ) + # remove markup from line + line = " " * prefix + line[prefix:] + break # is it the start of a new markup section ? if found: diff --git a/sdk/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py b/sdk/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py index 4e25ff0f87b..253a4d35af7 100644 --- a/sdk/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py +++ b/sdk/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py @@ -4,7 +4,7 @@ # # Convert source code markup to HTML documentation. # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/sdk/lib/3rdparty/freetype/src/tools/docmaker/formatter.py b/sdk/lib/3rdparty/freetype/src/tools/docmaker/formatter.py index 2745754f389..2708fd40d60 100644 --- a/sdk/lib/3rdparty/freetype/src/tools/docmaker/formatter.py +++ b/sdk/lib/3rdparty/freetype/src/tools/docmaker/formatter.py @@ -3,7 +3,7 @@ # # Convert parsed content blocks to a structured document (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/sdk/lib/3rdparty/freetype/src/tools/docmaker/sources.py b/sdk/lib/3rdparty/freetype/src/tools/docmaker/sources.py index 06407e16436..2cd5a3379c2 100644 --- a/sdk/lib/3rdparty/freetype/src/tools/docmaker/sources.py +++ b/sdk/lib/3rdparty/freetype/src/tools/docmaker/sources.py @@ -3,7 +3,7 @@ # # Convert source code comments to multi-line blocks (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, @@ -171,7 +171,7 @@ re_bold = re.compile( r"\*((?:\w|-)(?:\w|'|-)*)\*(.*)" ) # *bold* # # This regular expression code to identify an URL has been taken from # -# http://mail.python.org/pipermail/tutor/2002-September/017228.html +# https://mail.python.org/pipermail/tutor/2002-September/017228.html # # (with slight modifications). # diff --git a/sdk/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py b/sdk/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py index 012b55e49a7..7f5ecda41ce 100644 --- a/sdk/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py +++ b/sdk/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py @@ -3,7 +3,7 @@ # # A sub-class container of the `Formatter' class to produce HTML. # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, @@ -25,7 +25,7 @@ import time # The following strings define the HTML header used by all generated pages. html_header_1 = """\ +"https://www.w3.org/TR/html4/loose.dtd"> diff --git a/sdk/lib/3rdparty/freetype/src/tools/docmaker/utils.py b/sdk/lib/3rdparty/freetype/src/tools/docmaker/utils.py index ba5b2e7596e..f40f1674a04 100644 --- a/sdk/lib/3rdparty/freetype/src/tools/docmaker/utils.py +++ b/sdk/lib/3rdparty/freetype/src/tools/docmaker/utils.py @@ -3,7 +3,7 @@ # # Auxiliary functions for the `docmaker' tool (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/sdk/lib/3rdparty/freetype/src/tools/glnames.py b/sdk/lib/3rdparty/freetype/src/tools/glnames.py index 3270eebb3d2..b048d293641 100644 --- a/sdk/lib/3rdparty/freetype/src/tools/glnames.py +++ b/sdk/lib/3rdparty/freetype/src/tools/glnames.py @@ -6,7 +6,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -151,7 +151,7 @@ mac_standard_names = \ # The list of standard `SID' glyph names. For the official list, # see Annex A of document at # -# http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf . +# https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf . # sid_standard_names = \ [ @@ -5318,7 +5318,7 @@ def main(): write( "/* */\n" ) write( "/* PostScript glyph names. */\n" ) write( "/* */\n" ) - write( "/* Copyright 2005-2017 by */\n" ) + write( "/* Copyright 2005-2018 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" ) diff --git a/sdk/lib/3rdparty/freetype/src/truetype/truetype.c b/sdk/lib/3rdparty/freetype/src/truetype/truetype.c index 301b82ad1c7..484370975c6 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/truetype.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/truetype.c @@ -4,7 +4,7 @@ /* */ /* FreeType TrueType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttdriver.c b/sdk/lib/3rdparty/freetype/src/truetype/ttdriver.c index a1653b241ca..820cafbb8d8 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttdriver.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,7 +31,7 @@ #include FT_SERVICE_TRUETYPE_ENGINE_H #include FT_SERVICE_TRUETYPE_GLYF_H #include FT_SERVICE_PROPERTIES_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttdriver.h" #include "ttgload.h" @@ -233,8 +233,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without VVAR table */ - if ( !face->is_default_instance && - !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) && + !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -253,8 +253,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without HVAR table */ - if ( !face->is_default_instance && - !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) && + !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -498,6 +498,7 @@ (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ (FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */ (FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */ (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ (FT_Done_Blend_Func) tt_done_blend /* done_blend */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttdriver.h b/sdk/lib/3rdparty/freetype/src/truetype/ttdriver.h index 3bcba7f745b..707aa68edf3 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttdriver.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttdriver.h @@ -4,7 +4,7 @@ /* */ /* High-level TrueType driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/tterrors.h b/sdk/lib/3rdparty/freetype/src/truetype/tterrors.h index a49f205156b..88bca3a04af 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/tterrors.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/tterrors.h @@ -4,7 +4,7 @@ /* */ /* TrueType error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttgload.c b/sdk/lib/3rdparty/freetype/src/truetype/ttgload.c index 5e102c61519..32ed34aba5e 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttgload.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttgload.c @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,7 +24,7 @@ #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include FT_LIST_H #include "ttgload.h" @@ -664,7 +664,52 @@ } while ( subglyph->flags & MORE_COMPONENTS ); gloader->current.num_subglyphs = num_subglyphs; - FT_TRACE5(( " %d components\n", num_subglyphs )); + FT_TRACE5(( " %d component%s\n", + num_subglyphs, + num_subglyphs > 1 ? "s" : "" )); + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt i; + + + subglyph = gloader->current.subglyphs; + + for ( i = 0; i < num_subglyphs; i++ ) + { + if ( num_subglyphs > 1 ) + FT_TRACE7(( " subglyph %d:\n", i )); + + FT_TRACE7(( " glyph index: %d\n", subglyph->index )); + + if ( subglyph->flags & ARGS_ARE_XY_VALUES ) + FT_TRACE7(( " offset: x=%d, y=%d\n", + subglyph->arg1, + subglyph->arg2 )); + else + FT_TRACE7(( " matching points: base=%d, component=%d\n", + subglyph->arg1, + subglyph->arg2 )); + + if ( subglyph->flags & WE_HAVE_A_SCALE ) + FT_TRACE7(( " scaling: %f\n", + subglyph->transform.xx / 65536.0 )); + else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE ) + FT_TRACE7(( " scaling: x=%f, y=%f\n", + subglyph->transform.xx / 65536.0, + subglyph->transform.yy / 65536.0 )); + else if ( subglyph->flags & WE_HAVE_A_2X2 ) + FT_TRACE7(( " scaling: xx=%f, yx=%f\n" + " xy=%f, yy=%f\n", + subglyph->transform.xx / 65536.0, + subglyph->transform.yx / 65536.0, + subglyph->transform.xy / 65536.0, + subglyph->transform.yy / 65536.0 )); + + subglyph++; + } + } +#endif /* FT_DEBUG_LEVEL_TRACE */ #ifdef TT_USE_BYTECODE_INTERPRETER @@ -756,7 +801,7 @@ { FT_TRACE1(( "TT_Hint_Glyph: too long instructions" )); FT_TRACE1(( " (0x%lx byte) is truncated\n", - loader->glyph->control_len )); + loader->glyph->control_len )); } n_ins = loader->glyph->control_len; @@ -889,7 +934,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !loader->face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( loader->face ) ) || + FT_IS_VARIATION( FT_FACE( loader->face ) ) ) { /* Deltas apply to the unscaled data. */ error = TT_Vary_Apply_Glyph_Deltas( loader->face, @@ -991,9 +1037,24 @@ vec->x = FT_MulFix( vec->x, x_scale ); vec->y = FT_MulFix( vec->y, y_scale ); } + } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */ + if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) || + !IS_HINTED( loader->load_flags ) ) +#endif + { loader->pp1 = outline->points[n_points - 4]; loader->pp2 = outline->points[n_points - 3]; + } + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */ + if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) || + !IS_HINTED( loader->load_flags ) ) +#endif + { loader->pp3 = outline->points[n_points - 2]; loader->pp4 = outline->points[n_points - 1]; } @@ -1145,8 +1206,28 @@ if ( subglyph->flags & ROUND_XY_TO_GRID ) { - x = FT_PIX_ROUND( x ); - y = FT_PIX_ROUND( y ); + TT_Face face = loader->face; + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); + + + if ( IS_HINTED( loader->load_flags ) ) + { + /* + * We round the horizontal offset only if there is hinting along + * the x axis; this corresponds to integer advance width values. + * + * Theoretically, a glyph's bytecode can toggle ClearType's + * `backward compatibility' mode, which would allow modification + * of the advance width. In reality, however, applications + * neither allow nor expect modified advance widths if sub-pixel + * rendering is active. + * + */ + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_35 ) + x = FT_PIX_ROUND( x ); + + y = FT_PIX_ROUND( y ); + } } } } @@ -1359,6 +1440,7 @@ TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face ); #endif + #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) { @@ -1577,7 +1659,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !loader->face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) { /* a small outline structure with four elements for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ @@ -1711,7 +1794,7 @@ /* clear the nodes filled by sibling chains */ node = ft_list_get_node_at( &loader->composites, recurse_count ); for ( node2 = node; node2; node2 = node2->next ) - node2->data = (void*)ULONG_MAX; + node2->data = (void*)FT_ULONG_MAX; /* check whether we already have a composite glyph with this index */ if ( FT_List_Find( &loader->composites, @@ -1751,7 +1834,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) { short i, limit; FT_SubGlyph subglyph; @@ -2609,7 +2693,8 @@ TT_LoaderRec loader; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#define IS_DEFAULT_INSTANCE ( ( (TT_Face)glyph->face )->is_default_instance ) +#define IS_DEFAULT_INSTANCE ( !( FT_IS_NAMED_INSTANCE( glyph->face ) || \ + FT_IS_VARIATION( glyph->face ) ) ) #else #define IS_DEFAULT_INSTANCE 1 #endif diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttgload.h b/sdk/lib/3rdparty/freetype/src/truetype/ttgload.h index 1dd6c841db4..d237cfd2841 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttgload.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttgload.h @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttgxvar.c b/sdk/lib/3rdparty/freetype/src/truetype/ttgxvar.c index 49aa53a687b..6f456cf8c41 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttgxvar.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ /* */ /* TrueType GX Font Variation loader */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1043,10 +1043,11 @@ outerIndex, innerIndex ); - FT_TRACE5(( "%s value %d adjusted by %d units (%s)\n", + FT_TRACE5(( "%s value %d adjusted by %d unit%s (%s)\n", vertical ? "vertical height" : "horizontal width", *avalue, delta, + delta == 1 ? "" : "s", vertical ? "VVAR" : "HVAR" )); *avalue += delta; @@ -1333,13 +1334,15 @@ if ( p ) { - FT_TRACE5(( "value %c%c%c%c (%d units) adjusted by %d units (MVAR)\n", + FT_TRACE5(( "value %c%c%c%c (%d unit%s) adjusted by %d unit%s (MVAR)\n", (FT_Char)( value->tag >> 24 ), (FT_Char)( value->tag >> 16 ), (FT_Char)( value->tag >> 8 ), (FT_Char)( value->tag ), value->unmodified, - delta )); + value->unmodified == 1 ? "" : "s", + delta, + delta == 1 ? "" : "s" )); /* since we handle both signed and unsigned values as FT_Short, */ /* ensure proper overflow arithmetic */ @@ -1499,8 +1502,10 @@ blend->gv_glyphcnt = gvar_head.glyphCount; offsetToData = gvar_start + gvar_head.offsetToData; - FT_TRACE5(( "gvar: there are %d shared coordinates:\n", - blend->tuplecount )); + FT_TRACE5(( "gvar: there %s %d shared coordinate%s:\n", + blend->tuplecount == 1 ? "is" : "are", + blend->tuplecount, + blend->tuplecount == 1 ? "" : "s" )); if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) ) goto Exit; @@ -1728,7 +1733,9 @@ /* based on the [min,def,max] values for the axis to be [-1,0,1]. */ /* Then, if there's an `avar' table, we renormalize this range. */ - FT_TRACE5(( "design coordinates:\n" )); + FT_TRACE5(( "%d design coordinate%s:\n", + num_coords, + num_coords == 1 ? "" : "s" )); a = mmvar->axis; for ( i = 0; i < num_coords; i++, a++ ) @@ -1746,17 +1753,17 @@ a->minimum / 65536.0, a->maximum / 65536.0 )); - if ( coord > a->maximum) + if ( coord > a->maximum ) coord = a->maximum; else coord = a->minimum; } if ( coord < a->def ) - normalized[i] = -FT_DivFix( coords[i] - a->def, + normalized[i] = -FT_DivFix( coord - a->def, a->minimum - a->def ); else if ( coord > a->def ) - normalized[i] = FT_DivFix( coords[i] - a->def, + normalized[i] = FT_DivFix( coord - a->def, a->maximum - a->def ); else normalized[i] = 0; @@ -1822,16 +1829,8 @@ nc = blend->num_axis; } - if ( face->doblend ) - { - for ( i = 0; i < nc; i++ ) - design[i] = coords[i]; - } - else - { - for ( i = 0; i < nc; i++ ) - design[i] = 0; - } + for ( i = 0; i < nc; i++ ) + design[i] = coords[i]; for ( ; i < num_coords; i++ ) design[i] = 0; @@ -1940,11 +1939,11 @@ TT_Get_MM_Var( TT_Face face, FT_MM_Var* *master ) { - FT_Stream stream = face->root.stream; - FT_Memory memory = face->root.memory; + FT_Stream stream = face->root.stream; + FT_Memory memory = face->root.memory; FT_ULong table_len; - FT_Error error = FT_Err_Ok; - FT_ULong fvar_start; + FT_Error error = FT_Err_Ok; + FT_ULong fvar_start = 0; FT_UInt i, j; FT_MM_Var* mmvar = NULL; FT_Fixed* next_coords; @@ -1954,10 +1953,20 @@ FT_Fixed* c; FT_Var_Named_Style* ns; GX_FVar_Head fvar_head; - FT_Bool usePsName; + FT_Bool usePsName = 0; FT_UInt num_instances; + FT_UInt num_axes; FT_UShort* axis_flags; + FT_Offset mmvar_size; + FT_Offset axis_flags_size; + FT_Offset axis_size; + FT_Offset namedstyle_size; + FT_Offset next_coords_size; + FT_Offset next_name_size; + + FT_Bool need_init; + static const FT_Frame_Field fvar_fields[] = { @@ -1995,7 +2004,9 @@ /* read the font data and set up the internal representation */ /* if not already done */ - if ( !face->blend ) + need_init = !face->blend; + + if ( need_init ) { FT_TRACE2(( "FVAR " )); @@ -2037,21 +2048,49 @@ if ( FT_NEW( face->blend ) ) goto Exit; - /* `num_instances' holds the number of all named instances, */ - /* including the default instance which might be missing */ - /* in fvar's table of named instances */ - num_instances = face->root.style_flags >> 16; + num_axes = fvar_head.axisCount; + } + else + num_axes = face->blend->num_axis; - /* prepare storage area for MM data; this cannot overflow */ - /* 32-bit arithmetic because of the size limits used in the */ - /* `fvar' table validity check in `sfnt_init_face' */ - face->blend->mmvar_len = - sizeof ( FT_MM_Var ) + - fvar_head.axisCount * sizeof ( FT_UShort ) + - fvar_head.axisCount * sizeof ( FT_Var_Axis ) + - num_instances * sizeof ( FT_Var_Named_Style ) + - num_instances * fvar_head.axisCount * sizeof ( FT_Fixed ) + - fvar_head.axisCount * 5; + /* `num_instances' holds the number of all named instances, */ + /* including the default instance which might be missing */ + /* in fvar's table of named instances */ + num_instances = (FT_UInt)face->root.style_flags >> 16; + + /* prepare storage area for MM data; this cannot overflow */ + /* 32-bit arithmetic because of the size limits used in the */ + /* `fvar' table validity check in `sfnt_init_face' */ + + /* the various `*_size' variables, which we also use as */ + /* offsets into the `mmlen' array, must be multiples of the */ + /* pointer size (except the last one); without such an */ + /* alignment there might be runtime errors due to */ + /* misaligned addresses */ +#undef ALIGN_SIZE +#define ALIGN_SIZE( n ) \ + ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) ) + + mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) ); + axis_flags_size = ALIGN_SIZE( num_axes * + sizeof ( FT_UShort ) ); + axis_size = ALIGN_SIZE( num_axes * + sizeof ( FT_Var_Axis ) ); + namedstyle_size = ALIGN_SIZE( num_instances * + sizeof ( FT_Var_Named_Style ) ); + next_coords_size = ALIGN_SIZE( num_instances * + num_axes * + sizeof ( FT_Fixed ) ); + next_name_size = num_axes * 5; + + if ( need_init ) + { + face->blend->mmvar_len = mmvar_size + + axis_flags_size + + axis_size + + namedstyle_size + + next_coords_size + + next_name_size; if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) ) goto Exit; @@ -2061,7 +2100,7 @@ /* the data gets filled in later on */ mmvar->num_axis = - fvar_head.axisCount; + num_axes; mmvar->num_designs = ~0U; /* meaningless in this context; each glyph */ /* may have a different number of designs */ @@ -2071,22 +2110,23 @@ /* alas, no public field in `FT_Var_Axis' for axis flags */ axis_flags = - (FT_UShort*)&( mmvar[1] ); + (FT_UShort*)( (char*)mmvar + mmvar_size ); mmvar->axis = - (FT_Var_Axis*)&( axis_flags[fvar_head.axisCount] ); + (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); mmvar->namedstyle = - (FT_Var_Named_Style*)&( mmvar->axis[fvar_head.axisCount] ); + (FT_Var_Named_Style*)( (char*)mmvar->axis + axis_size ); - next_coords = - (FT_Fixed*)&( mmvar->namedstyle[num_instances] ); + next_coords = (FT_Fixed*)( (char*)mmvar->namedstyle + + namedstyle_size ); for ( i = 0; i < num_instances; i++ ) { mmvar->namedstyle[i].coords = next_coords; - next_coords += fvar_head.axisCount; + next_coords += num_axes; } - next_name = (FT_String*)next_coords; - for ( i = 0; i < fvar_head.axisCount; i++ ) + next_name = (FT_String*)( (char*)mmvar->namedstyle + + namedstyle_size + next_coords_size ); + for ( i = 0; i < num_axes; i++ ) { mmvar->axis[i].name = next_name; next_name += 5; @@ -2098,7 +2138,7 @@ goto Exit; a = mmvar->axis; - for ( i = 0; i < fvar_head.axisCount; i++ ) + for ( i = 0; i < num_axes; i++ ) { GX_FVar_Axis axis_rec; @@ -2148,7 +2188,7 @@ /* named instance coordinates are stored as design coordinates; */ /* we have to convert them to normalized coordinates also */ if ( FT_NEW_ARRAY( face->blend->normalized_stylecoords, - fvar_head.axisCount * num_instances ) ) + num_axes * num_instances ) ) goto Exit; if ( fvar_head.instanceCount && !face->blend->avar_loaded ) @@ -2168,14 +2208,14 @@ { /* PostScript names add 2 bytes to the instance record size */ if ( FT_FRAME_ENTER( ( usePsName ? 6L : 4L ) + - 4L * fvar_head.axisCount ) ) + 4L * num_axes ) ) goto Exit; ns->strid = FT_GET_USHORT(); (void) /* flags = */ FT_GET_USHORT(); c = ns->coords; - for ( j = 0; j < fvar_head.axisCount; j++, c++ ) + for ( j = 0; j < num_axes; j++, c++ ) *c = FT_GET_LONG(); /* valid psid values are 6, [256;32767], and 0xFFFF */ @@ -2184,11 +2224,8 @@ else ns->psid = 0xFFFF; - ft_var_to_normalized( face, - fvar_head.axisCount, - ns->coords, - nsc ); - nsc += fvar_head.axisCount; + ft_var_to_normalized( face, num_axes, ns->coords, nsc ); + nsc += num_axes; FT_FRAME_EXIT(); } @@ -2237,7 +2274,7 @@ a = mmvar->axis; c = ns->coords; - for ( j = 0; j < fvar_head.axisCount; j++, a++, c++ ) + for ( j = 0; j < num_axes; j++, a++, c++ ) *c = a->def; } } @@ -2258,23 +2295,24 @@ FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len ); axis_flags = - (FT_UShort*)&( mmvar[1] ); + (FT_UShort*)( (char*)mmvar + mmvar_size ); mmvar->axis = - (FT_Var_Axis*)&( axis_flags[mmvar->num_axis] ); + (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); mmvar->namedstyle = - (FT_Var_Named_Style*)&( mmvar->axis[mmvar->num_axis] ); + (FT_Var_Named_Style*)( (char*)mmvar->axis+ axis_size ); - next_coords = - (FT_Fixed*)&( mmvar->namedstyle[mmvar->num_namedstyles] ); + next_coords = (FT_Fixed*)( (char*)mmvar->namedstyle + + namedstyle_size ); for ( n = 0; n < mmvar->num_namedstyles; n++ ) { mmvar->namedstyle[n].coords = next_coords; - next_coords += mmvar->num_axis; + next_coords += num_axes; } a = mmvar->axis; - next_name = (FT_String*)next_coords; - for ( n = 0; n < mmvar->num_axis; n++ ) + next_name = (FT_String*)( (char*)mmvar->namedstyle + + namedstyle_size + next_coords_size ); + for ( n = 0; n < num_axes; n++ ) { a->name = next_name; @@ -2309,10 +2347,9 @@ FT_Error error = FT_Err_Ok; GX_Blend blend; FT_MM_Var* mmvar; - FT_UInt i, j; + FT_UInt i; - FT_Bool is_default_instance = TRUE; - FT_Bool all_design_coords = FALSE; + FT_Bool all_design_coords = FALSE; FT_Memory memory = face->root.memory; @@ -2357,9 +2394,6 @@ error = FT_THROW( Invalid_Argument ); goto Exit; } - - if ( coords[i] != 0 ) - is_default_instance = FALSE; } FT_TRACE5(( "\n" )); @@ -2390,6 +2424,12 @@ } else { + FT_Bool have_diff = 0; + FT_UInt j; + FT_Fixed* c; + FT_Fixed* n; + + manageCvt = mcvt_retain; for ( i = 0; i < num_coords; i++ ) @@ -2397,10 +2437,34 @@ if ( blend->normalizedcoords[i] != coords[i] ) { manageCvt = mcvt_load; + have_diff = 1; break; } } + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + { + FT_UInt idx = (FT_UInt)face->root.face_index >> 16; + + + c = blend->normalizedcoords + i; + n = blend->normalized_stylecoords + idx * mmvar->num_axis + i; + for ( j = i; j < mmvar->num_axis; j++, n++, c++ ) + if ( *c != *n ) + have_diff = 1; + } + else + { + c = blend->normalizedcoords + i; + for ( j = i; j < mmvar->num_axis; j++, c++ ) + if ( *c != 0 ) + have_diff = 1; + } + + /* return value -1 indicates `no change' */ + if ( !have_diff ) + return -1; + for ( ; i < mmvar->num_axis; i++ ) { if ( blend->normalizedcoords[i] != 0 ) @@ -2454,32 +2518,6 @@ } } - /* check whether the current variation tuple coincides */ - /* with a named instance */ - - for ( i = 0; i < blend->mmvar->num_namedstyles; i++ ) - { - FT_Fixed* nsc = blend->normalized_stylecoords + i * blend->num_axis; - FT_Fixed* ns = blend->normalizedcoords; - - - for ( j = 0; j < blend->num_axis; j++, nsc++, ns++ ) - { - if ( *nsc != *ns ) - break; - } - - if ( j == blend->num_axis ) - break; - } - - /* adjust named instance index */ - face->root.face_index &= 0xFFFF; - if ( i < blend->mmvar->num_namedstyles ) - face->root.face_index |= ( i + 1 ) << 16; - - face->is_default_instance = is_default_instance; - /* enforce recomputation of the PostScript name; */ FT_FREE( face->postscript_name ); face->postscript_name = NULL; @@ -2519,7 +2557,19 @@ FT_UInt num_coords, FT_Fixed* coords ) { - return tt_set_mm_blend( face, num_coords, coords, 1 ); + FT_Error error; + + + error = tt_set_mm_blend( face, num_coords, coords, 1 ); + if ( error ) + return error; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + return FT_Err_Ok; } @@ -2635,11 +2685,12 @@ FT_UInt i; FT_Memory memory = face->root.memory; - FT_Var_Axis* a; - FT_Fixed* c; - + FT_Fixed* c; + FT_Fixed* n; FT_Fixed* normalized = NULL; + FT_Bool have_diff = 0; + if ( !face->blend ) { @@ -2664,14 +2715,55 @@ goto Exit; } - FT_MEM_COPY( blend->coords, - coords, - num_coords * sizeof ( FT_Fixed ) ); + c = blend->coords; + n = coords; + for ( i = 0; i < num_coords; i++, n++, c++ ) + { + if ( *c != *n ) + { + *c = *n; + have_diff = 1; + } + } - a = mmvar->axis + num_coords; - c = blend->coords + num_coords; - for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ ) - *c = a->def; + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + { + FT_UInt instance_index; + FT_Var_Named_Style* named_style; + + + instance_index = (FT_UInt)face->root.face_index >> 16; + named_style = mmvar->namedstyle + instance_index - 1; + + n = named_style->coords + num_coords; + for ( ; i < mmvar->num_axis; i++, n++, c++ ) + { + if ( *c != *n ) + { + *c = *n; + have_diff = 1; + } + } + } + else + { + FT_Var_Axis* a; + + + a = mmvar->axis + num_coords; + for ( ; i < mmvar->num_axis; i++, a++, c++ ) + { + if ( *c != a->def ) + { + *c = a->def; + have_diff = 1; + } + } + } + + /* return value -1 indicates `no change' */ + if ( !have_diff ) + return -1; if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) goto Exit; @@ -2682,6 +2774,13 @@ ft_var_to_normalized( face, num_coords, blend->coords, normalized ); error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 ); + if ( error ) + goto Exit; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; Exit: FT_FREE( normalized ); @@ -2764,6 +2863,90 @@ } + /*************************************************************************/ + /* */ + /* */ + /* TT_Set_Named_Instance */ + /* */ + /* */ + /* Set the given named instance, also resetting any further */ + /* variation. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* instance_index :: The instance index, starting with value 1. */ + /* Value 0 indicates to not use an instance. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Set_Named_Instance( TT_Face face, + FT_UInt instance_index ) + { + FT_Error error = FT_ERR( Invalid_Argument ); + GX_Blend blend; + FT_MM_Var* mmvar; + + FT_UInt num_instances; + + + if ( !face->blend ) + { + if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) + goto Exit; + } + + blend = face->blend; + mmvar = blend->mmvar; + + num_instances = (FT_UInt)face->root.style_flags >> 16; + + /* `instance_index' starts with value 1, thus `>' */ + if ( instance_index > num_instances ) + goto Exit; + + if ( instance_index > 0 && mmvar->namedstyle ) + { + FT_Memory memory = face->root.memory; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; + + FT_Var_Named_Style* named_style; + FT_String* style_name; + + + named_style = mmvar->namedstyle + instance_index - 1; + + error = sfnt->get_name( face, + (FT_UShort)named_style->strid, + &style_name ); + if ( error ) + goto Exit; + + /* set (or replace) style name */ + FT_FREE( face->root.style_name ); + face->root.style_name = style_name; + + /* finally, select the named instance */ + error = TT_Set_Var_Design( face, + mmvar->num_axis, + named_style->coords ); + if ( error ) + goto Exit; + } + else + error = TT_Set_Var_Design( face, 0, NULL ); + + face->root.face_index = ( instance_index << 16 ) | + ( face->root.face_index & 0xFFFFL ); + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + Exit: + return error; + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -2810,8 +2993,10 @@ FT_Fixed* im_start_coords = NULL; FT_Fixed* im_end_coords = NULL; GX_Blend blend = face->blend; - FT_UInt point_count; - FT_UShort* localpoints; + FT_UInt point_count, spoint_count = 0; + FT_UShort* sharedpoints = NULL; + FT_UShort* localpoints = NULL; + FT_UShort* points; FT_Short* deltas; @@ -2880,11 +3065,24 @@ offsetToData += table_start; - /* The documentation implies there are flags packed into */ - /* `tupleCount', but John Jenkins says that shared points don't apply */ - /* to `cvar', and no other flags are defined. */ + if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS ) + { + here = FT_Stream_FTell( stream ); - FT_TRACE5(( "cvar: there are %d tuples:\n", tupleCount & 0xFFF )); + FT_Stream_SeekSet( stream, offsetToData ); + + sharedpoints = ft_var_readpackedpoints( stream, + table_len, + &spoint_count ); + offsetToData = FT_Stream_FTell( stream ); + + FT_Stream_SeekSet( stream, here ); + } + + FT_TRACE5(( "cvar: there %s %d tuple%s:\n", + ( tupleCount & 0xFFF ) == 1 ? "is" : "are", + tupleCount & 0xFFF, + ( tupleCount & 0xFFF ) == 1 ? "" : "s" )); for ( i = 0; i < ( tupleCount & 0xFFF ); i++ ) { @@ -2898,26 +3096,25 @@ tupleDataSize = FT_GET_USHORT(); tupleIndex = FT_GET_USHORT(); - /* There is no provision here for a global tuple coordinate section, */ - /* so John says. There are no tuple indices, just embedded tuples. */ - if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) { for ( j = 0; j < blend->num_axis; j++ ) tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */ /* short frac to fixed */ } - else + else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount ) { - /* skip this tuple; it makes no sense */ + FT_TRACE2(( "tt_face_vary_cvt:" + " invalid tuple index\n" )); - if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) - for ( j = 0; j < 2 * blend->num_axis; j++ ) - (void)FT_GET_SHORT(); - - offsetToData += tupleDataSize; - continue; + error = FT_THROW( Invalid_Table ); + goto Exit; } + else + FT_MEM_COPY( + tuple_coords, + &blend->tuplecoords[( tupleIndex & 0xFFF ) * blend->num_axis], + blend->num_axis * sizeof ( FT_Fixed ) ); if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) { @@ -2932,11 +3129,8 @@ tuple_coords, im_start_coords, im_end_coords ); - if ( /* tuple isn't active for our blend */ - apply == 0 || - /* global points not allowed, */ - /* if they aren't local, makes no sense */ - !( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) ) + + if ( apply == 0 ) /* tuple isn't active for our blend */ { offsetToData += tupleDataSize; continue; @@ -2946,14 +3140,27 @@ FT_Stream_SeekSet( stream, offsetToData ); - localpoints = ft_var_readpackedpoints( stream, - table_len, - &point_count ); - deltas = ft_var_readpackeddeltas( stream, - table_len, - point_count == 0 ? face->cvt_size - : point_count ); - if ( !localpoints || !deltas ) + if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) + { + localpoints = ft_var_readpackedpoints( stream, + table_len, + &point_count ); + points = localpoints; + } + else + { + points = sharedpoints; + point_count = spoint_count; + } + + deltas = ft_var_readpackeddeltas( stream, + table_len, + point_count == 0 ? face->cvt_size + : point_count ); + + if ( !points || + !deltas || + ( localpoints == ALL_POINTS && point_count != face->cvt_size ) ) ; /* failure, ignore it */ else if ( localpoints == ALL_POINTS ) @@ -3005,7 +3212,7 @@ FT_Long orig_cvt; - pindex = localpoints[j]; + pindex = points[j]; if ( (FT_ULong)pindex >= face->cvt_size ) continue; @@ -3044,6 +3251,8 @@ FT_FRAME_EXIT(); Exit: + if ( sharedpoints != ALL_POINTS ) + FT_FREE( sharedpoints ); FT_FREE( tuple_coords ); FT_FREE( im_start_coords ); FT_FREE( im_end_coords ); @@ -3330,7 +3539,6 @@ glyph_start = FT_Stream_FTell( stream ); /* each set of glyph variation data is formatted similarly to `cvar' */ - /* (except we get shared points and global tuples) */ if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) || FT_NEW_ARRAY( im_start_coords, blend->num_axis ) || @@ -3367,8 +3575,10 @@ FT_Stream_SeekSet( stream, here ); } - FT_TRACE5(( "gvar: there are %d tuples:\n", - tupleCount & GX_TC_TUPLE_COUNT_MASK )); + FT_TRACE5(( "gvar: there %s %d tuple%s:\n", + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "is" : "are", + tupleCount & GX_TC_TUPLE_COUNT_MASK, + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" )); for ( j = 0; j < n_points; j++ ) points_org[j] = outline->points[j]; @@ -3470,7 +3680,7 @@ FT_Pos delta_y = FT_MulFix( deltas_y[j], apply ); - if ( j < n_points - 3 ) + if ( j < n_points - 4 ) { outline->points[j].x += delta_x; outline->points[j].y += delta_y; @@ -3480,25 +3690,25 @@ /* To avoid double adjustment of advance width or height, */ /* adjust phantom points only if there is no HVAR or VVAR */ /* support, respectively. */ - if ( j == ( n_points - 3 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( j == ( n_points - 4 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_LSB ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 3 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_HADVANCE ) ) outline->points[j].x += delta_x; else if ( j == ( n_points - 2 ) && !( face->variation_support & - TT_FACE_FLAG_VAR_LSB ) ) - outline->points[j].x += delta_x; + TT_FACE_FLAG_VAR_TSB ) ) + outline->points[j].y += delta_y; else if ( j == ( n_points - 1 ) && !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) outline->points[j].y += delta_y; - - else if ( j == ( n_points - 0 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_TSB ) ) - outline->points[j].y += delta_y; } #ifdef FT_DEBUG_LEVEL_TRACE @@ -3565,8 +3775,36 @@ FT_Pos delta_y = points_out[j].y - points_org[j].y; - outline->points[j].x += delta_x; - outline->points[j].y += delta_y; + if ( j < n_points - 4 ) + { + outline->points[j].x += delta_x; + outline->points[j].y += delta_y; + } + else + { + /* To avoid double adjustment of advance width or height, */ + /* adjust phantom points only if there is no HVAR or VVAR */ + /* support, respectively. */ + if ( j == ( n_points - 4 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_LSB ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 3 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_HADVANCE ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 2 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_TSB ) ) + outline->points[j].y += delta_y; + + else if ( j == ( n_points - 1 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_VADVANCE ) ) + outline->points[j].y += delta_y; + } #ifdef FT_DEBUG_LEVEL_TRACE if ( delta_x || delta_y ) diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttgxvar.h b/sdk/lib/3rdparty/freetype/src/truetype/ttgxvar.h index 7e81719a3e1..a37bb90266c 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttgxvar.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttgxvar.h @@ -4,7 +4,7 @@ /* */ /* TrueType GX Font Variation loader (specification) */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and George Williams. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,6 +27,8 @@ FT_BEGIN_HEADER +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /*************************************************************************/ /* */ /* */ @@ -401,6 +403,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Fixed* coords ); + FT_LOCAL( FT_Error ) + TT_Set_Named_Instance( TT_Face face, + FT_UInt instance_index ); + FT_LOCAL( FT_Error ) tt_face_vary_cvt( TT_Face face, FT_Stream stream ); @@ -435,6 +441,8 @@ FT_BEGIN_HEADER FT_LOCAL( void ) tt_done_blend( TT_Face face ); +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + FT_END_HEADER diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttinterp.c b/sdk/lib/3rdparty/freetype/src/truetype/ttinterp.c index ddcc839bb30..d855aaaa9c6 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttinterp.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 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_CALC_H #include FT_TRIGONOMETRY_H #include FT_SYSTEM_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include FT_MULTIPLE_MASTERS_H #include "ttinterp.h" @@ -5690,7 +5690,11 @@ ( B1 & 63 ) != 0 && ( B2 & 63 ) != 0 && B1 != B2 ) - Move_Zp2_Point( exc, point, -dx, -dy, TRUE ); + Move_Zp2_Point( exc, + point, + NEG_LONG( dx ), + NEG_LONG( dy ), + TRUE ); } } else if ( exc->face->sph_compatibility_mode ) @@ -5722,7 +5726,7 @@ if ( ( B1 & 63 ) == 0 && ( B2 & 63 ) != 0 && B1 != B2 ) - Move_Zp2_Point( exc, point, 0, -dy, TRUE ); + Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE ); } } else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL ) @@ -5991,7 +5995,7 @@ exc->tt_metrics.compensations[0] ); } - exc->func_move( exc, &exc->zp0, point, distance - org_dist ); + exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) ); Fail: exc->GS.rp0 = point; @@ -6074,8 +6078,12 @@ /* single width cut-in test */ - if ( FT_ABS( org_dist - exc->GS.single_width_value ) < - exc->GS.single_width_cutin ) + /* |org_dist - single_width_value| < single_width_cutin */ + if ( exc->GS.single_width_cutin > 0 && + org_dist < exc->GS.single_width_value + + exc->GS.single_width_cutin && + org_dist > exc->GS.single_width_value - + exc->GS.single_width_cutin ) { if ( org_dist >= 0 ) org_dist = exc->GS.single_width_value; @@ -7153,7 +7161,7 @@ SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) && ( B1 & 63 ) != 0 && ( B2 & 63 ) != 0 ) ) ) - exc->func_move( exc, &exc->zp0, A, -B ); + exc->func_move( exc, &exc->zp0, A, NEG_LONG( B ) ); } } else @@ -8478,7 +8486,9 @@ } while ( !exc->instruction_trap ); LNo_Error_: - FT_TRACE4(( " %d instructions executed\n", ins_counter )); + FT_TRACE4(( " %d instruction%s executed\n", + ins_counter == 1 ? "" : "s", + ins_counter )); return FT_Err_Ok; LErrorCodeOverflow_: diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttinterp.h b/sdk/lib/3rdparty/freetype/src/truetype/ttinterp.h index abbecfcee3b..2966439ea25 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttinterp.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttinterp.h @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttobjs.c b/sdk/lib/3rdparty/freetype/src/truetype/ttobjs.c index 081fa2f1a5c..bc8086f2568 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttobjs.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ /* */ /* Objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,7 +21,7 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttgload.h" #include "ttpload.h" @@ -147,7 +147,7 @@ { #define TRICK_NAMES_MAX_CHARACTERS 19 -#define TRICK_NAMES_COUNT 18 +#define TRICK_NAMES_COUNT 23 static const char trick_names[TRICK_NAMES_COUNT] [TRICK_NAMES_MAX_CHARACTERS + 1] = @@ -165,6 +165,11 @@ "cpop", /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */ "DFGirl-W6-WIN-BF", /* dftt-h6.ttf; version 1.00, 1993 */ + "DFGothic-EB", /* DynaLab Inc. 1992-1995 */ + "DFGyoSho-Lt", /* DynaLab Inc. 1992-1995 */ + "DFHSGothic-W5", /* DynaLab Inc. 1992-1995 */ + "DFHSMincho-W3", /* DynaLab Inc. 1992-1995 */ + "DFHSMincho-W7", /* DynaLab Inc. 1992-1995 */ "DFKaiSho-SB", /* dfkaisb.ttf */ "DFKaiShu", "DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */ @@ -265,7 +270,7 @@ tt_check_trickyness_sfnt_ids( TT_Face face ) { #define TRICK_SFNT_IDS_PER_FACE 3 -#define TRICK_SFNT_IDS_NUM_FACES 19 +#define TRICK_SFNT_IDS_NUM_FACES 26 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] [TRICK_SFNT_IDS_PER_FACE] = { @@ -284,6 +289,31 @@ { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */ { 0xA344A1EBUL, 0x000001E1UL } /* prep */ }, + { /* DFGothic-EB */ + { 0x12C3EBB2UL, 0x00000350UL }, /* cvt */ + { 0xB680EE64UL, 0x000087A7UL }, /* fpgm */ + { 0xCE939563UL, 0x00000758UL } /* prep */ + }, + { /* DFGyoSho-Lt */ + { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */ + { 0xCE5956E9UL, 0x0000BC85UL }, /* fpgm */ + { 0x8272F416UL, 0x00000045UL } /* prep */ + }, + { /* DFHSGothic-W5 */ + { 0x1262EB4EUL, 0x00000350UL }, /* cvt */ + { 0xE86A5D64UL, 0x00007940UL }, /* fpgm */ + { 0x7850F729UL, 0x000005FFUL } /* prep */ + }, + { /* DFHSMincho-W3 */ + { 0x122DEB0AUL, 0x00000350UL }, /* cvt */ + { 0x3D16328AUL, 0x0000859BUL }, /* fpgm */ + { 0xA93FC33BUL, 0x000002CBUL } /* prep */ + }, + { /* DFHSMincho-W7 */ + { 0x125FEB26UL, 0x00000350UL }, /* cvt */ + { 0xA5ACC982UL, 0x00007EE1UL }, /* fpgm */ + { 0x90999196UL, 0x0000041FUL } /* prep */ + }, { /* DFKaiShu */ { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */ { 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */ @@ -294,6 +324,16 @@ { 0xA6E78C01UL, 0x00008998UL }, /* fpgm */ { 0x13A42602UL, 0x0000007EUL } /* prep */ }, + { /* DLCLiShu */ + { 0x07DCF546UL, 0x00000308UL }, /* cvt */ + { 0x40FE7C90UL, 0x00008E2AUL }, /* fpgm */ + { 0x608174B5UL, 0x0000007AUL } /* prep */ + }, + { /* DLCHayBold */ + { 0xEB891238UL, 0x00000308UL }, /* cvt */ + { 0xD2E4DCD4UL, 0x0000676FUL }, /* fpgm */ + { 0x8EA5F293UL, 0x000003B8UL } /* prep */ + }, { /* HuaTianKaiTi */ { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */ { 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */ @@ -657,46 +697,17 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { - FT_Int instance_index = face_index >> 16; + FT_UInt instance_index = (FT_UInt)face_index >> 16; if ( FT_HAS_MULTIPLE_MASTERS( ttface ) && instance_index > 0 ) { - error = TT_Get_MM_Var( face, NULL ); + error = TT_Set_Named_Instance( face, instance_index ); if ( error ) goto Exit; - if ( face->blend->mmvar->namedstyle ) - { - FT_Memory memory = ttface->memory; - - FT_Var_Named_Style* named_style; - FT_String* style_name; - - - /* in `face_index', the instance index starts with value 1 */ - named_style = face->blend->mmvar->namedstyle + instance_index - 1; - error = sfnt->get_name( face, - (FT_UShort)named_style->strid, - &style_name ); - if ( error ) - goto Exit; - - /* set style name; if already set, replace it */ - if ( face->root.style_name ) - FT_FREE( face->root.style_name ); - face->root.style_name = style_name; - - /* finally, select the named instance */ - error = TT_Set_Var_Design( face, - face->blend->mmvar->num_axis, - named_style->coords ); - if ( error ) - goto Exit; - - tt_apply_mvar( face ); - } + tt_apply_mvar( face ); } } diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttobjs.h b/sdk/lib/3rdparty/freetype/src/truetype/ttobjs.h index cdacee75e5a..38fa30e4e9f 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttobjs.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ /* */ /* Objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttpic.c b/sdk/lib/3rdparty/freetype/src/truetype/ttpic.c index 66bd7e1934c..cdbb80639e1 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttpic.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttpic.h b/sdk/lib/3rdparty/freetype/src/truetype/ttpic.h index 1410cd73c30..df878ae6f1d 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttpic.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttpload.c b/sdk/lib/3rdparty/freetype/src/truetype/ttpload.c index bcf6b34f67f..d9526ad082b 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttpload.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttpload.c @@ -4,7 +4,7 @@ /* */ /* TrueType-specific tables loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttpload.h b/sdk/lib/3rdparty/freetype/src/truetype/ttpload.h index 79079f345af..fa125272472 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttpload.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttpload.h @@ -4,7 +4,7 @@ /* */ /* TrueType-specific tables loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttsubpix.c b/sdk/lib/3rdparty/freetype/src/truetype/ttsubpix.c index 1c8cf011098..d94bcc8b50d 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttsubpix.c +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttsubpix.c @@ -4,7 +4,7 @@ /* */ /* TrueType Subpixel Hinting. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 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 @@ #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttsubpix.h" @@ -753,24 +753,24 @@ /* Does font name match rule family? */ - if ( strcmp( detected_font_name, rule_font_name ) == 0 ) + if ( ft_strcmp( detected_font_name, rule_font_name ) == 0 ) return TRUE; /* Is font name a wildcard ""? */ - if ( strcmp( rule_font_name, "" ) == 0 ) + if ( ft_strcmp( rule_font_name, "" ) == 0 ) return TRUE; /* Is font name contained in a class list? */ for ( i = 0; i < FAMILY_CLASS_RULES_SIZE; i++ ) { - if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) { for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { - if ( strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) continue; - if ( strcmp( FAMILY_CLASS_Rules[i].member[j], - detected_font_name ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], + detected_font_name ) == 0 ) return TRUE; } } @@ -788,24 +788,24 @@ /* Does font style match rule style? */ - if ( strcmp( detected_font_style, rule_font_style ) == 0 ) + if ( ft_strcmp( detected_font_style, rule_font_style ) == 0 ) return TRUE; /* Is font style a wildcard ""? */ - if ( strcmp( rule_font_style, "" ) == 0 ) + if ( ft_strcmp( rule_font_style, "" ) == 0 ) return TRUE; /* Is font style contained in a class list? */ for ( i = 0; i < STYLE_CLASS_RULES_SIZE; i++ ) { - if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) { for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { - if ( strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) continue; - if ( strcmp( STYLE_CLASS_Rules[i].member[j], - detected_font_style ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], + detected_font_style ) == 0 ) return TRUE; } } diff --git a/sdk/lib/3rdparty/freetype/src/truetype/ttsubpix.h b/sdk/lib/3rdparty/freetype/src/truetype/ttsubpix.h index c68f97ff074..1070bb016fd 100644 --- a/sdk/lib/3rdparty/freetype/src/truetype/ttsubpix.h +++ b/sdk/lib/3rdparty/freetype/src/truetype/ttsubpix.h @@ -4,7 +4,7 @@ /* */ /* TrueType Subpixel Hinting. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1afm.c b/sdk/lib/3rdparty/freetype/src/type1/t1afm.c index 11a2646fc25..61053d9a640 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1afm.c +++ b/sdk/lib/3rdparty/freetype/src/type1/t1afm.c @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1afm.h b/sdk/lib/3rdparty/freetype/src/type1/t1afm.h index 9f62cd013d9..cb8d302b4d4 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1afm.h +++ b/sdk/lib/3rdparty/freetype/src/type1/t1afm.h @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1driver.c b/sdk/lib/3rdparty/freetype/src/type1/t1driver.c index c2089947f94..029b410b476 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1driver.c +++ b/sdk/lib/3rdparty/freetype/src/type1/t1driver.c @@ -4,7 +4,7 @@ /* */ /* Type 1 driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,8 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_HASH_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H +#include FT_DRIVER_H #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_GLYPH_DICT_H @@ -37,6 +39,7 @@ #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_SERVICE_POSTSCRIPT_INFO_H +#include FT_SERVICE_PROPERTIES_H #include FT_SERVICE_KERNING_H @@ -126,6 +129,7 @@ (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ (FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */ (FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ @@ -613,6 +617,18 @@ #endif + /* + * PROPERTY SERVICE + * + */ + + FT_DEFINE_SERVICE_PROPERTIESREC( + t1_service_properties, + + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ + + /* * SERVICE LIST * @@ -624,6 +640,7 @@ { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict }, { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TYPE_1 }, { FT_SERVICE_ID_POSTSCRIPT_INFO, &t1_service_ps_info }, + { FT_SERVICE_ID_PROPERTIES, &t1_service_properties }, #ifndef T1_CONFIG_OPTION_NO_AFM { FT_SERVICE_ID_KERNING, &t1_service_kerning }, @@ -713,7 +730,7 @@ FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof ( FT_DriverRec ), + sizeof ( PS_DriverRec ), "type1", 0x10000L, diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1driver.h b/sdk/lib/3rdparty/freetype/src/type1/t1driver.h index 292786448dc..2b1507233dd 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1driver.h +++ b/sdk/lib/3rdparty/freetype/src/type1/t1driver.h @@ -4,7 +4,7 @@ /* */ /* High-level Type 1 driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1errors.h b/sdk/lib/3rdparty/freetype/src/type1/t1errors.h index 492dbb4a421..9e0151b9571 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1errors.h +++ b/sdk/lib/3rdparty/freetype/src/type1/t1errors.h @@ -4,7 +4,7 @@ /* */ /* Type 1 error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1gload.c b/sdk/lib/3rdparty/freetype/src/type1/t1gload.c index 04f854ee6d5..ee2656b476a 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1gload.c +++ b/sdk/lib/3rdparty/freetype/src/type1/t1gload.c @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,6 +23,8 @@ #include FT_INTERNAL_STREAM_H #include FT_OUTLINE_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_DRIVER_H #include "t1errors.h" @@ -37,37 +39,28 @@ #define FT_COMPONENT trace_t1gload - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /********** *********/ - /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/ - /********** *********/ - /********** The following code is in charge of computing *********/ - /********** the maximum advance width of the font. It *********/ - /********** quickly processes each glyph charstring to *********/ - /********** extract the value from either a `sbw' or `seac' *********/ - /********** operator. *********/ - /********** *********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - static FT_Error T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder, FT_UInt glyph_index, - FT_Data* char_string ) + FT_Data* char_string, + FT_Bool* force_scaling ) { T1_Face face = (T1_Face)decoder->builder.face; T1_Font type1 = &face->type1; FT_Error error = FT_Err_Ok; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; + PS_Decoder psdecoder; + #ifdef FT_CONFIG_OPTION_INCREMENTAL FT_Incremental_InterfaceRec *inc = face->root.internal->incremental_interface; #endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); +#endif decoder->font_matrix = type1->font_matrix; decoder->font_offset = type1->font_offset; @@ -90,9 +83,56 @@ } if ( !error ) - error = decoder->funcs.parse_charstrings( - decoder, (FT_Byte*)char_string->pointer, - (FT_UInt)char_string->length ); + { + /* choose which renderer to use */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + if ( driver->hinting_engine == FT_HINTING_FREETYPE || + decoder->builder.metrics_only ) + error = decoder_funcs->parse_charstrings_old( + decoder, + (FT_Byte*)char_string->pointer, + (FT_UInt)char_string->length ); +#else + if ( decoder->builder.metrics_only ) + error = decoder_funcs->parse_metrics( + decoder, + (FT_Byte*)char_string->pointer, + (FT_UInt)char_string->length ); +#endif + else + { + CFF_SubFontRec subfont; + + + psaux->ps_decoder_init( &psdecoder, decoder, TRUE ); + + psaux->t1_make_subfont( FT_FACE( face ), + &face->type1.private_dict, &subfont ); + psdecoder.current_subfont = &subfont; + + error = decoder_funcs->parse_charstrings( + &psdecoder, + (FT_Byte*)char_string->pointer, + (FT_ULong)char_string->length ); + + /* Adobe's engine uses 16.16 numbers everywhere; */ + /* as a consequence, glyphs larger than 2000ppem get rejected */ + if ( FT_ERR_EQ( error, Glyph_Too_Big ) ) + { + /* this time, we retry unhinted and scale up the glyph later on */ + /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */ + /* 0x400 for both `x_scale' and `y_scale' in this case) */ + ((T1_GlyphSlot)decoder->builder.glyph)->hint = FALSE; + + *force_scaling = TRUE; + + error = decoder_funcs->parse_charstrings( + &psdecoder, + (FT_Byte*)char_string->pointer, + (FT_ULong)char_string->length ); + } + } + } #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -126,8 +166,10 @@ FT_UInt glyph_index ) { FT_Data glyph_data; - FT_Error error = T1_Parse_Glyph_And_Get_Char_String( - decoder, glyph_index, &glyph_data ); + FT_Bool force_scaling = FALSE; + FT_Error error = T1_Parse_Glyph_And_Get_Char_String( + decoder, glyph_index, &glyph_data, + &force_scaling ); #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -149,6 +191,23 @@ } + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********** *********/ + /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/ + /********** *********/ + /********** The following code is in charge of computing *********/ + /********** the maximum advance width of the font. It *********/ + /********** quickly processes each glyph charstring to *********/ + /********** extract the value from either a `sbw' or `seac' *********/ + /********** operator. *********/ + /********** *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL_DEF( FT_Error ) T1_Compute_Max_Advance( T1_Face face, FT_Pos* max_advance ) @@ -216,6 +275,7 @@ } psaux->t1_decoder_funcs->done( &decoder ); + #ifdef __REACTOS__ free(&decoder); #undef decoder @@ -294,6 +354,7 @@ else advances[nn] = 0; } + #ifdef __REACTOS__ free(&decoder); #undef decoder @@ -319,6 +380,8 @@ #endif T1_Face face = (T1_Face)t1glyph->face; FT_Bool hinting; + FT_Bool scaled; + FT_Bool force_scaling = FALSE; T1_Font type1 = &face->type1; PSAux_Service psaux = (PSAux_Service)face->psaux; const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; @@ -366,7 +429,10 @@ hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); + scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); + glyph->hint = hinting; + glyph->scaled = scaled; t1glyph->format = FT_GLYPH_FORMAT_OUTLINE; error = decoder_funcs->init( &decoder, @@ -396,13 +462,15 @@ /* now load the unscaled outline */ error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index, - &glyph_data ); + &glyph_data, + &force_scaling ); if ( error ) goto Exit; #ifdef FT_CONFIG_OPTION_INCREMENTAL glyph_data_loaded = 1; #endif + hinting = glyph->hint; font_matrix = decoder.font_matrix; font_offset = decoder.font_offset; @@ -492,7 +560,7 @@ } #endif - 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; diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1gload.h b/sdk/lib/3rdparty/freetype/src/type1/t1gload.h index cc4d5e734fb..72ef76f6ae3 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1gload.h +++ b/sdk/lib/3rdparty/freetype/src/type1/t1gload.h @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1load.c b/sdk/lib/3rdparty/freetype/src/type1/t1load.c index f569d6bec36..2b8d4893c69 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1load.c +++ b/sdk/lib/3rdparty/freetype/src/type1/t1load.c @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -366,14 +366,16 @@ } - FT_LOCAL_DEF( FT_Error ) - T1_Set_MM_Blend( T1_Face face, + static FT_Error + t1_set_mm_blend( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ) { PS_Blend blend = face->blend; FT_UInt n, m; + FT_Bool have_diff = 0; + if ( !blend ) return FT_THROW( Invalid_Argument ); @@ -405,9 +407,36 @@ result = FT_MulFix( result, factor ); } - blend->weight_vector[n] = result; + + if ( blend->weight_vector[n] != result ) + { + blend->weight_vector[n] = result; + have_diff = 1; + } } + /* return value -1 indicates `no change' */ + return have_diff ? FT_Err_Ok : -1; + } + + + FT_LOCAL_DEF( FT_Error ) + T1_Set_MM_Blend( T1_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Error error; + + + error = t1_set_mm_blend( face, num_coords, coords ); + if ( error ) + return error; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + return FT_Err_Ok; } @@ -452,6 +481,7 @@ FT_UInt num_coords, FT_Long* coords ) { + FT_Error error; PS_Blend blend = face->blend; FT_UInt n, p; FT_Fixed final_blends[T1_MAX_MM_DESIGNS]; @@ -518,7 +548,28 @@ final_blends[n] = the_blend; } - return T1_Set_MM_Blend( face, blend->num_axis, final_blends ); + error = t1_set_mm_blend( face, blend->num_axis, final_blends ); + if ( error ) + return error; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + return FT_Err_Ok; + } + + + /* MM fonts don't have named instances, so only the design is reset */ + + FT_LOCAL_DEF( FT_Error ) + T1_Reset_MM_Blend( T1_Face face, + FT_UInt instance_index ) + { + FT_UNUSED( instance_index ); + + return T1_Set_MM_Blend( face, 0, NULL ); } @@ -1266,7 +1317,7 @@ if ( ft_isdigit( *cur ) || *cur == '[' ) { T1_Encoding encode = &face->type1.encoding; - FT_Int count, n; + FT_Int count, array_size, n; PS_Table char_table = &loader->encoding_table; FT_Memory memory = parser->root.memory; FT_Error error; @@ -1283,13 +1334,12 @@ else count = (FT_Int)T1_ToInt( parser ); - /* only composite fonts (which we don't support) */ - /* can have larger values */ + array_size = count; if ( count > 256 ) { - FT_ERROR(( "parse_encoding: invalid encoding array size\n" )); - parser->root.error = FT_THROW( Invalid_File_Format ); - return; + FT_TRACE2(( "parse_encoding:" + " only using first 256 encoding array entries\n" )); + array_size = 256; } T1_Skip_Spaces( parser ); @@ -1305,18 +1355,18 @@ } /* we use a T1_Table to store our charnames */ - loader->num_chars = encode->num_chars = count; - if ( FT_NEW_ARRAY( encode->char_index, count ) || - FT_NEW_ARRAY( encode->char_name, count ) || + loader->num_chars = encode->num_chars = array_size; + if ( FT_NEW_ARRAY( encode->char_index, array_size ) || + FT_NEW_ARRAY( encode->char_name, array_size ) || FT_SET_ERROR( psaux->ps_table_funcs->init( - char_table, count, memory ) ) ) + char_table, array_size, memory ) ) ) { parser->root.error = error; return; } /* We need to `zero' out encoding_table.elements */ - for ( n = 0; n < count; n++ ) + for ( n = 0; n < array_size; n++ ) { char* notdef = (char *)".notdef"; @@ -1409,11 +1459,14 @@ len = (FT_UInt)( parser->root.cursor - cur ); - parser->root.error = T1_Add_Table( char_table, charcode, - cur, len + 1 ); - if ( parser->root.error ) - return; - char_table->elements[charcode][len] = '\0'; + if ( n < array_size ) + { + parser->root.error = T1_Add_Table( char_table, charcode, + cur, len + 1 ); + if ( parser->root.error ) + return; + char_table->elements[charcode][len] = '\0'; + } n++; } diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1load.h b/sdk/lib/3rdparty/freetype/src/type1/t1load.h index 2d86984f0e7..03be3f7f937 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1load.h +++ b/sdk/lib/3rdparty/freetype/src/type1/t1load.h @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -89,6 +89,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); + FT_LOCAL( FT_Error ) + T1_Reset_MM_Blend( T1_Face face, + FT_UInt instance_index ); + FT_LOCAL( FT_Error ) T1_Get_Var_Design( T1_Face face, FT_UInt num_coords, diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1objs.c b/sdk/lib/3rdparty/freetype/src/type1/t1objs.c index 5ac1292ae0b..7333c4c9587 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1objs.c +++ b/sdk/lib/3rdparty/freetype/src/type1/t1objs.c @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_IDS_H +#include FT_DRIVER_H #include "t1gload.h" #include "t1load.h" @@ -379,7 +380,7 @@ /* 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 */ + /* https://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! */ @@ -578,9 +579,42 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - T1_Driver_Init( FT_Module driver ) + T1_Driver_Init( FT_Module module ) { - FT_UNUSED( driver ); + PS_Driver driver = (PS_Driver)module; + + FT_UInt32 seed; + + + /* set default property values, cf. `ftt1drv.h' */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + driver->hinting_engine = FT_HINTING_FREETYPE; +#else + driver->hinting_engine = FT_HINTING_ADOBE; +#endif + + driver->no_stem_darkening = TRUE; + + driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; + driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; + driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2; + driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2; + driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3; + driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3; + driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4; + driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4; + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&module ^ + (FT_Offset)(char*)module->memory ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + + driver->random_seed = (FT_Int32)seed; + if ( driver->random_seed < 0 ) + driver->random_seed = -driver->random_seed; + else if ( driver->random_seed == 0 ) + driver->random_seed = 123456789; return FT_Err_Ok; } diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1objs.h b/sdk/lib/3rdparty/freetype/src/type1/t1objs.h index 39d26bf8b9a..8298e036f4b 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1objs.h +++ b/sdk/lib/3rdparty/freetype/src/type1/t1objs.h @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -120,12 +120,12 @@ FT_BEGIN_HEADER FT_Bool hint; FT_Bool scaled; - FT_Int max_points; - FT_Int max_contours; - FT_Fixed x_scale; FT_Fixed y_scale; + FT_Int max_points; + FT_Int max_contours; + } T1_GlyphSlotRec; diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1parse.c b/sdk/lib/3rdparty/freetype/src/type1/t1parse.c index 18dd26434ce..8e201e5ef5a 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1parse.c +++ b/sdk/lib/3rdparty/freetype/src/type1/t1parse.c @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1parse.h b/sdk/lib/3rdparty/freetype/src/type1/t1parse.h index 3396680d1a3..4ac82ae913e 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1parse.h +++ b/sdk/lib/3rdparty/freetype/src/type1/t1parse.h @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/t1tokens.h b/sdk/lib/3rdparty/freetype/src/type1/t1tokens.h index ca0c55f9037..43a65d88ea4 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/t1tokens.h +++ b/sdk/lib/3rdparty/freetype/src/type1/t1tokens.h @@ -4,7 +4,7 @@ /* */ /* Type 1 tokenizer (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type1/type1.c b/sdk/lib/3rdparty/freetype/src/type1/type1.c index 81795376ef2..72eff59bfed 100644 --- a/sdk/lib/3rdparty/freetype/src/type1/type1.c +++ b/sdk/lib/3rdparty/freetype/src/type1/type1.c @@ -4,7 +4,7 @@ /* */ /* FreeType Type 1 driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/t42drivr.c b/sdk/lib/3rdparty/freetype/src/type42/t42drivr.c index 366cfb3a1de..f579b2708c8 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/t42drivr.c +++ b/sdk/lib/3rdparty/freetype/src/type42/t42drivr.c @@ -4,7 +4,7 @@ /* */ /* High-level Type 42 driver interface (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/t42drivr.h b/sdk/lib/3rdparty/freetype/src/type42/t42drivr.h index 1ac4a0a1a12..3667f3e0667 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/t42drivr.h +++ b/sdk/lib/3rdparty/freetype/src/type42/t42drivr.h @@ -4,7 +4,7 @@ /* */ /* High-level Type 42 driver interface (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/t42error.h b/sdk/lib/3rdparty/freetype/src/type42/t42error.h index fda92abf57c..e3978a76077 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/t42error.h +++ b/sdk/lib/3rdparty/freetype/src/type42/t42error.h @@ -4,7 +4,7 @@ /* */ /* Type 42 error codes (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/t42objs.c b/sdk/lib/3rdparty/freetype/src/type42/t42objs.c index 1c4ebd768a0..66e5c403825 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/t42objs.c +++ b/sdk/lib/3rdparty/freetype/src/type42/t42objs.c @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/t42objs.h b/sdk/lib/3rdparty/freetype/src/type42/t42objs.h index eb4c5bf69f8..3bad5135e09 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/t42objs.h +++ b/sdk/lib/3rdparty/freetype/src/type42/t42objs.h @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/t42parse.c b/sdk/lib/3rdparty/freetype/src/type42/t42parse.c index e7c6770bd29..4813d1f3f98 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/t42parse.c +++ b/sdk/lib/3rdparty/freetype/src/type42/t42parse.c @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/t42parse.h b/sdk/lib/3rdparty/freetype/src/type42/t42parse.h index 7a68606f2e2..f35d23de635 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/t42parse.h +++ b/sdk/lib/3rdparty/freetype/src/type42/t42parse.h @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/t42types.h b/sdk/lib/3rdparty/freetype/src/type42/t42types.h index 2306ab6c773..d0aa2de5705 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/t42types.h +++ b/sdk/lib/3rdparty/freetype/src/type42/t42types.h @@ -4,7 +4,7 @@ /* */ /* Type 42 font data types (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/type42/type42.c b/sdk/lib/3rdparty/freetype/src/type42/type42.c index ae8ac267823..6a89cfbed1b 100644 --- a/sdk/lib/3rdparty/freetype/src/type42/type42.c +++ b/sdk/lib/3rdparty/freetype/src/type42/type42.c @@ -4,7 +4,7 @@ /* */ /* FreeType Type 42 driver component. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/winfonts/fnterrs.h b/sdk/lib/3rdparty/freetype/src/winfonts/fnterrs.h index 4251021a700..3a86af5aace 100644 --- a/sdk/lib/3rdparty/freetype/src/winfonts/fnterrs.h +++ b/sdk/lib/3rdparty/freetype/src/winfonts/fnterrs.h @@ -4,7 +4,7 @@ /* */ /* Win FNT/FON error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/sdk/lib/3rdparty/freetype/src/winfonts/winfnt.c b/sdk/lib/3rdparty/freetype/src/winfonts/winfnt.c index 4c479623193..36bd3148d51 100644 --- a/sdk/lib/3rdparty/freetype/src/winfonts/winfnt.c +++ b/sdk/lib/3rdparty/freetype/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2003 Huw D M Davies for Codeweavers */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ diff --git a/sdk/lib/3rdparty/freetype/src/winfonts/winfnt.h b/sdk/lib/3rdparty/freetype/src/winfonts/winfnt.h index 884b645a2db..4885c9d7452 100644 --- a/sdk/lib/3rdparty/freetype/src/winfonts/winfnt.h +++ b/sdk/lib/3rdparty/freetype/src/winfonts/winfnt.h @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ /* */