summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype2/freetype-src/src
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-08-29 06:19:44 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-08-29 06:19:44 +0000
commit0de5be92a3a0fe27e8521fc4de67e19b1057842e (patch)
treee93a390fe965486cca19498840cb8d7904252fec /Build/source/libs/freetype2/freetype-src/src
parent27ce96eea3f1190bd744448cfa149e8d767af95a (diff)
revert freetype to 2.10.4
git-svn-id: svn://tug.org/texlive/trunk@60360 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src')
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afangles.c285
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afangles.h7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afblue.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afblue.cin2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afblue.dat2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afblue.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afblue.hin2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.c66
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afcover.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/aferrors.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c14
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c132
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afhints.h17
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afindic.c7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afindic.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c125
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/aflatin2.c2428
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/aflatin2.h46
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afloader.c39
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afloader.h4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.c56
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.h5
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afranges.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afranges.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afscript.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.c57
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afstyles.h11
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h60
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afwarp.c373
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afwarp.h66
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afwrtsys.h9
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/autofit.c5
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftadvanc.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftbase.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftbase.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftbbox.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftbdf.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftcid.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftcolor.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c334
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/fterrors.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftfntfmt.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftfstype.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftgasp.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftgloadr.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftgxval.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftinit.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftlcdfil.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftmac.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftmm.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c259
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftotval.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftoutln.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftpatent.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftpfr.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftpsprop.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftrfork.c28
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftsnames.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftstream.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftstroke.c47
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftsynth.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftsystem.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/fttype1.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftutil.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftver.rc8
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftwinfnt.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c58
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/bzip2/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcache.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcbasic.c12
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftccback.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcerror.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c31
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cff.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c16
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cfferrs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffgload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffload.c70
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffparse.c12
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffparse.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cfftoken.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/ciderrs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c19
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidgload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidload.c36
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidriver.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidriver.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidtoken.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/type1cid.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/dlg/dlg.c803
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c35
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/dlg/rules.mk70
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/README2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvbsln.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c41
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxverror.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfgen.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvlcar.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort0.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort1.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort4.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx0.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx1.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx4.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx5.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c35
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gzip/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.c9
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/lzw/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h20
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pcf/pcfdrivr.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c82
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfr.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrerror.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c130
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c11
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.c7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h1
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psblues.c3
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/pshints.c60
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c20
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c26
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c5
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c16
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshinter.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshnterr.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psnames/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c41
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psnames/psnamerr.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psnames/psnames.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psnames/pstables.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psnames/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c294
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/ftraster.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/raster.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/rasterrs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c1349
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c3878
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.h97
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfcommon.c147
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfcommon.h139
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdferrs.h37
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c590
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.h118
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/module.mk29
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/rules.mk78
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/sdf.c29
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c13
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c41
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c24
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c14
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c57
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c12
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c710
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h23
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c35
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c111
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c22
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c744
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/ftsmerrs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/smooth.c2
-rwxr-xr-xBuild/source/libs/freetype2/freetype-src/src/tools/afblue.pl2
-rwxr-xr-xBuild/source/libs/freetype2/freetype-src/src/tools/chktrcmp.py4
-rwxr-xr-xBuild/source/libs/freetype2/freetype-src/src/tools/glnames.py2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/tools/no-copyright4
-rwxr-xr-xBuild/source/libs/freetype2/freetype-src/src/tools/update-copyright-year65
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/truetype.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/tterrors.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c45
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c70
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c112
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h24
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c25
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1afm.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1driver.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1driver.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1errors.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1gload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1load.c30
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1load.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1objs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1parse.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1parse.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1tokens.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/type1.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42error.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c18
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c31
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/t42types.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type42/type42.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/winfonts/fnterrs.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/winfonts/module.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/winfonts/rules.mk2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c16
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.h2
374 files changed, 5044 insertions, 10831 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afangles.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afangles.c
new file mode 100644
index 00000000000..a2d45eb72c4
--- /dev/null
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afangles.c
@@ -0,0 +1,285 @@
+/****************************************************************************
+ *
+ * afangles.c
+ *
+ * Routines used to compute vector angles with limited accuracy
+ * and very high speed. It also contains sorting routines (body).
+ *
+ * Copyright (C) 2003-2020 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 "aftypes.h"
+
+
+ /*
+ * We are not using `af_angle_atan' anymore, but we keep the source
+ * code below just in case...
+ */
+
+
+#if 0
+
+
+ /*
+ * The trick here is to realize that we don't need a very accurate angle
+ * approximation. We are going to use the result of `af_angle_atan' to
+ * only compare the sign of angle differences, or check whether its
+ * magnitude is very small.
+ *
+ * The approximation
+ *
+ * dy * PI / (|dx|+|dy|)
+ *
+ * should be enough, and much faster to compute.
+ */
+ FT_LOCAL_DEF( AF_Angle )
+ af_angle_atan( FT_Fixed dx,
+ FT_Fixed dy )
+ {
+ AF_Angle angle;
+ FT_Fixed ax = dx;
+ FT_Fixed ay = dy;
+
+
+ if ( ax < 0 )
+ ax = -ax;
+ if ( ay < 0 )
+ ay = -ay;
+
+ ax += ay;
+
+ if ( ax == 0 )
+ angle = 0;
+ else
+ {
+ angle = ( AF_ANGLE_PI2 * dy ) / ( ax + ay );
+ if ( dx < 0 )
+ {
+ if ( angle >= 0 )
+ angle = AF_ANGLE_PI - angle;
+ else
+ angle = -AF_ANGLE_PI - angle;
+ }
+ }
+
+ return angle;
+ }
+
+
+#elif 0
+
+
+ /* the following table has been automatically generated with */
+ /* the `mather.py' Python script */
+
+#define AF_ATAN_BITS 8
+
+ static const FT_Byte af_arctan[1L << AF_ATAN_BITS] =
+ {
+ 0, 0, 1, 1, 1, 2, 2, 2,
+ 3, 3, 3, 3, 4, 4, 4, 5,
+ 5, 5, 6, 6, 6, 7, 7, 7,
+ 8, 8, 8, 9, 9, 9, 10, 10,
+ 10, 10, 11, 11, 11, 12, 12, 12,
+ 13, 13, 13, 14, 14, 14, 14, 15,
+ 15, 15, 16, 16, 16, 17, 17, 17,
+ 18, 18, 18, 18, 19, 19, 19, 20,
+ 20, 20, 21, 21, 21, 21, 22, 22,
+ 22, 23, 23, 23, 24, 24, 24, 24,
+ 25, 25, 25, 26, 26, 26, 26, 27,
+ 27, 27, 28, 28, 28, 28, 29, 29,
+ 29, 30, 30, 30, 30, 31, 31, 31,
+ 31, 32, 32, 32, 33, 33, 33, 33,
+ 34, 34, 34, 34, 35, 35, 35, 35,
+ 36, 36, 36, 36, 37, 37, 37, 38,
+ 38, 38, 38, 39, 39, 39, 39, 40,
+ 40, 40, 40, 41, 41, 41, 41, 42,
+ 42, 42, 42, 42, 43, 43, 43, 43,
+ 44, 44, 44, 44, 45, 45, 45, 45,
+ 46, 46, 46, 46, 46, 47, 47, 47,
+ 47, 48, 48, 48, 48, 48, 49, 49,
+ 49, 49, 50, 50, 50, 50, 50, 51,
+ 51, 51, 51, 51, 52, 52, 52, 52,
+ 52, 53, 53, 53, 53, 53, 54, 54,
+ 54, 54, 54, 55, 55, 55, 55, 55,
+ 56, 56, 56, 56, 56, 57, 57, 57,
+ 57, 57, 57, 58, 58, 58, 58, 58,
+ 59, 59, 59, 59, 59, 59, 60, 60,
+ 60, 60, 60, 61, 61, 61, 61, 61,
+ 61, 62, 62, 62, 62, 62, 62, 63,
+ 63, 63, 63, 63, 63, 64, 64, 64
+ };
+
+
+ FT_LOCAL_DEF( AF_Angle )
+ af_angle_atan( FT_Fixed dx,
+ FT_Fixed dy )
+ {
+ AF_Angle angle;
+
+
+ /* check trivial cases */
+ if ( dy == 0 )
+ {
+ angle = 0;
+ if ( dx < 0 )
+ angle = AF_ANGLE_PI;
+ return angle;
+ }
+ else if ( dx == 0 )
+ {
+ angle = AF_ANGLE_PI2;
+ if ( dy < 0 )
+ angle = -AF_ANGLE_PI2;
+ return angle;
+ }
+
+ angle = 0;
+ if ( dx < 0 )
+ {
+ dx = -dx;
+ dy = -dy;
+ angle = AF_ANGLE_PI;
+ }
+
+ if ( dy < 0 )
+ {
+ FT_Pos tmp;
+
+
+ tmp = dx;
+ dx = -dy;
+ dy = tmp;
+ angle -= AF_ANGLE_PI2;
+ }
+
+ if ( dx == 0 && dy == 0 )
+ return 0;
+
+ if ( dx == dy )
+ angle += AF_ANGLE_PI4;
+ else if ( dx > dy )
+ angle += af_arctan[FT_DivFix( dy, dx ) >> ( 16 - AF_ATAN_BITS )];
+ else
+ angle += AF_ANGLE_PI2 -
+ af_arctan[FT_DivFix( dx, dy ) >> ( 16 - AF_ATAN_BITS )];
+
+ if ( angle > AF_ANGLE_PI )
+ angle -= AF_ANGLE_2PI;
+
+ return angle;
+ }
+
+
+#endif /* 0 */
+
+
+ FT_LOCAL_DEF( void )
+ af_sort_pos( FT_UInt count,
+ FT_Pos* table )
+ {
+ FT_UInt i, j;
+ FT_Pos swap;
+
+
+ for ( i = 1; i < count; i++ )
+ {
+ for ( j = i; j > 0; j-- )
+ {
+ if ( table[j] >= table[j - 1] )
+ break;
+
+ swap = table[j];
+ table[j] = table[j - 1];
+ table[j - 1] = swap;
+ }
+ }
+ }
+
+
+ FT_LOCAL_DEF( void )
+ af_sort_and_quantize_widths( FT_UInt* count,
+ AF_Width table,
+ FT_Pos threshold )
+ {
+ FT_UInt i, j;
+ FT_UInt cur_idx;
+ FT_Pos cur_val;
+ FT_Pos sum;
+ AF_WidthRec swap;
+
+
+ if ( *count == 1 )
+ return;
+
+ /* sort */
+ for ( i = 1; i < *count; i++ )
+ {
+ for ( j = i; j > 0; j-- )
+ {
+ if ( table[j].org >= table[j - 1].org )
+ break;
+
+ swap = table[j];
+ table[j] = table[j - 1];
+ table[j - 1] = swap;
+ }
+ }
+
+ cur_idx = 0;
+ cur_val = table[cur_idx].org;
+
+ /* compute and use mean values for clusters not larger than */
+ /* `threshold'; this is very primitive and might not yield */
+ /* the best result, but normally, using reference character */
+ /* `o', `*count' is 2, so the code below is fully sufficient */
+ for ( i = 1; i < *count; i++ )
+ {
+ if ( table[i].org - cur_val > threshold ||
+ i == *count - 1 )
+ {
+ sum = 0;
+
+ /* fix loop for end of array */
+ if ( table[i].org - cur_val <= threshold &&
+ i == *count - 1 )
+ i++;
+
+ for ( j = cur_idx; j < i; j++ )
+ {
+ sum += table[j].org;
+ table[j].org = 0;
+ }
+ table[cur_idx].org = sum / (FT_Pos)j;
+
+ if ( i < *count - 1 )
+ {
+ cur_idx = i + 1;
+ cur_val = table[cur_idx].org;
+ }
+ }
+ }
+
+ cur_idx = 1;
+
+ /* compress array to remove zero values */
+ for ( i = 1; i < *count; i++ )
+ {
+ if ( table[i].org )
+ table[cur_idx++] = table[i];
+ }
+
+ *count = cur_idx;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afangles.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afangles.h
new file mode 100644
index 00000000000..18d7dae3a6b
--- /dev/null
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afangles.h
@@ -0,0 +1,7 @@
+/*
+ * afangles.h
+ *
+ * This is a dummy file, used to please the build system. It is never
+ * included by the auto-fitter sources.
+ *
+ */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.c
index c9e8045c183..9ebffdd0997 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.c
@@ -7,7 +7,7 @@
*
* Auto-fitter data for blue strings (body).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.cin b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.cin
index 071e80b031d..c6a697fee00 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.cin
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.cin
@@ -4,7 +4,7 @@
*
* Auto-fitter data for blue strings (body).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.dat b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.dat
index 1aa9b26de9f..b19b8df0f47 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.dat
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.dat
@@ -2,7 +2,7 @@
//
// Auto-fitter data for blue strings.
//
-// Copyright (C) 2013-2021 by
+// Copyright (C) 2013-2020 by
// David Turner, Robert Wilhelm, and Werner Lemberg.
//
// This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.h
index 311c9e3afda..486d663b6c9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.h
@@ -7,7 +7,7 @@
*
* Auto-fitter data for blue strings (specification).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.hin b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.hin
index 5186914937c..39570270917 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.hin
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afblue.hin
@@ -4,7 +4,7 @@
*
* Auto-fitter data for blue strings (specification).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.c
index 7e46b6b1ef5..3b340cd5eda 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.c
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for CJK writing system (body).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -37,6 +37,11 @@
#include "aferrors.h"
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+#include "afwarp.h"
+#endif
+
+
/**************************************************************************
*
* The macro FT_COMPONENT is used in trace mode. It is an implicit
@@ -67,11 +72,11 @@
AF_GlyphHintsRec hints[1];
- FT_TRACE5(( "\n" ));
- FT_TRACE5(( "cjk standard widths computation (style `%s')\n",
+ FT_TRACE5(( "\n"
+ "cjk standard widths computation (style `%s')\n"
+ "===================================================\n"
+ "\n",
af_style_names[metrics->root.style_class->style] ));
- FT_TRACE5(( "===================================================\n" ));
- FT_TRACE5(( "\n" ));
af_glyph_hints_init( hints, face->memory );
@@ -309,9 +314,9 @@
/* style's entry in the `af_blue_stringset' array, computing its */
/* extremum points (depending on the string properties) */
- FT_TRACE5(( "cjk blue zones computation\n" ));
- FT_TRACE5(( "==========================\n" ));
- FT_TRACE5(( "\n" ));
+ FT_TRACE5(( "cjk blue zones computation\n"
+ "==========================\n"
+ "\n" ));
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
shaper_buf = af_shaper_buf_create( face );
@@ -550,8 +555,9 @@
if ( AF_CJK_IS_TOP_BLUE( bs ) )
blue->flags |= AF_CJK_BLUE_TOP;
- FT_TRACE5(( " -> reference = %ld\n", *blue_ref ));
- FT_TRACE5(( " overshoot = %ld\n", *blue_shoot ));
+ FT_TRACE5(( " -> reference = %ld\n"
+ " overshoot = %ld\n",
+ *blue_ref, *blue_shoot ));
} /* end for loop */
@@ -737,12 +743,12 @@
blue->shoot.fit = blue->ref.fit - delta2;
- FT_TRACE5(( ">> active cjk blue zone %c%d[%ld/%ld]:\n",
+ FT_TRACE5(( ">> active cjk blue zone %c%d[%ld/%ld]:\n"
+ " ref: cur=%.2f fit=%.2f\n"
+ " shoot: cur=%.2f fit=%.2f\n",
( dim == AF_DIMENSION_HORZ ) ? 'H' : 'V',
- nn, blue->ref.org, blue->shoot.org ));
- FT_TRACE5(( " ref: cur=%.2f fit=%.2f\n",
- blue->ref.cur / 64.0, blue->ref.fit / 64.0 ));
- FT_TRACE5(( " shoot: cur=%.2f fit=%.2f\n",
+ nn, blue->ref.org, blue->shoot.org,
+ blue->ref.cur / 64.0, blue->ref.fit / 64.0,
blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 ));
blue->flags |= AF_CJK_BLUE_ACTIVE;
@@ -1395,6 +1401,11 @@
/* compute flags depending on render mode, etc. */
mode = metrics->root.scaler.render_mode;
+#if 0 /* AF_CONFIG_OPTION_USE_WARPER */
+ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )
+ metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;
+#endif
+
scaler_flags = hints->scaler_flags;
other_flags = 0;
@@ -1423,6 +1434,12 @@
scaler_flags |= AF_SCALER_FLAG_NO_ADVANCE;
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ /* get (global) warper flag */
+ if ( !metrics->root.globals->module->warping )
+ scaler_flags |= AF_SCALER_FLAG_NO_WARPER;
+#endif
+
hints->scaler_flags = scaler_flags;
hints->other_flags = other_flags;
@@ -2305,6 +2322,25 @@
if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||
( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) )
{
+
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+ AF_HINTS_DO_WARP( hints ) )
+ {
+ AF_WarperRec warper;
+ FT_Fixed scale;
+ FT_Pos delta;
+
+
+ af_warper_compute( &warper, hints, (AF_Dimension)dim,
+ &scale, &delta );
+ af_glyph_hints_scale_dim( hints, (AF_Dimension)dim,
+ scale, delta );
+ continue;
+ }
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
+
af_cjk_hint_edges( hints, (AF_Dimension)dim );
af_cjk_align_edge_points( hints, (AF_Dimension)dim );
af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim );
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.h
index 58aa298dada..fd0f451aa83 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afcjk.h
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for CJK writing system (specification).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afcover.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afcover.h
index c7ae1e9a8a2..03085ad07ea 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afcover.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afcover.h
@@ -4,7 +4,7 @@
*
* Auto-fitter coverages (specification only).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.c
index a36b56f7847..77d31df974f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.c
@@ -5,7 +5,7 @@
* Auto-fitter dummy routines to be used if no hinting should be
* performed (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.h
index b58849fe505..efd799e84b7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afdummy.h
@@ -5,7 +5,7 @@
* Auto-fitter dummy routines to be used if no hinting should be
* performed (specification).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/aferrors.h b/Build/source/libs/freetype2/freetype-src/src/autofit/aferrors.h
index 09bed663951..f90899944b5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/aferrors.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/aferrors.h
@@ -4,7 +4,7 @@
*
* Autofitter error codes (specification only).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c
index aedb74ddd40..d5129423d52 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c
@@ -4,7 +4,7 @@
*
* Auto-fitter routines to compute global hinting values (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -285,10 +285,10 @@
#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE4(( "\n" ));
- FT_TRACE4(( "style coverage\n" ));
- FT_TRACE4(( "==============\n" ));
- FT_TRACE4(( "\n" ));
+ FT_TRACE4(( "\n"
+ "style coverage\n"
+ "==============\n"
+ "\n" ));
for ( ss = 0; af_style_classes[ss]; ss++ )
{
@@ -478,10 +478,6 @@
{
style = (AF_Style)( globals->glyph_styles[gindex] &
AF_STYLE_UNASSIGNED );
- /* IMPORTANT: Clear the error code, see
- * https://gitlab.freedesktop.org/freetype/freetype/-/issues/1063
- */
- error = 0;
goto Again;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.h
index cd97e716c4e..fecf7af9773 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.h
@@ -5,7 +5,7 @@
* Auto-fitter routines to compute global hinting values
* (specification).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c
index 4bf6d66ddbf..a8e00890ef3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -32,104 +32,6 @@
#define FT_COMPONENT afhints
- FT_LOCAL_DEF( void )
- af_sort_pos( FT_UInt count,
- FT_Pos* table )
- {
- FT_UInt i, j;
- FT_Pos swap;
-
-
- for ( i = 1; i < count; i++ )
- {
- for ( j = i; j > 0; j-- )
- {
- if ( table[j] >= table[j - 1] )
- break;
-
- swap = table[j];
- table[j] = table[j - 1];
- table[j - 1] = swap;
- }
- }
- }
-
-
- FT_LOCAL_DEF( void )
- af_sort_and_quantize_widths( FT_UInt* count,
- AF_Width table,
- FT_Pos threshold )
- {
- FT_UInt i, j;
- FT_UInt cur_idx;
- FT_Pos cur_val;
- FT_Pos sum;
- AF_WidthRec swap;
-
-
- if ( *count == 1 )
- return;
-
- /* sort */
- for ( i = 1; i < *count; i++ )
- {
- for ( j = i; j > 0; j-- )
- {
- if ( table[j].org >= table[j - 1].org )
- break;
-
- swap = table[j];
- table[j] = table[j - 1];
- table[j - 1] = swap;
- }
- }
-
- cur_idx = 0;
- cur_val = table[cur_idx].org;
-
- /* compute and use mean values for clusters not larger than */
- /* `threshold'; this is very primitive and might not yield */
- /* the best result, but normally, using reference character */
- /* `o', `*count' is 2, so the code below is fully sufficient */
- for ( i = 1; i < *count; i++ )
- {
- if ( table[i].org - cur_val > threshold ||
- i == *count - 1 )
- {
- sum = 0;
-
- /* fix loop for end of array */
- if ( table[i].org - cur_val <= threshold &&
- i == *count - 1 )
- i++;
-
- for ( j = cur_idx; j < i; j++ )
- {
- sum += table[j].org;
- table[j].org = 0;
- }
- table[cur_idx].org = sum / (FT_Pos)j;
-
- if ( i < *count - 1 )
- {
- cur_idx = i + 1;
- cur_val = table[cur_idx].org;
- }
- }
- }
-
- cur_idx = 1;
-
- /* compress array to remove zero values */
- for ( i = 1; i < *count; i++ )
- {
- if ( table[i].org )
- table[cur_idx++] = table[i];
- }
-
- *count = cur_idx;
- }
-
/* Get new segment for given axis. */
FT_LOCAL_DEF( FT_Error )
@@ -953,6 +855,9 @@
hints->x_delta = x_delta;
hints->y_delta = y_delta;
+ hints->xmin_delta = 0;
+ hints->xmax_delta = 0;
+
points = hints->points;
if ( hints->num_points == 0 )
goto Exit;
@@ -1783,4 +1688,33 @@
}
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+
+ /* Apply (small) warp scale and warp delta for given dimension. */
+
+ FT_LOCAL_DEF( void )
+ af_glyph_hints_scale_dim( AF_GlyphHints hints,
+ AF_Dimension dim,
+ FT_Fixed scale,
+ FT_Pos delta )
+ {
+ AF_Point points = hints->points;
+ AF_Point points_limit = points + hints->num_points;
+ AF_Point point;
+
+
+ if ( dim == AF_DIMENSION_HORZ )
+ {
+ for ( point = points; point < points_limit; point++ )
+ point->x = FT_MulFix( point->fx, scale ) + delta;
+ }
+ else
+ {
+ for ( point = points; point < points_limit; point++ )
+ point->y = FT_MulFix( point->fy, scale ) + delta;
+ }
+ }
+
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
+
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.h
index 38d2847d712..6397f098f00 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.h
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines (specification).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -362,6 +362,9 @@ FT_BEGIN_HEADER
/* implementations */
AF_StyleMetrics metrics;
+ FT_Pos xmin_delta; /* used for warping */
+ FT_Pos xmax_delta;
+
/* Two arrays to avoid allocation penalty. */
/* The `embedded' structure must be the last element! */
struct
@@ -405,6 +408,10 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_ADVANCE( h ) \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
+#define AF_HINTS_DO_WARP( h ) \
+ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_WARPER )
+
+
FT_LOCAL( AF_Direction )
af_direction_compute( FT_Pos dx,
@@ -452,6 +459,14 @@ FT_BEGIN_HEADER
af_glyph_hints_align_weak_points( AF_GlyphHints hints,
AF_Dimension dim );
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ FT_LOCAL( void )
+ af_glyph_hints_scale_dim( AF_GlyphHints hints,
+ AF_Dimension dim,
+ FT_Fixed scale,
+ FT_Pos delta );
+#endif
+
FT_LOCAL( void )
af_glyph_hints_done( AF_GlyphHints hints );
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afindic.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afindic.c
index 064c300ed7d..bc2837a26dd 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afindic.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afindic.c
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for Indic writing system (body).
*
- * Copyright (C) 2007-2021 by
+ * Copyright (C) 2007-2020 by
* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.
*
* This file is part of the FreeType project, and may only be used,
@@ -27,6 +27,11 @@
#include "aferrors.h"
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+#include "afwarp.h"
+#endif
+
+
static FT_Error
af_indic_metrics_init( AF_CJKMetrics metrics,
FT_Face face )
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afindic.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afindic.h
index 3e467241125..088b88b19da 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afindic.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afindic.h
@@ -5,7 +5,7 @@
* Auto-fitter hinting routines for Indic writing system
* (specification).
*
- * Copyright (C) 2007-2021 by
+ * Copyright (C) 2007-2020 by
* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c
index b8af228a4f6..21ec02ebd2d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for latin writing system (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -24,6 +24,11 @@
#include "aferrors.h"
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+#include "afwarp.h"
+#endif
+
+
/**************************************************************************
*
* The macro FT_COMPONENT is used in trace mode. It is an implicit
@@ -58,11 +63,11 @@
AF_GlyphHintsRec hints[1];
- FT_TRACE5(( "\n" ));
- FT_TRACE5(( "latin standard widths computation (style `%s')\n",
+ FT_TRACE5(( "\n"
+ "latin standard widths computation (style `%s')\n"
+ "=====================================================\n"
+ "\n",
af_style_names[metrics->root.style_class->style] ));
- FT_TRACE5(( "=====================================================\n" ));
- FT_TRACE5(( "\n" ));
af_glyph_hints_init( hints, face->memory );
@@ -345,9 +350,9 @@
/* we walk over the blue character strings as specified in the */
/* style's entry in the `af_blue_stringset' array */
- FT_TRACE5(( "latin blue zones computation\n" ));
- FT_TRACE5(( "============================\n" ));
- FT_TRACE5(( "\n" ));
+ FT_TRACE5(( "latin blue zones computation\n"
+ "============================\n"
+ "\n" ));
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
shaper_buf = af_shaper_buf_create( face );
@@ -971,8 +976,9 @@
if ( AF_LATIN_IS_X_HEIGHT_BLUE( bs ) )
blue->flags |= AF_LATIN_BLUE_ADJUSTMENT;
- FT_TRACE5(( " -> reference = %ld\n", *blue_ref ));
- FT_TRACE5(( " overshoot = %ld\n", *blue_shoot ));
+ FT_TRACE5(( " -> reference = %ld\n"
+ " overshoot = %ld\n",
+ *blue_ref, *blue_shoot ));
} /* end for loop */
@@ -1269,28 +1275,29 @@
if ( dist == 0 )
{
- FT_TRACE5(( "af_latin_metrics_scale_dim:"
- " x height alignment (style `%s'):\n",
- af_style_names[metrics->root.style_class->style] ));
- FT_TRACE5(( " "
- " vertical scaling changed"
- " from %.5f to %.5f (by %ld%%)\n",
- scale / 65536.0,
- new_scale / 65536.0,
- ( fitted - scaled ) * 100 / scaled ));
- FT_TRACE5(( "\n" ));
+ FT_TRACE5((
+ "af_latin_metrics_scale_dim:"
+ " x height alignment (style `%s'):\n"
+ " "
+ " vertical scaling changed from %.5f to %.5f (by %ld%%)\n"
+ "\n",
+ af_style_names[metrics->root.style_class->style],
+ scale / 65536.0,
+ new_scale / 65536.0,
+ ( fitted - scaled ) * 100 / scaled ));
scale = new_scale;
}
#ifdef FT_DEBUG_LEVEL_TRACE
else
{
- FT_TRACE5(( "af_latin_metrics_scale_dim:"
- " x height alignment (style `%s'):\n",
- af_style_names[metrics->root.style_class->style] ));
- FT_TRACE5(( " "
- " excessive vertical scaling abandoned\n" ));
- FT_TRACE5(( "\n" ));
+ FT_TRACE5((
+ "af_latin_metrics_scale_dim:"
+ " x height alignment (style `%s'):\n"
+ " "
+ " excessive vertical scaling abandoned\n"
+ "\n",
+ af_style_names[metrics->root.style_class->style] ));
}
#endif
}
@@ -1339,11 +1346,9 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( axis->extra_light )
- {
- FT_TRACE5(( "`%s' style is extra light (at current resolution)\n",
+ FT_TRACE5(( "`%s' style is extra light (at current resolution)\n"
+ "\n",
af_style_names[metrics->root.style_class->style] ));
- FT_TRACE5(( "\n" ));
- }
#endif
if ( dim == AF_DIMENSION_VERT )
@@ -1468,13 +1473,13 @@
AF_LatinBlue blue = &axis->blues[nn];
- FT_TRACE5(( " reference %d: %ld scaled to %.2f%s\n",
+ FT_TRACE5(( " reference %d: %ld scaled to %.2f%s\n"
+ " overshoot %d: %ld scaled to %.2f%s\n",
nn,
blue->ref.org,
blue->ref.fit / 64.0,
( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? ""
- : " (inactive)" ));
- FT_TRACE5(( " overshoot %d: %ld scaled to %.2f%s\n",
+ : " (inactive)",
nn,
blue->shoot.org,
blue->shoot.fit / 64.0,
@@ -1842,31 +1847,6 @@
( FT_ABS( point->out_dir ) == major_dir ||
point == point->prev ) )
{
- /*
- * For efficiency, we restrict the number of segments to 1000,
- * which is a heuristic value: it is very unlikely that a glyph
- * with so many segments can be hinted in a sensible way.
- * Reasons:
- *
- * - The glyph has really 1000 segments; this implies that it has
- * at least 2000 outline points. Assuming 'normal' fonts that
- * have superfluous points optimized away, viewing such a glyph
- * only makes sense at large magnifications where hinting
- * isn't applied anyway.
- *
- * - We have a broken glyph. Hinting doesn't make sense in this
- * case either.
- */
- if ( axis->num_segments > 1000 )
- {
- FT_TRACE0(( "af_latin_hints_compute_segments:"
- " more than 1000 segments in this glyph;\n" ));
- FT_TRACE0(( " "
- " hinting is suppressed\n" ));
- axis->num_segments = 0;
- return FT_Err_Ok;
- }
-
/* this is the start of a new segment! */
segment_dir = (AF_Direction)point->out_dir;
@@ -2631,6 +2611,11 @@
/* compute flags depending on render mode, etc. */
mode = metrics->root.scaler.render_mode;
+#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */
+ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )
+ metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;
+#endif
+
scaler_flags = hints->scaler_flags;
other_flags = 0;
@@ -2668,6 +2653,12 @@
( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )
scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ /* get (global) warper flag */
+ if ( !metrics->root.globals->module->warping )
+ scaler_flags |= AF_SCALER_FLAG_NO_WARPER;
+#endif
+
hints->scaler_flags = scaler_flags;
hints->other_flags = other_flags;
@@ -3584,6 +3575,24 @@
/* grid-fit the outline */
for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
{
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+ AF_HINTS_DO_WARP( hints ) )
+ {
+ AF_WarperRec warper;
+ FT_Fixed scale;
+ FT_Pos delta;
+
+
+ af_warper_compute( &warper, hints, (AF_Dimension)dim,
+ &scale, &delta );
+ af_glyph_hints_scale_dim( hints, (AF_Dimension)dim,
+ scale, delta );
+ continue;
+ }
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
+
if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||
( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) )
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.h b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.h
index d6b919ef842..62bc4c8d442 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.h
@@ -5,7 +5,7 @@
* Auto-fitter hinting routines for latin writing system
* (specification).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin2.c b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin2.c
new file mode 100644
index 00000000000..902f3982e04
--- /dev/null
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin2.c
@@ -0,0 +1,2428 @@
+/* ATTENTION: This file doesn't compile. It is only here as a reference */
+/* of an alternative latin hinting algorithm that was always */
+/* marked as experimental. */
+
+
+/****************************************************************************
+ *
+ * aflatin2.c
+ *
+ * Auto-fitter hinting routines for latin writing system (body).
+ *
+ * Copyright (C) 2003-2020 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 <freetype/ftadvanc.h>
+
+
+#ifdef FT_OPTION_AUTOFIT2
+
+#include "afglobal.h"
+#include "aflatin.h"
+#include "aflatin2.h"
+#include "aferrors.h"
+
+
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+#include "afwarp.h"
+#endif
+
+
+ /**************************************************************************
+ *
+ * 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 aflatin2
+
+
+ FT_LOCAL_DEF( FT_Error )
+ af_latin2_hints_compute_segments( AF_GlyphHints hints,
+ AF_Dimension dim );
+
+ FT_LOCAL_DEF( void )
+ af_latin2_hints_link_segments( AF_GlyphHints hints,
+ AF_Dimension dim );
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** L A T I N G L O B A L M E T R I C S *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ FT_LOCAL_DEF( void )
+ af_latin2_metrics_init_widths( AF_LatinMetrics metrics,
+ FT_Face face )
+ {
+ /* scan the array of segments in each direction */
+ AF_GlyphHintsRec hints[1];
+
+
+ af_glyph_hints_init( hints, face->memory );
+
+ metrics->axis[AF_DIMENSION_HORZ].width_count = 0;
+ metrics->axis[AF_DIMENSION_VERT].width_count = 0;
+
+ {
+ FT_Error error;
+ FT_UInt glyph_index;
+ int dim;
+ AF_LatinMetricsRec dummy[1];
+ AF_Scaler scaler = &dummy->root.scaler;
+
+
+ glyph_index = FT_Get_Char_Index(
+ face,
+ metrics->root.style_class->standard_char );
+ if ( glyph_index == 0 )
+ goto Exit;
+
+ error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
+ if ( error || face->glyph->outline.n_points <= 0 )
+ goto Exit;
+
+ FT_ZERO( dummy );
+
+ dummy->units_per_em = metrics->units_per_em;
+ scaler->x_scale = scaler->y_scale = 0x10000L;
+ scaler->x_delta = scaler->y_delta = 0;
+ scaler->face = face;
+ scaler->render_mode = FT_RENDER_MODE_NORMAL;
+ scaler->flags = 0;
+
+ af_glyph_hints_rescale( hints, (AF_StyleMetrics)dummy );
+
+ error = af_glyph_hints_reload( hints, &face->glyph->outline );
+ if ( error )
+ goto Exit;
+
+ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
+ {
+ AF_LatinAxis axis = &metrics->axis[dim];
+ AF_AxisHints axhints = &hints->axis[dim];
+ AF_Segment seg, limit, link;
+ FT_UInt num_widths = 0;
+
+
+ error = af_latin2_hints_compute_segments( hints,
+ (AF_Dimension)dim );
+ if ( error )
+ goto Exit;
+
+ af_latin2_hints_link_segments( hints,
+ (AF_Dimension)dim );
+
+ seg = axhints->segments;
+ limit = seg + axhints->num_segments;
+
+ for ( ; seg < limit; seg++ )
+ {
+ link = seg->link;
+
+ /* we only consider stem segments there! */
+ if ( link && link->link == seg && link > seg )
+ {
+ FT_Pos dist;
+
+
+ dist = seg->pos - link->pos;
+ if ( dist < 0 )
+ dist = -dist;
+
+ if ( num_widths < AF_LATIN_MAX_WIDTHS )
+ axis->widths[num_widths++].org = dist;
+ }
+ }
+
+ af_sort_widths( num_widths, axis->widths );
+ axis->width_count = num_widths;
+ }
+
+ Exit:
+ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
+ {
+ AF_LatinAxis axis = &metrics->axis[dim];
+ FT_Pos stdw;
+
+
+ stdw = ( axis->width_count > 0 )
+ ? axis->widths[0].org
+ : AF_LATIN_CONSTANT( metrics, 50 );
+
+ /* let's try 20% of the smallest width */
+ axis->edge_distance_threshold = stdw / 5;
+ axis->standard_width = stdw;
+ axis->extra_light = 0;
+ }
+ }
+
+ af_glyph_hints_done( hints );
+ }
+
+
+
+#define AF_LATIN_MAX_TEST_CHARACTERS 12
+
+
+ static const char af_latin2_blue_chars[AF_LATIN_MAX_BLUES]
+ [AF_LATIN_MAX_TEST_CHARACTERS+1] =
+ {
+ "THEZOCQS",
+ "HEZLOCUS",
+ "fijkdbh",
+ "xzroesc",
+ "xzroesc",
+ "pqgjy"
+ };
+
+
+ static void
+ af_latin2_metrics_init_blues( AF_LatinMetrics metrics,
+ FT_Face face )
+ {
+ FT_Pos flats [AF_LATIN_MAX_TEST_CHARACTERS];
+ FT_Pos rounds[AF_LATIN_MAX_TEST_CHARACTERS];
+ FT_Int num_flats;
+ FT_Int num_rounds;
+ FT_Int bb;
+ AF_LatinBlue blue;
+ FT_Error error;
+ AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT];
+ FT_GlyphSlot glyph = face->glyph;
+
+
+ /* we compute the blues simply by loading each character from the */
+ /* 'af_latin2_blue_chars[blues]' string, then compute its top-most or */
+ /* bottom-most points (depending on `AF_IS_TOP_BLUE') */
+
+ FT_TRACE5(( "blue zones computation\n"
+ "======================\n\n" ));
+
+ for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ )
+ {
+ const char* p = af_latin2_blue_chars[bb];
+ const char* limit = p + AF_LATIN_MAX_TEST_CHARACTERS;
+ FT_Pos* blue_ref;
+ FT_Pos* blue_shoot;
+
+
+ FT_TRACE5(( "blue zone %d:\n", bb ));
+
+ num_flats = 0;
+ num_rounds = 0;
+
+ for ( ; p < limit && *p; p++ )
+ {
+ FT_UInt glyph_index;
+ FT_Int best_point, best_y, best_first, best_last;
+ FT_Vector* points;
+ FT_Bool round;
+
+
+ /* load the character in the face -- skip unknown or empty ones */
+ glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p );
+ if ( glyph_index == 0 )
+ continue;
+
+ error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
+ if ( error || glyph->outline.n_points <= 0 )
+ continue;
+
+ /* now compute min or max point indices and coordinates */
+ points = glyph->outline.points;
+ best_point = -1;
+ best_y = 0; /* make compiler happy */
+ best_first = 0; /* ditto */
+ best_last = 0; /* ditto */
+
+ {
+ FT_Int nn;
+ FT_Int first = 0;
+ FT_Int last = -1;
+
+
+ for ( nn = 0; nn < glyph->outline.n_contours; first = last+1, nn++ )
+ {
+ FT_Int old_best_point = best_point;
+ FT_Int pp;
+
+
+ last = glyph->outline.contours[nn];
+
+ /* Avoid single-point contours since they are never rasterized. */
+ /* In some fonts, they correspond to mark attachment points */
+ /* which are way outside of the glyph's real outline. */
+ if ( last <= first )
+ continue;
+
+ if ( AF_LATIN_IS_TOP_BLUE( bb ) )
+ {
+ for ( pp = first; pp <= last; pp++ )
+ if ( best_point < 0 || points[pp].y > best_y )
+ {
+ best_point = pp;
+ best_y = points[pp].y;
+ }
+ }
+ else
+ {
+ for ( pp = first; pp <= last; pp++ )
+ if ( best_point < 0 || points[pp].y < best_y )
+ {
+ best_point = pp;
+ best_y = points[pp].y;
+ }
+ }
+
+ if ( best_point != old_best_point )
+ {
+ best_first = first;
+ best_last = last;
+ }
+ }
+ FT_TRACE5(( " %c %d", *p, best_y ));
+ }
+
+ /* now check whether the point belongs to a straight or round */
+ /* segment; we first need to find in which contour the extremum */
+ /* lies, then inspect its previous and next points */
+ if ( best_point >= 0 )
+ {
+ FT_Pos best_x = points[best_point].x;
+ FT_Int start, end, prev, next;
+ FT_Pos dist;
+
+
+ /* now look for the previous and next points that are not on the */
+ /* same Y coordinate. Threshold the `closeness'... */
+ start = end = best_point;
+
+ do
+ {
+ prev = start - 1;
+ if ( prev < best_first )
+ prev = best_last;
+
+ dist = FT_ABS( points[prev].y - best_y );
+ /* accept a small distance or a small angle (both values are */
+ /* heuristic; value 20 corresponds to approx. 2.9 degrees) */
+ if ( dist > 5 )
+ if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist )
+ break;
+
+ start = prev;
+
+ } while ( start != best_point );
+
+ do
+ {
+ next = end + 1;
+ if ( next > best_last )
+ next = best_first;
+
+ dist = FT_ABS( points[next].y - best_y );
+ if ( dist > 5 )
+ if ( FT_ABS( points[next].x - best_x ) <= 20 * dist )
+ break;
+
+ end = next;
+
+ } while ( end != best_point );
+
+ /* now, set the `round' flag depending on the segment's kind */
+ round = FT_BOOL(
+ FT_CURVE_TAG( glyph->outline.tags[start] ) != FT_CURVE_TAG_ON ||
+ FT_CURVE_TAG( glyph->outline.tags[ end ] ) != FT_CURVE_TAG_ON );
+
+ FT_TRACE5(( " (%s)\n", round ? "round" : "flat" ));
+ }
+
+ if ( round )
+ rounds[num_rounds++] = best_y;
+ else
+ flats[num_flats++] = best_y;
+ }
+
+ if ( num_flats == 0 && num_rounds == 0 )
+ {
+ /*
+ * we couldn't find a single glyph to compute this blue zone,
+ * we will simply ignore it then
+ */
+ FT_TRACE5(( " empty\n" ));
+ continue;
+ }
+
+ /* we have computed the contents of the `rounds' and `flats' tables, */
+ /* now determine the reference and overshoot position of the blue -- */
+ /* we simply take the median value after a simple sort */
+ af_sort_pos( num_rounds, rounds );
+ af_sort_pos( num_flats, flats );
+
+ blue = & axis->blues[axis->blue_count];
+ blue_ref = & blue->ref.org;
+ blue_shoot = & blue->shoot.org;
+
+ axis->blue_count++;
+
+ if ( num_flats == 0 )
+ {
+ *blue_ref =
+ *blue_shoot = rounds[num_rounds / 2];
+ }
+ else if ( num_rounds == 0 )
+ {
+ *blue_ref =
+ *blue_shoot = flats[num_flats / 2];
+ }
+ else
+ {
+ *blue_ref = flats[num_flats / 2];
+ *blue_shoot = rounds[num_rounds / 2];
+ }
+
+ /* there are sometimes problems: if the overshoot position of top */
+ /* zones is under its reference position, or the opposite for bottom */
+ /* zones. We must thus check everything there and correct the errors */
+ if ( *blue_shoot != *blue_ref )
+ {
+ FT_Pos ref = *blue_ref;
+ FT_Pos shoot = *blue_shoot;
+ FT_Bool over_ref = FT_BOOL( shoot > ref );
+
+
+ if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref )
+ {
+ *blue_ref =
+ *blue_shoot = ( shoot + ref ) / 2;
+
+ FT_TRACE5(( " [overshoot smaller than reference,"
+ " taking mean value]\n" ));
+ }
+ }
+
+ blue->flags = 0;
+ if ( AF_LATIN_IS_TOP_BLUE( bb ) )
+ blue->flags |= AF_LATIN_BLUE_TOP;
+
+ /*
+ * The following flag is used later to adjust the y and x scales
+ * in order to optimize the pixel grid alignment of the top of small
+ * letters.
+ */
+ if ( AF_LATIN_IS_X_HEIGHT_BLUE( bb ) )
+ blue->flags |= AF_LATIN_BLUE_ADJUSTMENT;
+
+ FT_TRACE5(( " -> reference = %ld\n"
+ " overshoot = %ld\n",
+ *blue_ref, *blue_shoot ));
+ }
+
+ return;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ af_latin2_metrics_check_digits( AF_LatinMetrics metrics,
+ FT_Face face )
+ {
+ FT_UInt i;
+ FT_Bool started = 0, same_width = 1;
+ FT_Fixed advance, old_advance = 0;
+
+
+ /* check whether all ASCII digits have the same advance width; */
+ /* digit `0' is 0x30 in all supported charmaps */
+ for ( i = 0x30; i <= 0x39; i++ )
+ {
+ FT_UInt glyph_index;
+
+
+ glyph_index = FT_Get_Char_Index( face, i );
+ if ( glyph_index == 0 )
+ continue;
+
+ if ( FT_Get_Advance( face, glyph_index,
+ FT_LOAD_NO_SCALE |
+ FT_LOAD_NO_HINTING |
+ FT_LOAD_IGNORE_TRANSFORM,
+ &advance ) )
+ continue;
+
+ if ( started )
+ {
+ if ( advance != old_advance )
+ {
+ same_width = 0;
+ break;
+ }
+ }
+ else
+ {
+ old_advance = advance;
+ started = 1;
+ }
+ }
+
+ metrics->root.digits_have_same_width = same_width;
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
+ af_latin2_metrics_init( AF_LatinMetrics metrics,
+ FT_Face face )
+ {
+ FT_Error error = FT_Err_Ok;
+ FT_CharMap oldmap = face->charmap;
+ FT_UInt ee;
+
+ static const FT_Encoding latin_encodings[] =
+ {
+ FT_ENCODING_UNICODE,
+ FT_ENCODING_APPLE_ROMAN,
+ FT_ENCODING_ADOBE_STANDARD,
+ FT_ENCODING_ADOBE_LATIN_1,
+ FT_ENCODING_NONE /* end of list */
+ };
+
+
+ metrics->units_per_em = face->units_per_EM;
+
+ /* do we have a latin charmap in there? */
+ for ( ee = 0; latin_encodings[ee] != FT_ENCODING_NONE; ee++ )
+ {
+ error = FT_Select_Charmap( face, latin_encodings[ee] );
+ if ( !error )
+ break;
+ }
+
+ if ( !error )
+ {
+ af_latin2_metrics_init_widths( metrics, face );
+ af_latin2_metrics_init_blues( metrics, face );
+ af_latin2_metrics_check_digits( metrics, face );
+ }
+
+ FT_Set_Charmap( face, oldmap );
+ return FT_Err_Ok;
+ }
+
+
+ static void
+ af_latin2_metrics_scale_dim( AF_LatinMetrics metrics,
+ AF_Scaler scaler,
+ AF_Dimension dim )
+ {
+ FT_Fixed scale;
+ FT_Pos delta;
+ AF_LatinAxis axis;
+ FT_UInt nn;
+
+
+ if ( dim == AF_DIMENSION_HORZ )
+ {
+ scale = scaler->x_scale;
+ delta = scaler->x_delta;
+ }
+ else
+ {
+ scale = scaler->y_scale;
+ delta = scaler->y_delta;
+ }
+
+ axis = &metrics->axis[dim];
+
+ if ( axis->org_scale == scale && axis->org_delta == delta )
+ return;
+
+ axis->org_scale = scale;
+ axis->org_delta = delta;
+
+ /*
+ * correct Y scale to optimize the alignment of the top of small
+ * letters to the pixel grid
+ */
+ if ( dim == AF_DIMENSION_VERT )
+ {
+ AF_LatinAxis vaxis = &metrics->axis[AF_DIMENSION_VERT];
+ AF_LatinBlue blue = NULL;
+
+
+ for ( nn = 0; nn < vaxis->blue_count; nn++ )
+ {
+ if ( vaxis->blues[nn].flags & AF_LATIN_BLUE_ADJUSTMENT )
+ {
+ blue = &vaxis->blues[nn];
+ break;
+ }
+ }
+
+ if ( blue )
+ {
+ FT_Pos scaled;
+ FT_Pos threshold;
+ FT_Pos fitted;
+ FT_UInt limit;
+ FT_UInt ppem;
+
+
+ scaled = FT_MulFix( blue->shoot.org, scaler->y_scale );
+ ppem = metrics->root.scaler.face->size->metrics.x_ppem;
+ limit = metrics->root.globals->increase_x_height;
+ threshold = 40;
+
+ /* if the `increase-x-height' property is active, */
+ /* we round up much more often */
+ if ( limit &&
+ ppem <= limit &&
+ ppem >= AF_PROP_INCREASE_X_HEIGHT_MIN )
+ threshold = 52;
+
+ fitted = ( scaled + threshold ) & ~63;
+
+#if 1
+ if ( scaled != fitted )
+ {
+ scale = FT_MulDiv( scale, fitted, scaled );
+ FT_TRACE5(( "== scaled x-top = %.2g"
+ " fitted = %.2g, scaling = %.4g\n",
+ scaled / 64.0, fitted / 64.0,
+ ( fitted * 1.0 ) / scaled ));
+ }
+#endif
+ }
+ }
+
+ axis->scale = scale;
+ axis->delta = delta;
+
+ if ( dim == AF_DIMENSION_HORZ )
+ {
+ metrics->root.scaler.x_scale = scale;
+ metrics->root.scaler.x_delta = delta;
+ }
+ else
+ {
+ metrics->root.scaler.y_scale = scale;
+ metrics->root.scaler.y_delta = delta;
+ }
+
+ /* scale the standard widths */
+ for ( nn = 0; nn < axis->width_count; nn++ )
+ {
+ AF_Width width = axis->widths + nn;
+
+
+ width->cur = FT_MulFix( width->org, scale );
+ width->fit = width->cur;
+ }
+
+ /* an extra-light axis corresponds to a standard width that is */
+ /* smaller than 5/8 pixels */
+ axis->extra_light =
+ FT_BOOL( FT_MulFix( axis->standard_width, scale ) < 32 + 8 );
+
+ if ( dim == AF_DIMENSION_VERT )
+ {
+ /* scale the blue zones */
+ for ( nn = 0; nn < axis->blue_count; nn++ )
+ {
+ AF_LatinBlue blue = &axis->blues[nn];
+ FT_Pos dist;
+
+
+ blue->ref.cur = FT_MulFix( blue->ref.org, scale ) + delta;
+ blue->ref.fit = blue->ref.cur;
+ blue->shoot.cur = FT_MulFix( blue->shoot.org, scale ) + delta;
+ blue->shoot.fit = blue->shoot.cur;
+ blue->flags &= ~AF_LATIN_BLUE_ACTIVE;
+
+ /* a blue zone is only active if it is less than 3/4 pixels tall */
+ dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale );
+ if ( dist <= 48 && dist >= -48 )
+ {
+ FT_Pos delta1, delta2;
+
+ delta1 = blue->shoot.org - blue->ref.org;
+ delta2 = delta1;
+ if ( delta1 < 0 )
+ delta2 = -delta2;
+
+ delta2 = FT_MulFix( delta2, scale );
+
+ if ( delta2 < 32 )
+ delta2 = 0;
+ else if ( delta2 < 64 )
+ delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );
+ else
+ delta2 = FT_PIX_ROUND( delta2 );
+
+ if ( delta1 < 0 )
+ delta2 = -delta2;
+
+ blue->ref.fit = FT_PIX_ROUND( blue->ref.cur );
+ blue->shoot.fit = blue->ref.fit + delta2;
+
+ FT_TRACE5(( ">> activating blue zone %d:"
+ " ref.cur=%.2g ref.fit=%.2g"
+ " shoot.cur=%.2g shoot.fit=%.2g\n",
+ nn, blue->ref.cur / 64.0, blue->ref.fit / 64.0,
+ blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 ));
+
+ blue->flags |= AF_LATIN_BLUE_ACTIVE;
+ }
+ }
+ }
+ }
+
+
+ FT_LOCAL_DEF( void )
+ af_latin2_metrics_scale( AF_LatinMetrics metrics,
+ AF_Scaler scaler )
+ {
+ metrics->root.scaler.render_mode = scaler->render_mode;
+ metrics->root.scaler.face = scaler->face;
+ metrics->root.scaler.flags = scaler->flags;
+
+ af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ );
+ af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT );
+ }
+
+
+ /* Extract standard_width from writing system/script specific */
+ /* metrics class. */
+
+ FT_LOCAL_DEF( void )
+ af_latin2_get_standard_widths( AF_LatinMetrics metrics,
+ FT_Pos* stdHW,
+ FT_Pos* stdVW )
+ {
+ if ( stdHW )
+ *stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width;
+
+ if ( stdVW )
+ *stdVW = metrics->axis[AF_DIMENSION_HORZ].standard_width;
+ }
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** L A T I N G L Y P H A N A L Y S I S *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+#define SORT_SEGMENTS
+
+ FT_LOCAL_DEF( FT_Error )
+ af_latin2_hints_compute_segments( AF_GlyphHints hints,
+ AF_Dimension dim )
+ {
+ AF_AxisHints axis = &hints->axis[dim];
+ FT_Memory memory = hints->memory;
+ FT_Error error = FT_Err_Ok;
+ AF_Segment segment = NULL;
+ AF_SegmentRec seg0;
+ AF_Point* contour = hints->contours;
+ AF_Point* contour_limit = contour + hints->num_contours;
+ AF_Direction major_dir, segment_dir;
+
+
+ FT_ZERO( &seg0 );
+ seg0.score = 32000;
+ seg0.flags = AF_EDGE_NORMAL;
+
+ major_dir = (AF_Direction)FT_ABS( axis->major_dir );
+ segment_dir = major_dir;
+
+ axis->num_segments = 0;
+
+ /* set up (u,v) in each point */
+ if ( dim == AF_DIMENSION_HORZ )
+ {
+ AF_Point point = hints->points;
+ AF_Point limit = point + hints->num_points;
+
+
+ for ( ; point < limit; point++ )
+ {
+ point->u = point->fx;
+ point->v = point->fy;
+ }
+ }
+ else
+ {
+ AF_Point point = hints->points;
+ AF_Point limit = point + hints->num_points;
+
+
+ for ( ; point < limit; point++ )
+ {
+ point->u = point->fy;
+ point->v = point->fx;
+ }
+ }
+
+ /* do each contour separately */
+ for ( ; contour < contour_limit; contour++ )
+ {
+ AF_Point point = contour[0];
+ AF_Point start = point;
+ AF_Point last = point->prev;
+
+
+ if ( point == last ) /* skip singletons -- just in case */
+ continue;
+
+ /* already on an edge ?, backtrack to find its start */
+ if ( FT_ABS( point->in_dir ) == major_dir )
+ {
+ point = point->prev;
+
+ while ( point->in_dir == start->in_dir )
+ point = point->prev;
+ }
+ else /* otherwise, find first segment start, if any */
+ {
+ while ( FT_ABS( point->out_dir ) != major_dir )
+ {
+ point = point->next;
+
+ if ( point == start )
+ goto NextContour;
+ }
+ }
+
+ start = point;
+
+ for (;;)
+ {
+ AF_Point first;
+ FT_Pos min_u, min_v, max_u, max_v;
+
+ /* we're at the start of a new segment */
+ FT_ASSERT( FT_ABS( point->out_dir ) == major_dir &&
+ point->in_dir != point->out_dir );
+ first = point;
+
+ min_u = max_u = point->u;
+ min_v = max_v = point->v;
+
+ point = point->next;
+
+ while ( point->out_dir == first->out_dir )
+ {
+ point = point->next;
+
+ if ( point->u < min_u )
+ min_u = point->u;
+
+ if ( point->u > max_u )
+ max_u = point->u;
+ }
+
+ if ( point->v < min_v )
+ min_v = point->v;
+
+ if ( point->v > max_v )
+ max_v = point->v;
+
+ /* record new segment */
+ error = af_axis_hints_new_segment( axis, memory, &segment );
+ if ( error )
+ goto Exit;
+
+ segment[0] = seg0;
+ segment->dir = first->out_dir;
+ segment->first = first;
+ segment->last = point;
+ segment->pos = (FT_Short)( ( min_u + max_u ) >> 1 );
+ segment->min_coord = (FT_Short) min_v;
+ segment->max_coord = (FT_Short) max_v;
+ segment->height = (FT_Short)( max_v - min_v );
+
+ /* a segment is round if it doesn't have successive */
+ /* on-curve points. */
+ {
+ AF_Point pt = first;
+ AF_Point last = point;
+ FT_UInt f0 = pt->flags & AF_FLAG_CONTROL;
+ FT_UInt f1;
+
+
+ segment->flags &= ~AF_EDGE_ROUND;
+
+ for ( ; pt != last; f0 = f1 )
+ {
+ pt = pt->next;
+ f1 = pt->flags & AF_FLAG_CONTROL;
+
+ if ( !f0 && !f1 )
+ break;
+
+ if ( pt == last )
+ segment->flags |= AF_EDGE_ROUND;
+ }
+ }
+
+ /* this can happen in the case of a degenerate contour
+ * e.g. a 2-point vertical contour
+ */
+ if ( point == start )
+ break;
+
+ /* jump to the start of the next segment, if any */
+ while ( FT_ABS( point->out_dir ) != major_dir )
+ {
+ point = point->next;
+
+ if ( point == start )
+ goto NextContour;
+ }
+ }
+
+ NextContour:
+ ;
+ } /* contours */
+
+ /* now slightly increase the height of segments when this makes */
+ /* sense -- this is used to better detect and ignore serifs */
+ {
+ AF_Segment segments = axis->segments;
+ AF_Segment segments_end = segments + axis->num_segments;
+
+
+ for ( segment = segments; segment < segments_end; segment++ )
+ {
+ AF_Point first = segment->first;
+ AF_Point last = segment->last;
+ AF_Point p;
+ FT_Pos first_v = first->v;
+ FT_Pos last_v = last->v;
+
+
+ if ( first_v < last_v )
+ {
+ p = first->prev;
+ if ( p->v < first_v )
+ segment->height = (FT_Short)( segment->height +
+ ( ( first_v - p->v ) >> 1 ) );
+
+ p = last->next;
+ if ( p->v > last_v )
+ segment->height = (FT_Short)( segment->height +
+ ( ( p->v - last_v ) >> 1 ) );
+ }
+ else
+ {
+ p = first->prev;
+ if ( p->v > first_v )
+ segment->height = (FT_Short)( segment->height +
+ ( ( p->v - first_v ) >> 1 ) );
+
+ p = last->next;
+ if ( p->v < last_v )
+ segment->height = (FT_Short)( segment->height +
+ ( ( last_v - p->v ) >> 1 ) );
+ }
+ }
+ }
+
+#ifdef AF_SORT_SEGMENTS
+ /* place all segments with a negative direction to the start
+ * of the array, used to speed up segment linking later...
+ */
+ {
+ AF_Segment segments = axis->segments;
+ FT_UInt count = axis->num_segments;
+ FT_UInt ii, jj;
+
+ for ( ii = 0; ii < count; ii++ )
+ {
+ if ( segments[ii].dir > 0 )
+ {
+ for ( jj = ii + 1; jj < count; jj++ )
+ {
+ if ( segments[jj].dir < 0 )
+ {
+ AF_SegmentRec tmp;
+
+
+ tmp = segments[ii];
+ segments[ii] = segments[jj];
+ segments[jj] = tmp;
+
+ break;
+ }
+ }
+
+ if ( jj == count )
+ break;
+ }
+ }
+ axis->mid_segments = ii;
+ }
+#endif
+
+ Exit:
+ return error;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ af_latin2_hints_link_segments( AF_GlyphHints hints,
+ AF_Dimension dim )
+ {
+ AF_AxisHints axis = &hints->axis[dim];
+ AF_Segment segments = axis->segments;
+ AF_Segment segment_limit = segments + axis->num_segments;
+#ifdef AF_SORT_SEGMENTS
+ AF_Segment segment_mid = segments + axis->mid_segments;
+#endif
+ FT_Pos len_threshold, len_score;
+ AF_Segment seg1, seg2;
+
+
+ len_threshold = AF_LATIN_CONSTANT( hints->metrics, 8 );
+ if ( len_threshold == 0 )
+ len_threshold = 1;
+
+ len_score = AF_LATIN_CONSTANT( hints->metrics, 6000 );
+
+#ifdef AF_SORT_SEGMENTS
+ for ( seg1 = segments; seg1 < segment_mid; seg1++ )
+ {
+ if ( seg1->dir != axis->major_dir )
+ continue;
+
+ for ( seg2 = segment_mid; seg2 < segment_limit; seg2++ )
+#else
+ /* now compare each segment to the others */
+ for ( seg1 = segments; seg1 < segment_limit; seg1++ )
+ {
+ if ( seg1->dir != axis->major_dir )
+ continue;
+
+ for ( seg2 = segments; seg2 < segment_limit; seg2++ )
+ if ( seg1->dir + seg2->dir == 0 && seg2->pos > seg1->pos )
+#endif
+ {
+ FT_Pos pos1 = seg1->pos;
+ FT_Pos pos2 = seg2->pos;
+ FT_Pos dist = pos2 - pos1;
+
+
+ if ( dist < 0 )
+ continue;
+
+ {
+ FT_Pos min = seg1->min_coord;
+ FT_Pos max = seg1->max_coord;
+ FT_Pos len, score;
+
+
+ if ( min < seg2->min_coord )
+ min = seg2->min_coord;
+
+ if ( max > seg2->max_coord )
+ max = seg2->max_coord;
+
+ len = max - min;
+ if ( len >= len_threshold )
+ {
+ score = dist + len_score / len;
+ if ( score < seg1->score )
+ {
+ seg1->score = score;
+ seg1->link = seg2;
+ }
+
+ if ( score < seg2->score )
+ {
+ seg2->score = score;
+ seg2->link = seg1;
+ }
+ }
+ }
+ }
+ }
+#if 0
+ }
+#endif
+
+ /* now, compute the `serif' segments */
+ for ( seg1 = segments; seg1 < segment_limit; seg1++ )
+ {
+ seg2 = seg1->link;
+
+ if ( seg2 )
+ {
+ if ( seg2->link != seg1 )
+ {
+ seg1->link = NULL;
+ seg1->serif = seg2->link;
+ }
+ }
+ }
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
+ af_latin2_hints_compute_edges( AF_GlyphHints hints,
+ AF_Dimension dim )
+ {
+ AF_AxisHints axis = &hints->axis[dim];
+ FT_Error error = FT_Err_Ok;
+ FT_Memory memory = hints->memory;
+ AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim];
+
+ AF_Segment segments = axis->segments;
+ AF_Segment segment_limit = segments + axis->num_segments;
+ AF_Segment seg;
+
+ AF_Direction up_dir;
+ FT_Fixed scale;
+ FT_Pos edge_distance_threshold;
+ FT_Pos segment_length_threshold;
+
+
+ axis->num_edges = 0;
+
+ scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale
+ : hints->y_scale;
+
+ up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP
+ : AF_DIR_RIGHT;
+
+ /*
+ * We want to ignore very small (mostly serif) segments, we do that
+ * by ignoring those that whose length is less than a given fraction
+ * of the standard width. If there is no standard width, we ignore
+ * those that are less than a given size in pixels
+ *
+ * also, unlink serif segments that are linked to segments farther
+ * than 50% of the standard width
+ */
+ if ( dim == AF_DIMENSION_HORZ )
+ {
+ if ( laxis->width_count > 0 )
+ segment_length_threshold = ( laxis->standard_width * 10 ) >> 4;
+ else
+ segment_length_threshold = FT_DivFix( 64, hints->y_scale );
+ }
+ else
+ segment_length_threshold = 0;
+
+ /**********************************************************************
+ *
+ * We will begin by generating a sorted table of edges for the
+ * current direction. To do so, we simply scan each segment and try
+ * to find an edge in our table that corresponds to its position.
+ *
+ * If no edge is found, we create and insert a new edge in the
+ * sorted table. Otherwise, we simply add the segment to the edge's
+ * list which will be processed in the second step to compute the
+ * edge's properties.
+ *
+ * Note that the edges table is sorted along the segment/edge
+ * position.
+ *
+ */
+
+ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold,
+ scale );
+ if ( edge_distance_threshold > 64 / 4 )
+ edge_distance_threshold = 64 / 4;
+
+ edge_distance_threshold = FT_DivFix( edge_distance_threshold,
+ scale );
+
+ for ( seg = segments; seg < segment_limit; seg++ )
+ {
+ AF_Edge found = NULL;
+ FT_Int ee;
+
+
+ if ( seg->height < segment_length_threshold )
+ continue;
+
+ /* A special case for serif edges: If they are smaller than */
+ /* 1.5 pixels we ignore them. */
+ if ( seg->serif )
+ {
+ FT_Pos dist = seg->serif->pos - seg->pos;
+
+
+ if ( dist < 0 )
+ dist = -dist;
+
+ if ( dist >= laxis->standard_width >> 1 )
+ {
+ /* unlink this serif, it is too distant from its reference stem */
+ seg->serif = NULL;
+ }
+ else if ( 2*seg->height < 3 * segment_length_threshold )
+ continue;
+ }
+
+ /* look for an edge corresponding to the segment */
+ for ( ee = 0; ee < axis->num_edges; ee++ )
+ {
+ AF_Edge edge = axis->edges + ee;
+ FT_Pos dist;
+
+
+ dist = seg->pos - edge->fpos;
+ if ( dist < 0 )
+ dist = -dist;
+
+ if ( dist < edge_distance_threshold && edge->dir == seg->dir )
+ {
+ found = edge;
+ break;
+ }
+ }
+
+ if ( !found )
+ {
+ AF_Edge edge;
+
+
+ /* insert a new edge in the list and */
+ /* sort according to the position */
+ error = af_axis_hints_new_edge( axis, seg->pos, seg->dir, 0,
+ memory, &edge );
+ if ( error )
+ goto Exit;
+
+ /* add the segment to the new edge's list */
+ FT_ZERO( edge );
+
+ edge->first = seg;
+ edge->last = seg;
+ edge->dir = seg->dir;
+ edge->fpos = seg->pos;
+ edge->opos = FT_MulFix( seg->pos, scale );
+ edge->pos = edge->opos;
+ seg->edge_next = seg;
+ }
+ else
+ {
+ /* if an edge was found, simply add the segment to the edge's */
+ /* list */
+ seg->edge_next = found->first;
+ found->last->edge_next = seg;
+ found->last = seg;
+ }
+ }
+
+
+ /**********************************************************************
+ *
+ * Good, we will now compute each edge's properties according to
+ * segments found on its position. Basically, these are:
+ *
+ * - edge's main direction
+ * - stem edge, serif edge or both (which defaults to stem then)
+ * - rounded edge, straight or both (which defaults to straight)
+ * - link for edge
+ *
+ */
+
+ /* first of all, set the `edge' field in each segment -- this is */
+ /* required in order to compute edge links */
+
+ /*
+ * Note that removing this loop and setting the `edge' field of each
+ * segment directly in the code above slows down execution speed for
+ * some reasons on platforms like the Sun.
+ */
+ {
+ AF_Edge edges = axis->edges;
+ AF_Edge edge_limit = edges + axis->num_edges;
+ AF_Edge edge;
+
+
+ for ( edge = edges; edge < edge_limit; edge++ )
+ {
+ seg = edge->first;
+ if ( seg )
+ do
+ {
+ seg->edge = edge;
+ seg = seg->edge_next;
+
+ } while ( seg != edge->first );
+ }
+
+ /* now, compute each edge properties */
+ for ( edge = edges; edge < edge_limit; edge++ )
+ {
+ FT_Int is_round = 0; /* does it contain round segments? */
+ FT_Int is_straight = 0; /* does it contain straight segments? */
+#if 0
+ FT_Pos ups = 0; /* number of upwards segments */
+ FT_Pos downs = 0; /* number of downwards segments */
+#endif
+
+
+ seg = edge->first;
+
+ do
+ {
+ FT_Bool is_serif;
+
+
+ /* check for roundness of segment */
+ if ( seg->flags & AF_EDGE_ROUND )
+ is_round++;
+ else
+ is_straight++;
+
+#if 0
+ /* check for segment direction */
+ if ( seg->dir == up_dir )
+ ups += seg->max_coord-seg->min_coord;
+ else
+ downs += seg->max_coord-seg->min_coord;
+#endif
+
+ /* check for links -- if seg->serif is set, then seg->link must */
+ /* be ignored */
+ is_serif = FT_BOOL( seg->serif &&
+ seg->serif->edge &&
+ seg->serif->edge != edge );
+
+ if ( ( seg->link && seg->link->edge ) || is_serif )
+ {
+ AF_Edge edge2;
+ AF_Segment seg2;
+
+
+ edge2 = edge->link;
+ seg2 = seg->link;
+
+ if ( is_serif )
+ {
+ seg2 = seg->serif;
+ edge2 = edge->serif;
+ }
+
+ if ( edge2 )
+ {
+ FT_Pos edge_delta;
+ FT_Pos seg_delta;
+
+
+ edge_delta = edge->fpos - edge2->fpos;
+ if ( edge_delta < 0 )
+ edge_delta = -edge_delta;
+
+ seg_delta = seg->pos - seg2->pos;
+ if ( seg_delta < 0 )
+ seg_delta = -seg_delta;
+
+ if ( seg_delta < edge_delta )
+ edge2 = seg2->edge;
+ }
+ else
+ edge2 = seg2->edge;
+
+ if ( is_serif )
+ {
+ edge->serif = edge2;
+ edge2->flags |= AF_EDGE_SERIF;
+ }
+ else
+ edge->link = edge2;
+ }
+
+ seg = seg->edge_next;
+
+ } while ( seg != edge->first );
+
+ /* set the round/straight flags */
+ edge->flags = AF_EDGE_NORMAL;
+
+ if ( is_round > 0 && is_round >= is_straight )
+ edge->flags |= AF_EDGE_ROUND;
+
+#if 0
+ /* set the edge's main direction */
+ edge->dir = AF_DIR_NONE;
+
+ if ( ups > downs )
+ edge->dir = (FT_Char)up_dir;
+
+ else if ( ups < downs )
+ edge->dir = (FT_Char)-up_dir;
+
+ else if ( ups == downs )
+ edge->dir = 0; /* both up and down! */
+#endif
+
+ /* gets rid of serifs if link is set */
+ /* XXX: This gets rid of many unpleasant artefacts! */
+ /* Example: the `c' in cour.pfa at size 13 */
+
+ if ( edge->serif && edge->link )
+ edge->serif = NULL;
+ }
+ }
+
+ Exit:
+ return error;
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
+ af_latin2_hints_detect_features( AF_GlyphHints hints,
+ AF_Dimension dim )
+ {
+ FT_Error error;
+
+
+ error = af_latin2_hints_compute_segments( hints, dim );
+ if ( !error )
+ {
+ af_latin2_hints_link_segments( hints, dim );
+
+ error = af_latin2_hints_compute_edges( hints, dim );
+ }
+ return error;
+ }
+
+
+ static void
+ af_latin2_hints_compute_blue_edges( AF_GlyphHints hints,
+ AF_LatinMetrics metrics )
+ {
+ AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT];
+ AF_Edge edge = axis->edges;
+ AF_Edge edge_limit = edge + axis->num_edges;
+ AF_LatinAxis latin = &metrics->axis[AF_DIMENSION_VERT];
+ FT_Fixed scale = latin->scale;
+ FT_Pos best_dist0; /* initial threshold */
+
+
+ /* compute the initial threshold as a fraction of the EM size */
+ best_dist0 = FT_MulFix( metrics->units_per_em / 40, scale );
+
+ if ( best_dist0 > 64 / 2 )
+ best_dist0 = 64 / 2;
+
+ /* compute which blue zones are active, i.e. have their scaled */
+ /* size < 3/4 pixels */
+
+ /* for each horizontal edge search the blue zone which is closest */
+ for ( ; edge < edge_limit; edge++ )
+ {
+ FT_Int bb;
+ AF_Width best_blue = NULL;
+ FT_Pos best_dist = best_dist0;
+
+ for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ )
+ {
+ AF_LatinBlue blue = latin->blues + bb;
+ FT_Bool is_top_blue, is_major_dir;
+
+
+ /* skip inactive blue zones (i.e., those that are too small) */
+ if ( !( blue->flags & AF_LATIN_BLUE_ACTIVE ) )
+ continue;
+
+ /* if it is a top zone, check for right edges -- if it is a bottom */
+ /* zone, check for left edges */
+ /* */
+ /* of course, that's for TrueType */
+ is_top_blue = (FT_Byte)( ( blue->flags & AF_LATIN_BLUE_TOP ) != 0 );
+ is_major_dir = FT_BOOL( edge->dir == axis->major_dir );
+
+ /* if it is a top zone, the edge must be against the major */
+ /* direction; if it is a bottom zone, it must be in the major */
+ /* direction */
+ if ( is_top_blue ^ is_major_dir )
+ {
+ FT_Pos dist;
+ AF_Width compare;
+
+
+ /* if it's a rounded edge, compare it to the overshoot position */
+ /* if it's a flat edge, compare it to the reference position */
+ if ( edge->flags & AF_EDGE_ROUND )
+ compare = &blue->shoot;
+ else
+ compare = &blue->ref;
+
+ dist = edge->fpos - compare->org;
+ if ( dist < 0 )
+ dist = -dist;
+
+ dist = FT_MulFix( dist, scale );
+ if ( dist < best_dist )
+ {
+ best_dist = dist;
+ best_blue = compare;
+ }
+
+#if 0
+ /* now, compare it to the overshoot position if the edge is */
+ /* rounded, and if the edge is over the reference position of a */
+ /* top zone, or under the reference position of a bottom zone */
+ if ( edge->flags & AF_EDGE_ROUND && dist != 0 )
+ {
+ FT_Bool is_under_ref = FT_BOOL( edge->fpos < blue->ref.org );
+
+
+ if ( is_top_blue ^ is_under_ref )
+ {
+ blue = latin->blues + bb;
+ dist = edge->fpos - blue->shoot.org;
+ if ( dist < 0 )
+ dist = -dist;
+
+ dist = FT_MulFix( dist, scale );
+ if ( dist < best_dist )
+ {
+ best_dist = dist;
+ best_blue = & blue->shoot;
+ }
+ }
+ }
+#endif
+ }
+ }
+
+ if ( best_blue )
+ edge->blue_edge = best_blue;
+ }
+ }
+
+
+ static FT_Error
+ af_latin2_hints_init( AF_GlyphHints hints,
+ AF_LatinMetrics metrics )
+ {
+ FT_Render_Mode mode;
+ FT_UInt32 scaler_flags, other_flags;
+ FT_Face face = metrics->root.scaler.face;
+
+
+ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics );
+
+ /*
+ * correct x_scale and y_scale if needed, since they may have
+ * been modified `af_latin2_metrics_scale_dim' above
+ */
+ hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale;
+ hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta;
+ hints->y_scale = metrics->axis[AF_DIMENSION_VERT].scale;
+ hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta;
+
+ /* compute flags depending on render mode, etc. */
+ mode = metrics->root.scaler.render_mode;
+
+#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */
+ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )
+ metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;
+#endif
+
+ scaler_flags = hints->scaler_flags;
+ other_flags = 0;
+
+ /*
+ * We snap the width of vertical stems for the monochrome and
+ * horizontal LCD rendering targets only.
+ */
+ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )
+ other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
+
+ /*
+ * We snap the width of horizontal stems for the monochrome and
+ * vertical LCD rendering targets only.
+ */
+ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )
+ other_flags |= AF_LATIN_HINTS_VERT_SNAP;
+
+ /*
+ * We adjust stems to full pixels unless in `light' or `lcd' mode.
+ */
+ if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD )
+ other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
+
+ if ( mode == FT_RENDER_MODE_MONO )
+ other_flags |= AF_LATIN_HINTS_MONO;
+
+ /*
+ * In `light' or `lcd' mode we disable horizontal hinting completely.
+ * We also do it if the face is italic.
+ */
+ if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD ||
+ ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )
+ scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
+
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ /* get (global) warper flag */
+ if ( !metrics->root.globals->module->warping )
+ scaler_flags |= AF_SCALER_FLAG_NO_WARPER;
+#endif
+
+ hints->scaler_flags = scaler_flags;
+ hints->other_flags = other_flags;
+
+ return 0;
+ }
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** L A T I N G L Y P H G R I D - F I T T I N G *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /* snap a given width in scaled coordinates to one of the */
+ /* current standard widths */
+
+ static FT_Pos
+ af_latin2_snap_width( AF_Width widths,
+ FT_UInt count,
+ FT_Pos width )
+ {
+ FT_UInt n;
+ FT_Pos best = 64 + 32 + 2;
+ FT_Pos reference = width;
+ FT_Pos scaled;
+
+
+ for ( n = 0; n < count; n++ )
+ {
+ FT_Pos w;
+ FT_Pos dist;
+
+
+ w = widths[n].cur;
+ dist = width - w;
+ if ( dist < 0 )
+ dist = -dist;
+ if ( dist < best )
+ {
+ best = dist;
+ reference = w;
+ }
+ }
+
+ scaled = FT_PIX_ROUND( reference );
+
+ if ( width >= reference )
+ {
+ if ( width < scaled + 48 )
+ width = reference;
+ }
+ else
+ {
+ if ( width > scaled - 48 )
+ width = reference;
+ }
+
+ return width;
+ }
+
+
+ /* compute the snapped width of a given stem */
+
+ static FT_Pos
+ af_latin2_compute_stem_width( AF_GlyphHints hints,
+ AF_Dimension dim,
+ FT_Pos width,
+ FT_UInt base_flags,
+ FT_UInt stem_flags )
+ {
+ AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics;
+ AF_LatinAxis axis = & metrics->axis[dim];
+ FT_Pos dist = width;
+ FT_Int sign = 0;
+ FT_Int vertical = ( dim == AF_DIMENSION_VERT );
+
+ FT_UNUSED( base_flags );
+
+
+ if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) ||
+ axis->extra_light )
+ return width;
+
+ if ( dist < 0 )
+ {
+ dist = -width;
+ sign = 1;
+ }
+
+ if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||
+ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) )
+ {
+ /* smooth hinting process: very lightly quantize the stem width */
+
+ /* leave the widths of serifs alone */
+
+ if ( ( stem_flags & AF_EDGE_SERIF ) && vertical && ( dist < 3 * 64 ) )
+ goto Done_Width;
+
+#if 0
+ else if ( ( base_flags & AF_EDGE_ROUND ) )
+ {
+ if ( dist < 80 )
+ dist = 64;
+ }
+ else if ( dist < 56 )
+ dist = 56;
+#endif
+ if ( axis->width_count > 0 )
+ {
+ FT_Pos delta;
+
+
+ /* compare to standard width */
+ if ( axis->width_count > 0 )
+ {
+ delta = dist - axis->widths[0].cur;
+
+ if ( delta < 0 )
+ delta = -delta;
+
+ if ( delta < 40 )
+ {
+ dist = axis->widths[0].cur;
+ if ( dist < 48 )
+ dist = 48;
+
+ goto Done_Width;
+ }
+ }
+
+ if ( dist < 3 * 64 )
+ {
+ delta = dist & 63;
+ dist &= -64;
+
+ if ( delta < 10 )
+ dist += delta;
+
+ else if ( delta < 32 )
+ dist += 10;
+
+ else if ( delta < 54 )
+ dist += 54;
+
+ else
+ dist += delta;
+ }
+ else
+ dist = ( dist + 32 ) & ~63;
+ }
+ }
+ else
+ {
+ /* strong hinting process: snap the stem width to integer pixels */
+ FT_Pos org_dist = dist;
+
+
+ dist = af_latin2_snap_width( axis->widths, axis->width_count, dist );
+
+ if ( vertical )
+ {
+ /* in the case of vertical hinting, always round */
+ /* the stem heights to integer pixels */
+
+ if ( dist >= 64 )
+ dist = ( dist + 16 ) & ~63;
+ else
+ dist = 64;
+ }
+ else
+ {
+ if ( AF_LATIN_HINTS_DO_MONO( hints ) )
+ {
+ /* monochrome horizontal hinting: snap widths to integer pixels */
+ /* with a different threshold */
+
+ if ( dist < 64 )
+ dist = 64;
+ else
+ dist = ( dist + 32 ) & ~63;
+ }
+ else
+ {
+ /* for horizontal anti-aliased hinting, we adopt a more subtle */
+ /* approach: we strengthen small stems, round stems whose size */
+ /* is between 1 and 2 pixels to an integer, otherwise nothing */
+
+ if ( dist < 48 )
+ dist = ( dist + 64 ) >> 1;
+
+ else if ( dist < 128 )
+ {
+ /* We only round to an integer width if the corresponding */
+ /* distortion is less than 1/4 pixel. Otherwise this */
+ /* makes everything worse since the diagonals, which are */
+ /* not hinted, appear a lot bolder or thinner than the */
+ /* vertical stems. */
+
+ FT_Int delta;
+
+
+ dist = ( dist + 22 ) & ~63;
+ delta = dist - org_dist;
+ if ( delta < 0 )
+ delta = -delta;
+
+ if ( delta >= 16 )
+ {
+ dist = org_dist;
+ if ( dist < 48 )
+ dist = ( dist + 64 ) >> 1;
+ }
+ }
+ else
+ /* round otherwise to prevent color fringes in LCD mode */
+ dist = ( dist + 32 ) & ~63;
+ }
+ }
+ }
+
+ Done_Width:
+ if ( sign )
+ dist = -dist;
+
+ return dist;
+ }
+
+
+ /* align one stem edge relative to the previous stem edge */
+
+ static void
+ af_latin2_align_linked_edge( AF_GlyphHints hints,
+ AF_Dimension dim,
+ AF_Edge base_edge,
+ AF_Edge stem_edge )
+ {
+ FT_Pos dist = stem_edge->opos - base_edge->opos;
+
+ FT_Pos fitted_width = af_latin2_compute_stem_width( hints, dim, dist,
+ base_edge->flags,
+ stem_edge->flags );
+
+
+ stem_edge->pos = base_edge->pos + fitted_width;
+
+ FT_TRACE5(( "LINK: edge %d (opos=%.2f) linked to (%.2f), "
+ "dist was %.2f, now %.2f\n",
+ stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0,
+ stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 ));
+ }
+
+
+ static void
+ af_latin2_align_serif_edge( AF_GlyphHints hints,
+ AF_Edge base,
+ AF_Edge serif )
+ {
+ FT_UNUSED( hints );
+
+ serif->pos = base->pos + ( serif->opos - base->opos );
+ }
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** E D G E H I N T I N G ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ static void
+ af_latin2_hint_edges( AF_GlyphHints hints,
+ AF_Dimension dim )
+ {
+ AF_AxisHints axis = &hints->axis[dim];
+ AF_Edge edges = axis->edges;
+ AF_Edge edge_limit = edges + axis->num_edges;
+ AF_Edge edge;
+ AF_Edge anchor = NULL;
+ FT_Int has_serifs = 0;
+ FT_Pos anchor_drift = 0;
+
+
+
+ FT_TRACE5(( "==== hinting %s edges =====\n",
+ dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" ));
+
+ /* we begin by aligning all stems relative to the blue zone */
+ /* if needed -- that's only for horizontal edges */
+
+ if ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_BLUES( hints ) )
+ {
+ for ( edge = edges; edge < edge_limit; edge++ )
+ {
+ AF_Width blue;
+ AF_Edge edge1, edge2;
+
+
+ if ( edge->flags & AF_EDGE_DONE )
+ continue;
+
+ blue = edge->blue_edge;
+ edge1 = NULL;
+ edge2 = edge->link;
+
+ if ( blue )
+ {
+ edge1 = edge;
+ }
+ else if ( edge2 && edge2->blue_edge )
+ {
+ blue = edge2->blue_edge;
+ edge1 = edge2;
+ edge2 = edge;
+ }
+
+ if ( !edge1 )
+ continue;
+
+ FT_TRACE5(( "BLUE: edge %d (opos=%.2f) snapped to (%.2f), "
+ "was (%.2f)\n",
+ edge1-edges, edge1->opos / 64.0, blue->fit / 64.0,
+ edge1->pos / 64.0 ));
+
+ edge1->pos = blue->fit;
+ edge1->flags |= AF_EDGE_DONE;
+
+ if ( edge2 && !edge2->blue_edge )
+ {
+ af_latin2_align_linked_edge( hints, dim, edge1, edge2 );
+ edge2->flags |= AF_EDGE_DONE;
+ }
+
+ if ( !anchor )
+ {
+ anchor = edge;
+
+ anchor_drift = ( anchor->pos - anchor->opos );
+ if ( edge2 )
+ anchor_drift = ( anchor_drift +
+ ( edge2->pos - edge2->opos ) ) >> 1;
+ }
+ }
+ }
+
+ /* now we will align all stem edges, trying to maintain the */
+ /* relative order of stems in the glyph */
+ for ( edge = edges; edge < edge_limit; edge++ )
+ {
+ AF_Edge edge2;
+
+
+ if ( edge->flags & AF_EDGE_DONE )
+ continue;
+
+ /* skip all non-stem edges */
+ edge2 = edge->link;
+ if ( !edge2 )
+ {
+ has_serifs++;
+ continue;
+ }
+
+ /* now align the stem */
+
+ /* this should not happen, but it's better to be safe */
+ if ( edge2->blue_edge )
+ {
+ FT_TRACE5(( "ASSERTION FAILED for edge %d\n", edge2-edges ));
+
+ af_latin2_align_linked_edge( hints, dim, edge2, edge );
+ edge->flags |= AF_EDGE_DONE;
+ continue;
+ }
+
+ if ( !anchor )
+ {
+ FT_Pos org_len, org_center, cur_len;
+ FT_Pos cur_pos1, error1, error2, u_off, d_off;
+
+
+ org_len = edge2->opos - edge->opos;
+ cur_len = af_latin2_compute_stem_width( hints, dim, org_len,
+ edge->flags,
+ edge2->flags );
+ if ( cur_len <= 64 )
+ u_off = d_off = 32;
+ else
+ {
+ u_off = 38;
+ d_off = 26;
+ }
+
+ if ( cur_len < 96 )
+ {
+ org_center = edge->opos + ( org_len >> 1 );
+
+ cur_pos1 = FT_PIX_ROUND( org_center );
+
+ error1 = org_center - ( cur_pos1 - u_off );
+ if ( error1 < 0 )
+ error1 = -error1;
+
+ error2 = org_center - ( cur_pos1 + d_off );
+ if ( error2 < 0 )
+ error2 = -error2;
+
+ if ( error1 < error2 )
+ cur_pos1 -= u_off;
+ else
+ cur_pos1 += d_off;
+
+ edge->pos = cur_pos1 - cur_len / 2;
+ edge2->pos = edge->pos + cur_len;
+ }
+ else
+ edge->pos = FT_PIX_ROUND( edge->opos );
+
+ FT_TRACE5(( "ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)"
+ " snapped to (%.2f) (%.2f)\n",
+ edge-edges, edge->opos / 64.0,
+ edge2-edges, edge2->opos / 64.0,
+ edge->pos / 64.0, edge2->pos / 64.0 ));
+ anchor = edge;
+
+ edge->flags |= AF_EDGE_DONE;
+
+ af_latin2_align_linked_edge( hints, dim, edge, edge2 );
+
+ edge2->flags |= AF_EDGE_DONE;
+
+ anchor_drift = ( ( anchor->pos - anchor->opos ) +
+ ( edge2->pos - edge2->opos ) ) >> 1;
+
+ FT_TRACE5(( "DRIFT: %.2f\n", anchor_drift/64.0 ));
+ }
+ else
+ {
+ FT_Pos org_pos, org_len, org_center, cur_center, cur_len;
+ FT_Pos org_left, org_right;
+
+
+ org_pos = edge->opos + anchor_drift;
+ org_len = edge2->opos - edge->opos;
+ org_center = org_pos + ( org_len >> 1 );
+
+ cur_len = af_latin2_compute_stem_width( hints, dim, org_len,
+ edge->flags,
+ edge2->flags );
+
+ org_left = org_pos + ( ( org_len - cur_len ) >> 1 );
+ org_right = org_pos + ( ( org_len + cur_len ) >> 1 );
+
+ FT_TRACE5(( "ALIGN: left=%.2f right=%.2f ",
+ org_left / 64.0, org_right / 64.0 ));
+ cur_center = org_center;
+
+ if ( edge2->flags & AF_EDGE_DONE )
+ {
+ FT_TRACE5(( "\n" ));
+ edge->pos = edge2->pos - cur_len;
+ }
+ else
+ {
+ /* we want to compare several displacement, and choose
+ * the one that increases fitness while minimizing
+ * distortion as well
+ */
+ FT_Pos displacements[6], scores[6], org, fit, delta;
+ FT_UInt count = 0;
+
+ /* note: don't even try to fit tiny stems */
+ if ( cur_len < 32 )
+ {
+ FT_TRACE5(( "tiny stem\n" ));
+ goto AlignStem;
+ }
+
+ /* if the span is within a single pixel, don't touch it */
+ if ( FT_PIX_FLOOR( org_left ) == FT_PIX_CEIL( org_right ) )
+ {
+ FT_TRACE5(( "single pixel stem\n" ));
+ goto AlignStem;
+ }
+
+ if ( cur_len <= 96 )
+ {
+ /* we want to avoid the absolute worst case which is
+ * when the left and right edges of the span each represent
+ * about 50% of the gray. we'd better want to change this
+ * to 25/75%, since this is much more pleasant to the eye with
+ * very acceptable distortion
+ */
+ FT_Pos frac_left = org_left & 63;
+ FT_Pos frac_right = org_right & 63;
+
+ if ( frac_left >= 22 && frac_left <= 42 &&
+ frac_right >= 22 && frac_right <= 42 )
+ {
+ org = frac_left;
+ fit = ( org <= 32 ) ? 16 : 48;
+ delta = FT_ABS( fit - org );
+ displacements[count] = fit - org;
+ scores[count++] = delta;
+ FT_TRACE5(( "dispA=%.2f (%d) ", ( fit - org ) / 64.0, delta ));
+
+ org = frac_right;
+ fit = ( org <= 32 ) ? 16 : 48;
+ delta = FT_ABS( fit - org );
+ displacements[count] = fit - org;
+ scores[count++] = delta;
+ FT_TRACE5(( "dispB=%.2f (%d) ", ( fit - org ) / 64.0, delta ));
+ }
+ }
+
+ /* snapping the left edge to the grid */
+ org = org_left;
+ fit = FT_PIX_ROUND( org );
+ delta = FT_ABS( fit - org );
+ displacements[count] = fit - org;
+ scores[count++] = delta;
+ FT_TRACE5(( "dispC=%.2f (%d) ", ( fit - org ) / 64.0, delta ));
+
+ /* snapping the right edge to the grid */
+ org = org_right;
+ fit = FT_PIX_ROUND( org );
+ delta = FT_ABS( fit - org );
+ displacements[count] = fit - org;
+ scores[count++] = delta;
+ FT_TRACE5(( "dispD=%.2f (%d) ", ( fit - org ) / 64.0, delta ));
+
+ /* now find the best displacement */
+ {
+ FT_Pos best_score = scores[0];
+ FT_Pos best_disp = displacements[0];
+ FT_UInt nn;
+
+ for ( nn = 1; nn < count; nn++ )
+ {
+ if ( scores[nn] < best_score )
+ {
+ best_score = scores[nn];
+ best_disp = displacements[nn];
+ }
+ }
+
+ cur_center = org_center + best_disp;
+ }
+ FT_TRACE5(( "\n" ));
+ }
+
+ AlignStem:
+ edge->pos = cur_center - ( cur_len >> 1 );
+ edge2->pos = edge->pos + cur_len;
+
+ FT_TRACE5(( "STEM1: %d (opos=%.2f) to %d (opos=%.2f)"
+ " snapped to (%.2f) and (%.2f),"
+ " org_len=%.2f cur_len=%.2f\n",
+ edge-edges, edge->opos / 64.0,
+ edge2-edges, edge2->opos / 64.0,
+ edge->pos / 64.0, edge2->pos / 64.0,
+ org_len / 64.0, cur_len / 64.0 ));
+
+ edge->flags |= AF_EDGE_DONE;
+ edge2->flags |= AF_EDGE_DONE;
+
+ if ( edge > edges && edge->pos < edge[-1].pos )
+ {
+ FT_TRACE5(( "BOUND: %d (pos=%.2f) to (%.2f)\n",
+ edge-edges, edge->pos / 64.0, edge[-1].pos / 64.0 ));
+ edge->pos = edge[-1].pos;
+ }
+ }
+ }
+
+ /* make sure that lowercase m's maintain their symmetry */
+
+ /* In general, lowercase m's have six vertical edges if they are sans */
+ /* serif, or twelve if they are with serifs. This implementation is */
+ /* based on that assumption, and seems to work very well with most */
+ /* faces. However, if for a certain face this assumption is not */
+ /* true, the m is just rendered like before. In addition, any stem */
+ /* correction will only be applied to symmetrical glyphs (even if the */
+ /* glyph is not an m), so the potential for unwanted distortion is */
+ /* relatively low. */
+
+ /* We don't handle horizontal edges since we can't easily assure that */
+ /* the third (lowest) stem aligns with the base line; it might end up */
+ /* one pixel higher or lower. */
+
+#if 0
+ {
+ FT_Int n_edges = edge_limit - edges;
+
+
+ if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) )
+ {
+ AF_Edge edge1, edge2, edge3;
+ FT_Pos dist1, dist2, span, delta;
+
+
+ if ( n_edges == 6 )
+ {
+ edge1 = edges;
+ edge2 = edges + 2;
+ edge3 = edges + 4;
+ }
+ else
+ {
+ edge1 = edges + 1;
+ edge2 = edges + 5;
+ edge3 = edges + 9;
+ }
+
+ dist1 = edge2->opos - edge1->opos;
+ dist2 = edge3->opos - edge2->opos;
+
+ span = dist1 - dist2;
+ if ( span < 0 )
+ span = -span;
+
+ if ( span < 8 )
+ {
+ delta = edge3->pos - ( 2 * edge2->pos - edge1->pos );
+ edge3->pos -= delta;
+ if ( edge3->link )
+ edge3->link->pos -= delta;
+
+ /* move the serifs along with the stem */
+ if ( n_edges == 12 )
+ {
+ ( edges + 8 )->pos -= delta;
+ ( edges + 11 )->pos -= delta;
+ }
+
+ edge3->flags |= AF_EDGE_DONE;
+ if ( edge3->link )
+ edge3->link->flags |= AF_EDGE_DONE;
+ }
+ }
+ }
+#endif
+
+ if ( has_serifs || !anchor )
+ {
+ /*
+ * now hint the remaining edges (serifs and single) in order
+ * to complete our processing
+ */
+ for ( edge = edges; edge < edge_limit; edge++ )
+ {
+ FT_Pos delta;
+
+
+ if ( edge->flags & AF_EDGE_DONE )
+ continue;
+
+ delta = 1000;
+
+ if ( edge->serif )
+ {
+ delta = edge->serif->opos - edge->opos;
+ if ( delta < 0 )
+ delta = -delta;
+ }
+
+ if ( delta < 64 + 16 )
+ {
+ af_latin2_align_serif_edge( hints, edge->serif, edge );
+ FT_TRACE5(( "SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)"
+ " aligned to (%.2f)\n",
+ edge-edges, edge->opos / 64.0,
+ edge->serif - edges, edge->serif->opos / 64.0,
+ edge->pos / 64.0 ));
+ }
+ else if ( !anchor )
+ {
+ FT_TRACE5(( "SERIF_ANCHOR: edge %d (opos=%.2f)"
+ " snapped to (%.2f)\n",
+ edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));
+ edge->pos = FT_PIX_ROUND( edge->opos );
+ anchor = edge;
+ }
+ else
+ {
+ AF_Edge before, after;
+
+
+ for ( before = edge - 1; before >= edges; before-- )
+ if ( before->flags & AF_EDGE_DONE )
+ break;
+
+ for ( after = edge + 1; after < edge_limit; after++ )
+ if ( after->flags & AF_EDGE_DONE )
+ break;
+
+ if ( before >= edges && before < edge &&
+ after < edge_limit && after > edge )
+ {
+ if ( after->opos == before->opos )
+ edge->pos = before->pos;
+ else
+ edge->pos = before->pos +
+ FT_MulDiv( edge->opos - before->opos,
+ after->pos - before->pos,
+ after->opos - before->opos );
+ FT_TRACE5(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f)"
+ " from %d (opos=%.2f)\n",
+ edge-edges, edge->opos / 64.0, edge->pos / 64.0,
+ before - edges, before->opos / 64.0 ));
+ }
+ else
+ {
+ edge->pos = anchor->pos +
+ ( ( edge->opos - anchor->opos + 16 ) & ~31 );
+
+ FT_TRACE5(( "SERIF_LINK2: edge %d (opos=%.2f)"
+ " snapped to (%.2f)\n",
+ edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));
+ }
+ }
+
+ edge->flags |= AF_EDGE_DONE;
+
+ if ( edge > edges && edge->pos < edge[-1].pos )
+ edge->pos = edge[-1].pos;
+
+ if ( edge + 1 < edge_limit &&
+ edge[1].flags & AF_EDGE_DONE &&
+ edge->pos > edge[1].pos )
+ edge->pos = edge[1].pos;
+ }
+ }
+ }
+
+
+ static FT_Error
+ af_latin2_hints_apply( FT_UInt glyph_index,
+ AF_GlyphHints hints,
+ FT_Outline* outline,
+ AF_LatinMetrics metrics )
+ {
+ FT_Error error;
+ int dim;
+
+ FT_UNUSED( glyph_index );
+
+
+ error = af_glyph_hints_reload( hints, outline );
+ if ( error )
+ goto Exit;
+
+ /* analyze glyph outline */
+ if ( AF_HINTS_DO_HORIZONTAL( hints ) )
+ {
+ error = af_latin2_hints_detect_features( hints, AF_DIMENSION_HORZ );
+ if ( error )
+ goto Exit;
+ }
+
+ if ( AF_HINTS_DO_VERTICAL( hints ) )
+ {
+ error = af_latin2_hints_detect_features( hints, AF_DIMENSION_VERT );
+ if ( error )
+ goto Exit;
+
+ af_latin2_hints_compute_blue_edges( hints, metrics );
+ }
+
+ /* grid-fit the outline */
+ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
+ {
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+ AF_HINTS_DO_WARP( hints ) )
+ {
+ AF_WarperRec warper;
+ FT_Fixed scale;
+ FT_Pos delta;
+
+
+ af_warper_compute( &warper, hints, dim, &scale, &delta );
+ af_glyph_hints_scale_dim( hints, dim, scale, delta );
+ continue;
+ }
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
+
+ if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||
+ ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) )
+ {
+ af_latin2_hint_edges( hints, (AF_Dimension)dim );
+ af_glyph_hints_align_edge_points( hints, (AF_Dimension)dim );
+ af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim );
+ af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim );
+ }
+ }
+ af_glyph_hints_save( hints, outline );
+
+ Exit:
+ return error;
+ }
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** L A T I N S C R I P T C L A S S *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ AF_DEFINE_WRITING_SYSTEM_CLASS(
+ af_latin2_writing_system_class,
+
+ AF_WRITING_SYSTEM_LATIN2,
+
+ sizeof ( AF_LatinMetricsRec ),
+
+ (AF_WritingSystem_InitMetricsFunc) af_latin2_metrics_init, /* style_metrics_init */
+ (AF_WritingSystem_ScaleMetricsFunc)af_latin2_metrics_scale, /* style_metrics_scale */
+ (AF_WritingSystem_DoneMetricsFunc) NULL, /* style_metrics_done */
+ (AF_WritingSystem_GetStdWidthsFunc)af_latin2_get_standard_widths, /* style_metrics_getstdw */
+
+ (AF_WritingSystem_InitHintsFunc) af_latin2_hints_init, /* style_hints_init */
+ (AF_WritingSystem_ApplyHintsFunc) af_latin2_hints_apply /* style_hints_apply */
+ )
+
+#else /* !FT_OPTION_AUTOFIT2 */
+
+ /* ANSI C doesn't like empty source files */
+ typedef int _af_latin2_dummy;
+
+#endif /* !FT_OPTION_AUTOFIT2 */
+
+
+/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin2.h b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin2.h
new file mode 100644
index 00000000000..c2aebc49acf
--- /dev/null
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin2.h
@@ -0,0 +1,46 @@
+/* ATTENTION: This file doesn't compile. It is only here as a reference */
+/* of an alternative latin hinting algorithm that was always */
+/* marked as experimental. */
+
+
+/****************************************************************************
+ *
+ * aflatin2.h
+ *
+ * Auto-fitter hinting routines for latin writing system
+ * (specification).
+ *
+ * Copyright (C) 2003-2020 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 AFLATIN2_H_
+#define AFLATIN2_H_
+
+#include "afhints.h"
+
+
+FT_BEGIN_HEADER
+
+
+ /* the `latin' writing system */
+
+ AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin2_writing_system_class )
+
+
+/* */
+
+FT_END_HEADER
+
+#endif /* AFLATIN_H_ */
+
+
+/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afloader.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afloader.c
index a06d49ad7e5..c35d85c4cfb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afloader.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afloader.c
@@ -4,7 +4,7 @@
*
* Auto-fitter glyph loading routines (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -105,6 +105,7 @@
globals->stem_darkening_for_ppem;
FT_Fixed em_size = af_intToFixed( face->units_per_EM );
+ FT_Fixed em_ratio = FT_DivFix( af_intToFixed( 1000 ), em_size );
FT_Matrix scale_down_matrix = { 0x10000L, 0, 0, 0x10000L };
@@ -141,11 +142,12 @@
darken_by_font_units_x =
- af_loader_compute_darkening( loader,
- face,
- stdVW ) ;
- darken_x = FT_MulFix( darken_by_font_units_x,
- size_metrics->x_scale );
+ af_intToFixed( af_loader_compute_darkening( loader,
+ face,
+ stdVW ) );
+ darken_x = FT_DivFix( FT_MulFix( darken_by_font_units_x,
+ size_metrics->x_scale ),
+ em_ratio );
globals->standard_vertical_width = stdVW;
globals->stem_darkening_for_ppem = size_metrics->x_ppem;
@@ -159,11 +161,12 @@
darken_by_font_units_y =
- af_loader_compute_darkening( loader,
- face,
- stdHW ) ;
- darken_y = FT_MulFix( darken_by_font_units_y,
- size_metrics->y_scale );
+ af_intToFixed( af_loader_compute_darkening( loader,
+ face,
+ stdHW ) );
+ darken_y = FT_DivFix( FT_MulFix( darken_by_font_units_y,
+ size_metrics->y_scale ),
+ em_ratio );
globals->standard_horizontal_width = stdHW;
globals->stem_darkening_for_ppem = size_metrics->x_ppem;
@@ -297,6 +300,12 @@
if ( error )
goto Exit;
+#ifdef FT_OPTION_AUTOFIT2
+ /* XXX: undocumented hook to activate the latin2 writing system. */
+ if ( load_flags & ( 1UL << 20 ) )
+ style_options = AF_STYLE_LTN2_DFLT;
+#endif
+
/*
* Glyphs (really code points) are assigned to scripts. Script
* analysis is done lazily: For each glyph that passes through here,
@@ -473,8 +482,8 @@
FT_Pos pp2x = loader->pp2.x;
- loader->pp1.x = FT_PIX_ROUND( pp1x );
- loader->pp2.x = FT_PIX_ROUND( pp2x );
+ loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
+ loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
slot->lsb_delta = loader->pp1.x - pp1x;
slot->rsb_delta = loader->pp2.x - pp2x;
@@ -585,7 +594,7 @@
*
* XXX: Currently a crude adaption of the original algorithm. Do better?
*/
- FT_LOCAL_DEF( FT_Fixed )
+ FT_LOCAL_DEF( FT_Int32 )
af_loader_compute_darkening( AF_Loader loader,
FT_Face face,
FT_Pos standard_width )
@@ -704,7 +713,7 @@
}
/* Convert darken_amount from per 1000 em to true character space. */
- return FT_DivFix( darken_amount, em_ratio );
+ return af_fixedToInt( FT_DivFix( darken_amount, em_ratio ) );
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afloader.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afloader.h
index b4936a8722b..97282371cd4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afloader.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afloader.h
@@ -4,7 +4,7 @@
*
* Auto-fitter glyph loading routines (specification).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -75,7 +75,7 @@ FT_BEGIN_HEADER
FT_UInt gindex,
FT_Int32 load_flags );
- FT_LOCAL_DEF( FT_Fixed )
+ FT_LOCAL_DEF( FT_Int32 )
af_loader_compute_darkening( AF_Loader loader,
FT_Face face,
FT_Pos standard_width );
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.c
index 76f9b3733b3..e16494460eb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.c
@@ -4,7 +4,7 @@
*
* Auto-fitter module implementation (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -48,7 +48,7 @@
int _af_debug_disable_blue_hints;
/* we use a global object instead of a local one for debugging */
- static AF_GlyphHintsRec _af_debug_hints_rec[1];
+ AF_GlyphHintsRec _af_debug_hints_rec[1];
void* _af_debug_hints = _af_debug_hints_rec;
#endif
@@ -148,7 +148,7 @@
if ( !af_style_classes[ss] )
{
- FT_TRACE2(( "af_property_set: Invalid value %d for property `%s'\n",
+ FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n",
*fallback_script, property_name ));
return FT_THROW( Invalid_Argument );
}
@@ -190,6 +190,35 @@
return error;
}
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ else if ( !ft_strcmp( property_name, "warping" ) )
+ {
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ if ( value_is_string )
+ {
+ const char* s = (const char*)value;
+ long w = ft_strtol( s, NULL, 10 );
+
+
+ if ( w == 0 )
+ module->warping = 0;
+ else if ( w == 1 )
+ module->warping = 1;
+ else
+ return FT_THROW( Invalid_Argument );
+ }
+ else
+#endif
+ {
+ FT_Bool* warping = (FT_Bool*)value;
+
+
+ module->warping = *warping;
+ }
+
+ return error;
+ }
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
{
FT_Int* darken_params;
@@ -278,7 +307,7 @@
return error;
}
- FT_TRACE2(( "af_property_set: missing property `%s'\n",
+ FT_TRACE0(( "af_property_set: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
@@ -293,6 +322,9 @@
AF_Module module = (AF_Module)ft_module;
FT_UInt fallback_style = module->fallback_style;
FT_UInt default_script = module->default_script;
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ FT_Bool warping = module->warping;
+#endif
if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
@@ -339,6 +371,17 @@
return error;
}
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ else if ( !ft_strcmp( property_name, "warping" ) )
+ {
+ FT_Bool* val = (FT_Bool*)value;
+
+
+ *val = warping;
+
+ return error;
+ }
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
{
FT_Int* darken_params = module->darken_params;
@@ -367,7 +410,7 @@
return error;
}
- FT_TRACE2(( "af_property_get: missing property `%s'\n",
+ FT_TRACE0(( "af_property_get: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
@@ -404,6 +447,9 @@
module->fallback_style = AF_STYLE_FALLBACK;
module->default_script = AF_SCRIPT_DEFAULT;
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ module->warping = 0;
+#endif
module->no_stem_darkening = TRUE;
module->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.h
index c5bd4682015..e8fe4a93aad 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afmodule.h
@@ -4,7 +4,7 @@
*
* Auto-fitter module implementation (specification).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -37,6 +37,9 @@ FT_BEGIN_HEADER
FT_UInt fallback_style;
FT_UInt default_script;
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ FT_Bool warping;
+#endif
FT_Bool no_stem_darkening;
FT_Int darken_params[8];
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afranges.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afranges.c
index e06f182dd0d..c8ebf5e7849 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afranges.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afranges.c
@@ -4,7 +4,7 @@
*
* Auto-fitter Unicode script ranges (body).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afranges.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afranges.h
index 841d630aab6..c2ffda4b0f9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afranges.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afranges.h
@@ -4,7 +4,7 @@
*
* Auto-fitter Unicode script ranges (specification).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afscript.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afscript.h
index af78d573e11..4cf9cc19f58 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afscript.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afscript.h
@@ -4,7 +4,7 @@
*
* Auto-fitter scripts (specification only).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.c
index 5d078937e18..bbf7b6b1f9a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.c
@@ -4,7 +4,7 @@
*
* HarfBuzz interface for accessing OpenType features (body).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -132,24 +132,13 @@
/* Convert a HarfBuzz script tag into the corresponding OpenType */
/* tag or tags -- some Indic scripts like Devanagari have an old */
/* and a new set of features. */
- {
- unsigned int tags_count = 3;
- hb_tag_t tags[3];
-
-
- hb_ot_tags_from_script_and_language( script,
- HB_LANGUAGE_INVALID,
- &tags_count,
- tags,
- NULL,
- NULL );
- script_tags[0] = tags_count > 0 ? tags[0] : HB_TAG_NONE;
- script_tags[1] = tags_count > 1 ? tags[1] : HB_TAG_NONE;
- script_tags[2] = tags_count > 2 ? tags[2] : HB_TAG_NONE;
- }
+ hb_ot_tags_from_script( script,
+ &script_tags[0],
+ &script_tags[1] );
- /* If the second tag is HB_OT_TAG_DEFAULT_SCRIPT, change that to */
- /* HB_TAG_NONE except for the default script. */
+ /* `hb_ot_tags_from_script' usually returns HB_OT_TAG_DEFAULT_SCRIPT */
+ /* as the second tag. We change that to HB_TAG_NONE except for the */
+ /* default script. */
if ( default_script )
{
if ( script_tags[0] == HB_TAG_NONE )
@@ -168,6 +157,9 @@
/* HarfBuzz maps them to `DFLT', which we don't want to handle here */
if ( script_tags[0] == HB_OT_TAG_DEFAULT_SCRIPT )
goto Exit;
+
+ if ( script_tags[1] == HB_OT_TAG_DEFAULT_SCRIPT )
+ script_tags[1] = HB_TAG_NONE;
}
gsub_lookups = hb_set_create();
@@ -181,9 +173,9 @@
if ( hb_set_is_empty( gsub_lookups ) )
goto Exit; /* nothing to do */
- FT_TRACE4(( "GSUB lookups (style `%s'):\n",
+ FT_TRACE4(( "GSUB lookups (style `%s'):\n"
+ " ",
af_style_names[style_class->style] ));
- FT_TRACE4(( " " ));
#ifdef FT_DEBUG_LEVEL_TRACE
count = 0;
@@ -210,13 +202,12 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( !count )
FT_TRACE4(( " (none)" ));
- FT_TRACE4(( "\n" ));
- FT_TRACE4(( "\n" ));
+ FT_TRACE4(( "\n\n" ));
#endif
- FT_TRACE4(( "GPOS lookups (style `%s'):\n",
+ FT_TRACE4(( "GPOS lookups (style `%s'):\n"
+ " ",
af_style_names[style_class->style] ));
- FT_TRACE4(( " " ));
gpos_lookups = hb_set_create();
hb_ot_layout_collect_lookups( face,
@@ -251,8 +242,7 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( !count )
FT_TRACE4(( " (none)" ));
- FT_TRACE4(( "\n" ));
- FT_TRACE4(( "\n" ));
+ FT_TRACE4(( "\n\n" ));
#endif
/*
@@ -363,10 +353,8 @@
{
#ifdef FT_DEBUG_LEVEL_TRACE
if ( !( count % 10 ) )
- {
- FT_TRACE4(( "\n" ));
- FT_TRACE4(( " " ));
- }
+ FT_TRACE4(( "\n"
+ " " ));
FT_TRACE4(( " %d", idx ));
count++;
@@ -388,12 +376,9 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( !count )
- {
- FT_TRACE4(( "\n" ));
- FT_TRACE4(( " (none)" ));
- }
- FT_TRACE4(( "\n" ));
- FT_TRACE4(( "\n" ));
+ FT_TRACE4(( "\n"
+ " (none)" ));
+ FT_TRACE4(( "\n\n" ));
#endif
Exit:
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.h
index cf3f81342ff..138c27b32b6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afshaper.h
@@ -4,7 +4,7 @@
*
* HarfBuzz interface for accessing OpenType features (specification).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afstyles.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afstyles.h
index 64c808c5812..9113ec451ef 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afstyles.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afstyles.h
@@ -4,7 +4,7 @@
*
* Auto-fitter styles (specification only).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -299,6 +299,15 @@
AF_BLUE_STRINGSET_LATP,
AF_COVERAGE_DEFAULT )
+#ifdef FT_OPTION_AUTOFIT2
+ STYLE( ltn2_dflt, LTN2_DFLT,
+ "Latin 2 default style",
+ AF_WRITING_SYSTEM_LATIN2,
+ AF_SCRIPT_LATN,
+ AF_BLUE_STRINGSET_LATN,
+ AF_COVERAGE_DEFAULT )
+#endif
+
STYLE( lisu_dflt, LISU_DFLT,
"Lisu default style",
AF_WRITING_SYSTEM_LATIN,
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h b/Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h
index e76b103ed01..5f040c6b4b9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h
@@ -4,7 +4,7 @@
*
* Auto-fitter types (specification only).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -92,6 +92,63 @@ extern void* _af_debug_hints;
FT_Pos threshold );
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** A N G L E T Y P E S *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /*
+ * The auto-fitter doesn't need a very high angular accuracy;
+ * this allows us to speed up some computations considerably with a
+ * light Cordic algorithm (see afangles.c).
+ */
+
+ typedef FT_Int AF_Angle;
+
+
+#define AF_ANGLE_PI 256
+#define AF_ANGLE_2PI ( AF_ANGLE_PI * 2 )
+#define AF_ANGLE_PI2 ( AF_ANGLE_PI / 2 )
+#define AF_ANGLE_PI4 ( AF_ANGLE_PI / 4 )
+
+
+#if 0
+ /*
+ * compute the angle of a given 2-D vector
+ */
+ FT_LOCAL( AF_Angle )
+ af_angle_atan( FT_Pos dx,
+ FT_Pos dy );
+
+
+ /*
+ * compute `angle2 - angle1'; the result is always within
+ * the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1]
+ */
+ FT_LOCAL( AF_Angle )
+ af_angle_diff( AF_Angle angle1,
+ AF_Angle angle2 );
+#endif /* 0 */
+
+
+#define AF_ANGLE_DIFF( result, angle1, angle2 ) \
+ FT_BEGIN_STMNT \
+ AF_Angle _delta = (angle2) - (angle1); \
+ \
+ \
+ while ( _delta <= -AF_ANGLE_PI ) \
+ _delta += AF_ANGLE_2PI; \
+ \
+ while ( _delta > AF_ANGLE_PI ) \
+ _delta -= AF_ANGLE_2PI; \
+ \
+ result = _delta; \
+ FT_END_STMNT
+
+
/*
* opaque handle to glyph-specific hints -- see `afhints.h' for more
* details
@@ -115,6 +172,7 @@ extern void* _af_debug_hints;
#define AF_SCALER_FLAG_NO_HORIZONTAL 1U /* disable horizontal hinting */
#define AF_SCALER_FLAG_NO_VERTICAL 2U /* disable vertical hinting */
#define AF_SCALER_FLAG_NO_ADVANCE 4U /* disable advance hinting */
+#define AF_SCALER_FLAG_NO_WARPER 8U /* disable warper */
typedef struct AF_ScalerRec_
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afwarp.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afwarp.c
new file mode 100644
index 00000000000..808280df5d9
--- /dev/null
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afwarp.c
@@ -0,0 +1,373 @@
+/****************************************************************************
+ *
+ * afwarp.c
+ *
+ * Auto-fitter warping algorithm (body).
+ *
+ * Copyright (C) 2006-2020 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.
+ *
+ */
+
+
+ /*
+ * The idea of the warping code is to slightly scale and shift a glyph
+ * within a single dimension so that as much of its segments are aligned
+ * (more or less) on the grid. To find out the optimal scaling and
+ * shifting value, various parameter combinations are tried and scored.
+ */
+
+#include "afwarp.h"
+
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+
+ /**************************************************************************
+ *
+ * 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 afwarp
+
+
+ /* The weights cover the range 0/64 - 63/64 of a pixel. Obviously, */
+ /* values around a half pixel (which means exactly between two grid */
+ /* lines) gets the worst weight. */
+#if 1
+ static const AF_WarpScore
+ af_warper_weights[64] =
+ {
+ 35, 32, 30, 25, 20, 15, 12, 10, 5, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -1, -2, -5, -8,-10,-10,-20,-20,-30,-30,
+
+ -30,-30,-20,-20,-10,-10, -8, -5, -2, -1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 5, 10, 12, 15, 20, 25, 30, 32,
+ };
+#else
+ static const AF_WarpScore
+ af_warper_weights[64] =
+ {
+ 30, 20, 10, 5, 4, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, -1, -2, -2, -5, -5,-10,-10,-15,-20,
+
+ -20,-15,-15,-10,-10, -5, -5, -2, -2, -1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 4, 5, 10, 20,
+ };
+#endif
+
+
+ /* Score segments for a given `scale' and `delta' in the range */
+ /* `xx1' to `xx2', and store the best result in `warper'. If */
+ /* the new best score is equal to the old one, prefer the */
+ /* value with a smaller distortion (around `base_distort'). */
+
+ static void
+ af_warper_compute_line_best( AF_Warper warper,
+ FT_Fixed scale,
+ FT_Pos delta,
+ FT_Pos xx1,
+ FT_Pos xx2,
+ AF_WarpScore base_distort,
+ AF_Segment segments,
+ FT_Int num_segments )
+ {
+ FT_Int idx_min, idx_max, idx0;
+ FT_Int nn;
+ AF_WarpScore scores[65];
+
+
+ for ( nn = 0; nn < 65; nn++ )
+ scores[nn] = 0;
+
+ idx0 = xx1 - warper->t1;
+
+ /* compute minimum and maximum indices */
+ {
+ FT_Pos xx1min = warper->x1min;
+ FT_Pos xx1max = warper->x1max;
+ FT_Pos w = xx2 - xx1;
+
+
+ if ( xx1min + w < warper->x2min )
+ xx1min = warper->x2min - w;
+
+ if ( xx1max + w > warper->x2max )
+ xx1max = warper->x2max - w;
+
+ idx_min = xx1min - warper->t1;
+ idx_max = xx1max - warper->t1;
+
+ if ( idx_min < 0 || idx_min > idx_max || idx_max > 64 )
+ {
+ FT_TRACE5(( "invalid indices:\n"
+ " min=%d max=%d, xx1=%ld xx2=%ld,\n"
+ " x1min=%ld x1max=%ld, x2min=%ld x2max=%ld\n",
+ idx_min, idx_max, xx1, xx2,
+ warper->x1min, warper->x1max,
+ warper->x2min, warper->x2max ));
+ return;
+ }
+ }
+
+ for ( nn = 0; nn < num_segments; nn++ )
+ {
+ FT_Pos len = segments[nn].max_coord - segments[nn].min_coord;
+ FT_Pos y0 = FT_MulFix( segments[nn].pos, scale ) + delta;
+ FT_Pos y = y0 + ( idx_min - idx0 );
+ FT_Int idx;
+
+
+ /* score the length of the segments for the given range */
+ for ( idx = idx_min; idx <= idx_max; idx++, y++ )
+ scores[idx] += af_warper_weights[y & 63] * len;
+ }
+
+ /* find best score */
+ {
+ FT_Int idx;
+
+
+ for ( idx = idx_min; idx <= idx_max; idx++ )
+ {
+ AF_WarpScore score = scores[idx];
+ AF_WarpScore distort = base_distort + ( idx - idx0 );
+
+
+ if ( score > warper->best_score ||
+ ( score == warper->best_score &&
+ distort < warper->best_distort ) )
+ {
+ warper->best_score = score;
+ warper->best_distort = distort;
+ warper->best_scale = scale;
+ warper->best_delta = delta + ( idx - idx0 );
+ }
+ }
+ }
+ }
+
+
+ /* Compute optimal scaling and delta values for a given glyph and */
+ /* dimension. */
+
+ FT_LOCAL_DEF( void )
+ af_warper_compute( AF_Warper warper,
+ AF_GlyphHints hints,
+ AF_Dimension dim,
+ FT_Fixed *a_scale,
+ FT_Pos *a_delta )
+ {
+ AF_AxisHints axis;
+ AF_Point points;
+
+ FT_Fixed org_scale;
+ FT_Pos org_delta;
+
+ FT_Int nn, num_points, num_segments;
+ FT_Int X1, X2;
+ FT_Int w;
+
+ AF_WarpScore base_distort;
+ AF_Segment segments;
+
+
+ /* get original scaling transformation */
+ if ( dim == AF_DIMENSION_VERT )
+ {
+ org_scale = hints->y_scale;
+ org_delta = hints->y_delta;
+ }
+ else
+ {
+ org_scale = hints->x_scale;
+ org_delta = hints->x_delta;
+ }
+
+ warper->best_scale = org_scale;
+ warper->best_delta = org_delta;
+ warper->best_score = FT_INT_MIN;
+ warper->best_distort = 0;
+
+ axis = &hints->axis[dim];
+ segments = axis->segments;
+ num_segments = axis->num_segments;
+ points = hints->points;
+ num_points = hints->num_points;
+
+ *a_scale = org_scale;
+ *a_delta = org_delta;
+
+ /* get X1 and X2, minimum and maximum in original coordinates */
+ if ( num_segments < 1 )
+ return;
+
+#if 1
+ X1 = X2 = points[0].fx;
+ for ( nn = 1; nn < num_points; nn++ )
+ {
+ FT_Int X = points[nn].fx;
+
+
+ if ( X < X1 )
+ X1 = X;
+ if ( X > X2 )
+ X2 = X;
+ }
+#else
+ X1 = X2 = segments[0].pos;
+ for ( nn = 1; nn < num_segments; nn++ )
+ {
+ FT_Int X = segments[nn].pos;
+
+
+ if ( X < X1 )
+ X1 = X;
+ if ( X > X2 )
+ X2 = X;
+ }
+#endif
+
+ if ( X1 >= X2 )
+ return;
+
+ warper->x1 = FT_MulFix( X1, org_scale ) + org_delta;
+ warper->x2 = FT_MulFix( X2, org_scale ) + org_delta;
+
+ warper->t1 = AF_WARPER_FLOOR( warper->x1 );
+ warper->t2 = AF_WARPER_CEIL( warper->x2 );
+
+ /* examine a half pixel wide range around the maximum coordinates */
+ warper->x1min = warper->x1 & ~31;
+ warper->x1max = warper->x1min + 32;
+ warper->x2min = warper->x2 & ~31;
+ warper->x2max = warper->x2min + 32;
+
+ if ( warper->x1max > warper->x2 )
+ warper->x1max = warper->x2;
+
+ if ( warper->x2min < warper->x1 )
+ warper->x2min = warper->x1;
+
+ warper->w0 = warper->x2 - warper->x1;
+
+ if ( warper->w0 <= 64 )
+ {
+ warper->x1max = warper->x1;
+ warper->x2min = warper->x2;
+ }
+
+ /* examine (at most) a pixel wide range around the natural width */
+ warper->wmin = warper->x2min - warper->x1max;
+ warper->wmax = warper->x2max - warper->x1min;
+
+#if 1
+ /* some heuristics to reduce the number of widths to be examined */
+ {
+ int margin = 16;
+
+
+ if ( warper->w0 <= 128 )
+ {
+ margin = 8;
+ if ( warper->w0 <= 96 )
+ margin = 4;
+ }
+
+ if ( warper->wmin < warper->w0 - margin )
+ warper->wmin = warper->w0 - margin;
+
+ if ( warper->wmax > warper->w0 + margin )
+ warper->wmax = warper->w0 + margin;
+ }
+
+ if ( warper->wmin < warper->w0 * 3 / 4 )
+ warper->wmin = warper->w0 * 3 / 4;
+
+ if ( warper->wmax > warper->w0 * 5 / 4 )
+ warper->wmax = warper->w0 * 5 / 4;
+#else
+ /* no scaling, just translation */
+ warper->wmin = warper->wmax = warper->w0;
+#endif
+
+ for ( w = warper->wmin; w <= warper->wmax; w++ )
+ {
+ FT_Fixed new_scale;
+ FT_Pos new_delta;
+ FT_Pos xx1, xx2;
+
+
+ /* compute min and max positions for given width, */
+ /* assuring that they stay within the coordinate ranges */
+ xx1 = warper->x1;
+ xx2 = warper->x2;
+ if ( w >= warper->w0 )
+ {
+ xx1 -= w - warper->w0;
+ if ( xx1 < warper->x1min )
+ {
+ xx2 += warper->x1min - xx1;
+ xx1 = warper->x1min;
+ }
+ }
+ else
+ {
+ xx1 -= w - warper->w0;
+ if ( xx1 > warper->x1max )
+ {
+ xx2 -= xx1 - warper->x1max;
+ xx1 = warper->x1max;
+ }
+ }
+
+ if ( xx1 < warper->x1 )
+ base_distort = warper->x1 - xx1;
+ else
+ base_distort = xx1 - warper->x1;
+
+ if ( xx2 < warper->x2 )
+ base_distort += warper->x2 - xx2;
+ else
+ base_distort += xx2 - warper->x2;
+
+ /* give base distortion a greater weight while scoring */
+ base_distort *= 10;
+
+ new_scale = org_scale + FT_DivFix( w - warper->w0, X2 - X1 );
+ new_delta = xx1 - FT_MulFix( X1, new_scale );
+
+ af_warper_compute_line_best( warper, new_scale, new_delta, xx1, xx2,
+ base_distort,
+ segments, num_segments );
+ }
+
+ {
+ FT_Fixed best_scale = warper->best_scale;
+ FT_Pos best_delta = warper->best_delta;
+
+
+ hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale )
+ + best_delta;
+ hints->xmax_delta = FT_MulFix( X2, best_scale - org_scale )
+ + best_delta;
+
+ *a_scale = best_scale;
+ *a_delta = best_delta;
+ }
+ }
+
+#else /* !AF_CONFIG_OPTION_USE_WARPER */
+
+ /* ANSI C doesn't like empty source files */
+ typedef int _af_warp_dummy;
+
+#endif /* !AF_CONFIG_OPTION_USE_WARPER */
+
+/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afwarp.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afwarp.h
new file mode 100644
index 00000000000..cdea23e7dec
--- /dev/null
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afwarp.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+ *
+ * afwarp.h
+ *
+ * Auto-fitter warping algorithm (specification).
+ *
+ * Copyright (C) 2006-2020 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 AFWARP_H_
+#define AFWARP_H_
+
+#include "afhints.h"
+
+FT_BEGIN_HEADER
+
+#define AF_WARPER_SCALE
+
+#define AF_WARPER_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
+#define AF_WARPER_CEIL( x ) AF_WARPER_FLOOR( (x) + 63 )
+
+
+ typedef FT_Int32 AF_WarpScore;
+
+ typedef struct AF_WarperRec_
+ {
+ FT_Pos x1, x2;
+ FT_Pos t1, t2;
+ FT_Pos x1min, x1max;
+ FT_Pos x2min, x2max;
+ FT_Pos w0, wmin, wmax;
+
+ FT_Fixed best_scale;
+ FT_Pos best_delta;
+ AF_WarpScore best_score;
+ AF_WarpScore best_distort;
+
+ } AF_WarperRec, *AF_Warper;
+
+
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ FT_LOCAL( void )
+ af_warper_compute( AF_Warper warper,
+ AF_GlyphHints hints,
+ AF_Dimension dim,
+ FT_Fixed *a_scale,
+ FT_Pos *a_delta );
+#endif
+
+
+FT_END_HEADER
+
+
+#endif /* AFWARP_H_ */
+
+
+/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afwrtsys.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afwrtsys.h
index 39aa1211263..3990633d2d6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afwrtsys.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afwrtsys.h
@@ -4,7 +4,7 @@
*
* Auto-fitter writing systems (specification only).
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -26,6 +26,9 @@
#include "aflatin.h"
#include "afcjk.h"
#include "afindic.h"
+#ifdef FT_OPTION_AUTOFIT2
+#include "aflatin2.h"
+#endif
#endif /* AFWRTSYS_H_ */
@@ -41,5 +44,9 @@
WRITING_SYSTEM( latin, LATIN )
WRITING_SYSTEM( cjk, CJK )
WRITING_SYSTEM( indic, INDIC )
+#ifdef FT_OPTION_AUTOFIT2
+ WRITING_SYSTEM( latin2, LATIN2 )
+#endif
+
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/autofit.c b/Build/source/libs/freetype2/freetype-src/src/autofit/autofit.c
index 7e692b4de9b..ef5e7f14522 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/autofit.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/autofit.c
@@ -4,7 +4,7 @@
*
* Auto-fitter module (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -18,6 +18,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
+#include "afangles.c"
#include "afblue.c"
#include "afcjk.c"
#include "afdummy.c"
@@ -25,10 +26,12 @@
#include "afhints.c"
#include "afindic.c"
#include "aflatin.c"
+#include "aflatin2.c"
#include "afloader.c"
#include "afmodule.c"
#include "afranges.c"
#include "afshaper.c"
+#include "afwarp.c"
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/module.mk b/Build/source/libs/freetype2/freetype-src/src/autofit/module.mk
index fab3a6bd623..c32781f478c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2003-2021 by
+# Copyright (C) 2003-2020 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/Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk b/Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk
index 19b3bcadb30..553ddce6b74 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2003-2021 by
+# Copyright (C) 2003-2020 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -28,7 +28,8 @@ AUTOF_COMPILE := $(CC) $(ANSIFLAGS) \
# AUTOF driver sources (i.e., C files)
#
-AUTOF_DRV_SRC := $(AUTOF_DIR)/afblue.c \
+AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \
+ $(AUTOF_DIR)/afblue.c \
$(AUTOF_DIR)/afcjk.c \
$(AUTOF_DIR)/afdummy.c \
$(AUTOF_DIR)/afglobal.c \
@@ -39,6 +40,7 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afblue.c \
$(AUTOF_DIR)/afmodule.c \
$(AUTOF_DIR)/afranges.c \
$(AUTOF_DIR)/afshaper.c \
+ $(AUTOF_DIR)/afwarp.c
# AUTOF driver headers
#
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftadvanc.c b/Build/source/libs/freetype2/freetype-src/src/base/ftadvanc.c
index f20b9928aa1..c689e6a15ba 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftadvanc.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftadvanc.c
@@ -4,7 +4,7 @@
*
* Quick computation of advance widths (body).
*
- * Copyright (C) 2008-2021 by
+ * Copyright (C) 2008-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftbase.c b/Build/source/libs/freetype2/freetype-src/src/base/ftbase.c
index 7366bc46db1..bfbaffd64e9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftbase.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftbase.c
@@ -4,7 +4,7 @@
*
* Single object library component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftbase.h b/Build/source/libs/freetype2/freetype-src/src/base/ftbase.h
index 963ff93d681..25afa9bc314 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftbase.h
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftbase.h
@@ -4,7 +4,7 @@
*
* Private functions used in the `base' module (specification).
*
- * Copyright (C) 2008-2021 by
+ * Copyright (C) 2008-2020 by
* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftbbox.c b/Build/source/libs/freetype2/freetype-src/src/base/ftbbox.c
index 4db29cbf83c..30a4eba0b3b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftbbox.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftbbox.c
@@ -4,7 +4,7 @@
*
* FreeType bbox computation (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftbdf.c b/Build/source/libs/freetype2/freetype-src/src/base/ftbdf.c
index f93ca8eb755..fc374c66751 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftbdf.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftbdf.c
@@ -4,7 +4,7 @@
*
* FreeType API for accessing BDF-specific strings (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c b/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c
index e504db17210..584213ddcff 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c
@@ -4,7 +4,7 @@
*
* FreeType utility functions for bitmaps (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -907,8 +907,8 @@
final_rows = ( final_ury - final_lly ) >> 6;
#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE5(( "FT_Bitmap_Blend:\n" ));
- FT_TRACE5(( " source bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
+ FT_TRACE5(( "FT_Bitmap_Blend:\n"
+ " source bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
source_llx / 64, source_lly / 64,
source_urx / 64, source_ury / 64,
source_->width, source_->rows ));
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c b/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c
index e60303afc8d..b5258c85a1b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c
@@ -4,7 +4,7 @@
*
* Arithmetic computations (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -109,7 +109,7 @@
#ifndef FT_MSB
- FT_BASE_DEF( FT_Int )
+ FT_BASE_DEF ( FT_Int )
FT_MSB( FT_UInt32 z )
{
FT_Int shift = 0;
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftcid.c b/Build/source/libs/freetype2/freetype-src/src/base/ftcid.c
index 216ee2b3e49..ce8a876adc6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftcid.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftcid.c
@@ -4,7 +4,7 @@
*
* FreeType API for accessing CID font information.
*
- * Copyright (C) 2007-2021 by
+ * Copyright (C) 2007-2020 by
* Derek Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftcolor.c b/Build/source/libs/freetype2/freetype-src/src/base/ftcolor.c
index 3ef3256b202..a50d6800967 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftcolor.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftcolor.c
@@ -4,7 +4,7 @@
*
* FreeType's glyph color management (body).
*
- * Copyright (C) 2018-2021 by
+ * Copyright (C) 2018-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c b/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c
index 8425ca70280..eb0d6516070 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c
@@ -4,7 +4,7 @@
*
* Memory debugger (body).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c b/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c
index bf4018652c8..62cf680b015 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c
@@ -4,7 +4,7 @@
*
* Debugging and logging component (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -42,53 +42,7 @@
#include <freetype/freetype.h>
-#include <freetype/ftlogging.h>
#include <freetype/internal/ftdebug.h>
-#include <freetype/internal/ftobjs.h>
-
-
-#ifdef FT_DEBUG_LOGGING
-
- /**************************************************************************
- *
- * Variables used to control logging.
- *
- * 1. `ft_default_trace_level` stores the value of trace levels, which are
- * provided to FreeType using the `FT2_DEBUG` environment variable.
- *
- * 2. `ft_fileptr` stores the `FILE*` handle.
- *
- * 3. `ft_component` is a string that holds the name of `FT_COMPONENT`.
- *
- * 4. The flag `ft_component_flag` prints the name of `FT_COMPONENT` along
- * with the actual log message if set to true.
- *
- * 5. The flag `ft_timestamp_flag` prints time along with the actual log
- * message if set to ture.
- *
- * 6. `ft_have_newline_char` is used to differentiate between a log
- * message with and without a trailing newline character.
- *
- * 7. `ft_custom_trace_level` stores the custom trace level value, which
- * is provided by the user at run-time.
- *
- * We use `static` to avoid 'unused variable' warnings.
- *
- */
- static const char* ft_default_trace_level = NULL;
- static FILE* ft_fileptr = NULL;
- static const char* ft_component = NULL;
- static FT_Bool ft_component_flag = FALSE;
- static FT_Bool ft_timestamp_flag = FALSE;
- static FT_Bool ft_have_newline_char = TRUE;
- static const char* ft_custom_trace_level = NULL;
-
- /* declared in ftdebug.h */
-
- dlg_handler ft_default_log_handler = NULL;
- FT_Custom_Log_Handler custom_output_handler = NULL;
-
-#endif /* FT_DEBUG_LOGGING*/
#ifdef FT_DEBUG_LEVEL_ERROR
@@ -152,6 +106,7 @@
#endif /* FT_DEBUG_LEVEL_ERROR */
+
#ifdef FT_DEBUG_LEVEL_TRACE
/* array of trace levels, initialized to 0; */
@@ -240,17 +195,8 @@
FT_BASE_DEF( void )
ft_debug_init( void )
{
- const char* ft2_debug = NULL;
-
+ const char* ft2_debug = ft_getenv( "FT2_DEBUG" );
-#ifdef FT_DEBUG_LOGGING
- if ( ft_custom_trace_level != NULL )
- ft2_debug = ft_custom_trace_level;
- else
- ft2_debug = ft_default_trace_level;
-#else
- ft2_debug = ft_getenv( "FT2_DEBUG" );
-#endif
if ( ft2_debug )
{
@@ -264,49 +210,6 @@
if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' )
continue;
-#ifdef FT_DEBUG_LOGGING
-
- /* check extra arguments for logging */
- if ( *p == '-' )
- {
- const char* r = ++p;
-
-
- if ( *r == 'v' )
- {
- const char* s = ++r;
-
-
- ft_component_flag = TRUE;
-
- if ( *s == 't' )
- {
- ft_timestamp_flag = TRUE;
- p++;
- }
-
- p++;
- }
-
- else if ( *r == 't' )
- {
- const char* s = ++r;
-
-
- ft_timestamp_flag = TRUE;
-
- if ( *s == 'v' )
- {
- ft_component_flag = TRUE;
- p++;
- }
-
- p++;
- }
- }
-
-#endif /* FT_DEBUG_LOGGING */
-
/* read toggle name, followed by ':' */
q = p;
while ( *p && *p != ':' )
@@ -408,237 +311,8 @@
/* nothing */
}
-#endif /* !FT_DEBUG_LEVEL_TRACE */
-
-
-#ifdef FT_DEBUG_LOGGING
-
- /**************************************************************************
- *
- * Initialize and de-initialize 'dlg' library.
- *
- */
-
- FT_BASE_DEF( void )
- ft_logging_init( void )
- {
- ft_default_log_handler = ft_log_handler;
- ft_default_trace_level = ft_getenv( "FT2_DEBUG" );
-
- if ( ft_getenv( "FT_LOGGING_FILE" ) )
- ft_fileptr = ft_fopen( ft_getenv( "FT_LOGGING_FILE" ), "w" );
- else
- ft_fileptr = stderr;
-
- ft_debug_init();
-
- /* Set the default output handler for 'dlg'. */
- dlg_set_handler( ft_default_log_handler, NULL );
- }
-
- FT_BASE_DEF( void )
- ft_logging_deinit( void )
- {
- if ( ft_fileptr != stderr )
- ft_fclose( ft_fileptr );
- }
-
-
- /**************************************************************************
- *
- * An output log handler for FreeType.
- *
- */
- FT_BASE_DEF( void )
- ft_log_handler( const struct dlg_origin* origin,
- const char* string,
- void* data )
- {
- char features_buf[128];
- char* bufp = features_buf;
-
- FT_UNUSED( data );
-
-
- if ( ft_have_newline_char )
- {
- const char* features = NULL;
- size_t features_length = 0;
-
-
-#define FEATURES_TIMESTAMP "[%h:%m] "
-#define FEATURES_COMPONENT "[%t] "
-#define FEATURES_TIMESTAMP_COMPONENT "[%h:%m %t] "
-
- if ( ft_timestamp_flag && ft_component_flag )
- {
- features = FEATURES_TIMESTAMP_COMPONENT;
- features_length = sizeof ( FEATURES_TIMESTAMP_COMPONENT );
- }
- else if ( ft_timestamp_flag )
- {
- features = FEATURES_TIMESTAMP;
- features_length = sizeof ( FEATURES_TIMESTAMP );
- }
- else if ( ft_component_flag )
- {
- features = FEATURES_COMPONENT;
- features_length = sizeof ( FEATURES_COMPONENT );
- }
-
- if ( ft_component_flag || ft_timestamp_flag )
- {
- ft_strncpy( features_buf, features, features_length );
- bufp += features_length - 1;
- }
-
- if ( ft_component_flag )
- {
- size_t tag_length = ft_strlen( *origin->tags );
- size_t i;
-
-
- /* To vertically align tracing messages we compensate the */
- /* different FT_COMPONENT string lengths by inserting an */
- /* appropriate amount of space characters. */
- for ( i = 0;
- i < FT_MAX_TRACE_LEVEL_LENGTH - tag_length;
- i++ )
- *bufp++ = ' ';
- }
- }
-
- /* Finally add the format string for the tracing message. */
- *bufp++ = '%';
- *bufp++ = 'c';
- *bufp = '\0';
-
- dlg_generic_outputf_stream( ft_fileptr,
- (const char*)features_buf,
- origin,
- string,
- dlg_default_output_styles,
- true );
-
- if ( ft_strrchr( string, '\n' ) )
- ft_have_newline_char = TRUE;
- else
- ft_have_newline_char = FALSE;
- }
-
-
- /* documentation is in ftdebug.h */
- FT_BASE_DEF( void )
- ft_add_tag( const char* tag )
- {
- ft_component = tag;
-
- dlg_add_tag( tag, NULL );
- }
-
-
- /* documentation is in ftdebug.h */
- FT_BASE_DEF( void )
- ft_remove_tag( const char* tag )
- {
- dlg_remove_tag( tag, NULL );
- }
-
-
- /* documentation is in ftlogging.h */
-
- FT_EXPORT_DEF( void )
- FT_Trace_Set_Level( const char* level )
- {
- ft_component_flag = FALSE;
- ft_timestamp_flag = FALSE;
- ft_custom_trace_level = level;
-
- ft_debug_init();
- }
-
-
- /* documentation is in ftlogging.h */
-
- FT_EXPORT_DEF( void )
- FT_Trace_Set_Default_Level( void )
- {
- ft_component_flag = FALSE;
- ft_timestamp_flag = FALSE;
- ft_custom_trace_level = NULL;
-
- ft_debug_init();
- }
-
-
- /**************************************************************************
- *
- * Functions to handle a custom log handler.
- *
- */
-
- /* documentation is in ftlogging.h */
-
- FT_EXPORT_DEF( void )
- FT_Set_Log_Handler( FT_Custom_Log_Handler handler )
- {
- custom_output_handler = handler;
- }
-
-
- /* documentation is in ftlogging.h */
-
- FT_EXPORT_DEF( void )
- FT_Set_Default_Log_Handler( void )
- {
- custom_output_handler = NULL;
- }
-
-
- /* documentation is in ftdebug.h */
- FT_BASE_DEF( void )
- FT_Logging_Callback( const char* fmt,
- ... )
- {
- va_list ap;
-
-
- va_start( ap, fmt );
- custom_output_handler( ft_component, fmt, ap );
- va_end( ap );
- }
-
-#else /* !FT_DEBUG_LOGGING */
-
- FT_EXPORT_DEF( void )
- FT_Trace_Set_Level( const char* level )
- {
- FT_UNUSED( level );
- }
-
-
- FT_EXPORT_DEF( void )
- FT_Trace_Set_Default_Level( void )
- {
- /* nothing */
- }
-
-
- FT_EXPORT_DEF( void )
- FT_Set_Log_Handler( FT_Custom_Log_Handler handler )
- {
- FT_UNUSED( handler );
- }
-
-
- FT_EXPORT_DEF( void )
- FT_Set_Default_Log_Handler( void )
- {
- /* nothing */
- }
-
-#endif /* !FT_DEBUG_LOGGING */
+#endif /* !FT_DEBUG_LEVEL_TRACE */
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/fterrors.c b/Build/source/libs/freetype2/freetype-src/src/base/fterrors.c
index 14649268f85..eba9e76563f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/fterrors.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/fterrors.c
@@ -4,7 +4,7 @@
*
* FreeType API for error code handling.
*
- * Copyright (C) 2018-2021 by
+ * Copyright (C) 2018-2020 by
* Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftfntfmt.c b/Build/source/libs/freetype2/freetype-src/src/base/ftfntfmt.c
index 4e1b830190d..a45317e7973 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftfntfmt.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftfntfmt.c
@@ -4,7 +4,7 @@
*
* FreeType utility file for font formats (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftfstype.c b/Build/source/libs/freetype2/freetype-src/src/base/ftfstype.c
index 57e904d6f41..bca548fc568 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftfstype.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftfstype.c
@@ -4,7 +4,7 @@
*
* FreeType utility file to access FSType data (body).
*
- * Copyright (C) 2008-2021 by
+ * Copyright (C) 2008-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftgasp.c b/Build/source/libs/freetype2/freetype-src/src/base/ftgasp.c
index b744f0a4652..eed05a3265c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftgasp.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftgasp.c
@@ -4,7 +4,7 @@
*
* Access of TrueType's `gasp' table (body).
*
- * Copyright (C) 2007-2021 by
+ * Copyright (C) 2007-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftgloadr.c b/Build/source/libs/freetype2/freetype-src/src/base/ftgloadr.c
index 83ce0660aeb..05fc7692bb6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftgloadr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftgloadr.c
@@ -4,7 +4,7 @@
*
* The FreeType glyph loader (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c b/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c
index 9e3c3cd35cf..825eba2c4d4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c
@@ -4,7 +4,7 @@
*
* FreeType convenience functions to handle glyphs (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftgxval.c b/Build/source/libs/freetype2/freetype-src/src/base/ftgxval.c
index e9567f77f34..f04df145261 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftgxval.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftgxval.c
@@ -4,7 +4,7 @@
*
* FreeType API for validating TrueTypeGX/AAT tables (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* Masatake YAMATO, Redhat K.K,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftinit.c b/Build/source/libs/freetype2/freetype-src/src/base/ftinit.c
index a2d2b933c09..0acc75e4607 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftinit.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftinit.c
@@ -4,7 +4,7 @@
*
* FreeType initialization layer (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -202,10 +202,6 @@
FT_Memory memory;
-#ifdef FT_DEBUG_LOGGING
- ft_logging_init();
-#endif
-
/* check of `alibrary' delayed to `FT_New_Library' */
/* First of all, allocate a new system object -- this function is part */
@@ -252,10 +248,6 @@
/* discard memory manager */
FT_Done_Memory( memory );
-#ifdef FT_DEBUG_LOGGING
- ft_logging_deinit();
-#endif
-
return FT_Err_Ok;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftlcdfil.c b/Build/source/libs/freetype2/freetype-src/src/base/ftlcdfil.c
index 488b913e636..1e84dbc894a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftlcdfil.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftlcdfil.c
@@ -4,7 +4,7 @@
*
* FreeType API for color filtering of subpixel bitmap glyphs (body).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -32,7 +32,7 @@
/* add padding according to filter weights */
- FT_BASE_DEF( void )
+ FT_BASE_DEF (void)
ft_lcd_padding( FT_BBox* cbox,
FT_GlyphSlot slot,
FT_Render_Mode mode )
@@ -357,7 +357,7 @@
FT_EXPORT_DEF( FT_Error )
FT_Library_SetLcdGeometry( FT_Library library,
- FT_Vector sub[3] )
+ FT_Vector* sub )
{
FT_UNUSED( library );
FT_UNUSED( sub );
@@ -368,7 +368,7 @@
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
/* add padding to accommodate outline shifts */
- FT_BASE_DEF( void )
+ FT_BASE_DEF (void)
ft_lcd_padding( FT_BBox* cbox,
FT_GlyphSlot slot,
FT_Render_Mode mode )
@@ -428,7 +428,7 @@
ft_memcpy( library->lcd_geometry, sub, 3 * sizeof( FT_Vector ) );
- return FT_Err_Ok;
+ return FT_THROW( Unimplemented_Feature );
}
#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c b/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c
index f41c5eeab1c..55a631fd748 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c
+++ b/Build/source/libs/freetype2/freetype-src/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 (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -631,7 +631,7 @@
old_total_size = total_size;
}
- if ( FT_QALLOC( buffer, (FT_Long)total_size ) )
+ if ( FT_ALLOC( buffer, (FT_Long)total_size ) )
goto Error;
/* Second pass: append all POST data to the buffer, add PFB fields. */
@@ -752,7 +752,7 @@
if ( FT_MAC_RFORK_MAX_LEN < sfnt_size )
return FT_THROW( Array_Too_Large );
- if ( FT_QALLOC( sfnt_data, (FT_Long)sfnt_size ) )
+ if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
{
ReleaseResource( sfnt );
return error;
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftmm.c b/Build/source/libs/freetype2/freetype-src/src/base/ftmm.c
index fc5d4ecc8d0..9a702b99335 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftmm.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftmm.c
@@ -4,7 +4,7 @@
*
* Multiple Master font support (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c b/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c
index 0ded2440fca..c060bbbc879 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c
@@ -4,7 +4,7 @@
*
* The FreeType private base classes (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -78,9 +78,6 @@
#pragma warning( pop )
#endif
- /* This array must stay in sync with the @FT_Pixel_Mode enumeration */
- /* (in file `ftimage.h`). */
-
static const char* const pixel_modes[] =
{
"none",
@@ -90,8 +87,7 @@
"gray 4-bit bitmap",
"LCD 8-bit bitmap",
"vertical LCD 8-bit bitmap",
- "BGRA 32-bit color image bitmap",
- "SDF 8-bit bitmap"
+ "BGRA 32-bit color image bitmap"
};
#endif /* FT_DEBUG_LEVEL_TRACE */
@@ -197,7 +193,6 @@
FT_Error error;
FT_Memory memory;
FT_Stream stream = NULL;
- FT_UInt mode;
*astream = NULL;
@@ -209,15 +204,15 @@
return FT_THROW( Invalid_Argument );
memory = library->memory;
- mode = args->flags &
- ( FT_OPEN_MEMORY | FT_OPEN_STREAM | FT_OPEN_PATHNAME );
- if ( mode == FT_OPEN_MEMORY )
+ if ( FT_NEW( stream ) )
+ goto Exit;
+
+ stream->memory = memory;
+
+ if ( args->flags & FT_OPEN_MEMORY )
{
/* create a memory-based stream */
- if ( FT_NEW( stream ) )
- goto Exit;
-
FT_Stream_OpenMemory( stream,
(const FT_Byte*)args->memory_base,
(FT_ULong)args->memory_size );
@@ -225,40 +220,33 @@
#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
- else if ( mode == FT_OPEN_PATHNAME )
+ else if ( args->flags & FT_OPEN_PATHNAME )
{
/* create a normal system stream */
- if ( FT_NEW( stream ) )
- goto Exit;
-
error = FT_Stream_Open( stream, args->pathname );
- if ( error )
- FT_FREE( stream );
+ stream->pathname.pointer = args->pathname;
}
- else if ( ( mode == FT_OPEN_STREAM ) && args->stream )
+ else if ( ( args->flags & FT_OPEN_STREAM ) && args->stream )
{
/* use an existing, user-provided stream */
/* in this case, we do not need to allocate a new stream object */
/* since the caller is responsible for closing it himself */
+ FT_FREE( stream );
stream = args->stream;
- error = FT_Err_Ok;
}
#endif
else
- {
error = FT_THROW( Invalid_Argument );
- if ( ( args->flags & FT_OPEN_STREAM ) && args->stream )
- FT_Stream_Close( args->stream );
- }
- if ( !error )
- {
- stream->memory = memory;
- *astream = stream;
- }
+ if ( error )
+ FT_FREE( stream );
+ else
+ stream->memory = memory; /* just to be certain */
+
+ *astream = stream;
Exit:
return error;
@@ -547,8 +535,6 @@
ft_glyphslot_free_bitmap( slot );
/* clear all public fields in the glyph slot */
- slot->glyph_index = 0;
-
FT_ZERO( &slot->metrics );
FT_ZERO( &slot->outline );
@@ -569,8 +555,6 @@
slot->linearHoriAdvance = 0;
slot->linearVertAdvance = 0;
- slot->advance.x = 0;
- slot->advance.y = 0;
slot->lsb_delta = 0;
slot->rsb_delta = 0;
}
@@ -750,29 +734,6 @@
}
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( void )
- FT_Get_Transform( FT_Face face,
- FT_Matrix* matrix,
- FT_Vector* delta )
- {
- FT_Face_Internal internal;
-
-
- if ( !face )
- return;
-
- internal = face->internal;
-
- if ( matrix )
- *matrix = internal->transform_matrix;
-
- if ( delta )
- *delta = internal->transform_delta;
- }
-
-
static FT_Renderer
ft_lookup_glyph_renderer( FT_GlyphSlot slot );
@@ -1095,24 +1056,19 @@
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( "FT_Load_Glyph: index %d, flags 0x%x\n",
glyph_index, load_flags ));
- FT_TRACE5(( " bitmap %dx%d %s, %s (mode %d)\n",
- slot->bitmap.width,
- slot->bitmap.rows,
- slot->outline.points ?
- slot->bitmap.buffer ? "rendered"
- : "preset"
- :
- slot->internal->flags & FT_GLYPH_OWN_BITMAP ? "owned"
- : "unowned",
- pixel_modes[slot->bitmap.pixel_mode],
- slot->bitmap.pixel_mode ));
- FT_TRACE5(( "\n" ));
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(( "\n" ));
+ FT_TRACE5(( " bitmap %dx%d, %s (mode %d)\n",
+ slot->bitmap.width,
+ slot->bitmap.rows,
+ pixel_modes[slot->bitmap.pixel_mode],
+ slot->bitmap.pixel_mode ));
+ FT_TRACE5(( "\n" ));
{
FT_Glyph_Metrics* metrics = &slot->metrics;
@@ -1826,7 +1782,7 @@
if ( error )
goto Exit;
- if ( FT_QALLOC( sfnt_ps, (FT_Long)length ) )
+ if ( FT_ALLOC( sfnt_ps, (FT_Long)length ) )
goto Exit;
error = FT_Stream_Read( stream, (FT_Byte *)sfnt_ps, length );
@@ -1936,7 +1892,7 @@
goto Exit;
}
- if ( FT_QALLOC( pfb_data, (FT_Long)pfb_len + 2 ) )
+ if ( FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 ) )
goto Exit;
pfb_data[0] = 0x80;
@@ -2000,7 +1956,7 @@
{
FT_TRACE3(( " Write POST fragment #%d header (4-byte) to buffer"
" %p + 0x%08lx\n",
- i, (void*)pfb_data, pfb_lenpos ));
+ i, pfb_data, pfb_lenpos ));
if ( pfb_lenpos + 3 > pfb_len + 2 )
goto Exit2;
@@ -2015,7 +1971,7 @@
FT_TRACE3(( " Write POST fragment #%d header (6-byte) to buffer"
" %p + 0x%08lx\n",
- i, (void*)pfb_data, pfb_pos ));
+ i, pfb_data, pfb_pos ));
if ( pfb_pos + 6 > pfb_len + 2 )
goto Exit2;
@@ -2038,7 +1994,7 @@
FT_TRACE3(( " Load POST fragment #%d (%ld byte) to buffer"
" %p + 0x%08lx\n",
- i, rlen, (void*)pfb_data, pfb_pos ));
+ i, rlen, pfb_data, pfb_pos ));
error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen );
if ( error )
@@ -2136,7 +2092,7 @@
if ( error )
goto Exit;
- if ( FT_QALLOC( sfnt_data, rlen ) )
+ if ( FT_ALLOC( sfnt_data, rlen ) )
return error;
error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, (FT_ULong)rlen );
if ( error ) {
@@ -2725,10 +2681,10 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( !error && face_index < 0 )
{
- FT_TRACE3(( "FT_Open_Face: The font has %ld face%s\n",
+ FT_TRACE3(( "FT_Open_Face: The font has %ld face%s\n"
+ " and %ld named instance%s for face %ld\n",
face->num_faces,
- face->num_faces == 1 ? "" : "s" ));
- FT_TRACE3(( " and %ld named instance%s for face %ld\n",
+ face->num_faces == 1 ? "" : "s",
face->style_flags >> 16,
( face->style_flags >> 16 ) == 1 ? "" : "s",
-face_index - 1 ));
@@ -4456,7 +4412,8 @@
render->glyph_format = clazz->glyph_format;
/* allocate raster object if needed */
- if ( clazz->raster_class->raster_new )
+ if ( clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
+ clazz->raster_class->raster_new )
{
error = clazz->raster_class->raster_new( memory, &render->raster );
if ( error )
@@ -4503,7 +4460,8 @@
/* release raster object, if any */
- if ( render->raster )
+ if ( render->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
+ render->raster )
render->clazz->raster_class->raster_done( render->raster );
/* remove from list */
@@ -4598,6 +4556,9 @@
switch ( slot->format )
{
+ case FT_GLYPH_FORMAT_BITMAP: /* already a bitmap, don't do anything */
+ break;
+
default:
if ( slot->internal->load_flags & FT_LOAD_COLOR )
{
@@ -4773,11 +4734,11 @@
/* we use FT_TRACE7 in this block */
if ( !error &&
- ft_trace_levels[trace_checksum] >= 7 &&
- slot->bitmap.buffer )
+ ft_trace_levels[trace_checksum] >= 7 )
{
if ( slot->bitmap.rows < 128U &&
- slot->bitmap.width < 128U )
+ slot->bitmap.width < 128U &&
+ slot->bitmap.buffer )
{
int rows = (int)slot->bitmap.rows;
int width = (int)slot->bitmap.width;
@@ -5188,16 +5149,16 @@
if ( cur == limit )
{
- FT_TRACE2(( "%s: can't find module `%s'\n",
- func_name, module_name ));
+ FT_ERROR(( "%s: can't find module `%s'\n",
+ func_name, module_name ));
return FT_THROW( Missing_Module );
}
/* check whether we have a service interface */
if ( !cur[0]->clazz->get_interface )
{
- FT_TRACE2(( "%s: module `%s' doesn't support properties\n",
- func_name, module_name ));
+ FT_ERROR(( "%s: module `%s' doesn't support properties\n",
+ func_name, module_name ));
return FT_THROW( Unimplemented_Feature );
}
@@ -5206,8 +5167,8 @@
FT_SERVICE_ID_PROPERTIES );
if ( !interface )
{
- FT_TRACE2(( "%s: module `%s' doesn't support properties\n",
- func_name, module_name ));
+ FT_ERROR(( "%s: module `%s' doesn't support properties\n",
+ func_name, module_name ));
return FT_THROW( Unimplemented_Feature );
}
@@ -5220,8 +5181,8 @@
if ( missing_func )
{
- FT_TRACE2(( "%s: property service of module `%s' is broken\n",
- func_name, module_name ));
+ FT_ERROR(( "%s: property service of module `%s' is broken\n",
+ func_name, module_name ));
return FT_THROW( Unimplemented_Feature );
}
@@ -5331,12 +5292,10 @@
if ( !memory || !alibrary )
return FT_THROW( Invalid_Argument );
-#ifndef FT_DEBUG_LOGGING
#ifdef FT_DEBUG_LEVEL_ERROR
/* init debugging support */
ft_debug_init();
-#endif /* FT_DEBUG_LEVEL_ERROR */
-#endif /* !FT_DEBUG_LOGGING */
+#endif
/* first of all, allocate the library object */
if ( FT_NEW( library ) )
@@ -5608,116 +5567,4 @@
}
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Bool )
- FT_Get_Color_Glyph_Paint( FT_Face face,
- FT_UInt base_glyph,
- FT_Color_Root_Transform root_transform,
- FT_OpaquePaint* paint )
- {
- TT_Face ttface;
- SFNT_Service sfnt;
-
-
- if ( !face || !paint )
- return 0;
-
- if ( !FT_IS_SFNT( face ) )
- return 0;
-
- ttface = (TT_Face)face;
- sfnt = (SFNT_Service)ttface->sfnt;
-
- if ( sfnt->get_colr_layer )
- return sfnt->get_colr_glyph_paint( ttface,
- base_glyph,
- root_transform,
- paint );
- else
- return 0;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Bool )
- FT_Get_Paint_Layers( FT_Face face,
- FT_LayerIterator* layer_iterator,
- FT_OpaquePaint* paint )
- {
- TT_Face ttface;
- SFNT_Service sfnt;
-
-
- if ( !face || !paint || !layer_iterator )
- return 0;
-
- if ( !FT_IS_SFNT( face ) )
- return 0;
-
- ttface = (TT_Face)face;
- sfnt = (SFNT_Service)ttface->sfnt;
-
- if ( sfnt->get_paint_layers )
- return sfnt->get_paint_layers( ttface, layer_iterator, paint );
- else
- return 0;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Bool )
- FT_Get_Paint( FT_Face face,
- FT_OpaquePaint opaque_paint,
- FT_COLR_Paint* paint )
- {
- TT_Face ttface;
- SFNT_Service sfnt;
-
-
- if ( !face || !paint || !paint )
- return 0;
-
- if ( !FT_IS_SFNT( face ) )
- return 0;
-
- ttface = (TT_Face)face;
- sfnt = (SFNT_Service)ttface->sfnt;
-
- if ( sfnt->get_paint )
- return sfnt->get_paint( ttface, opaque_paint, paint );
- else
- return 0;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Bool )
- FT_Get_Colorline_Stops ( FT_Face face,
- FT_ColorStop * color_stop,
- FT_ColorStopIterator *iterator )
- {
- TT_Face ttface;
- SFNT_Service sfnt;
-
-
- if ( !face || !color_stop || !iterator )
- return 0;
-
- if ( !FT_IS_SFNT( face ) )
- return 0;
-
- ttface = (TT_Face)face;
- sfnt = (SFNT_Service)ttface->sfnt;
-
- if ( sfnt->get_colorline_stops )
- return sfnt->get_colorline_stops ( ttface, color_stop, iterator );
- else
- return 0;
- }
-
-
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftotval.c b/Build/source/libs/freetype2/freetype-src/src/base/ftotval.c
index 0f748d006c8..90a5dd617cd 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftotval.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftotval.c
@@ -4,7 +4,7 @@
*
* FreeType API for validating OpenType tables (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftoutln.c b/Build/source/libs/freetype2/freetype-src/src/base/ftoutln.c
index 98c6ca16e65..311f098e3a8 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftoutln.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftoutln.c
@@ -4,7 +4,7 @@
*
* FreeType outline management (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftpatent.c b/Build/source/libs/freetype2/freetype-src/src/base/ftpatent.c
index cd192d33bd4..a02c636a65f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftpatent.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftpatent.c
@@ -5,7 +5,7 @@
* FreeType API for checking patented TrueType bytecode instructions
* (body). Obsolete, retained for backward compatibility.
*
- * Copyright (C) 2007-2021 by
+ * Copyright (C) 2007-2020 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftpfr.c b/Build/source/libs/freetype2/freetype-src/src/base/ftpfr.c
index 5afd5a183f8..c656fcd9b9a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftpfr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftpfr.c
@@ -4,7 +4,7 @@
*
* FreeType API for accessing PFR-specific data (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftpsprop.c b/Build/source/libs/freetype2/freetype-src/src/base/ftpsprop.c
index 3655ae97eca..8c29f50f6b6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftpsprop.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftpsprop.c
@@ -5,7 +5,7 @@
* Get and set properties of PostScript drivers (body).
* See `ftdriver.h' for available properties.
*
- * Copyright (C) 2017-2021 by
+ * Copyright (C) 2017-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -220,7 +220,7 @@
return error;
}
- FT_TRACE2(( "ps_property_set: missing property `%s'\n",
+ FT_TRACE0(( "ps_property_set: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
@@ -275,7 +275,7 @@
return error;
}
- FT_TRACE2(( "ps_property_get: missing property `%s'\n",
+ FT_TRACE0(( "ps_property_get: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftrfork.c b/Build/source/libs/freetype2/freetype-src/src/base/ftrfork.c
index cb7e94ddb08..f989be47f47 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftrfork.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftrfork.c
@@ -4,7 +4,7 @@
*
* Embedded resource forks accessor (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* Masatake YAMATO and Redhat K.K.
*
* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are
@@ -167,11 +167,16 @@
}
- FT_COMPARE_DEF( int )
- ft_raccess_sort_ref_by_id( const void* a,
- const void* b )
+ static int
+ ft_raccess_sort_ref_by_id( FT_RFork_Ref* a,
+ FT_RFork_Ref* b )
{
- return ( (FT_RFork_Ref*)a )->res_id - ( (FT_RFork_Ref*)b )->res_id;
+ if ( a->res_id < b->res_id )
+ return -1;
+ else if ( a->res_id > b->res_id )
+ return 1;
+ else
+ return 0;
}
@@ -251,7 +256,7 @@
if ( error )
return error;
- if ( FT_QNEW_ARRAY( ref, *count ) )
+ if ( FT_NEW_ARRAY( ref, *count ) )
return error;
for ( j = 0; j < *count; j++ )
@@ -289,7 +294,8 @@
ft_qsort( ref,
(size_t)*count,
sizeof ( FT_RFork_Ref ),
- ft_raccess_sort_ref_by_id );
+ ( int(*)(const void*,
+ const void*) )ft_raccess_sort_ref_by_id );
FT_TRACE3(( " -- sort resources by their ids --\n" ));
@@ -299,7 +305,7 @@
j, ref[j].res_id, ref[j].offset ));
}
- if ( FT_QNEW_ARRAY( offsets_internal, *count ) )
+ if ( FT_NEW_ARRAY( offsets_internal, *count ) )
goto Exit;
/* XXX: duplicated reference ID,
@@ -602,7 +608,7 @@
if ( base_file_len + 6 > FT_INT_MAX )
return FT_THROW( Array_Too_Large );
- if ( FT_QALLOC( newpath, base_file_len + 6 ) )
+ if ( FT_ALLOC( newpath, base_file_len + 6 ) )
return error;
FT_MEM_COPY( newpath, base_file_name, base_file_len );
@@ -638,7 +644,7 @@
if ( base_file_len + 18 > FT_INT_MAX )
return FT_THROW( Array_Too_Large );
- if ( FT_QALLOC( newpath, base_file_len + 18 ) )
+ if ( FT_ALLOC( newpath, base_file_len + 18 ) )
return error;
FT_MEM_COPY( newpath, base_file_name, base_file_len );
@@ -874,7 +880,7 @@
new_length = ft_strlen( original_name ) + ft_strlen( insertion );
- if ( FT_QALLOC( new_name, new_length + 1 ) )
+ if ( FT_ALLOC( new_name, new_length + 1 ) )
return NULL;
tmp = ft_strrchr( original_name, '/' );
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftsnames.c b/Build/source/libs/freetype2/freetype-src/src/base/ftsnames.c
index 44dba66638e..8507f28d367 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftsnames.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftsnames.c
@@ -7,7 +7,7 @@
*
* This is _not_ used to retrieve glyph names!
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -65,7 +65,7 @@
FT_Stream stream = face->stream;
- if ( FT_QNEW_ARRAY ( entry->string, entry->stringLength ) ||
+ if ( FT_NEW_ARRAY ( entry->string, entry->stringLength ) ||
FT_STREAM_SEEK( entry->stringOffset ) ||
FT_STREAM_READ( entry->string, entry->stringLength ) )
{
@@ -121,7 +121,7 @@
FT_Stream stream = face->stream;
- if ( FT_QNEW_ARRAY ( entry->string, entry->stringLength ) ||
+ if ( FT_NEW_ARRAY ( entry->string, entry->stringLength ) ||
FT_STREAM_SEEK( entry->stringOffset ) ||
FT_STREAM_READ( entry->string, entry->stringLength ) )
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c b/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c
index f14c7012cf1..d940254d8bb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c
@@ -4,7 +4,7 @@
*
* I/O stream support (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftstroke.c b/Build/source/libs/freetype2/freetype-src/src/base/ftstroke.c
index 37e9649411f..56f98e1d928 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftstroke.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftstroke.c
@@ -4,7 +4,7 @@
*
* FreeType path stroker (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -974,8 +974,7 @@
FT_StrokeBorder border = stroker->borders + side;
FT_Angle phi, theta, rotate;
FT_Fixed length;
- FT_Vector sigma = { 0, 0 };
- FT_Vector delta;
+ FT_Vector sigma, delta;
FT_Error error = FT_Err_Ok;
FT_Bool intersect; /* use intersection of lines? */
@@ -1049,7 +1048,7 @@
{
/* this is a mitered (pointed) or beveled (truncated) corner */
FT_Fixed radius = stroker->radius;
- FT_Vector sigma = { 0, 0 };
+ FT_Vector sigma;
FT_Angle theta = 0, phi = 0;
FT_Bool bevel, fixed_bevel;
@@ -1529,8 +1528,7 @@
stroker->angle_in = angle_out;
}
- stroker->center = *to;
- stroker->line_length = 0;
+ stroker->center = *to;
Exit:
return error;
@@ -1746,8 +1744,7 @@
stroker->angle_in = angle_out;
}
- stroker->center = *to;
- stroker->line_length = 0;
+ stroker->center = *to;
Exit:
return error;
@@ -1900,9 +1897,13 @@
}
else
{
+ FT_Angle turn;
+ FT_Int inside_side;
+
+
/* close the path if needed */
- if ( !FT_IS_SMALL( stroker->center.x - stroker->subpath_start.x ) ||
- !FT_IS_SMALL( stroker->center.y - stroker->subpath_start.y ) )
+ if ( stroker->center.x != stroker->subpath_start.x ||
+ stroker->center.y != stroker->subpath_start.y )
{
error = FT_Stroker_LineTo( stroker, &stroker->subpath_start );
if ( error )
@@ -1911,11 +1912,29 @@
/* process the corner */
stroker->angle_out = stroker->subpath_angle;
+ turn = FT_Angle_Diff( stroker->angle_in,
+ stroker->angle_out );
- error = ft_stroker_process_corner( stroker,
- stroker->subpath_line_length );
- if ( error )
- goto Exit;
+ /* no specific corner processing is required if the turn is 0 */
+ if ( turn != 0 )
+ {
+ /* when we turn to the right, the inside side is 0 */
+ /* otherwise, the inside side is 1 */
+ inside_side = ( turn < 0 );
+
+ error = ft_stroker_inside( stroker,
+ inside_side,
+ stroker->subpath_line_length );
+ if ( error )
+ goto Exit;
+
+ /* process the outside side */
+ error = ft_stroker_outside( stroker,
+ !inside_side,
+ stroker->subpath_line_length );
+ if ( error )
+ goto Exit;
+ }
/* then end our two subpaths */
ft_stroke_border_close( stroker->borders + 0, FALSE );
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftsynth.c b/Build/source/libs/freetype2/freetype-src/src/base/ftsynth.c
index 73565b13077..a9119e2b245 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftsynth.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftsynth.c
@@ -4,7 +4,7 @@
*
* FreeType synthesizing code for emboldening and slanting (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftsystem.c b/Build/source/libs/freetype2/freetype-src/src/base/ftsystem.c
index 9beb7e245d2..3013cbda9d6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftsystem.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftsystem.c
@@ -4,7 +4,7 @@
*
* ANSI-specific FreeType low-level system interface (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -275,7 +275,7 @@
stream->close = ft_ansi_stream_close;
FT_TRACE1(( "FT_Stream_Open:" ));
- FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n",
+ FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
filepathname, stream->size ));
return FT_Err_Ok;
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c b/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c
index 990c46d9939..c6f027cf615 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c
@@ -4,7 +4,7 @@
*
* FreeType trigonometric functions (body).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/fttype1.c b/Build/source/libs/freetype2/freetype-src/src/base/fttype1.c
index 0d0afbcef06..be60ed6ec57 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/fttype1.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/fttype1.c
@@ -4,7 +4,7 @@
*
* FreeType utility file for PS names support (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftutil.c b/Build/source/libs/freetype2/freetype-src/src/base/ftutil.c
index 3142faee987..d90cfbcd263 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftutil.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftutil.c
@@ -4,7 +4,7 @@
*
* FreeType utility file for memory and list management (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc b/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc
index 5fe433cbd7f..0b92e9b8992 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc
@@ -4,7 +4,7 @@
/* */
/* FreeType VERSIONINFO resource for Windows DLLs. */
/* */
-/* Copyright (C) 2018-2021 by */
+/* Copyright (C) 2018-2020 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -18,8 +18,8 @@
#include<windows.h>
-#define FT_VERSION 2,11,0,0
-#define FT_VERSION_STR "2.11.0"
+#define FT_VERSION 2,10,4,0
+#define FT_VERSION_STR "2.10.4"
VS_VERSION_INFO VERSIONINFO
FILEVERSION FT_VERSION
@@ -45,7 +45,7 @@ BEGIN
VALUE "FileVersion", FT_VERSION_STR
VALUE "ProductName", "FreeType"
VALUE "ProductVersion", FT_VERSION_STR
- VALUE "LegalCopyright", "\251 2000-2021 The FreeType Project www.freetype.org. All rights reserved."
+ VALUE "LegalCopyright", "\251 2000-2020 The FreeType Project www.freetype.org. All rights reserved."
VALUE "InternalName", "freetype"
VALUE "OriginalFilename", FT_FILENAME
END
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftwinfnt.c b/Build/source/libs/freetype2/freetype-src/src/base/ftwinfnt.c
index 98f197afdc4..699dc3d700c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftwinfnt.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftwinfnt.c
@@ -4,7 +4,7 @@
*
* FreeType API for accessing Windows FNT specific info (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/rules.mk b/Build/source/libs/freetype2/freetype-src/src/base/rules.mk
index 53289aee6d4..411c4c821fe 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/base/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c b/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c
index e3c12032b97..d29188b97ba 100644
--- a/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c
@@ -276,7 +276,7 @@ THE SOFTWARE.
char* s;
- if ( FT_QALLOC( face->style_name, len ) )
+ if ( FT_ALLOC( face->style_name, len ) )
return error;
s = face->style_name;
@@ -442,7 +442,7 @@ THE SOFTWARE.
bdfface->num_glyphs = (FT_Long)( font->glyphs_size + 1 );
bdfface->num_fixed_sizes = 1;
- if ( FT_NEW( bdfface->available_sizes ) )
+ if ( FT_NEW_ARRAY( bdfface->available_sizes, 1 ) )
goto Exit;
{
@@ -451,6 +451,8 @@ THE SOFTWARE.
long value;
+ FT_ZERO( bsize );
+
/* sanity checks */
if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c b/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
index 8db9940f12a..a4ddb9a1d9f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
+++ b/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
@@ -185,12 +185,12 @@
"Added `FONT_ASCENT %hd'.\n"
#define ACMSG2 "FONT_DESCENT property missing. " \
"Added `FONT_DESCENT %hd'.\n"
-#define ACMSG3 "Font width != actual width. Old: %d New: %d.\n"
+#define ACMSG3 "Font width != actual width. Old: %hd New: %hd.\n"
#define ACMSG4 "Font left bearing != actual left bearing. " \
"Old: %hd New: %hd.\n"
#define ACMSG5 "Font ascent != actual ascent. Old: %hd New: %hd.\n"
-#define ACMSG6 "Font descent != actual descent. Old: %d New: %d.\n"
-#define ACMSG7 "Font height != actual height. Old: %d New: %d.\n"
+#define ACMSG6 "Font descent != actual descent. Old: %hd New: %hd.\n"
+#define ACMSG7 "Font height != actual height. Old: %hd New: %hd.\n"
#define ACMSG8 "Glyph scalable width (SWIDTH) adjustments made.\n"
#define ACMSG9 "SWIDTH field missing at line %ld. Set automatically.\n"
#define ACMSG10 "DWIDTH field missing at line %ld. Set to glyph width.\n"
@@ -328,7 +328,7 @@
else if ( newsize < oldsize || newsize > bigsize )
newsize = bigsize;
- if ( FT_QRENEW_ARRAY( list->field, oldsize, newsize ) )
+ if ( FT_RENEW_ARRAY( list->field, oldsize, newsize ) )
goto Exit;
list->size = newsize;
@@ -538,7 +538,7 @@
/* initial size and allocation of the input buffer */
buf_size = 1024;
- if ( FT_QALLOC( buf, buf_size ) )
+ if ( FT_NEW_ARRAY( buf, buf_size ) )
goto Exit;
cb = callback;
@@ -599,7 +599,7 @@
}
new_size = buf_size * 2;
- if ( FT_QREALLOC( buf, buf_size, new_size ) )
+ if ( FT_RENEW_ARRAY( buf, buf_size, new_size ) )
goto Exit;
cursor = (ptrdiff_t)buf_size;
@@ -807,7 +807,7 @@
/* Routine to compare two glyphs by encoding so they can be sorted. */
- FT_COMPARE_DEF( int )
+ static int
by_encoding( const void* a,
const void* b )
{
@@ -844,18 +844,19 @@
if ( ft_hash_str_lookup( name, &(font->proptbl) ) )
goto Exit;
- if ( FT_QRENEW_ARRAY( font->user_props,
- font->nuser_props,
- font->nuser_props + 1 ) )
+ if ( FT_RENEW_ARRAY( font->user_props,
+ font->nuser_props,
+ font->nuser_props + 1 ) )
goto Exit;
p = font->user_props + font->nuser_props;
+ FT_ZERO( p );
n = ft_strlen( name ) + 1;
if ( n > FT_ULONG_MAX )
return FT_THROW( Invalid_Argument );
- if ( FT_QALLOC( p->name, n ) )
+ if ( FT_NEW_ARRAY( p->name, n ) )
goto Exit;
FT_MEM_COPY( (char *)p->name, name, n );
@@ -941,9 +942,9 @@
FT_Error error = FT_Err_Ok;
- if ( FT_QRENEW_ARRAY( font->comments,
- font->comments_len,
- font->comments_len + len + 1 ) )
+ if ( FT_RENEW_ARRAY( font->comments,
+ font->comments_len,
+ font->comments_len + len + 1 ) )
goto Exit;
cp = font->comments + font->comments_len;
@@ -1158,12 +1159,21 @@
/* Allocate another property if this is overflowing. */
if ( font->props_used == font->props_size )
{
- if ( FT_QRENEW_ARRAY( font->props,
- font->props_size,
- font->props_size + 1 ) )
- goto Exit;
+ if ( font->props_size == 0 )
+ {
+ if ( FT_NEW_ARRAY( font->props, 1 ) )
+ goto Exit;
+ }
+ else
+ {
+ if ( FT_RENEW_ARRAY( font->props,
+ font->props_size,
+ font->props_size + 1 ) )
+ goto Exit;
+ }
fp = font->props + font->props_size;
+ FT_ZERO( fp );
font->props_size++;
}
@@ -1428,7 +1438,7 @@
goto Exit;
}
- if ( FT_QALLOC( p->glyph_name, slen + 1 ) )
+ if ( FT_NEW_ARRAY( p->glyph_name, slen + 1 ) )
goto Exit;
FT_MEM_COPY( p->glyph_name, s, slen + 1 );
@@ -1725,7 +1735,7 @@
else
glyph->bytes = (unsigned short)bitmap_size;
- if ( FT_ALLOC( glyph->bitmap, glyph->bytes ) )
+ if ( FT_NEW_ARRAY( glyph->bitmap, glyph->bytes ) )
goto Exit;
p->row = 0;
@@ -2045,7 +2055,7 @@
/* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */
FT_FREE( p->font->name );
- if ( FT_QALLOC( p->font->name, slen + 1 ) )
+ if ( FT_NEW_ARRAY( p->font->name, slen + 1 ) )
goto Exit;
FT_MEM_COPY( p->font->name, s, slen + 1 );
@@ -2279,9 +2289,9 @@
if ( p->font->comments_len > 0 )
{
- if ( FT_QRENEW_ARRAY( p->font->comments,
- p->font->comments_len,
- p->font->comments_len + 1 ) )
+ if ( FT_RENEW_ARRAY( p->font->comments,
+ p->font->comments_len,
+ p->font->comments_len + 1 ) )
goto Fail;
p->font->comments[p->font->comments_len] = 0;
diff --git a/Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c b/Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c
index 3df7496a6ef..411c5d263b8 100644
--- a/Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c
+++ b/Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c
@@ -8,7 +8,7 @@
* parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2010-2021 by
+ * Copyright (C) 2010-2020 by
* Joel Klinghed.
*
* based on `src/gzip/ftgzip.c'
@@ -70,7 +70,7 @@
FT_Pointer p = NULL;
- (void)FT_QALLOC( p, sz );
+ (void)FT_ALLOC( p, sz );
return p;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/bzip2/rules.mk b/Build/source/libs/freetype2/freetype-src/src/bzip2/rules.mk
index e584277b06a..eed0f4baa4b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/bzip2/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/bzip2/rules.mk
@@ -2,7 +2,7 @@
# FreeType 2 BZIP2 support configuration rules
#
-# Copyright (C) 2010-2021 by
+# Copyright (C) 2010-2020 by
# Joel Klinghed.
#
# based on `src/lzw/rules.mk'
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcache.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcache.c
index ddd3e43c028..e90f4639cb1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcache.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcache.c
@@ -4,7 +4,7 @@
*
* The FreeType Caching sub-system (body only).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcbasic.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcbasic.c
index 1760c5fbd4c..43ea314d4a2 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcbasic.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcbasic.c
@@ -4,7 +4,7 @@
*
* The FreeType basic cache interface (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -108,16 +108,12 @@
if ( error || !face )
return result;
-#ifdef FT_DEBUG_LEVEL_TRACE
if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
- {
FT_TRACE1(( "ftc_basic_family_get_count:"
- " the number of glyphs in this face is %ld,\n",
+ " the number of glyphs in this face is %ld,\n"
+ " "
+ " which is too much and thus truncated\n",
face->num_glyphs ));
- FT_TRACE1(( " "
- " which is too much and thus truncated\n" ));
- }
-#endif
if ( !error )
result = (FT_UInt)face->num_glyphs;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c
index 4c0324278f5..1c8e0f32211 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c
@@ -4,7 +4,7 @@
*
* The FreeType internal cache interface (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -459,7 +459,7 @@
{
error = cache->clazz.node_new( &node, query, cache );
}
- FTC_CACHE_TRYLOOP_END( NULL )
+ FTC_CACHE_TRYLOOP_END( NULL );
if ( error )
node = NULL;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h
index 73410933ef3..11698bb0e90 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h
@@ -4,7 +4,7 @@
*
* FreeType internal cache interface (specification).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftccback.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftccback.h
index 8185fe37381..542acb1565a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftccback.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftccback.h
@@ -4,7 +4,7 @@
*
* Callback functions of the caching sub-system (specification only).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c
index cfce0a6d32a..468c008cf60 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
*
* FreeType CharMap cache (body)
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcerror.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftcerror.h
index 2c6faf65e23..bedfd28371c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcerror.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcerror.h
@@ -4,7 +4,7 @@
*
* Caching sub-system error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.c
index 52771c7a8a3..7f5438aad58 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.c
@@ -4,7 +4,7 @@
*
* FreeType Glyph Image (FT_Glyph) cache (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.h
index cf00cdc7b85..5629545f3c5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcglyph.h
@@ -4,7 +4,7 @@
*
* FreeType abstract glyph cache (specification).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.c
index 3f12a654b2b..58ebad8c932 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.c
@@ -4,7 +4,7 @@
*
* FreeType Image cache (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.h
index 8b28d6f00b7..a400788b3cb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcimage.h
@@ -4,7 +4,7 @@
*
* FreeType Generic Image cache (specification)
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c
index 312a83cfb67..436d41f3745 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c
@@ -4,7 +4,7 @@
*
* FreeType Cache Manager (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.h
index 99aa9263694..6c6ec685450 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.h
@@ -4,7 +4,7 @@
*
* FreeType Cache Manager (specification).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c
index 1a9d8281d15..8feed45f6b5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c
@@ -4,7 +4,7 @@
*
* FreeType MRU support (body).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.h
index 6befde307f6..ac4f9b126d2 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.h
@@ -4,7 +4,7 @@
*
* Simple MRU list-cache (specification).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c
index 7e24d81d93d..e0db930af8e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c
@@ -4,7 +4,7 @@
*
* FreeType sbits manager (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -52,8 +52,10 @@
pitch = -pitch;
size = (FT_ULong)pitch * bitmap->rows;
+ if ( !size )
+ return FT_Err_Ok;
- if ( !FT_QALLOC( sbit->buffer, size ) )
+ if ( !FT_ALLOC( sbit->buffer, size ) )
FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );
return error;
@@ -106,6 +108,7 @@
FT_Error error;
FTC_GNode gnode = FTC_GNODE( snode );
FTC_Family family = gnode->family;
+ FT_Memory memory = manager->memory;
FT_Face face;
FTC_SBit sbit;
FTC_SFamilyClass clazz;
@@ -120,6 +123,8 @@
sbit = snode->sbits + ( gindex - gnode->gindex );
clazz = (FTC_SFamilyClass)family->clazz;
+ sbit->buffer = 0;
+
error = clazz->family_load_glyph( family, gindex, manager, &face );
if ( error )
goto BadGlyph;
@@ -138,13 +143,12 @@
goto BadGlyph;
}
- /* Check whether our values fit into 8/16-bit containers! */
+ /* Check whether our values fit into 8-bit containers! */
/* If this is not the case, our bitmap is too large */
/* and we will leave it as `missing' with sbit.buffer = 0 */
#define CHECK_CHAR( d ) ( temp = (FT_Char)d, (FT_Int) temp == (FT_Int) d )
#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, (FT_UInt)temp == (FT_UInt)d )
-#define CHECK_SHRT( d ) ( temp = (FT_Short)d, (FT_Int)temp == (FT_Int) d )
/* horizontal advance in pixels */
xadvance = ( slot->advance.x + 32 ) >> 6;
@@ -152,7 +156,7 @@
if ( !CHECK_BYTE( bitmap->rows ) ||
!CHECK_BYTE( bitmap->width ) ||
- !CHECK_SHRT( bitmap->pitch ) ||
+ !CHECK_CHAR( bitmap->pitch ) ||
!CHECK_CHAR( slot->bitmap_left ) ||
!CHECK_CHAR( slot->bitmap_top ) ||
!CHECK_CHAR( xadvance ) ||
@@ -165,7 +169,7 @@
sbit->width = (FT_Byte)bitmap->width;
sbit->height = (FT_Byte)bitmap->rows;
- sbit->pitch = (FT_Short)bitmap->pitch;
+ sbit->pitch = (FT_Char)bitmap->pitch;
sbit->left = (FT_Char)slot->bitmap_left;
sbit->top = (FT_Char)slot->bitmap_top;
sbit->xadvance = (FT_Char)xadvance;
@@ -173,17 +177,8 @@
sbit->format = (FT_Byte)bitmap->pixel_mode;
sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
- {
- /* take the bitmap ownership */
- sbit->buffer = bitmap->buffer;
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
- else
- {
- /* copy the bitmap into a new buffer -- ignore error */
- error = ftc_sbit_copy_bitmap( sbit, bitmap, manager->memory );
- }
+ /* copy the bitmap into a new buffer -- ignore error */
+ error = ftc_sbit_copy_bitmap( sbit, bitmap, memory );
/* now, compute size */
if ( asize )
@@ -395,7 +390,7 @@
{
error = ftc_snode_load( snode, cache->manager, gindex, &size );
}
- FTC_CACHE_TRYLOOP_END( list_changed )
+ FTC_CACHE_TRYLOOP_END( list_changed );
ftcsnode->ref_count--; /* unlock the node */
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.h
index 9f2d5fb33ca..46f797e724d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.h
@@ -4,7 +4,7 @@
*
* A small-bitmap cache (specification).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/rules.mk b/Build/source/libs/freetype2/freetype-src/src/cache/rules.mk
index 0abd216a840..4738b5153a1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2000-2021 by
+# Copyright (C) 2000-2020 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/Build/source/libs/freetype2/freetype-src/src/cff/cff.c b/Build/source/libs/freetype2/freetype-src/src/cff/cff.c
index c2ffea3d0d5..0fa6c87870b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cff.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cff.c
@@ -4,7 +4,7 @@
*
* FreeType OpenType driver component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.c
index ff1aae69efa..6d16ed42264 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.c
@@ -4,7 +4,7 @@
*
* CFF character mapping table (cmap) support (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.h b/Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.h
index 221e255afb5..69fab8dc6c0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffcmap.h
@@ -4,7 +4,7 @@
*
* CFF character mapping table (cmap) support (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c
index 9bde3c7b7f9..486ab242353 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c
@@ -4,7 +4,7 @@
*
* OpenType font driver implementation (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -345,8 +345,8 @@
else
{
FT_ERROR(( "cff_get_glyph_name:"
- " cannot get glyph name from a CFF2 font\n" ));
- FT_ERROR(( " "
+ " cannot get glyph name from a CFF2 font\n"
+ " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;
@@ -356,8 +356,8 @@
if ( !font->psnames )
{
FT_ERROR(( "cff_get_glyph_name:"
- " cannot get glyph name from CFF & CEF fonts\n" ));
- FT_ERROR(( " "
+ " cannot get glyph name from CFF & CEF fonts\n"
+ " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;
@@ -412,8 +412,8 @@
else
{
FT_ERROR(( "cff_get_name_index:"
- " cannot get glyph index from a CFF2 font\n" ));
- FT_ERROR(( " "
+ " cannot get glyph index from a CFF2 font\n"
+ " "
" without the `psnames' module\n" ));
return 0;
}
@@ -478,7 +478,7 @@
FT_Memory memory = face->root.memory;
- if ( FT_QALLOC( font_info, sizeof ( *font_info ) ) )
+ if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
goto Fail;
font_info->version = cff_index_get_sid_string( cff,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.h b/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.h
index fce92bbb006..d198dd35cb4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.h
@@ -4,7 +4,7 @@
*
* High-level OpenType driver interface (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cfferrs.h b/Build/source/libs/freetype2/freetype-src/src/cff/cfferrs.h
index b507ec8bb77..5b00a3f0a2e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cfferrs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cfferrs.h
@@ -4,7 +4,7 @@
*
* CFF error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c
index 831b3ae1df2..feee38a4131 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c
@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.h b/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.h
index d0d6a6fa080..3b312f452e1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.h
@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffload.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffload.c
index 4a4010d6147..73d3eecd313 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffload.c
@@ -4,7 +4,7 @@
*
* OpenType and CFF data/program tables loader (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -356,9 +356,9 @@
data_size = (FT_ULong)( idx->count + 1 ) * offsize;
- if ( FT_QNEW_ARRAY( idx->offsets, idx->count + 1 ) ||
- FT_STREAM_SEEK( idx->start + idx->hdr_size ) ||
- FT_FRAME_ENTER( data_size ) )
+ if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) ||
+ FT_STREAM_SEEK( idx->start + idx->hdr_size ) ||
+ FT_FRAME_ENTER( data_size ) )
goto Exit;
poff = idx->offsets;
@@ -427,7 +427,7 @@
new_size = idx->data_size + idx->count;
if ( idx->count > 0 &&
- !FT_QNEW_ARRAY( tbl, idx->count + 1 ) &&
+ !FT_NEW_ARRAY( tbl, idx->count + 1 ) &&
( !pool || !FT_ALLOC( new_bytes, new_size ) ) )
{
FT_ULong n, cur_offset;
@@ -634,9 +634,10 @@
if ( error )
goto Exit;
- if ( !FT_QALLOC( name, byte_len + 1 ) )
+ if ( !FT_ALLOC( name, byte_len + 1 ) )
{
- FT_MEM_COPY( name, bytes, byte_len );
+ if ( byte_len )
+ FT_MEM_COPY( name, bytes, byte_len );
name[byte_len] = 0;
}
cff_index_forget_element( idx, &bytes );
@@ -931,7 +932,7 @@
goto Exit;
/* Allocate memory for sids. */
- if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
+ if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit;
/* assign the .notdef glyph */
@@ -1017,14 +1018,14 @@
case 0:
if ( num_glyphs > 229 )
{
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n" ));
- FT_ERROR(( "predefined charset (Adobe ISO-Latin)\n" ));
+ FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
+ "predefined charset (Adobe ISO-Latin)\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
/* Allocate memory for sids. */
- if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
+ if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit;
/* Copy the predefined charset into the allocated memory. */
@@ -1035,14 +1036,14 @@
case 1:
if ( num_glyphs > 166 )
{
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n" ));
- FT_ERROR(( "predefined charset (Adobe Expert)\n" ));
+ FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
+ "predefined charset (Adobe Expert)\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
/* Allocate memory for sids. */
- if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
+ if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit;
/* Copy the predefined charset into the allocated memory. */
@@ -1053,14 +1054,14 @@
case 2:
if ( num_glyphs > 87 )
{
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n" ));
- FT_ERROR(( "predefined charset (Adobe Expert Subset)\n" ));
+ FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
+ "predefined charset (Adobe Expert Subset)\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
/* Allocate memory for sids. */
- if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
+ if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit;
/* Copy the predefined charset into the allocated memory. */
@@ -1086,6 +1087,7 @@
FT_FREE( charset->cids );
charset->format = 0;
charset->offset = 0;
+ charset->sids = 0;
}
return error;
@@ -1167,7 +1169,7 @@
/* make temporary copy of item variation data offsets; */
/* we'll parse region list first, then come back */
- if ( FT_QNEW_ARRAY( dataOffsetArray, vstore->dataCount ) )
+ if ( FT_NEW_ARRAY( dataOffsetArray, vstore->dataCount ) )
goto Exit;
for ( i = 0; i < vstore->dataCount; i++ )
@@ -1182,7 +1184,7 @@
FT_READ_USHORT( vstore->regionCount ) )
goto Exit;
- if ( FT_QNEW_ARRAY( vstore->varRegionList, vstore->regionCount ) )
+ if ( FT_NEW_ARRAY( vstore->varRegionList, vstore->regionCount ) )
goto Exit;
for ( i = 0; i < vstore->regionCount; i++ )
@@ -1190,7 +1192,7 @@
CFF_VarRegion* region = &vstore->varRegionList[i];
- if ( FT_QNEW_ARRAY( region->axisList, vstore->axisCount ) )
+ if ( FT_NEW_ARRAY( region->axisList, vstore->axisCount ) )
goto Exit;
for ( j = 0; j < vstore->axisCount; j++ )
@@ -1212,7 +1214,7 @@
}
/* use dataOffsetArray now to parse varData items */
- if ( FT_QNEW_ARRAY( vstore->varData, vstore->dataCount ) )
+ if ( FT_NEW_ARRAY( vstore->varData, vstore->dataCount ) )
goto Exit;
for ( i = 0; i < vstore->dataCount; i++ )
@@ -1234,7 +1236,7 @@
if ( FT_READ_USHORT( data->regionIdxCount ) )
goto Exit;
- if ( FT_QNEW_ARRAY( data->regionIndices, data->regionIdxCount ) )
+ if ( FT_NEW_ARRAY( data->regionIndices, data->regionIdxCount ) )
goto Exit;
for ( j = 0; j < data->regionIdxCount; j++ )
@@ -1320,9 +1322,9 @@
/* increase or allocate `blend_stack' and reset `blend_top'; */
/* prepare to append `numBlends' values to the buffer */
- if ( FT_QREALLOC( subFont->blend_stack,
- subFont->blend_alloc,
- subFont->blend_alloc + size ) )
+ if ( FT_REALLOC( subFont->blend_stack,
+ subFont->blend_alloc,
+ subFont->blend_alloc + size ) )
goto Exit;
subFont->blend_top = subFont->blend_stack + subFont->blend_used;
@@ -1435,7 +1437,9 @@
/* prepare buffer for the blend vector */
len = varData->regionIdxCount + 1; /* add 1 for default component */
- if ( FT_QRENEW_ARRAY( blend->BV, blend->lenBV, len ) )
+ if ( FT_REALLOC( blend->BV,
+ blend->lenBV * sizeof( *blend->BV ),
+ len * sizeof( *blend->BV ) ) )
goto Exit;
blend->lenBV = len;
@@ -1452,8 +1456,10 @@
if ( master == 0 )
{
blend->BV[master] = FT_FIXED_ONE;
- FT_TRACE4(( " build blend vector len %d\n", len ));
- FT_TRACE4(( " [ %f ", blend->BV[master] / 65536.0 ));
+ FT_TRACE4(( " build blend vector len %d\n"
+ " [ %f ",
+ len,
+ blend->BV[master] / 65536.0 ));
continue;
}
@@ -1537,7 +1543,9 @@
if ( lenNDV != 0 )
{
/* user has set a normalized vector */
- if ( FT_QRENEW_ARRAY( blend->lastNDV, blend->lenNDV, lenNDV ) )
+ if ( FT_REALLOC( blend->lastNDV,
+ blend->lenNDV * sizeof ( *NDV ),
+ lenNDV * sizeof ( *NDV ) ) )
goto Exit;
FT_MEM_COPY( blend->lastNDV,
@@ -2355,8 +2363,8 @@
if ( font->name_index.count > 1 )
{
FT_ERROR(( "cff_font_load:"
- " invalid CFF font with multiple subfonts\n" ));
- FT_ERROR(( " "
+ " invalid CFF font with multiple subfonts\n"
+ " "
" in SFNT wrapper\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffload.h b/Build/source/libs/freetype2/freetype-src/src/cff/cffload.h
index 20f9296c4fb..fc998db2db9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffload.h
@@ -4,7 +4,7 @@
*
* OpenType & CFF data/program tables loader (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c
index c50281342de..d555d523580 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c
@@ -4,7 +4,7 @@
*
* OpenType objects manager (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -659,8 +659,8 @@
if ( dict->cid_registry == 0xFFFFU && !psnames )
{
FT_ERROR(( "cff_face_init:"
- " cannot open CFF & CEF fonts\n" ));
- FT_ERROR(( " "
+ " cannot open CFF & CEF fonts\n"
+ " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;
@@ -1174,7 +1174,11 @@
/* set default property values, cf. `ftcffdrv.h' */
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ driver->hinting_engine = FT_HINTING_FREETYPE;
+#else
driver->hinting_engine = FT_HINTING_ADOBE;
+#endif
driver->no_stem_darkening = TRUE;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.h b/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.h
index 149a8a2f0a7..845bd909413 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.h
@@ -4,7 +4,7 @@
*
* OpenType objects manager (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffparse.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffparse.c
index dde55e95c24..69bcd5d957c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffparse.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffparse.c
@@ -4,7 +4,7 @@
*
* CFF token stream parser (body)
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 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 @@
parser->num_axes = num_axes;
/* allocate the stack buffer */
- if ( FT_QNEW_ARRAY( parser->stack, stackSize ) )
+ if ( FT_NEW_ARRAY( parser->stack, stackSize ) )
{
FT_FREE( parser->stack );
goto Exit;
@@ -713,10 +713,9 @@
( max_scaling - min_scaling ) > 9 )
{
FT_TRACE1(( "cff_parse_font_matrix:"
- " strange scaling values (minimum %ld, maximum %ld),\n",
- min_scaling, max_scaling ));
- FT_TRACE1(( " "
- " using default matrix\n" ));
+ " strange scaling values (minimum %ld, maximum %ld),\n"
+ " "
+ " using default matrix\n", min_scaling, max_scaling ));
goto Unlikely;
}
@@ -1516,7 +1515,6 @@
case cff_kind_fixed_thousand:
FT_TRACE4(( " %f\n", (double)val / 65536 / 1000 ));
- break;
default:
; /* never reached */
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffparse.h b/Build/source/libs/freetype2/freetype-src/src/cff/cffparse.h
index a28ab52200a..6f3fbb37d63 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffparse.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffparse.h
@@ -4,7 +4,7 @@
*
* CFF token stream parser (specification)
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cfftoken.h b/Build/source/libs/freetype2/freetype-src/src/cff/cfftoken.h
index eef30690c43..4c6a53eec13 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cfftoken.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cfftoken.h
@@ -4,7 +4,7 @@
*
* CFF token definitions (specification only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/module.mk b/Build/source/libs/freetype2/freetype-src/src/cff/module.mk
index cfa444d8f3a..bd728c6a348 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/cff/rules.mk b/Build/source/libs/freetype2/freetype-src/src/cff/rules.mk
index e54614ffe56..70bb92d5063 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/cid/ciderrs.h b/Build/source/libs/freetype2/freetype-src/src/cid/ciderrs.h
index 2d762d9e1d1..f698bb22936 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/ciderrs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/ciderrs.h
@@ -4,7 +4,7 @@
*
* CID error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c
index bd0a7e7fb10..54aa62f8104 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 Glyph Loader (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -85,10 +85,10 @@
if ( glyph_data.length != 0 )
{
glyph_length = (FT_ULong)( glyph_data.length - cid->fd_bytes );
-
- if ( !FT_QALLOC( charstring, glyph_length ) )
- FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes,
- glyph_length );
+ (void)FT_ALLOC( charstring, glyph_length );
+ if ( !error )
+ ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
+ glyph_length );
}
inc->funcs->free_glyph_data( inc->object, &glyph_data );
@@ -130,10 +130,11 @@
}
glyph_length = off2 - off1;
-
- if ( glyph_length == 0 ||
- FT_QALLOC( charstring, glyph_length ) ||
- FT_STREAM_READ_AT( cid->data_offset + off1,
+ if ( glyph_length == 0 )
+ goto Exit;
+ if ( FT_ALLOC( charstring, glyph_length ) )
+ goto Exit;
+ if ( FT_STREAM_READ_AT( cid->data_offset + off1,
charstring, glyph_length ) )
goto Exit;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.h b/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.h
index 8b515efa01c..da36e37e069 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.h
@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidload.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidload.c
index 7fd0d7c78c2..bb9136a3df8 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidload.c
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 font loader (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -552,7 +552,7 @@
goto Fail;
}
- if ( FT_QRENEW_ARRAY( offsets, max_offsets, new_max ) )
+ if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )
goto Fail;
max_offsets = new_max;
@@ -589,8 +589,8 @@
/* allocate, and read them */
data_len = offsets[num_subrs] - offsets[0];
- if ( FT_QNEW_ARRAY( subr->code, num_subrs + 1 ) ||
- FT_QALLOC( subr->code[0], data_len ) )
+ if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||
+ FT_ALLOC( subr->code[0], data_len ) )
goto Fail;
if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
@@ -665,18 +665,17 @@
static FT_Error
- cid_hex_to_binary( FT_Byte* data,
- FT_ULong data_len,
- FT_ULong offset,
- CID_Face face,
- FT_ULong* data_written )
+ cid_hex_to_binary( FT_Byte* data,
+ FT_ULong data_len,
+ FT_ULong offset,
+ CID_Face face )
{
FT_Stream stream = face->root.stream;
FT_Error error;
FT_Byte buffer[256];
FT_Byte *p, *plimit;
- FT_Byte *d = data, *dlimit;
+ FT_Byte *d, *dlimit;
FT_Byte val;
FT_Bool upper_nibble, done;
@@ -685,6 +684,7 @@
if ( FT_STREAM_SEEK( offset ) )
goto Exit;
+ d = data;
dlimit = d + data_len;
p = buffer;
plimit = p;
@@ -758,7 +758,6 @@
error = FT_Err_Ok;
Exit:
- *data_written = (FT_ULong)( d - data );
return error;
}
@@ -804,8 +803,8 @@
if ( parser->binary_length >
face->root.stream->size - parser->data_offset )
{
- FT_TRACE0(( "cid_face_open: adjusting length of binary data\n" ));
- FT_TRACE0(( " (from %ld to %ld bytes)\n",
+ FT_TRACE0(( "cid_face_open: adjusting length of binary data\n"
+ " (from %ld to %ld bytes)\n",
parser->binary_length,
face->root.stream->size - parser->data_offset ));
parser->binary_length = face->root.stream->size -
@@ -813,16 +812,15 @@
}
/* we must convert the data section from hexadecimal to binary */
- if ( FT_QALLOC( face->binary_data, parser->binary_length ) ||
+ if ( FT_ALLOC( face->binary_data, parser->binary_length ) ||
FT_SET_ERROR( cid_hex_to_binary( face->binary_data,
parser->binary_length,
parser->data_offset,
- face,
- &binary_length ) ) )
+ face ) ) )
goto Exit;
FT_Stream_OpenMemory( face->cid_stream,
- face->binary_data, binary_length );
+ face->binary_data, parser->binary_length );
cid->data_offset = 0;
}
else
@@ -845,8 +843,8 @@
if ( cid->fd_bytes > 4 || cid->gd_bytes > 4 )
{
FT_ERROR(( "cid_face_open:"
- " Values of `FDBytes' or `GDBytes' larger than 4\n" ));
- FT_ERROR(( " "
+ " Values of `FDBytes' or `GDBytes' larger than 4\n"
+ " "
" are not supported\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidload.h b/Build/source/libs/freetype2/freetype-src/src/cid/cidload.h
index 456685c2af1..06fb9ef4767 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidload.h
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 font loader (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c
index c7568118547..04b295eb8f3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c
@@ -4,7 +4,7 @@
*
* CID objects manager (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -479,7 +479,11 @@
/* 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;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.h b/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.h
index 32f59cbcceb..6ae3061379c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.h
@@ -4,7 +4,7 @@
*
* CID objects manager (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c
index a28f8ee5590..1fc098b448e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 parser (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h b/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h
index 6a00c6cee12..0b49bebf488 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 parser (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidriver.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidriver.c
index a0898dfa2fd..d08cea1d7e8 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidriver.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidriver.c
@@ -4,7 +4,7 @@
*
* CID driver interface (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidriver.h b/Build/source/libs/freetype2/freetype-src/src/cid/cidriver.h
index 3ff5f78e11a..0fc8ed37bf2 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidriver.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidriver.h
@@ -4,7 +4,7 @@
*
* High-level CID driver interface (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidtoken.h b/Build/source/libs/freetype2/freetype-src/src/cid/cidtoken.h
index 84c8258014d..e9f068bb501 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidtoken.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidtoken.h
@@ -4,7 +4,7 @@
*
* CID token definitions (specification only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/module.mk b/Build/source/libs/freetype2/freetype-src/src/cid/module.mk
index 2e16262b3a2..9fb02235e6f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/cid/rules.mk b/Build/source/libs/freetype2/freetype-src/src/cid/rules.mk
index 933b2daf783..94f663c80e3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/cid/type1cid.c b/Build/source/libs/freetype2/freetype-src/src/cid/type1cid.c
index 5405ecffc8f..082e8bfe5b3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/type1cid.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/type1cid.c
@@ -4,7 +4,7 @@
*
* FreeType OpenType driver component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/dlg/dlg.c b/Build/source/libs/freetype2/freetype-src/src/dlg/dlg.c
deleted file mode 100644
index 359cb075901..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/dlg/dlg.c
+++ /dev/null
@@ -1,803 +0,0 @@
-// Copyright (c) 2019 nyorain
-// Distributed under the Boost Software License, Version 1.0.
-// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt
-
-#define _XOPEN_SOURCE
-#define _POSIX_C_SOURCE 200809L
-#define _WIN32_WINNT 0x0600
-
-// Needed on windows so that we can use sprintf without warning.
-#define _CRT_SECURE_NO_WARNINGS
-
-#include <dlg/output.h>
-#include <dlg/dlg.h>
-#include <wchar.h>
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-const char* const dlg_reset_sequence = "\033[0m";
-const struct dlg_style dlg_default_output_styles[] = {
- {dlg_text_style_italic, dlg_color_green, dlg_color_none},
- {dlg_text_style_dim, dlg_color_gray, dlg_color_none},
- {dlg_text_style_none, dlg_color_cyan, dlg_color_none},
- {dlg_text_style_none, dlg_color_yellow, dlg_color_none},
- {dlg_text_style_none, dlg_color_red, dlg_color_none},
- {dlg_text_style_bold, dlg_color_red, dlg_color_none}
-};
-
-static void* xalloc(size_t size) {
- void* ret = calloc(size, 1);
- if(!ret) fprintf(stderr, "dlg: calloc returned NULL, probably crashing (size: %zu)\n", size);
- return ret;
-}
-
-static void* xrealloc(void* ptr, size_t size) {
- void* ret = realloc(ptr, size);
- if(!ret) fprintf(stderr, "dlg: realloc returned NULL, probably crashing (size: %zu)\n", size);
- return ret;
-}
-
-struct dlg_tag_func_pair {
- const char* tag;
- const char* func;
-};
-
-struct dlg_data {
- const char** tags; // vec
- struct dlg_tag_func_pair* pairs; // vec
- char* buffer;
- size_t buffer_size;
-};
-
-static dlg_handler g_handler = dlg_default_output;
-static void* g_data = NULL;
-
-static void dlg_free_data(void* data);
-static struct dlg_data* dlg_create_data(void);
-
-// platform-specific
-#if defined(__unix__) || defined(__unix) || defined(__linux__) || defined(__APPLE__) || defined(__MACH__)
- #define DLG_OS_UNIX
- #include <unistd.h>
- #include <pthread.h>
- #include <sys/time.h>
-
- static pthread_key_t dlg_data_key;
-
- static void dlg_main_cleanup(void) {
- void* data = pthread_getspecific(dlg_data_key);
- if(data) {
- dlg_free_data(data);
- pthread_setspecific(dlg_data_key, NULL);
- }
- }
-
- static void init_data_key(void) {
- pthread_key_create(&dlg_data_key, dlg_free_data);
- atexit(dlg_main_cleanup);
- }
-
- static struct dlg_data* dlg_data(void) {
- static pthread_once_t key_once = PTHREAD_ONCE_INIT;
- pthread_once(&key_once, init_data_key);
-
- void* data = pthread_getspecific(dlg_data_key);
- if(!data) {
- data = dlg_create_data();
- pthread_setspecific(dlg_data_key, data);
- }
-
- return (struct dlg_data*) data;
- }
-
- static void lock_file(FILE* file) {
- flockfile(file);
- }
-
- static void unlock_file(FILE* file) {
- funlockfile(file);
- }
-
- bool dlg_is_tty(FILE* stream) {
- return isatty(fileno(stream));
- }
-
- static unsigned get_msecs(void) {
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv.tv_usec;
- }
-
-// platform switch -- end unix
-#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)
- #define DLG_OS_WIN
- #define WIN32_LEAN_AND_MEAN
- #define DEFINE_CONSOLEV2_PROPERTIES
- #include <windows.h>
- #include <io.h>
-
- // thanks for nothing, microsoft
- #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
- #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
- #endif
-
- // the max buffer size we will convert on the stack
- #define DLG_MAX_STACK_BUF_SIZE 1024
-
- static void WINAPI dlg_fls_destructor(void* data) {
- dlg_free_data(data);
- }
-
- // TODO: error handling
- static BOOL CALLBACK dlg_init_fls(PINIT_ONCE io, void* param, void** lpContext) {
- (void) io;
- (void) param;
- **((DWORD**) lpContext) = FlsAlloc(dlg_fls_destructor);
- return true;
- }
-
- static struct dlg_data* dlg_data(void) {
- static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
- static DWORD fls = 0;
- void* flsp = (void*) &fls;
- InitOnceExecuteOnce(&init_once, dlg_init_fls, NULL, &flsp);
- void* data = FlsGetValue(fls);
- if(!data) {
- data = dlg_create_data();
- FlsSetValue(fls, data);
- }
-
- return (struct dlg_data*) data;
- }
-
- static void lock_file(FILE* file) {
- _lock_file(file);
- }
-
- static void unlock_file(FILE* file) {
- _unlock_file(file);
- }
-
- bool dlg_is_tty(FILE* stream) {
- return _isatty(_fileno(stream));
- }
-
-#ifdef DLG_WIN_CONSOLE
- static bool init_ansi_console(void) {
- HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
- HANDLE err = GetStdHandle(STD_ERROR_HANDLE);
- if(out == INVALID_HANDLE_VALUE || err == INVALID_HANDLE_VALUE)
- return false;
-
- DWORD outMode, errMode;
- if(!GetConsoleMode(out, &outMode) || !GetConsoleMode(err, &errMode))
- return false;
-
- outMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
- errMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
- if(!SetConsoleMode(out, outMode) || !SetConsoleMode(out, errMode))
- return false;
-
- return true;
- }
-
- static bool win_write_heap(void* handle, int needed, const char* format, va_list args) {
- char* buf1 = xalloc(3 * needed + 3 + (needed % 2));
- wchar_t* buf2 = (wchar_t*) (buf1 + needed + 1 + (needed % 2));
- vsnprintf(buf1, needed + 1, format, args);
- needed = MultiByteToWideChar(CP_UTF8, 0, buf1, needed, buf2, needed + 1);
- bool ret = (needed != 0 && WriteConsoleW(handle, buf2, needed, NULL, NULL) != 0);
- free(buf1);
- return ret;
- }
-
- static bool win_write_stack(void* handle, int needed, const char* format, va_list args) {
- char buf1[DLG_MAX_STACK_BUF_SIZE];
- wchar_t buf2[DLG_MAX_STACK_BUF_SIZE];
- vsnprintf(buf1, needed + 1, format, args);
- needed = MultiByteToWideChar(CP_UTF8, 0, buf1, needed, buf2, needed + 1);
- return (needed != 0 && WriteConsoleW(handle, buf2, needed, NULL, NULL) != 0);
- }
-#endif // DLG_WIN_CONSOLE
-
- static unsigned get_msecs() {
- SYSTEMTIME st;
- GetSystemTime(&st);
- return st.wMilliseconds;
- }
-
-#else // platform switch -- end windows
- #error Cannot determine platform (needed for color and utf-8 and stuff)
-#endif
-
-// general
-void dlg_escape_sequence(struct dlg_style style, char buf[12]) {
- int nums[3];
- unsigned int count = 0;
-
- if(style.fg != dlg_color_none) {
- nums[count++] = style.fg + 30;
- }
-
- if(style.bg != dlg_color_none) {
- nums[count++] = style.fg + 40;
- }
-
- if(style.style != dlg_text_style_none) {
- nums[count++] = style.style;
- }
-
- switch(count) {
- case 1: snprintf(buf, 12, "\033[%dm", nums[0]); break;
- case 2: snprintf(buf, 12, "\033[%d;%dm", nums[0], nums[1]); break;
- case 3: snprintf(buf, 12, "\033[%d;%d;%dm", nums[0], nums[1], nums[2]); break;
- default: buf[0] = '\0'; break;
- }
-}
-
-int dlg_vfprintf(FILE* stream, const char* format, va_list args) {
-#if defined(DLG_OS_WIN) && defined(DLG_WIN_CONSOLE)
- void* handle = NULL;
- if(stream == stdout) {
- handle = GetStdHandle(STD_OUTPUT_HANDLE);
- } else if(stream == stderr) {
- handle = GetStdHandle(STD_ERROR_HANDLE);
- }
-
- if(handle) {
- va_list args_copy;
- va_copy(args_copy, args);
- int needed = vsnprintf(NULL, 0, format, args_copy);
- va_end(args_copy);
-
- if(needed < 0) {
- return needed;
- }
-
- // We don't allocate too much on the stack
- // but we also don't want to call alloc every logging call
- // or use another cached buffer
- if(needed >= DLG_MAX_STACK_BUF_SIZE) {
- if(win_write_heap(handle, needed, format, args)) {
- return needed;
- }
- } else {
- if(win_write_stack(handle, needed, format, args)) {
- return needed;
- }
- }
- }
-#endif
-
- return vfprintf(stream, format, args);
-}
-
-int dlg_fprintf(FILE* stream, const char* format, ...) {
- va_list args;
- va_start(args, format);
- int ret = dlg_vfprintf(stream, format, args);
- va_end(args);
- return ret;
-}
-
-int dlg_styled_fprintf(FILE* stream, struct dlg_style style, const char* format, ...) {
- char buf[12];
- dlg_escape_sequence(style, buf);
-
- fprintf(stream, "%s", buf);
- va_list args;
- va_start(args, format);
- int ret = dlg_vfprintf(stream, format, args);
- va_end(args);
- fprintf(stream, "%s", dlg_reset_sequence);
- return ret;
-}
-
-void dlg_generic_output(dlg_generic_output_handler output, void* data,
- unsigned int features, const struct dlg_origin* origin, const char* string,
- const struct dlg_style styles[6]) {
- // We never print any dynamic content below so we can be sure at compile
- // time that a buffer of size 64 is large enough.
- char format_buf[64];
- char* format = format_buf;
-
- if(features & dlg_output_style) {
- format += sprintf(format, "%%s");
- }
-
- if(features & (dlg_output_time | dlg_output_file_line | dlg_output_tags | dlg_output_func)) {
- format += sprintf(format, "[");
- }
-
- bool first_meta = true;
- if(features & dlg_output_time) {
- format += sprintf(format, "%%h");
- first_meta = false;
- }
-
- if(features & dlg_output_time_msecs) {
- if(!first_meta) {
- format += sprintf(format, ":");
- }
-
- format += sprintf(format, "%%m");
- first_meta = false;
- }
-
- if(features & dlg_output_file_line) {
- if(!first_meta) {
- format += sprintf(format, " ");
- }
-
- format += sprintf(format, "%%o");
- first_meta = false;
- }
-
- if(features & dlg_output_func) {
- if(!first_meta) {
- format += sprintf(format, " ");
- }
-
- format += sprintf(format, "%%f");
- first_meta = false;
- }
-
- if(features & dlg_output_tags) {
- if(!first_meta) {
- format += sprintf(format, " ");
- }
-
- format += sprintf(format, "{%%t}");
- first_meta = false;
- }
-
- if(features & (dlg_output_time | dlg_output_file_line | dlg_output_tags | dlg_output_func)) {
- format += sprintf(format, "] ");
- }
-
- format += sprintf(format, "%%c");
-
- if(features & dlg_output_newline) {
- format += sprintf(format, "\n");
- }
-
- *format = '\0';
- dlg_generic_outputf(output, data, format_buf, origin, string, styles);
-}
-
-void dlg_generic_outputf(dlg_generic_output_handler output, void* data,
- const char* format_string, const struct dlg_origin* origin, const char* string,
- const struct dlg_style styles[6]) {
- bool reset_style = false;
- for(const char* it = format_string; *it; it++) {
- if(*it != '%') {
- output(data, "%c", *it);
- continue;
- }
-
- char next = *(it + 1); // must be valid since *it is not '\0'
- if(next == 'h') {
- time_t t = time(NULL);
- struct tm tm_info;
-
- #ifdef DLG_OS_WIN
- if(localtime_s(&tm_info, &t)) {
- #else
- if(!localtime_r(&t, &tm_info)) {
- #endif
- output(data, "<DATE ERROR>");
- } else {
- char timebuf[32];
- strftime(timebuf, sizeof(timebuf), "%H:%M:%S", &tm_info);
- output(data, "%s", timebuf);
- }
- it++;
- } else if(next == 'm') {
- output(data, "%06d", get_msecs());
- it++;
- } else if(next == 't') {
- bool first_tag = true;
- for(const char** tags = origin->tags; *tags; ++tags) {
- if(!first_tag) {
- output(data, ", ");
- }
-
- output(data, "%s", *tags);
- first_tag = false;
- }
- ++it;
- } else if(next == 'f') {
- output(data, "%s", origin->func);
- ++it;
- } else if(next == 'o') {
- output(data, "%s:%u", origin->file, origin->line);
- ++it;
- } else if(next == 's') {
- char buf[12];
- dlg_escape_sequence(styles[origin->level], buf);
- output(data, "%s", buf);
- reset_style = true;
- ++it;
- } else if(next == 'r') {
- output(data, "%s", dlg_reset_sequence);
- reset_style = false;
- ++it;
- } else if(next == 'c') {
- if(origin->expr && string) {
- output(data, "assertion '%s' failed: '%s'", origin->expr, string);
- } else if(origin->expr) {
- output(data, "assertion '%s' failed", origin->expr);
- } else if(string) {
- output(data, "%s", string);
- }
- ++it;
- } else if(next == '%') {
- output(data, "%s", "%");
- ++it;
- } else {
- // in this case it's a '%' without known format specifier following
- output(data, "%s", "%");
- }
- }
-
- if(reset_style) {
- output(data, "%s", dlg_reset_sequence);
- }
-}
-
-struct buf {
- char* buf;
- size_t* size;
-};
-
-static void print_size(void* size, const char* format, ...) {
- va_list args;
- va_start(args, format);
-
- int ret = vsnprintf(NULL, 0, format, args);
- va_end(args);
-
- if(ret > 0) {
- *((size_t*) size) += ret;
- }
-}
-
-static void print_buf(void* dbuf, const char* format, ...) {
- struct buf* buf = (struct buf*) dbuf;
- va_list args;
- va_start(args, format);
-
- int printed = vsnprintf(buf->buf, *buf->size, format, args);
- va_end(args);
-
- if(printed > 0) {
- *buf->size -= printed;
- buf->buf += printed;
- }
-}
-
-void dlg_generic_output_buf(char* buf, size_t* size, unsigned int features,
- const struct dlg_origin* origin, const char* string,
- const struct dlg_style styles[6]) {
- if(buf) {
- struct buf mbuf;
- mbuf.buf = buf;
- mbuf.size = size;
- dlg_generic_output(print_buf, &mbuf, features, origin, string, styles);
- } else {
- *size = 0;
- dlg_generic_output(print_size, size, features, origin, string, styles);
- }
-}
-
-void dlg_generic_outputf_buf(char* buf, size_t* size, const char* format_string,
- const struct dlg_origin* origin, const char* string,
- const struct dlg_style styles[6]) {
- if(buf) {
- struct buf mbuf;
- mbuf.buf = buf;
- mbuf.size = size;
- dlg_generic_outputf(print_buf, &mbuf, format_string, origin, string, styles);
- } else {
- *size = 0;
- dlg_generic_outputf(print_size, size, format_string, origin, string, styles);
- }
-}
-
-static void print_stream(void* stream, const char* format, ...) {
- va_list args;
- va_start(args, format);
- dlg_vfprintf((FILE*) stream, format, args);
- va_end(args);
-}
-
-void dlg_generic_output_stream(FILE* stream, unsigned int features,
- const struct dlg_origin* origin, const char* string,
- const struct dlg_style styles[6]) {
- stream = stream ? stream : stdout;
- if(features & dlg_output_threadsafe) {
- lock_file(stream);
- }
-
- dlg_generic_output(print_stream, stream, features, origin, string, styles);
- if(features & dlg_output_threadsafe) {
- unlock_file(stream);
- }
-}
-
-void dlg_generic_outputf_stream(FILE* stream, const char* format_string,
- const struct dlg_origin* origin, const char* string,
- const struct dlg_style styles[6], bool lock_stream) {
- stream = stream ? stream : stdout;
- if(lock_stream) {
- lock_file(stream);
- }
-
- dlg_generic_outputf(print_stream, stream, format_string, origin, string, styles);
- if(lock_stream) {
- unlock_file(stream);
- }
-}
-
-void dlg_default_output(const struct dlg_origin* origin, const char* string, void* data) {
- FILE* stream = data ? (FILE*) data : stdout;
- unsigned int features = dlg_output_file_line |
- dlg_output_newline |
- dlg_output_threadsafe;
-
-#ifdef DLG_DEFAULT_OUTPUT_ALWAYS_COLOR
- dlg_win_init_ansi();
- features |= dlg_output_style;
-#else
- if(dlg_is_tty(stream) && dlg_win_init_ansi()) {
- features |= dlg_output_style;
- }
-#endif
-
- dlg_generic_output_stream(stream, features, origin, string, dlg_default_output_styles);
- fflush(stream);
-}
-
-bool dlg_win_init_ansi(void) {
-#if defined(DLG_OS_WIN) && defined(DLG_WIN_CONSOLE)
- // TODO: use init once
- static volatile LONG status = 0;
- LONG res = InterlockedCompareExchange(&status, 1, 0);
- if(res == 0) { // not initialized
- InterlockedExchange(&status, 3 + init_ansi_console());
- }
-
- while(status == 1); // currently initialized in another thread, spinlock
- return (status == 4);
-#else
- return true;
-#endif
-}
-
-// small dynamic vec/array implementation
-// Since the macros vec_init and vec_add[c]/vec_push might
-// change the pointers value it must not be referenced somewhere else.
-#define vec__raw(vec) (((unsigned int*) vec) - 2)
-
-static void* vec_do_create(unsigned int typesize, unsigned int cap, unsigned int size) {
- unsigned long a = (size > cap) ? size : cap;
- void* ptr = xalloc(2 * sizeof(unsigned int) + a * typesize);
- unsigned int* begin = (unsigned int*) ptr;
- begin[0] = size * typesize;
- begin[1] = a * typesize;
- return begin + 2;
-}
-
-// NOTE: can be more efficient if we are allowed to reorder vector
-static void vec_do_erase(void* vec, unsigned int pos, unsigned int size) {
- unsigned int* begin = vec__raw(vec);
- begin[0] -= size;
- char* buf = (char*) vec;
- memcpy(buf + pos, buf + pos + size, size);
-}
-
-static void* vec_do_add(void** vec, unsigned int size) {
- unsigned int* begin = vec__raw(*vec);
- unsigned int needed = begin[0] + size;
- if(needed >= begin[1]) {
- void* ptr = xrealloc(begin, sizeof(unsigned int) * 2 + needed * 2);
- begin = (unsigned int*) ptr;
- begin[1] = needed * 2;
- (*vec) = begin + 2;
- }
-
- void* ptr = ((char*) (*vec)) + begin[0];
- begin[0] += size;
- return ptr;
-}
-
-#define vec_create(type, size) (type*) vec_do_create(sizeof(type), size * 2, size)
-#define vec_create_reserve(type, size, capacity) (type*) vec_do_create(sizeof(type), capcity, size)
-#define vec_init(array, size) array = vec_do_create(sizeof(*array), size * 2, size)
-#define vec_init_reserve(array, size, capacity) *((void**) &array) = vec_do_create(sizeof(*array), capacity, size)
-#define vec_free(vec) (free((vec) ? vec__raw(vec) : NULL), vec = NULL)
-#define vec_erase_range(vec, pos, count) vec_do_erase(vec, pos * sizeof(*vec), count * sizeof(*vec))
-#define vec_erase(vec, pos) vec_do_erase(vec, pos * sizeof(*vec), sizeof(*vec))
-#define vec_size(vec) (vec__raw(vec)[0] / sizeof(*vec))
-#define vec_capacity(vec) (vec_raw(vec)[1] / sizeof(*vec))
-#define vec_add(vec) vec_do_add((void**) &vec, sizeof(*vec))
-#define vec_addc(vec, count) (vec_do_add((void**) &vec, sizeof(*vec) * count))
-#define vec_push(vec, value) (vec_do_add((void**) &vec, sizeof(*vec)), vec_last(vec) = (value))
-#define vec_pop(vec) (vec__raw(vec)[0] -= sizeof(*vec))
-#define vec_popc(vec, count) (vec__raw(vec)[0] -= sizeof(*vec) * count)
-#define vec_clear(vec) (vec__raw(vec)[0] = 0)
-#define vec_last(vec) (vec[vec_size(vec) - 1])
-
-static struct dlg_data* dlg_create_data(void) {
- struct dlg_data* data = (struct dlg_data*) xalloc(sizeof(struct dlg_data));
- vec_init_reserve(data->tags, 0, 20);
- vec_init_reserve(data->pairs, 0, 20);
- data->buffer_size = 100;
- data->buffer = (char*) xalloc(data->buffer_size);
- return data;
-}
-
-static void dlg_free_data(void* ddata) {
- struct dlg_data* data = (struct dlg_data*) ddata;
- if(data) {
- vec_free(data->pairs);
- vec_free(data->tags);
- free(data->buffer);
- free(data);
- }
-}
-
-void dlg_add_tag(const char* tag, const char* func) {
- struct dlg_data* data = dlg_data();
- struct dlg_tag_func_pair* pair =
- (struct dlg_tag_func_pair*) vec_add(data->pairs);
- pair->tag = tag;
- pair->func = func;
-}
-
-bool dlg_remove_tag(const char* tag, const char* func) {
- struct dlg_data* data = dlg_data();
- for(unsigned int i = 0; i < vec_size(data->pairs); ++i) {
- if(data->pairs[i].func == func && data->pairs[i].tag == tag) {
- vec_erase(data->pairs, i);
- return true;
- }
- }
-
- return false;
-}
-
-char** dlg_thread_buffer(size_t** size) {
- struct dlg_data* data = dlg_data();
- if(size) {
- *size = &data->buffer_size;
- }
- return &data->buffer;
-}
-
-void dlg_set_handler(dlg_handler handler, void* data) {
- g_handler = handler;
- g_data = data;
-}
-
-dlg_handler dlg_get_handler(void** data) {
- *data = g_data;
- return g_handler;
-}
-
-const char* dlg__printf_format(const char* str, ...) {
- va_list vlist;
- va_start(vlist, str);
-
- va_list vlistcopy;
- va_copy(vlistcopy, vlist);
- int needed = vsnprintf(NULL, 0, str, vlist);
- if(needed < 0) {
- printf("dlg__printf_format: invalid format given\n");
- va_end(vlist);
- va_end(vlistcopy);
- return NULL;
- }
-
- va_end(vlist);
-
- size_t* buf_size;
- char** buf = dlg_thread_buffer(&buf_size);
- if(*buf_size <= (unsigned int) needed) {
- *buf_size = (needed + 1) * 2;
- *buf = (char*) xrealloc(*buf, *buf_size);
- }
-
- vsnprintf(*buf, *buf_size, str, vlistcopy);
- va_end(vlistcopy);
-
- return *buf;
-}
-
-void dlg__do_log(enum dlg_level lvl, const char* const* tags, const char* file, int line,
- const char* func, const char* string, const char* expr) {
- struct dlg_data* data = dlg_data();
- unsigned int tag_count = 0;
-
- // push default tags
- while(tags[tag_count]) {
- vec_push(data->tags, tags[tag_count++]);
- }
-
- // push current global tags
- for(size_t i = 0; i < vec_size(data->pairs); ++i) {
- const struct dlg_tag_func_pair pair = data->pairs[i];
- if(pair.func == NULL || !strcmp(pair.func, func)) {
- vec_push(data->tags, pair.tag);
- }
- }
-
- // push call-specific tags, skip first terminating NULL
- ++tag_count;
- while(tags[tag_count]) {
- vec_push(data->tags, tags[tag_count++]);
- }
-
- vec_push(data->tags, NULL); // terminating NULL
- struct dlg_origin origin;
- origin.level = lvl;
- origin.file = file;
- origin.line = line;
- origin.func = func;
- origin.expr = expr;
- origin.tags = data->tags;
-
- g_handler(&origin, string, g_data);
- vec_clear(data->tags);
-}
-
-#ifdef _MSC_VER
-// shitty msvc compatbility
-// meson gives us sane paths (separated by '/') while on MSVC,
-// __FILE__ contains a '\\' separator.
-static bool path_same(char a, char b) {
- return (a == b) ||
- (a == '/' && b == '\\') ||
- (a == '\\' && b == '/');
-}
-#else
-
-static inline bool path_same(char a, char b) {
- return a == b;
-}
-
-#endif
-
-const char* dlg__strip_root_path(const char* file, const char* base) {
- if(!file) {
- return NULL;
- }
-
- const char* saved = file;
- if(*file == '.') { // relative path detected
- while(*(++file) == '.' || *file == '/' || *file == '\\');
- if(*file == '\0') { // weird case: purely relative path without file
- return saved;
- }
-
- return file;
- }
-
- // strip base from file if it is given
- if(base) {
- char fn = *file;
- char bn = *base;
- while(bn != '\0' && path_same(fn, bn)) {
- fn = *(++file);
- bn = *(++base);
- }
-
- if(fn == '\0' || bn != '\0') { // weird case: base isn't prefix of file
- return saved;
- }
- }
-
- return file;
-}
diff --git a/Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c b/Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c
deleted file mode 100644
index 639411543ee..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
- *
- * dlgwrap.c
- *
- * Wrapper file for the 'dlg' library (body only)
- *
- * Copyright (C) 2020-2021 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.
- *
- */
-
-
- /* We have to duplicate these feature test macros from `dlg.c` */
- /* since `freetype.h` loads some affected standard headers. */
-#define _XOPEN_SOURCE
-#define _POSIX_C_SOURCE 200809L
-
-#include <freetype/freetype.h>
-
-
-#ifdef FT_DEBUG_LOGGING
-#include "dlg.c"
-#else
- /* ANSI C doesn't like empty source files */
- typedef int _dlg_dummy;
-#endif
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/dlg/rules.mk b/Build/source/libs/freetype2/freetype-src/src/dlg/rules.mk
deleted file mode 100644
index a56dee6c2ab..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/dlg/rules.mk
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# FreeType 2 dlg logging library configuration rules
-#
-
-
-# Copyright (C) 2020-2021 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.
-
-
-# dlg logging library directory
-#
-DLG_DIR := $(SRC_DIR)/dlg
-
-
-# compilation flags for the library
-#
-DLG_COMPILE := $(CC) $(ANSIFLAGS) \
- $I$(subst /,$(COMPILER_SEP),$(DLG_DIR)) \
- $(INCLUDE_FLAGS) \
- $(FT_CFLAGS)
-
-
-# dlg logging library sources (i.e., C files)
-#
-DLG_SRC := $(DLG_DIR)/dlgwrap.c
-
-# dlg logging library headers
-#
-DLG_H := $(TOP_DIR)/include/dlg/dlg.h \
- $(TOP_DIR)/include/dlg/output.h
-
-
-# dlg logging library object(s)
-#
-# DLG_OBJ_M is used during `multi' builds
-# DLG_OBJ_S is used during `single' builds
-#
-DLG_OBJ_M := $(DLG_SRC:$(DLG_DIR)/%.c=$(OBJ_DIR)/%.$O)
-DLG_OBJ_S := $(OBJ_DIR)/dlg.$O
-
-# dlg logging library source file for single build
-#
-DLG_SRC_S := $(DLG_DIR)/dlgwrap.c
-
-
-# dlg logging library - single object
-#
-$(DLG_OBJ_S): $(DLG_SRC_S) $(DLG_SRC) $(FREETYPE_H) $(DLG_H)
- $(DLG_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(DLG_SRC_S))
-
-
-# dlg logging library - multiple objects
-#
-$(OBJ_DIR)/%.$O: $(DLG_DIR)/%.c $(FREETYPE_H) $(DLG_H)
- $(DLG_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
-
-
-# update main object lists
-#
-DLG_OBJS_S += $(DLG_OBJ_S)
-DLG_OBJS_M += $(DLG_OBJ_M)
-
-
-# EOF
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/README b/Build/source/libs/freetype2/freetype-src/src/gxvalid/README
index 7fb0296282b..2a32bab204c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/README
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/README
@@ -518,7 +518,7 @@ gxvalid: TrueType GX validator
------------------------------------------------------------------------
-Copyright (C) 2004-2021 by
+Copyright (C) 2004-2020 by
suzuki toshiya, Masatake YAMATO, Red hat K.K.,
David Turner, Robert Wilhelm, and Werner Lemberg.
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.c
index 309d517443f..683b8a69724 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.c
@@ -4,7 +4,7 @@
*
* FreeType validator for TrueTypeGX/AAT tables (body only).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.h b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.h
index 2c41c286685..ff2812da20e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.h
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvalid.h
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT table validation (specification only).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvbsln.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvbsln.c
index af69cb51df3..ac58d4615c0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvbsln.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvbsln.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT bsln table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c
index f96d57bdb48..ead0f24cd3a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT common tables validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
@@ -46,11 +46,16 @@
/*************************************************************************/
/*************************************************************************/
- FT_COMPARE_DEF( int )
- gxv_compare_ushort_offset( const void* a,
- const void* b )
+ static int
+ gxv_compare_ushort_offset( FT_UShort* a,
+ FT_UShort* b )
{
- return *(FT_UShort*)a - *(FT_UShort*)b;
+ if ( *a < *b )
+ return -1;
+ else if ( *a > *b )
+ return 1;
+ else
+ return 0;
}
@@ -73,7 +78,7 @@
buff[nmemb] = limit;
ft_qsort( buff, ( nmemb + 1 ), sizeof ( FT_UShort ),
- gxv_compare_ushort_offset );
+ ( int(*)(const void*, const void*) )gxv_compare_ushort_offset );
if ( buff[nmemb] > limit )
FT_INVALID_OFFSET;
@@ -106,17 +111,13 @@
/*************************************************************************/
/*************************************************************************/
- FT_COMPARE_DEF( int )
- gxv_compare_ulong_offset( const void* a,
- const void* b )
+ static int
+ gxv_compare_ulong_offset( FT_ULong* a,
+ FT_ULong* b )
{
- FT_ULong a_ = *(FT_ULong*)a;
- FT_ULong b_ = *(FT_ULong*)b;
-
-
- if ( a_ < b_ )
+ if ( *a < *b )
return -1;
- else if ( a_ > b_ )
+ else if ( *a > *b )
return 1;
else
return 0;
@@ -142,7 +143,7 @@
buff[nmemb] = limit;
ft_qsort( buff, ( nmemb + 1 ), sizeof ( FT_ULong ),
- gxv_compare_ulong_offset );
+ ( int(*)(const void*, const void*) )gxv_compare_ulong_offset );
if ( buff[nmemb] > limit )
FT_INVALID_OFFSET;
@@ -1492,11 +1493,9 @@
state = (FT_UShort)( newState_idx / ( 1 + maxClassID ) );
if ( 0 != ( newState_idx % ( 1 + maxClassID ) ) )
{
- FT_TRACE4(( "-> new state = %d (supposed)\n",
- state ));
- FT_TRACE4(( "but newState index 0x%04x"
- " is not aligned to %d-classes\n",
- newState_idx, 1 + maxClassID ));
+ FT_TRACE4(( "-> new state = %d (supposed)\n"
+ "but newState index 0x%04x is not aligned to %d-classes\n",
+ state, newState_idx, 1 + maxClassID ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h
index de134ced102..59d149215c4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT common tables validation (specification).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxverror.h b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxverror.h
index d20d3956801..5d8f0b68069 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxverror.h
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxverror.h
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT validation module error codes (specification only).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c
index bc76d72001c..400ec8a3fbb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT feat table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.h b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.h
index f6d28fa71ce..435dcefb093 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.h
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.h
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT feat table validation (specification).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfgen.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfgen.c
index b47cd0f7baf..fe05a6f3a14 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfgen.c
+++ b/Build/source/libs/freetype2/freetype-src/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 (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* Masatake YAMATO and Redhat K.K.
*
* This file may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c
index 54a2a548e32..3c7f1f9534f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT just table validation (body).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c
index 9fcdbaa7cdb..cc0b3dfcb4c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT kern table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvlcar.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvlcar.c
index 9db839ba8a0..82ac1907ab7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvlcar.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvlcar.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT lcar table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c
index ad6dfb075e7..a467e87131e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c
@@ -4,7 +4,7 @@
*
* FreeType's TrueTypeGX/AAT validation module implementation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
@@ -62,7 +62,7 @@
if ( error )
goto Exit;
- if ( FT_QALLOC( *table, *table_len ) )
+ if ( FT_ALLOC( *table, *table_len ) )
goto Exit;
error = FT_Load_Sfnt_Table( face, tag, 0, *table, table_len );
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.h b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.h
index 90e0c10a283..f2982c96c2b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.h
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.h
@@ -5,7 +5,7 @@
* FreeType's TrueTypeGX/AAT validation module implementation
* (specification).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c
index 23bfe08344b..aae7f01a899 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT mort table validation (body).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.h b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.h
index de5ab4ef02c..7237c58254b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.h
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.h
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT common definition for mort table (specification).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort0.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort0.c
index 0c695aa4c77..d452c1ccaa0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort0.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort0.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT mort table validation
* body for type0 (Indic Script Rearrangement) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort1.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort1.c
index 0af22362f1f..d743f89f6e7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort1.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort1.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT mort table validation
* body for type1 (Contextual Substitution) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c
index 4abfbb64228..9e69e1269d0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT mort table validation
* body for type2 (Ligature Substitution) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort4.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort4.c
index 1b0dd3edabe..4584d204cfe 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort4.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort4.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT mort table validation
* body for type4 (Non-Contextual Glyph Substitution) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c
index eedec2966f1..a15a24fe652 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT mort table validation
* body for type5 (Contextual Glyph Insertion) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c
index 12a77dbb721..754d9f8bf18 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT morx table validation (body).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.h b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.h
index f155f184603..f747b1d636d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.h
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.h
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT common definition for morx table (specification).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx0.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx0.c
index e93cea9ccac..5a42e552e27 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx0.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx0.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT morx table validation
* body for type0 (Indic Script Rearrangement) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx1.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx1.c
index d380f8d1adc..9f8b69067e9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx1.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx1.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT morx table validation
* body for type1 (Contextual Substitution) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c
index 8eff5393f90..98b5c49c267 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT morx table validation
* body for type2 (Ligature Substitution) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx4.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx4.c
index e632e8d42ab..857e4d4eb86 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx4.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx4.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT morx table validation
* body for "morx" type4 (Non-Contextual Glyph Substitution) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx5.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx5.c
index 5ad33976d77..7ceba077af0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx5.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx5.c
@@ -5,7 +5,7 @@
* TrueTypeGX/AAT morx table validation
* body for type5 (Contextual Glyph Insertion) subtable.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c
index b4abcd68e93..a398fe09778 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT opbd table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c
index f6ec16b4ac7..bee8bab97bc 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT prop table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c
index 6a3d4b409e9..58a631c9e5f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c
@@ -4,7 +4,7 @@
*
* TrueTypeGX/AAT trak table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/module.mk b/Build/source/libs/freetype2/freetype-src/src/gxvalid/module.mk
index efb9c9295f2..e7d408df9d0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/module.mk
@@ -2,7 +2,7 @@
# FreeType 2 gxvalid module definition
#
-# Copyright (C) 2004-2021 by
+# Copyright (C) 2004-2020 by
# suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/rules.mk b/Build/source/libs/freetype2/freetype-src/src/gxvalid/rules.mk
index 8e0b453423d..d55a4935e21 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2004-2021 by
+# Copyright (C) 2004-2020 by
# suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
diff --git a/Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c b/Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c
index 788a37b3171..de7d0fdd5b6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c
@@ -8,7 +8,7 @@
* parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -121,29 +121,24 @@
'malloc/free' */
static voidpf
- ft_gzip_alloc( voidpf opaque,
- uInt items,
- uInt size )
+ ft_gzip_alloc( FT_Memory memory,
+ uInt items,
+ uInt size )
{
- FT_Memory memory = (FT_Memory)opaque;
- FT_ULong sz = (FT_ULong)size * items;
+ FT_ULong sz = (FT_ULong)size * items;
FT_Error error;
- FT_Pointer p = NULL;
+ FT_Pointer p = NULL;
- /* allocate and zero out */
(void)FT_ALLOC( p, sz );
return p;
}
static void
- ft_gzip_free( voidpf opaque,
- voidpf address )
+ ft_gzip_free( FT_Memory memory,
+ voidpf address )
{
- FT_Memory memory = (FT_Memory)opaque;
-
-
FT_MEM_FREE( address );
}
@@ -155,14 +150,14 @@
unsigned items,
unsigned size )
{
- return ft_gzip_alloc( opaque, items, size );
+ return ft_gzip_alloc( (FT_Memory)opaque, items, size );
}
local void
zcfree( voidpf opaque,
voidpf ptr )
{
- ft_gzip_free( opaque, ptr );
+ ft_gzip_free( (FT_Memory)opaque, ptr );
}
#endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */
@@ -309,8 +304,8 @@
}
/* initialize zlib -- there is no zlib header in the compressed stream */
- zstream->zalloc = ft_gzip_alloc;
- zstream->zfree = ft_gzip_free;
+ zstream->zalloc = (alloc_func)ft_gzip_alloc;
+ zstream->zfree = (free_func) ft_gzip_free;
zstream->opaque = stream->memory;
zstream->avail_in = 0;
@@ -676,7 +671,7 @@
FT_Byte* zip_buff = NULL;
- if ( !FT_QALLOC( zip_buff, zip_size ) )
+ if ( !FT_ALLOC( zip_buff, zip_size ) )
{
FT_ULong count;
@@ -746,8 +741,8 @@
stream.next_out = output;
stream.avail_out = (uInt)*output_len;
- stream.zalloc = ft_gzip_alloc;
- stream.zfree = ft_gzip_free;
+ stream.zalloc = (alloc_func)ft_gzip_alloc;
+ stream.zfree = (free_func) ft_gzip_free;
stream.opaque = memory;
/* This is a temporary fix and will be removed once the internal
diff --git a/Build/source/libs/freetype2/freetype-src/src/gzip/rules.mk b/Build/source/libs/freetype2/freetype-src/src/gzip/rules.mk
index 1a90ae8fcf5..4ea823f8d36 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gzip/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/gzip/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2002-2021 by
+# Copyright (C) 2002-2020 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/Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c b/Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c
index 93c8f597820..ddb81e6e973 100644
--- a/Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c
+++ b/Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c
@@ -8,7 +8,7 @@
* be used to parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* Albert Chin-A-Young.
*
* based on code in `src/gzip/ftgzip.c'
diff --git a/Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.c b/Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.c
index 8b5b357f369..884d2ec74eb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.c
+++ b/Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.c
@@ -8,7 +8,7 @@
* be used to parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,
@@ -127,7 +127,6 @@
new_size = new_size + ( new_size >> 1 ) + 4;
- /* if relocating to heap */
if ( state->stack == state->stack_0 )
{
state->stack = NULL;
@@ -143,13 +142,9 @@
return -1;
}
- if ( FT_QRENEW_ARRAY( state->stack, old_size, new_size ) )
+ if ( FT_RENEW_ARRAY( state->stack, old_size, new_size ) )
return -1;
- /* if relocating to heap */
- if ( old_size == 0 )
- FT_MEM_COPY( state->stack, state->stack_0, FT_LZW_DEFAULT_STACK_SIZE );
-
state->stack_size = new_size;
}
return 0;
diff --git a/Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.h b/Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.h
index 9ada742c73d..d8768f7b47b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.h
+++ b/Build/source/libs/freetype2/freetype-src/src/lzw/ftzopen.h
@@ -8,7 +8,7 @@
* be used to parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/lzw/rules.mk b/Build/source/libs/freetype2/freetype-src/src/lzw/rules.mk
index 747cbdcca89..3468ee024de 100644
--- a/Build/source/libs/freetype2/freetype-src/src/lzw/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/lzw/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2004-2021 by
+# Copyright (C) 2004-2020 by
# Albert Chin-A-Young.
#
# based on `src/lzw/rules.mk'
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk b/Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk
index 3009349209c..67b9820d84c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2004-2021 by
+# Copyright (C) 2004-2020 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/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c
index 869233ce8c5..d640209f684 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c
@@ -4,7 +4,7 @@
*
* FreeType validator for OpenType tables (body only).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h
index f8ca454d6ef..8208ff01128 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h
@@ -4,7 +4,7 @@
*
* OpenType table validation (specification only).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c
index 83f998cdb12..250ae98ab5f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c
@@ -4,7 +4,7 @@
*
* OpenType BASE table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c
index 40624bb159e..faaa8468718 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c
@@ -4,7 +4,7 @@
*
* OpenType common tables validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h
index e092684c9a1..f9926034a9b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h
@@ -4,7 +4,7 @@
*
* OpenType common tables validation (specification).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -105,11 +105,10 @@ FT_BEGIN_HEADER
FT_Byte* pp = (FT_Byte*)_size ## _p; \
\
\
- FT_TRACE3(( "\n" )); \
- FT_TRACE3(( "Invalid offset to optional table `%s'" \
- " set to zero.\n", \
- #_size )); \
- FT_TRACE3(( "\n" )); \
+ FT_TRACE3(( "\n" \
+ "Invalid offset to optional table `%s'" \
+ " set to zero.\n" \
+ "\n", #_size )); \
\
_size = pp[0] = pp[1] = 0; \
} \
@@ -128,11 +127,10 @@ FT_BEGIN_HEADER
FT_Byte* pp = (FT_Byte*)_size ## _p; \
\
\
- FT_TRACE3(( "\n" )); \
- FT_TRACE3(( "Invalid offset to optional table `%s'" \
- " set to zero.\n", \
- #_size )); \
- FT_TRACE3(( "\n" )); \
+ 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; \
} \
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h
index 3e23234f366..979e9cbd9c2 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h
@@ -4,7 +4,7 @@
*
* OpenType validation module error codes (specification only).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c
index 5a160a4142e..88874b8474e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c
@@ -4,7 +4,7 @@
*
* OpenType GDEF table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c
index e0d4e420de9..29d56f91e8c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c
@@ -4,7 +4,7 @@
*
* OpenType GPOS table validation (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h
index 176a68883fa..06a03a0e6c7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h
@@ -4,7 +4,7 @@
*
* OpenType GPOS table validator (specification).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c
index b426a17449e..f0d563ba921 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c
@@ -4,7 +4,7 @@
*
* OpenType GSUB table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c
index 404dda88a14..79de7b809dd 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c
@@ -4,7 +4,7 @@
*
* OpenType JSTF table validation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c
index 8dceabde90e..dfdeaaba7ed 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c
@@ -4,7 +4,7 @@
*
* OpenType MATH table validation (body).
*
- * Copyright (C) 2007-2021 by
+ * Copyright (C) 2007-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by George Williams.
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c
index f76ac62fe1e..0188b270183 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c
@@ -4,7 +4,7 @@
*
* FreeType's OpenType validation module implementation (body).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -53,7 +53,7 @@
if ( error )
goto Exit;
- if ( FT_QALLOC( *table, *table_len ) )
+ if ( FT_ALLOC( *table, *table_len ) )
goto Exit;
error = FT_Load_Sfnt_Table( face, tag, 0, *table, table_len );
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h
index 37c20e00236..efd6da035f4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h
@@ -5,7 +5,7 @@
* FreeType's OpenType validation module implementation
* (specification).
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk b/Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk
index 634a3506be8..7f0169fd895 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2004-2021 by
+# Copyright (C) 2004-2020 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/Build/source/libs/freetype2/freetype-src/src/pcf/pcfdrivr.c b/Build/source/libs/freetype2/freetype-src/src/pcf/pcfdrivr.c
index 2a40af9e993..e9dd51752eb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pcf/pcfdrivr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pcf/pcfdrivr.c
@@ -606,7 +606,7 @@ THE SOFTWARE.
if ( prop->value.l > 0x7FFFFFFFL ||
prop->value.l < ( -1 - 0x7FFFFFFFL ) )
{
- FT_TRACE2(( "pcf_get_bdf_property:"
+ FT_TRACE1(( "pcf_get_bdf_property:"
" too large integer 0x%lx is truncated\n",
prop->value.l ));
}
@@ -705,7 +705,7 @@ THE SOFTWARE.
#endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
- FT_TRACE2(( "pcf_property_set: missing property `%s'\n",
+ FT_TRACE0(( "pcf_property_set: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
@@ -743,7 +743,7 @@ THE SOFTWARE.
#endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
- FT_TRACE2(( "pcf_property_get: missing property `%s'\n",
+ FT_TRACE0(( "pcf_property_get: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c b/Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c
index 060554ae46a..8817682cdfb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c
@@ -127,7 +127,7 @@ THE SOFTWARE.
toc->count = FT_MIN( stream->size >> 4, 9 );
}
- if ( FT_QNEW_ARRAY( face->toc.tables, toc->count ) )
+ if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )
return error;
tables = face->toc.tables;
@@ -501,8 +501,8 @@ THE SOFTWARE.
if ( FT_READ_ULONG_LE( format ) )
goto Bail;
- FT_TRACE4(( "pcf_get_properties:\n" ));
- FT_TRACE4(( " format: 0x%lX (%s)\n",
+ FT_TRACE4(( "pcf_get_properties:\n"
+ " format: 0x%lX (%s)\n",
format,
PCF_BYTE_ORDER( format ) == MSBFirst ? "MSB" : "LSB" ));
@@ -540,7 +540,7 @@ THE SOFTWARE.
face->nprops = (int)nprops;
- if ( FT_QNEW_ARRAY( props, nprops ) )
+ if ( FT_NEW_ARRAY( props, nprops ) )
goto Bail;
for ( i = 0; i < nprops; i++ )
@@ -607,13 +607,14 @@ THE SOFTWARE.
}
/* allocate one more byte so that we have a final null byte */
- if ( FT_QALLOC( strings, string_size + 1 ) ||
- FT_STREAM_READ( strings, string_size ) )
+ if ( FT_NEW_ARRAY( strings, string_size + 1 ) )
goto Bail;
- strings[string_size] = '\0';
+ error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size );
+ if ( error )
+ goto Bail;
- if ( FT_QNEW_ARRAY( properties, nprops ) )
+ if ( FT_NEW_ARRAY( properties, nprops ) )
goto Bail;
face->properties = properties;
@@ -696,8 +697,8 @@ THE SOFTWARE.
if ( FT_READ_ULONG_LE( format ) )
goto Bail;
- FT_TRACE4(( "pcf_get_metrics:\n" ));
- FT_TRACE4(( " format: 0x%lX (%s, %s)\n",
+ FT_TRACE4(( "pcf_get_metrics:\n"
+ " format: 0x%lX (%s, %s)\n",
format,
PCF_BYTE_ORDER( format ) == MSBFirst ? "MSB" : "LSB",
PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) ?
@@ -766,7 +767,7 @@ THE SOFTWARE.
face->nmetrics = nmetrics + 1;
- if ( FT_QNEW_ARRAY( face->metrics, face->nmetrics ) )
+ if ( FT_NEW_ARRAY( face->metrics, face->nmetrics ) )
return error;
/* we handle glyph index 0 later on */
@@ -839,16 +840,17 @@ THE SOFTWARE.
FT_Stream_ExitFrame( stream );
- FT_TRACE4(( "pcf_get_bitmaps:\n" ));
- FT_TRACE4(( " format: 0x%lX\n", format ));
- FT_TRACE4(( " (%s, %s,\n",
+ FT_TRACE4(( "pcf_get_bitmaps:\n"
+ " format: 0x%lX\n"
+ " (%s, %s,\n"
+ " padding=%d bit%s, scanning=%d bit%s)\n",
+ format,
PCF_BYTE_ORDER( format ) == MSBFirst
? "most significant byte first"
: "least significant byte first",
PCF_BIT_ORDER( format ) == MSBFirst
? "most significant bit first"
- : "least significant bit first" ));
- FT_TRACE4(( " padding=%d bit%s, scanning=%d bit%s)\n",
+ : "least significant bit first",
8 << PCF_GLYPH_PAD_INDEX( format ),
( 8 << PCF_GLYPH_PAD_INDEX( format ) ) == 1 ? "" : "s",
8 << PCF_SCAN_UNIT_INDEX( format ),
@@ -999,8 +1001,8 @@ THE SOFTWARE.
if ( FT_READ_ULONG_LE( format ) )
goto Bail;
- FT_TRACE4(( "pcf_get_encodings:\n" ));
- FT_TRACE4(( " format: 0x%lX (%s)\n",
+ FT_TRACE4(( "pcf_get_encodings:\n"
+ " format: 0x%lX (%s)\n",
format,
PCF_BYTE_ORDER( format ) == MSBFirst ? "MSB" : "LSB" ));
@@ -1019,11 +1021,11 @@ THE SOFTWARE.
goto Bail;
}
- FT_TRACE4(( " firstCol 0x%X, lastCol 0x%X\n",
- enc->firstCol, enc->lastCol ));
- FT_TRACE4(( " firstRow 0x%X, lastRow 0x%X\n",
- enc->firstRow, enc->lastRow ));
- FT_TRACE4(( " defaultChar 0x%X\n",
+ FT_TRACE4(( " firstCol 0x%X, lastCol 0x%X\n"
+ " firstRow 0x%X, lastRow 0x%X\n"
+ " defaultChar 0x%X\n",
+ enc->firstCol, enc->lastCol,
+ enc->firstRow, enc->lastRow,
enc->defaultChar ));
/* sanity checks; we limit numbers of rows and columns to 256 */
@@ -1086,8 +1088,8 @@ THE SOFTWARE.
if ( defaultCharEncodingOffset == 0xFFFF )
{
FT_TRACE0(( "pcf_get_encodings:"
- " No glyph for default character,\n" ));
- FT_TRACE0(( " "
+ " No glyph for default character,\n"
+ " "
" setting it to the first glyph of the font\n" ));
defaultCharEncodingOffset = 1;
}
@@ -1098,8 +1100,8 @@ THE SOFTWARE.
if ( defaultCharEncodingOffset >= face->nmetrics )
{
FT_TRACE0(( "pcf_get_encodings:"
- " Invalid glyph index for default character,\n" ));
- FT_TRACE0(( " "
+ " Invalid glyph index for default character,\n"
+ " "
" setting it to the first glyph of the font\n" ));
defaultCharEncodingOffset = 1;
}
@@ -1206,10 +1208,10 @@ THE SOFTWARE.
if ( FT_READ_ULONG_LE( format ) )
goto Bail;
- FT_TRACE4(( "pcf_get_accel%s:\n",
+ FT_TRACE4(( "pcf_get_accel%s:\n"
+ " format: 0x%lX (%s, %s)\n",
type == PCF_BDF_ACCELERATORS ? " (getting BDF accelerators)"
- : "" ));
- FT_TRACE4(( " format: 0x%lX (%s, %s)\n",
+ : "",
format,
PCF_BYTE_ORDER( format ) == MSBFirst ? "MSB" : "LSB",
PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) ?
@@ -1231,16 +1233,16 @@ THE SOFTWARE.
}
FT_TRACE5(( " noOverlap=%s, constantMetrics=%s,"
- " terminalFont=%s, constantWidth=%s\n",
+ " terminalFont=%s, constantWidth=%s\n"
+ " inkInside=%s, inkMetrics=%s, drawDirection=%s\n"
+ " fontAscent=%ld, fontDescent=%ld, maxOverlap=%ld\n",
accel->noOverlap ? "yes" : "no",
accel->constantMetrics ? "yes" : "no",
accel->terminalFont ? "yes" : "no",
- accel->constantWidth ? "yes" : "no" ));
- FT_TRACE5(( " inkInside=%s, inkMetrics=%s, drawDirection=%s\n",
+ accel->constantWidth ? "yes" : "no",
accel->inkInside ? "yes" : "no",
accel->inkMetrics ? "yes" : "no",
- accel->drawDirection ? "RTL" : "LTR" ));
- FT_TRACE5(( " fontAscent=%ld, fontDescent=%ld, maxOverlap=%ld\n",
+ accel->drawDirection ? "RTL" : "LTR",
accel->fontAscent,
accel->fontDescent,
accel->maxOverlap ));
@@ -1367,7 +1369,7 @@ THE SOFTWARE.
char* s;
- if ( FT_QALLOC( face->style_name, len ) )
+ if ( FT_ALLOC( face->style_name, len ) )
return error;
s = face->style_name;
@@ -1531,7 +1533,7 @@ THE SOFTWARE.
{
l += ft_strlen( foundry_prop->value.atom ) + 1;
- if ( FT_QALLOC( root->family_name, l ) )
+ if ( FT_NEW_ARRAY( root->family_name, l ) )
goto Exit;
ft_strcpy( root->family_name, foundry_prop->value.atom );
@@ -1540,7 +1542,7 @@ THE SOFTWARE.
}
else
{
- if ( FT_QALLOC( root->family_name, l ) )
+ if ( FT_NEW_ARRAY( root->family_name, l ) )
goto Exit;
ft_strcpy( root->family_name, prop->value.atom );
@@ -1564,7 +1566,7 @@ THE SOFTWARE.
root->num_glyphs = (FT_Long)face->nmetrics;
root->num_fixed_sizes = 1;
- if ( FT_NEW( root->available_sizes ) )
+ if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
goto Exit;
{
@@ -1572,6 +1574,8 @@ THE SOFTWARE.
FT_Short resolution_x = 0, resolution_y = 0;
+ FT_ZERO( bsize );
+
/* for simplicity, we take absolute values of integer properties */
#if 0
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/module.mk b/Build/source/libs/freetype2/freetype-src/src/pfr/module.mk
index 4f49e12da87..762353dda28 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2002-2021 by
+# Copyright (C) 2002-2020 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/Build/source/libs/freetype2/freetype-src/src/pfr/pfr.c b/Build/source/libs/freetype2/freetype-src/src/pfr/pfr.c
index 4058ad56528..9264c77df2f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfr.c
@@ -4,7 +4,7 @@
*
* FreeType PFR driver component.
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.c b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.c
index 6a7f573594b..ebc7b843935 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.c
@@ -4,7 +4,7 @@
*
* FreeType PFR cmap handling (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.h
index 17c02a2b4b8..a6d920c30b3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrcmap.h
@@ -4,7 +4,7 @@
*
* FreeType PFR cmap handling (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.c b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.c
index 16b8f794717..b14320875a1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.c
@@ -4,7 +4,7 @@
*
* FreeType PFR driver interface (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.h
index 6ff16fea065..7646b4d1bde 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrdrivr.h
@@ -4,7 +4,7 @@
*
* High-level Type PFR driver interface (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrerror.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrerror.h
index 255696efed2..33460ef4fd5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrerror.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrerror.h
@@ -4,7 +4,7 @@
*
* PFR error codes (specification only).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.c b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.c
index b400042a868..aa640c3b07f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.c
@@ -4,7 +4,7 @@
*
* FreeType PFR glyph loader (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.h
index b726d564fc5..f356b4c75b0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrgload.h
@@ -4,7 +4,7 @@
*
* FreeType PFR glyph loader (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.c b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.c
index a9c1e2834aa..a2832e55c7f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.c
@@ -4,7 +4,7 @@
*
* FreeType PFR loader (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -565,7 +565,7 @@
if ( phy_font->font_id )
goto Exit;
- if ( FT_QALLOC( phy_font->font_id, len + 1 ) )
+ if ( FT_ALLOC( phy_font->font_id, len + 1 ) )
goto Exit;
/* copy font ID name, and terminate it for safety */
@@ -601,7 +601,7 @@
PFR_CHECK( count * 2 );
- if ( FT_QNEW_ARRAY( snaps, count ) )
+ if ( FT_NEW_ARRAY( snaps, count ) )
goto Exit;
phy_font->vertical.stem_snaps = snaps;
@@ -761,7 +761,7 @@
if ( ok )
{
- if ( FT_QALLOC( result, len + 1 ) )
+ if ( FT_ALLOC( result, len + 1 ) )
goto Exit;
FT_MEM_COPY( result, p, len );
@@ -953,7 +953,7 @@
PFR_CHECK( count * 2 );
- if ( FT_QNEW_ARRAY( phy_font->blue_values, count ) )
+ if ( FT_NEW_ARRAY( phy_font->blue_values, count ) )
goto Fail;
for ( n = 0; n < count; n++ )
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.h
index 4f467d1bad9..7615b9ce148 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrload.h
@@ -4,7 +4,7 @@
*
* FreeType PFR loader (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c
index 5302fac4cf6..918e7fd4960 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
*
* FreeType PFR object methods (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -213,7 +213,7 @@
FT_Memory memory = pfrface->stream->memory;
- if ( FT_QNEW_ARRAY( pfrface->available_sizes, count ) )
+ if ( FT_NEW_ARRAY( pfrface->available_sizes, count ) )
goto Exit;
size = pfrface->available_sizes;
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.h
index 70b05395b8b..808822f1c4f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.h
@@ -4,7 +4,7 @@
*
* FreeType PFR object methods (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.c b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.c
index 255fd587726..a6691e6d183 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.c
@@ -4,7 +4,7 @@
*
* FreeType PFR bitmap loader (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -310,8 +310,8 @@
if ( lim > limit )
{
FT_TRACE0(( "pfr_lookup_bitmap_data:"
- " number of bitmap records too large,\n" ));
- FT_TRACE0(( " "
+ " number of bitmap records too large,\n"
+ " "
" thus ignoring all bitmaps in this strike\n" ));
*flags &= ~PFR_BITMAP_VALID_CHARCODES;
}
@@ -328,8 +328,8 @@
if ( (FT_Long)code <= prev_code )
{
FT_TRACE0(( "pfr_lookup_bitmap_data:"
- " bitmap records are not sorted,\n" ));
- FT_TRACE0(( " "
+ " bitmap records are not sorted,\n"
+ " "
" thus ignoring all bitmaps in this strike\n" ));
*flags &= ~PFR_BITMAP_VALID_CHARCODES;
break;
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.h
index f50d8013aa9..8cb0de0d25d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrsbit.h
@@ -4,7 +4,7 @@
*
* FreeType PFR bitmap loader (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h
index dff3b464494..06fb82d51a3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h
@@ -4,7 +4,7 @@
*
* FreeType PFR data structures (specification only).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/rules.mk b/Build/source/libs/freetype2/freetype-src/src/pfr/rules.mk
index 00c791f11c8..a1fe82baffb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2002-2021 by
+# Copyright (C) 2002-2020 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/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c
index 0ad1760518e..2d6a0d9a121 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
*
* AFM parser (body).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -29,16 +29,6 @@
/**************************************************************************
*
- * 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 afmparse
-
-
- /**************************************************************************
- *
* AFM_Stream
*
* The use of AFM_Stream is largely inspired by parseAFM.[ch] from t1lib.
@@ -596,39 +586,21 @@
static FT_Error
afm_parse_track_kern( AFM_Parser parser )
{
- AFM_FontInfo fi = parser->FontInfo;
- AFM_Stream stream = parser->stream;
+ AFM_FontInfo fi = parser->FontInfo;
AFM_TrackKern tk;
-
- char* key;
- FT_Offset len;
- int n = -1;
- FT_Int tmp;
+ char* key;
+ FT_Offset len;
+ int n = -1;
+ FT_Int tmp;
if ( afm_parser_read_int( parser, &tmp ) )
goto Fail;
if ( tmp < 0 )
- {
- FT_ERROR(( "afm_parse_track_kern: invalid number of track kerns\n" ));
goto Fail;
- }
fi->NumTrackKern = (FT_UInt)tmp;
- FT_TRACE3(( "afm_parse_track_kern: %u track kern%s expected\n",
- fi->NumTrackKern,
- fi->NumTrackKern == 1 ? "" : "s" ));
-
- /* Rough sanity check: The minimum line length of the `TrackKern` */
- /* command is 20 characters (including the EOL character). */
- if ( (FT_ULong)( stream->limit - stream->cursor ) / 20 <
- fi->NumTrackKern )
- {
- FT_ERROR(( "afm_parse_track_kern:"
- " number of track kern entries exceeds stream size\n" ));
- goto Fail;
- }
if ( fi->NumTrackKern )
{
@@ -651,10 +623,7 @@
n++;
if ( n >= (int)fi->NumTrackKern )
- {
- FT_ERROR(( "afm_parse_track_kern: too many track kern data\n" ));
- goto Fail;
- }
+ goto Fail;
tk = fi->TrackKerns + n;
@@ -664,12 +633,7 @@
shared_vals[3].type = AFM_VALUE_TYPE_FIXED;
shared_vals[4].type = AFM_VALUE_TYPE_FIXED;
if ( afm_parser_read_vals( parser, shared_vals, 5 ) != 5 )
- {
- FT_ERROR(( "afm_parse_track_kern:"
- " insufficient number of parameters for entry %d\n",
- n ));
goto Fail;
- }
tk->degree = shared_vals[0].u.i;
tk->min_ptsize = shared_vals[1].u.f;
@@ -682,19 +646,7 @@
case AFM_TOKEN_ENDTRACKKERN:
case AFM_TOKEN_ENDKERNDATA:
case AFM_TOKEN_ENDFONTMETRICS:
- tmp = n + 1;
- if ( (FT_UInt)tmp != fi->NumTrackKern )
- {
- FT_TRACE1(( "afm_parse_track_kern: %s%d track kern entr%s seen\n",
- tmp == 0 ? "" : "only ",
- tmp,
- tmp == 1 ? "y" : "ies" ));
- fi->NumTrackKern = (FT_UInt)tmp;
- }
- else
- FT_TRACE3(( "afm_parse_track_kern: %d track kern entr%s seen\n",
- tmp,
- tmp == 1 ? "y" : "ies" ));
+ fi->NumTrackKern = (FT_UInt)( n + 1 );
return FT_Err_Ok;
case AFM_TOKEN_UNKNOWN:
@@ -715,7 +667,7 @@
/* compare two kerning pairs */
- FT_COMPARE_DEF( int )
+ FT_CALLBACK_DEF( int )
afm_compare_kern_pairs( const void* a,
const void* b )
{
@@ -738,8 +690,7 @@
static FT_Error
afm_parse_kern_pairs( AFM_Parser parser )
{
- AFM_FontInfo fi = parser->FontInfo;
- AFM_Stream stream = parser->stream;
+ AFM_FontInfo fi = parser->FontInfo;
AFM_KernPair kp;
char* key;
FT_Offset len;
@@ -751,26 +702,9 @@
goto Fail;
if ( tmp < 0 )
- {
- FT_ERROR(( "afm_parse_kern_pairs: invalid number of kern pairs\n" ));
goto Fail;
- }
fi->NumKernPair = (FT_UInt)tmp;
- FT_TRACE3(( "afm_parse_kern_pairs: %u kern pair%s expected\n",
- fi->NumKernPair,
- fi->NumKernPair == 1 ? "" : "s" ));
-
- /* Rough sanity check: The minimum line length of the `KP`, */
- /* `KPH`,`KPX`, and `KPY` commands is 10 characters (including */
- /* the EOL character). */
- if ( (FT_ULong)( stream->limit - stream->cursor ) / 10 <
- fi->NumKernPair )
- {
- FT_ERROR(( "afm_parse_kern_pairs:"
- " number of kern pairs exceeds stream size\n" ));
- goto Fail;
- }
if ( fi->NumKernPair )
{
@@ -800,10 +734,7 @@
n++;
if ( n >= (int)fi->NumKernPair )
- {
- FT_ERROR(( "afm_parse_kern_pairs: too many kern pairs\n" ));
goto Fail;
- }
kp = fi->KernPairs + n;
@@ -813,12 +744,7 @@
shared_vals[3].type = AFM_VALUE_TYPE_INTEGER;
r = afm_parser_read_vals( parser, shared_vals, 4 );
if ( r < 3 )
- {
- FT_ERROR(( "afm_parse_kern_pairs:"
- " insufficient number of parameters for entry %d\n",
- n ));
goto Fail;
- }
/* index values can't be negative */
kp->index1 = shared_vals[0].u.u;
@@ -840,20 +766,7 @@
case AFM_TOKEN_ENDKERNPAIRS:
case AFM_TOKEN_ENDKERNDATA:
case AFM_TOKEN_ENDFONTMETRICS:
- tmp = n + 1;
- if ( (FT_UInt)tmp != fi->NumKernPair )
- {
- FT_TRACE1(( "afm_parse_kern_pairs: %s%d kern pair%s seen\n",
- tmp == 0 ? "" : "only ",
- tmp,
- tmp == 1 ? "" : "s" ));
- fi->NumKernPair = (FT_UInt)tmp;
- }
- else
- FT_TRACE3(( "afm_parse_kern_pairs: %d kern pair%s seen\n",
- tmp,
- tmp == 1 ? "" : "s" ));
-
+ fi->NumKernPair = (FT_UInt)( n + 1 );
ft_qsort( fi->KernPairs, fi->NumKernPair,
sizeof ( AFM_KernPairRec ),
afm_compare_kern_pairs );
@@ -879,43 +792,22 @@
char* key;
FT_Offset len;
- int have_trackkern = 0;
- int have_kernpairs = 0;
-
while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
{
switch ( afm_tokenize( key, len ) )
{
case AFM_TOKEN_STARTTRACKKERN:
- if ( have_trackkern )
- {
- FT_ERROR(( "afm_parse_kern_data:"
- " invalid second horizontal track kern section\n" ));
- goto Fail;
- }
-
error = afm_parse_track_kern( parser );
if ( error )
return error;
-
- have_trackkern = 1;
break;
case AFM_TOKEN_STARTKERNPAIRS:
case AFM_TOKEN_STARTKERNPAIRS0:
- if ( have_kernpairs )
- {
- FT_ERROR(( "afm_parse_kern_data:"
- " invalid second horizontal kern pair section\n" ));
- goto Fail;
- }
-
error = afm_parse_kern_pairs( parser );
if ( error )
return error;
-
- have_kernpairs = 1;
break;
case AFM_TOKEN_ENDKERNDATA:
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h
index 44b05b2cacb..16a3a3e902d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h
@@ -4,7 +4,7 @@
*
* AFM parser (specification).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c
index 3498f670c79..3d2da1e03ca 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c
@@ -4,7 +4,7 @@
*
* PostScript CFF (Type 2) decoding routines (body).
*
- * Copyright (C) 2017-2021 by
+ * Copyright (C) 2017-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -2153,7 +2153,7 @@
decoder->locals_bias );
- FT_TRACE4(( " callsubr (idx %d, entering level %ld)\n",
+ FT_TRACE4(( " callsubr (idx %d, entering level %d)\n",
idx,
zone - decoder->zones + 1 ));
@@ -2197,7 +2197,7 @@
decoder->globals_bias );
- FT_TRACE4(( " callgsubr (idx %d, entering level %ld)\n",
+ FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n",
idx,
zone - decoder->zones + 1 ));
@@ -2236,7 +2236,7 @@
break;
case cff_op_return:
- FT_TRACE4(( " return (leaving level %ld)\n",
+ FT_TRACE4(( " return (leaving level %d)\n",
decoder->zone - decoder->zones ));
if ( decoder->zone <= decoder->zones )
@@ -2271,8 +2271,7 @@
} /* while ip < limit */
- FT_TRACE4(( "..end..\n" ));
- FT_TRACE4(( "\n" ));
+ FT_TRACE4(( "..end..\n\n" ));
Fail:
return error;
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h
index b1314ed1c1e..77a4962698b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h
@@ -4,7 +4,7 @@
*
* PostScript CFF (Type 2) decoding routines (specification).
*
- * Copyright (C) 2017-2021 by
+ * Copyright (C) 2017-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk b/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk
index 06f7e72c1c9..651db014263 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.c
index 70313d283a4..8751d275fb9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.c
@@ -65,6 +65,7 @@
arrstack->error = error;
arrstack->sizeItem = sizeItem;
arrstack->allocated = 0;
+ arrstack->chunk = 10; /* chunks of 10 items */
arrstack->count = 0;
arrstack->totalSize = 0;
arrstack->ptr = NULL;
@@ -109,7 +110,7 @@
FT_ASSERT( newSize > 0 ); /* avoid realloc with zero size */
- if ( !FT_QREALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
+ if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
{
arrstack->allocated = numElements;
arrstack->totalSize = newSize;
@@ -215,9 +216,9 @@
if ( arrstack->count == arrstack->allocated )
{
- /* increase the buffer size */
+ /* grow the buffer by one chunk */
if ( !cf2_arrstack_setNumElements(
- arrstack, arrstack->allocated * 2 + 16 ) )
+ arrstack, arrstack->allocated + arrstack->chunk ) )
{
/* on error, ignore the push */
return;
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h
index 31e5330cc38..098617b2575 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h
@@ -55,6 +55,7 @@ FT_BEGIN_HEADER
size_t sizeItem; /* bytes per element */
size_t allocated; /* items allocated */
+ size_t chunk; /* allocation increment in items */
size_t count; /* number of elements allocated */
size_t totalSize; /* total bytes allocated */
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c
index 2960c8b696b..f4282222a68 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c
@@ -4,7 +4,7 @@
*
* FreeType auxiliary PostScript driver component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h
index e8ee29166cf..8b9a958aec0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h
@@ -4,7 +4,7 @@
*
* PS auxiliary module error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c
index 52da23365ed..e73ba224517 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c
@@ -4,7 +4,7 @@
*
* FreeType auxiliary PostScript module implementation (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h
index e3e80632206..a6bebe4b945 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h
@@ -4,7 +4,7 @@
*
* FreeType auxiliary PostScript module implementation (specification).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psblues.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psblues.c
index f9c864fea9a..3878e9bde04 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psblues.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psblues.c
@@ -506,8 +506,7 @@
/* guarantee minimum of 1 pixel overshoot */
dsNew = FT_MIN(
cf2_fixedRound( bottomHintEdge->dsCoord ),
- SUB_INT32( blues->zone[i].dsFlatEdge,
- cf2_intToFixed( 1 ) ) );
+ blues->zone[i].dsFlatEdge - cf2_intToFixed( 1 ) );
}
else
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c
index c28d65df297..4cf5cd5d881 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c
@@ -4,7 +4,7 @@
*
* Some convenience conversions (body).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h
index cd91a7bb563..833e8273648 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h
@@ -4,7 +4,7 @@
*
* Some convenience conversions (specification).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/pshints.c b/Build/source/libs/freetype2/freetype-src/src/psaux/pshints.c
index ad472c98df5..ce8cfca7154 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/pshints.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/pshints.c
@@ -412,12 +412,6 @@
{
FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] );
- /* final amount to move edge or edge pair */
- CF2_Fixed move = 0;
-
- CF2_Fixed dsCoord_i;
- CF2_Fixed dsCoord_j;
-
/* index of upper edge (same value for ghost hint) */
j = isPair ? i + 1 : i;
@@ -428,14 +422,11 @@
FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) ==
cf2_hint_isLocked( &hintmap->edge[j] ) );
- dsCoord_i = hintmap->edge[i].dsCoord;
- dsCoord_j = hintmap->edge[j].dsCoord;
-
if ( !cf2_hint_isLocked( &hintmap->edge[i] ) )
{
/* hint edge is not locked, we can adjust it */
- CF2_Fixed fracDown = cf2_fixedFraction( dsCoord_i );
- CF2_Fixed fracUp = cf2_fixedFraction( dsCoord_j );
+ CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord );
+ CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord );
/* calculate all four possibilities; moves down are negative */
CF2_Fixed downMoveDown = 0 - fracDown;
@@ -452,6 +443,9 @@
/* smallest move down */
CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown );
+ /* final amount to move edge or edge pair */
+ CF2_Fixed move;
+
CF2_Fixed downMinCounter = CF2_MIN_COUNTER;
CF2_Fixed upMinCounter = CF2_MIN_COUNTER;
FT_Bool saveEdge = FALSE;
@@ -473,14 +467,16 @@
/* is there room to move up? */
/* there is if we are at top of array or the next edge is at or */
/* beyond proposed move up? */
- if ( j >= hintmap->count - 1 ||
+ if ( j >= hintmap->count - 1 ||
hintmap->edge[j + 1].dsCoord >=
- ADD_INT32( dsCoord_j, moveUp + upMinCounter ) )
+ ADD_INT32( hintmap->edge[j].dsCoord,
+ moveUp + upMinCounter ) )
{
/* there is room to move up; is there also room to move down? */
- if ( i == 0 ||
+ if ( i == 0 ||
hintmap->edge[i - 1].dsCoord <=
- ADD_INT32( dsCoord_i, moveDown - downMinCounter ) )
+ ADD_INT32( hintmap->edge[i].dsCoord,
+ moveDown - downMinCounter ) )
{
/* move smaller absolute amount */
move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */
@@ -491,9 +487,10 @@
else
{
/* is there room to move down? */
- if ( i == 0 ||
+ if ( i == 0 ||
hintmap->edge[i - 1].dsCoord <=
- ADD_INT32( dsCoord_i, moveDown - downMinCounter ) )
+ ADD_INT32( hintmap->edge[i].dsCoord,
+ moveDown - downMinCounter ) )
{
move = moveDown;
/* true if non-optimum move */
@@ -527,21 +524,17 @@
}
/* move the edge(s) */
- hintmap->edge[i].dsCoord = ADD_INT32( dsCoord_i, move );
+ hintmap->edge[i].dsCoord = ADD_INT32( hintmap->edge[i].dsCoord,
+ move );
if ( isPair )
- hintmap->edge[j].dsCoord = ADD_INT32( dsCoord_j, move );
+ hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord,
+ move );
}
- /* assert there are no overlaps in device space; */
- /* ignore tests if there was overflow (that is, if */
- /* operands have the same sign but the sum does not) */
+ /* assert there are no overlaps in device space */
FT_ASSERT( i == 0 ||
- ( ( dsCoord_i ^ move ) >= 0 &&
- ( dsCoord_i ^ hintmap->edge[i].dsCoord ) < 0 ) ||
hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord );
FT_ASSERT( i < j ||
- ( ( dsCoord_j ^ move ) >= 0 &&
- ( dsCoord_j ^ hintmap->edge[j].dsCoord ) < 0 ) ||
hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord );
/* adjust the scales, avoiding divide by zero */
@@ -1029,17 +1022,10 @@
}
}
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( initialMap )
- {
- FT_TRACE6(( "flags: [p]air [g]host [t]op"
- " [b]ottom [L]ocked [S]ynthetic\n" ));
- FT_TRACE6(( "Initial hintmap" ));
- }
- else
- FT_TRACE6(( "Hints:" ));
-#endif
-
+ FT_TRACE6(( "%s\n", initialMap ? "flags: [p]air [g]host [t]op"
+ " [b]ottom [L]ocked [S]ynthetic\n"
+ "Initial hintmap"
+ : "Hints:" ));
cf2_hintmap_dump( hintmap );
/*
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c
index 40e92766389..519c6944475 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c
@@ -1340,9 +1340,9 @@
if ( decoder->glyph_names == 0 )
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
- FT_ERROR(( "cf2_interpT2CharString:\n" ));
- FT_ERROR(( " (Type 1 seac) glyph names table"
- " not available in this font\n" ));
+ FT_ERROR((
+ "cf2_interpT2CharString: (Type 1 seac)"
+ " glyph names table not available in this font\n" ));
lastError = FT_THROW( Invalid_Glyph_Format );
goto exit;
}
@@ -1368,9 +1368,9 @@
if ( bchar_index < 0 || achar_index < 0 )
{
- FT_ERROR(( "cf2_interpT2CharString:\n" ));
- FT_ERROR(( " (Type 1 seac) invalid"
- " seac character code arguments\n" ));
+ FT_ERROR((
+ "cf2_interpT2CharString: (Type 1 seac)"
+ " invalid seac character code arguments\n" ));
lastError = FT_THROW( Invalid_Glyph_Format );
goto exit;
}
@@ -1670,13 +1670,7 @@
*/
count = cf2_stack_count( opStack );
- if ( (CF2_UInt)arg_cnt > count )
- {
- FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
- " stack underflow\n" ));
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit;
- }
+ FT_ASSERT( (CF2_UInt)arg_cnt <= count );
opIdx += count - (CF2_UInt)arg_cnt;
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c
index 30f501916a6..defc4d4fcee 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
*
* Auxiliary functions for PostScript fonts (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -251,7 +251,7 @@
if ( !old_base )
return;
- if ( FT_QALLOC( table->block, table->cursor ) )
+ if ( FT_ALLOC( table->block, table->cursor ) )
return;
FT_MEM_COPY( table->block, old_base, table->cursor );
shift_elements( table, old_base );
@@ -595,10 +595,10 @@
if ( cur < limit && cur == parser->cursor )
{
FT_ERROR(( "ps_parser_skip_PS_token:"
- " current token is `%c' which is self-delimiting\n",
+ " current token is `%c' which is self-delimiting\n"
+ " "
+ " but invalid at this point\n",
*cur ));
- FT_ERROR(( " "
- " but invalid at this point\n" ));
error = FT_THROW( Invalid_File_Format );
}
@@ -979,7 +979,7 @@
}
len = (FT_UInt)( cur - *cursor );
- if ( cur >= limit || FT_QALLOC( result, len + 1 ) )
+ if ( cur >= limit || FT_ALLOC( result, len + 1 ) )
return 0;
/* now copy the string */
@@ -1175,8 +1175,8 @@
else
{
FT_ERROR(( "ps_parser_load_field:"
- " expected a name or string\n" ));
- FT_ERROR(( " "
+ " expected a name or string\n"
+ " "
" but found token of type %d instead\n",
token.type ));
error = FT_THROW( Invalid_File_Format );
@@ -1193,7 +1193,7 @@
*(FT_String**)q = NULL;
}
- if ( FT_QALLOC( string, len + 1 ) )
+ if ( FT_ALLOC( string, len + 1 ) )
goto Exit;
FT_MEM_COPY( string, cur, len );
@@ -1248,7 +1248,7 @@
FT_UInt i;
- if ( FT_QNEW_ARRAY( temp, max_objects * 4 ) )
+ if ( FT_NEW_ARRAY( temp, max_objects * 4 ) )
goto Exit;
for ( i = 0; i < 4; i++ )
@@ -1258,14 +1258,14 @@
if ( result < 0 || (FT_UInt)result < max_objects )
{
FT_ERROR(( "ps_parser_load_field:"
- " expected %d integer%s in the %s subarray\n",
+ " expected %d integer%s in the %s subarray\n"
+ " "
+ " of /FontBBox in the /Blend dictionary\n",
max_objects, max_objects > 1 ? "s" : "",
i == 0 ? "first"
: ( i == 1 ? "second"
: ( i == 2 ? "third"
: "fourth" ) ) ));
- FT_ERROR(( " "
- " of /FontBBox in the /Blend dictionary\n" ));
error = FT_THROW( Invalid_File_Format );
FT_FREE( temp );
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h
index 99d16959a73..fdad672b6d2 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h
@@ -4,7 +4,7 @@
*
* Auxiliary functions for PostScript fonts (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c
index bc8888c3ab3..7ae5256ef19 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c
@@ -59,14 +59,15 @@
CF2_Stack stack = NULL;
- if ( FT_QNEW( stack ) )
+ if ( FT_NEW( stack ) )
return NULL;
+ /* initialize the structure; FT_NEW zeroes it */
stack->memory = memory;
stack->error = e;
/* allocate the stack buffer */
- if ( FT_QNEW_ARRAY( stack->buffer, stackSize ) )
+ if ( FT_NEW_ARRAY( stack->buffer, stackSize ) )
{
FT_FREE( stack );
return NULL;
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk b/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk
index 05439120dd2..f49aecbc794 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c
index 3e7c577a18c..e21e93ca268 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c
@@ -4,7 +4,7 @@
*
* Type 1 character map support (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h
index 8f69600ca40..031796510f7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h
@@ -4,7 +4,7 @@
*
* Type 1 character map support (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c
index ee1cb263449..2ed27ca19ef 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
*
* PostScript Type 1 decoding routines (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -517,7 +517,7 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( bol )
{
- FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
+ FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
bol = FALSE;
}
#endif
@@ -1162,9 +1162,9 @@
if ( top - decoder->stack != num_args )
FT_TRACE0(( "t1_decoder_parse_charstrings:"
" too much operands on the stack"
- " (seen %ld, expected %d)\n",
+ " (seen %d, expected %d)\n",
top - decoder->stack, num_args ));
- break;
+ break;
}
#endif /* FT_DEBUG_LEVEL_TRACE */
@@ -1209,7 +1209,7 @@
FT_TRACE4(( "BuildCharArray = [ " ));
for ( i = 0; i < decoder->len_buildchar; i++ )
- FT_TRACE4(( "%ld ", decoder->buildchar[i] ));
+ FT_TRACE4(( "%d ", decoder->buildchar[i] ));
FT_TRACE4(( "]\n" ));
}
@@ -1650,8 +1650,7 @@
} /* while ip < limit */
- FT_TRACE4(( "..end..\n" ));
- FT_TRACE4(( "\n" ));
+ FT_TRACE4(( "..end..\n\n" ));
Fail:
return error;
@@ -2071,8 +2070,7 @@
} /* while ip < limit */
- FT_TRACE4(( "..end..\n" ));
- FT_TRACE4(( "\n" ));
+ FT_TRACE4(( "..end..\n\n" ));
No_Width:
FT_ERROR(( "t1_decoder_parse_metrics:"
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h
index eea9d34b042..b793504ac6a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h
@@ -4,7 +4,7 @@
*
* PostScript Type 1 decoding routines (specification).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/module.mk b/Build/source/libs/freetype2/freetype-src/src/pshinter/module.mk
index ca181ee6bf1..b440d2e76a2 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c
index 79763ecd943..920b9a74b5f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
*
* PostScript hinting algorithm (body).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h
index 1bc5294072d..5367a5d1648 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h
@@ -4,7 +4,7 @@
*
* PostScript hinting algorithm (specification).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.c b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.c
index 2ca0f665c60..cdc1c3af0e9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
* PostScript hinter global hinting management (body).
* Inspired by the new auto-hinter module.
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.h b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.h
index a8f9953fa08..8181324e5ee 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshglob.h
@@ -4,7 +4,7 @@
*
* PostScript hinter global hinting management.
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshinter.c b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshinter.c
index 705143dcdcb..3cca0ad7c23 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshinter.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshinter.c
@@ -4,7 +4,7 @@
*
* FreeType PostScript Hinting module
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.c b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.c
index 6674041f7ec..e0abd386f9f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.c
@@ -4,7 +4,7 @@
*
* FreeType PostScript hinter module implementation (body).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.h b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.h
index 8b229bb0771..2a6eb1c4697 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshmod.h
@@ -4,7 +4,7 @@
*
* PostScript hinter module interface (specification).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshnterr.h b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshnterr.h
index 567d765132d..d67955c4102 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshnterr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshnterr.h
@@ -4,7 +4,7 @@
*
* PS Hinter error codes (specification only).
*
- * Copyright (C) 2003-2021 by
+ * Copyright (C) 2003-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c
index a108734d49d..bddccf2a6eb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c
@@ -4,7 +4,7 @@
*
* FreeType PostScript hints recorder (body).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.h b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.h
index e483981d9d9..b13c7be13ce 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.h
@@ -4,7 +4,7 @@
*
* Postscript (Type1/Type2) hints recorder (specification).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/rules.mk b/Build/source/libs/freetype2/freetype-src/src/pshinter/rules.mk
index 3c5a59a8072..c845c255cd4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2001-2021 by
+# Copyright (C) 2001-2020 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/Build/source/libs/freetype2/freetype-src/src/psnames/module.mk b/Build/source/libs/freetype2/freetype-src/src/psnames/module.mk
index abfb54ffc68..675bb371313 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psnames/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/psnames/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c b/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c
index fff9c42a37d..b38f9d3b1cd 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c
@@ -4,7 +4,7 @@
*
* psnames module implementation (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -155,30 +155,31 @@
/* Look for a non-initial dot in the glyph name in order to */
/* find variants like `A.swash', `e.final', etc. */
{
- FT_UInt32 value = 0;
- const char* p = glyph_name;
-
+ const char* p = glyph_name;
+ const char* dot = NULL;
- for ( ; *p && *p != '.'; p++ )
- ;
- /* now look up the glyph in the Adobe Glyph List; */
- /* `.notdef', `.null' and the empty name are short cut */
- if ( p > glyph_name )
+ for ( ; *p; p++ )
{
- value = (FT_UInt32)ft_get_adobe_glyph_index( glyph_name, p );
-
- if ( *p == '.' )
- value |= (FT_UInt32)VARIANT_BIT;
+ if ( *p == '.' && p > glyph_name )
+ {
+ dot = p;
+ break;
+ }
}
- return value;
+ /* now look up the glyph in the Adobe Glyph List */
+ if ( !dot )
+ return (FT_UInt32)ft_get_adobe_glyph_index( glyph_name, p );
+ else
+ return (FT_UInt32)( ft_get_adobe_glyph_index( glyph_name, dot ) |
+ VARIANT_BIT );
}
}
/* ft_qsort callback to sort the unicode map */
- FT_COMPARE_DEF( int )
+ FT_CALLBACK_DEF( int )
compare_uni_maps( const void* a,
const void* b )
{
@@ -327,7 +328,7 @@
table->num_maps = 0;
table->maps = NULL;
- if ( !FT_QNEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
+ if ( !FT_NEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
{
FT_UInt n;
FT_UInt count;
@@ -342,7 +343,7 @@
const char* gname = get_glyph_name( glyph_data, n );
- if ( gname && *gname )
+ if ( gname )
{
ps_check_extra_glyph_name( gname, n,
extra_glyphs, extra_glyph_list_states );
@@ -390,9 +391,9 @@
/* Reallocate if the number of used entries is much smaller. */
if ( count < num_glyphs / 2 )
{
- (void)FT_QRENEW_ARRAY( table->maps,
- num_glyphs + EXTRA_GLYPH_LIST_SIZE,
- count );
+ (void)FT_RENEW_ARRAY( table->maps,
+ num_glyphs + EXTRA_GLYPH_LIST_SIZE,
+ count );
error = FT_Err_Ok;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.h b/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.h
index e92a975e9db..c85a9ecad7a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.h
@@ -4,7 +4,7 @@
*
* High-level psnames module interface (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psnames/psnamerr.h b/Build/source/libs/freetype2/freetype-src/src/psnames/psnamerr.h
index 888b76c4f61..154c701d040 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psnames/psnamerr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psnames/psnamerr.h
@@ -4,7 +4,7 @@
*
* PS names module error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psnames/psnames.c b/Build/source/libs/freetype2/freetype-src/src/psnames/psnames.c
index e7be6707d62..cff36851baa 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psnames/psnames.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psnames/psnames.c
@@ -4,7 +4,7 @@
*
* FreeType psnames module component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psnames/pstables.h b/Build/source/libs/freetype2/freetype-src/src/psnames/pstables.h
index 0bcadca9cc1..c215f16ffcf 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psnames/pstables.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psnames/pstables.h
@@ -4,7 +4,7 @@
*
* PostScript glyph names.
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psnames/rules.mk b/Build/source/libs/freetype2/freetype-src/src/psnames/rules.mk
index 6694f4eb6c3..14cdda3ad1e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psnames/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/psnames/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h b/Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h
index 9de0b126993..6efe4a9a5a2 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h
@@ -5,7 +5,7 @@
* Miscellaneous macros for stand-alone rasterizer (specification
* only).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c b/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c
index fbcf8d22a21..9f0a7976fad 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c
@@ -4,7 +4,7 @@
*
* The FreeType glyph rasterizer (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -149,6 +149,9 @@
/*************************************************************************/
/*************************************************************************/
+ /* define DEBUG_RASTER if you want to compile a debugging version */
+/* #define DEBUG_RASTER */
+
/*************************************************************************/
/*************************************************************************/
@@ -197,13 +200,12 @@
#define FT_THROW( e ) FT_ERR_CAT( Raster_Err_, e )
#endif
-#define Raster_Err_Ok 0
-#define Raster_Err_Invalid_Outline -1
-#define Raster_Err_Cannot_Render_Glyph -2
-#define Raster_Err_Invalid_Argument -3
-#define Raster_Err_Raster_Overflow -4
-#define Raster_Err_Raster_Uninitialized -5
-#define Raster_Err_Raster_Negative_Height -6
+#define Raster_Err_None 0
+#define Raster_Err_Not_Ini -1
+#define Raster_Err_Overflow -2
+#define Raster_Err_Neg_Height -3
+#define Raster_Err_Invalid -4
+#define Raster_Err_Unsupported -5
#define ft_memset memset
@@ -228,6 +230,13 @@
#include "rasterrs.h"
+#define Raster_Err_None FT_Err_Ok
+#define Raster_Err_Not_Ini Raster_Err_Raster_Uninitialized
+#define Raster_Err_Overflow Raster_Err_Raster_Overflow
+#define Raster_Err_Neg_Height Raster_Err_Raster_Negative_Height
+#define Raster_Err_Invalid Raster_Err_Invalid_Outline
+#define Raster_Err_Unsupported Raster_Err_Cannot_Render_Glyph
+
#endif /* !STANDALONE_ */
@@ -366,6 +375,16 @@
typedef PProfile* PProfileList;
+ /* Simple record used to implement a stack of bands, required */
+ /* by the sub-banding mechanism */
+ typedef struct black_TBand_
+ {
+ Short y_min; /* band's minimum */
+ Short y_max; /* band's maximum */
+
+ } black_TBand;
+
+
#define AlignProfileSize \
( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( Long ) )
@@ -407,8 +426,8 @@
/* prototypes used for sweep function dispatch */
typedef void
- Function_Sweep_Init( RAS_ARGS Short min,
- Short max );
+ Function_Sweep_Init( RAS_ARGS Short* min,
+ Short* max );
typedef void
Function_Sweep_Span( RAS_ARGS Short y,
@@ -473,11 +492,10 @@
Int numTurns; /* number of Y-turns in outline */
- Byte dropOutControl; /* current drop_out control method */
+ TPoint* arc; /* current Bezier arc pointer */
UShort bWidth; /* target bitmap width */
PByte bOrigin; /* target bitmap bottom-left origin */
- PByte bLine; /* target bitmap current line */
Long lastX, lastY;
Long minY, maxY;
@@ -499,6 +517,9 @@
FT_Bitmap target; /* description of target bit/pixmap */
FT_Outline outline;
+ Long traceOfs; /* current offset in target bitmap */
+ Short traceIncr; /* sweep's increment in target bitmap */
+
/* dispatch variables */
Function_Sweep_Init* Proc_Sweep_Init;
@@ -506,6 +527,18 @@
Function_Sweep_Span* Proc_Sweep_Drop;
Function_Sweep_Step* Proc_Sweep_Step;
+ Byte dropOutControl; /* current drop_out control method */
+
+ Bool second_pass; /* indicates whether a horizontal pass */
+ /* should be performed to control */
+ /* drop-out accurately when calling */
+ /* Render_Glyph. */
+
+ TPoint arcs[3 * MaxBezier + 1]; /* The Bezier stack */
+
+ black_TBand band_stack[16]; /* band stack used for sub-banding */
+ Int band_top; /* band stack top */
+
};
@@ -627,7 +660,7 @@
if ( ras.top >= ras.maxBuff )
{
- ras.error = FT_THROW( Raster_Overflow );
+ ras.error = FT_THROW( Overflow );
return FAILURE;
}
@@ -656,7 +689,7 @@
default:
FT_ERROR(( "New_Profile: invalid profile direction\n" ));
- ras.error = FT_THROW( Invalid_Outline );
+ ras.error = FT_THROW( Invalid );
return FAILURE;
}
@@ -698,7 +731,7 @@
if ( h < 0 )
{
FT_ERROR(( "End_Profile: negative height encountered\n" ));
- ras.error = FT_THROW( Raster_Negative_Height );
+ ras.error = FT_THROW( Neg_Height );
return FAILURE;
}
@@ -734,7 +767,7 @@
if ( ras.top >= ras.maxBuff )
{
FT_TRACE1(( "overflow in End_Profile\n" ));
- ras.error = FT_THROW( Raster_Overflow );
+ ras.error = FT_THROW( Overflow );
return FAILURE;
}
@@ -789,7 +822,7 @@
ras.maxBuff--;
if ( ras.maxBuff <= ras.top )
{
- ras.error = FT_THROW( Raster_Overflow );
+ ras.error = FT_THROW( Overflow );
return FAILURE;
}
ras.numTurns++;
@@ -1053,7 +1086,7 @@
size = e2 - e1 + 1;
if ( ras.top + size >= ras.maxBuff )
{
- ras.error = FT_THROW( Raster_Overflow );
+ ras.error = FT_THROW( Overflow );
return FAILURE;
}
@@ -1176,7 +1209,6 @@
*/
static Bool
Bezier_Up( RAS_ARGS Int degree,
- TPoint* arc,
TSplitter splitter,
Long miny,
Long maxy )
@@ -1184,11 +1216,13 @@
Long y1, y2, e, e2, e0;
Short f1;
+ TPoint* arc;
TPoint* start_arc;
PLong top;
+ arc = ras.arc;
y1 = arc[degree].y;
y2 = arc[0].y;
top = ras.top;
@@ -1237,7 +1271,7 @@
if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )
{
ras.top = top;
- ras.error = FT_THROW( Raster_Overflow );
+ ras.error = FT_THROW( Overflow );
return FAILURE;
}
@@ -1280,6 +1314,7 @@
Fin:
ras.top = top;
+ ras.arc -= degree;
return SUCCESS;
}
@@ -1311,11 +1346,11 @@
*/
static Bool
Bezier_Down( RAS_ARGS Int degree,
- TPoint* arc,
TSplitter splitter,
Long miny,
Long maxy )
{
+ TPoint* arc = ras.arc;
Bool result, fresh;
@@ -1327,7 +1362,7 @@
fresh = ras.fresh;
- result = Bezier_Up( RAS_VARS degree, arc, splitter, -maxy, -miny );
+ result = Bezier_Up( RAS_VARS degree, splitter, -maxy, -miny );
if ( fresh && !ras.fresh )
ras.cProfile->start = -ras.cProfile->start;
@@ -1468,24 +1503,22 @@
{
Long y1, y2, y3, x3, ymin, ymax;
TStates state_bez;
- TPoint arcs[2 * MaxBezier + 1]; /* The Bezier stack */
- TPoint* arc; /* current Bezier arc pointer */
- arc = arcs;
- arc[2].x = ras.lastX;
- arc[2].y = ras.lastY;
- arc[1].x = cx;
- arc[1].y = cy;
- arc[0].x = x;
- arc[0].y = y;
+ ras.arc = ras.arcs;
+ ras.arc[2].x = ras.lastX;
+ ras.arc[2].y = ras.lastY;
+ ras.arc[1].x = cx;
+ ras.arc[1].y = cy;
+ ras.arc[0].x = x;
+ ras.arc[0].y = y;
do
{
- y1 = arc[2].y;
- y2 = arc[1].y;
- y3 = arc[0].y;
- x3 = arc[0].x;
+ y1 = ras.arc[2].y;
+ y2 = ras.arc[1].y;
+ y3 = ras.arc[0].y;
+ x3 = ras.arc[0].x;
/* first, categorize the Bezier arc */
@@ -1503,13 +1536,13 @@
if ( y2 < ymin || y2 > ymax )
{
/* this arc has no given direction, split it! */
- Split_Conic( arc );
- arc += 2;
+ Split_Conic( ras.arc );
+ ras.arc += 2;
}
else if ( y1 == y3 )
{
/* this arc is flat, ignore it and pop it from the Bezier stack */
- arc -= 2;
+ ras.arc -= 2;
}
else
{
@@ -1536,18 +1569,15 @@
/* now call the appropriate routine */
if ( state_bez == Ascending_State )
{
- if ( Bezier_Up( RAS_VARS 2, arc, Split_Conic,
- ras.minY, ras.maxY ) )
+ if ( Bezier_Up( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )
goto Fail;
}
else
- if ( Bezier_Down( RAS_VARS 2, arc, Split_Conic,
- ras.minY, ras.maxY ) )
+ if ( Bezier_Down( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )
goto Fail;
- arc -= 2;
}
- } while ( arc >= arcs );
+ } while ( ras.arc >= ras.arcs );
ras.lastX = x3;
ras.lastY = y3;
@@ -1602,27 +1632,25 @@
{
Long y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;
TStates state_bez;
- TPoint arcs[3 * MaxBezier + 1]; /* The Bezier stack */
- TPoint* arc; /* current Bezier arc pointer */
- arc = arcs;
- arc[3].x = ras.lastX;
- arc[3].y = ras.lastY;
- arc[2].x = cx1;
- arc[2].y = cy1;
- arc[1].x = cx2;
- arc[1].y = cy2;
- arc[0].x = x;
- arc[0].y = y;
+ ras.arc = ras.arcs;
+ ras.arc[3].x = ras.lastX;
+ ras.arc[3].y = ras.lastY;
+ ras.arc[2].x = cx1;
+ ras.arc[2].y = cy1;
+ ras.arc[1].x = cx2;
+ ras.arc[1].y = cy2;
+ ras.arc[0].x = x;
+ ras.arc[0].y = y;
do
{
- y1 = arc[3].y;
- y2 = arc[2].y;
- y3 = arc[1].y;
- y4 = arc[0].y;
- x4 = arc[0].x;
+ y1 = ras.arc[3].y;
+ y2 = ras.arc[2].y;
+ y3 = ras.arc[1].y;
+ y4 = ras.arc[0].y;
+ x4 = ras.arc[0].x;
/* first, categorize the Bezier arc */
@@ -1651,13 +1679,13 @@
if ( ymin2 < ymin1 || ymax2 > ymax1 )
{
/* this arc has no given direction, split it! */
- Split_Cubic( arc );
- arc += 3;
+ Split_Cubic( ras.arc );
+ ras.arc += 3;
}
else if ( y1 == y4 )
{
/* this arc is flat, ignore it and pop it from the Bezier stack */
- arc -= 3;
+ ras.arc -= 3;
}
else
{
@@ -1683,18 +1711,15 @@
/* compute intersections */
if ( state_bez == Ascending_State )
{
- if ( Bezier_Up( RAS_VARS 3, arc, Split_Cubic,
- ras.minY, ras.maxY ) )
+ if ( Bezier_Up( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )
goto Fail;
}
else
- if ( Bezier_Down( RAS_VARS 3, arc, Split_Cubic,
- ras.minY, ras.maxY ) )
+ if ( Bezier_Down( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )
goto Fail;
- arc -= 3;
}
- } while ( arc >= arcs );
+ } while ( ras.arc >= ras.arcs );
ras.lastX = x4;
ras.lastY = y4;
@@ -1942,7 +1967,7 @@
return SUCCESS;
Invalid_Outline:
- ras.error = FT_THROW( Invalid_Outline );
+ ras.error = FT_THROW( Invalid );
Fail:
return FAILURE;
@@ -2189,13 +2214,16 @@
*/
static void
- Vertical_Sweep_Init( RAS_ARGS Short min,
- Short max )
+ Vertical_Sweep_Init( RAS_ARGS Short* min,
+ Short* max )
{
+ Long pitch = ras.target.pitch;
+
FT_UNUSED( max );
- ras.bLine = ras.bOrigin - min * ras.target.pitch;
+ ras.traceIncr = (Short)-pitch;
+ ras.traceOfs = -*min * pitch;
}
@@ -2257,7 +2285,7 @@
f1 = (Byte) ( 0xFF >> ( e1 & 7 ) );
f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
- target = ras.bLine + c1;
+ target = ras.bOrigin + ras.traceOfs + c1;
c2 -= c1;
if ( c2 > 0 )
@@ -2409,8 +2437,8 @@
c1 = (Short)( e1 >> 3 );
f1 = (Short)( e1 & 7 );
- if ( e1 >= 0 && e1 < ras.bWidth &&
- ras.bLine[c1] & ( 0x80 >> f1 ) )
+ if ( e1 >= 0 && e1 < ras.bWidth &&
+ ras.bOrigin[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
goto Exit;
}
else
@@ -2426,7 +2454,7 @@
c1 = (Short)( e1 >> 3 );
f1 = (Short)( e1 & 7 );
- ras.bLine[c1] |= (char)( 0x80 >> f1 );
+ ras.bOrigin[ras.traceOfs + c1] |= (char)( 0x80 >> f1 );
}
Exit:
@@ -2437,7 +2465,7 @@
static void
Vertical_Sweep_Step( RAS_ARG )
{
- ras.bLine -= ras.target.pitch;
+ ras.traceOfs += ras.traceIncr;
}
@@ -2451,8 +2479,8 @@
*/
static void
- Horizontal_Sweep_Init( RAS_ARGS Short min,
- Short max )
+ Horizontal_Sweep_Init( RAS_ARGS Short* min,
+ Short* max )
{
/* nothing, really */
FT_UNUSED_RASTER;
@@ -2716,13 +2744,13 @@
/* check the Y-turns */
if ( ras.numTurns == 0 )
{
- ras.error = FT_THROW( Invalid_Outline );
+ ras.error = FT_THROW( Invalid );
return FAILURE;
}
/* now initialize the sweep */
- ras.Proc_Sweep_Init( RAS_VARS min_Y, max_Y );
+ ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y );
/* then compute the distance of each profile from min_Y */
@@ -3011,54 +3039,63 @@
* Renderer error code.
*/
static int
- Render_Single_Pass( RAS_ARGS Bool flipped,
- Int y_min,
- Int y_max )
+ Render_Single_Pass( RAS_ARGS Bool flipped )
{
- Int y_mid;
- Int band_top = 0;
- Int band_stack[32]; /* enough to bisect 32-bit int bands */
+ Short i, j, k;
- while ( 1 )
+ while ( ras.band_top >= 0 )
{
- ras.minY = (Long)y_min * ras.precision;
- ras.maxY = (Long)y_max * ras.precision;
+ ras.maxY = (Long)ras.band_stack[ras.band_top].y_max * ras.precision;
+ ras.minY = (Long)ras.band_stack[ras.band_top].y_min * ras.precision;
ras.top = ras.buff;
- ras.error = Raster_Err_Ok;
+ ras.error = Raster_Err_None;
if ( Convert_Glyph( RAS_VARS flipped ) )
{
- if ( ras.error != Raster_Err_Raster_Overflow )
- return ras.error;
+ if ( ras.error != Raster_Err_Overflow )
+ return FAILURE;
+
+ ras.error = Raster_Err_None;
/* sub-banding */
- if ( y_min == y_max )
- return ras.error; /* still Raster_Overflow */
+#ifdef DEBUG_RASTER
+ ClearBand( RAS_VARS TRUNC( ras.minY ), TRUNC( ras.maxY ) );
+#endif
+
+ i = ras.band_stack[ras.band_top].y_min;
+ j = ras.band_stack[ras.band_top].y_max;
+
+ k = (Short)( ( i + j ) / 2 );
+
+ if ( ras.band_top >= 7 || k < i )
+ {
+ ras.band_top = 0;
+ ras.error = FT_THROW( Invalid );
+
+ return ras.error;
+ }
+
+ ras.band_stack[ras.band_top + 1].y_min = k;
+ ras.band_stack[ras.band_top + 1].y_max = j;
- y_mid = ( y_min + y_max ) >> 1;
+ ras.band_stack[ras.band_top].y_max = (Short)( k - 1 );
- band_stack[band_top++] = y_min;
- y_min = y_mid + 1;
+ ras.band_top++;
}
else
{
if ( ras.fProfile )
if ( Draw_Sweep( RAS_VAR ) )
return ras.error;
-
- if ( --band_top < 0 )
- break;
-
- y_max = y_min - 1;
- y_min = band_stack[band_top];
+ ras.band_top--;
}
}
- return Raster_Err_Ok;
+ return SUCCESS;
}
@@ -3095,6 +3132,9 @@
ras.dropOutControl += 1;
}
+ ras.second_pass = (Bool)( !( ras.outline.flags &
+ FT_OUTLINE_SINGLE_PASS ) );
+
/* Vertical Sweep */
FT_TRACE7(( "Vertical pass (ftraster)\n" ));
@@ -3103,18 +3143,21 @@
ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
ras.Proc_Sweep_Step = Vertical_Sweep_Step;
+ ras.band_top = 0;
+ ras.band_stack[0].y_min = 0;
+ ras.band_stack[0].y_max = (Short)( ras.target.rows - 1 );
+
ras.bWidth = (UShort)ras.target.width;
ras.bOrigin = (Byte*)ras.target.buffer;
if ( ras.target.pitch > 0 )
ras.bOrigin += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
- error = Render_Single_Pass( RAS_VARS 0, 0, (Int)ras.target.rows - 1 );
- if ( error )
+ if ( ( error = Render_Single_Pass( RAS_VARS 0 ) ) != 0 )
return error;
/* Horizontal Sweep */
- if ( !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS ) )
+ if ( ras.second_pass && ras.dropOutControl != 2 )
{
FT_TRACE7(( "Horizontal pass (ftraster)\n" ));
@@ -3123,12 +3166,15 @@
ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;
ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
- error = Render_Single_Pass( RAS_VARS 1, 0, (Int)ras.target.width - 1 );
- if ( error )
+ ras.band_top = 0;
+ ras.band_stack[0].y_min = 0;
+ ras.band_stack[0].y_max = (Short)( ras.target.width - 1 );
+
+ if ( ( error = Render_Single_Pass( RAS_VARS 1 ) ) != 0 )
return error;
}
- return Raster_Err_Ok;
+ return Raster_Err_None;
}
@@ -3246,36 +3292,38 @@
if ( !raster )
- return FT_THROW( Raster_Uninitialized );
+ return FT_THROW( Not_Ini );
if ( !outline )
- return FT_THROW( Invalid_Outline );
+ return FT_THROW( Invalid );
/* return immediately if the outline is empty */
if ( outline->n_points == 0 || outline->n_contours <= 0 )
- return Raster_Err_Ok;
+ return Raster_Err_None;
if ( !outline->contours || !outline->points )
- return FT_THROW( Invalid_Outline );
+ return FT_THROW( Invalid );
if ( outline->n_points !=
outline->contours[outline->n_contours - 1] + 1 )
- return FT_THROW( Invalid_Outline );
+ return FT_THROW( Invalid );
/* this version of the raster does not support direct rendering, sorry */
- if ( params->flags & FT_RASTER_FLAG_DIRECT ||
- params->flags & FT_RASTER_FLAG_AA )
- return FT_THROW( Cannot_Render_Glyph );
+ if ( params->flags & FT_RASTER_FLAG_DIRECT )
+ return FT_THROW( Unsupported );
+
+ if ( params->flags & FT_RASTER_FLAG_AA )
+ return FT_THROW( Unsupported );
if ( !target_map )
- return FT_THROW( Invalid_Argument );
+ return FT_THROW( Invalid );
/* nothing to do */
if ( !target_map->width || !target_map->rows )
- return Raster_Err_Ok;
+ return Raster_Err_None;
if ( !target_map->buffer )
- return FT_THROW( Invalid_Argument );
+ return FT_THROW( Invalid );
ras.outline = *outline;
ras.target = *target_map;
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.h b/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.h
index 4affd48b51f..1b2ee3c0167 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.h
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.h
@@ -4,7 +4,7 @@
*
* The FreeType glyph rasterizer (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.c b/Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.c
index 236a8daf0a6..57fed9bc14c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.c
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.c
@@ -4,7 +4,7 @@
*
* The FreeType glyph rasterizer interface (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.h b/Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.h
index e4cea537416..3f6be536755 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.h
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/ftrend1.h
@@ -4,7 +4,7 @@
*
* The FreeType glyph rasterizer interface (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/module.mk b/Build/source/libs/freetype2/freetype-src/src/raster/module.mk
index fbc1d64ec27..3600732b16e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/raster/raster.c b/Build/source/libs/freetype2/freetype-src/src/raster/raster.c
index ad81a394142..cd37943bf60 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/raster.c
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/raster.c
@@ -4,7 +4,7 @@
*
* FreeType monochrome rasterer module component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/rasterrs.h b/Build/source/libs/freetype2/freetype-src/src/raster/rasterrs.h
index 852dd5bc319..a29651a6c54 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/rasterrs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/rasterrs.h
@@ -4,7 +4,7 @@
*
* monochrome renderer error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/rules.mk b/Build/source/libs/freetype2/freetype-src/src/raster/rules.mk
index 7ffda772764..3e949d77416 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c b/Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c
deleted file mode 100644
index db4a2dd11aa..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c
+++ /dev/null
@@ -1,1349 +0,0 @@
-/****************************************************************************
- *
- * ftbsdf.c
- *
- * Signed Distance Field support for bitmap fonts (body only).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * 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 <freetype/internal/ftobjs.h>
-#include <freetype/internal/ftdebug.h>
-#include <freetype/internal/ftmemory.h>
-#include <freetype/fttrigon.h>
-
-#include "ftsdf.h"
-#include "ftsdferrs.h"
-#include "ftsdfcommon.h"
-
-
- /**************************************************************************
- *
- * A brief technical overview of how the BSDF rasterizer works
- * -----------------------------------------------------------
- *
- * [Notes]:
- * * SDF stands for Signed Distance Field everywhere.
- *
- * * BSDF stands for Bitmap to Signed Distance Field rasterizer.
- *
- * * This renderer converts rasterized bitmaps to SDF. There is another
- * renderer called 'sdf', which generates SDF directly from outlines;
- * see file `ftsdf.c` for more.
- *
- * * The idea of generating SDF from bitmaps is taken from two research
- * papers, where one is dependent on the other:
- *
- * - Per-Erik Danielsson: Euclidean Distance Mapping
- * http://webstaff.itn.liu.se/~stegu/JFA/Danielsson.pdf
- *
- * From this paper we use the eight-point sequential Euclidean
- * distance mapping (8SED). This is the heart of the process used
- * in this rasterizer.
- *
- * - Stefan Gustavson, Robin Strand: Anti-aliased Euclidean distance transform.
- * http://weber.itn.liu.se/~stegu/aadist/edtaa_preprint.pdf
- *
- * The original 8SED algorithm discards the pixels' alpha values,
- * which can contain information about the actual outline of the
- * glyph. This paper takes advantage of those alpha values and
- * approximates outline pretty accurately.
- *
- * * This rasterizer also works for monochrome bitmaps. However, the
- * result is not as accurate since we don't have any way to
- * approximate outlines from binary bitmaps.
- *
- * ========================================================================
- *
- * Generating SDF from bitmap is done in several steps.
- *
- * (1) The only information we have is the bitmap itself. It can
- * be monochrome or anti-aliased. If it is anti-aliased, pixel values
- * are nothing but coverage values. These coverage values can be used
- * to extract information about the outline of the image. For
- * example, if the pixel's alpha value is 0.5, then we can safely
- * assume that the outline passes through the center of the pixel.
- *
- * (2) Find edge pixels in the bitmap (see `bsdf_is_edge` for more). For
- * all edge pixels we use the Anti-aliased Euclidean distance
- * transform algorithm and compute approximate edge distances (see
- * `compute_edge_distance` and/or the second paper for more).
- *
- * (3) Now that we have computed approximate distances for edge pixels we
- * use the 8SED algorithm to basically sweep the entire bitmap and
- * compute distances for the rest of the pixels. (Since the algorithm
- * is pretty convoluted it is only explained briefly in a comment to
- * function `edt8`. To see the actual algorithm refer to the first
- * paper.)
- *
- * (4) Finally, compute the sign for each pixel. This is done in function
- * `finalize_sdf`. The basic idea is that if a pixel's original
- * alpha/coverage value is greater than 0.5 then it is 'inside' (and
- * 'outside' otherwise).
- *
- * Pseudo Code:
- *
- * ```
- * b = source bitmap;
- * t = target bitmap;
- * dm = list of distances; // dimension equal to b
- *
- * foreach grid_point (x, y) in b:
- * {
- * if (is_edge(x, y)):
- * dm = approximate_edge_distance(b, x, y);
- *
- * // do the 8SED on the distances
- * edt8(dm);
- *
- * // determine the signs
- * determine_signs(dm):
- *
- * // copy SDF data to the target bitmap
- * copy(dm to t);
- * }
- *
- */
-
-
- /**************************************************************************
- *
- * 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 bsdf
-
-
- /**************************************************************************
- *
- * useful macros
- *
- */
-
-#define ONE 65536 /* 1 in 16.16 */
-
-
- /**************************************************************************
- *
- * structs
- *
- */
-
-
- /**************************************************************************
- *
- * @Struct:
- * BSDF_TRaster
- *
- * @Description:
- * This struct is used in place of @FT_Raster and is stored within the
- * internal FreeType renderer struct. While rasterizing this is passed
- * to the @FT_Raster_RenderFunc function, which then can be used however
- * we want.
- *
- * @Fields:
- * memory ::
- * Used internally to allocate intermediate memory while raterizing.
- *
- */
- typedef struct BSDF_TRaster_
- {
- FT_Memory memory;
-
- } BSDF_TRaster;
-
-
- /**************************************************************************
- *
- * @Struct:
- * ED
- *
- * @Description:
- * Euclidean distance. It gets used for Euclidean distance transforms;
- * it can also be interpreted as an edge distance.
- *
- * @Fields:
- * dist ::
- * Vector length of the `near` parameter. Can be squared or absolute
- * depending on the `USE_SQUARED_DISTANCES` macro defined in file
- * `ftsdfcommon.h`.
- *
- * near ::
- * Vector to the nearest edge. Can also be interpreted as shortest
- * distance of a point.
- *
- * alpha ::
- * Alpha value of the original bitmap from which we generate SDF.
- * Needed for computing the gradient and determining the proper sign
- * of a pixel.
- *
- */
- typedef struct ED_
- {
- FT_16D16 dist;
- FT_16D16_Vec near;
- FT_Byte alpha;
-
- } ED;
-
-
- /**************************************************************************
- *
- * @Struct:
- * BSDF_Worker
- *
- * @Description:
- * A convenience struct that is passed to functions while generating
- * SDF; most of those functions require the same parameters.
- *
- * @Fields:
- * distance_map ::
- * A one-dimensional array that gets interpreted as two-dimensional
- * one. It contains the Euclidean distances of all points of the
- * bitmap.
- *
- * width ::
- * Width of the above `distance_map`.
- *
- * rows ::
- * Number of rows in the above `distance_map`.
- *
- * params ::
- * Internal parameters and properties required by the rasterizer. See
- * file `ftsdf.h` for more.
- *
- */
- typedef struct BSDF_Worker_
- {
- ED* distance_map;
-
- FT_Int width;
- FT_Int rows;
-
- SDF_Raster_Params params;
-
- } BSDF_Worker;
-
-
- /**************************************************************************
- *
- * initializer
- *
- */
-
- static const ED zero_ed = { 0, { 0, 0 }, 0 };
-
-
- /**************************************************************************
- *
- * rasterizer functions
- *
- */
-
- /**************************************************************************
- *
- * @Function:
- * bsdf_is_edge
- *
- * @Description:
- * Check whether a pixel is an edge pixel, i.e., whether it is
- * surrounded by a completely black pixel (zero alpha), and the current
- * pixel is not a completely black pixel.
- *
- * @Input:
- * dm ::
- * Array of distances. The parameter must point to the current
- * pixel, i.e., the pixel that is to be checked for being an edge.
- *
- * x ::
- * The x position of the current pixel.
- *
- * y ::
- * The y position of the current pixel.
- *
- * w ::
- * Width of the bitmap.
- *
- * r ::
- * Number of rows in the bitmap.
- *
- * @Return:
- * 1~if the current pixel is an edge pixel, 0~otherwise.
- *
- */
-
-#ifdef CHECK_NEIGHBOR
-#undef CHECK_NEIGHBOR
-#endif
-
-#define CHECK_NEIGHBOR( x_offset, y_offset ) \
- do \
- { \
- if ( x + x_offset >= 0 && x + x_offset < w && \
- y + y_offset >= 0 && y + y_offset < r ) \
- { \
- num_neighbors++; \
- \
- to_check = dm + y_offset * w + x_offset; \
- if ( to_check->alpha == 0 ) \
- { \
- is_edge = 1; \
- goto Done; \
- } \
- } \
- } while ( 0 )
-
- static FT_Bool
- bsdf_is_edge( ED* dm, /* distance map */
- FT_Int x, /* x index of point to check */
- FT_Int y, /* y index of point to check */
- FT_Int w, /* width */
- FT_Int r ) /* rows */
- {
- FT_Bool is_edge = 0;
- ED* to_check = NULL;
- FT_Int num_neighbors = 0;
-
-
- if ( dm->alpha == 0 )
- goto Done;
-
- if ( dm->alpha > 0 && dm->alpha < 255 )
- {
- is_edge = 1;
- goto Done;
- }
-
- /* up */
- CHECK_NEIGHBOR( 0, -1 );
-
- /* down */
- CHECK_NEIGHBOR( 0, 1 );
-
- /* left */
- CHECK_NEIGHBOR( -1, 0 );
-
- /* right */
- CHECK_NEIGHBOR( 1, 0 );
-
- /* up left */
- CHECK_NEIGHBOR( -1, -1 );
-
- /* up right */
- CHECK_NEIGHBOR( 1, -1 );
-
- /* down left */
- CHECK_NEIGHBOR( -1, 1 );
-
- /* down right */
- CHECK_NEIGHBOR( 1, 1 );
-
- if ( num_neighbors != 8 )
- is_edge = 1;
-
- Done:
- return is_edge;
- }
-
-#undef CHECK_NEIGHBOR
-
-
- /**************************************************************************
- *
- * @Function:
- * compute_edge_distance
- *
- * @Description:
- * Approximate the outline and compute the distance from `current`
- * to the approximated outline.
- *
- * @Input:
- * current ::
- * Array of Euclidean distances. `current` must point to the position
- * for which the distance is to be caculated. We treat this array as
- * a two-dimensional array mapped to a one-dimensional array.
- *
- * x ::
- * The x coordinate of the `current` parameter in the array.
- *
- * y ::
- * The y coordinate of the `current` parameter in the array.
- *
- * w ::
- * The width of the distances array.
- *
- * r ::
- * Number of rows in the distances array.
- *
- * @Return:
- * A vector pointing to the approximate edge distance.
- *
- * @Note:
- * This is a computationally expensive function. Try to reduce the
- * number of calls to this function. Moreover, this must only be used
- * for edge pixel positions.
- *
- */
- static FT_16D16_Vec
- compute_edge_distance( ED* current,
- FT_Int x,
- FT_Int y,
- FT_Int w,
- FT_Int r )
- {
- /*
- * This function, based on the paper presented by Stefan Gustavson and
- * Robin Strand, gets used to approximate edge distances from
- * anti-aliased bitmaps.
- *
- * The algorithm is as follows.
- *
- * (1) In anti-aliased images, the pixel's alpha value is the coverage
- * of the pixel by the outline. For example, if the alpha value is
- * 0.5f we can assume that the outline passes through the center of
- * the pixel.
- *
- * (2) For this reason we can use that alpha value to approximate the real
- * distance of the pixel to edge pretty accurately. A simple
- * approximation is `(0.5f - alpha)`, assuming that the outline is
- * parallel to the x or y~axis. However, in this algorithm we use a
- * different approximation which is quite accurate even for
- * non-axis-aligned edges.
- *
- * (3) The only remaining piece of information that we cannot
- * approximate directly from the alpha is the direction of the edge.
- * This is where we use Sobel's operator to compute the gradient of
- * the pixel. The gradient give us a pretty good approximation of
- * the edge direction. We use a 3x3 kernel filter to compute the
- * gradient.
- *
- * (4) After the above two steps we have both the direction and the
- * distance to the edge which is used to generate the Signed
- * Distance Field.
- *
- * References:
- *
- * - Anti-Aliased Euclidean Distance Transform:
- * http://weber.itn.liu.se/~stegu/aadist/edtaa_preprint.pdf
- * - Sobel Operator:
- * https://en.wikipedia.org/wiki/Sobel_operator
- */
-
- FT_16D16_Vec g = { 0, 0 };
- FT_16D16 dist, current_alpha;
- FT_16D16 a1, temp;
- FT_16D16 gx, gy;
- FT_16D16 alphas[9];
-
-
- /* Since our spread cannot be 0, this condition */
- /* can never be true. */
- if ( x <= 0 || x >= w - 1 ||
- y <= 0 || y >= r - 1 )
- return g;
-
- /* initialize the alphas */
- alphas[0] = 256 * (FT_16D16)current[-w - 1].alpha;
- alphas[1] = 256 * (FT_16D16)current[-w ].alpha;
- alphas[2] = 256 * (FT_16D16)current[-w + 1].alpha;
- alphas[3] = 256 * (FT_16D16)current[ -1].alpha;
- alphas[4] = 256 * (FT_16D16)current[ 0].alpha;
- alphas[5] = 256 * (FT_16D16)current[ 1].alpha;
- alphas[6] = 256 * (FT_16D16)current[ w - 1].alpha;
- alphas[7] = 256 * (FT_16D16)current[ w ].alpha;
- alphas[8] = 256 * (FT_16D16)current[ w + 1].alpha;
-
- current_alpha = alphas[4];
-
- /* Compute the gradient using the Sobel operator. */
- /* In this case we use the following 3x3 filters: */
- /* */
- /* For x: | -1 0 -1 | */
- /* | -root(2) 0 root(2) | */
- /* | -1 0 1 | */
- /* */
- /* For y: | -1 -root(2) -1 | */
- /* | 0 0 0 | */
- /* | 1 root(2) 1 | */
- /* */
- /* [Note]: 92681 is root(2) in 16.16 format. */
- g.x = -alphas[0] -
- FT_MulFix( alphas[3], 92681 ) -
- alphas[6] +
- alphas[2] +
- FT_MulFix( alphas[5], 92681 ) +
- alphas[8];
-
- g.y = -alphas[0] -
- FT_MulFix( alphas[1], 92681 ) -
- alphas[2] +
- alphas[6] +
- FT_MulFix( alphas[7], 92681 ) +
- alphas[8];
-
- FT_Vector_NormLen( &g );
-
- /* The gradient gives us the direction of the */
- /* edge for the current pixel. Once we have the */
- /* approximate direction of the edge, we can */
- /* approximate the edge distance much better. */
-
- if ( g.x == 0 || g.y == 0 )
- dist = ONE / 2 - alphas[4];
- else
- {
- gx = g.x;
- gy = g.y;
-
- gx = FT_ABS( gx );
- gy = FT_ABS( gy );
-
- if ( gx < gy )
- {
- temp = gx;
- gx = gy;
- gy = temp;
- }
-
- a1 = FT_DivFix( gy, gx ) / 2;
-
- if ( current_alpha < a1 )
- dist = ( gx + gy ) / 2 -
- square_root( 2 * FT_MulFix( gx,
- FT_MulFix( gy,
- current_alpha ) ) );
-
- else if ( current_alpha < ( ONE - a1 ) )
- dist = FT_MulFix( ONE / 2 - current_alpha, gx );
-
- else
- dist = -( gx + gy ) / 2 +
- square_root( 2 * FT_MulFix( gx,
- FT_MulFix( gy,
- ONE - current_alpha ) ) );
- }
-
- g.x = FT_MulFix( g.x, dist );
- g.y = FT_MulFix( g.y, dist );
-
- return g;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * bsdf_approximate_edge
- *
- * @Description:
- * Loops over all the pixels and call `compute_edge_distance` only for
- * edge pixels. This maked the process a lot faster since
- * `compute_edge_distance` uses functions such as `FT_Vector_NormLen',
- * which are quite slow.
- *
- * @InOut:
- * worker ::
- * Contains the distance map as well as all the relevant parameters
- * required by the function.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- * @Note:
- * The function directly manipulates `worker->distance_map`.
- *
- */
- static FT_Error
- bsdf_approximate_edge( BSDF_Worker* worker )
- {
- FT_Error error = FT_Err_Ok;
- FT_Int i, j;
- FT_Int index;
- ED* ed;
-
-
- if ( !worker || !worker->distance_map )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- ed = worker->distance_map;
-
- for ( j = 0; j < worker->rows; j++ )
- {
- for ( i = 0; i < worker->width; i++ )
- {
- index = j * worker->width + i;
-
- if ( bsdf_is_edge( worker->distance_map + index,
- i, j,
- worker->width,
- worker->rows ) )
- {
- /* approximate the edge distance for edge pixels */
- ed[index].near = compute_edge_distance( ed + index,
- i, j,
- worker->width,
- worker->rows );
- ed[index].dist = VECTOR_LENGTH_16D16( ed[index].near );
- }
- else
- {
- /* for non-edge pixels assign far away distances */
- ed[index].dist = 400 * ONE;
- ed[index].near.x = 200 * ONE;
- ed[index].near.y = 200 * ONE;
- }
- }
- }
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * bsdf_init_distance_map
- *
- * @Description:
- * Initialize the distance map according to the '8-point sequential
- * Euclidean distance mapping' (8SED) algorithm. Basically it copies
- * the `source` bitmap alpha values to the `distance_map->alpha`
- * parameter of `worker`.
- *
- * @Input:
- * source ::
- * Source bitmap to copy the data from.
- *
- * @Output:
- * worker ::
- * Target distance map to copy the data to.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- */
- static FT_Error
- bsdf_init_distance_map( const FT_Bitmap* source,
- BSDF_Worker* worker )
- {
- FT_Error error = FT_Err_Ok;
-
- FT_Int x_diff, y_diff;
- FT_Int t_i, t_j, s_i, s_j;
- FT_Byte* s;
- ED* t;
-
-
- /* again check the parameters (probably unnecessary) */
- if ( !source || !worker )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* Because of the way we convert a bitmap to SDF, */
- /* i.e., aligning the source to the center of the */
- /* target, the target's width and rows must be */
- /* checked before copying. */
- if ( worker->width < (FT_Int)source->width ||
- worker->rows < (FT_Int)source->rows )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* check pixel mode */
- if ( source->pixel_mode == FT_PIXEL_MODE_NONE )
- {
- FT_ERROR(( "bsdf_copy_source_to_target:"
- " Invalid pixel mode of source bitmap" ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( source->pixel_mode == FT_PIXEL_MODE_MONO )
- {
- FT_TRACE0(( "bsdf_copy_source_to_target:"
- " The `bsdf' renderer can convert monochrome\n" ));
- FT_TRACE0(( " "
- " bitmaps to SDF but the results are not perfect\n" ));
- FT_TRACE0(( " "
- " because there is no way to approximate actual\n" ));
- FT_TRACE0(( " "
- " outlines from monochrome bitmaps. Consider\n" ));
- FT_TRACE0(( " "
- " using an anti-aliased bitmap instead.\n" ));
- }
-#endif
-
- /* Calculate the width and row differences */
- /* between target and source. */
- x_diff = worker->width - (int)source->width;
- y_diff = worker->rows - (int)source->rows;
-
- x_diff /= 2;
- y_diff /= 2;
-
- t = (ED*)worker->distance_map;
- s = source->buffer;
-
- /* For now we only support pixel mode `FT_PIXEL_MODE_MONO` */
- /* and `FT_PIXEL_MODE_GRAY`. More will be added later. */
- /* */
- /* [NOTE]: We can also use @FT_Bitmap_Convert to convert */
- /* bitmap to 8bpp. To avoid extra allocation and */
- /* since the target bitmap can be 16bpp we manually */
- /* convert the source bitmap to the desired bpp. */
-
- switch ( source->pixel_mode )
- {
- case FT_PIXEL_MODE_MONO:
- {
- FT_Int t_width = worker->width;
- FT_Int t_rows = worker->rows;
- FT_Int s_width = (int)source->width;
- FT_Int s_rows = (int)source->rows;
-
-
- for ( t_j = 0; t_j < t_rows; t_j++ )
- {
- for ( t_i = 0; t_i < t_width; t_i++ )
- {
- FT_Int t_index = t_j * t_width + t_i;
- FT_Int s_index;
- FT_Int div, mod;
- FT_Byte pixel, byte;
-
-
- t[t_index] = zero_ed;
-
- s_i = t_i - x_diff;
- s_j = t_j - y_diff;
-
- /* Assign 0 to padding similar to */
- /* the source bitmap. */
- if ( s_i < 0 || s_i >= s_width ||
- s_j < 0 || s_j >= s_rows )
- continue;
-
- if ( worker->params.flip_y )
- s_index = ( s_rows - s_j - 1 ) * source->pitch;
- else
- s_index = s_j * source->pitch;
-
- div = s_index + s_i / 8;
- mod = 7 - s_i % 8;
-
- pixel = s[div];
- byte = (FT_Byte)( 1 << mod );
-
- t[t_index].alpha = pixel & byte ? 255 : 0;
-
- pixel = 0;
- }
- }
- }
- break;
-
- case FT_PIXEL_MODE_GRAY:
- {
- FT_Int t_width = worker->width;
- FT_Int t_rows = worker->rows;
- FT_Int s_width = (int)source->width;
- FT_Int s_rows = (int)source->rows;
-
-
- /* loop over all pixels and assign pixel values from source */
- for ( t_j = 0; t_j < t_rows; t_j++ )
- {
- for ( t_i = 0; t_i < t_width; t_i++ )
- {
- FT_Int t_index = t_j * t_width + t_i;
- FT_Int s_index;
-
-
- t[t_index] = zero_ed;
-
- s_i = t_i - x_diff;
- s_j = t_j - y_diff;
-
- /* Assign 0 to padding similar to */
- /* the source bitmap. */
- if ( s_i < 0 || s_i >= s_width ||
- s_j < 0 || s_j >= s_rows )
- continue;
-
- if ( worker->params.flip_y )
- s_index = ( s_rows - s_j - 1 ) * s_width + s_i;
- else
- s_index = s_j * s_width + s_i;
-
- /* simply copy the alpha values */
- t[t_index].alpha = s[s_index];
- }
- }
- }
- break;
-
- default:
- FT_ERROR(( "bsdf_copy_source_to_target:"
- " unsopported pixel mode of source bitmap\n" ));
-
- error = FT_THROW( Unimplemented_Feature );
- break;
- }
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * compare_neighbor
- *
- * @Description:
- * Compare neighbor pixel (which is defined by the offset) and update
- * `current` distance if the new distance is shorter than the original.
- *
- * @Input:
- * x_offset ::
- * X offset of the neighbor to be checked. The offset is relative to
- * the `current`.
- *
- * y_offset ::
- * Y offset of the neighbor to be checked. The offset is relative to
- * the `current`.
- *
- * width ::
- * Width of the `current` array.
- *
- * @InOut:
- * current ::
- * Pointer into array of distances. This parameter must point to the
- * position whose neighbor is to be checked. The array is treated as
- * a two-dimensional array.
- *
- */
- static void
- compare_neighbor( ED* current,
- FT_Int x_offset,
- FT_Int y_offset,
- FT_Int width )
- {
- ED* to_check;
- FT_16D16 dist;
- FT_16D16_Vec dist_vec;
-
-
- to_check = current + ( y_offset * width ) + x_offset;
-
- /*
- * While checking for the nearest point we first approximate the
- * distance of `current` by adding the deviation (which is sqrt(2) at
- * most). Only if the new value is less than the current value we
- * calculate the actual distances using `FT_Vector_Length`. This last
- * step can be omitted by using squared distances.
- */
-
- /*
- * Approximate the distance. We subtract 1 to avoid precision errors,
- * which could happen because the two directions can be opposite.
- */
- dist = to_check->dist - ONE;
-
- if ( dist < current->dist )
- {
- dist_vec = to_check->near;
-
- dist_vec.x += x_offset * ONE;
- dist_vec.y += y_offset * ONE;
- dist = VECTOR_LENGTH_16D16( dist_vec );
-
- if ( dist < current->dist )
- {
- current->dist = dist;
- current->near = dist_vec;
- }
- }
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * first_pass
- *
- * @Description:
- * First pass of the 8SED algorithm. Loop over the bitmap from top to
- * bottom and scan each row left to right, updating the distances in
- * `worker->distance_map`.
- *
- * @InOut:
- * worker::
- * Contains all the relevant parameters.
- *
- */
- static void
- first_pass( BSDF_Worker* worker )
- {
- FT_Int i, j; /* iterators */
- FT_Int w, r; /* width, rows */
- ED* dm; /* distance map */
-
-
- dm = worker->distance_map;
- w = worker->width;
- r = worker->rows;
-
- /* Start scanning from top to bottom and sweep each */
- /* row back and forth comparing the distances of the */
- /* neighborhood. Leave the first row as it has no top */
- /* neighbor; it will be covered in the second scan of */
- /* the image (from bottom to top). */
- for ( j = 1; j < r; j++ )
- {
- FT_Int index;
- ED* current;
-
-
- /* Forward pass of rows (left -> right). Leave the first */
- /* column, which gets covered in the backward pass. */
- for ( i = 1; i < w; i++ )
- {
- index = j * w + i;
- current = dm + index;
-
- /* left-up */
- compare_neighbor( current, -1, -1, w );
- /* up */
- compare_neighbor( current, 0, -1, w );
- /* up-right */
- compare_neighbor( current, 1, -1, w );
- /* left */
- compare_neighbor( current, -1, 0, w );
- }
-
- /* Backward pass of rows (right -> left). Leave the last */
- /* column, which was already covered in the forward pass. */
- for ( i = w - 2; i >= 0; i-- )
- {
- index = j * w + i;
- current = dm + index;
-
- /* right */
- compare_neighbor( current, 1, 0, w );
- }
- }
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * second_pass
- *
- * @Description:
- * Second pass of the 8SED algorithm. Loop over the bitmap from bottom
- * to top and scan each row left to right, updating the distances in
- * `worker->distance_map`.
- *
- * @InOut:
- * worker::
- * Contains all the relevant parameters.
- *
- */
- static void
- second_pass( BSDF_Worker* worker )
- {
- FT_Int i, j; /* iterators */
- FT_Int w, r; /* width, rows */
- ED* dm; /* distance map */
-
-
- dm = worker->distance_map;
- w = worker->width;
- r = worker->rows;
-
- /* Start scanning from bottom to top and sweep each */
- /* row back and forth comparing the distances of the */
- /* neighborhood. Leave the last row as it has no down */
- /* neighbor; it is already covered in the first scan */
- /* of the image (from top to bottom). */
- for ( j = r - 2; j >= 0; j-- )
- {
- FT_Int index;
- ED* current;
-
-
- /* Forward pass of rows (left -> right). Leave the first */
- /* column, which gets covered in the backward pass. */
- for ( i = 1; i < w; i++ )
- {
- index = j * w + i;
- current = dm + index;
-
- /* left-up */
- compare_neighbor( current, -1, 1, w );
- /* up */
- compare_neighbor( current, 0, 1, w );
- /* up-right */
- compare_neighbor( current, 1, 1, w );
- /* left */
- compare_neighbor( current, -1, 0, w );
- }
-
- /* Backward pass of rows (right -> left). Leave the last */
- /* column, which was already covered in the forward pass. */
- for ( i = w - 2; i >= 0; i-- )
- {
- index = j * w + i;
- current = dm + index;
-
- /* right */
- compare_neighbor( current, 1, 0, w );
- }
- }
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * edt8
- *
- * @Description:
- * Compute the distance map of the a bitmap. Execute both first and
- * second pass of the 8SED algorithm.
- *
- * @InOut:
- * worker::
- * Contains all the relevant parameters.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- */
- static FT_Error
- edt8( BSDF_Worker* worker )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( !worker || !worker->distance_map )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* first scan of the image */
- first_pass( worker );
-
- /* second scan of the image */
- second_pass( worker );
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * finalize_sdf
- *
- * @Description:
- * Copy the SDF data from `worker->distance_map` to the `target` bitmap.
- * Also transform the data to output format, (which is 6.10 fixed-point
- * format at the moment).
- *
- * @Input:
- * worker ::
- * Contains source distance map and other SDF data.
- *
- * @Output:
- * target ::
- * Target bitmap to which the SDF data is copied to.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- */
- static FT_Error
- finalize_sdf( BSDF_Worker* worker,
- const FT_Bitmap* target )
- {
- FT_Error error = FT_Err_Ok;
-
- FT_Int w, r;
- FT_Int i, j;
-
- FT_SDFFormat* t_buffer;
- FT_16D16 spread;
-
-
- if ( !worker || !target )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- w = (int)target->width;
- r = (int)target->rows;
- t_buffer = (FT_SDFFormat*)target->buffer;
-
- if ( w != worker->width ||
- r != worker->rows )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
-#if USE_SQUARED_DISTANCES
- spread = FT_INT_16D16( worker->params.spread *
- worker->params.spread );
-#else
- spread = FT_INT_16D16( worker->params.spread );
-#endif
-
- for ( j = 0; j < r; j++ )
- {
- for ( i = 0; i < w; i++ )
- {
- FT_Int index;
- FT_16D16 dist;
- FT_SDFFormat final_dist;
- FT_Char sign;
-
-
- index = j * w + i;
- dist = worker->distance_map[index].dist;
-
- if ( dist < 0 || dist > spread )
- dist = spread;
-
-#if USE_SQUARED_DISTANCES
- dist = square_root( dist );
-#endif
-
- /* We assume that if the pixel is inside a contour */
- /* its coverage value must be > 127. */
- sign = worker->distance_map[index].alpha < 127 ? -1 : 1;
-
- /* flip the sign according to the property */
- if ( worker->params.flip_sign )
- sign = -sign;
-
- /* concatenate from 16.16 to appropriate format */
- final_dist = map_fixed_to_sdf( dist * sign, spread );
-
- t_buffer[index] = final_dist;
- }
- }
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * interface functions
- *
- */
-
- /* called when adding a new module through @FT_Add_Module */
- static FT_Error
- bsdf_raster_new( FT_Memory memory,
- FT_Raster* araster )
- {
- FT_Error error = FT_Err_Ok;
- BSDF_TRaster* raster = NULL;
-
-
- *araster = 0;
- if ( !FT_ALLOC( raster, sizeof ( BSDF_TRaster ) ) )
- {
- raster->memory = memory;
- *araster = (FT_Raster)raster;
- }
-
- return error;
- }
-
-
- /* unused */
- static void
- bsdf_raster_reset( FT_Raster raster,
- unsigned char* pool_base,
- unsigned long pool_size )
- {
- FT_UNUSED( raster );
- FT_UNUSED( pool_base );
- FT_UNUSED( pool_size );
- }
-
-
- /* unused */
- static FT_Error
- bsdf_raster_set_mode( FT_Raster raster,
- unsigned long mode,
- void* args )
- {
- FT_UNUSED( raster );
- FT_UNUSED( mode );
- FT_UNUSED( args );
-
- return FT_Err_Ok;
- }
-
-
- /* called while rendering through @FT_Render_Glyph */
- static FT_Error
- bsdf_raster_render( FT_Raster raster,
- const FT_Raster_Params* params )
- {
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = NULL;
-
- const FT_Bitmap* source = NULL;
- const FT_Bitmap* target = NULL;
-
- BSDF_TRaster* bsdf_raster = (BSDF_TRaster*)raster;
- BSDF_Worker worker;
-
- const SDF_Raster_Params* sdf_params = (const SDF_Raster_Params*)params;
-
-
- worker.distance_map = NULL;
-
- /* check for valid parameters */
- if ( !raster || !params )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* check whether the flag is set */
- if ( sdf_params->root.flags != FT_RASTER_FLAG_SDF )
- {
- error = FT_THROW( Raster_Corrupted );
- goto Exit;
- }
-
- source = (const FT_Bitmap*)sdf_params->root.source;
- target = (const FT_Bitmap*)sdf_params->root.target;
-
- /* check source and target bitmap */
- if ( !source || !target )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- memory = bsdf_raster->memory;
- if ( !memory )
- {
- FT_TRACE0(( "bsdf_raster_render: Raster not set up properly,\n" ));
- FT_TRACE0(( " unable to find memory handle.\n" ));
-
- error = FT_THROW( Invalid_Handle );
- goto Exit;
- }
-
- /* check whether spread is set properly */
- if ( sdf_params->spread > MAX_SPREAD ||
- sdf_params->spread < MIN_SPREAD )
- {
- FT_TRACE0(( "bsdf_raster_render:"
- " The `spread' field of `SDF_Raster_Params'\n" ));
- FT_TRACE0(( " "
- " is invalid; the value of this field must be\n" ));
- FT_TRACE0(( " "
- " within [%d, %d].\n",
- MIN_SPREAD, MAX_SPREAD ));
- FT_TRACE0(( " "
- " Also, you must pass `SDF_Raster_Params'\n" ));
- FT_TRACE0(( " "
- " instead of the default `FT_Raster_Params'\n" ));
- FT_TRACE0(( " "
- " while calling this function and set the fields\n" ));
- FT_TRACE0(( " "
- " accordingly.\n" ));
-
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* set up the worker */
-
- /* allocate the distance map */
- if ( FT_QALLOC_MULT( worker.distance_map, target->rows,
- target->width * sizeof ( *worker.distance_map ) ) )
- goto Exit;
-
- worker.width = (int)target->width;
- worker.rows = (int)target->rows;
- worker.params = *sdf_params;
-
- FT_CALL( bsdf_init_distance_map( source, &worker ) );
- FT_CALL( bsdf_approximate_edge( &worker ) );
- FT_CALL( edt8( &worker ) );
- FT_CALL( finalize_sdf( &worker, target ) );
-
- FT_TRACE0(( "bsdf_raster_render: Total memory used = %ld\n",
- worker.width * worker.rows *
- (long)sizeof ( *worker.distance_map ) ));
-
- Exit:
- if ( worker.distance_map )
- FT_FREE( worker.distance_map );
-
- return error;
- }
-
-
- /* called while deleting `FT_Library` only if the module is added */
- static void
- bsdf_raster_done( FT_Raster raster )
- {
- FT_Memory memory = (FT_Memory)((BSDF_TRaster*)raster)->memory;
-
-
- FT_FREE( raster );
- }
-
-
- FT_DEFINE_RASTER_FUNCS(
- ft_bitmap_sdf_raster,
-
- FT_GLYPH_FORMAT_BITMAP,
-
- (FT_Raster_New_Func) bsdf_raster_new, /* raster_new */
- (FT_Raster_Reset_Func) bsdf_raster_reset, /* raster_reset */
- (FT_Raster_Set_Mode_Func)bsdf_raster_set_mode, /* raster_set_mode */
- (FT_Raster_Render_Func) bsdf_raster_render, /* raster_render */
- (FT_Raster_Done_Func) bsdf_raster_done /* raster_done */
- )
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c
deleted file mode 100644
index d3722b1dc17..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c
+++ /dev/null
@@ -1,3878 +0,0 @@
-/****************************************************************************
- *
- * ftsdf.c
- *
- * Signed Distance Field support for outline fonts (body).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * 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 <freetype/internal/ftobjs.h>
-#include <freetype/internal/ftdebug.h>
-#include <freetype/ftoutln.h>
-#include <freetype/fttrigon.h>
-#include <freetype/ftbitmap.h>
-#include "ftsdf.h"
-
-#include "ftsdferrs.h"
-
-
- /**************************************************************************
- *
- * A brief technical overview of how the SDF rasterizer works
- * ----------------------------------------------------------
- *
- * [Notes]:
- * * SDF stands for Signed Distance Field everywhere.
- *
- * * This renderer generates SDF directly from outlines. There is
- * another renderer called 'bsdf', which converts bitmaps to SDF; see
- * file `ftbsdf.c` for more.
- *
- * * The basic idea of generating the SDF is taken from Viktor Chlumsky's
- * research paper. The paper explains both single and multi-channel
- * SDF, however, this implementation only generates single-channel SDF.
- *
- * Chlumsky, Viktor: Shape Decomposition for Multi-channel Distance
- * Fields. Master's thesis. Czech Technical University in Prague,
- * Faculty of InformationTechnology, 2015.
- *
- * For more information: https://github.com/Chlumsky/msdfgen
- *
- * ========================================================================
- *
- * Generating SDF from outlines is pretty straightforward.
- *
- * (1) We have a set of contours that make the outline of a shape/glyph.
- * Each contour comprises of several edges, with three types of edges.
- *
- * * line segments
- * * conic Bezier curves
- * * cubic Bezier curves
- *
- * (2) Apart from the outlines we also have a two-dimensional grid, namely
- * the bitmap that is used to represent the final SDF data.
- *
- * (3) In order to generate SDF, our task is to find shortest signed
- * distance from each grid point to the outline. The 'signed
- * distance' means that if the grid point is filled by any contour
- * then its sign is positive, otherwise it is negative. The pseudo
- * code is as follows.
- *
- * ```
- * foreach grid_point (x, y):
- * {
- * int min_dist = INT_MAX;
- *
- * foreach contour in outline:
- * {
- * foreach edge in contour:
- * {
- * // get shortest distance from point (x, y) to the edge
- * d = get_min_dist(x, y, edge);
- *
- * if (d < min_dist)
- * min_dist = d;
- * }
- *
- * bitmap[x, y] = min_dist;
- * }
- * }
- * ```
- *
- * (4) After running this algorithm the bitmap contains information about
- * the shortest distance from each point to the outline of the shape.
- * Of course, while this is the most straightforward way of generating
- * SDF, we use various optimizations in our implementation. See the
- * `sdf_generate_*' functions in this file for all details.
- *
- * The optimization currently used by default is subdivision; see
- * function `sdf_generate_subdivision` for more.
- *
- * Also, to see how we compute the shortest distance from a point to
- * each type of edge, check out the `get_min_distance_*' functions.
- *
- */
-
-
- /**************************************************************************
- *
- * 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 sdf
-
-
- /**************************************************************************
- *
- * definitions
- *
- */
-
- /*
- * If set to 1, the rasterizer uses Newton-Raphson's method for finding
- * the shortest distance from a point to a conic curve.
- *
- * If set to 0, an analytical method gets used instead, which computes the
- * roots of a cubic polynomial to find the shortest distance. However,
- * the analytical method can currently underflow; we thus use Newton's
- * method by default.
- */
-#ifndef USE_NEWTON_FOR_CONIC
-#define USE_NEWTON_FOR_CONIC 1
-#endif
-
- /*
- * The number of intervals a Bezier curve gets sampled and checked to find
- * the shortest distance.
- */
-#define MAX_NEWTON_DIVISIONS 4
-
- /*
- * The number of steps of Newton's iterations in each interval of the
- * Bezier curve. Basically, we run Newton's approximation
- *
- * x -= Q(t) / Q'(t)
- *
- * for each division to get the shortest distance.
- */
-#define MAX_NEWTON_STEPS 4
-
- /*
- * The epsilon distance (in 16.16 fractional units) used for corner
- * resolving. If the difference of two distances is less than this value
- * they will be checked for a corner if they are ambiguous.
- */
-#define CORNER_CHECK_EPSILON 32
-
-#if 0
- /*
- * Coarse grid dimension. Will probably be removed in the future because
- * coarse grid optimization is the slowest algorithm.
- */
-#define CG_DIMEN 8
-#endif
-
-
- /**************************************************************************
- *
- * macros
- *
- */
-
-#define MUL_26D6( a, b ) ( ( ( a ) * ( b ) ) / 64 )
-#define VEC_26D6_DOT( p, q ) ( MUL_26D6( p.x, q.x ) + \
- MUL_26D6( p.y, q.y ) )
-
-
- /**************************************************************************
- *
- * structures and enums
- *
- */
-
- /**************************************************************************
- *
- * @Struct:
- * SDF_TRaster
- *
- * @Description:
- * This struct is used in place of @FT_Raster and is stored within the
- * internal FreeType renderer struct. While rasterizing it is passed to
- * the @FT_Raster_RenderFunc function, which then can be used however we
- * want.
- *
- * @Fields:
- * memory ::
- * Used internally to allocate intermediate memory while raterizing.
- *
- */
- typedef struct SDF_TRaster_
- {
- FT_Memory memory;
-
- } SDF_TRaster;
-
-
- /**************************************************************************
- *
- * @Enum:
- * SDF_Edge_Type
- *
- * @Description:
- * Enumeration of all curve types present in fonts.
- *
- * @Fields:
- * SDF_EDGE_UNDEFINED ::
- * Undefined edge, simply used to initialize and detect errors.
- *
- * SDF_EDGE_LINE ::
- * Line segment with start and end point.
- *
- * SDF_EDGE_CONIC ::
- * A conic/quadratic Bezier curve with start, end, and one control
- * point.
- *
- * SDF_EDGE_CUBIC ::
- * A cubic Bezier curve with start, end, and two control points.
- *
- */
- typedef enum SDF_Edge_Type_
- {
- SDF_EDGE_UNDEFINED = 0,
- SDF_EDGE_LINE = 1,
- SDF_EDGE_CONIC = 2,
- SDF_EDGE_CUBIC = 3
-
- } SDF_Edge_Type;
-
-
- /**************************************************************************
- *
- * @Enum:
- * SDF_Contour_Orientation
- *
- * @Description:
- * Enumeration of all orientation values of a contour. We determine the
- * orientation by calculating the area covered by a contour. Contrary
- * to values returned by @FT_Outline_Get_Orientation,
- * `SDF_Contour_Orientation` is independent of the fill rule, which can
- * be different for different font formats.
- *
- * @Fields:
- * SDF_ORIENTATION_NONE ::
- * Undefined orientation, used for initialization and error detection.
- *
- * SDF_ORIENTATION_CW ::
- * Clockwise orientation (positive area covered).
- *
- * SDF_ORIENTATION_CCW ::
- * Counter-clockwise orientation (negative area covered).
- *
- * @Note:
- * See @FT_Outline_Get_Orientation for more details.
- *
- */
- typedef enum SDF_Contour_Orientation_
- {
- SDF_ORIENTATION_NONE = 0,
- SDF_ORIENTATION_CW = 1,
- SDF_ORIENTATION_CCW = 2
-
- } SDF_Contour_Orientation;
-
-
- /**************************************************************************
- *
- * @Struct:
- * SDF_Edge
- *
- * @Description:
- * Represent an edge of a contour.
- *
- * @Fields:
- * start_pos ::
- * Start position of an edge. Valid for all types of edges.
- *
- * end_pos ::
- * Etart position of an edge. Valid for all types of edges.
- *
- * control_a ::
- * A control point of the edge. Valid only for `SDF_EDGE_CONIC`
- * and `SDF_EDGE_CUBIC`.
- *
- * control_b ::
- * Another control point of the edge. Valid only for
- * `SDF_EDGE_CONIC`.
- *
- * edge_type ::
- * Type of the edge, see @SDF_Edge_Type for all possible edge types.
- *
- * next ::
- * Used to create a singly linked list, which can be interpreted
- * as a contour.
- *
- */
- typedef struct SDF_Edge_
- {
- FT_26D6_Vec start_pos;
- FT_26D6_Vec end_pos;
- FT_26D6_Vec control_a;
- FT_26D6_Vec control_b;
-
- SDF_Edge_Type edge_type;
-
- struct SDF_Edge_* next;
-
- } SDF_Edge;
-
-
- /**************************************************************************
- *
- * @Struct:
- * SDF_Contour
- *
- * @Description:
- * Represent a complete contour, which contains a list of edges.
- *
- * @Fields:
- * last_pos ::
- * Contains the value of `end_pos' of the last edge in the list of
- * edges. Useful while decomposing the outline with
- * @FT_Outline_Decompose.
- *
- * edges ::
- * Linked list of all the edges that make the contour.
- *
- * next ::
- * Used to create a singly linked list, which can be interpreted as a
- * complete shape or @FT_Outline.
- *
- */
- typedef struct SDF_Contour_
- {
- FT_26D6_Vec last_pos;
- SDF_Edge* edges;
-
- struct SDF_Contour_* next;
-
- } SDF_Contour;
-
-
- /**************************************************************************
- *
- * @Struct:
- * SDF_Shape
- *
- * @Description:
- * Represent a complete shape, which is the decomposition of
- * @FT_Outline.
- *
- * @Fields:
- * memory ::
- * Used internally to allocate memory.
- *
- * contours ::
- * Linked list of all the contours that make the shape.
- *
- */
- typedef struct SDF_Shape_
- {
- FT_Memory memory;
- SDF_Contour* contours;
-
- } SDF_Shape;
-
-
- /**************************************************************************
- *
- * @Struct:
- * SDF_Signed_Distance
- *
- * @Description:
- * Represent signed distance of a point, i.e., the distance of the edge
- * nearest to the point.
- *
- * @Fields:
- * distance ::
- * Distance of the point from the nearest edge. Can be squared or
- * absolute depending on the `USE_SQUARED_DISTANCES` macro defined in
- * file `ftsdfcommon.h`.
- *
- * cross ::
- * Cross product of the shortest distance vector (i.e., the vector
- * from the point to the nearest edge) and the direction of the edge
- * at the nearest point. This is used to resolve ambiguities of
- * `sign`.
- *
- * sign ::
- * A value used to indicate whether the distance vector is outside or
- * inside the contour corresponding to the edge.
- *
- * @Note:
- * `sign` may or may not be correct, therefore it must be checked
- * properly in case there is an ambiguity.
- *
- */
- typedef struct SDF_Signed_Distance_
- {
- FT_16D16 distance;
- FT_16D16 cross;
- FT_Char sign;
-
- } SDF_Signed_Distance;
-
-
- /**************************************************************************
- *
- * @Struct:
- * SDF_Params
- *
- * @Description:
- * Yet another internal parameters required by the rasterizer.
- *
- * @Fields:
- * orientation ::
- * This is not the @SDF_Contour_Orientation value but @FT_Orientation,
- * which determines whether clockwise-oriented outlines are to be
- * filled or counter-clockwise-oriented ones.
- *
- * flip_sign ::
- * If set to true, flip the sign. By default the points filled by the
- * outline are positive.
- *
- * flip_y ::
- * If set to true the output bitmap is upside-down. Can be useful
- * because OpenGL and DirectX use different coordinate systems for
- * textures.
- *
- * overload_sign ::
- * In the subdivision and bounding box optimization, the default
- * outside sign is taken as -1. This parameter can be used to modify
- * that behaviour. For example, while generating SDF for a single
- * counter-clockwise contour, the outside sign should be 1.
- *
- */
- typedef struct SDF_Params_
- {
- FT_Orientation orientation;
- FT_Bool flip_sign;
- FT_Bool flip_y;
-
- FT_Int overload_sign;
-
- } SDF_Params;
-
-
- /**************************************************************************
- *
- * constants, initializer, and destructor
- *
- */
-
- static
- const FT_Vector zero_vector = { 0, 0 };
-
- static
- const SDF_Edge null_edge = { { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 },
- SDF_EDGE_UNDEFINED, NULL };
-
- static
- const SDF_Contour null_contour = { { 0, 0 }, NULL, NULL };
-
- static
- const SDF_Shape null_shape = { NULL, NULL };
-
- static
- const SDF_Signed_Distance max_sdf = { INT_MAX, 0, 0 };
-
-
- /* Create a new @SDF_Edge on the heap and assigns the `edge` */
- /* pointer to the newly allocated memory. */
- static FT_Error
- sdf_edge_new( FT_Memory memory,
- SDF_Edge** edge )
- {
- FT_Error error = FT_Err_Ok;
- SDF_Edge* ptr = NULL;
-
-
- if ( !memory || !edge )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( !FT_QALLOC( ptr, sizeof ( *ptr ) ) )
- {
- *ptr = null_edge;
- *edge = ptr;
- }
-
- Exit:
- return error;
- }
-
-
- /* Free the allocated `edge` variable. */
- static void
- sdf_edge_done( FT_Memory memory,
- SDF_Edge** edge )
- {
- if ( !memory || !edge || !*edge )
- return;
-
- FT_FREE( *edge );
- }
-
-
- /* Create a new @SDF_Contour on the heap and assign */
- /* the `contour` pointer to the newly allocated memory. */
- static FT_Error
- sdf_contour_new( FT_Memory memory,
- SDF_Contour** contour )
- {
- FT_Error error = FT_Err_Ok;
- SDF_Contour* ptr = NULL;
-
-
- if ( !memory || !contour )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( !FT_QALLOC( ptr, sizeof ( *ptr ) ) )
- {
- *ptr = null_contour;
- *contour = ptr;
- }
-
- Exit:
- return error;
- }
-
-
- /* Free the allocated `contour` variable. */
- /* Also free the list of edges. */
- static void
- sdf_contour_done( FT_Memory memory,
- SDF_Contour** contour )
- {
- SDF_Edge* edges;
- SDF_Edge* temp;
-
-
- if ( !memory || !contour || !*contour )
- return;
-
- edges = (*contour)->edges;
-
- /* release all edges */
- while ( edges )
- {
- temp = edges;
- edges = edges->next;
-
- sdf_edge_done( memory, &temp );
- }
-
- FT_FREE( *contour );
- }
-
-
- /* Create a new @SDF_Shape on the heap and assign */
- /* the `shape` pointer to the newly allocated memory. */
- static FT_Error
- sdf_shape_new( FT_Memory memory,
- SDF_Shape** shape )
- {
- FT_Error error = FT_Err_Ok;
- SDF_Shape* ptr = NULL;
-
-
- if ( !memory || !shape )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( !FT_QALLOC( ptr, sizeof ( *ptr ) ) )
- {
- *ptr = null_shape;
- ptr->memory = memory;
- *shape = ptr;
- }
-
- Exit:
- return error;
- }
-
-
- /* Free the allocated `shape` variable. */
- /* Also free the list of contours. */
- static void
- sdf_shape_done( SDF_Shape** shape )
- {
- FT_Memory memory;
- SDF_Contour* contours;
- SDF_Contour* temp;
-
-
- if ( !shape || !*shape )
- return;
-
- memory = (*shape)->memory;
- contours = (*shape)->contours;
-
- if ( !memory )
- return;
-
- /* release all contours */
- while ( contours )
- {
- temp = contours;
- contours = contours->next;
-
- sdf_contour_done( memory, &temp );
- }
-
- /* release the allocated shape struct */
- FT_FREE( *shape );
- }
-
-
- /**************************************************************************
- *
- * shape decomposition functions
- *
- */
-
- /* This function is called when starting a new contour at `to`, */
- /* which gets added to the shape's list. */
- static FT_Error
- sdf_move_to( const FT_26D6_Vec* to,
- void* user )
- {
- SDF_Shape* shape = ( SDF_Shape* )user;
- SDF_Contour* contour = NULL;
-
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = shape->memory;
-
-
- if ( !to || !user )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- FT_CALL( sdf_contour_new( memory, &contour ) );
-
- contour->last_pos = *to;
- contour->next = shape->contours;
- shape->contours = contour;
-
- Exit:
- return error;
- }
-
-
- /* This function is called when there is a line in the */
- /* contour. The line starts at the previous edge point and */
- /* stops at `to`. */
- static FT_Error
- sdf_line_to( const FT_26D6_Vec* to,
- void* user )
- {
- SDF_Shape* shape = ( SDF_Shape* )user;
- SDF_Edge* edge = NULL;
- SDF_Contour* contour = NULL;
-
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = shape->memory;
-
-
- if ( !to || !user )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- contour = shape->contours;
-
- if ( contour->last_pos.x == to->x &&
- contour->last_pos.y == to->y )
- goto Exit;
-
- FT_CALL( sdf_edge_new( memory, &edge ) );
-
- edge->edge_type = SDF_EDGE_LINE;
- edge->start_pos = contour->last_pos;
- edge->end_pos = *to;
-
- edge->next = contour->edges;
- contour->edges = edge;
- contour->last_pos = *to;
-
- Exit:
- return error;
- }
-
-
- /* This function is called when there is a conic Bezier curve */
- /* in the contour. The curve starts at the previous edge point */
- /* and stops at `to`, with control point `control_1`. */
- static FT_Error
- sdf_conic_to( const FT_26D6_Vec* control_1,
- const FT_26D6_Vec* to,
- void* user )
- {
- SDF_Shape* shape = ( SDF_Shape* )user;
- SDF_Edge* edge = NULL;
- SDF_Contour* contour = NULL;
-
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = shape->memory;
-
-
- if ( !control_1 || !to || !user )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- contour = shape->contours;
-
- FT_CALL( sdf_edge_new( memory, &edge ) );
-
- edge->edge_type = SDF_EDGE_CONIC;
- edge->start_pos = contour->last_pos;
- edge->control_a = *control_1;
- edge->end_pos = *to;
-
- edge->next = contour->edges;
- contour->edges = edge;
- contour->last_pos = *to;
-
- Exit:
- return error;
- }
-
-
- /* This function is called when there is a cubic Bezier curve */
- /* in the contour. The curve starts at the previous edge point */
- /* and stops at `to`, with two control points `control_1` and */
- /* `control_2`. */
- static FT_Error
- sdf_cubic_to( const FT_26D6_Vec* control_1,
- const FT_26D6_Vec* control_2,
- const FT_26D6_Vec* to,
- void* user )
- {
- SDF_Shape* shape = ( SDF_Shape* )user;
- SDF_Edge* edge = NULL;
- SDF_Contour* contour = NULL;
-
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = shape->memory;
-
-
- if ( !control_2 || !control_1 || !to || !user )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- contour = shape->contours;
-
- FT_CALL( sdf_edge_new( memory, &edge ) );
-
- edge->edge_type = SDF_EDGE_CUBIC;
- edge->start_pos = contour->last_pos;
- edge->control_a = *control_1;
- edge->control_b = *control_2;
- edge->end_pos = *to;
-
- edge->next = contour->edges;
- contour->edges = edge;
- contour->last_pos = *to;
-
- Exit:
- return error;
- }
-
-
- /* Construct the structure to hold all four outline */
- /* decomposition functions. */
- FT_DEFINE_OUTLINE_FUNCS(
- sdf_decompose_funcs,
-
- (FT_Outline_MoveTo_Func) sdf_move_to, /* move_to */
- (FT_Outline_LineTo_Func) sdf_line_to, /* line_to */
- (FT_Outline_ConicTo_Func)sdf_conic_to, /* conic_to */
- (FT_Outline_CubicTo_Func)sdf_cubic_to, /* cubic_to */
-
- 0, /* shift */
- 0 /* delta */
- )
-
-
- /* Decompose `outline` and put it into the `shape` structure. */
- static FT_Error
- sdf_outline_decompose( FT_Outline* outline,
- SDF_Shape* shape )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( !outline || !shape )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- error = FT_Outline_Decompose( outline,
- &sdf_decompose_funcs,
- (void*)shape );
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * utility functions
- *
- */
-
- /* Return the control box of a edge. The control box is a rectangle */
- /* in which all the control points can fit tightly. */
- static FT_CBox
- get_control_box( SDF_Edge edge )
- {
- FT_CBox cbox;
- FT_Bool is_set = 0;
-
-
- switch ( edge.edge_type )
- {
- case SDF_EDGE_CUBIC:
- cbox.xMin = edge.control_b.x;
- cbox.xMax = edge.control_b.x;
- cbox.yMin = edge.control_b.y;
- cbox.yMax = edge.control_b.y;
-
- is_set = 1;
- /* fall through */
-
- case SDF_EDGE_CONIC:
- if ( is_set )
- {
- cbox.xMin = edge.control_a.x < cbox.xMin
- ? edge.control_a.x
- : cbox.xMin;
- cbox.xMax = edge.control_a.x > cbox.xMax
- ? edge.control_a.x
- : cbox.xMax;
-
- cbox.yMin = edge.control_a.y < cbox.yMin
- ? edge.control_a.y
- : cbox.yMin;
- cbox.yMax = edge.control_a.y > cbox.yMax
- ? edge.control_a.y
- : cbox.yMax;
- }
- else
- {
- cbox.xMin = edge.control_a.x;
- cbox.xMax = edge.control_a.x;
- cbox.yMin = edge.control_a.y;
- cbox.yMax = edge.control_a.y;
-
- is_set = 1;
- }
- /* fall through */
-
- case SDF_EDGE_LINE:
- if ( is_set )
- {
- cbox.xMin = edge.start_pos.x < cbox.xMin
- ? edge.start_pos.x
- : cbox.xMin;
- cbox.xMax = edge.start_pos.x > cbox.xMax
- ? edge.start_pos.x
- : cbox.xMax;
-
- cbox.yMin = edge.start_pos.y < cbox.yMin
- ? edge.start_pos.y
- : cbox.yMin;
- cbox.yMax = edge.start_pos.y > cbox.yMax
- ? edge.start_pos.y
- : cbox.yMax;
- }
- else
- {
- cbox.xMin = edge.start_pos.x;
- cbox.xMax = edge.start_pos.x;
- cbox.yMin = edge.start_pos.y;
- cbox.yMax = edge.start_pos.y;
- }
-
- cbox.xMin = edge.end_pos.x < cbox.xMin
- ? edge.end_pos.x
- : cbox.xMin;
- cbox.xMax = edge.end_pos.x > cbox.xMax
- ? edge.end_pos.x
- : cbox.xMax;
-
- cbox.yMin = edge.end_pos.y < cbox.yMin
- ? edge.end_pos.y
- : cbox.yMin;
- cbox.yMax = edge.end_pos.y > cbox.yMax
- ? edge.end_pos.y
- : cbox.yMax;
-
- break;
-
- default:
- break;
- }
-
- return cbox;
- }
-
-
- /* Return orientation of a single contour. */
- /* Note that the orientation is independent of the fill rule! */
- /* So, for TTF a clockwise-oriented contour has to be filled */
- /* and the opposite for OTF fonts. */
- static SDF_Contour_Orientation
- get_contour_orientation ( SDF_Contour* contour )
- {
- SDF_Edge* head = NULL;
- FT_26D6 area = 0;
-
-
- /* return none if invalid parameters */
- if ( !contour || !contour->edges )
- return SDF_ORIENTATION_NONE;
-
- head = contour->edges;
-
- /* Calculate the area of the control box for all edges. */
- while ( head )
- {
- switch ( head->edge_type )
- {
- case SDF_EDGE_LINE:
- area += MUL_26D6( ( head->end_pos.x - head->start_pos.x ),
- ( head->end_pos.y + head->start_pos.y ) );
- break;
-
- case SDF_EDGE_CONIC:
- area += MUL_26D6( head->control_a.x - head->start_pos.x,
- head->control_a.y + head->start_pos.y );
- area += MUL_26D6( head->end_pos.x - head->control_a.x,
- head->end_pos.y + head->control_a.y );
- break;
-
- case SDF_EDGE_CUBIC:
- area += MUL_26D6( head->control_a.x - head->start_pos.x,
- head->control_a.y + head->start_pos.y );
- area += MUL_26D6( head->control_b.x - head->control_a.x,
- head->control_b.y + head->control_a.y );
- area += MUL_26D6( head->end_pos.x - head->control_b.x,
- head->end_pos.y + head->control_b.y );
- break;
-
- default:
- return SDF_ORIENTATION_NONE;
- }
-
- head = head->next;
- }
-
- /* Clockwise contours cover a positive area, and counter-clockwise */
- /* contours cover a negative area. */
- if ( area > 0 )
- return SDF_ORIENTATION_CW;
- else
- return SDF_ORIENTATION_CCW;
- }
-
-
- /* This function is exactly the same as the one */
- /* in the smooth renderer. It splits a conic */
- /* into two conics exactly half way at t = 0.5. */
- static void
- split_conic( FT_26D6_Vec* base )
- {
- FT_26D6 a, b;
-
-
- base[4].x = base[2].x;
- a = base[0].x + base[1].x;
- b = base[1].x + base[2].x;
- base[3].x = b / 2;
- base[2].x = ( a + b ) / 4;
- base[1].x = a / 2;
-
- base[4].y = base[2].y;
- a = base[0].y + base[1].y;
- b = base[1].y + base[2].y;
- base[3].y = b / 2;
- base[2].y = ( a + b ) / 4;
- base[1].y = a / 2;
- }
-
-
- /* This function is exactly the same as the one */
- /* in the smooth renderer. It splits a cubic */
- /* into two cubics exactly half way at t = 0.5. */
- static void
- split_cubic( FT_26D6_Vec* base )
- {
- FT_26D6 a, b, c;
-
-
- base[6].x = base[3].x;
- a = base[0].x + base[1].x;
- b = base[1].x + base[2].x;
- c = base[2].x + base[3].x;
- base[5].x = c / 2;
- c += b;
- base[4].x = c / 4;
- base[1].x = a / 2;
- a += b;
- base[2].x = a / 4;
- base[3].x = ( a + c ) / 8;
-
- base[6].y = base[3].y;
- a = base[0].y + base[1].y;
- b = base[1].y + base[2].y;
- c = base[2].y + base[3].y;
- base[5].y = c / 2;
- c += b;
- base[4].y = c / 4;
- base[1].y = a / 2;
- a += b;
- base[2].y = a / 4;
- base[3].y = ( a + c ) / 8;
- }
-
-
- /* Split a conic Bezier curve into a number of lines */
- /* and add them to `out'. */
- /* */
- /* This function uses recursion; we thus need */
- /* parameter `max_splits' for stopping. */
- static FT_Error
- split_sdf_conic( FT_Memory memory,
- FT_26D6_Vec* control_points,
- FT_Int max_splits,
- SDF_Edge** out )
- {
- FT_Error error = FT_Err_Ok;
- FT_26D6_Vec cpos[5];
- SDF_Edge* left,* right;
-
-
- if ( !memory || !out )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* split conic outline */
- cpos[0] = control_points[0];
- cpos[1] = control_points[1];
- cpos[2] = control_points[2];
-
- split_conic( cpos );
-
- /* If max number of splits is done */
- /* then stop and add the lines to */
- /* the list. */
- if ( max_splits <= 2 )
- goto Append;
-
- /* Otherwise keep splitting. */
- FT_CALL( split_sdf_conic( memory, &cpos[0], max_splits / 2, out ) );
- FT_CALL( split_sdf_conic( memory, &cpos[2], max_splits / 2, out ) );
-
- /* [NOTE]: This is not an efficient way of */
- /* splitting the curve. Check the deviation */
- /* instead and stop if the deviation is less */
- /* than a pixel. */
-
- goto Exit;
-
- Append:
- /* Do allocation and add the lines to the list. */
-
- FT_CALL( sdf_edge_new( memory, &left ) );
- FT_CALL( sdf_edge_new( memory, &right ) );
-
- left->start_pos = cpos[0];
- left->end_pos = cpos[2];
- left->edge_type = SDF_EDGE_LINE;
-
- right->start_pos = cpos[2];
- right->end_pos = cpos[4];
- right->edge_type = SDF_EDGE_LINE;
-
- left->next = right;
- right->next = (*out);
- *out = left;
-
- Exit:
- return error;
- }
-
-
- /* Split a cubic Bezier curve into a number of lines */
- /* and add them to `out`. */
- /* */
- /* This function uses recursion; we thus need */
- /* parameter `max_splits' for stopping. */
- static FT_Error
- split_sdf_cubic( FT_Memory memory,
- FT_26D6_Vec* control_points,
- FT_Int max_splits,
- SDF_Edge** out )
- {
- FT_Error error = FT_Err_Ok;
- FT_26D6_Vec cpos[7];
- SDF_Edge* left,* right;
-
-
- if ( !memory || !out )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* split the conic */
- cpos[0] = control_points[0];
- cpos[1] = control_points[1];
- cpos[2] = control_points[2];
- cpos[3] = control_points[3];
-
- split_cubic( cpos );
-
- /* If max number of splits is done */
- /* then stop and add the lines to */
- /* the list. */
- if ( max_splits <= 2 )
- goto Append;
-
- /* Otherwise keep splitting. */
- FT_CALL( split_sdf_cubic( memory, &cpos[0], max_splits / 2, out ) );
- FT_CALL( split_sdf_cubic( memory, &cpos[3], max_splits / 2, out ) );
-
- /* [NOTE]: This is not an efficient way of */
- /* splitting the curve. Check the deviation */
- /* instead and stop if the deviation is less */
- /* than a pixel. */
-
- goto Exit;
-
- Append:
- /* Do allocation and add the lines to the list. */
-
- FT_CALL( sdf_edge_new( memory, &left) );
- FT_CALL( sdf_edge_new( memory, &right) );
-
- left->start_pos = cpos[0];
- left->end_pos = cpos[3];
- left->edge_type = SDF_EDGE_LINE;
-
- right->start_pos = cpos[3];
- right->end_pos = cpos[6];
- right->edge_type = SDF_EDGE_LINE;
-
- left->next = right;
- right->next = (*out);
- *out = left;
-
- Exit:
- return error;
- }
-
-
- /* Subdivide an entire shape into line segments */
- /* such that it doesn't look visually different */
- /* from the original curve. */
- static FT_Error
- split_sdf_shape( SDF_Shape* shape )
- {
- FT_Error error = FT_Err_Ok;
- FT_Memory memory;
-
- SDF_Contour* contours;
- SDF_Contour* new_contours = NULL;
-
-
- if ( !shape || !shape->memory )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- contours = shape->contours;
- memory = shape->memory;
-
- /* for each contour */
- while ( contours )
- {
- SDF_Edge* edges = contours->edges;
- SDF_Edge* new_edges = NULL;
-
- SDF_Contour* tempc;
-
-
- /* for each edge */
- while ( edges )
- {
- SDF_Edge* edge = edges;
- SDF_Edge* temp;
-
- switch ( edge->edge_type )
- {
- case SDF_EDGE_LINE:
- /* Just create a duplicate edge in case */
- /* it is a line. We can use the same edge. */
- FT_CALL( sdf_edge_new( memory, &temp ) );
-
- ft_memcpy( temp, edge, sizeof ( *edge ) );
-
- temp->next = new_edges;
- new_edges = temp;
- break;
-
- case SDF_EDGE_CONIC:
- /* Subdivide the curve and add it to the list. */
- {
- FT_26D6_Vec ctrls[3];
-
-
- ctrls[0] = edge->start_pos;
- ctrls[1] = edge->control_a;
- ctrls[2] = edge->end_pos;
-
- error = split_sdf_conic( memory, ctrls, 32, &new_edges );
- }
- break;
-
- case SDF_EDGE_CUBIC:
- /* Subdivide the curve and add it to the list. */
- {
- FT_26D6_Vec ctrls[4];
-
-
- ctrls[0] = edge->start_pos;
- ctrls[1] = edge->control_a;
- ctrls[2] = edge->control_b;
- ctrls[3] = edge->end_pos;
-
- error = split_sdf_cubic( memory, ctrls, 32, &new_edges );
- }
- break;
-
- default:
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- edges = edges->next;
- }
-
- /* add to the contours list */
- FT_CALL( sdf_contour_new( memory, &tempc ) );
-
- tempc->next = new_contours;
- tempc->edges = new_edges;
- new_contours = tempc;
- new_edges = NULL;
-
- /* deallocate the contour */
- tempc = contours;
- contours = contours->next;
-
- sdf_contour_done( memory, &tempc );
- }
-
- shape->contours = new_contours;
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * for debugging
- *
- */
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- static void
- sdf_shape_dump( SDF_Shape* shape )
- {
- FT_UInt num_contours = 0;
-
- FT_UInt total_edges = 0;
- FT_UInt total_lines = 0;
- FT_UInt total_conic = 0;
- FT_UInt total_cubic = 0;
-
- SDF_Contour* contour_list;
-
-
- if ( !shape )
- {
- FT_TRACE5(( "sdf_shape_dump: null shape\n" ));
- return;
- }
-
- contour_list = shape->contours;
-
- FT_TRACE5(( "sdf_shape_dump (values are in 26.6 format):\n" ));
-
- while ( contour_list )
- {
- FT_UInt num_edges = 0;
- SDF_Edge* edge_list;
- SDF_Contour* contour = contour_list;
-
-
- FT_TRACE5(( " Contour %d\n", num_contours ));
-
- edge_list = contour->edges;
-
- while ( edge_list )
- {
- SDF_Edge* edge = edge_list;
-
-
- FT_TRACE5(( " %3d: ", num_edges ));
-
- switch ( edge->edge_type )
- {
- case SDF_EDGE_LINE:
- FT_TRACE5(( "Line: (%ld, %ld) -- (%ld, %ld)\n",
- edge->start_pos.x, edge->start_pos.y,
- edge->end_pos.x, edge->end_pos.y ));
- total_lines++;
- break;
-
- case SDF_EDGE_CONIC:
- FT_TRACE5(( "Conic: (%ld, %ld) .. (%ld, %ld) .. (%ld, %ld)\n",
- edge->start_pos.x, edge->start_pos.y,
- edge->control_a.x, edge->control_a.y,
- edge->end_pos.x, edge->end_pos.y ));
- total_conic++;
- break;
-
- case SDF_EDGE_CUBIC:
- FT_TRACE5(( "Cubic: (%ld, %ld) .. (%ld, %ld)"
- " .. (%ld, %ld) .. (%ld %ld)\n",
- edge->start_pos.x, edge->start_pos.y,
- edge->control_a.x, edge->control_a.y,
- edge->control_b.x, edge->control_b.y,
- edge->end_pos.x, edge->end_pos.y ));
- total_cubic++;
- break;
-
- default:
- break;
- }
-
- num_edges++;
- total_edges++;
- edge_list = edge_list->next;
- }
-
- num_contours++;
- contour_list = contour_list->next;
- }
-
- FT_TRACE5(( "\n" ));
- FT_TRACE5(( " total number of contours = %d\n", num_contours ));
- FT_TRACE5(( " total number of edges = %d\n", total_edges ));
- FT_TRACE5(( " |__lines = %d\n", total_lines ));
- FT_TRACE5(( " |__conic = %d\n", total_conic ));
- FT_TRACE5(( " |__cubic = %d\n", total_cubic ));
- }
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
-
- /**************************************************************************
- *
- * math functions
- *
- */
-
-#if !USE_NEWTON_FOR_CONIC
-
- /* [NOTE]: All the functions below down until rasterizer */
- /* can be avoided if we decide to subdivide the */
- /* curve into lines. */
-
- /* This function uses Newton's iteration to find */
- /* the cube root of a fixed-point integer. */
- static FT_16D16
- cube_root( FT_16D16 val )
- {
- /* [IMPORTANT]: This function is not good as it may */
- /* not break, so use a lookup table instead. Or we */
- /* can use an algorithm similar to `square_root`. */
-
- FT_Int v, g, c;
-
-
- if ( val == 0 ||
- val == -FT_INT_16D16( 1 ) ||
- val == FT_INT_16D16( 1 ) )
- return val;
-
- v = val < 0 ? -val : val;
- g = square_root( v );
- c = 0;
-
- while ( 1 )
- {
- c = FT_MulFix( FT_MulFix( g, g ), g ) - v;
- c = FT_DivFix( c, 3 * FT_MulFix( g, g ) );
-
- g -= c;
-
- if ( ( c < 0 ? -c : c ) < 30 )
- break;
- }
-
- return val < 0 ? -g : g;
- }
-
-
- /* Calculate the perpendicular by using '1 - base^2'. */
- /* Then use arctan to compute the angle. */
- static FT_16D16
- arc_cos( FT_16D16 val )
- {
- FT_16D16 p;
- FT_16D16 b = val;
- FT_16D16 one = FT_INT_16D16( 1 );
-
-
- if ( b > one )
- b = one;
- if ( b < -one )
- b = -one;
-
- p = one - FT_MulFix( b, b );
- p = square_root( p );
-
- return FT_Atan2( b, p );
- }
-
-
- /* Compute roots of a quadratic polynomial, assign them to `out`, */
- /* and return number of real roots. */
- /* */
- /* The procedure can be found at */
- /* */
- /* https://mathworld.wolfram.com/QuadraticFormula.html */
- static FT_UShort
- solve_quadratic_equation( FT_26D6 a,
- FT_26D6 b,
- FT_26D6 c,
- FT_16D16 out[2] )
- {
- FT_16D16 discriminant = 0;
-
-
- a = FT_26D6_16D16( a );
- b = FT_26D6_16D16( b );
- c = FT_26D6_16D16( c );
-
- if ( a == 0 )
- {
- if ( b == 0 )
- return 0;
- else
- {
- out[0] = FT_DivFix( -c, b );
-
- return 1;
- }
- }
-
- discriminant = FT_MulFix( b, b ) - 4 * FT_MulFix( a, c );
-
- if ( discriminant < 0 )
- return 0;
- else if ( discriminant == 0 )
- {
- out[0] = FT_DivFix( -b, 2 * a );
-
- return 1;
- }
- else
- {
- discriminant = square_root( discriminant );
-
- out[0] = FT_DivFix( -b + discriminant, 2 * a );
- out[1] = FT_DivFix( -b - discriminant, 2 * a );
-
- return 2;
- }
- }
-
-
- /* Compute roots of a cubic polynomial, assign them to `out`, */
- /* and return number of real roots. */
- /* */
- /* The procedure can be found at */
- /* */
- /* https://mathworld.wolfram.com/CubicFormula.html */
- static FT_UShort
- solve_cubic_equation( FT_26D6 a,
- FT_26D6 b,
- FT_26D6 c,
- FT_26D6 d,
- FT_16D16 out[3] )
- {
- FT_16D16 q = 0; /* intermediate */
- FT_16D16 r = 0; /* intermediate */
-
- FT_16D16 a2 = b; /* x^2 coefficients */
- FT_16D16 a1 = c; /* x coefficients */
- FT_16D16 a0 = d; /* constant */
-
- FT_16D16 q3 = 0;
- FT_16D16 r2 = 0;
- FT_16D16 a23 = 0;
- FT_16D16 a22 = 0;
- FT_16D16 a1x2 = 0;
-
-
- /* cutoff value for `a` to be a cubic, otherwise solve quadratic */
- if ( a == 0 || FT_ABS( a ) < 16 )
- return solve_quadratic_equation( b, c, d, out );
-
- if ( d == 0 )
- {
- out[0] = 0;
-
- return solve_quadratic_equation( a, b, c, out + 1 ) + 1;
- }
-
- /* normalize the coefficients; this also makes them 16.16 */
- a2 = FT_DivFix( a2, a );
- a1 = FT_DivFix( a1, a );
- a0 = FT_DivFix( a0, a );
-
- /* compute intermediates */
- a1x2 = FT_MulFix( a1, a2 );
- a22 = FT_MulFix( a2, a2 );
- a23 = FT_MulFix( a22, a2 );
-
- q = ( 3 * a1 - a22 ) / 9;
- r = ( 9 * a1x2 - 27 * a0 - 2 * a23 ) / 54;
-
- /* [BUG]: `q3` and `r2` still cause underflow. */
-
- q3 = FT_MulFix( q, q );
- q3 = FT_MulFix( q3, q );
-
- r2 = FT_MulFix( r, r );
-
- if ( q3 < 0 && r2 < -q3 )
- {
- FT_16D16 t = 0;
-
-
- q3 = square_root( -q3 );
- t = FT_DivFix( r, q3 );
-
- if ( t > ( 1 << 16 ) )
- t = ( 1 << 16 );
- if ( t < -( 1 << 16 ) )
- t = -( 1 << 16 );
-
- t = arc_cos( t );
- a2 /= 3;
- q = 2 * square_root( -q );
-
- out[0] = FT_MulFix( q, FT_Cos( t / 3 ) ) - a2;
- out[1] = FT_MulFix( q, FT_Cos( ( t + FT_ANGLE_PI * 2 ) / 3 ) ) - a2;
- out[2] = FT_MulFix( q, FT_Cos( ( t + FT_ANGLE_PI * 4 ) / 3 ) ) - a2;
-
- return 3;
- }
-
- else if ( r2 == -q3 )
- {
- FT_16D16 s = 0;
-
-
- s = cube_root( r );
- a2 /= -3;
-
- out[0] = a2 + ( 2 * s );
- out[1] = a2 - s;
-
- return 2;
- }
-
- else
- {
- FT_16D16 s = 0;
- FT_16D16 t = 0;
- FT_16D16 dis = 0;
-
-
- if ( q3 == 0 )
- dis = FT_ABS( r );
- else
- dis = square_root( q3 + r2 );
-
- s = cube_root( r + dis );
- t = cube_root( r - dis );
- a2 /= -3;
- out[0] = ( a2 + ( s + t ) );
-
- return 1;
- }
- }
-
-#endif /* !USE_NEWTON_FOR_CONIC */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /** **/
- /** RASTERIZER **/
- /** **/
- /*************************************************************************/
- /*************************************************************************/
-
- /**************************************************************************
- *
- * @Function:
- * resolve_corner
- *
- * @Description:
- * At some places on the grid two edges can give opposite directions;
- * this happens when the closest point is on one of the endpoint. In
- * that case we need to check the proper sign.
- *
- * This can be visualized by an example:
- *
- * ```
- * x
- *
- * o
- * ^ \
- * / \
- * / \
- * (a) / \ (b)
- * / \
- * / \
- * / v
- * ```
- *
- * Suppose `x` is the point whose shortest distance from an arbitrary
- * contour we want to find out. It is clear that `o` is the nearest
- * point on the contour. Now to determine the sign we do a cross
- * product of the shortest distance vector and the edge direction, i.e.,
- *
- * ```
- * => sign = cross(x - o, direction(a))
- * ```
- *
- * Using the right hand thumb rule we can see that the sign will be
- * positive.
- *
- * If we use `b', however, we have
- *
- * ```
- * => sign = cross(x - o, direction(b))
- * ```
- *
- * In this case the sign will be negative. To determine the correct
- * sign we thus divide the plane in two halves and check which plane the
- * point lies in.
- *
- * ```
- * |
- * x |
- * |
- * o
- * ^|\
- * / | \
- * / | \
- * (a) / | \ (b)
- * / | \
- * / \
- * / v
- * ```
- *
- * We can see that `x` lies in the plane of `a`, so we take the sign
- * determined by `a`. This test can be easily done by calculating the
- * orthogonality and taking the greater one.
- *
- * The orthogonality is simply the sinus of the two vectors (i.e.,
- * x - o) and the corresponding direction. We efficiently pre-compute
- * the orthogonality with the corresponding `get_min_distance_*`
- * functions.
- *
- * @Input:
- * sdf1 ::
- * First signed distance (can be any of `a` or `b`).
- *
- * sdf1 ::
- * Second signed distance (can be any of `a` or `b`).
- *
- * @Return:
- * The correct signed distance, which is computed by using the above
- * algorithm.
- *
- * @Note:
- * The function does not care about the actual distance, it simply
- * returns the signed distance which has a larger cross product. As a
- * consequence, this function should not be used if the two distances
- * are fairly apart. In that case simply use the signed distance with
- * a shorter absolute distance.
- *
- */
- static SDF_Signed_Distance
- resolve_corner( SDF_Signed_Distance sdf1,
- SDF_Signed_Distance sdf2 )
- {
- return FT_ABS( sdf1.cross ) > FT_ABS( sdf2.cross ) ? sdf1 : sdf2;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * get_min_distance_line
- *
- * @Description:
- * Find the shortest distance from the `line` segment to a given `point`
- * and assign it to `out`. Use it for line segments only.
- *
- * @Input:
- * line ::
- * The line segment to which the shortest distance is to be computed.
- *
- * point ::
- * Point from which the shortest distance is to be computed.
- *
- * @Output:
- * out ::
- * Signed distance from `point` to `line`.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- * @Note:
- * The `line' parameter must have an edge type of `SDF_EDGE_LINE`.
- *
- */
- static FT_Error
- get_min_distance_line( SDF_Edge* line,
- FT_26D6_Vec point,
- SDF_Signed_Distance* out )
- {
- /*
- * In order to calculate the shortest distance from a point to
- * a line segment, we do the following. Let's assume that
- *
- * ```
- * a = start point of the line segment
- * b = end point of the line segment
- * p = point from which shortest distance is to be calculated
- * ```
- *
- * (1) Write the parametric equation of the line.
- *
- * ```
- * point_on_line = a + (b - a) * t (t is the factor)
- * ```
- *
- * (2) Find the projection of point `p` on the line. The projection
- * will be perpendicular to the line, which allows us to get the
- * solution by making the dot product zero.
- *
- * ```
- * (point_on_line - a) . (p - point_on_line) = 0
- *
- * (point_on_line)
- * (a) x-------o----------------x (b)
- * |_|
- * |
- * |
- * (p)
- * ```
- *
- * (3) Simplification of the above equation yields the factor of
- * `point_on_line`:
- *
- * ```
- * t = ((p - a) . (b - a)) / |b - a|^2
- * ```
- *
- * (4) We clamp factor `t` between [0.0f, 1.0f] because `point_on_line`
- * can be outside of the line segment:
- *
- * ```
- * (point_on_line)
- * (a) x------------------------x (b) -----o---
- * |_|
- * |
- * |
- * (p)
- * ```
- *
- * (5) Finally, the distance we are interested in is
- *
- * ```
- * |point_on_line - p|
- * ```
- */
-
- FT_Error error = FT_Err_Ok;
-
- FT_Vector a; /* start position */
- FT_Vector b; /* end position */
- FT_Vector p; /* current point */
-
- FT_26D6_Vec line_segment; /* `b` - `a` */
- FT_26D6_Vec p_sub_a; /* `p` - `a` */
-
- FT_26D6 sq_line_length; /* squared length of `line_segment` */
- FT_16D16 factor; /* factor of the nearest point */
- FT_26D6 cross; /* used to determine sign */
-
- FT_16D16_Vec nearest_point; /* `point_on_line` */
- FT_16D16_Vec nearest_vector; /* `p` - `nearest_point` */
-
-
- if ( !line || !out )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( line->edge_type != SDF_EDGE_LINE )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- a = line->start_pos;
- b = line->end_pos;
- p = point;
-
- line_segment.x = b.x - a.x;
- line_segment.y = b.y - a.y;
-
- p_sub_a.x = p.x - a.x;
- p_sub_a.y = p.y - a.y;
-
- sq_line_length = ( line_segment.x * line_segment.x ) / 64 +
- ( line_segment.y * line_segment.y ) / 64;
-
- /* currently factor is 26.6 */
- factor = ( p_sub_a.x * line_segment.x ) / 64 +
- ( p_sub_a.y * line_segment.y ) / 64;
-
- /* now factor is 16.16 */
- factor = FT_DivFix( factor, sq_line_length );
-
- /* clamp the factor between 0.0 and 1.0 in fixed point */
- if ( factor > FT_INT_16D16( 1 ) )
- factor = FT_INT_16D16( 1 );
- if ( factor < 0 )
- factor = 0;
-
- nearest_point.x = FT_MulFix( FT_26D6_16D16( line_segment.x ),
- factor );
- nearest_point.y = FT_MulFix( FT_26D6_16D16( line_segment.y ),
- factor );
-
- nearest_point.x = FT_26D6_16D16( a.x ) + nearest_point.x;
- nearest_point.y = FT_26D6_16D16( a.y ) + nearest_point.y;
-
- nearest_vector.x = nearest_point.x - FT_26D6_16D16( p.x );
- nearest_vector.y = nearest_point.y - FT_26D6_16D16( p.y );
-
- cross = FT_MulFix( nearest_vector.x, line_segment.y ) -
- FT_MulFix( nearest_vector.y, line_segment.x );
-
- /* assign the output */
- out->sign = cross < 0 ? 1 : -1;
- out->distance = VECTOR_LENGTH_16D16( nearest_vector );
-
- /* Instead of finding `cross` for checking corner we */
- /* directly set it here. This is more efficient */
- /* because if the distance is perpendicular we can */
- /* directly set it to 1. */
- if ( factor != 0 && factor != FT_INT_16D16( 1 ) )
- out->cross = FT_INT_16D16( 1 );
- else
- {
- /* [OPTIMIZATION]: Pre-compute this direction. */
- /* If not perpendicular then compute `cross`. */
- FT_Vector_NormLen( &line_segment );
- FT_Vector_NormLen( &nearest_vector );
-
- out->cross = FT_MulFix( line_segment.x, nearest_vector.y ) -
- FT_MulFix( line_segment.y, nearest_vector.x );
- }
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * get_min_distance_conic
- *
- * @Description:
- * Find the shortest distance from the `conic` Bezier curve to a given
- * `point` and assign it to `out`. Use it for conic/quadratic curves
- * only.
- *
- * @Input:
- * conic ::
- * The conic Bezier curve to which the shortest distance is to be
- * computed.
- *
- * point ::
- * Point from which the shortest distance is to be computed.
- *
- * @Output:
- * out ::
- * Signed distance from `point` to `conic`.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- * @Note:
- * The `conic` parameter must have an edge type of `SDF_EDGE_CONIC`.
- *
- */
-
-#if !USE_NEWTON_FOR_CONIC
-
- /*
- * The function uses an analytical method to find the shortest distance
- * which is faster than the Newton-Raphson method, but has underflows at
- * the moment. Use Newton's method if you can see artifacts in the SDF.
- */
- static FT_Error
- get_min_distance_conic( SDF_Edge* conic,
- FT_26D6_Vec point,
- SDF_Signed_Distance* out )
- {
- /*
- * The procedure to find the shortest distance from a point to a
- * quadratic Bezier curve is similar to the line segment algorithm. The
- * shortest distance is perpendicular to the Bezier curve; the only
- * difference from line is that there can be more than one
- * perpendicular, and we also have to check the endpoints, because the
- * perpendicular may not be the shortest.
- *
- * Let's assume that
- * ```
- * p0 = first endpoint
- * p1 = control point
- * p2 = second endpoint
- * p = point from which shortest distance is to be calculated
- * ```
- *
- * (1) The equation of a quadratic Bezier curve can be written as
- *
- * ```
- * B(t) = (1 - t)^2 * p0 + 2(1 - t)t * p1 + t^2 * p2
- * ```
- *
- * with `t` a factor in the range [0.0f, 1.0f]. This equation can
- * be rewritten as
- *
- * ```
- * B(t) = t^2 * (p0 - 2p1 + p2) + 2t * (p1 - p0) + p0
- * ```
- *
- * With
- *
- * ```
- * A = p0 - 2p1 + p2
- * B = p1 - p0
- * ```
- *
- * we have
- *
- * ```
- * B(t) = t^2 * A + 2t * B + p0
- * ```
- *
- * (2) The derivative of the last equation above is
- *
- * ```
- * B'(t) = 2 *(tA + B)
- * ```
- *
- * (3) To find the shortest distance from `p` to `B(t)` we find the
- * point on the curve at which the shortest distance vector (i.e.,
- * `B(t) - p`) and the direction (i.e., `B'(t)`) make 90 degrees.
- * In other words, we make the dot product zero.
- *
- * ```
- * (B(t) - p) . (B'(t)) = 0
- * (t^2 * A + 2t * B + p0 - p) . (2 * (tA + B)) = 0
- * ```
- *
- * After simplifying we get a cubic equation
- *
- * ```
- * at^3 + bt^2 + ct + d = 0
- * ```
- *
- * with
- *
- * ```
- * a = A.A
- * b = 3A.B
- * c = 2B.B + A.p0 - A.p
- * d = p0.B - p.B
- * ```
- *
- * (4) Now the roots of the equation can be computed using 'Cardano's
- * Cubic formula'; we clamp the roots in the range [0.0f, 1.0f].
- *
- * [note]: `B` and `B(t)` are different in the above equations.
- */
-
- FT_Error error = FT_Err_Ok;
-
- FT_26D6_Vec aA, bB; /* A, B in the above comment */
- FT_26D6_Vec nearest_point; /* point on curve nearest to `point` */
- FT_26D6_Vec direction; /* direction of curve at `nearest_point` */
-
- FT_26D6_Vec p0, p1, p2; /* control points of a conic curve */
- FT_26D6_Vec p; /* `point` to which shortest distance */
-
- FT_26D6 a, b, c, d; /* cubic coefficients */
-
- FT_16D16 roots[3] = { 0, 0, 0 }; /* real roots of the cubic eq. */
- FT_16D16 min_factor; /* factor at `nearest_point` */
- FT_16D16 cross; /* to determine the sign */
- FT_16D16 min = FT_INT_MAX; /* shortest squared distance */
-
- FT_UShort num_roots; /* number of real roots of cubic */
- FT_UShort i;
-
-
- if ( !conic || !out )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( conic->edge_type != SDF_EDGE_CONIC )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- p0 = conic->start_pos;
- p1 = conic->control_a;
- p2 = conic->end_pos;
- p = point;
-
- /* compute substitution coefficients */
- aA.x = p0.x - 2 * p1.x + p2.x;
- aA.y = p0.y - 2 * p1.y + p2.y;
-
- bB.x = p1.x - p0.x;
- bB.y = p1.y - p0.y;
-
- /* compute cubic coefficients */
- a = VEC_26D6_DOT( aA, aA );
-
- b = 3 * VEC_26D6_DOT( aA, bB );
-
- c = 2 * VEC_26D6_DOT( bB, bB ) +
- VEC_26D6_DOT( aA, p0 ) -
- VEC_26D6_DOT( aA, p );
-
- d = VEC_26D6_DOT( p0, bB ) -
- VEC_26D6_DOT( p, bB );
-
- /* find the roots */
- num_roots = solve_cubic_equation( a, b, c, d, roots );
-
- if ( num_roots == 0 )
- {
- roots[0] = 0;
- roots[1] = FT_INT_16D16( 1 );
- num_roots = 2;
- }
-
- /* [OPTIMIZATION]: Check the roots, clamp them and discard */
- /* duplicate roots. */
-
- /* convert these values to 16.16 for further computation */
- aA.x = FT_26D6_16D16( aA.x );
- aA.y = FT_26D6_16D16( aA.y );
-
- bB.x = FT_26D6_16D16( bB.x );
- bB.y = FT_26D6_16D16( bB.y );
-
- p0.x = FT_26D6_16D16( p0.x );
- p0.y = FT_26D6_16D16( p0.y );
-
- p.x = FT_26D6_16D16( p.x );
- p.y = FT_26D6_16D16( p.y );
-
- for ( i = 0; i < num_roots; i++ )
- {
- FT_16D16 t = roots[i];
- FT_16D16 t2 = 0;
- FT_16D16 dist = 0;
-
- FT_16D16_Vec curve_point;
- FT_16D16_Vec dist_vector;
-
- /*
- * Ideally we should discard the roots which are outside the range
- * [0.0, 1.0] and check the endpoints of the Bezier curve, but Behdad
- * Esfahbod proved the following lemma.
- *
- * Lemma:
- *
- * (1) If the closest point on the curve [0, 1] is to the endpoint at
- * `t` = 1 and the cubic has no real roots at `t` = 1 then the
- * cubic must have a real root at some `t` > 1.
- *
- * (2) Similarly, if the closest point on the curve [0, 1] is to the
- * endpoint at `t` = 0 and the cubic has no real roots at `t` = 0
- * then the cubic must have a real root at some `t` < 0.
- *
- * Now because of this lemma we only need to clamp the roots and that
- * will take care of the endpoints.
- *
- * For more details see
- *
- * https://lists.nongnu.org/archive/html/freetype-devel/2020-06/msg00147.html
- */
-
- if ( t < 0 )
- t = 0;
- if ( t > FT_INT_16D16( 1 ) )
- t = FT_INT_16D16( 1 );
-
- t2 = FT_MulFix( t, t );
-
- /* B(t) = t^2 * A + 2t * B + p0 - p */
- curve_point.x = FT_MulFix( aA.x, t2 ) +
- 2 * FT_MulFix( bB.x, t ) + p0.x;
- curve_point.y = FT_MulFix( aA.y, t2 ) +
- 2 * FT_MulFix( bB.y, t ) + p0.y;
-
- /* `curve_point` - `p` */
- dist_vector.x = curve_point.x - p.x;
- dist_vector.y = curve_point.y - p.y;
-
- dist = VECTOR_LENGTH_16D16( dist_vector );
-
- if ( dist < min )
- {
- min = dist;
- nearest_point = curve_point;
- min_factor = t;
- }
- }
-
- /* B'(t) = 2 * (tA + B) */
- direction.x = 2 * FT_MulFix( aA.x, min_factor ) + 2 * bB.x;
- direction.y = 2 * FT_MulFix( aA.y, min_factor ) + 2 * bB.y;
-
- /* determine the sign */
- cross = FT_MulFix( nearest_point.x - p.x, direction.y ) -
- FT_MulFix( nearest_point.y - p.y, direction.x );
-
- /* assign the values */
- out->distance = min;
- out->sign = cross < 0 ? 1 : -1;
-
- if ( min_factor != 0 && min_factor != FT_INT_16D16( 1 ) )
- out->cross = FT_INT_16D16( 1 ); /* the two are perpendicular */
- else
- {
- /* convert to nearest vector */
- nearest_point.x -= FT_26D6_16D16( p.x );
- nearest_point.y -= FT_26D6_16D16( p.y );
-
- /* compute `cross` if not perpendicular */
- FT_Vector_NormLen( &direction );
- FT_Vector_NormLen( &nearest_point );
-
- out->cross = FT_MulFix( direction.x, nearest_point.y ) -
- FT_MulFix( direction.y, nearest_point.x );
- }
-
- Exit:
- return error;
- }
-
-#else /* USE_NEWTON_FOR_CONIC */
-
- /*
- * The function uses Newton's approximation to find the shortest distance,
- * which is a bit slower than the analytical method but doesn't cause
- * underflow.
- */
- static FT_Error
- get_min_distance_conic( SDF_Edge* conic,
- FT_26D6_Vec point,
- SDF_Signed_Distance* out )
- {
- /*
- * This method uses Newton-Raphson's approximation to find the shortest
- * distance from a point to a conic curve. It does not involve solving
- * any cubic equation, that is why there is no risk of underflow.
- *
- * Let's assume that
- *
- * ```
- * p0 = first endpoint
- * p1 = control point
- * p3 = second endpoint
- * p = point from which shortest distance is to be calculated
- * ```
- *
- * (1) The equation of a quadratic Bezier curve can be written as
- *
- * ```
- * B(t) = (1 - t)^2 * p0 + 2(1 - t)t * p1 + t^2 * p2
- * ```
- *
- * with `t` the factor in the range [0.0f, 1.0f]. The above
- * equation can be rewritten as
- *
- * ```
- * B(t) = t^2 * (p0 - 2p1 + p2) + 2t * (p1 - p0) + p0
- * ```
- *
- * With
- *
- * ```
- * A = p0 - 2p1 + p2
- * B = 2 * (p1 - p0)
- * ```
- *
- * we have
- *
- * ```
- * B(t) = t^2 * A + t * B + p0
- * ```
- *
- * (2) The derivative of the above equation is
- *
- * ```
- * B'(t) = 2t * A + B
- * ```
- *
- * (3) The second derivative of the above equation is
- *
- * ```
- * B''(t) = 2A
- * ```
- *
- * (4) The equation `P(t)` of the distance from point `p` to the curve
- * can be written as
- *
- * ```
- * P(t) = t^2 * A + t^2 * B + p0 - p
- * ```
- *
- * With
- *
- * ```
- * C = p0 - p
- * ```
- *
- * we have
- *
- * ```
- * P(t) = t^2 * A + t * B + C
- * ```
- *
- * (5) Finally, the equation of the angle between `B(t)` and `P(t)` can
- * be written as
- *
- * ```
- * Q(t) = P(t) . B'(t)
- * ```
- *
- * (6) Our task is to find a value of `t` such that the above equation
- * `Q(t)` becomes zero, this is, the point-to-curve vector makes
- * 90~degrees with the curve. We solve this with the Newton-Raphson
- * method.
- *
- * (7) We first assume an arbitary value of factor `t`, which we then
- * improve.
- *
- * ```
- * t := Q(t) / Q'(t)
- * ```
- *
- * Putting the value of `Q(t)` from the above equation gives
- *
- * ```
- * t := P(t) . B'(t) / derivative(P(t) . B'(t))
- * t := P(t) . B'(t) /
- * (P'(t) . B'(t) + P(t) . B''(t))
- * ```
- *
- * Note that `P'(t)` is the same as `B'(t)` because the constant is
- * gone due to the derivative.
- *
- * (8) Finally we get the equation to improve the factor as
- *
- * ```
- * t := P(t) . B'(t) /
- * (B'(t) . B'(t) + P(t) . B''(t))
- * ```
- *
- * [note]: `B` and `B(t)` are different in the above equations.
- */
-
- FT_Error error = FT_Err_Ok;
-
- FT_26D6_Vec aA, bB, cC; /* A, B, C in the above comment */
- FT_26D6_Vec nearest_point; /* point on curve nearest to `point` */
- FT_26D6_Vec direction; /* direction of curve at `nearest_point` */
-
- FT_26D6_Vec p0, p1, p2; /* control points of a conic curve */
- FT_26D6_Vec p; /* `point` to which shortest distance */
-
- FT_16D16 min_factor = 0; /* factor at `nearest_point' */
- FT_16D16 cross; /* to determine the sign */
- FT_16D16 min = FT_INT_MAX; /* shortest squared distance */
-
- FT_UShort iterations;
- FT_UShort steps;
-
-
- if ( !conic || !out )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( conic->edge_type != SDF_EDGE_CONIC )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- p0 = conic->start_pos;
- p1 = conic->control_a;
- p2 = conic->end_pos;
- p = point;
-
- /* compute substitution coefficients */
- aA.x = p0.x - 2 * p1.x + p2.x;
- aA.y = p0.y - 2 * p1.y + p2.y;
-
- bB.x = 2 * ( p1.x - p0.x );
- bB.y = 2 * ( p1.y - p0.y );
-
- cC.x = p0.x;
- cC.y = p0.y;
-
- /* do Newton's iterations */
- for ( iterations = 0; iterations <= MAX_NEWTON_DIVISIONS; iterations++ )
- {
- FT_16D16 factor = FT_INT_16D16( iterations ) / MAX_NEWTON_DIVISIONS;
- FT_16D16 factor2;
- FT_16D16 length;
-
- FT_16D16_Vec curve_point; /* point on the curve */
- FT_16D16_Vec dist_vector; /* `curve_point` - `p` */
-
- FT_26D6_Vec d1; /* first derivative */
- FT_26D6_Vec d2; /* second derivative */
-
- FT_16D16 temp1;
- FT_16D16 temp2;
-
-
- for ( steps = 0; steps < MAX_NEWTON_STEPS; steps++ )
- {
- factor2 = FT_MulFix( factor, factor );
-
- /* B(t) = t^2 * A + t * B + p0 */
- curve_point.x = FT_MulFix( aA.x, factor2 ) +
- FT_MulFix( bB.x, factor ) + cC.x;
- curve_point.y = FT_MulFix( aA.y, factor2 ) +
- FT_MulFix( bB.y, factor ) + cC.y;
-
- /* convert to 16.16 */
- curve_point.x = FT_26D6_16D16( curve_point.x );
- curve_point.y = FT_26D6_16D16( curve_point.y );
-
- /* P(t) in the comment */
- dist_vector.x = curve_point.x - FT_26D6_16D16( p.x );
- dist_vector.y = curve_point.y - FT_26D6_16D16( p.y );
-
- length = VECTOR_LENGTH_16D16( dist_vector );
-
- if ( length < min )
- {
- min = length;
- min_factor = factor;
- nearest_point = curve_point;
- }
-
- /* This is Newton's approximation. */
- /* */
- /* t := P(t) . B'(t) / */
- /* (B'(t) . B'(t) + P(t) . B''(t)) */
-
- /* B'(t) = 2tA + B */
- d1.x = FT_MulFix( aA.x, 2 * factor ) + bB.x;
- d1.y = FT_MulFix( aA.y, 2 * factor ) + bB.y;
-
- /* B''(t) = 2A */
- d2.x = 2 * aA.x;
- d2.y = 2 * aA.y;
-
- dist_vector.x /= 1024;
- dist_vector.y /= 1024;
-
- /* temp1 = P(t) . B'(t) */
- temp1 = VEC_26D6_DOT( dist_vector, d1 );
-
- /* temp2 = B'(t) . B'(t) + P(t) . B''(t) */
- temp2 = VEC_26D6_DOT( d1, d1 ) +
- VEC_26D6_DOT( dist_vector, d2 );
-
- factor -= FT_DivFix( temp1, temp2 );
-
- if ( factor < 0 || factor > FT_INT_16D16( 1 ) )
- break;
- }
- }
-
- /* B'(t) = 2t * A + B */
- direction.x = 2 * FT_MulFix( aA.x, min_factor ) + bB.x;
- direction.y = 2 * FT_MulFix( aA.y, min_factor ) + bB.y;
-
- /* determine the sign */
- cross = FT_MulFix( nearest_point.x - FT_26D6_16D16( p.x ),
- direction.y ) -
- FT_MulFix( nearest_point.y - FT_26D6_16D16( p.y ),
- direction.x );
-
- /* assign the values */
- out->distance = min;
- out->sign = cross < 0 ? 1 : -1;
-
- if ( min_factor != 0 && min_factor != FT_INT_16D16( 1 ) )
- out->cross = FT_INT_16D16( 1 ); /* the two are perpendicular */
- else
- {
- /* convert to nearest vector */
- nearest_point.x -= FT_26D6_16D16( p.x );
- nearest_point.y -= FT_26D6_16D16( p.y );
-
- /* compute `cross` if not perpendicular */
- FT_Vector_NormLen( &direction );
- FT_Vector_NormLen( &nearest_point );
-
- out->cross = FT_MulFix( direction.x, nearest_point.y ) -
- FT_MulFix( direction.y, nearest_point.x );
- }
-
- Exit:
- return error;
- }
-
-
-#endif /* USE_NEWTON_FOR_CONIC */
-
-
- /**************************************************************************
- *
- * @Function:
- * get_min_distance_cubic
- *
- * @Description:
- * Find the shortest distance from the `cubic` Bezier curve to a given
- * `point` and assigns it to `out`. Use it for cubic curves only.
- *
- * @Input:
- * cubic ::
- * The cubic Bezier curve to which the shortest distance is to be
- * computed.
- *
- * point ::
- * Point from which the shortest distance is to be computed.
- *
- * @Output:
- * out ::
- * Signed distance from `point` to `cubic`.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- * @Note:
- * The function uses Newton's approximation to find the shortest
- * distance. Another way would be to divide the cubic into conic or
- * subdivide the curve into lines, but that is not implemented.
- *
- * The `cubic` parameter must have an edge type of `SDF_EDGE_CUBIC`.
- *
- */
- static FT_Error
- get_min_distance_cubic( SDF_Edge* cubic,
- FT_26D6_Vec point,
- SDF_Signed_Distance* out )
- {
- /*
- * The procedure to find the shortest distance from a point to a cubic
- * Bezier curve is similar to quadratic curve algorithm. The only
- * difference is that while calculating factor `t`, instead of a cubic
- * polynomial equation we have to find the roots of a 5th degree
- * polynomial equation. Solving this would require a significant amount
- * of time, and still the results may not be accurate. We are thus
- * going to directly approximate the value of `t` using the Newton-Raphson
- * method.
- *
- * Let's assume that
- *
- * ```
- * p0 = first endpoint
- * p1 = first control point
- * p2 = second control point
- * p3 = second endpoint
- * p = point from which shortest distance is to be calculated
- * ```
- *
- * (1) The equation of a cubic Bezier curve can be written as
- *
- * ```
- * B(t) = (1 - t)^3 * p0 + 3(1 - t)^2 t * p1 +
- * 3(1 - t)t^2 * p2 + t^3 * p3
- * ```
- *
- * The equation can be expanded and written as
- *
- * ```
- * B(t) = t^3 * (-p0 + 3p1 - 3p2 + p3) +
- * 3t^2 * (p0 - 2p1 + p2) + 3t * (-p0 + p1) + p0
- * ```
- *
- * With
- *
- * ```
- * A = -p0 + 3p1 - 3p2 + p3
- * B = 3(p0 - 2p1 + p2)
- * C = 3(-p0 + p1)
- * ```
- *
- * we have
- *
- * ```
- * B(t) = t^3 * A + t^2 * B + t * C + p0
- * ```
- *
- * (2) The derivative of the above equation is
- *
- * ```
- * B'(t) = 3t^2 * A + 2t * B + C
- * ```
- *
- * (3) The second derivative of the above equation is
- *
- * ```
- * B''(t) = 6t * A + 2B
- * ```
- *
- * (4) The equation `P(t)` of the distance from point `p` to the curve
- * can be written as
- *
- * ```
- * P(t) = t^3 * A + t^2 * B + t * C + p0 - p
- * ```
- *
- * With
- *
- * ```
- * D = p0 - p
- * ```
- *
- * we have
- *
- * ```
- * P(t) = t^3 * A + t^2 * B + t * C + D
- * ```
- *
- * (5) Finally the equation of the angle between `B(t)` and `P(t)` can
- * be written as
- *
- * ```
- * Q(t) = P(t) . B'(t)
- * ```
- *
- * (6) Our task is to find a value of `t` such that the above equation
- * `Q(t)` becomes zero, this is, the point-to-curve vector makes
- * 90~degree with curve. We solve this with the Newton-Raphson
- * method.
- *
- * (7) We first assume an arbitary value of factor `t`, which we then
- * improve.
- *
- * ```
- * t := Q(t) / Q'(t)
- * ```
- *
- * Putting the value of `Q(t)` from the above equation gives
- *
- * ```
- * t := P(t) . B'(t) / derivative(P(t) . B'(t))
- * t := P(t) . B'(t) /
- * (P'(t) . B'(t) + P(t) . B''(t))
- * ```
- *
- * Note that `P'(t)` is the same as `B'(t)` because the constant is
- * gone due to the derivative.
- *
- * (8) Finally we get the equation to improve the factor as
- *
- * ```
- * t := P(t) . B'(t) /
- * (B'(t) . B'( t ) + P(t) . B''(t))
- * ```
- *
- * [note]: `B` and `B(t)` are different in the above equations.
- */
-
- FT_Error error = FT_Err_Ok;
-
- FT_26D6_Vec aA, bB, cC, dD; /* A, B, C in the above comment */
- FT_16D16_Vec nearest_point; /* point on curve nearest to `point` */
- FT_16D16_Vec direction; /* direction of curve at `nearest_point` */
-
- FT_26D6_Vec p0, p1, p2, p3; /* control points of a cubic curve */
- FT_26D6_Vec p; /* `point` to which shortest distance */
-
- FT_16D16 min_factor = 0; /* factor at shortest distance */
- FT_16D16 min_factor_sq = 0; /* factor at shortest distance */
- FT_16D16 cross; /* to determine the sign */
- FT_16D16 min = FT_INT_MAX; /* shortest distance */
-
- FT_UShort iterations;
- FT_UShort steps;
-
-
- if ( !cubic || !out )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( cubic->edge_type != SDF_EDGE_CUBIC )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- p0 = cubic->start_pos;
- p1 = cubic->control_a;
- p2 = cubic->control_b;
- p3 = cubic->end_pos;
- p = point;
-
- /* compute substitution coefficients */
- aA.x = -p0.x + 3 * ( p1.x - p2.x ) + p3.x;
- aA.y = -p0.y + 3 * ( p1.y - p2.y ) + p3.y;
-
- bB.x = 3 * ( p0.x - 2 * p1.x + p2.x );
- bB.y = 3 * ( p0.y - 2 * p1.y + p2.y );
-
- cC.x = 3 * ( p1.x - p0.x );
- cC.y = 3 * ( p1.y - p0.y );
-
- dD.x = p0.x;
- dD.y = p0.y;
-
- for ( iterations = 0; iterations <= MAX_NEWTON_DIVISIONS; iterations++ )
- {
- FT_16D16 factor = FT_INT_16D16( iterations ) / MAX_NEWTON_DIVISIONS;
-
- FT_16D16 factor2; /* factor^2 */
- FT_16D16 factor3; /* factor^3 */
- FT_16D16 length;
-
- FT_16D16_Vec curve_point; /* point on the curve */
- FT_16D16_Vec dist_vector; /* `curve_point' - `p' */
-
- FT_26D6_Vec d1; /* first derivative */
- FT_26D6_Vec d2; /* second derivative */
-
- FT_16D16 temp1;
- FT_16D16 temp2;
-
-
- for ( steps = 0; steps < MAX_NEWTON_STEPS; steps++ )
- {
- factor2 = FT_MulFix( factor, factor );
- factor3 = FT_MulFix( factor2, factor );
-
- /* B(t) = t^3 * A + t^2 * B + t * C + D */
- curve_point.x = FT_MulFix( aA.x, factor3 ) +
- FT_MulFix( bB.x, factor2 ) +
- FT_MulFix( cC.x, factor ) + dD.x;
- curve_point.y = FT_MulFix( aA.y, factor3 ) +
- FT_MulFix( bB.y, factor2 ) +
- FT_MulFix( cC.y, factor ) + dD.y;
-
- /* convert to 16.16 */
- curve_point.x = FT_26D6_16D16( curve_point.x );
- curve_point.y = FT_26D6_16D16( curve_point.y );
-
- /* P(t) in the comment */
- dist_vector.x = curve_point.x - FT_26D6_16D16( p.x );
- dist_vector.y = curve_point.y - FT_26D6_16D16( p.y );
-
- length = VECTOR_LENGTH_16D16( dist_vector );
-
- if ( length < min )
- {
- min = length;
- min_factor = factor;
- min_factor_sq = factor2;
- nearest_point = curve_point;
- }
-
- /* This the Newton's approximation. */
- /* */
- /* t := P(t) . B'(t) / */
- /* (B'(t) . B'(t) + P(t) . B''(t)) */
-
- /* B'(t) = 3t^2 * A + 2t * B + C */
- d1.x = FT_MulFix( aA.x, 3 * factor2 ) +
- FT_MulFix( bB.x, 2 * factor ) + cC.x;
- d1.y = FT_MulFix( aA.y, 3 * factor2 ) +
- FT_MulFix( bB.y, 2 * factor ) + cC.y;
-
- /* B''(t) = 6t * A + 2B */
- d2.x = FT_MulFix( aA.x, 6 * factor ) + 2 * bB.x;
- d2.y = FT_MulFix( aA.y, 6 * factor ) + 2 * bB.y;
-
- dist_vector.x /= 1024;
- dist_vector.y /= 1024;
-
- /* temp1 = P(t) . B'(t) */
- temp1 = VEC_26D6_DOT( dist_vector, d1 );
-
- /* temp2 = B'(t) . B'(t) + P(t) . B''(t) */
- temp2 = VEC_26D6_DOT( d1, d1 ) +
- VEC_26D6_DOT( dist_vector, d2 );
-
- factor -= FT_DivFix( temp1, temp2 );
-
- if ( factor < 0 || factor > FT_INT_16D16( 1 ) )
- break;
- }
- }
-
- /* B'(t) = 3t^2 * A + 2t * B + C */
- direction.x = FT_MulFix( aA.x, 3 * min_factor_sq ) +
- FT_MulFix( bB.x, 2 * min_factor ) + cC.x;
- direction.y = FT_MulFix( aA.y, 3 * min_factor_sq ) +
- FT_MulFix( bB.y, 2 * min_factor ) + cC.y;
-
- /* determine the sign */
- cross = FT_MulFix( nearest_point.x - FT_26D6_16D16( p.x ),
- direction.y ) -
- FT_MulFix( nearest_point.y - FT_26D6_16D16( p.y ),
- direction.x );
-
- /* assign the values */
- out->distance = min;
- out->sign = cross < 0 ? 1 : -1;
-
- if ( min_factor != 0 && min_factor != FT_INT_16D16( 1 ) )
- out->cross = FT_INT_16D16( 1 ); /* the two are perpendicular */
- else
- {
- /* convert to nearest vector */
- nearest_point.x -= FT_26D6_16D16( p.x );
- nearest_point.y -= FT_26D6_16D16( p.y );
-
- /* compute `cross` if not perpendicular */
- FT_Vector_NormLen( &direction );
- FT_Vector_NormLen( &nearest_point );
-
- out->cross = FT_MulFix( direction.x, nearest_point.y ) -
- FT_MulFix( direction.y, nearest_point.x );
- }
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * sdf_edge_get_min_distance
- *
- * @Description:
- * Find shortest distance from `point` to any type of `edge`. It checks
- * the edge type and then calls the relevant `get_min_distance_*`
- * function.
- *
- * @Input:
- * edge ::
- * An edge to which the shortest distance is to be computed.
- *
- * point ::
- * Point from which the shortest distance is to be computed.
- *
- * @Output:
- * out ::
- * Signed distance from `point` to `edge`.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- */
- static FT_Error
- sdf_edge_get_min_distance( SDF_Edge* edge,
- FT_26D6_Vec point,
- SDF_Signed_Distance* out )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( !edge || !out )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* edge-specific distance calculation */
- switch ( edge->edge_type )
- {
- case SDF_EDGE_LINE:
- get_min_distance_line( edge, point, out );
- break;
-
- case SDF_EDGE_CONIC:
- get_min_distance_conic( edge, point, out );
- break;
-
- case SDF_EDGE_CUBIC:
- get_min_distance_cubic( edge, point, out );
- break;
-
- default:
- error = FT_THROW( Invalid_Argument );
- }
-
- Exit:
- return error;
- }
-
-
- /* `sdf_generate' is not used at the moment */
-#if 0
-
- #error "DO NOT USE THIS!"
- #error "The function still outputs 16-bit data, which might cause memory"
- #error "corruption. If required I will add this later."
-
- /**************************************************************************
- *
- * @Function:
- * sdf_contour_get_min_distance
- *
- * @Description:
- * Iterate over all edges that make up the contour, find the shortest
- * distance from a point to this contour, and assigns result to `out`.
- *
- * @Input:
- * contour ::
- * A contour to which the shortest distance is to be computed.
- *
- * point ::
- * Point from which the shortest distance is to be computed.
- *
- * @Output:
- * out ::
- * Signed distance from the `point' to the `contour'.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- * @Note:
- * The function does not return a signed distance for each edge which
- * makes up the contour, it simply returns the shortest of all the
- * edges.
- *
- */
- static FT_Error
- sdf_contour_get_min_distance( SDF_Contour* contour,
- FT_26D6_Vec point,
- SDF_Signed_Distance* out )
- {
- FT_Error error = FT_Err_Ok;
- SDF_Signed_Distance min_dist = max_sdf;
- SDF_Edge* edge_list;
-
-
- if ( !contour || !out )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- edge_list = contour->edges;
-
- /* iterate over all the edges manually */
- while ( edge_list )
- {
- SDF_Signed_Distance current_dist = max_sdf;
- FT_16D16 diff;
-
-
- FT_CALL( sdf_edge_get_min_distance( edge_list,
- point,
- &current_dist ) );
-
- if ( current_dist.distance >= 0 )
- {
- diff = current_dist.distance - min_dist.distance;
-
-
- if ( FT_ABS(diff ) < CORNER_CHECK_EPSILON )
- min_dist = resolve_corner( min_dist, current_dist );
- else if ( diff < 0 )
- min_dist = current_dist;
- }
- else
- FT_TRACE0(( "sdf_contour_get_min_distance: Overflow.\n" ));
-
- edge_list = edge_list->next;
- }
-
- *out = min_dist;
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * sdf_generate
- *
- * @Description:
- * This is the main function that is responsible for generating signed
- * distance fields. The function does not align or compute the size of
- * `bitmap`; therefore the calling application must set up `bitmap`
- * properly and transform the `shape' appropriately in advance.
- *
- * Currently we check all pixels against all contours and all edges.
- *
- * @Input:
- * internal_params ::
- * Internal parameters and properties required by the rasterizer. See
- * @SDF_Params for more.
- *
- * shape ::
- * A complete shape which is used to generate SDF.
- *
- * spread ::
- * Maximum distances to be allowed in the output bitmap.
- *
- * @Output:
- * bitmap ::
- * The output bitmap which will contain the SDF information.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- */
- static FT_Error
- sdf_generate( const SDF_Params internal_params,
- const SDF_Shape* shape,
- FT_UInt spread,
- const FT_Bitmap* bitmap )
- {
- FT_Error error = FT_Err_Ok;
-
- FT_UInt width = 0;
- FT_UInt rows = 0;
- FT_UInt x = 0; /* used to loop in x direction, i.e., width */
- FT_UInt y = 0; /* used to loop in y direction, i.e., rows */
- FT_UInt sp_sq = 0; /* `spread` [* `spread`] as a 16.16 fixed value */
-
- FT_Short* buffer;
-
-
- if ( !shape || !bitmap )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( spread < MIN_SPREAD || spread > MAX_SPREAD )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- width = bitmap->width;
- rows = bitmap->rows;
- buffer = (FT_Short*)bitmap->buffer;
-
- if ( USE_SQUARED_DISTANCES )
- sp_sq = FT_INT_16D16( spread * spread );
- else
- sp_sq = FT_INT_16D16( spread );
-
- if ( width == 0 || rows == 0 )
- {
- FT_TRACE0(( "sdf_generate:"
- " Cannot render glyph with width/height == 0\n" ));
- FT_TRACE0(( " "
- " (width, height provided [%d, %d])\n",
- width, rows ));
-
- error = FT_THROW( Cannot_Render_Glyph );
- goto Exit;
- }
-
- /* loop over all rows */
- for ( y = 0; y < rows; y++ )
- {
- /* loop over all pixels of a row */
- for ( x = 0; x < width; x++ )
- {
- /* `grid_point` is the current pixel position; */
- /* our task is to find the shortest distance */
- /* from this point to the entire shape. */
- FT_26D6_Vec grid_point = zero_vector;
- SDF_Signed_Distance min_dist = max_sdf;
- SDF_Contour* contour_list;
-
- FT_UInt index;
- FT_Short value;
-
-
- grid_point.x = FT_INT_26D6( x );
- grid_point.y = FT_INT_26D6( y );
-
- /* This `grid_point' is at the corner, but we */
- /* use the center of the pixel. */
- grid_point.x += FT_INT_26D6( 1 ) / 2;
- grid_point.y += FT_INT_26D6( 1 ) / 2;
-
- contour_list = shape->contours;
-
- /* iterate over all contours manually */
- while ( contour_list )
- {
- SDF_Signed_Distance current_dist = max_sdf;
-
-
- FT_CALL( sdf_contour_get_min_distance( contour_list,
- grid_point,
- &current_dist ) );
-
- if ( current_dist.distance < min_dist.distance )
- min_dist = current_dist;
-
- contour_list = contour_list->next;
- }
-
- /* [OPTIMIZATION]: if (min_dist > sp_sq) then simply clamp */
- /* the value to spread to avoid square_root */
-
- /* clamp the values to spread */
- if ( min_dist.distance > sp_sq )
- min_dist.distance = sp_sq;
-
- /* square_root the values and fit in a 6.10 fixed point */
- if ( USE_SQUARED_DISTANCES )
- min_dist.distance = square_root( min_dist.distance );
-
- if ( internal_params.orientation == FT_ORIENTATION_FILL_LEFT )
- min_dist.sign = -min_dist.sign;
- if ( internal_params.flip_sign )
- min_dist.sign = -min_dist.sign;
-
- min_dist.distance /= 64; /* convert from 16.16 to 22.10 */
-
- value = min_dist.distance & 0x0000FFFF; /* truncate to 6.10 */
- value *= min_dist.sign;
-
- if ( internal_params.flip_y )
- index = y * width + x;
- else
- index = ( rows - y - 1 ) * width + x;
-
- buffer[index] = value;
- }
- }
-
- Exit:
- return error;
- }
-
-#endif /* 0 */
-
-
- /**************************************************************************
- *
- * @Function:
- * sdf_generate_bounding_box
- *
- * @Description:
- * This function does basically the same thing as `sdf_generate` above
- * but more efficiently.
- *
- * Instead of checking all pixels against all edges, we loop over all
- * edges and only check pixels around the control box of the edge; the
- * control box is increased by the spread in all directions. Anything
- * outside of the control box that exceeds `spread` doesn't need to be
- * computed.
- *
- * Lastly, to determine the sign of unchecked pixels, we do a single
- * pass of all rows starting with a '+' sign and flipping when we come
- * across a '-' sign and continue. This also eliminates the possibility
- * of overflow because we only check the proximity of the curve.
- * Therefore we can use squared distanced safely.
- *
- * @Input:
- * internal_params ::
- * Internal parameters and properties required by the rasterizer.
- * See @SDF_Params for more.
- *
- * shape ::
- * A complete shape which is used to generate SDF.
- *
- * spread ::
- * Maximum distances to be allowed in the output bitmap.
- *
- * @Output:
- * bitmap ::
- * The output bitmap which will contain the SDF information.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- */
- static FT_Error
- sdf_generate_bounding_box( const SDF_Params internal_params,
- const SDF_Shape* shape,
- FT_UInt spread,
- const FT_Bitmap* bitmap )
- {
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = NULL;
-
- FT_Int width, rows, i, j;
- FT_Int sp_sq; /* max value to check */
-
- SDF_Contour* contours; /* list of all contours */
- FT_SDFFormat* buffer; /* the bitmap buffer */
-
- /* This buffer has the same size in indices as the */
- /* bitmap buffer. When we check a pixel position for */
- /* a shortest distance we keep it in this buffer. */
- /* This way we can find out which pixel is set, */
- /* and also determine the signs properly. */
- SDF_Signed_Distance* dists = NULL;
-
- const FT_16D16 fixed_spread = FT_INT_16D16( spread );
-
-
- if ( !shape || !bitmap )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( spread < MIN_SPREAD || spread > MAX_SPREAD )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- memory = shape->memory;
- if ( !memory )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( FT_ALLOC( dists,
- bitmap->width * bitmap->rows * sizeof ( *dists ) ) )
- goto Exit;
-
- contours = shape->contours;
- width = (FT_Int)bitmap->width;
- rows = (FT_Int)bitmap->rows;
- buffer = (FT_SDFFormat*)bitmap->buffer;
-
- if ( USE_SQUARED_DISTANCES )
- sp_sq = fixed_spread * fixed_spread;
- else
- sp_sq = fixed_spread;
-
- if ( width == 0 || rows == 0 )
- {
- FT_TRACE0(( "sdf_generate:"
- " Cannot render glyph with width/height == 0\n" ));
- FT_TRACE0(( " "
- " (width, height provided [%d, %d])", width, rows ));
-
- error = FT_THROW( Cannot_Render_Glyph );
- goto Exit;
- }
-
- /* loop over all contours */
- while ( contours )
- {
- SDF_Edge* edges = contours->edges;
-
-
- /* loop over all edges */
- while ( edges )
- {
- FT_CBox cbox;
- FT_Int x, y;
-
-
- /* get the control box and increase it by `spread' */
- cbox = get_control_box( *edges );
-
- cbox.xMin = ( cbox.xMin - 63 ) / 64 - ( FT_Pos )spread;
- cbox.xMax = ( cbox.xMax + 63 ) / 64 + ( FT_Pos )spread;
- cbox.yMin = ( cbox.yMin - 63 ) / 64 - ( FT_Pos )spread;
- cbox.yMax = ( cbox.yMax + 63 ) / 64 + ( FT_Pos )spread;
-
- /* now loop over the pixels in the control box. */
- for ( y = cbox.yMin; y < cbox.yMax; y++ )
- {
- for ( x = cbox.xMin; x < cbox.xMax; x++ )
- {
- FT_26D6_Vec grid_point = zero_vector;
- SDF_Signed_Distance dist = max_sdf;
- FT_UInt index = 0;
-
-
- if ( x < 0 || x >= width )
- continue;
- if ( y < 0 || y >= rows )
- continue;
-
- grid_point.x = FT_INT_26D6( x );
- grid_point.y = FT_INT_26D6( y );
-
- /* This `grid_point` is at the corner, but we */
- /* use the center of the pixel. */
- grid_point.x += FT_INT_26D6( 1 ) / 2;
- grid_point.y += FT_INT_26D6( 1 ) / 2;
-
- FT_CALL( sdf_edge_get_min_distance( edges,
- grid_point,
- &dist ) );
-
- if ( internal_params.orientation == FT_ORIENTATION_FILL_LEFT )
- dist.sign = -dist.sign;
-
- /* ignore if the distance is greater than spread; */
- /* otherwise it creates artifacts due to the wrong sign */
- if ( dist.distance > sp_sq )
- continue;
-
- /* square_root the values and fit in a 6.10 fixed-point */
- if ( USE_SQUARED_DISTANCES )
- dist.distance = square_root( dist.distance );
-
- if ( internal_params.flip_y )
- index = (FT_UInt)( y * width + x );
- else
- index = (FT_UInt)( ( rows - y - 1 ) * width + x );
-
- /* check whether the pixel is set or not */
- if ( dists[index].sign == 0 )
- dists[index] = dist;
- else if ( dists[index].distance > dist.distance )
- dists[index] = dist;
- else if ( FT_ABS( dists[index].distance - dist.distance )
- < CORNER_CHECK_EPSILON )
- dists[index] = resolve_corner( dists[index], dist );
- }
- }
-
- edges = edges->next;
- }
-
- contours = contours->next;
- }
-
- /* final pass */
- for ( j = 0; j < rows; j++ )
- {
- /* We assume the starting pixel of each row is outside. */
- FT_Char current_sign = -1;
- FT_UInt index;
-
-
- if ( internal_params.overload_sign != 0 )
- current_sign = internal_params.overload_sign < 0 ? -1 : 1;
-
- for ( i = 0; i < width; i++ )
- {
- index = (FT_UInt)( j * width + i );
-
- /* if the pixel is not set */
- /* its shortest distance is more than `spread` */
- if ( dists[index].sign == 0 )
- dists[index].distance = fixed_spread;
- else
- current_sign = dists[index].sign;
-
- /* clamp the values */
- if ( dists[index].distance > fixed_spread )
- dists[index].distance = fixed_spread;
-
- /* flip sign if required */
- dists[index].distance *= internal_params.flip_sign ? -current_sign
- : current_sign;
-
- /* concatenate to appropriate format */
- buffer[index] = map_fixed_to_sdf( dists[index].distance,
- fixed_spread );
- }
- }
-
- Exit:
- FT_FREE( dists );
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * sdf_generate_subdivision
- *
- * @Description:
- * Subdivide the shape into a number of straight lines, then use the
- * above `sdf_generate_bounding_box` function to generate the SDF.
- *
- * Note: After calling this function `shape` no longer has the original
- * edges, it only contains lines.
- *
- * @Input:
- * internal_params ::
- * Internal parameters and properties required by the rasterizer.
- * See @SDF_Params for more.
- *
- * shape ::
- * A complete shape which is used to generate SDF.
- *
- * spread ::
- * Maximum distances to be allowed inthe output bitmap.
- *
- * @Output:
- * bitmap ::
- * The output bitmap which will contain the SDF information.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- */
- static FT_Error
- sdf_generate_subdivision( const SDF_Params internal_params,
- SDF_Shape* shape,
- FT_UInt spread,
- const FT_Bitmap* bitmap )
- {
- /*
- * Thanks to Alexei for providing the idea of this optimization.
- *
- * We take advantage of two facts.
- *
- * (1) Computing the shortest distance from a point to a line segment is
- * very fast.
- * (2) We don't have to compute the shortest distance for the entire
- * two-dimensional grid.
- *
- * Both ideas lead to the following optimization.
- *
- * (1) Split the outlines into a number of line segments.
- *
- * (2) For each line segment, only process its neighborhood.
- *
- * (3) Compute the closest distance to the line only for neighborhood
- * grid points.
- *
- * This greatly reduces the number of grid points to check.
- */
-
- FT_Error error = FT_Err_Ok;
-
-
- FT_CALL( split_sdf_shape( shape ) );
- FT_CALL( sdf_generate_bounding_box( internal_params,
- shape, spread, bitmap ) );
-
- Exit:
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
- * sdf_generate_with_overlaps
- *
- * @Description:
- * This function can be used to generate SDF for glyphs with overlapping
- * contours. The function generates SDF for contours separately on
- * separate bitmaps (to generate SDF it uses
- * `sdf_generate_subdivision`). At the end it simply combines all the
- * SDF into the output bitmap; this fixes all the signs and removes
- * overlaps.
- *
- * @Input:
- * internal_params ::
- * Internal parameters and properties required by the rasterizer. See
- * @SDF_Params for more.
- *
- * shape ::
- * A complete shape which is used to generate SDF.
- *
- * spread ::
- * Maximum distances to be allowed in the output bitmap.
- *
- * @Output:
- * bitmap ::
- * The output bitmap which will contain the SDF information.
- *
- * @Return:
- * FreeType error, 0 means success.
- *
- * @Note:
- * The function cannot generate a proper SDF for glyphs with
- * self-intersecting contours because we cannot separate them into two
- * separate bitmaps. In case of self-intersecting contours it is
- * necessary to remove the overlaps before generating the SDF.
- *
- */
- static FT_Error
- sdf_generate_with_overlaps( SDF_Params internal_params,
- SDF_Shape* shape,
- FT_UInt spread,
- const FT_Bitmap* bitmap )
- {
- FT_Error error = FT_Err_Ok;
-
- FT_Int num_contours; /* total number of contours */
- FT_Int i, j; /* iterators */
- FT_Int width, rows; /* width and rows of the bitmap */
- FT_Bitmap* bitmaps; /* separate bitmaps for contours */
-
- SDF_Contour* contour; /* temporary variable to iterate */
- SDF_Contour* temp_contour; /* temporary contour */
- SDF_Contour* head; /* head of the contour list */
- SDF_Shape temp_shape; /* temporary shape */
-
- FT_Memory memory; /* to allocate memory */
- FT_SDFFormat* t; /* target bitmap buffer */
- FT_Bool flip_sign; /* flip sign? */
-
- /* orientation of all the separate contours */
- SDF_Contour_Orientation* orientations;
-
-
- bitmaps = NULL;
- orientations = NULL;
- head = NULL;
-
- if ( !shape || !bitmap || !shape->memory )
- return FT_THROW( Invalid_Argument );
-
- /* Disable `flip_sign` to avoid extra complication */
- /* during the combination phase. */
- flip_sign = internal_params.flip_sign;
- internal_params.flip_sign = 0;
-
- contour = shape->contours;
- memory = shape->memory;
- temp_shape.memory = memory;
- width = (FT_Int)bitmap->width;
- rows = (FT_Int)bitmap->rows;
- num_contours = 0;
-
- /* find the number of contours in the shape */
- while ( contour )
- {
- num_contours++;
- contour = contour->next;
- }
-
- /* allocate the bitmaps to generate SDF for separate contours */
- if ( FT_ALLOC( bitmaps,
- (FT_UInt)num_contours * sizeof ( *bitmaps ) ) )
- goto Exit;
-
- /* allocate array to hold orientation for all contours */
- if ( FT_ALLOC( orientations,
- (FT_UInt)num_contours * sizeof ( *orientations ) ) )
- goto Exit;
-
- contour = shape->contours;
-
- /* Iterate over all contours and generate SDF separately. */
- for ( i = 0; i < num_contours; i++ )
- {
- /* initialize the corresponding bitmap */
- FT_Bitmap_Init( &bitmaps[i] );
-
- bitmaps[i].width = bitmap->width;
- bitmaps[i].rows = bitmap->rows;
- bitmaps[i].pitch = bitmap->pitch;
- bitmaps[i].num_grays = bitmap->num_grays;
- bitmaps[i].pixel_mode = bitmap->pixel_mode;
-
- /* allocate memory for the buffer */
- if ( FT_ALLOC( bitmaps[i].buffer,
- bitmap->rows * (FT_UInt)bitmap->pitch ) )
- goto Exit;
-
- /* determine the orientation */
- orientations[i] = get_contour_orientation( contour );
-
- /* The `overload_sign` property is specific to */
- /* `sdf_generate_bounding_box`. This basically */
- /* overloads the default sign of the outside */
- /* pixels, which is necessary for */
- /* counter-clockwise contours. */
- if ( orientations[i] == SDF_ORIENTATION_CCW &&
- internal_params.orientation == FT_ORIENTATION_FILL_RIGHT )
- internal_params.overload_sign = 1;
- else if ( orientations[i] == SDF_ORIENTATION_CW &&
- internal_params.orientation == FT_ORIENTATION_FILL_LEFT )
- internal_params.overload_sign = 1;
- else
- internal_params.overload_sign = 0;
-
- /* Make `contour->next` NULL so that there is */
- /* one contour in the list. Also hold the next */
- /* contour in a temporary variable so as to */
- /* restore the original value. */
- temp_contour = contour->next;
- contour->next = NULL;
-
- /* Use `temp_shape` to hold the new contour. */
- /* Now, `temp_shape` has only one contour. */
- temp_shape.contours = contour;
-
- /* finally generate the SDF */
- FT_CALL( sdf_generate_subdivision( internal_params,
- &temp_shape,
- spread,
- &bitmaps[i] ) );
-
- /* Restore the original `next` variable. */
- contour->next = temp_contour;
-
- /* Since `split_sdf_shape` deallocated the original */
- /* contours list we need to assign the new value to */
- /* the shape's contour. */
- temp_shape.contours->next = head;
- head = temp_shape.contours;
-
- /* Simply flip the orientation in case of post-script fonts */
- /* so as to avoid modificatons in the combining phase. */
- if ( internal_params.orientation == FT_ORIENTATION_FILL_LEFT )
- {
- if ( orientations[i] == SDF_ORIENTATION_CW )
- orientations[i] = SDF_ORIENTATION_CCW;
- else if ( orientations[i] == SDF_ORIENTATION_CCW )
- orientations[i] = SDF_ORIENTATION_CW;
- }
-
- contour = contour->next;
- }
-
- /* assign the new contour list to `shape->contours` */
- shape->contours = head;
-
- /* cast the output bitmap buffer */
- t = (FT_SDFFormat*)bitmap->buffer;
-
- /* Iterate over all pixels and combine all separate */
- /* contours. These are the rules for combining: */
- /* */
- /* (1) For all clockwise contours, compute the largest */
- /* value. Name this as `val_c`. */
- /* (2) For all counter-clockwise contours, compute the */
- /* smallest value. Name this as `val_ac`. */
- /* (3) Now, finally use the smaller value of `val_c' */
- /* and `val_ac'. */
- for ( j = 0; j < rows; j++ )
- {
- for ( i = 0; i < width; i++ )
- {
- FT_Int id = j * width + i; /* index of current pixel */
- FT_Int c; /* contour iterator */
-
- FT_SDFFormat val_c = 0; /* max clockwise value */
- FT_SDFFormat val_ac = UCHAR_MAX; /* min counter-clockwise val */
-
-
- /* iterate through all the contours */
- for ( c = 0; c < num_contours; c++ )
- {
- /* current contour value */
- FT_SDFFormat temp = ( (FT_SDFFormat*)bitmaps[c].buffer )[id];
-
-
- if ( orientations[c] == SDF_ORIENTATION_CW )
- val_c = FT_MAX( val_c, temp ); /* clockwise */
- else
- val_ac = FT_MIN( val_ac, temp ); /* counter-clockwise */
- }
-
- /* Finally find the smaller of the two and assign to output. */
- /* Also apply `flip_sign` if set. */
- t[id] = FT_MIN( val_c, val_ac );
-
- if ( flip_sign )
- t[id] = invert_sign( t[id] );
- }
- }
-
- Exit:
- /* deallocate orientations array */
- if ( orientations )
- FT_FREE( orientations );
-
- /* deallocate temporary bitmaps */
- if ( bitmaps )
- {
- if ( num_contours == 0 )
- error = FT_THROW( Raster_Corrupted );
- else
- {
- for ( i = 0; i < num_contours; i++ )
- FT_FREE( bitmaps[i].buffer );
-
- FT_FREE( bitmaps );
- }
- }
-
- /* restore the `flip_sign` property */
- internal_params.flip_sign = flip_sign;
-
- return error;
- }
-
-
- /**************************************************************************
- *
- * interface functions
- *
- */
-
- static FT_Error
- sdf_raster_new( FT_Memory memory,
- FT_Raster* araster)
- {
- FT_Error error = FT_Err_Ok;
- SDF_TRaster* raster = NULL;
- FT_Int line = __LINE__;
-
- /* in non-debugging mode this is not used */
- FT_UNUSED( line );
-
-
- *araster = 0;
- if ( !FT_ALLOC( raster, sizeof ( SDF_TRaster ) ) )
- {
- raster->memory = memory;
- *araster = (FT_Raster)raster;
- }
-
- return error;
- }
-
-
- static void
- sdf_raster_reset( FT_Raster raster,
- unsigned char* pool_base,
- unsigned long pool_size )
- {
- FT_UNUSED( raster );
- FT_UNUSED( pool_base );
- FT_UNUSED( pool_size );
- }
-
-
- static FT_Error
- sdf_raster_set_mode( FT_Raster raster,
- unsigned long mode,
- void* args )
- {
- FT_UNUSED( raster );
- FT_UNUSED( mode );
- FT_UNUSED( args );
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- sdf_raster_render( FT_Raster raster,
- const FT_Raster_Params* params )
- {
- FT_Error error = FT_Err_Ok;
- SDF_TRaster* sdf_raster = (SDF_TRaster*)raster;
- FT_Outline* outline = NULL;
- const SDF_Raster_Params* sdf_params = (const SDF_Raster_Params*)params;
-
- FT_Memory memory = NULL;
- SDF_Shape* shape = NULL;
- SDF_Params internal_params;
-
-
- /* check for valid arguments */
- if ( !sdf_raster || !sdf_params )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- outline = (FT_Outline*)sdf_params->root.source;
-
- /* check whether outline is valid */
- if ( !outline )
- {
- error = FT_THROW( Invalid_Outline );
- goto Exit;
- }
-
- /* if the outline is empty, return */
- if ( outline->n_points <= 0 || outline->n_contours <= 0 )
- goto Exit;
-
- /* check whether the outline has valid fields */
- if ( !outline->contours || !outline->points )
- {
- error = FT_THROW( Invalid_Outline );
- goto Exit;
- }
-
- /* check whether spread is set properly */
- if ( sdf_params->spread > MAX_SPREAD ||
- sdf_params->spread < MIN_SPREAD )
- {
- FT_TRACE0(( "sdf_raster_render:"
- " The `spread' field of `SDF_Raster_Params' is invalid,\n" ));
- FT_TRACE0(( " "
- " the value of this field must be within [%d, %d].\n",
- MIN_SPREAD, MAX_SPREAD ));
- FT_TRACE0(( " "
- " Also, you must pass `SDF_Raster_Params' instead of\n" ));
- FT_TRACE0(( " "
- " the default `FT_Raster_Params' while calling\n" ));
- FT_TRACE0(( " "
- " this function and set the fields properly.\n" ));
-
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- memory = sdf_raster->memory;
- if ( !memory )
- {
- FT_TRACE0(( "sdf_raster_render:"
- " Raster not setup properly,\n" ));
- FT_TRACE0(( " "
- " unable to find memory handle.\n" ));
-
- error = FT_THROW( Invalid_Handle );
- goto Exit;
- }
-
- /* set up the parameters */
- internal_params.orientation = FT_Outline_Get_Orientation( outline );
- internal_params.flip_sign = sdf_params->flip_sign;
- internal_params.flip_y = sdf_params->flip_y;
- internal_params.overload_sign = 0;
-
- FT_CALL( sdf_shape_new( memory, &shape ) );
-
- FT_CALL( sdf_outline_decompose( outline, shape ) );
-
- if ( sdf_params->overlaps )
- FT_CALL( sdf_generate_with_overlaps( internal_params,
- shape, sdf_params->spread,
- sdf_params->root.target ) );
- else
- FT_CALL( sdf_generate_subdivision( internal_params,
- shape, sdf_params->spread,
- sdf_params->root.target ) );
-
- if ( shape )
- sdf_shape_done( &shape );
-
- Exit:
- return error;
- }
-
-
- static void
- sdf_raster_done( FT_Raster raster )
- {
- FT_Memory memory = (FT_Memory)((SDF_TRaster*)raster)->memory;
-
-
- FT_FREE( raster );
- }
-
-
- FT_DEFINE_RASTER_FUNCS(
- ft_sdf_raster,
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Raster_New_Func) sdf_raster_new, /* raster_new */
- (FT_Raster_Reset_Func) sdf_raster_reset, /* raster_reset */
- (FT_Raster_Set_Mode_Func)sdf_raster_set_mode, /* raster_set_mode */
- (FT_Raster_Render_Func) sdf_raster_render, /* raster_render */
- (FT_Raster_Done_Func) sdf_raster_done /* raster_done */
- )
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.h b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.h
deleted file mode 100644
index 187b418af3c..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
- *
- * ftsdf.h
- *
- * Signed Distance Field support (specification).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * 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 FTSDF_H_
-#define FTSDF_H_
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include <freetype/ftimage.h>
-
-/* common properties and function */
-#include "ftsdfcommon.h"
-
-FT_BEGIN_HEADER
-
- /**************************************************************************
- *
- * @struct:
- * SDF_Raster_Params
- *
- * @description:
- * This struct must be passed to the raster render function
- * @FT_Raster_RenderFunc instead of @FT_Raster_Params because the
- * rasterizer requires some additional information to render properly.
- *
- * @fields:
- * root ::
- * The native raster parameters structure.
- *
- * spread ::
- * This is an essential parameter/property required by the renderer.
- * `spread` defines the maximum unsigned value that is present in the
- * final SDF output. For the default value check file
- * `ftsdfcommon.h`.
- *
- * flip_sign ::
- * By default positive values indicate positions inside of contours,
- * i.e., filled by a contour. If this property is true then that
- * output will be the opposite of the default, i.e., negative values
- * indicate positions inside of contours.
- *
- * flip_y ::
- * Setting this parameter to true maked the output image flipped
- * along the y-axis.
- *
- * overlaps ::
- * Set this to true to generate SDF for glyphs having overlapping
- * contours. The overlapping support is limited to glyphs that do not
- * have self-intersecting contours. Also, removing overlaps require a
- * considerable amount of extra memory; additionally, it will not work
- * if generating SDF from bitmap.
- *
- * @note:
- * All properties are valid for both the 'sdf' and 'bsdf' renderers; the
- * exception is `overlaps`, which gets ignored by the 'bsdf' renderer.
- *
- */
- typedef struct SDF_Raster_Params_
- {
- FT_Raster_Params root;
- FT_UInt spread;
- FT_Bool flip_sign;
- FT_Bool flip_y;
- FT_Bool overlaps;
-
- } SDF_Raster_Params;
-
-
- /* rasterizer to convert outline to SDF */
- FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_sdf_raster;
-
- /* rasterizer to convert bitmap to SDF */
- FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_bitmap_sdf_raster;
-
-FT_END_HEADER
-
-#endif /* FTSDF_H_ */
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfcommon.c b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfcommon.c
deleted file mode 100644
index 91aa521bb31..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfcommon.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
- *
- * ftsdfcommon.c
- *
- * Auxiliary data for Signed Distance Field support (body).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * 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 "ftsdf.h"
-#include "ftsdfcommon.h"
-
-
- /**************************************************************************
- *
- * common functions
- *
- */
-
- /*
- * Original algorithm:
- *
- * https://github.com/chmike/fpsqrt
- *
- * Use this to compute the square root of a 16.16 fixed point number.
- */
- FT_LOCAL_DEF( FT_16D16 )
- square_root( FT_16D16 val )
- {
- FT_ULong t, q, b, r;
-
-
- r = (FT_ULong)val;
- b = 0x40000000L;
- q = 0;
-
- while ( b > 0x40L )
- {
- t = q + b;
-
- if ( r >= t )
- {
- r -= t;
- q = t + b;
- }
-
- r <<= 1;
- b >>= 1;
- }
-
- q >>= 8;
-
- return (FT_16D16)q;
- }
-
-
- /**************************************************************************
- *
- * format and sign manipulating functions
- *
- */
-
- /*
- * Convert 16.16 fixed point values to the desired output format.
- * In this case we reduce 16.16 fixed point values to normalized
- * 8-bit values.
- *
- * The `max_value` in the parameter is the maximum value in the
- * distance field map and is equal to the spread. We normalize
- * the distances using this value instead of computing the maximum
- * value for the entire bitmap.
- *
- * You can use this function to map the 16.16 signed values to any
- * format required. Do note that the output buffer is 8-bit, so only
- * use an 8-bit format for `FT_SDFFormat`, or increase the buffer size in
- * `ftsdfrend.c`.
- */
- FT_LOCAL_DEF( FT_SDFFormat )
- map_fixed_to_sdf( FT_16D16 dist,
- FT_16D16 max_value )
- {
- FT_SDFFormat out;
- FT_16D16 udist;
-
-
- /* normalize the distance values */
- dist = FT_DivFix( dist, max_value );
-
- udist = dist < 0 ? -dist : dist;
-
- /* Reduce the distance values to 8 bits. */
- /* */
- /* Since +1/-1 in 16.16 takes the 16th bit, we right-shift */
- /* the number by 9 to make it fit into the 7-bit range. */
- /* */
- /* One bit is reserved for the sign. */
- udist >>= 9;
-
- /* Since `char` can only store a maximum positive value */
- /* of 127 we need to make sure it does not wrap around and */
- /* give a negative value. */
- if ( dist > 0 && udist > 127 )
- udist = 127;
- if ( dist < 0 && udist > 128 )
- udist = 128;
-
- /* Output the data; negative values are from [0, 127] and positive */
- /* from [128, 255]. One important thing is that negative values */
- /* are inverted here, that means [0, 128] maps to [-128, 0] linearly. */
- /* More on that in `freetype.h` near the documentation of */
- /* `FT_RENDER_MODE_SDF`. */
- out = dist < 0 ? 128 - (FT_SDFFormat)udist
- : (FT_SDFFormat)udist + 128;
-
- return out;
- }
-
-
- /*
- * Invert the signed distance packed into the corresponding format.
- * So if the values are negative they will become positive in the
- * chosen format.
- *
- * [Note]: This function should only be used after converting the
- * 16.16 signed distance values to `FT_SDFFormat`. If that
- * conversion has not been done, then simply invert the sign
- * and use the above function to pack the values.
- */
- FT_LOCAL_DEF( FT_SDFFormat )
- invert_sign( FT_SDFFormat dist )
- {
- return 255 - dist;
- }
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfcommon.h b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfcommon.h
deleted file mode 100644
index 44f6bba53f8..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfcommon.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
- *
- * ftsdfcommon.h
- *
- * Auxiliary data for Signed Distance Field support (specification).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * This file is part of the FreeType project, and may only be used,
- * modified, and distributed under the terms of the FreeType project
- * license, LICENSE.TXT. By continuing to use, modify, or distribute
- * this file you indicate that you have read the license and
- * understand and accept it fully.
- *
- */
-
-
- /****************************************************
- *
- * This file contains common functions and properties
- * for both the 'sdf' and 'bsdf' renderers.
- *
- */
-
-#ifndef FTSDFCOMMON_H_
-#define FTSDFCOMMON_H_
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include <freetype/internal/ftobjs.h>
-
-
-FT_BEGIN_HEADER
-
-
- /**************************************************************************
- *
- * default values (cannot be set individually for each renderer)
- *
- */
-
- /* default spread value */
-#define DEFAULT_SPREAD 8
- /* minimum spread supported by the renderer */
-#define MIN_SPREAD 2
- /* maximum spread supported by the renderer */
-#define MAX_SPREAD 32
-
-
- /**************************************************************************
- *
- * common definitions (cannot be set individually for each renderer)
- *
- */
-
- /* If this macro is set to 1 the rasterizer uses squared distances for */
- /* computation. It can greatly improve the performance but there is a */
- /* chance of overflow and artifacts. You can safely use it up to a */
- /* pixel size of 128. */
-#ifndef USE_SQUARED_DISTANCES
-#define USE_SQUARED_DISTANCES 0
-#endif
-
-
- /**************************************************************************
- *
- * common macros
- *
- */
-
- /* convert int to 26.6 fixed-point */
-#define FT_INT_26D6( x ) ( x * 64 )
- /* convert int to 16.16 fixed-point */
-#define FT_INT_16D16( x ) ( x * 65536 )
- /* convert 26.6 to 16.16 fixed-point */
-#define FT_26D6_16D16( x ) ( x * 1024 )
-
-
- /* Convenience macro to call a function; it */
- /* jumps to label `Exit` if an error occurs. */
-#define FT_CALL( x ) do \
- { \
- error = ( x ); \
- if ( error != FT_Err_Ok ) \
- goto Exit; \
- } while ( 0 )
-
-
- /*
- * The macro `VECTOR_LENGTH_16D16` computes either squared distances or
- * actual distances, depending on the value of `USE_SQUARED_DISTANCES`.
- *
- * By using squared distances the performance can be greatly improved but
- * there is a risk of overflow.
- */
-#if USE_SQUARED_DISTANCES
-#define VECTOR_LENGTH_16D16( v ) ( FT_MulFix( v.x, v.x ) + \
- FT_MulFix( v.y, v.y ) )
-#else
-#define VECTOR_LENGTH_16D16( v ) FT_Vector_Length( &v )
-#endif
-
-
- /**************************************************************************
- *
- * common typedefs
- *
- */
-
- typedef FT_Vector FT_26D6_Vec; /* with 26.6 fixed-point components */
- typedef FT_Vector FT_16D16_Vec; /* with 16.16 fixed-point components */
-
- typedef FT_Fixed FT_16D16; /* 16.16 fixed-point representation */
- typedef FT_Fixed FT_26D6; /* 26.6 fixed-point representation */
- typedef FT_Byte FT_SDFFormat; /* format to represent SDF data */
-
- typedef FT_BBox FT_CBox; /* control box of a curve */
-
-
- FT_LOCAL( FT_16D16 )
- square_root( FT_16D16 val );
-
- FT_LOCAL( FT_SDFFormat )
- map_fixed_to_sdf( FT_16D16 dist,
- FT_16D16 max_value );
-
- FT_LOCAL( FT_SDFFormat )
- invert_sign( FT_SDFFormat dist );
-
-
-FT_END_HEADER
-
-#endif /* FTSDFCOMMON_H_ */
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdferrs.h b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdferrs.h
deleted file mode 100644
index dbb113d5379..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdferrs.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
- *
- * ftsdferrs.h
- *
- * Signed Distance Field error codes (specification only).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * 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 FTSDFERRS_H_
-#define FTSDFERRS_H_
-
-#include <freetype/ftmoderr.h>
-
-#undef FTERRORS_H_
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX Sdf_Err_
-#define FT_ERR_BASE FT_Mod_Err_Sdf
-
-#include <freetype/fterrors.h>
-
-#endif /* FTSDFERRS_H_ */
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c
deleted file mode 100644
index 420ad496c74..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/****************************************************************************
- *
- * ftsdfrend.c
- *
- * Signed Distance Field renderer interface (body).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * 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 <freetype/internal/ftdebug.h>
-#include <freetype/internal/ftobjs.h>
-#include <freetype/internal/services/svprop.h>
-#include <freetype/ftoutln.h>
-#include <freetype/ftbitmap.h>
-#include "ftsdfrend.h"
-#include "ftsdf.h"
-
-#include "ftsdferrs.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 sdf
-
-
- /**************************************************************************
- *
- * macros and default property values
- *
- */
-#define SDF_RENDERER( rend ) ( (SDF_Renderer)rend )
-
-
- /**************************************************************************
- *
- * for setting properties
- *
- */
-
- /* property setter function */
- static FT_Error
- sdf_property_set( FT_Module module,
- const char* property_name,
- const void* value,
- FT_Bool value_is_string )
- {
- FT_Error error = FT_Err_Ok;
- SDF_Renderer render = SDF_RENDERER( FT_RENDERER( module ) );
-
- FT_UNUSED( value_is_string );
-
-
- if ( ft_strcmp( property_name, "spread" ) == 0 )
- {
- FT_Int val = *(const FT_Int*)value;
-
-
- if ( val > MAX_SPREAD || val < MIN_SPREAD )
- {
- FT_TRACE0(( "[sdf] sdf_property_set:"
- " the `spread' property can have a value\n" ));
- FT_TRACE0(( " "
- " within range [%d, %d] (value provided: %d)\n",
- MIN_SPREAD, MAX_SPREAD, val ));
-
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- render->spread = (FT_UInt)val;
- FT_TRACE7(( "[sdf] sdf_property_set:"
- " updated property `spread' to %d\n", val ));
- }
-
- else if ( ft_strcmp( property_name, "flip_sign" ) == 0 )
- {
- FT_Int val = *(const FT_Int*)value;
-
-
- render->flip_sign = val ? 1 : 0;
- FT_TRACE7(( "[sdf] sdf_property_set:"
- " updated property `flip_sign' to %d\n", val ));
- }
-
- else if ( ft_strcmp( property_name, "flip_y" ) == 0 )
- {
- FT_Int val = *(const FT_Int*)value;
-
-
- render->flip_y = val ? 1 : 0;
- FT_TRACE7(( "[sdf] sdf_property_set:"
- " updated property `flip_y' to %d\n", val ));
- }
-
- else if ( ft_strcmp( property_name, "overlaps" ) == 0 )
- {
- FT_Bool val = *(const FT_Bool*)value;
-
-
- render->overlaps = val;
- FT_TRACE7(( "[sdf] sdf_property_set:"
- " updated property `overlaps' to %d\n", val ));
- }
-
- else
- {
- FT_TRACE0(( "[sdf] sdf_property_set:"
- " missing property `%s'\n", property_name ));
- error = FT_THROW( Missing_Property );
- }
-
- Exit:
- return error;
- }
-
-
- /* property getter function */
- static FT_Error
- sdf_property_get( FT_Module module,
- const char* property_name,
- void* value )
- {
- FT_Error error = FT_Err_Ok;
- SDF_Renderer render = SDF_RENDERER( FT_RENDERER( module ) );
-
-
- if ( ft_strcmp( property_name, "spread" ) == 0 )
- {
- FT_UInt* val = (FT_UInt*)value;
-
-
- *val = render->spread;
- }
-
- else if ( ft_strcmp( property_name, "flip_sign" ) == 0 )
- {
- FT_Int* val = (FT_Int*)value;
-
-
- *val = render->flip_sign;
- }
-
- else if ( ft_strcmp( property_name, "flip_y" ) == 0 )
- {
- FT_Int* val = (FT_Int*)value;
-
-
- *val = render->flip_y;
- }
-
- else if ( ft_strcmp( property_name, "overlaps" ) == 0 )
- {
- FT_Int* val = (FT_Int*)value;
-
-
- *val = render->overlaps;
- }
-
- else
- {
- FT_TRACE0(( "[sdf] sdf_property_get:"
- " missing property `%s'\n", property_name ));
- error = FT_THROW( Missing_Property );
- }
-
- return error;
- }
-
-
- FT_DEFINE_SERVICE_PROPERTIESREC(
- sdf_service_properties,
-
- (FT_Properties_SetFunc)sdf_property_set, /* set_property */
- (FT_Properties_GetFunc)sdf_property_get ) /* get_property */
-
-
- FT_DEFINE_SERVICEDESCREC1(
- sdf_services,
-
- FT_SERVICE_ID_PROPERTIES, &sdf_service_properties )
-
-
- static FT_Module_Interface
- ft_sdf_requester( FT_Renderer render,
- const char* module_interface )
- {
- FT_UNUSED( render );
-
- return ft_service_list_lookup( sdf_services, module_interface );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /** **/
- /** OUTLINE TO SDF CONVERTER **/
- /** **/
- /*************************************************************************/
- /*************************************************************************/
-
- /**************************************************************************
- *
- * interface functions
- *
- */
-
- static FT_Error
- ft_sdf_init( FT_Renderer render )
- {
- SDF_Renderer sdf_render = SDF_RENDERER( render );
-
-
- sdf_render->spread = DEFAULT_SPREAD;
- sdf_render->flip_sign = 0;
- sdf_render->flip_y = 0;
- sdf_render->overlaps = 0;
-
- return FT_Err_Ok;
- }
-
-
- static void
- ft_sdf_done( FT_Renderer render )
- {
- FT_UNUSED( render );
- }
-
-
- /* generate signed distance field from a glyph's slot image */
- static FT_Error
- ft_sdf_render( FT_Renderer module,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- FT_Error error = FT_Err_Ok;
- FT_Outline* outline = &slot->outline;
- FT_Bitmap* bitmap = &slot->bitmap;
- FT_Memory memory = NULL;
- FT_Renderer render = NULL;
-
- FT_Pos x_shift = 0;
- FT_Pos y_shift = 0;
-
- FT_Pos x_pad = 0;
- FT_Pos y_pad = 0;
-
- SDF_Raster_Params params;
- SDF_Renderer sdf_module = SDF_RENDERER( module );
-
-
- render = &sdf_module->root;
- memory = render->root.memory;
-
- /* check whether slot format is correct before rendering */
- if ( slot->format != render->glyph_format )
- {
- error = FT_THROW( Invalid_Glyph_Format );
- goto Exit;
- }
-
- /* check whether render mode is correct */
- if ( mode != FT_RENDER_MODE_SDF )
- {
- error = FT_THROW( Cannot_Render_Glyph );
- goto Exit;
- }
-
- /* deallocate the previously allocated bitmap */
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
- {
- FT_FREE( bitmap->buffer );
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
-
- /* preset the bitmap using the glyph's outline; */
- /* the sdf bitmap is similar to an anti-aliased bitmap */
- /* with a slightly bigger size and different pixel mode */
- if ( ft_glyphslot_preset_bitmap( slot, FT_RENDER_MODE_NORMAL, origin ) )
- {
- error = FT_THROW( Raster_Overflow );
- goto Exit;
- }
-
- if ( !bitmap->rows || !bitmap->pitch )
- goto Exit;
-
- /* the padding will simply be equal to the `spread' */
- x_pad = sdf_module->spread;
- y_pad = sdf_module->spread;
-
- /* apply the padding; will be in all the directions */
- bitmap->rows += y_pad * 2;
- bitmap->width += x_pad * 2;
-
- /* ignore the pitch, pixel mode and set custom */
- bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
- bitmap->pitch = (int)( bitmap->width );
- bitmap->num_grays = 255;
-
- /* allocate new buffer */
- if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
- goto Exit;
-
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
-
- slot->bitmap_top += y_pad;
- slot->bitmap_left -= x_pad;
-
- x_shift = 64 * -slot->bitmap_left;
- y_shift = 64 * -slot->bitmap_top;
- y_shift += 64 * (FT_Int)bitmap->rows;
-
- 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 );
-
- /* set up parameters */
- params.root.target = bitmap;
- params.root.source = outline;
- params.root.flags = FT_RASTER_FLAG_SDF;
- params.spread = sdf_module->spread;
- params.flip_sign = sdf_module->flip_sign;
- params.flip_y = sdf_module->flip_y;
- params.overlaps = sdf_module->overlaps;
-
- /* render the outline */
- error = render->raster_render( render->raster,
- (const FT_Raster_Params*)&params );
-
- Exit:
- if ( !error )
- {
- /* the glyph is successfully rendered to 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;
- }
-
-
- /* transform the glyph using matrix and/or delta */
- static FT_Error
- ft_sdf_transform( FT_Renderer render,
- FT_GlyphSlot slot,
- const FT_Matrix* matrix,
- const FT_Vector* delta )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( slot->format != render->glyph_format )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( matrix )
- FT_Outline_Transform( &slot->outline, matrix );
-
- if ( delta )
- FT_Outline_Translate( &slot->outline, delta->x, delta->y );
-
- Exit:
- return error;
- }
-
-
- /* return the control box of a glyph's outline */
- static void
- ft_sdf_get_cbox( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_BBox* cbox )
- {
- FT_ZERO( cbox );
-
- if ( slot->format == render->glyph_format )
- FT_Outline_Get_CBox( &slot->outline, cbox );
- }
-
-
- /* set render specific modes or attributes */
- static FT_Error
- ft_sdf_set_mode( FT_Renderer render,
- FT_ULong mode_tag,
- FT_Pointer data )
- {
- /* pass it to the rasterizer */
- return render->clazz->raster_class->raster_set_mode( render->raster,
- mode_tag,
- data );
- }
-
-
- FT_DEFINE_RENDERER(
- ft_sdf_renderer_class,
-
- FT_MODULE_RENDERER,
- sizeof ( SDF_Renderer_Module ),
-
- "sdf",
- 0x10000L,
- 0x20000L,
-
- NULL,
-
- (FT_Module_Constructor)ft_sdf_init,
- (FT_Module_Destructor) ft_sdf_done,
- (FT_Module_Requester) ft_sdf_requester,
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Renderer_RenderFunc) ft_sdf_render, /* render_glyph */
- (FT_Renderer_TransformFunc)ft_sdf_transform, /* transform_glyph */
- (FT_Renderer_GetCBoxFunc) ft_sdf_get_cbox, /* get_glyph_cbox */
- (FT_Renderer_SetModeFunc) ft_sdf_set_mode, /* set_mode */
-
- (FT_Raster_Funcs*)&ft_sdf_raster /* raster_class */
- )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /** **/
- /** BITMAP TO SDF CONVERTER **/
- /** **/
- /*************************************************************************/
- /*************************************************************************/
-
- /* generate signed distance field from glyph's bitmap */
- static FT_Error
- ft_bsdf_render( FT_Renderer module,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = NULL;
-
- FT_Bitmap* bitmap = &slot->bitmap;
- FT_Renderer render = NULL;
- FT_Bitmap target;
-
- FT_Pos x_pad = 0;
- FT_Pos y_pad = 0;
-
- SDF_Raster_Params params;
- SDF_Renderer sdf_module = SDF_RENDERER( module );
-
-
- /* initialize the bitmap in case any error occurs */
- FT_Bitmap_Init( &target );
-
- render = &sdf_module->root;
- memory = render->root.memory;
-
- /* check whether slot format is correct before rendering */
- if ( slot->format != render->glyph_format )
- {
- error = FT_THROW( Invalid_Glyph_Format );
- goto Exit;
- }
-
- /* check whether render mode is correct */
- if ( mode != FT_RENDER_MODE_SDF )
- {
- error = FT_THROW( Cannot_Render_Glyph );
- goto Exit;
- }
-
- if ( origin )
- {
- FT_ERROR(( "ft_bsdf_render: can't translate the bitmap\n" ));
-
- error = FT_THROW( Unimplemented_Feature );
- goto Exit;
- }
-
- if ( !bitmap->rows || !bitmap->pitch )
- goto Exit;
-
- FT_Bitmap_New( &target );
-
- /* padding will simply be equal to `spread` */
- x_pad = sdf_module->spread;
- y_pad = sdf_module->spread;
-
- /* apply padding, which extends to all directions */
- target.rows = bitmap->rows + y_pad * 2;
- target.width = bitmap->width + x_pad * 2;
-
- /* set up the target bitmap */
- target.pixel_mode = FT_PIXEL_MODE_GRAY;
- target.pitch = (int)( target.width );
- target.num_grays = 255;
-
- if ( FT_ALLOC_MULT( target.buffer, target.rows, target.pitch ) )
- goto Exit;
-
- /* set up parameters */
- params.root.target = &target;
- params.root.source = bitmap;
- params.root.flags = FT_RASTER_FLAG_SDF;
- params.spread = sdf_module->spread;
- params.flip_sign = sdf_module->flip_sign;
- params.flip_y = sdf_module->flip_y;
-
- error = render->raster_render( render->raster,
- (const FT_Raster_Params*)&params );
-
- Exit:
- if ( !error )
- {
- /* the glyph is successfully converted to a SDF */
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
- {
- FT_FREE( bitmap->buffer );
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
-
- slot->bitmap = target;
- slot->bitmap_top += y_pad;
- slot->bitmap_left -= x_pad;
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
- }
- else if ( target.buffer )
- FT_FREE( target.buffer );
-
- return error;
- }
-
-
- FT_DEFINE_RENDERER(
- ft_bitmap_sdf_renderer_class,
-
- FT_MODULE_RENDERER,
- sizeof ( SDF_Renderer_Module ),
-
- "bsdf",
- 0x10000L,
- 0x20000L,
-
- NULL,
-
- (FT_Module_Constructor)ft_sdf_init,
- (FT_Module_Destructor) ft_sdf_done,
- (FT_Module_Requester) ft_sdf_requester,
-
- FT_GLYPH_FORMAT_BITMAP,
-
- (FT_Renderer_RenderFunc) ft_bsdf_render, /* render_glyph */
- (FT_Renderer_TransformFunc)ft_sdf_transform, /* transform_glyph */
- (FT_Renderer_GetCBoxFunc) ft_sdf_get_cbox, /* get_glyph_cbox */
- (FT_Renderer_SetModeFunc) ft_sdf_set_mode, /* set_mode */
-
- (FT_Raster_Funcs*)&ft_bitmap_sdf_raster /* raster_class */
- )
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.h b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.h
deleted file mode 100644
index bc88707ec24..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
- *
- * ftsdfrend.h
- *
- * Signed Distance Field renderer interface (specification).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * 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 FTSDFREND_H_
-#define FTSDFREND_H_
-
-#include <freetype/ftrender.h>
-#include <freetype/ftmodapi.h>
-#include <freetype/internal/ftobjs.h>
-
-FT_BEGIN_HEADER
-
-
- /**************************************************************************
- *
- * @struct:
- * SDF_Renderer_Module
- *
- * @description:
- * This struct extends the native renderer struct `FT_RendererRec`. It
- * is basically used to store various parameters required by the
- * renderer and some additional parameters that can be used to tweak the
- * output of the renderer.
- *
- * @fields:
- * root ::
- * The native rendere struct.
- *
- * spread ::
- * This is an essential parameter/property required by the renderer.
- * `spread` defines the maximum unsigned value that is present in the
- * final SDF output. For the default value check file
- * `ftsdfcommon.h`.
- *
- * flip_sign ::
- * By default positive values indicate positions inside of contours,
- * i.e., filled by a contour. If this property is true then that
- * output will be the opposite of the default, i.e., negative values
- * indicate positions inside of contours.
- *
- * flip_y ::
- * Setting this parameter to true makes the output image flipped
- * along the y-axis.
- *
- * overlaps ::
- * Set this to true to generate SDF for glyphs having overlapping
- * contours. The overlapping support is limited to glyphs that do not
- * have self-intersecting contours. Also, removing overlaps require a
- * considerable amount of extra memory; additionally, it will not work
- * if generating SDF from bitmap.
- *
- * @note:
- * All properties except `overlaps` are valid for both the 'sdf' and
- * 'bsdf' renderers.
- *
- */
- typedef struct SDF_Renderer_Module_
- {
- FT_RendererRec root;
- FT_UInt spread;
- FT_Bool flip_sign;
- FT_Bool flip_y;
- FT_Bool overlaps;
-
- } SDF_Renderer_Module, *SDF_Renderer;
-
-
- /**************************************************************************
- *
- * @renderer:
- * ft_sdf_renderer_class
- *
- * @description:
- * Renderer to convert @FT_Outline to signed distance fields.
- *
- */
- FT_DECLARE_RENDERER( ft_sdf_renderer_class )
-
-
- /**************************************************************************
- *
- * @renderer:
- * ft_bitmap_sdf_renderer_class
- *
- * @description:
- * This is not exactly a renderer; it is just a converter that
- * transforms bitmaps to signed distance fields.
- *
- * @note:
- * This is not a separate module, it is part of the 'sdf' module.
- *
- */
- FT_DECLARE_RENDERER( ft_bitmap_sdf_renderer_class )
-
-
-FT_END_HEADER
-
-#endif /* FTSDFREND_H_ */
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/module.mk b/Build/source/libs/freetype2/freetype-src/src/sdf/module.mk
deleted file mode 100644
index 6be4b0c6d47..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/module.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# FreeType 2 Signed Distance Field module definition
-#
-
-
-# Copyright (C) 2020-2021 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.
-
-
-FTMODULE_H_COMMANDS += SDF_RENDERER
-FTMODULE_H_COMMANDS += BSDF_RENDERER
-
-define SDF_RENDERER
-$(OPEN_DRIVER) FT_Renderer_Class, ft_sdf_renderer_class $(CLOSE_DRIVER)
-$(ECHO_DRIVER)sdf $(ECHO_DRIVER_DESC)signed distance field renderer$(ECHO_DRIVER_DONE)
-endef
-
-define BSDF_RENDERER
-$(OPEN_DRIVER) FT_Renderer_Class, ft_bitmap_sdf_renderer_class $(CLOSE_DRIVER)
-$(ECHO_DRIVER)bsdf $(ECHO_DRIVER_DESC)bitmap to signed distance field converter$(ECHO_DRIVER_DONE)
-endef
-
-#EOF
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/rules.mk b/Build/source/libs/freetype2/freetype-src/src/sdf/rules.mk
deleted file mode 100644
index 7e7e4fbe860..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/rules.mk
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# FreeType 2 Signed Distance Field driver configuration rules
-#
-
-
-# Copyright (C) 2020-2021 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.
-
-
-# sdf driver directory
-#
-SDF_DIR := $(SRC_DIR)/sdf
-
-
-# compilation flags for the driver
-#
-SDF_COMPILE := $(CC) $(ANSIFLAGS) \
- $I$(subst /,$(COMPILER_SEP),$(SDF_DIR)) \
- $(INCLUDE_FLAGS) \
- $(FT_CFLAGS)
-
-
-# sdf driver sources (i.e., C files)
-#
-SDF_DRV_SRC := $(SDF_DIR)/ftsdfrend.c \
- $(SDF_DIR)/ftsdf.c \
- $(SDF_DIR)/ftbsdf.c \
- $(SDF_DIR)/ftsdfcommon.c
-
-
-# sdf driver headers
-#
-SDF_DRV_H := $(SDF_DIR)/ftsdfrend.h \
- $(SDF_DIR)/ftsdf.h \
- $(SDF_DIR)/ftsdferrs.h \
- $(SDF_DIR)/ftsdfcommon.h
-
-
-# sdf driver object(s)
-#
-# SDF_DRV_OBJ_M is used during `multi' builds.
-# SDF_DRV_OBJ_S is used during `single' builds.
-#
-SDF_DRV_OBJ_M := $(SDF_DRV_SRC:$(SDF_DIR)/%.c=$(OBJ_DIR)/%.$O)
-SDF_DRV_OBJ_S := $(OBJ_DIR)/sdf.$O
-
-
-# sdf driver source file for single build
-#
-SDF_DRV_SRC_S := $(SDF_DIR)/sdf.c
-
-
-# sdf driver - single object
-#
-$(SDF_DRV_OBJ_S): $(SDF_DRV_SRC_S) $(SDF_DRV_SRC) \
- $(FREETYPE_H) $(SDF_DRV_H)
- $(SDF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SDF_DRV_SRC_S))
-
-
-# sdf driver - multiple objects
-#
-$(OBJ_DIR)/%.$O: $(SDF_DIR)/%.c $(FREETYPE_H) $(SDF_DRV_H)
- $(SDF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
-
-
-# update main driver list
-#
-DRV_OBJS_S += $(SDF_DRV_OBJ_S)
-DRV_OBJS_M += $(SDF_DRV_OBJ_M)
-
-
-# EOF
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/sdf.c b/Build/source/libs/freetype2/freetype-src/src/sdf/sdf.c
deleted file mode 100644
index 1bc3fc385cc..00000000000
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/sdf.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/****************************************************************************
- *
- * sdf.c
- *
- * FreeType Signed Distance Field renderer module component (body only).
- *
- * Copyright (C) 2020-2021 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * Written by Anuj Verma.
- *
- * 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.
- *
- */
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include "ftsdfrend.c"
-#include "ftsdfcommon.c"
-#include "ftbsdf.c"
-#include "ftsdf.c"
-
-
-/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk b/Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk
index eabd48f6093..0f459d84218 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c
index 02fe37440c0..f55016122c1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c
@@ -4,7 +4,7 @@
*
* PNG Bitmap glyph support.
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* Google, Inc.
* Written by Stuart Gill and Behdad Esfahbod.
*
@@ -270,10 +270,7 @@
int bitdepth, color_type, interlace;
FT_Int i;
-
- /* `rows` gets modified within a 'setjmp' scope; */
- /* we thus need the `volatile` keyword. */
- png_byte* *volatile rows = NULL;
+ png_byte* *rows = NULL; /* pacify compiler */
if ( x_offset < 0 ||
@@ -430,7 +427,7 @@
goto DestroyExit;
}
- if ( FT_QNEW_ARRAY( rows, imgHeight ) )
+ if ( FT_NEW_ARRAY( rows, imgHeight ) )
{
error = FT_THROW( Out_Of_Memory );
goto DestroyExit;
@@ -441,11 +438,11 @@
png_read_image( png, rows );
+ FT_FREE( rows );
+
png_read_end( png, info );
DestroyExit:
- /* even if reading fails with longjmp, rows must be freed */
- FT_FREE( rows );
png_destroy_read_struct( &png, &info, NULL );
FT_Stream_Close( &stream );
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h
index 89efd27545b..2d6e83d69b0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h
@@ -4,7 +4,7 @@
*
* PNG Bitmap glyph support.
*
- * Copyright (C) 2013-2021 by
+ * Copyright (C) 2013-2020 by
* Google, Inc.
* Written by Stuart Gill and Behdad Esfahbod.
*
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk b/Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk
index d41305c0ad6..f56ef060ed3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c
index 824e709fab6..0460339a74f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
*
* High-level SFNT driver interface (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -501,7 +501,7 @@
FT_UNUSED( error );
- if ( FT_QALLOC( result, entry->stringLength / 2 + 1 ) )
+ if ( FT_ALLOC( result, entry->stringLength / 2 + 1 ) )
return NULL;
if ( FT_STREAM_SEEK( entry->stringOffset ) ||
@@ -560,7 +560,7 @@
FT_UNUSED( error );
- if ( FT_QALLOC( result, entry->stringLength + 1 ) )
+ if ( FT_ALLOC( result, entry->stringLength + 1 ) )
return NULL;
if ( FT_STREAM_SEEK( entry->stringOffset ) ||
@@ -868,8 +868,8 @@
result[len] = '\0';
FT_TRACE0(( "sfnt_get_var_ps_name:"
- " Shortening variation PS name prefix\n" ));
- FT_TRACE0(( " "
+ " Shortening variation PS name prefix\n"
+ " "
" to %d characters\n", len ));
}
@@ -920,16 +920,16 @@
if ( !subfamily_name )
{
FT_TRACE1(( "sfnt_get_var_ps_name:"
- " can't construct named instance PS name;\n" ));
- FT_TRACE1(( " "
+ " can't construct named instance PS name;\n"
+ " "
" trying to construct normal instance PS name\n" ));
goto construct_instance_name;
}
/* after the prefix we have character `-' followed by the */
/* subfamily name (using only characters a-z, A-Z, and 0-9) */
- if ( FT_QALLOC( result, face->var_postscript_prefix_len +
- 1 + ft_strlen( subfamily_name ) + 1 ) )
+ if ( FT_ALLOC( result, face->var_postscript_prefix_len +
+ 1 + ft_strlen( subfamily_name ) + 1 ) )
return NULL;
ft_strcpy( result, face->var_postscript_prefix );
@@ -957,9 +957,9 @@
construct_instance_name:
axis = mm_var->axis;
- if ( FT_QALLOC( result,
- face->var_postscript_prefix_len +
- num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) )
+ if ( FT_ALLOC( result,
+ face->var_postscript_prefix_len +
+ num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) )
return NULL;
p = result;
@@ -993,7 +993,6 @@
if ( t != ' ' && ft_isalnum( t ) )
*p++ = t;
}
- *p++ = '\0';
}
check_length:
@@ -1214,8 +1213,6 @@
#define PUT_COLOR_LAYERS( a ) NULL
#endif
-#define PUT_COLOR_LAYERS_V1( a ) PUT_COLOR_LAYERS( a )
-
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
#define PUT_PS_NAMES( a ) a
#else
@@ -1274,9 +1271,9 @@
/* TT_Free_Table_Func free_eblc */
PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike ),
- /* TT_Set_SBit_Strike_Func set_sbit_strike */
+ /* TT_Set_SBit_Strike_Func set_sbit_strike */
PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ),
- /* TT_Load_Strike_Metrics_Func load_strike_metrics */
+ /* TT_Load_Strike_Metrics_Func load_strike_metrics */
PUT_COLOR_LAYERS( tt_face_load_cpal ),
/* TT_Load_Table_Func load_cpal */
@@ -1290,16 +1287,6 @@
/* TT_Set_Palette_Func set_palette */
PUT_COLOR_LAYERS( tt_face_get_colr_layer ),
/* TT_Get_Colr_Layer_Func get_colr_layer */
-
- PUT_COLOR_LAYERS_V1( tt_face_get_colr_glyph_paint ),
- /* TT_Get_Colr_Glyph_Paint_Func get_colr_glyph_paint */
- PUT_COLOR_LAYERS_V1( tt_face_get_paint_layers ),
- /* TT_Get_Paint_Layers_Func get_paint_layers */
- PUT_COLOR_LAYERS_V1( tt_face_get_colorline_stops ),
- /* TT_Get_Paint get_paint */
- PUT_COLOR_LAYERS_V1( tt_face_get_paint ),
- /* TT_Get_Colorline_Stops_Func get_colorline_stops */
-
PUT_COLOR_LAYERS( tt_face_colr_blend_layer ),
/* TT_Blend_Colr_Func colr_blend */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h
index 8d5b5ce367c..1ac2706325f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h
@@ -4,7 +4,7 @@
*
* High-level SFNT driver interface (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h
index 78e6f03513a..55c3e76b666 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h
@@ -4,7 +4,7 @@
*
* SFNT error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c
index 97692cdfb0a..471239ff0ba 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c
@@ -4,7 +4,7 @@
*
* Single object library component.
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c
index cf730717eb0..39460be2e6c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
*
* SFNT object management (base).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -65,7 +65,7 @@
len = (FT_UInt)entry->stringLength / 2;
- if ( FT_QNEW_ARRAY( string, len + 1 ) )
+ if ( FT_NEW_ARRAY( string, len + 1 ) )
return NULL;
for ( n = 0; n < len; n++ )
@@ -100,7 +100,7 @@
len = (FT_UInt)entry->stringLength;
- if ( FT_QNEW_ARRAY( string, len + 1 ) )
+ if ( FT_NEW_ARRAY( string, len + 1 ) )
return NULL;
for ( n = 0; n < len; n++ )
@@ -446,7 +446,7 @@
return FT_THROW( Array_Too_Large );
/* now read the offsets of each font in the file */
- if ( FT_QNEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
+ if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
return error;
if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
@@ -464,7 +464,7 @@
face->ttc_header.version = 1 << 16;
face->ttc_header.count = 1;
- if ( FT_QNEW( face->ttc_header.offsets ) )
+ if ( FT_NEW( face->ttc_header.offsets ) )
return error;
face->ttc_header.offsets[0] = offset;
@@ -643,8 +643,8 @@
*/
if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
- !( FT_QALLOC( default_values, num_axes * 4 ) ||
- FT_QALLOC( instance_values, num_axes * 4 ) ) )
+ !( FT_ALLOC( default_values, num_axes * 4 ) ||
+ FT_ALLOC( instance_values, num_axes * 4 ) ) )
{
/* the current stream position is 16 bytes after the table start */
FT_ULong array_start = FT_STREAM_POS() - 16 + offset;
@@ -820,8 +820,7 @@
/* it doesn't contain outlines. */
/* */
- FT_TRACE2(( "sfnt_load_face: %p\n", (void *)face ));
- FT_TRACE2(( "\n" ));
+ FT_TRACE2(( "sfnt_load_face: %p\n\n", (void *)face ));
/* do we have outlines in there? */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -1150,10 +1149,9 @@
}
/* synthesize Unicode charmap if one is missing */
- if ( !has_unicode &&
- root->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
+ if ( !has_unicode )
{
- FT_CharMapRec cmaprec;
+ FT_CharMapRec cmaprec;
cmaprec.face = root;
@@ -1238,7 +1236,7 @@
}
/* reduce array size to the actually used elements */
- (void)FT_QRENEW_ARRAY( sbit_strike_map, count, bsize_idx );
+ (void)FT_RENEW_ARRAY( sbit_strike_map, count, bsize_idx );
/* from now on, all strike indices are mapped */
/* using `sbit_strike_map' */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h
index 172c47ebb48..e8e30420830 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h
@@ -4,7 +4,7 @@
*
* SFNT object management (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c
index 44c926ed413..f0a32e1e065 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c
@@ -4,7 +4,7 @@
*
* WOFF format management (base).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -66,7 +66,7 @@
}
- FT_COMPARE_DEF( int )
+ FT_CALLBACK_DEF( int )
compare_offsets( const void* a,
const void* b )
{
@@ -160,8 +160,8 @@
}
/* Don't trust `totalSfntSize' before thorough checks. */
- if ( FT_QALLOC( sfnt, 12 + woff.num_tables * 16UL ) ||
- FT_NEW( sfnt_stream ) )
+ if ( FT_ALLOC( sfnt, 12 + woff.num_tables * 16UL ) ||
+ FT_NEW( sfnt_stream ) )
goto Exit;
sfnt_header = sfnt;
@@ -198,9 +198,9 @@
FT_NEW_ARRAY( indices, woff.num_tables ) )
goto Exit;
- FT_TRACE2(( "\n" ));
- FT_TRACE2(( " tag offset compLen origLen checksum\n" ));
- FT_TRACE2(( " -------------------------------------------\n" ));
+ FT_TRACE2(( "\n"
+ " tag offset compLen origLen checksum\n"
+ " -------------------------------------------\n" ));
if ( FT_FRAME_ENTER( 20L * woff.num_tables ) )
goto Exit;
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h
index e2f22731e20..d177ab11600 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h
@@ -4,7 +4,7 @@
*
* WOFFF format management (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c
index df04072382e..5c8202f8237 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c
@@ -4,7 +4,7 @@
*
* WOFF2 format management (base).
*
- * Copyright (C) 2019-2021 by
+ * Copyright (C) 2019-2020 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -101,7 +101,7 @@
}
- FT_COMPARE_DEF( int )
+ FT_CALLBACK_DEF( int )
compare_tags( const void* a,
const void* b )
{
@@ -341,11 +341,6 @@
#else /* !FT_CONFIG_OPTION_USE_BROTLI */
- FT_UNUSED( dst );
- FT_UNUSED( dst_size );
- FT_UNUSED( src );
- FT_UNUSED( src_size );
-
FT_ERROR(( "woff2_decompress: Brotli support not available.\n" ));
return FT_THROW( Unimplemented_Feature );
@@ -795,7 +790,7 @@
goto Fail;
loca_buf_size = loca_values_size * offset_size;
- if ( FT_QNEW_ARRAY( loca_buf, loca_buf_size ) )
+ if ( FT_NEW_ARRAY( loca_buf, loca_buf_size ) )
goto Fail;
dst = loca_buf;
@@ -1857,10 +1852,11 @@
FT_NEW_ARRAY( indices, woff2.num_tables ) )
goto Exit;
- FT_TRACE2(( "\n" ));
- FT_TRACE2(( " tag flags transform origLen transformLen offset\n" ));
- FT_TRACE2(( " -----------------------------------------------------------\n" ));
- /* " XXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX" */
+ FT_TRACE2((
+ "\n"
+ " tag flags transform origLen transformLen offset\n"
+ " -----------------------------------------------------------\n" ));
+ /* " XXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX" */
for ( nn = 0; nn < woff2.num_tables; nn++ )
{
@@ -2123,8 +2119,8 @@
/* Create a temporary array. */
- if ( FT_QNEW_ARRAY( temp_indices,
- ttc_font->num_tables ) )
+ if ( FT_NEW_ARRAY( temp_indices,
+ ttc_font->num_tables ) )
goto Exit;
FT_TRACE4(( "Storing tables for TTC face index %d.\n", face_index ));
@@ -2132,9 +2128,9 @@
temp_indices[nn] = indices[ttc_font->table_indices[nn]];
/* Resize array to required size. */
- if ( FT_QRENEW_ARRAY( indices,
- woff2.num_tables,
- ttc_font->num_tables ) )
+ if ( FT_RENEW_ARRAY( indices,
+ woff2.num_tables,
+ ttc_font->num_tables ) )
goto Exit;
for ( nn = 0; nn < ttc_font->num_tables; nn++ )
@@ -2174,8 +2170,8 @@
}
/* Write sfnt header. */
- if ( FT_QALLOC( sfnt, sfnt_size ) ||
- FT_NEW( sfnt_stream ) )
+ if ( FT_ALLOC( sfnt, sfnt_size ) ||
+ FT_NEW( sfnt_stream ) )
goto Exit;
sfnt_header = sfnt;
@@ -2213,25 +2209,6 @@
sizeof ( WOFF2_Table ),
compare_tags );
- /* reject fonts that have multiple tables with the same tag */
- for ( nn = 1; nn < woff2.num_tables; nn++ )
- {
- FT_ULong tag = indices[nn]->Tag;
-
-
- if ( tag == indices[nn - 1]->Tag )
- {
- FT_ERROR(( "woff2_open_font:"
- " multiple tables with tag `%c%c%c%c'.\n",
- (FT_Char)( tag >> 24 ),
- (FT_Char)( tag >> 16 ),
- (FT_Char)( tag >> 8 ),
- (FT_Char)( tag ) ));
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
- }
-
if ( woff2.uncompressed_size < 1 )
{
error = FT_THROW( Invalid_Table );
@@ -2246,8 +2223,8 @@
}
/* Allocate memory for uncompressed table data. */
- if ( FT_QALLOC( uncompressed_buf, woff2.uncompressed_size ) ||
- FT_FRAME_ENTER( woff2.totalCompressedSize ) )
+ if ( FT_ALLOC( uncompressed_buf, woff2.uncompressed_size ) ||
+ FT_FRAME_ENTER( woff2.totalCompressedSize ) )
goto Exit;
/* Uncompress the stream. */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h
index 27f3da7b1d3..798f66bd0af 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h
@@ -4,7 +4,7 @@
*
* WOFFF2 format management (specification).
*
- * Copyright (C) 2019-2021 by
+ * Copyright (C) 2019-2020 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c
index b8d9473a632..a287d3afc47 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c
@@ -4,7 +4,7 @@
*
* TrueType and OpenType embedded BDF properties (body).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h
index 91271d916f7..e60c01cb8ba 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h
@@ -4,7 +4,7 @@
*
* TrueType and OpenType embedded BDF properties (specification).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c
index b369d837884..556a712199f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
*
* TrueType character mapping table (cmap) support (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -916,16 +916,6 @@
length = (FT_UInt)( valid->limit - table );
}
- /* it also happens that the `length' field is too small; */
- /* this is easy to correct */
- if ( length < (FT_UInt)( valid->limit - table ) )
- {
- if ( valid->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_DATA;
-
- length = (FT_UInt)( valid->limit - table );
- }
-
if ( length < 16 )
FT_INVALID_TOO_SHORT;
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h
index 504fc951c41..c7d7c21d2c0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h
@@ -4,7 +4,7 @@
*
* TrueType character mapping table (cmap) support (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h
index 4e6cd46ba88..2e4ce5075b8 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h
@@ -4,7 +4,7 @@
*
* TT CMAP classes definitions (specification only).
*
- * Copyright (C) 2009-2021 by
+ * Copyright (C) 2009-2020 by
* Oran Agra and Mickey Gabel.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c
index bd478ab9b5b..9025e356ce3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c
@@ -4,8 +4,8 @@
*
* TrueType and OpenType colored glyph layer support (body).
*
- * Copyright (C) 2018-2021 by
- * David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg.
+ * Copyright (C) 2018-2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
*
@@ -31,7 +31,6 @@
#include <freetype/internal/ftstream.h>
#include <freetype/tttags.h>
#include <freetype/ftcolor.h>
-#include <freetype/config/integer-types.h>
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
@@ -40,27 +39,12 @@
/* NOTE: These are the table sizes calculated through the specs. */
-#define BASE_GLYPH_SIZE 6U
-#define BASE_GLYPH_PAINT_RECORD_SIZE 6U
-#define LAYER_V1_LIST_PAINT_OFFSET_SIZE 4U
-#define LAYER_V1_LIST_NUM_LAYERS_SIZE 4U
-#define COLOR_STOP_SIZE 6U
-#define LAYER_SIZE 4U
-#define COLR_HEADER_SIZE 14U
+#define BASE_GLYPH_SIZE 6U
+#define LAYER_SIZE 4U
+#define COLR_HEADER_SIZE 14U
- typedef enum FT_PaintFormat_Internal_
- {
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER = 18,
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM = 20,
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER = 22,
- FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER = 26,
- FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER = 30
-
- } FT_PaintFormat_Internal;
-
-
- typedef struct BaseGlyphRecord_
+ typedef struct BaseGlyphRecord_
{
FT_UShort gid;
FT_UShort first_layer_index;
@@ -69,16 +53,7 @@
} BaseGlyphRecord;
- typedef struct BaseGlyphV1Record_
- {
- FT_UShort gid;
- /* Offset from start of BaseGlyphV1List, i.e., from base_glyphs_v1. */
- FT_ULong paint_offset;
-
- } BaseGlyphV1Record;
-
-
- typedef struct Colr_
+ typedef struct Colr_
{
FT_UShort version;
FT_UShort num_base_glyphs;
@@ -87,21 +62,7 @@
FT_Byte* base_glyphs;
FT_Byte* layers;
- FT_ULong num_base_glyphs_v1;
- /* Points at beginning of BaseGlyphV1List. */
- FT_Byte* base_glyphs_v1;
-
- FT_ULong num_layers_v1;
- FT_Byte* layers_v1;
-
- /*
- * Paint tables start at the minimum of the end of the LayerList and the
- * end of the BaseGlyphList. Record this location in a field here for
- * safety checks when accessing paint tables.
- */
- FT_Byte* paints_start_v1;
-
- /* The memory that backs up the `COLR' table. */
+ /* The memory which backs up the `COLR' table. */
void* table;
FT_ULong table_size;
@@ -127,14 +88,10 @@
FT_Byte* table = NULL;
FT_Byte* p = NULL;
- /* Needed for reading array lengths in referenced tables. */
- FT_Byte* p1 = NULL;
Colr* colr = NULL;
FT_ULong base_glyph_offset, layer_offset;
- FT_ULong base_glyphs_offset_v1, num_base_glyphs_v1;
- FT_ULong layer_offset_v1, num_layers_v1;
FT_ULong table_size;
@@ -158,7 +115,7 @@
goto NoColr;
colr->version = FT_NEXT_USHORT( p );
- if ( colr->version != 0 && colr->version != 1 )
+ if ( colr->version != 0 )
goto InvalidTable;
colr->num_base_glyphs = FT_NEXT_USHORT( p );
@@ -178,56 +135,6 @@
if ( colr->num_layers * LAYER_SIZE > table_size - layer_offset )
goto InvalidTable;
- if ( colr->version == 1 )
- {
- base_glyphs_offset_v1 = FT_NEXT_ULONG( p );
-
- if ( base_glyphs_offset_v1 >= table_size )
- goto InvalidTable;
-
- p1 = (FT_Byte*)( table + base_glyphs_offset_v1 );
- num_base_glyphs_v1 = FT_PEEK_ULONG( p1 );
-
- if ( num_base_glyphs_v1 * BASE_GLYPH_PAINT_RECORD_SIZE >
- table_size - base_glyphs_offset_v1 )
- goto InvalidTable;
-
- colr->num_base_glyphs_v1 = num_base_glyphs_v1;
- colr->base_glyphs_v1 = p1;
-
- layer_offset_v1 = FT_NEXT_ULONG( p );
-
- if ( layer_offset_v1 >= table_size )
- goto InvalidTable;
-
- if ( layer_offset_v1 )
- {
- p1 = (FT_Byte*)( table + layer_offset_v1 );
- num_layers_v1 = FT_PEEK_ULONG( p1 );
-
- if ( num_layers_v1 * LAYER_V1_LIST_PAINT_OFFSET_SIZE >
- table_size - layer_offset_v1 )
- goto InvalidTable;
-
- colr->num_layers_v1 = num_layers_v1;
- colr->layers_v1 = p1;
-
- colr->paints_start_v1 =
- FT_MIN( colr->base_glyphs_v1 +
- colr->num_base_glyphs_v1 * BASE_GLYPH_PAINT_RECORD_SIZE,
- colr->layers_v1 +
- colr->num_layers_v1 * LAYER_V1_LIST_PAINT_OFFSET_SIZE );
- }
- else
- {
- colr->num_layers_v1 = 0;
- colr->layers_v1 = 0;
- colr->paints_start_v1 =
- colr->base_glyphs_v1 +
- colr->num_base_glyphs_v1 * BASE_GLYPH_PAINT_RECORD_SIZE;
- }
- }
-
colr->base_glyphs = (FT_Byte*)( table + base_glyph_offset );
colr->layers = (FT_Byte*)( table + layer_offset );
colr->table = table;
@@ -267,17 +174,17 @@
static FT_Bool
find_base_glyph_record( FT_Byte* base_glyph_begin,
- FT_UInt num_base_glyph,
+ FT_Int num_base_glyph,
FT_UInt glyph_id,
BaseGlyphRecord* record )
{
- FT_UInt min = 0;
- FT_UInt max = num_base_glyph;
+ FT_Int min = 0;
+ FT_Int max = num_base_glyph - 1;
- while ( min < max )
+ while ( min <= max )
{
- FT_UInt mid = min + ( max - min ) / 2;
+ FT_Int mid = min + ( max - min ) / 2;
FT_Byte* p = base_glyph_begin + mid * BASE_GLYPH_SIZE;
FT_UShort gid = FT_NEXT_USHORT( p );
@@ -286,7 +193,7 @@
if ( gid < glyph_id )
min = mid + 1;
else if (gid > glyph_id )
- max = mid;
+ max = mid - 1;
else
{
record->gid = gid;
@@ -358,593 +265,6 @@
}
- static FT_Bool
- read_color_line( FT_Byte* color_line_p,
- FT_ColorLine *colorline )
- {
- FT_Byte* p = color_line_p;
- FT_PaintExtend paint_extend;
-
-
- paint_extend = (FT_PaintExtend)FT_NEXT_BYTE( p );
- if ( paint_extend > FT_COLR_PAINT_EXTEND_REFLECT )
- return 0;
-
- colorline->extend = paint_extend;
-
- colorline->color_stop_iterator.num_color_stops = FT_NEXT_USHORT( p );
- colorline->color_stop_iterator.p = p;
- colorline->color_stop_iterator.current_color_stop = 0;
-
- return 1;
- }
-
-
- /*
- * Read a paint offset for `FT_Paint*` objects that have them and check
- * whether it is within reasonable limits within the font and the COLR
- * table.
- *
- * Return 1 on success, 0 on failure.
- */
- static FT_Bool
- get_child_table_pointer ( Colr* colr,
- FT_Byte* paint_base,
- FT_Byte** p,
- FT_Byte** child_table_pointer )
- {
- FT_UInt32 paint_offset;
- FT_Byte* child_table_p;
-
-
- if ( !child_table_pointer )
- return 0;
-
- paint_offset = FT_NEXT_UOFF3( *p );
- if ( !paint_offset )
- return 0;
-
- child_table_p = (FT_Byte*)( paint_base + paint_offset );
-
- if ( child_table_p < colr->paints_start_v1 ||
- child_table_p >= ( (FT_Byte*)colr->table + colr->table_size ) )
- return 0;
-
- *child_table_pointer = child_table_p;
- return 1;
- }
-
-
- static FT_Bool
- read_paint( Colr* colr,
- FT_Byte* p,
- FT_COLR_Paint* apaint )
- {
- FT_Byte* paint_base = p;
- FT_Byte* child_table_p = NULL;
-
-
- if ( !p || !colr || !colr->table )
- return 0;
-
- if ( p < colr->paints_start_v1 ||
- p >= ( (FT_Byte*)colr->table + colr->table_size ) )
- return 0;
-
- apaint->format = (FT_PaintFormat)FT_NEXT_BYTE( p );
-
- if ( apaint->format >= FT_COLR_PAINT_FORMAT_MAX )
- return 0;
-
- if ( apaint->format == FT_COLR_PAINTFORMAT_COLR_LAYERS )
- {
- /* Initialize layer iterator/ */
- FT_Byte num_layers;
- FT_UInt32 first_layer_index;
-
-
- num_layers = FT_NEXT_BYTE( p );
- if ( num_layers > colr->num_layers_v1 )
- return 0;
-
- first_layer_index = FT_NEXT_ULONG( p );
- if ( first_layer_index + num_layers > colr->num_layers_v1 )
- return 0;
-
- apaint->u.colr_layers.layer_iterator.num_layers = num_layers;
- apaint->u.colr_layers.layer_iterator.layer = 0;
- /* TODO: Check whether pointer is outside colr? */
- apaint->u.colr_layers.layer_iterator.p =
- colr->layers_v1 +
- LAYER_V1_LIST_NUM_LAYERS_SIZE +
- LAYER_V1_LIST_PAINT_OFFSET_SIZE * first_layer_index;
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_SOLID )
- {
- apaint->u.solid.color.palette_index = FT_NEXT_USHORT( p );
- apaint->u.solid.color.alpha = FT_NEXT_SHORT( p );
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_COLR_GLYPH )
- {
- apaint->u.colr_glyph.glyphID = FT_NEXT_USHORT( p );
-
- return 1;
- }
-
- /*
- * Grouped below here are all paint formats that have an offset to a
- * child paint table as the first entry (for example, a color line or a
- * child paint table). Retrieve that and determine whether that paint
- * offset is valid first.
- */
-
- if ( !get_child_table_pointer( colr, paint_base, &p, &child_table_p ) )
- return 0;
-
- if ( apaint->format == FT_COLR_PAINTFORMAT_LINEAR_GRADIENT )
- {
- if ( !read_color_line( child_table_p,
- &apaint->u.linear_gradient.colorline ) )
- return 0;
-
- apaint->u.linear_gradient.p0.x = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p0.y = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p1.x = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p1.y = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p2.x = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p2.y = FT_NEXT_SHORT( p );
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_RADIAL_GRADIENT )
- {
- if ( !read_color_line( child_table_p,
- &apaint->u.radial_gradient.colorline ) )
- return 0;
-
- apaint->u.radial_gradient.c0.x = FT_NEXT_SHORT( p );
- apaint->u.radial_gradient.c0.y = FT_NEXT_SHORT( p );
-
- apaint->u.radial_gradient.r0 = FT_NEXT_USHORT( p );
-
- apaint->u.radial_gradient.c1.x = FT_NEXT_SHORT( p );
- apaint->u.radial_gradient.c1.y = FT_NEXT_SHORT( p );
-
- apaint->u.radial_gradient.r1 = FT_NEXT_USHORT( p );
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_SWEEP_GRADIENT )
- {
- if ( !read_color_line( child_table_p,
- &apaint->u.sweep_gradient.colorline ) )
- return 0;
-
- apaint->u.sweep_gradient.center.x = FT_NEXT_SHORT( p );
- apaint->u.sweep_gradient.center.y = FT_NEXT_SHORT( p );
-
- apaint->u.sweep_gradient.start_angle = FT_NEXT_LONG( p );
- apaint->u.sweep_gradient.end_angle = FT_NEXT_LONG( p );
-
- return 1;
- }
-
- if ( apaint->format == FT_COLR_PAINTFORMAT_GLYPH )
- {
- apaint->u.glyph.paint.p = child_table_p;
- apaint->u.glyph.paint.insert_root_transform = 0;
- apaint->u.glyph.glyphID = FT_NEXT_USHORT( p );
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSFORM )
- {
- apaint->u.transform.paint.p = child_table_p;
- apaint->u.transform.paint.insert_root_transform = 0;
-
- apaint->u.transform.affine.xx = FT_NEXT_LONG( p );
- apaint->u.transform.affine.yx = FT_NEXT_LONG( p );
- apaint->u.transform.affine.xy = FT_NEXT_LONG( p );
- apaint->u.transform.affine.yy = FT_NEXT_LONG( p );
- apaint->u.transform.affine.dx = FT_NEXT_LONG( p );
- apaint->u.transform.affine.dy = FT_NEXT_LONG( p );
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSLATE )
- {
- apaint->u.translate.paint.p = child_table_p;
- apaint->u.translate.paint.insert_root_transform = 0;
-
- apaint->u.translate.dx = FT_NEXT_LONG( p );
- apaint->u.translate.dy = FT_NEXT_LONG( p );
-
- return 1;
- }
-
- else if ( apaint->format ==
- FT_COLR_PAINTFORMAT_SCALE ||
- (FT_PaintFormat_Internal)apaint->format ==
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER ||
- (FT_PaintFormat_Internal)apaint->format ==
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM ||
- (FT_PaintFormat_Internal)apaint->format ==
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER )
- {
- apaint->u.scale.paint.p = child_table_p;
- apaint->u.scale.paint.insert_root_transform = 0;
-
- /* All scale paints get at least one scale value. */
- apaint->u.scale.scale_x = FT_NEXT_LONG( p );
-
- /* Non-uniform ones read an extra y value. */
- if ( apaint->format ==
- FT_COLR_PAINTFORMAT_SCALE ||
- (FT_PaintFormat_Internal)apaint->format ==
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER )
- apaint->u.scale.scale_y = FT_NEXT_LONG( p );
- else
- apaint->u.scale.scale_y = apaint->u.scale.scale_x;
-
- /* Scale paints that have a center read center coordinates, */
- /* otherwise the center is (0,0). */
- if ( (FT_PaintFormat_Internal)apaint->format ==
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER ||
- (FT_PaintFormat_Internal)apaint->format ==
- FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER )
- {
- apaint->u.scale.center_x = FT_NEXT_LONG ( p );
- apaint->u.scale.center_y = FT_NEXT_LONG ( p );
- }
- else
- {
- apaint->u.scale.center_x = 0;
- apaint->u.scale.center_y = 0;
- }
-
- /* FT 'COLR' v1 API output format always returns fully defined */
- /* structs; we thus set the format to the public API value. */
- apaint->format = FT_COLR_PAINTFORMAT_SCALE;
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_ROTATE )
- {
- apaint->u.rotate.paint.p = child_table_p;
- apaint->u.rotate.paint.insert_root_transform = 0;
-
- apaint->u.rotate.angle = FT_NEXT_LONG( p );
-
- apaint->u.rotate.center_x = FT_NEXT_LONG( p );
- apaint->u.rotate.center_y = FT_NEXT_LONG( p );
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_SKEW )
- {
- apaint->u.skew.paint.p = child_table_p;
- apaint->u.skew.paint.insert_root_transform = 0;
-
- apaint->u.skew.x_skew_angle = FT_NEXT_LONG( p );
- apaint->u.skew.y_skew_angle = FT_NEXT_LONG( p );
-
- apaint->u.skew.center_x = FT_NEXT_LONG( p );
- apaint->u.skew.center_y = FT_NEXT_LONG( p );
-
- return 1;
- }
-
- else if ( apaint->format == FT_COLR_PAINTFORMAT_COMPOSITE )
- {
- FT_UInt composite_mode;
-
-
- apaint->u.composite.source_paint.p = child_table_p;
- apaint->u.composite.source_paint.insert_root_transform = 0;
-
- composite_mode = FT_NEXT_BYTE( p );
- if ( composite_mode >= FT_COLR_COMPOSITE_MAX )
- return 0;
-
- apaint->u.composite.composite_mode = (FT_Composite_Mode)composite_mode;
-
- if ( !get_child_table_pointer( colr, paint_base, &p, &child_table_p ) )
- return 0;
-
- apaint->u.composite.backdrop_paint.p =
- child_table_p;
- apaint->u.composite.backdrop_paint.insert_root_transform =
- 0;
-
- return 1;
- }
-
- return 0;
- }
-
-
- static FT_Bool
- find_base_glyph_v1_record( FT_Byte * base_glyph_begin,
- FT_UInt num_base_glyph,
- FT_UInt glyph_id,
- BaseGlyphV1Record *record )
- {
- FT_UInt min = 0;
- FT_UInt max = num_base_glyph;
-
-
- while ( min < max )
- {
- FT_UInt mid = min + ( max - min ) / 2;
-
- /*
- * `base_glyph_begin` is the beginning of `BaseGlyphV1List`;
- * skip `numBaseGlyphV1Records` by adding 4 to start binary search
- * in the array of `BaseGlyphV1Record`.
- */
- FT_Byte *p = base_glyph_begin + 4 + mid * BASE_GLYPH_PAINT_RECORD_SIZE;
-
- FT_UShort gid = FT_NEXT_USHORT( p );
-
-
- if ( gid < glyph_id )
- min = mid + 1;
- else if (gid > glyph_id )
- max = mid;
- else
- {
- record->gid = gid;
- record->paint_offset = FT_NEXT_ULONG ( p );
- return 1;
- }
- }
-
- return 0;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- tt_face_get_colr_glyph_paint( TT_Face face,
- FT_UInt base_glyph,
- FT_Color_Root_Transform root_transform,
- FT_OpaquePaint* opaque_paint )
- {
- Colr* colr = (Colr*)face->colr;
- BaseGlyphV1Record base_glyph_v1_record;
- FT_Byte* p;
-
- if ( !colr || !colr->table )
- return 0;
-
- if ( colr->version < 1 || !colr->num_base_glyphs_v1 ||
- !colr->base_glyphs_v1 )
- return 0;
-
- if ( opaque_paint->p )
- return 0;
-
- if ( !find_base_glyph_v1_record( colr->base_glyphs_v1,
- colr->num_base_glyphs_v1,
- base_glyph,
- &base_glyph_v1_record ) )
- return 0;
-
- if ( !base_glyph_v1_record.paint_offset ||
- base_glyph_v1_record.paint_offset > colr->table_size )
- return 0;
-
- p = (FT_Byte*)( colr->base_glyphs_v1 +
- base_glyph_v1_record.paint_offset );
- if ( p >= ( (FT_Byte*)colr->table + colr->table_size ) )
- return 0;
-
- opaque_paint->p = p;
-
- if ( root_transform == FT_COLOR_INCLUDE_ROOT_TRANSFORM )
- opaque_paint->insert_root_transform = 1;
- else
- opaque_paint->insert_root_transform = 0;
-
- return 1;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- tt_face_get_paint_layers( TT_Face face,
- FT_LayerIterator* iterator,
- FT_OpaquePaint* opaque_paint )
- {
- FT_Byte* p = NULL;
- FT_Byte* p_first_layer = NULL;
- FT_Byte* p_paint = NULL;
- FT_UInt32 paint_offset;
-
- Colr* colr;
-
-
- if ( iterator->layer == iterator->num_layers )
- return 0;
-
- colr = (Colr*)face->colr;
- if ( !colr )
- return 0;
-
- /*
- * We have an iterator pointing at a paint offset as part of the
- * `paintOffset` array in `LayerV1List`.
- */
- p = iterator->p;
-
- /*
- * First ensure that p is within COLRv1.
- */
- if ( p < colr->layers_v1 ||
- p >= ( (FT_Byte*)colr->table + colr->table_size ) )
- return 0;
-
- /*
- * Do a cursor sanity check of the iterator. Counting backwards from
- * where it stands, we need to end up at a position after the beginning
- * of the `LayerV1List` table and not after the end of the
- * `LayerV1List`.
- */
- p_first_layer = p -
- iterator->layer * LAYER_V1_LIST_PAINT_OFFSET_SIZE -
- LAYER_V1_LIST_NUM_LAYERS_SIZE;
- if ( p_first_layer < (FT_Byte*)colr->layers_v1 )
- return 0;
- if ( p_first_layer >= (FT_Byte*)(
- colr->layers_v1 + LAYER_V1_LIST_NUM_LAYERS_SIZE +
- colr->num_layers_v1 * LAYER_V1_LIST_PAINT_OFFSET_SIZE ) )
- return 0;
-
- paint_offset =
- FT_NEXT_ULONG( p );
- opaque_paint->insert_root_transform =
- 0;
-
- p_paint = (FT_Byte*)( colr->layers_v1 + paint_offset );
-
- if ( p_paint < colr->paints_start_v1 ||
- p_paint >= ( (FT_Byte*)colr->table + colr->table_size ) )
- return 0;
-
- opaque_paint->p = p_paint;
-
- iterator->p = p;
-
- iterator->layer++;
-
- return 1;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- tt_face_get_colorline_stops( TT_Face face,
- FT_ColorStop* color_stop,
- FT_ColorStopIterator *iterator )
- {
- Colr* colr = (Colr*)face->colr;
-
- FT_Byte* p;
-
-
- if ( !colr || !colr->table )
- return 0;
-
- if ( iterator->current_color_stop >= iterator->num_color_stops )
- return 0;
-
- if ( iterator->p +
- ( ( iterator->num_color_stops - iterator->current_color_stop ) *
- COLOR_STOP_SIZE ) >
- ( (FT_Byte *)colr->table + colr->table_size ) )
- return 0;
-
- /* Iterator points at first `ColorStop` of `ColorLine`. */
- p = iterator->p;
-
- color_stop->stop_offset = FT_NEXT_SHORT( p );
-
- color_stop->color.palette_index = FT_NEXT_USHORT( p );
-
- color_stop->color.alpha = FT_NEXT_SHORT( p );
-
- iterator->p = p;
- iterator->current_color_stop++;
-
- return 1;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- tt_face_get_paint( TT_Face face,
- FT_OpaquePaint opaque_paint,
- FT_COLR_Paint* paint )
- {
- Colr* colr = (Colr*)face->colr;
- FT_OpaquePaint next_paint;
- FT_Matrix ft_root_scale;
-
- if ( !colr || !colr->base_glyphs_v1 || !colr->table )
- return 0;
-
- if ( opaque_paint.insert_root_transform )
- {
- /* 'COLR' v1 glyph information is returned in unscaled coordinates,
- * i.e., `FT_Size` is not applied or multiplied into the values. When
- * client applications draw color glyphs, they can request to include
- * a top-level transform, which includes the active `x_scale` and
- * `y_scale` information for scaling the glyph, as well the additional
- * transform and translate configured through `FT_Set_Transform`.
- * This allows client applications to apply this top-level transform
- * to the graphics context first and only once, then have gradient and
- * contour scaling applied correctly when performing the additional
- * drawing operations for subsequenct paints. Prepare this initial
- * transform here.
- */
- paint->format = FT_COLR_PAINTFORMAT_TRANSFORM;
-
- next_paint.p = opaque_paint.p;
- next_paint.insert_root_transform = 0;
- paint->u.transform.paint = next_paint;
-
- /* `x_scale` and `y_scale` are in 26.6 format, representing the scale
- * factor to get from font units to requested size. However, expected
- * return values are in 16.16, so we shift accordingly with rounding.
- */
- ft_root_scale.xx = ( face->root.size->metrics.x_scale + 32 ) >> 6;
- ft_root_scale.xy = 0;
- ft_root_scale.yx = 0;
- ft_root_scale.yy = ( face->root.size->metrics.y_scale + 32 ) >> 6;
-
- if ( face->root.internal->transform_flags & 1 )
- FT_Matrix_Multiply( &face->root.internal->transform_matrix,
- &ft_root_scale );
-
- paint->u.transform.affine.xx = ft_root_scale.xx;
- paint->u.transform.affine.xy = ft_root_scale.xy;
- paint->u.transform.affine.yx = ft_root_scale.yx;
- paint->u.transform.affine.yy = ft_root_scale.yy;
-
- /* The translation is specified in 26.6 format and, according to the
- * documentation of `FT_Set_Translate`, is performed on the character
- * size given in the last call to `FT_Set_Char_Size`. The
- * 'PaintTransform' paint table's `FT_Affine23` format expects
- * values in 16.16 format, thus we need to shift by 10 bits.
- */
- if ( face->root.internal->transform_flags & 2 )
- {
- paint->u.transform.affine.dx =
- face->root.internal->transform_delta.x << 10;
- paint->u.transform.affine.dy =
- face->root.internal->transform_delta.y << 10;
- }
- else
- {
- paint->u.transform.affine.dx = 0;
- paint->u.transform.affine.dy = 0;
- }
-
- return 1;
- }
-
- return read_paint( colr, opaque_paint.p, paint );
- }
-
-
FT_LOCAL_DEF( FT_Error )
tt_face_colr_blend_layer( TT_Face face,
FT_UInt color_index,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h
index c91d2b1723e..6412162669f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h
@@ -4,7 +4,7 @@
*
* TrueType and OpenType colored glyph layer support (specification).
*
- * Copyright (C) 2018-2021 by
+ * Copyright (C) 2018-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
@@ -42,27 +42,6 @@ FT_BEGIN_HEADER
FT_UInt *acolor_index,
FT_LayerIterator* iterator );
- FT_LOCAL( FT_Bool )
- tt_face_get_colr_glyph_paint( TT_Face face,
- FT_UInt base_glyph,
- FT_Color_Root_Transform root_transform,
- FT_OpaquePaint* paint );
-
- FT_LOCAL( FT_Bool )
- tt_face_get_paint_layers( TT_Face face,
- FT_LayerIterator* iterator,
- FT_OpaquePaint* paint );
-
- FT_LOCAL( FT_Bool )
- tt_face_get_colorline_stops( TT_Face face,
- FT_ColorStop* color_stop,
- FT_ColorStopIterator* iterator );
-
- FT_LOCAL( FT_Bool )
- tt_face_get_paint( TT_Face face,
- FT_OpaquePaint opaque_paint,
- FT_COLR_Paint* paint );
-
FT_LOCAL( FT_Error )
tt_face_colr_blend_layer( TT_Face face,
FT_UInt color_index,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c
index a0d84bca3a6..9c514bafe58 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c
@@ -4,7 +4,7 @@
*
* TrueType and OpenType color palette support (body).
*
- * Copyright (C) 2018-2021 by
+ * Copyright (C) 2018-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h
index 1c5586855b9..b544be696a4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h
@@ -4,7 +4,7 @@
*
* TrueType and OpenType color palette support (specification).
*
- * Copyright (C) 2018-2021 by
+ * Copyright (C) 2018-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.c
index bb1922caf95..d4a70c7855a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.c
+++ b/Build/source/libs/freetype2/freetype-src/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 (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.h
index 3d8f1e83477..f44b5bdeb0d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.h
+++ b/Build/source/libs/freetype2/freetype-src/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 (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c
index d8ea9ea01cd..4b46f41357c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c
+++ b/Build/source/libs/freetype2/freetype-src/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 (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -416,9 +416,9 @@
FT_FRAME_ENTER( sfnt.num_tables * 16L ) )
goto Exit;
- FT_TRACE2(( "\n" ));
- FT_TRACE2(( " tag offset length checksum\n" ));
- FT_TRACE2(( " ----------------------------------\n" ));
+ FT_TRACE2(( "\n"
+ " tag offset length checksum\n"
+ " ----------------------------------\n" ));
valid_entries = 0;
for ( nn = 0; nn < sfnt.num_tables; nn++ )
@@ -505,8 +505,7 @@
FT_FRAME_EXIT();
- FT_TRACE2(( "table directory loaded\n" ));
- FT_TRACE2(( "\n" ));
+ FT_TRACE2(( "table directory loaded\n\n" ));
Exit:
return error;
@@ -795,8 +794,8 @@
if ( maxProfile->maxTwilightPoints > ( 0xFFFFU - 4 ) )
{
FT_TRACE0(( "tt_face_load_maxp:"
- " too much twilight points in `maxp' table;\n" ));
- FT_TRACE0(( " "
+ " too much twilight points in `maxp' table;\n"
+ " "
" some glyphs might be rendered incorrectly\n" ));
maxProfile->maxTwilightPoints = 0xFFFFU - 4;
@@ -917,8 +916,8 @@
storage_start += 2 + 4 * table->numLangTagRecords;
/* allocate language tag records array */
- if ( FT_QNEW_ARRAY( table->langTags, table->numLangTagRecords ) ||
- FT_FRAME_ENTER( table->numLangTagRecords * 4 ) )
+ if ( FT_NEW_ARRAY( table->langTags, table->numLangTagRecords ) ||
+ FT_FRAME_ENTER( table->numLangTagRecords * 4 ) )
goto Exit;
/* load language tags */
@@ -948,8 +947,8 @@
}
/* allocate name records array */
- if ( FT_QNEW_ARRAY( table->names, table->numNameRecords ) ||
- FT_FRAME_ENTER( table->numNameRecords * 12 ) )
+ if ( FT_NEW_ARRAY( table->names, table->numNameRecords ) ||
+ FT_FRAME_ENTER( table->numNameRecords * 12 ) )
goto Exit;
/* load name records */
@@ -993,9 +992,9 @@
/* reduce array size to the actually used elements */
count = (FT_UInt)( entry - table->names );
- (void)FT_QRENEW_ARRAY( table->names,
- table->numNameRecords,
- count );
+ (void)FT_RENEW_ARRAY( table->names,
+ table->numNameRecords,
+ count );
table->numNameRecords = count;
}
@@ -1312,12 +1311,6 @@
if ( FT_STREAM_READ_FIELDS( post_fields, post ) )
return error;
- if ( post->FormatType != 0x00030000L &&
- post->FormatType != 0x00025000L &&
- post->FormatType != 0x00020000L &&
- post->FormatType != 0x00010000L )
- return FT_THROW( Invalid_Post_Table_Format );
-
/* we don't load the glyph names, we do that in another */
/* module (ttpost). */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.h
index cab15cd2387..4e53d8b7823 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.h
+++ b/Build/source/libs/freetype2/freetype-src/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 (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c
index 7aece36fb01..021123336ed 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c
@@ -4,7 +4,7 @@
*
* Load the metrics tables common to TTF and OTF fonts (body).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h
index 270170d4782..dba65ca9ba3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h
@@ -4,7 +4,7 @@
*
* Load the metrics tables common to TTF and OTF fonts (specification).
*
- * Copyright (C) 2006-2021 by
+ * Copyright (C) 2006-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c
index b92ca5db149..e93a4bf1b16 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
* PostScript name table processing for TrueType and OpenType fonts
* (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -158,7 +158,7 @@
static FT_Error
load_format_20( TT_Face face,
FT_Stream stream,
- FT_ULong post_len )
+ FT_ULong post_limit )
{
FT_Memory memory = stream->memory;
FT_Error error;
@@ -168,7 +168,6 @@
FT_UShort* glyph_indices = NULL;
FT_Char** name_strings = NULL;
- FT_Byte* strings = NULL;
if ( FT_READ_USHORT( num_glyphs ) )
@@ -180,8 +179,7 @@
/* There already exist fonts which have more than 32768 glyph names */
/* in this table, so the test for this threshold has been dropped. */
- if ( num_glyphs > face->max_profile.numGlyphs ||
- (FT_ULong)num_glyphs * 2UL > post_len - 2 )
+ if ( num_glyphs > face->max_profile.numGlyphs )
{
error = FT_THROW( Invalid_File_Format );
goto Exit;
@@ -192,7 +190,7 @@
FT_Int n;
- if ( FT_QNEW_ARRAY( glyph_indices, num_glyphs ) ||
+ if ( FT_NEW_ARRAY ( glyph_indices, num_glyphs ) ||
FT_FRAME_ENTER( num_glyphs * 2L ) )
goto Fail;
@@ -225,56 +223,60 @@
}
/* now load the name strings */
- if ( num_names )
{
FT_UShort n;
- FT_ULong p;
- post_len -= (FT_ULong)num_glyphs * 2UL + 2;
-
- if ( FT_QALLOC( strings, post_len + 1 ) ||
- FT_STREAM_READ( strings, post_len ) ||
- FT_QNEW_ARRAY( name_strings, num_names ) )
+ if ( FT_NEW_ARRAY( name_strings, num_names ) )
goto Fail;
- /* convert from Pascal- to C-strings and set pointers */
- for ( p = 0, n = 0; p < post_len && n < num_names; n++ )
+ for ( n = 0; n < num_names; n++ )
{
- FT_UInt len = strings[p];
+ FT_UInt len;
- if ( len > 63U )
+ if ( FT_STREAM_POS() >= post_limit )
+ break;
+ else
{
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
+ FT_TRACE6(( "load_format_20: %ld byte left in post table\n",
+ post_limit - FT_STREAM_POS() ));
- strings[p] = 0;
- name_strings[n] = (FT_Char*)strings + p + 1;
- p += len + 1;
- }
- strings[post_len] = 0;
+ if ( FT_READ_BYTE( len ) )
+ goto Fail1;
+ }
- /* deal with missing or insufficient string data */
- if ( n < num_names )
- {
- if ( post_len == 0 )
+ if ( len > post_limit ||
+ FT_STREAM_POS() > post_limit - len )
{
- /* fake empty string */
- if ( FT_QREALLOC( strings, 1, 2 ) )
- goto Fail;
+ FT_Int d = (FT_Int)post_limit - (FT_Int)FT_STREAM_POS();
+
- post_len = 1;
- strings[post_len] = 0;
+ FT_ERROR(( "load_format_20:"
+ " exceeding string length (%d),"
+ " truncating at end of post table (%d byte left)\n",
+ len, d ));
+ len = (FT_UInt)FT_MAX( 0, d );
}
+ if ( FT_NEW_ARRAY( name_strings[n], len + 1 ) ||
+ FT_STREAM_READ( name_strings[n], len ) )
+ goto Fail1;
+
+ name_strings[n][len] = '\0';
+ }
+
+ if ( n < num_names )
+ {
FT_ERROR(( "load_format_20:"
" all entries in post table are already parsed,"
" using NULL names for gid %d - %d\n",
n, num_names - 1 ));
for ( ; n < num_names; n++ )
- name_strings[n] = (FT_Char*)strings + post_len;
+ if ( FT_NEW_ARRAY( name_strings[n], 1 ) )
+ goto Fail1;
+ else
+ name_strings[n][0] = '\0';
}
}
@@ -290,9 +292,17 @@
}
return FT_Err_Ok;
+ Fail1:
+ {
+ FT_UShort n;
+
+
+ for ( n = 0; n < num_names; n++ )
+ FT_FREE( name_strings[n] );
+ }
+
Fail:
FT_FREE( name_strings );
- FT_FREE( strings );
FT_FREE( glyph_indices );
Exit:
@@ -303,7 +313,7 @@
static FT_Error
load_format_25( TT_Face face,
FT_Stream stream,
- FT_ULong post_len )
+ FT_ULong post_limit )
{
FT_Memory memory = stream->memory;
FT_Error error;
@@ -311,7 +321,7 @@
FT_Int num_glyphs;
FT_Char* offset_table = NULL;
- FT_UNUSED( post_len );
+ FT_UNUSED( post_limit );
if ( FT_READ_USHORT( num_glyphs ) )
@@ -326,7 +336,7 @@
goto Exit;
}
- if ( FT_QNEW_ARRAY( offset_table, num_glyphs ) ||
+ if ( FT_NEW_ARRAY( offset_table, num_glyphs ) ||
FT_STREAM_READ( offset_table, num_glyphs ) )
goto Fail;
@@ -374,6 +384,7 @@
FT_Error error;
FT_Fixed format;
FT_ULong post_len;
+ FT_ULong post_limit;
/* get a stream for the face's resource */
@@ -384,6 +395,8 @@
if ( error )
goto Exit;
+ post_limit = FT_STREAM_POS() + post_len;
+
format = face->postscript.FormatType;
/* go to beginning of subtable */
@@ -391,10 +404,10 @@
goto Exit;
/* now read postscript table */
- if ( format == 0x00020000L && post_len >= 34 )
- error = load_format_20( face, stream, post_len - 32 );
- else if ( format == 0x00025000L && post_len >= 34 )
- error = load_format_25( face, stream, post_len - 32 );
+ if ( format == 0x00020000L )
+ error = load_format_20( face, stream, post_limit );
+ else if ( format == 0x00025000L )
+ error = load_format_25( face, stream, post_limit );
else
error = FT_THROW( Invalid_File_Format );
@@ -420,19 +433,17 @@
if ( format == 0x00020000L )
{
TT_Post_20 table = &names->names.format_20;
+ FT_UShort n;
FT_FREE( table->glyph_indices );
table->num_glyphs = 0;
- if ( table->num_names )
- {
- table->glyph_names[0]--;
- FT_FREE( table->glyph_names[0] );
+ for ( n = 0; n < table->num_names; n++ )
+ FT_FREE( table->glyph_names[n] );
- FT_FREE( table->glyph_names );
- table->num_names = 0;
- }
+ FT_FREE( table->glyph_names );
+ table->num_names = 0;
}
else if ( format == 0x00025000L )
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h
index 6d65b5766c2..94c7d168008 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h
@@ -5,7 +5,7 @@
* PostScript name table processing for TrueType and OpenType fonts
* (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c
index e9ba697dba0..9dd44197106 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
*
* TrueType and OpenType embedded bitmap support (body).
*
- * Copyright (C) 2005-2021 by
+ * Copyright (C) 2005-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Copyright 2013 by Google, Inc.
@@ -172,17 +172,13 @@
goto Exit;
}
-#ifdef FT_DEBUG_LEVEL_TRACE
/* we currently don't support bit 1; however, it is better to */
/* draw at least something... */
if ( flags == 3 )
- {
FT_TRACE1(( "tt_face_load_sbit_strikes:"
- " sbix overlay not supported yet\n" ));
- FT_TRACE1(( " "
+ " sbix overlay not supported yet\n"
+ " "
" expect bad rendering results\n" ));
- }
-#endif
/*
* Count the number of strikes available in the table. We are a bit
@@ -244,8 +240,8 @@
if ( !face->ebdt_size )
{
FT_TRACE2(( "tt_face_load_sbit_strikes:"
- " no embedded bitmap data table found;\n" ));
- FT_TRACE2(( " "
+ " no embedded bitmap data table found;\n"
+ " "
" resetting number of strikes to zero\n" ));
face->sbit_num_strikes = 0;
}
@@ -349,8 +345,8 @@
if ( metrics->ascender == 0 )
{
FT_TRACE2(( "tt_face_load_strike_metrics:"
- " sanitizing invalid ascender and descender\n" ));
- FT_TRACE2(( " "
+ " sanitizing invalid ascender and descender\n"
+ " "
" values for strike %ld (%dppem, %dppem)\n",
strike_index,
metrics->x_ppem, metrics->y_ppem ));
@@ -378,8 +374,8 @@
if ( metrics->height == 0 )
{
FT_TRACE2(( "tt_face_load_strike_metrics:"
- " sanitizing invalid height value\n" ));
- FT_TRACE2(( " "
+ " sanitizing invalid height value\n"
+ " "
" for strike (%d, %d)\n",
metrics->x_ppem, metrics->y_ppem ));
metrics->height = metrics->y_ppem * 64;
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h
index 7a0ed92e920..b867e43a61a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
*
* TrueType and OpenType embedded bitmap support (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c
index 84748268c1a..fd9f2e6c5d4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c
@@ -4,7 +4,7 @@
*
* WOFF2 Font table tags (base).
*
- * Copyright (C) 2019-2021 by
+ * Copyright (C) 2019-2020 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h
index 543daf89111..c437c77aa1f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h
@@ -4,7 +4,7 @@
*
* WOFFF2 Font table tags (specification).
*
- * Copyright (C) 2019-2021 by
+ * Copyright (C) 2019-2020 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c b/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c
index 86118fb36ff..681900fd400 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c
@@ -4,7 +4,7 @@
*
* A new `perfect' anti-aliasing renderer (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -168,11 +168,10 @@
typedef ptrdiff_t FT_PtrDist;
-#define Smooth_Err_Ok 0
-#define Smooth_Err_Invalid_Outline -1
-#define Smooth_Err_Cannot_Render_Glyph -2
-#define Smooth_Err_Invalid_Argument -3
-#define Smooth_Err_Raster_Overflow -4
+#define ErrRaster_Invalid_Mode -2
+#define ErrRaster_Invalid_Outline -1
+#define ErrRaster_Invalid_Argument -3
+#define ErrRaster_Memory_Overflow -4
#define FT_BEGIN_HEADER
#define FT_END_HEADER
@@ -230,18 +229,18 @@ typedef ptrdiff_t FT_PtrDist;
#define FT_ERROR( varformat ) FT_Message varformat
#endif
-#define FT_THROW( e ) \
- ( FT_Throw( FT_ERR_CAT( Smooth_Err_, e ), \
- __LINE__, \
- __FILE__ ) | \
- FT_ERR_CAT( Smooth_Err_, e ) )
+#define FT_THROW( e ) \
+ ( FT_Throw( FT_ERR_CAT( ErrRaster_, e ), \
+ __LINE__, \
+ __FILE__ ) | \
+ FT_ERR_CAT( ErrRaster_, e ) )
#else /* !FT_DEBUG_LEVEL_TRACE */
#define FT_TRACE5( x ) do { } while ( 0 ) /* nothing */
#define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
-#define FT_THROW( e ) FT_ERR_CAT( Smooth_Err_, e )
+#define FT_THROW( e ) FT_ERR_CAT( ErrRaster_, e )
#endif /* !FT_DEBUG_LEVEL_TRACE */
@@ -287,6 +286,10 @@ typedef ptrdiff_t FT_PtrDist;
#include "ftsmerrs.h"
+#define Smooth_Err_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
+#define Smooth_Err_Memory_Overflow Smooth_Err_Out_Of_Memory
+#define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
+
#endif /* !STANDALONE_ */
@@ -389,41 +392,6 @@ typedef ptrdiff_t FT_PtrDist;
( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) )
- /* Scale area and apply fill rule to calculate the coverage byte. */
- /* The top fill bit is used for the non-zero rule. The eighth */
- /* fill bit is used for the even-odd rule. The higher coverage */
- /* bytes are either clamped for the non-zero-rule or discarded */
- /* later for the even-odd rule. */
-#define FT_FILL_RULE( coverage, area, fill ) \
- FT_BEGIN_STMNT \
- coverage = (int)( area >> ( PIXEL_BITS * 2 + 1 - 8 ) ); \
- if ( coverage & fill ) \
- coverage = ~coverage; \
- if ( coverage > 255 && fill & INT_MIN ) \
- coverage = 255; \
- FT_END_STMNT
-
-
- /* It is faster to write small spans byte-by-byte than calling */
- /* `memset'. This is mainly due to the cost of the function call. */
-#define FT_GRAY_SET( d, s, count ) \
- FT_BEGIN_STMNT \
- unsigned char* q = d; \
- switch ( count ) \
- { \
- case 7: *q++ = (unsigned char)s; /* fall through */ \
- case 6: *q++ = (unsigned char)s; /* fall through */ \
- case 5: *q++ = (unsigned char)s; /* fall through */ \
- case 4: *q++ = (unsigned char)s; /* fall through */ \
- case 3: *q++ = (unsigned char)s; /* fall through */ \
- case 2: *q++ = (unsigned char)s; /* fall through */ \
- case 1: *q = (unsigned char)s; /* fall through */ \
- case 0: break; \
- default: FT_MEM_SET( d, s, count ); \
- } \
- FT_END_STMNT
-
-
/**************************************************************************
*
* TYPE DEFINITIONS
@@ -464,7 +432,7 @@ typedef ptrdiff_t FT_PtrDist;
#endif
/* FT_Span buffer size for direct rendering only */
-#define FT_MAX_GRAY_SPANS 16
+#define FT_MAX_GRAY_SPANS 10
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
@@ -479,27 +447,28 @@ typedef ptrdiff_t FT_PtrDist;
{
ft_jmp_buf jump_buffer;
- TCoord min_ex, max_ex; /* min and max integer pixel coordinates */
+ TCoord ex, ey;
+ TCoord min_ex, max_ex;
TCoord min_ey, max_ey;
- TCoord count_ey; /* same as (max_ey - min_ey) */
-
- PCell cell; /* current cell */
- PCell cell_free; /* call allocation next free slot */
- PCell cell_limit; /* cell allocation limit */
- PCell* ycells; /* array of cell linked-lists; one per */
- /* vertical coordinate in the current band */
+ TArea area;
+ TCoord cover;
+ int invalid;
- PCell cells; /* cell storage area */
- FT_PtrDist max_cells; /* cell storage capacity */
+ PCell* ycells;
+ PCell cells;
+ FT_PtrDist max_cells;
+ FT_PtrDist num_cells;
- TPos x, y; /* last point position */
+ TPos x, y;
- FT_Outline outline; /* input outline */
- TPixmap target; /* target pixmap */
+ FT_Outline outline;
+ TPixmap target;
FT_Raster_Span_Func render_span;
void* render_span_data;
+ FT_Span spans[FT_MAX_GRAY_SPANS];
+ int num_spans;
} gray_TWorker, *gray_PWorker;
@@ -507,36 +476,17 @@ typedef ptrdiff_t FT_PtrDist;
#pragma warning( pop )
#endif
+
#ifndef FT_STATIC_RASTER
#define ras (*worker)
#else
static gray_TWorker ras;
#endif
- /*
- * Return a pointer to the 'null cell', used as a sentinel at the end of
- * all `ycells` linked lists. Its x coordinate should be maximal to
- * ensure no NULL checks are necessary when looking for an insertion point
- * in `gray_set_cell`. Other loops should check the cell pointer with
- * CELL_IS_NULL() to detect the end of the list.
- */
-#define NULL_CELL_PTR( ras ) (ras).cells
-
- /* The |x| value of the null cell. Must be the largest possible */
- /* integer value stored in a `TCell.x` field. */
-#define CELL_MAX_X_VALUE INT_MAX
-
- /* Return true iff |cell| points to the null cell. */
-#define CELL_IS_NULL( cell ) ( (cell)->x == CELL_MAX_X_VALUE )
-
-
-#define FT_INTEGRATE( ras, a, b ) \
- ras.cell->cover += (a), ras.cell->area += (a) * (TArea)(b)
-
typedef struct gray_TRaster_
{
- void* memory;
+ void* memory;
} gray_TRaster, *gray_PRaster;
@@ -558,7 +508,7 @@ typedef ptrdiff_t FT_PtrDist;
printf( "%3d:", y );
- for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
+ for ( ; cell != NULL; cell = cell->next )
printf( " (%3d, c:%4d, a:%6d)",
cell->x, cell->cover, cell->area );
printf( "\n" );
@@ -570,63 +520,77 @@ typedef ptrdiff_t FT_PtrDist;
/**************************************************************************
*
- * Set the current cell to a new position.
+ * Record the current cell in the linked list.
*/
static void
- gray_set_cell( RAS_ARG_ TCoord ex,
- TCoord ey )
+ gray_record_cell( RAS_ARG )
{
- /* Move the cell pointer to a new position in the linked list. We use */
- /* NULL to indicate that the cell is outside of the clipping region */
- /* during the render phase. This means that: */
- /* */
- /* . the new vertical position must be within min_ey..max_ey-1. */
- /* . the new horizontal position must be strictly less than max_ex */
- /* */
- /* Note that if a cell is to the left of the clipping region, it is */
- /* actually set to the (min_ex-1) horizontal position. */
-
- TCoord ey_index = ey - ras.min_ey;
+ PCell *pcell, cell;
+ TCoord x = ras.ex;
- if ( ey_index < 0 || ey_index >= ras.count_ey || ex >= ras.max_ex )
- ras.cell = NULL_CELL_PTR( ras );
- else
+ pcell = &ras.ycells[ras.ey - ras.min_ey];
+ while ( ( cell = *pcell ) )
{
- PCell* pcell = ras.ycells + ey_index;
- PCell cell;
+ if ( cell->x > x )
+ break;
+ if ( cell->x == x )
+ goto Found;
- ex = FT_MAX( ex, ras.min_ex - 1 );
+ pcell = &cell->next;
+ }
- while ( 1 )
- {
- cell = *pcell;
+ if ( ras.num_cells >= ras.max_cells )
+ ft_longjmp( ras.jump_buffer, 1 );
- if ( cell->x > ex )
- break;
+ /* insert new cell */
+ cell = ras.cells + ras.num_cells++;
+ cell->x = x;
+ cell->area = ras.area;
+ cell->cover = ras.cover;
- if ( cell->x == ex )
- goto Found;
+ cell->next = *pcell;
+ *pcell = cell;
- pcell = &cell->next;
- }
+ return;
- /* insert new cell */
- cell = ras.cell_free++;
- if ( cell >= ras.cell_limit )
- ft_longjmp( ras.jump_buffer, 1 );
+ Found:
+ /* update old cell */
+ cell->area += ras.area;
+ cell->cover += ras.cover;
+ }
- cell->x = ex;
- cell->area = 0;
- cell->cover = 0;
- cell->next = *pcell;
- *pcell = cell;
+ /**************************************************************************
+ *
+ * Set the current cell to a new position.
+ */
+ static void
+ gray_set_cell( RAS_ARG_ TCoord ex,
+ TCoord ey )
+ {
+ /* Move the cell pointer to a new position. We set the `invalid' */
+ /* flag to indicate that the cell isn't part of those we're interested */
+ /* in during the render phase. This means that: */
+ /* */
+ /* . the new vertical position must be within min_ey..max_ey-1. */
+ /* . the new horizontal position must be strictly less than max_ex */
+ /* */
+ /* Note that if a cell is to the left of the clipping region, it is */
+ /* actually set to the (min_ex-1) horizontal position. */
- Found:
- ras.cell = cell;
- }
+ /* 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;
+ ras.cover = 0;
+ ras.ex = FT_MAX( ex, ras.min_ex - 1 );
+ ras.ey = ey;
+
+ ras.invalid = ( ey >= ras.max_ey || ey < ras.min_ey ||
+ ex >= ras.max_ex );
}
@@ -691,9 +655,10 @@ typedef ptrdiff_t FT_PtrDist;
/* XXX: y-delta and x-delta below should be related. */
FT_DIV_MOD( TCoord, p, dx, delta, mod );
- FT_INTEGRATE( ras, delta, fx1 + first );
- y1 += delta;
- ex1 += incr;
+ ras.area += (TArea)( ( fx1 + first ) * delta );
+ ras.cover += delta;
+ y1 += delta;
+ ex1 += incr;
gray_set_cell( RAS_VAR_ ex1, ey );
if ( ex1 != ex2 )
@@ -714,9 +679,10 @@ typedef ptrdiff_t FT_PtrDist;
delta++;
}
- FT_INTEGRATE( ras, delta, ONE_PIXEL );
- y1 += delta;
- ex1 += incr;
+ ras.area += (TArea)( ONE_PIXEL * delta );
+ ras.cover += delta;
+ y1 += delta;
+ ex1 += incr;
gray_set_cell( RAS_VAR_ ex1, ey );
} while ( ex1 != ex2 );
}
@@ -724,7 +690,10 @@ typedef ptrdiff_t FT_PtrDist;
fx1 = ONE_PIXEL - first;
End:
- FT_INTEGRATE( ras, y2 - y1, fx1 + fx2 );
+ dy = y2 - y1;
+
+ ras.area += (TArea)( ( fx1 + fx2 ) * dy );
+ ras.cover += dy;
}
@@ -767,6 +736,7 @@ typedef ptrdiff_t FT_PtrDist;
{
TCoord ex = TRUNC( ras.x );
TCoord two_fx = FRACT( ras.x ) << 1;
+ TArea area;
if ( dy > 0)
@@ -780,23 +750,27 @@ typedef ptrdiff_t FT_PtrDist;
incr = -1;
}
- delta = first - fy1;
- FT_INTEGRATE( ras, delta, two_fx);
- ey1 += incr;
+ delta = first - fy1;
+ ras.area += (TArea)two_fx * delta;
+ ras.cover += delta;
+ ey1 += incr;
gray_set_cell( RAS_VAR_ ex, ey1 );
delta = first + first - ONE_PIXEL;
+ area = (TArea)two_fx * delta;
while ( ey1 != ey2 )
{
- FT_INTEGRATE( ras, delta, two_fx);
- ey1 += incr;
+ ras.area += area;
+ ras.cover += delta;
+ ey1 += incr;
gray_set_cell( RAS_VAR_ ex, ey1 );
}
- delta = fy2 - ONE_PIXEL + first;
- FT_INTEGRATE( ras, delta, two_fx);
+ delta = fy2 - ONE_PIXEL + first;
+ ras.area += (TArea)two_fx * delta;
+ ras.cover += delta;
goto End;
}
@@ -909,7 +883,8 @@ typedef ptrdiff_t FT_PtrDist;
do
{
fy2 = ONE_PIXEL;
- FT_INTEGRATE( ras, fy2 - fy1, fx1 * 2 );
+ ras.cover += ( fy2 - fy1 );
+ ras.area += ( fy2 - fy1 ) * fx1 * 2;
fy1 = 0;
ey1++;
gray_set_cell( RAS_VAR_ ex1, ey1 );
@@ -918,7 +893,8 @@ typedef ptrdiff_t FT_PtrDist;
do
{
fy2 = 0;
- FT_INTEGRATE( ras, fy2 - fy1, fx1 * 2 );
+ ras.cover += ( fy2 - fy1 );
+ ras.area += ( fy2 - fy1 ) * fx1 * 2;
fy1 = ONE_PIXEL;
ey1--;
gray_set_cell( RAS_VAR_ ex1, ey1 );
@@ -936,297 +912,72 @@ typedef ptrdiff_t FT_PtrDist;
/* also easily updated when moving from one cell to the next. */
do
{
- if ( prod - dx * ONE_PIXEL > 0 &&
- prod <= 0 ) /* left */
+ if ( prod <= 0 &&
+ prod - dx * ONE_PIXEL > 0 ) /* left */
{
fx2 = 0;
fy2 = FT_UDIV( -prod, -dx );
prod -= dy * ONE_PIXEL;
- FT_INTEGRATE( ras, fy2 - fy1, fx1 + fx2 );
+ ras.cover += ( fy2 - fy1 );
+ ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
fx1 = ONE_PIXEL;
fy1 = fy2;
ex1--;
}
- else if ( prod - dx * ONE_PIXEL + dy * ONE_PIXEL > 0 &&
- prod - dx * ONE_PIXEL <= 0 ) /* up */
+ else if ( prod - dx * ONE_PIXEL <= 0 &&
+ prod - dx * ONE_PIXEL + dy * ONE_PIXEL > 0 ) /* up */
{
prod -= dx * ONE_PIXEL;
fx2 = FT_UDIV( -prod, dy );
fy2 = ONE_PIXEL;
- FT_INTEGRATE( ras, fy2 - fy1, fx1 + fx2 );
+ ras.cover += ( fy2 - fy1 );
+ ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
fx1 = fx2;
fy1 = 0;
ey1++;
}
- else if ( prod + dy * ONE_PIXEL >= 0 &&
- prod - dx * ONE_PIXEL + dy * ONE_PIXEL <= 0 ) /* right */
+ else if ( prod - dx * ONE_PIXEL + dy * ONE_PIXEL <= 0 &&
+ prod + dy * ONE_PIXEL >= 0 ) /* right */
{
prod += dy * ONE_PIXEL;
fx2 = ONE_PIXEL;
fy2 = FT_UDIV( prod, dx );
- FT_INTEGRATE( ras, fy2 - fy1, fx1 + fx2 );
+ ras.cover += ( fy2 - fy1 );
+ ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
fx1 = 0;
fy1 = fy2;
ex1++;
}
- else /* ( prod > 0 &&
- prod + dy * ONE_PIXEL < 0 ) down */
+ else /* ( prod + dy * ONE_PIXEL < 0 &&
+ prod > 0 ) down */
{
fx2 = FT_UDIV( prod, -dy );
fy2 = 0;
prod += dx * ONE_PIXEL;
- FT_INTEGRATE( ras, fy2 - fy1, fx1 + fx2 );
+ ras.cover += ( fy2 - fy1 );
+ ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
fx1 = fx2;
fy1 = ONE_PIXEL;
ey1--;
}
gray_set_cell( RAS_VAR_ ex1, ey1 );
-
} while ( ex1 != ex2 || ey1 != ey2 );
}
fx2 = FRACT( to_x );
fy2 = FRACT( to_y );
- FT_INTEGRATE( ras, fy2 - fy1, fx1 + fx2 );
+ ras.cover += ( fy2 - fy1 );
+ ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
End:
- ras.x = to_x;
- ras.y = to_y;
+ ras.x = to_x;
+ ras.y = to_y;
}
#endif
- /*
- * Benchmarking shows that using DDA to flatten the quadratic Bézier arcs
- * is slightly faster in the following cases:
- *
- * - When the host CPU is 64-bit.
- * - When SSE2 SIMD registers and instructions are available (even on
- * x86).
- *
- * For other cases, using binary splits is actually slightly faster.
- */
-#if defined( __SSE2__ ) || \
- defined( __x86_64__ ) || \
- defined( __aarch64__ ) || \
- defined( _M_AMD64 ) || \
- defined( _M_ARM64 )
-# define BEZIER_USE_DDA 1
-#else
-# define BEZIER_USE_DDA 0
-#endif
-
- /*
- * For now, the code that depends on `BEZIER_USE_DDA` requires `FT_Int64`
- * to be defined. If `FT_LONG64` is not defined, meaning there is no
- * 64-bit type available, disable it to avoid compilation errors. See for
- * example https://gitlab.freedesktop.org/freetype/freetype/-/issues/1071.
- */
-#if !defined( FT_LONG64 )
-# undef BEZIER_USE_DDA
-# define BEZIER_USE_DDA 0
-#endif
-
-#if BEZIER_USE_DDA
-
-#ifdef __SSE2__
-# include <emmintrin.h>
-#endif
-
- static void
- gray_render_conic( RAS_ARG_ const FT_Vector* control,
- const FT_Vector* to )
- {
- FT_Vector p0, p1, p2;
- TPos dx, dy;
- int shift;
-
- FT_Int64 ax, ay, bx, by;
- FT_Int64 rx, ry;
- FT_Int64 qx, qy;
- FT_Int64 px, py;
-
- FT_UInt count;
-
-
- p0.x = ras.x;
- p0.y = ras.y;
- p1.x = UPSCALE( control->x );
- p1.y = UPSCALE( control->y );
- p2.x = UPSCALE( to->x );
- p2.y = UPSCALE( to->y );
-
- /* short-cut the arc that crosses the current band */
- if ( ( TRUNC( p0.y ) >= ras.max_ey &&
- TRUNC( p1.y ) >= ras.max_ey &&
- TRUNC( p2.y ) >= ras.max_ey ) ||
- ( TRUNC( p0.y ) < ras.min_ey &&
- TRUNC( p1.y ) < ras.min_ey &&
- TRUNC( p2.y ) < ras.min_ey ) )
- {
- ras.x = p2.x;
- ras.y = p2.y;
- return;
- }
-
- dx = FT_ABS( p0.x + p2.x - 2 * p1.x );
- dy = FT_ABS( p0.y + p2.y - 2 * p1.y );
- if ( dx < dy )
- dx = dy;
-
- if ( dx <= ONE_PIXEL / 4 )
- {
- gray_render_line( RAS_VAR_ p2.x, p2.y );
- return;
- }
-
- /* We can calculate the number of necessary bisections because */
- /* each bisection predictably reduces deviation exactly 4-fold. */
- /* Even 32-bit deviation would vanish after 16 bisections. */
- shift = 0;
- do
- {
- dx >>= 2;
- shift += 1;
-
- } while ( dx > ONE_PIXEL / 4 );
-
- /*
- * The (P0,P1,P2) arc equation, for t in [0,1] range:
- *
- * P(t) = P0*(1-t)^2 + P1*2*t*(1-t) + P2*t^2
- *
- * P(t) = P0 + 2*(P1-P0)*t + (P0+P2-2*P1)*t^2
- * = P0 + 2*B*t + A*t^2
- *
- * for A = P0 + P2 - 2*P1
- * and B = P1 - P0
- *
- * Let's consider the difference when advancing by a small
- * parameter h:
- *
- * Q(h,t) = P(t+h) - P(t) = 2*B*h + A*h^2 + 2*A*h*t
- *
- * And then its own difference:
- *
- * R(h,t) = Q(h,t+h) - Q(h,t) = 2*A*h*h = R (constant)
- *
- * Since R is always a constant, it is possible to compute
- * successive positions with:
- *
- * P = P0
- * Q = Q(h,0) = 2*B*h + A*h*h
- * R = 2*A*h*h
- *
- * loop:
- * P += Q
- * Q += R
- * EMIT(P)
- *
- * To ensure accurate results, perform computations on 64-bit
- * values, after scaling them by 2^32:
- *
- * R << 32 = 2 * A << (32 - N - N)
- * = A << (33 - 2 *N)
- *
- * Q << 32 = (2 * B << (32 - N)) + (A << (32 - N - N))
- * = (B << (33 - N)) + (A << (32 - N - N))
- */
-
-#ifdef __SSE2__
- /* Experience shows that for small shift values, */
- /* SSE2 is actually slower. */
- if ( shift > 2 )
- {
- union
- {
- struct { FT_Int64 ax, ay, bx, by; } i;
- struct { __m128i a, b; } vec;
-
- } u;
-
- union
- {
- struct { FT_Int32 px_lo, px_hi, py_lo, py_hi; } i;
- __m128i vec;
-
- } v;
-
- __m128i a, b;
- __m128i r, q, q2;
- __m128i p;
-
-
- u.i.ax = p0.x + p2.x - 2 * p1.x;
- u.i.ay = p0.y + p2.y - 2 * p1.y;
- u.i.bx = p1.x - p0.x;
- u.i.by = p1.y - p0.y;
-
- a = _mm_load_si128( &u.vec.a );
- b = _mm_load_si128( &u.vec.b );
-
- r = _mm_slli_epi64( a, 33 - 2 * shift );
- q = _mm_slli_epi64( b, 33 - shift );
- q2 = _mm_slli_epi64( a, 32 - 2 * shift );
-
- q = _mm_add_epi64( q2, q );
-
- v.i.px_lo = 0;
- v.i.px_hi = p0.x;
- v.i.py_lo = 0;
- v.i.py_hi = p0.y;
-
- p = _mm_load_si128( &v.vec );
-
- for ( count = ( 1U << shift ); count > 0; count-- )
- {
- p = _mm_add_epi64( p, q );
- q = _mm_add_epi64( q, r );
-
- _mm_store_si128( &v.vec, p );
-
- gray_render_line( RAS_VAR_ v.i.px_hi, v.i.py_hi );
- }
-
- return;
- }
-#endif /* __SSE2__ */
-
- ax = p0.x + p2.x - 2 * p1.x;
- ay = p0.y + p2.y - 2 * p1.y;
- bx = p1.x - p0.x;
- by = p1.y - p0.y;
-
- rx = ax << ( 33 - 2 * shift );
- ry = ay << ( 33 - 2 * shift );
-
- qx = ( bx << ( 33 - shift ) ) + ( ax << ( 32 - 2 * shift ) );
- qy = ( by << ( 33 - shift ) ) + ( ay << ( 32 - 2 * shift ) );
-
- px = (FT_Int64)p0.x << 32;
- py = (FT_Int64)p0.y << 32;
-
- for ( count = 1U << shift; count > 0; count-- )
- {
- px += qx;
- py += qy;
- qx += rx;
- qy += ry;
-
- gray_render_line( RAS_VAR_ (FT_Pos)( px >> 32 ),
- (FT_Pos)( py >> 32 ) );
- }
- }
-
-#else /* !BEZIER_USE_DDA */
-
- /*
- * Note that multiple attempts to speed up the function below
- * with SSE2 intrinsics, using various data layouts, have turned
- * out to be slower than the non-SIMD code below.
- */
static void
gray_split_conic( FT_Vector* base )
{
@@ -1312,17 +1063,7 @@ typedef ptrdiff_t FT_PtrDist;
} while ( --draw );
}
-#endif /* !BEZIER_USE_DDA */
-
- /*
- * For cubic Bézier, binary splits are still faster than DDA
- * because the splits are adaptive to how quickly each sub-arc
- * approaches their chord trisection points.
- *
- * It might be useful to experiment with SSE2 to speed up
- * `gray_split_cubic`, though.
- */
static void
gray_split_cubic( FT_Vector* base )
{
@@ -1464,62 +1205,94 @@ typedef ptrdiff_t FT_PtrDist;
static void
- gray_sweep( RAS_ARG )
+ gray_hline( RAS_ARG_ TCoord x,
+ TCoord y,
+ TArea coverage,
+ TCoord acount )
{
- int fill = ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ? 0x100 : INT_MIN;
- int coverage;
- int y;
+ /* scale the coverage from 0..(ONE_PIXEL*ONE_PIXEL*2) to 0..256 */
+ coverage >>= PIXEL_BITS * 2 + 1 - 8;
-
- for ( y = ras.min_ey; y < ras.max_ey; y++ )
+ /* compute the line's coverage depending on the outline fill rule */
+ if ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL )
{
- PCell cell = ras.ycells[y - ras.min_ey];
- TCoord x = ras.min_ex;
- TArea cover = 0;
- TArea area;
+ coverage &= 511;
- unsigned char* line = ras.target.origin - ras.target.pitch * y;
+ if ( coverage >= 256 )
+ coverage = 511 - coverage;
+ }
+ else /* default non-zero winding rule */
+ {
+ if ( coverage < 0 )
+ coverage = ~coverage; /* the same as -coverage - 1 */
+ if ( coverage >= 256 )
+ coverage = 255;
+ }
- for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
- {
- if ( cover != 0 && cell->x > x )
- {
- FT_FILL_RULE( coverage, cover, fill );
- FT_GRAY_SET( line + x, coverage, cell->x - x );
- }
+ if ( ras.num_spans >= 0 ) /* for FT_RASTER_FLAG_DIRECT only */
+ {
+ FT_Span* span = ras.spans + ras.num_spans++;
- cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
- area = cover - cell->area;
- if ( area != 0 && cell->x >= ras.min_ex )
- {
- FT_FILL_RULE( coverage, area, fill );
- line[cell->x] = (unsigned char)coverage;
- }
+ span->x = (short)x;
+ span->len = (unsigned short)acount;
+ span->coverage = (unsigned char)coverage;
- x = cell->x + 1;
+ if ( ras.num_spans == FT_MAX_GRAY_SPANS )
+ {
+ /* flush the span buffer and reset the count */
+ ras.render_span( y, ras.num_spans, ras.spans, ras.render_span_data );
+ ras.num_spans = 0;
}
+ }
+ else
+ {
+ unsigned char* q = ras.target.origin - ras.target.pitch * y + x;
+ unsigned char c = (unsigned char)coverage;
- if ( cover != 0 ) /* only if cropped */
+
+ /* For small-spans it is faster to do it by ourselves than
+ * calling `memset'. This is mainly due to the cost of the
+ * function call.
+ */
+ switch ( acount )
{
- FT_FILL_RULE( coverage, cover, fill );
- FT_GRAY_SET( line + x, coverage, ras.max_ex - x );
+ case 7:
+ *q++ = c;
+ /* fall through */
+ case 6:
+ *q++ = c;
+ /* fall through */
+ case 5:
+ *q++ = c;
+ /* fall through */
+ case 4:
+ *q++ = c;
+ /* fall through */
+ case 3:
+ *q++ = c;
+ /* fall through */
+ case 2:
+ *q++ = c;
+ /* fall through */
+ case 1:
+ *q = c;
+ /* fall through */
+ case 0:
+ break;
+ default:
+ FT_MEM_SET( q, c, acount );
}
}
}
static void
- gray_sweep_direct( RAS_ARG )
+ gray_sweep( RAS_ARG )
{
- int fill = ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ? 0x100 : INT_MIN;
- int coverage;
int y;
- FT_Span span[FT_MAX_GRAY_SPANS];
- int n = 0;
-
for ( y = ras.min_ey; y < ras.max_ey; y++ )
{
@@ -1529,62 +1302,28 @@ typedef ptrdiff_t FT_PtrDist;
TArea area;
- for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
+ for ( ; cell != NULL; cell = cell->next )
{
if ( cover != 0 && cell->x > x )
- {
- FT_FILL_RULE( coverage, cover, fill );
-
- span[n].coverage = (unsigned char)coverage;
- span[n].x = (short)x;
- span[n].len = (unsigned short)( cell->x - x );
-
- if ( ++n == FT_MAX_GRAY_SPANS )
- {
- /* flush the span buffer and reset the count */
- ras.render_span( y, n, span, ras.render_span_data );
- n = 0;
- }
- }
+ gray_hline( RAS_VAR_ x, y, cover, cell->x - x );
cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
area = cover - cell->area;
if ( area != 0 && cell->x >= ras.min_ex )
- {
- FT_FILL_RULE( coverage, area, fill );
-
- span[n].coverage = (unsigned char)coverage;
- span[n].x = (short)cell->x;
- span[n].len = 1;
-
- if ( ++n == FT_MAX_GRAY_SPANS )
- {
- /* flush the span buffer and reset the count */
- ras.render_span( y, n, span, ras.render_span_data );
- n = 0;
- }
- }
+ gray_hline( RAS_VAR_ cell->x, y, area, 1 );
x = cell->x + 1;
}
- if ( cover != 0 ) /* only if cropped */
- {
- FT_FILL_RULE( coverage, cover, fill );
-
- span[n].coverage = (unsigned char)coverage;
- span[n].x = (short)x;
- span[n].len = (unsigned short)( ras.max_ex - x );
+ if ( cover != 0 )
+ gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x );
- ++n;
- }
-
- if ( n )
+ if ( ras.num_spans > 0 ) /* for FT_RASTER_FLAG_DIRECT only */
{
/* flush the span buffer and reset the count */
- ras.render_span( y, n, span, ras.render_span_data );
- n = 0;
+ ras.render_span( y, ras.num_spans, ras.spans, ras.render_span_data );
+ ras.num_spans = 0;
}
}
}
@@ -1865,7 +1604,7 @@ typedef ptrdiff_t FT_PtrDist;
}
FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
- return Smooth_Err_Ok;
+ return 0;
Exit:
FT_TRACE5(( "FT_Outline_Decompose: Error 0x%x\n", error ));
@@ -1906,15 +1645,18 @@ typedef ptrdiff_t FT_PtrDist;
if ( continued )
FT_Trace_Enable();
+ if ( !ras.invalid )
+ gray_record_cell( RAS_VAR );
+
FT_TRACE7(( "band [%d..%d]: %ld cell%s\n",
ras.min_ey,
ras.max_ey,
- ras.cell_free - ras.cells,
- ras.cell_free - ras.cells == 1 ? "" : "s" ));
+ ras.num_cells,
+ ras.num_cells == 1 ? "" : "s" ));
}
else
{
- error = FT_THROW( Raster_Overflow );
+ error = FT_THROW( Memory_Overflow );
FT_TRACE7(( "band [%d..%d]: to be bisected\n",
ras.min_ey, ras.max_ey ));
@@ -1951,19 +1693,9 @@ typedef ptrdiff_t FT_PtrDist;
/* memory management */
n = ( height * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / sizeof ( TCell );
- ras.cells = buffer + n;
- ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - n );
- ras.cell_limit = ras.cells + ras.max_cells;
- ras.ycells = (PCell*)buffer;
-
- /* Initialize the null cell at the start of the `cells` array. */
- /* Note that this requires `ras.cell_free` initialization to skip */
- /* over the first entry in the array. */
- PCell null_cell = NULL_CELL_PTR( ras );
- null_cell->x = CELL_MAX_X_VALUE;
- null_cell->area = 0;
- null_cell->cover = 0;
- null_cell->next = NULL;;
+ ras.cells = buffer + n;
+ ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - n );
+ ras.ycells = (PCell*)buffer;
for ( y = yMin; y < yMax; )
{
@@ -1978,33 +1710,27 @@ typedef ptrdiff_t FT_PtrDist;
do
{
TCoord width = band[0] - band[1];
- TCoord w;
int error;
- for ( w = 0; w < width; ++w )
- ras.ycells[w] = null_cell;
+ FT_MEM_ZERO( ras.ycells, height * sizeof ( PCell ) );
- ras.cell_free = ras.cells + 1; /* NOTE: Skip over the null cell. */
- ras.cell = null_cell;
+ ras.num_cells = 0;
+ ras.invalid = 1;
ras.min_ey = band[1];
ras.max_ey = band[0];
- ras.count_ey = width;
error = gray_convert_glyph_inner( RAS_VAR, continued );
continued = 1;
if ( !error )
{
- if ( ras.render_span ) /* for FT_RASTER_FLAG_DIRECT only */
- gray_sweep_direct( RAS_VAR );
- else
- gray_sweep( RAS_VAR );
+ gray_sweep( RAS_VAR );
band--;
continue;
}
- else if ( error != Smooth_Err_Raster_Overflow )
- return error;
+ else if ( error != ErrRaster_Memory_Overflow )
+ return 1;
/* render pool overflow; we will reduce the render band by half */
width >>= 1;
@@ -2013,7 +1739,7 @@ typedef ptrdiff_t FT_PtrDist;
if ( width == 0 )
{
FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
- return FT_THROW( Raster_Overflow );
+ return 1;
}
band++;
@@ -2022,7 +1748,7 @@ typedef ptrdiff_t FT_PtrDist;
} while ( band >= bands );
}
- return Smooth_Err_Ok;
+ return 0;
}
@@ -2043,14 +1769,14 @@ typedef ptrdiff_t FT_PtrDist;
/* this version does not support monochrome rendering */
if ( !( params->flags & FT_RASTER_FLAG_AA ) )
- return FT_THROW( Cannot_Render_Glyph );
+ return FT_THROW( Invalid_Mode );
if ( !outline )
return FT_THROW( Invalid_Outline );
/* return immediately if the outline is empty */
if ( outline->n_points == 0 || outline->n_contours <= 0 )
- return Smooth_Err_Ok;
+ return 0;
if ( !outline->contours || !outline->points )
return FT_THROW( Invalid_Outline );
@@ -2064,10 +1790,11 @@ typedef ptrdiff_t FT_PtrDist;
if ( params->flags & FT_RASTER_FLAG_DIRECT )
{
if ( !params->gray_spans )
- return Smooth_Err_Ok;
+ return 0;
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
ras.render_span_data = params->user;
+ ras.num_spans = 0;
ras.min_ex = params->clip_box.xMin;
ras.min_ey = params->clip_box.yMin;
@@ -2082,7 +1809,7 @@ typedef ptrdiff_t FT_PtrDist;
/* nothing to do */
if ( !target_map->width || !target_map->rows )
- return Smooth_Err_Ok;
+ return 0;
if ( !target_map->buffer )
return FT_THROW( Invalid_Argument );
@@ -2097,6 +1824,7 @@ typedef ptrdiff_t FT_PtrDist;
ras.render_span = (FT_Raster_Span_Func)NULL;
ras.render_span_data = NULL;
+ ras.num_spans = -1; /* invalid */
ras.min_ex = 0;
ras.min_ey = 0;
@@ -2106,7 +1834,7 @@ typedef ptrdiff_t FT_PtrDist;
/* exit if nothing to do */
if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey )
- return Smooth_Err_Ok;
+ return 0;
return gray_convert_glyph( RAS_VAR );
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.h b/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.h
index 3dad0498dc3..caba632833d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.h
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.h
@@ -4,7 +4,7 @@
*
* FreeType smooth renderer declaration
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmerrs.h b/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmerrs.h
index dc2c40cc9f0..e93f3df9b36 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmerrs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmerrs.h
@@ -4,7 +4,7 @@
*
* smooth renderer error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.c b/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.c
index bea3b4a8001..5d66bd6fc42 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.c
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
*
* Anti-aliasing renderer interface (body).
*
- * Copyright (C) 2000-2021 by
+ * Copyright (C) 2000-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.h b/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.h
index 2dd81e84b87..22a88d54ec7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.h
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/ftsmooth.h
@@ -4,7 +4,7 @@
*
* Anti-aliasing renderer interface (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/smooth/module.mk b/Build/source/libs/freetype2/freetype-src/src/smooth/module.mk
index ec6537f1778..9b1507f1e09 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/smooth/rules.mk b/Build/source/libs/freetype2/freetype-src/src/smooth/rules.mk
index de701d91eaf..b08056fac50 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/smooth/smooth.c b/Build/source/libs/freetype2/freetype-src/src/smooth/smooth.c
index 9e254406359..04b531c0870 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/smooth.c
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/smooth.c
@@ -4,7 +4,7 @@
*
* FreeType anti-aliasing rasterer module component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/tools/afblue.pl b/Build/source/libs/freetype2/freetype-src/src/tools/afblue.pl
index 954816276bf..bbc4f472c94 100755
--- a/Build/source/libs/freetype2/freetype-src/src/tools/afblue.pl
+++ b/Build/source/libs/freetype2/freetype-src/src/tools/afblue.pl
@@ -5,7 +5,7 @@
#
# Process a blue zone character data file.
#
-# Copyright (C) 2013-2021 by
+# Copyright (C) 2013-2020 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/tools/chktrcmp.py b/Build/source/libs/freetype2/freetype-src/src/tools/chktrcmp.py
index 244a24a6c3a..4c40bdafdb5 100755
--- a/Build/source/libs/freetype2/freetype-src/src/tools/chktrcmp.py
+++ b/Build/source/libs/freetype2/freetype-src/src/tools/chktrcmp.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# Check trace components in FreeType 2 source.
-# Author: suzuki toshiya, 2009, 2013, 2020
+# Author: suzuki toshiya, 2009, 2013
#
# This code is explicitly into the public domain.
@@ -50,7 +50,7 @@ for i in range( 1, len( sys.argv ) ):
#
c_pathname_pat = re.compile( '^.*\.[ch]$', re.IGNORECASE )
-trace_use_pat = re.compile( '^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+' )
+trace_use_pat = re.compile( '^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+trace_' )
for d in SRC_FILE_DIRS:
for ( p, dlst, flst ) in os.walk( d ):
diff --git a/Build/source/libs/freetype2/freetype-src/src/tools/glnames.py b/Build/source/libs/freetype2/freetype-src/src/tools/glnames.py
index c6f2f278931..a19ce178b82 100755
--- a/Build/source/libs/freetype2/freetype-src/src/tools/glnames.py
+++ b/Build/source/libs/freetype2/freetype-src/src/tools/glnames.py
@@ -6,7 +6,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/tools/no-copyright b/Build/source/libs/freetype2/freetype-src/src/tools/no-copyright
index 1eaa6309674..d639aa4a84f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/tools/no-copyright
+++ b/Build/source/libs/freetype2/freetype-src/src/tools/no-copyright
@@ -7,6 +7,8 @@
#
# Don't put empty lines into this file!
#
+.gitignore
+#
builds/unix/pkg.m4
#
docs/FTL.TXT
@@ -60,6 +62,4 @@ src/gzip/zutil.h
src/tools/apinames.c
src/tools/ftrandom/ftrandom.c
#
-subprojects/dlg
-#
# EOF
diff --git a/Build/source/libs/freetype2/freetype-src/src/tools/update-copyright-year b/Build/source/libs/freetype2/freetype-src/src/tools/update-copyright-year
index 69d63b60aba..c659bbafb89 100755
--- a/Build/source/libs/freetype2/freetype-src/src/tools/update-copyright-year
+++ b/Build/source/libs/freetype2/freetype-src/src/tools/update-copyright-year
@@ -2,7 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}'
& eval 'exec perl -wS -i "$0" $argv:q'
if 0;
-# Copyright (C) 2015-2021 by
+# Copyright (C) 2015-2020 by
# Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -28,20 +28,20 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}'
#
# or
#
-# /* Copyright (c) 2000, 2001, 2004-2007 by */
-# /* foobar */
+# /* Copyright 2000, 2001, 2004-2007 by */
+# /* foobar */
#
# and replaces them uniformly with
#
-# Copyright (C) 2000-2021
+# Copyright 2000-2015
# foobar
#
# and
#
-# /* Copyright (C) 2000-2021 by */
-# /* foobar */
+# /* Copyright 2000-2015 by */
+# /* foobar */
#
-# (assuming that the current year is 2021). As can be seen, the line length
+# (assuming that the current year is 2015). As can be seen, the line length
# is retained if there is non-whitespace after the word `by' on the same
# line.
@@ -80,11 +80,11 @@ while (<>)
{
# Fill line to the same length (if appropriate); we skip the middle
# part but insert `(C)', three spaces, and `-'.
- my $space = length($+{space1})
- + length($+{middle})
- + length($+{space2})
+ my $space = length($+{space1}) - 1
+ + length($+{middle}) - 1
+ + length($+{space2}) - 1
+ length($+{space3})
- - (length("(C)") + 3 + 1);
+ - (length("(C)") + 1);
print "$+{begin}";
print "Copyright\ (C)\ $+{first}-$year\ by";
@@ -106,38 +106,19 @@ while (<>)
(?<end>.*)
}
{
- if ($+{first} < $year)
- {
- # Fill line to the same length (if appropriate); we insert three
- # spaces, the string `(C)', a `-', and the current year.
- my $space = length($+{space1})
- + length($+{space2})
- + length($+{space3})
- - (length($year) + length("(C)") + 3 + 1);
-
- print "$+{begin}";
- print "Copyright\ (C)\ $+{first}-$year\ by";
- # If $space is negative this inserts nothing.
- print ' ' x $space if length($+{end});
- print "$+{end}\n";
- $replaced = 1;
- }
- else
- {
- # Fill line to the same length (if appropriate); we insert three
- # spaces and the string `(C)'.
- my $space = length($+{space1})
- + length($+{space2})
- + length($+{space3})
- - (length("(C)") + 3);
+ # Fill line to the same length (if appropriate); we insert three
+ # spaces, a `-', and the current year.
+ my $space = length($+{space1}) - 1
+ + length($+{space2}) - 1
+ + length($+{space3})
+ - (length($year) + 1);
- print "$+{begin}";
- print "Copyright\ (C)\ $+{first}\ by";
- # If $space is negative this inserts nothing.
- print ' ' x $space if length($+{end});
- print "$+{end}\n";
- $replaced = 1;
- }
+ print "$+{begin}";
+ print "Copyright\ (C)\ $+{first}-$year\ by";
+ # If $space is negative this inserts nothing.
+ print ' ' x $space if length($+{end});
+ print "$+{end}\n";
+ $replaced = 1;
}ex
||
# Otherwise print line unaltered.
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/module.mk b/Build/source/libs/freetype2/freetype-src/src/truetype/module.mk
index 485ef05c2df..2d8d39d1f77 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/truetype/rules.mk b/Build/source/libs/freetype2/freetype-src/src/truetype/rules.mk
index cfd6b3b2f44..2f6fecfc44a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/truetype/truetype.c b/Build/source/libs/freetype2/freetype-src/src/truetype/truetype.c
index 4232aca6ec4..41b6808a84e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/truetype.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/truetype.c
@@ -4,7 +4,7 @@
*
* FreeType TrueType driver component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c
index eaa14aad8d6..bf830b14188 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
*
* TrueType font driver implementation (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -108,7 +108,7 @@
return error;
}
- FT_TRACE2(( "tt_property_set: missing property `%s'\n",
+ FT_TRACE0(( "tt_property_set: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
@@ -135,7 +135,7 @@
return error;
}
- FT_TRACE2(( "tt_property_get: missing property `%s'\n",
+ FT_TRACE0(( "tt_property_get: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.h
index 4e6d52d22ca..ee1438eb6e0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.h
@@ -4,7 +4,7 @@
*
* High-level TrueType driver interface (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/tterrors.h b/Build/source/libs/freetype2/freetype-src/src/truetype/tterrors.h
index 0ce247e376a..efeafd3a1b4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/tterrors.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/tterrors.h
@@ -4,7 +4,7 @@
*
* TrueType error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c
index b490b84b5e2..1dd319dcbf4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c
@@ -4,7 +4,7 @@
*
* TrueType Glyph Loader (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -197,17 +197,10 @@
}
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* With the incremental interface, these values are set by */
- /* a call to `tt_get_metrics_incremental'. */
- if ( face->root.internal->incremental_interface == NULL )
-#endif
+ if ( !loader->linear_def )
{
- if ( !loader->linear_def )
- {
- loader->linear_def = 1;
- loader->linear = advance_width;
- }
+ loader->linear_def = 1;
+ loader->linear = advance_width;
}
return FT_Err_Ok;
@@ -217,8 +210,8 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
static void
- tt_get_metrics_incremental( TT_Loader loader,
- FT_UInt glyph_index )
+ tt_get_metrics_incr_overrides( TT_Loader loader,
+ FT_UInt glyph_index )
{
TT_Face face = loader->face;
@@ -458,7 +451,7 @@
(void*)&load->exec->glyphIns,
n_ins );
- load->exec->glyphSize = (FT_UInt)tmp;
+ load->exec->glyphSize = (FT_UShort)tmp;
if ( error )
return error;
@@ -743,14 +736,12 @@
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",
+ FT_TRACE7(( " scaling: xx=%f, yx=%f\n"
+ " xy=%f, yy=%f\n",
subglyph->transform.xx / 65536.0,
- subglyph->transform.yx / 65536.0 ));
- FT_TRACE7(( " xy=%f, yy=%f\n",
+ subglyph->transform.yx / 65536.0,
subglyph->transform.xy / 65536.0,
subglyph->transform.yy / 65536.0 ));
- }
subglyph++;
}
@@ -1748,11 +1739,13 @@
if ( loader->byte_len == 0 || loader->n_contours == 0 )
{
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- tt_get_metrics_incremental( loader, glyph_index );
-#endif
+ /* must initialize points before (possibly) overriding */
+ /* glyph metrics from the incremental interface */
tt_loader_set_pp( loader );
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ tt_get_metrics_incr_overrides( loader, glyph_index );
+#endif
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -1835,11 +1828,13 @@
goto Exit;
}
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- tt_get_metrics_incremental( loader, glyph_index );
-#endif
+ /* must initialize phantom points before (possibly) overriding */
+ /* glyph metrics from the incremental interface */
tt_loader_set_pp( loader );
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ tt_get_metrics_incr_overrides( loader, glyph_index );
+#endif
/***********************************************************************/
/***********************************************************************/
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.h
index 78fdeaa73d0..8f72cd558c8 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
*
* TrueType Glyph Loader (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c
index aad3e2929aa..b462263de11 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
*
* TrueType GX Font Variation loader
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.
*
* This file is part of the FreeType project, and may only be used,
@@ -371,9 +371,8 @@
if ( axisCount != (FT_Long)blend->mmvar->num_axis )
{
- FT_TRACE2(( "ft_var_load_avar:"
- " number of axes in `avar' and `fvar'\n" ));
- FT_TRACE2(( " table are different\n" ));
+ FT_TRACE2(( "ft_var_load_avar: number of axes in `avar' and `fvar'\n"
+ " table are different\n" ));
goto Exit;
}
@@ -487,22 +486,13 @@
if ( itemStore->axisCount != (FT_Long)blend->mmvar->num_axis )
{
FT_TRACE2(( "ft_var_load_item_variation_store:"
- " number of axes in item variation store\n" ));
- FT_TRACE2(( " "
+ " number of axes in item variation store\n"
+ " "
" and `fvar' table are different\n" ));
error = FT_THROW( Invalid_Table );
goto Exit;
}
- /* new constraint in OpenType 1.8.4 */
- if ( itemStore->regionCount >= 32768U )
- {
- FT_TRACE2(( "ft_var_load_item_variation_store:"
- " too many variation region tables\n" ));
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
if ( FT_NEW_ARRAY( itemStore->varRegionList, itemStore->regionCount ) )
goto Exit;
@@ -1525,9 +1515,8 @@
if ( gvar_head.axisCount != (FT_UShort)blend->mmvar->num_axis )
{
- FT_TRACE1(( "ft_var_load_gvar:"
- " number of axes in `gvar' and `cvar'\n" ));
- FT_TRACE1(( " table are different\n" ));
+ FT_TRACE1(( "ft_var_load_gvar: number of axes in `gvar' and `cvar'\n"
+ " table are different\n" ));
error = FT_THROW( Invalid_Table );
goto Exit;
}
@@ -1852,12 +1841,12 @@
FT_TRACE5(( " %d: %.5f\n", i, coord / 65536.0 ));
if ( coord > a->maximum || coord < a->minimum )
{
- FT_TRACE1(( "ft_var_to_normalized: design coordinate %.5f\n",
- coord / 65536.0 ));
- FT_TRACE1(( " is out of range [%.5f;%.5f];"
- " clamping\n",
- a->minimum / 65536.0,
- a->maximum / 65536.0 ));
+ FT_TRACE1((
+ "ft_var_to_normalized: design coordinate %.5f\n"
+ " is out of range [%.5f;%.5f]; clamping\n",
+ coord / 65536.0,
+ a->minimum / 65536.0,
+ a->maximum / 65536.0 ));
if ( coord > a->maximum )
coord = a->maximum;
@@ -2060,7 +2049,7 @@
FT_Var_Axis* a;
FT_Fixed* c;
FT_Var_Named_Style* ns;
- GX_FVar_Head fvar_head = { 0, 0, 0, 0, 0, 0 };
+ GX_FVar_Head fvar_head;
FT_Bool usePsName = 0;
FT_UInt num_instances;
FT_UInt num_axes;
@@ -2126,8 +2115,8 @@
if ( FT_SET_ERROR( face->goto_table( face, TTAG_CFF2,
stream, &table_len ) ) )
{
- FT_TRACE1(( "\n" ));
- FT_TRACE1(( "TT_Get_MM_Var: `gvar' or `CFF2' table is missing\n" ));
+ FT_TRACE1(( "\n"
+ "TT_Get_MM_Var: `gvar' or `CFF2' table is missing\n" ));
goto Exit;
}
}
@@ -2555,17 +2544,17 @@
num_coords = mmvar->num_axis;
}
- FT_TRACE5(( "TT_Set_MM_Blend:\n" ));
- FT_TRACE5(( " normalized design coordinates:\n" ));
+ FT_TRACE5(( "TT_Set_MM_Blend:\n"
+ " normalized design coordinates:\n" ));
for ( i = 0; i < num_coords; i++ )
{
FT_TRACE5(( " %.5f\n", coords[i] / 65536.0 ));
if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L )
{
- FT_TRACE1(( "TT_Set_MM_Blend: normalized design coordinate %.5f\n",
+ FT_TRACE1(( "TT_Set_MM_Blend: normalized design coordinate %.5f\n"
+ " is out of range [-1;1]\n",
coords[i] / 65536.0 ));
- FT_TRACE1(( " is out of range [-1;1]\n" ));
error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -2663,10 +2652,9 @@
}
blend->num_axis = mmvar->num_axis;
- if ( coords )
- FT_MEM_COPY( blend->normalizedcoords,
- coords,
- num_coords * sizeof ( FT_Fixed ) );
+ FT_MEM_COPY( blend->normalizedcoords,
+ coords,
+ num_coords * sizeof ( FT_Fixed ) );
if ( set_design_coords )
ft_var_to_design( face,
@@ -2964,8 +2952,8 @@
if ( !face->blend->avar_loaded )
ft_var_load_avar( face );
- FT_TRACE5(( "TT_Set_Var_Design:\n" ));
- FT_TRACE5(( " normalized design coordinates:\n" ));
+ FT_TRACE5(( "TT_Set_Var_Design:\n"
+ " normalized design coordinates:\n" ));
ft_var_to_normalized( face, num_coords, blend->coords, normalized );
error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 );
@@ -3241,16 +3229,16 @@
if ( !blend )
{
- FT_TRACE2(( "\n" ));
- FT_TRACE2(( "tt_face_vary_cvt: no blend specified\n" ));
+ FT_TRACE2(( "\n"
+ "tt_face_vary_cvt: no blend specified\n" ));
error = FT_Err_Ok;
goto Exit;
}
if ( !face->cvt )
{
- FT_TRACE2(( "\n" ));
- FT_TRACE2(( "tt_face_vary_cvt: no `cvt ' table\n" ));
+ FT_TRACE2(( "\n"
+ "tt_face_vary_cvt: no `cvt ' table\n" ));
error = FT_Err_Ok;
goto Exit;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h
index c587319510d..26e89bcf74e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h
@@ -4,7 +4,7 @@
*
* TrueType GX Font Variation loader (specification)
*
- * Copyright (C) 2004-2021 by
+ * Copyright (C) 2004-2020 by
* David Turner, Robert Wilhelm, Werner Lemberg and George Williams.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c
index 96b48a00336..0c3cb10ae8e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c
@@ -4,7 +4,7 @@
*
* TrueType bytecode interpreter (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -251,14 +251,6 @@
FT_FREE( exec->stack );
exec->stackSize = 0;
- /* free glyf cvt working area */
- FT_FREE( exec->glyfCvt );
- exec->glyfCvtSize = 0;
-
- /* free glyf storage working area */
- FT_FREE( exec->glyfStorage );
- exec->glyfStoreSize = 0;
-
/* free call stack */
FT_FREE( exec->callStack );
exec->callSize = 0;
@@ -306,7 +298,7 @@
exec->memory = memory;
exec->callSize = 32;
- if ( FT_QNEW_ARRAY( exec->callStack, exec->callSize ) )
+ if ( FT_NEW_ARRAY( exec->callStack, exec->callSize ) )
goto Fail_Memory;
/* all values in the context are set to 0 already, but this is */
@@ -472,13 +464,13 @@
if ( error )
return error;
- tmp = (FT_ULong)exec->glyphSize;
+ tmp = exec->glyphSize;
error = Update_Max( exec->memory,
&tmp,
sizeof ( FT_Byte ),
(void*)&exec->glyphIns,
maxp->maxSizeOfInstructions );
- exec->glyphSize = (FT_UInt)tmp;
+ exec->glyphSize = (FT_UShort)tmp;
if ( error )
return error;
@@ -1580,36 +1572,11 @@
}
- static void
- Modify_CVT_Check( TT_ExecContext exc )
- {
- /* TT_RunIns sets origCvt and restores cvt to origCvt when done. */
- if ( exc->iniRange == tt_coderange_glyph &&
- exc->cvt == exc->origCvt )
- {
- exc->error = Update_Max( exc->memory,
- &exc->glyfCvtSize,
- sizeof ( FT_Long ),
- (void*)&exc->glyfCvt,
- exc->cvtSize );
- if ( exc->error )
- return;
-
- FT_ARRAY_COPY( exc->glyfCvt, exc->cvt, exc->glyfCvtSize );
- exc->cvt = exc->glyfCvt;
- }
- }
-
-
FT_CALLBACK_DEF( void )
Write_CVT( TT_ExecContext exc,
FT_ULong idx,
FT_F26Dot6 value )
{
- Modify_CVT_Check( exc );
- if ( exc->error )
- return;
-
exc->cvt[idx] = value;
}
@@ -1619,10 +1586,6 @@
FT_ULong idx,
FT_F26Dot6 value )
{
- Modify_CVT_Check( exc );
- if ( exc->error )
- return;
-
exc->cvt[idx] = FT_DivFix( value, Current_Ratio( exc ) );
}
@@ -1632,10 +1595,6 @@
FT_ULong idx,
FT_F26Dot6 value )
{
- Modify_CVT_Check( exc );
- if ( exc->error )
- return;
-
exc->cvt[idx] = ADD_LONG( exc->cvt[idx], value );
}
@@ -1645,10 +1604,6 @@
FT_ULong idx,
FT_F26Dot6 value )
{
- Modify_CVT_Check( exc );
- if ( exc->error )
- return;
-
exc->cvt[idx] = ADD_LONG( exc->cvt[idx],
FT_DivFix( value, Current_Ratio( exc ) ) );
}
@@ -3170,30 +3125,7 @@
ARRAY_BOUND_ERROR;
}
else
- {
- /* TT_RunIns sets origStorage and restores storage to origStorage */
- /* when done. */
- if ( exc->iniRange == tt_coderange_glyph &&
- exc->storage == exc->origStorage )
- {
- FT_ULong tmp = (FT_ULong)exc->glyfStoreSize;
-
-
- exc->error = Update_Max( exc->memory,
- &tmp,
- sizeof ( FT_Long ),
- (void*)&exc->glyfStorage,
- exc->storeSize );
- exc->glyfStoreSize = (FT_UShort)tmp;
- if ( exc->error )
- return;
-
- FT_ARRAY_COPY( exc->glyfStorage, exc->storage, exc->glyfStoreSize );
- exc->storage = exc->glyfStorage;
- }
-
exc->storage[I] = args[1];
- }
}
@@ -3593,7 +3525,7 @@
return;
}
- exc->IP = ADD_LONG( exc->IP, args[0] );
+ exc->IP += args[0];
if ( exc->IP < 0 ||
( exc->callTop > 0 &&
exc->IP > exc->callStack[exc->callTop - 1].Def->end ) )
@@ -3765,7 +3697,7 @@
/* FDEF is only allowed in `prep' or `fpgm' */
- if ( exc->iniRange == tt_coderange_glyph )
+ if ( exc->curRange == tt_coderange_glyph )
{
exc->error = FT_THROW( DEF_In_Glyf_Bytecode );
return;
@@ -3839,7 +3771,7 @@
if ( opcode_pointer[i] == opcode_size[i] )
{
- FT_TRACE6(( "sph: Function %d, opcode ptrn: %ld, %s %s\n",
+ FT_TRACE6(( "sph: Function %d, opcode ptrn: %d, %s %s\n",
i, n,
exc->face->root.family_name,
exc->face->root.style_name ));
@@ -4201,7 +4133,7 @@
/* we enable IDEF only in `prep' or `fpgm' */
- if ( exc->iniRange == tt_coderange_glyph )
+ if ( exc->curRange == tt_coderange_glyph )
{
exc->error = FT_THROW( DEF_In_Glyf_Bytecode );
return;
@@ -4430,7 +4362,7 @@
if ( ( opcode & 1 ) != 0 )
{
- C = B; /* counter-clockwise rotation */
+ C = B; /* counter clockwise rotation */
B = A;
A = NEG_LONG( C );
}
@@ -5118,7 +5050,7 @@
if ( ( opcode & 1 ) != 0 )
{
- C = B; /* counter-clockwise rotation */
+ C = B; /* counter clockwise rotation */
B = A;
A = NEG_LONG( C );
}
@@ -5142,7 +5074,7 @@
if ( ( opcode & 1 ) != 0 )
{
- C = B; /* counter-clockwise rotation */
+ C = B; /* counter clockwise rotation */
B = A;
A = NEG_LONG( C );
}
@@ -7849,8 +7781,8 @@
if ( num_twilight_points > 0xFFFFU )
num_twilight_points = 0xFFFFU;
- FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n" ));
- FT_TRACE5(( " from %d to the more reasonable value %ld\n",
+ FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n"
+ " from %d to the more reasonable value %ld\n",
exc->twilight.n_points,
num_twilight_points ));
exc->twilight.n_points = (FT_UShort)num_twilight_points;
@@ -7910,10 +7842,6 @@
exc->func_move_cvt = Move_CVT;
}
- exc->origCvt = exc->cvt;
- exc->origStorage = exc->storage;
- exc->iniRange = exc->curRange;
-
Compute_Funcs( exc );
Compute_Round( exc, (FT_Byte)exc->GS.round_state );
@@ -7922,7 +7850,6 @@
exc->opcode = exc->code[exc->IP];
#ifdef FT_DEBUG_LEVEL_TRACE
- if ( ft_trace_levels[trace_ttinterp] >= 6 )
{
FT_Long cnt = FT_MIN( 8, exc->top );
FT_Long n;
@@ -8639,10 +8566,8 @@
/* increment instruction counter and check if we didn't */
/* run this program for too long (e.g. infinite loops). */
- if ( ++ins_counter > TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES ) {
- exc->error = FT_THROW( Execution_Too_Long );
- goto LErrorLabel_;
- }
+ if ( ++ins_counter > TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES )
+ return FT_THROW( Execution_Too_Long );
LSuiteLabel_:
if ( exc->IP >= exc->codeSize )
@@ -8661,10 +8586,6 @@
FT_TRACE4(( " %ld instruction%s executed\n",
ins_counter,
ins_counter == 1 ? "" : "s" ));
-
- exc->cvt = exc->origCvt;
- exc->storage = exc->origStorage;
-
return FT_Err_Ok;
LErrorCodeOverflow_:
@@ -8674,9 +8595,6 @@
if ( exc->error && !exc->instruction_trap )
FT_TRACE1(( " The interpreter returned error 0x%x\n", exc->error ));
- exc->cvt = exc->origCvt;
- exc->storage = exc->origStorage;
-
return exc->error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h
index a7578f829bc..6a83705a6c5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h
@@ -4,7 +4,7 @@
*
* TrueType bytecode interpreter (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -175,7 +175,6 @@ FT_BEGIN_HEADER
TT_GraphicsState GS; /* current graphics state */
- FT_Int iniRange; /* initial code range number */
FT_Int curRange; /* current code range number */
FT_Byte* code; /* current code range */
FT_Long IP; /* current instruction pointer */
@@ -188,9 +187,6 @@ FT_BEGIN_HEADER
/* increment IP after ins. exec */
FT_ULong cvtSize;
FT_Long* cvt;
- FT_ULong glyfCvtSize;
- FT_Long* glyfCvt; /* cvt working copy for glyph */
- FT_Long* origCvt;
FT_UInt glyphSize; /* glyph instructions buffer size */
FT_Byte* glyphIns; /* glyph instructions buffer */
@@ -217,11 +213,8 @@ FT_BEGIN_HEADER
TT_CodeRangeTable codeRangeTable; /* table of valid code ranges */
/* useful for the debugger */
- FT_UShort storeSize; /* size of current storage */
- FT_Long* storage; /* storage area */
- FT_UShort glyfStoreSize;
- FT_Long* glyfStorage; /* storage working copy for glyph */
- FT_Long* origStorage;
+ FT_UShort storeSize; /* size of current storage */
+ FT_Long* storage; /* storage area */
FT_F26Dot6 period; /* values used for the */
FT_F26Dot6 phase; /* `SuperRounding' */
@@ -476,15 +469,16 @@ FT_BEGIN_HEADER
* TT_New_Context
*
* @Description:
- * Create a `TT_ExecContext`. Note that there is now an execution
- * context per `TT_Size` that is not shared among faces.
+ * Queries the face context for a given font. Note that there is
+ * now a _single_ execution context in the TrueType driver which is
+ * shared among faces.
*
* @Input:
- * driver ::
- * A handle to the driver, used for memory allocation.
+ * face ::
+ * A handle to the source face object.
*
* @Return:
- * A handle to a new empty execution context.
+ * A handle to the execution context. Initialized for `face'.
*
* @Note:
* Only the glyph loader and debugger should call this function.
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c
index 92eff4dffe7..06d45695597 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
*
* Objects manager (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -712,8 +712,8 @@
tt_check_single_notdef( ttface ) )
{
FT_TRACE5(( "tt_face_init:"
- " Only the `.notdef' glyph has an outline.\n" ));
- FT_TRACE5(( " "
+ " Only the `.notdef' glyph has an outline.\n"
+ " "
" Resetting scalable flag to FALSE.\n" ));
ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.h
index fd72378721b..d986deabc41 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
*
* Objects manager (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c
index 6c12c97bd7f..b1255b88cd5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
*
* TrueType-specific tables loader (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -237,11 +237,10 @@
if ( pos1 > face->glyf_len )
{
FT_TRACE1(( "tt_face_get_location:"
- " too large offset (0x%08lx) found for glyph index %d,\n",
- pos1, gindex ));
- FT_TRACE1(( " "
+ " too large offset (0x%08lx) found for glyph index %d,\n"
+ " "
" exceeding the end of `glyf' table (0x%08lx)\n",
- face->glyf_len ));
+ pos1, gindex, face->glyf_len ));
*asize = 0;
return 0;
}
@@ -252,21 +251,19 @@
if ( gindex == face->num_locations - 2 )
{
FT_TRACE1(( "tt_face_get_location:"
- " too large size (%ld bytes) found for glyph index %d,\n",
- pos2 - pos1, gindex ));
- FT_TRACE1(( " "
+ " too large size (%ld bytes) found for glyph index %d,\n"
+ " "
" truncating at the end of `glyf' table to %ld bytes\n",
- face->glyf_len - pos1 ));
+ pos2 - pos1, gindex, face->glyf_len - pos1 ));
pos2 = face->glyf_len;
}
else
{
FT_TRACE1(( "tt_face_get_location:"
- " too large offset (0x%08lx) found for glyph index %d,\n",
- pos2, gindex + 1 ));
- FT_TRACE1(( " "
+ " too large offset (0x%08lx) found for glyph index %d,\n"
+ " "
" exceeding the end of `glyf' table (0x%08lx)\n",
- face->glyf_len ));
+ pos2, gindex + 1, face->glyf_len ));
*asize = 0;
return 0;
}
@@ -347,7 +344,7 @@
face->cvt_size = table_len / 2;
- if ( FT_QNEW_ARRAY( face->cvt, face->cvt_size ) )
+ if ( FT_NEW_ARRAY( face->cvt, face->cvt_size ) )
goto Exit;
if ( FT_FRAME_ENTER( face->cvt_size * 2L ) )
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.h
index 84c42cdaf4f..bb669e02786 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.h
@@ -4,7 +4,7 @@
*
* TrueType-specific tables loader (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c
index e3b523e394b..56667deaf79 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c
@@ -4,7 +4,7 @@
*
* TrueType Subpixel Hinting.
*
- * Copyright (C) 2010-2021 by
+ * Copyright (C) 2010-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -891,12 +891,12 @@
#define TWEAK_RULES( x ) \
if ( sph_test_tweak( face, family, ppem, style, glyph_index, \
x##_Rules, x##_RULES_SIZE ) ) \
- loader->exec->sph_tweak_flags |= SPH_TWEAK_##x
+ loader->exec->sph_tweak_flags |= SPH_TWEAK_##x;
#define TWEAK_RULES_EXCEPTIONS( x ) \
if ( sph_test_tweak( face, family, ppem, style, glyph_index, \
x##_Rules_Exceptions, x##_RULES_EXCEPTIONS_SIZE ) ) \
- loader->exec->sph_tweak_flags &= ~SPH_TWEAK_##x
+ loader->exec->sph_tweak_flags &= ~SPH_TWEAK_##x;
FT_LOCAL_DEF( void )
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.h
index 762b7c98a37..229a6cf055b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.h
@@ -4,7 +4,7 @@
*
* TrueType Subpixel Hinting.
*
- * Copyright (C) 2010-2021 by
+ * Copyright (C) 2010-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/module.mk b/Build/source/libs/freetype2/freetype-src/src/type1/module.mk
index 5da4716f415..cffb774b45c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/type1/rules.mk b/Build/source/libs/freetype2/freetype-src/src/type1/rules.mk
index 985248d3158..213e619247e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c
index 4c18ed1955a..b9cd66b045d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c
@@ -4,7 +4,7 @@
*
* AFM support for Type 1 fonts (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -83,7 +83,7 @@
/* compare two kerning pairs */
- FT_COMPARE_DEF( int )
+ FT_CALLBACK_DEF( int )
compare_kern_pairs( const void* a,
const void* b )
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.h b/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.h
index 86fe45ea3e7..edf919c7915 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.h
@@ -4,7 +4,7 @@
*
* AFM support for Type 1 fonts (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1driver.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1driver.c
index f4d7a089ae2..b786a87817e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1driver.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1driver.c
@@ -4,7 +4,7 @@
*
* Type 1 driver interface (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1driver.h b/Build/source/libs/freetype2/freetype-src/src/type1/t1driver.h
index 20a827f8987..e7eae0b88c4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1driver.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1driver.h
@@ -4,7 +4,7 @@
*
* High-level Type 1 driver interface (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1errors.h b/Build/source/libs/freetype2/freetype-src/src/type1/t1errors.h
index 18ef75452b6..ad03a3d32a1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1errors.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1errors.h
@@ -4,7 +4,7 @@
*
* Type 1 error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c
index 57ad39774f9..d16b81f2463 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c
@@ -4,7 +4,7 @@
*
* Type 1 Glyph Loader (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.h b/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.h
index a924d551a9d..9947507c84a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.h
@@ -4,7 +4,7 @@
*
* Type 1 Glyph Loader (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1load.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1load.c
index 497c26aa7d8..84986007b0d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1load.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1load.c
@@ -4,7 +4,7 @@
*
* Type 1 font loader (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -130,10 +130,10 @@
/* allocate the blend `private' and `font_info' dictionaries */
- if ( FT_QNEW_ARRAY( blend->font_infos[1], num_designs ) ||
- FT_QNEW_ARRAY( blend->privates [1], num_designs ) ||
- FT_QNEW_ARRAY( blend->bboxes [1], num_designs ) ||
- FT_QNEW_ARRAY( blend->weight_vector, num_designs * 2 ) )
+ if ( FT_NEW_ARRAY( blend->font_infos[1], num_designs ) ||
+ FT_NEW_ARRAY( blend->privates [1], num_designs ) ||
+ FT_NEW_ARRAY( blend->bboxes [1], num_designs ) ||
+ FT_NEW_ARRAY( blend->weight_vector, num_designs * 2 ) )
goto Exit;
blend->default_weight_vector = blend->weight_vector + num_designs;
@@ -167,12 +167,12 @@
/* allocate the blend design pos table if needed */
num_designs = blend->num_designs;
num_axis = blend->num_axis;
- if ( num_designs && num_axis && blend->design_pos[0] == NULL )
+ if ( num_designs && num_axis && blend->design_pos[0] == 0 )
{
FT_UInt n;
- if ( FT_QNEW_ARRAY( blend->design_pos[0], num_designs * num_axis ) )
+ if ( FT_NEW_ARRAY( blend->design_pos[0], num_designs * num_axis ) )
goto Exit;
for ( n = 1; n < num_designs; n++ )
@@ -851,7 +851,7 @@
FT_FREE( name );
}
- if ( FT_QALLOC( blend->axis_names[n], len + 1 ) )
+ if ( FT_ALLOC( blend->axis_names[n], len + 1 ) )
goto Exit;
name = (FT_Byte*)blend->axis_names[n];
@@ -1044,7 +1044,7 @@
}
/* allocate design map data */
- if ( FT_QNEW_ARRAY( map->design_points, num_points * 2 ) )
+ if ( FT_NEW_ARRAY( map->design_points, num_points * 2 ) )
goto Exit;
map->blend_points = map->design_points + num_points;
map->num_points = (FT_Byte)num_points;
@@ -1122,8 +1122,8 @@
else if ( blend->num_designs != (FT_UInt)num_designs )
{
FT_ERROR(( "parse_weight_vector:"
- " /BlendDesignPosition and /WeightVector have\n" ));
- FT_ERROR(( " "
+ " /BlendDesignPosition and /WeightVector have\n"
+ " "
" different number of elements\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
@@ -1307,9 +1307,9 @@
else
{
FT_TRACE1(( "t1_load_keyword: ignoring keyword `%s'"
- " which is not valid at this point\n",
+ " which is not valid at this point\n"
+ " (probably due to missing keywords)\n",
field->ident ));
- FT_TRACE1(( " (probably due to missing keywords)\n" ));
error = FT_Err_Ok;
}
@@ -1858,7 +1858,7 @@
}
/* t1_decrypt() shouldn't write to base -- make temporary copy */
- if ( FT_QALLOC( temp, size ) )
+ if ( FT_ALLOC( temp, size ) )
goto Fail;
FT_MEM_COPY( temp, base, size );
psaux->t1_decrypt( temp, size, 4330 );
@@ -2068,7 +2068,7 @@
}
/* t1_decrypt() shouldn't write to base -- make temporary copy */
- if ( FT_QALLOC( temp, size ) )
+ if ( FT_ALLOC( temp, size ) )
goto Fail;
FT_MEM_COPY( temp, base, size );
psaux->t1_decrypt( temp, size, 4330 );
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1load.h b/Build/source/libs/freetype2/freetype-src/src/type1/t1load.h
index ba19adb147b..4396415c203 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1load.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1load.h
@@ -4,7 +4,7 @@
*
* Type 1 font loader (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c
index ec202be2934..3b918b73388 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c
@@ -4,7 +4,7 @@
*
* Type 1 objects manager (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -217,6 +217,7 @@
{
FT_FREE( face->buildchar );
+ face->buildchar = NULL;
face->len_buildchar = 0;
}
@@ -597,7 +598,11 @@
/* 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;
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.h b/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.h
index 5f103b50661..536be8ba1e3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.h
@@ -4,7 +4,7 @@
*
* Type 1 objects manager (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1parse.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1parse.c
index 9f226296a9c..74cf38bde72 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1parse.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1parse.c
@@ -4,7 +4,7 @@
*
* Type 1 parser (body).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -221,7 +221,7 @@
else
{
/* read segment in memory -- this is clumsy, but so does the format */
- if ( FT_QALLOC( parser->base_dict, size ) ||
+ if ( FT_ALLOC( parser->base_dict, size ) ||
FT_STREAM_READ( parser->base_dict, size ) )
goto Exit;
parser->base_len = size;
@@ -302,8 +302,8 @@
goto Fail;
}
- if ( FT_STREAM_SEEK( start_pos ) ||
- FT_QALLOC( parser->private_dict, parser->private_len ) )
+ if ( FT_STREAM_SEEK( start_pos ) ||
+ FT_ALLOC( parser->private_dict, parser->private_len ) )
goto Fail;
parser->private_len = 0;
@@ -450,7 +450,7 @@
if ( parser->in_memory )
{
/* note that we allocate one more byte to put a terminating `0' */
- if ( FT_QALLOC( parser->private_dict, size + 1 ) )
+ if ( FT_ALLOC( parser->private_dict, size + 1 ) )
goto Fail;
parser->private_len = size;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1parse.h b/Build/source/libs/freetype2/freetype-src/src/type1/t1parse.h
index 247ff73b2cc..1ea0110b505 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1parse.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1parse.h
@@ -4,7 +4,7 @@
*
* Type 1 parser (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1tokens.h b/Build/source/libs/freetype2/freetype-src/src/type1/t1tokens.h
index 13ac8ac1c71..c09420355dd 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1tokens.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1tokens.h
@@ -4,7 +4,7 @@
*
* Type 1 tokenizer (specification).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/type1.c b/Build/source/libs/freetype2/freetype-src/src/type1/type1.c
index 003b78cb860..cadee78994d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/type1.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/type1.c
@@ -4,7 +4,7 @@
*
* FreeType Type 1 driver component (body only).
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/module.mk b/Build/source/libs/freetype2/freetype-src/src/type42/module.mk
index ec3214cda61..6ef3a95eade 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2002-2021 by
+# Copyright (C) 2002-2020 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/Build/source/libs/freetype2/freetype-src/src/type42/rules.mk b/Build/source/libs/freetype2/freetype-src/src/type42/rules.mk
index 9821943eaf5..f4ce91a3b79 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 2002-2021 by
+# Copyright (C) 2002-2020 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/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c b/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c
index e74ba1deba7..90898b43292 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.c
@@ -4,7 +4,7 @@
*
* High-level Type 42 driver interface (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h
index c6d8a4409e1..8bf2afc7555 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42drivr.h
@@ -4,7 +4,7 @@
*
* High-level Type 42 driver interface (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42error.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42error.h
index 470f5189a87..e48132ec098 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42error.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42error.h
@@ -4,7 +4,7 @@
*
* Type 42 error codes (specification only).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c b/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c
index 03955e945ba..6acfcdf4015 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.c
@@ -4,7 +4,7 @@
*
* Type 42 objects manager (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
@@ -44,7 +44,7 @@
parser = &loader.parser;
- if ( FT_QALLOC( face->ttf_data, 12 ) )
+ if ( FT_ALLOC( face->ttf_data, 12 ) )
goto Exit;
/* while parsing the font we always update `face->ttf_size' so that */
@@ -510,8 +510,7 @@
error = FT_New_Size( t42face->ttf_face, &ttsize );
- if ( !error )
- t42size->ttsize = ttsize;
+ t42size->ttsize = ttsize;
FT_Activate_Size( ttsize );
@@ -583,7 +582,6 @@
FT_Face face = t42slot->face;
T42_Face t42face = (T42_Face)face;
FT_GlyphSlot ttslot;
- FT_Memory memory = face->memory;
FT_Error error = FT_Err_Ok;
@@ -595,15 +593,9 @@
else
{
error = FT_New_GlyphSlot( t42face->ttf_face, &ttslot );
- if ( !error )
- slot->ttslot = ttslot;
+ slot->ttslot = ttslot;
}
- /* share the loader so that the autohinter can see it */
- FT_GlyphLoader_Done( slot->ttslot->internal->loader );
- FT_FREE( slot->ttslot->internal );
- slot->ttslot->internal = t42slot->internal;
-
return error;
}
@@ -614,8 +606,6 @@
T42_GlyphSlot slot = (T42_GlyphSlot)t42slot;
- /* do not destroy the inherited internal structure just yet */
- slot->ttslot->internal = NULL;
FT_Done_GlyphSlot( slot->ttslot );
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h
index cbd344ffbd4..69f5cffd44f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42objs.h
@@ -4,7 +4,7 @@
*
* Type 42 objects manager (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c b/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c
index ea2c5198a9d..98507699fad 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.c
@@ -4,7 +4,7 @@
*
* Type 42 font parser (body).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
@@ -197,7 +197,7 @@
else
{
/* read segment in memory */
- if ( FT_QALLOC( parser->base_dict, size ) ||
+ if ( FT_ALLOC( parser->base_dict, size ) ||
FT_STREAM_READ( parser->base_dict, size ) )
goto Exit;
@@ -576,9 +576,6 @@
old_string_size = 0;
count = 0;
- FT_TRACE2(( "\n" ));
- FT_TRACE2(( "t42_parse_sfnts:\n" ));
-
while ( parser->root.cursor < limit )
{
FT_ULong size;
@@ -614,7 +611,7 @@
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
- if ( FT_QREALLOC( string_buf, old_string_size, string_size ) )
+ if ( FT_REALLOC( string_buf, old_string_size, string_size ) )
goto Fail;
allocated = 1;
@@ -683,9 +680,6 @@
goto Fail;
}
- FT_TRACE2(( " PS string size %5lu bytes, offset 0x%08lx (%lu)\n",
- string_size, count, count ));
-
/* The whole TTF is now loaded into `string_buf'. We are */
/* checking its contents while copying it to `ttf_data'. */
@@ -708,9 +702,6 @@
status = BEFORE_TABLE_DIR;
face->ttf_size = 12 + 16 * num_tables;
- FT_TRACE2(( " SFNT directory contains %d tables\n",
- num_tables ));
-
if ( (FT_Long)size < face->ttf_size )
{
FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" ));
@@ -718,7 +709,7 @@
goto Fail;
}
- if ( FT_QREALLOC( face->ttf_data, 12, face->ttf_size ) )
+ if ( FT_REALLOC( face->ttf_data, 12, face->ttf_size ) )
goto Fail;
}
/* fall through */
@@ -736,18 +727,12 @@
FT_ULong len;
- FT_TRACE2(( "\n" ));
- FT_TRACE2(( " table length\n" ));
- FT_TRACE2(( " ------------------------------\n" ));
-
for ( i = 0; i < num_tables; i++ )
{
FT_Byte* p = face->ttf_data + 12 + 16 * i + 12;
len = FT_PEEK_ULONG( p );
- FT_TRACE2(( " %4i 0x%08lx (%lu)\n", i, len, len ));
-
if ( len > size ||
face->ttf_size > (FT_Long)( size - len ) )
{
@@ -763,12 +748,8 @@
status = OTHER_TABLES;
- FT_TRACE2(( "\n" ));
- FT_TRACE2(( " allocating %ld bytes\n", face->ttf_size + 1 ));
- FT_TRACE2(( "\n" ));
-
- if ( FT_QREALLOC( face->ttf_data, 12 + 16 * num_tables,
- face->ttf_size + 1 ) )
+ if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables,
+ face->ttf_size + 1 ) )
goto Fail;
}
/* fall through */
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h
index 0fbd2b5e0bc..2ccf052d784 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42parse.h
@@ -4,7 +4,7 @@
*
* Type 42 font parser (specification).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/t42types.h b/Build/source/libs/freetype2/freetype-src/src/type42/t42types.h
index ea2f03e8930..ba0cc21429d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/t42types.h
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/t42types.h
@@ -4,7 +4,7 @@
*
* Type 42 font data types (specification only).
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/type42/type42.c b/Build/source/libs/freetype2/freetype-src/src/type42/type42.c
index d8d3936bdf5..012559e2fd6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type42/type42.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type42/type42.c
@@ -4,7 +4,7 @@
*
* FreeType Type 42 driver component.
*
- * Copyright (C) 2002-2021 by
+ * Copyright (C) 2002-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/winfonts/fnterrs.h b/Build/source/libs/freetype2/freetype-src/src/winfonts/fnterrs.h
index d582a9b99c1..550de386fcb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/winfonts/fnterrs.h
+++ b/Build/source/libs/freetype2/freetype-src/src/winfonts/fnterrs.h
@@ -4,7 +4,7 @@
*
* Win FNT/FON error codes (specification only).
*
- * Copyright (C) 2001-2021 by
+ * Copyright (C) 2001-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/Build/source/libs/freetype2/freetype-src/src/winfonts/module.mk b/Build/source/libs/freetype2/freetype-src/src/winfonts/module.mk
index 4a8580cabdb..4614c55fd0b 100644
--- a/Build/source/libs/freetype2/freetype-src/src/winfonts/module.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/winfonts/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/winfonts/rules.mk b/Build/source/libs/freetype2/freetype-src/src/winfonts/rules.mk
index 1384f23b6fe..e73ef5ea998 100644
--- a/Build/source/libs/freetype2/freetype-src/src/winfonts/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/winfonts/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2021 by
+# Copyright (C) 1996-2020 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/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c b/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c
index d590c0a22b8..e83312d1668 100644
--- a/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c
+++ b/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
*
* FreeType font driver for Windows FNT/FON files
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
* Copyright 2003 Huw D M Davies for Codeweavers
* Copyright 2007 Dmitry Timoshkov for Codeweavers
@@ -420,12 +420,12 @@
goto Exit;
FT_TRACE2(( "magic %04lx, machine %02x, number_of_sections %u, "
- "size_of_optional_header %02x\n",
+ "size_of_optional_header %02x\n"
+ "magic32 %02x, rsrc_virtual_address %04lx, "
+ "rsrc_size %04lx\n",
pe32_header.magic, pe32_header.machine,
pe32_header.number_of_sections,
- pe32_header.size_of_optional_header ));
- FT_TRACE2(( "magic32 %02x, rsrc_virtual_address %04lx, "
- "rsrc_size %04lx\n",
+ pe32_header.size_of_optional_header,
pe32_header.magic32, pe32_header.rsrc_virtual_address,
pe32_header.rsrc_size ));
@@ -793,7 +793,7 @@
root->style_flags |= FT_STYLE_FLAG_BOLD;
/* set up the `fixed_sizes' array */
- if ( FT_QNEW( root->available_sizes ) )
+ if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
goto Fail;
root->num_fixed_sizes = 1;
@@ -888,7 +888,7 @@
/* NULL byte -- the frame is erroneously one byte too small. */
/* We thus allocate one more byte, setting it explicitly to */
/* zero. */
- if ( FT_QALLOC( font->family_name, family_size + 1 ) )
+ if ( FT_ALLOC( font->family_name, family_size + 1 ) )
goto Fail;
FT_MEM_COPY( font->family_name,
@@ -1094,7 +1094,7 @@
/* note: since glyphs are stored in columns and not in rows we */
/* can't use ft_glyphslot_set_bitmap */
- if ( FT_QALLOC_MULT( bitmap->buffer, bitmap->rows, pitch ) )
+ if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, pitch ) )
goto Exit;
column = (FT_Byte*)bitmap->buffer;
diff --git a/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.h b/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.h
index a7134abd9cf..3367c7715e3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.h
+++ b/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.h
@@ -4,7 +4,7 @@
*
* FreeType font driver for Windows FNT/FON files
*
- * Copyright (C) 1996-2021 by
+ * Copyright (C) 1996-2020 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
* Copyright 2007 Dmitry Timoshkov for Codeweavers
*