From 58f56950848bae9c90da3873090c7698e0128b12 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 14 Aug 2019 11:13:36 +0200 Subject: Update bundled Freetype to 2.10.1 [ChangeLog][Freetype] Upgraded bundled Freetype version to 2.10.1. Fixes: QTBUG-77466 Change-Id: I1de8b8b03e0ffd0b17eeafff1017df7c638c9279 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/freetype/src/Jamfile | 2 +- src/3rdparty/freetype/src/autofit/Jamfile | 2 +- src/3rdparty/freetype/src/autofit/afangles.c | 52 +- src/3rdparty/freetype/src/autofit/afangles.h | 6 +- src/3rdparty/freetype/src/autofit/afblue.c | 39 +- src/3rdparty/freetype/src/autofit/afblue.cin | 32 +- src/3rdparty/freetype/src/autofit/afblue.dat | 28 +- src/3rdparty/freetype/src/autofit/afblue.h | 171 +- src/3rdparty/freetype/src/autofit/afblue.hin | 32 +- src/3rdparty/freetype/src/autofit/afcjk.c | 195 +- src/3rdparty/freetype/src/autofit/afcjk.h | 38 +- src/3rdparty/freetype/src/autofit/afcover.h | 32 +- src/3rdparty/freetype/src/autofit/afdummy.c | 42 +- src/3rdparty/freetype/src/autofit/afdummy.h | 34 +- src/3rdparty/freetype/src/autofit/aferrors.h | 48 +- src/3rdparty/freetype/src/autofit/afglobal.c | 98 +- src/3rdparty/freetype/src/autofit/afglobal.h | 46 +- src/3rdparty/freetype/src/autofit/afhints.c | 181 +- src/3rdparty/freetype/src/autofit/afhints.h | 238 +- src/3rdparty/freetype/src/autofit/afindic.c | 32 +- src/3rdparty/freetype/src/autofit/afindic.h | 34 +- src/3rdparty/freetype/src/autofit/aflatin.c | 304 +- src/3rdparty/freetype/src/autofit/aflatin.h | 44 +- src/3rdparty/freetype/src/autofit/aflatin2.c | 147 +- src/3rdparty/freetype/src/autofit/aflatin2.h | 34 +- src/3rdparty/freetype/src/autofit/afloader.c | 175 +- src/3rdparty/freetype/src/autofit/afloader.h | 42 +- src/3rdparty/freetype/src/autofit/afmodule.c | 88 +- src/3rdparty/freetype/src/autofit/afmodule.h | 36 +- src/3rdparty/freetype/src/autofit/afranges.c | 47 +- src/3rdparty/freetype/src/autofit/afranges.h | 32 +- src/3rdparty/freetype/src/autofit/afscript.h | 38 +- src/3rdparty/freetype/src/autofit/afshaper.c | 61 +- src/3rdparty/freetype/src/autofit/afshaper.h | 32 +- src/3rdparty/freetype/src/autofit/afstyles.h | 39 +- src/3rdparty/freetype/src/autofit/aftypes.h | 252 +- src/3rdparty/freetype/src/autofit/afwarp.c | 54 +- src/3rdparty/freetype/src/autofit/afwarp.h | 36 +- src/3rdparty/freetype/src/autofit/afwrtsys.h | 32 +- src/3rdparty/freetype/src/autofit/autofit.c | 33 +- src/3rdparty/freetype/src/autofit/module.mk | 2 +- src/3rdparty/freetype/src/autofit/rules.mk | 3 +- src/3rdparty/freetype/src/base/Jamfile | 7 +- src/3rdparty/freetype/src/base/ftadvanc.c | 32 +- src/3rdparty/freetype/src/base/ftbase.c | 36 +- src/3rdparty/freetype/src/base/ftbase.h | 32 +- src/3rdparty/freetype/src/base/ftbbox.c | 368 +- src/3rdparty/freetype/src/base/ftbdf.c | 32 +- src/3rdparty/freetype/src/base/ftbitmap.c | 376 +- src/3rdparty/freetype/src/base/ftcalc.c | 194 +- src/3rdparty/freetype/src/base/ftcid.c | 32 +- src/3rdparty/freetype/src/base/ftcolor.c | 157 + src/3rdparty/freetype/src/base/ftdbgmem.c | 60 +- src/3rdparty/freetype/src/base/ftdebug.c | 179 +- src/3rdparty/freetype/src/base/fterrors.c | 46 + src/3rdparty/freetype/src/base/ftfntfmt.c | 32 +- src/3rdparty/freetype/src/base/ftfstype.c | 32 +- src/3rdparty/freetype/src/base/ftgasp.c | 32 +- src/3rdparty/freetype/src/base/ftgloadr.c | 134 +- src/3rdparty/freetype/src/base/ftglyph.c | 141 +- src/3rdparty/freetype/src/base/ftgxval.c | 50 +- src/3rdparty/freetype/src/base/fthash.c | 28 +- src/3rdparty/freetype/src/base/ftinit.c | 217 +- src/3rdparty/freetype/src/base/ftlcdfil.c | 127 +- src/3rdparty/freetype/src/base/ftmac.c | 106 +- src/3rdparty/freetype/src/base/ftmm.c | 107 +- src/3rdparty/freetype/src/base/ftobjs.c | 589 ++-- src/3rdparty/freetype/src/base/ftotval.c | 32 +- src/3rdparty/freetype/src/base/ftoutln.c | 148 +- src/3rdparty/freetype/src/base/ftpatent.c | 34 +- src/3rdparty/freetype/src/base/ftpfr.c | 32 +- src/3rdparty/freetype/src/base/ftpsprop.c | 48 +- src/3rdparty/freetype/src/base/ftrfork.c | 72 +- src/3rdparty/freetype/src/base/ftsnames.c | 78 +- src/3rdparty/freetype/src/base/ftstream.c | 58 +- src/3rdparty/freetype/src/base/ftstroke.c | 120 +- src/3rdparty/freetype/src/base/ftsynth.c | 46 +- src/3rdparty/freetype/src/base/ftsystem.c | 281 +- src/3rdparty/freetype/src/base/fttrigon.c | 76 +- src/3rdparty/freetype/src/base/fttype1.c | 32 +- src/3rdparty/freetype/src/base/ftutil.c | 54 +- src/3rdparty/freetype/src/base/ftver.rc | 10 +- src/3rdparty/freetype/src/base/ftwinfnt.c | 32 +- src/3rdparty/freetype/src/base/rules.mk | 11 +- src/3rdparty/freetype/src/bdf/Jamfile | 2 +- src/3rdparty/freetype/src/bdf/bdf.h | 82 +- src/3rdparty/freetype/src/bdf/bdfdrivr.c | 69 +- src/3rdparty/freetype/src/bdf/bdfdrivr.h | 9 +- src/3rdparty/freetype/src/bdf/bdferror.h | 10 +- src/3rdparty/freetype/src/bdf/bdflib.c | 411 +-- src/3rdparty/freetype/src/bzip2/Jamfile | 2 +- src/3rdparty/freetype/src/bzip2/ftbzip2.c | 52 +- src/3rdparty/freetype/src/bzip2/rules.mk | 2 +- src/3rdparty/freetype/src/cache/Jamfile | 2 +- src/3rdparty/freetype/src/cache/ftcache.c | 32 +- src/3rdparty/freetype/src/cache/ftcbasic.c | 36 +- src/3rdparty/freetype/src/cache/ftccache.c | 34 +- src/3rdparty/freetype/src/cache/ftccache.h | 64 +- src/3rdparty/freetype/src/cache/ftccback.h | 32 +- src/3rdparty/freetype/src/cache/ftccmap.c | 62 +- src/3rdparty/freetype/src/cache/ftcerror.h | 48 +- src/3rdparty/freetype/src/cache/ftcglyph.c | 32 +- src/3rdparty/freetype/src/cache/ftcglyph.h | 166 +- src/3rdparty/freetype/src/cache/ftcimage.c | 32 +- src/3rdparty/freetype/src/cache/ftcimage.h | 50 +- src/3rdparty/freetype/src/cache/ftcmanag.c | 38 +- src/3rdparty/freetype/src/cache/ftcmanag.h | 143 +- src/3rdparty/freetype/src/cache/ftcmru.c | 32 +- src/3rdparty/freetype/src/cache/ftcmru.h | 80 +- src/3rdparty/freetype/src/cache/ftcsbits.c | 92 +- src/3rdparty/freetype/src/cache/ftcsbits.h | 32 +- src/3rdparty/freetype/src/cache/rules.mk | 4 +- src/3rdparty/freetype/src/cff/Jamfile | 2 +- src/3rdparty/freetype/src/cff/cff.c | 33 +- src/3rdparty/freetype/src/cff/cffcmap.c | 35 +- src/3rdparty/freetype/src/cff/cffcmap.h | 32 +- src/3rdparty/freetype/src/cff/cffdrivr.c | 326 +- src/3rdparty/freetype/src/cff/cffdrivr.h | 34 +- src/3rdparty/freetype/src/cff/cfferrs.h | 46 +- src/3rdparty/freetype/src/cff/cffgload.c | 64 +- src/3rdparty/freetype/src/cff/cffgload.h | 32 +- src/3rdparty/freetype/src/cff/cffload.c | 61 +- src/3rdparty/freetype/src/cff/cffload.h | 32 +- src/3rdparty/freetype/src/cff/cffobjs.c | 118 +- src/3rdparty/freetype/src/cff/cffobjs.h | 48 +- src/3rdparty/freetype/src/cff/cffparse.c | 444 +-- src/3rdparty/freetype/src/cff/cffparse.h | 55 +- src/3rdparty/freetype/src/cff/cfftoken.h | 32 +- src/3rdparty/freetype/src/cff/module.mk | 2 +- src/3rdparty/freetype/src/cff/rules.mk | 5 +- src/3rdparty/freetype/src/cid/Jamfile | 2 +- src/3rdparty/freetype/src/cid/ciderrs.h | 46 +- src/3rdparty/freetype/src/cid/cidgload.c | 49 +- src/3rdparty/freetype/src/cid/cidgload.h | 32 +- src/3rdparty/freetype/src/cid/cidload.c | 185 +- src/3rdparty/freetype/src/cid/cidload.h | 32 +- src/3rdparty/freetype/src/cid/cidobjs.c | 204 +- src/3rdparty/freetype/src/cid/cidobjs.h | 116 +- src/3rdparty/freetype/src/cid/cidparse.c | 46 +- src/3rdparty/freetype/src/cid/cidparse.h | 108 +- src/3rdparty/freetype/src/cid/cidriver.c | 56 +- src/3rdparty/freetype/src/cid/cidriver.h | 38 +- src/3rdparty/freetype/src/cid/cidtoken.h | 57 +- src/3rdparty/freetype/src/cid/module.mk | 2 +- src/3rdparty/freetype/src/cid/rules.mk | 2 +- src/3rdparty/freetype/src/cid/type1cid.c | 32 +- src/3rdparty/freetype/src/gxvalid/Jamfile | 2 +- src/3rdparty/freetype/src/gxvalid/README | 2 +- src/3rdparty/freetype/src/gxvalid/gxvalid.c | 34 +- src/3rdparty/freetype/src/gxvalid/gxvalid.h | 50 +- src/3rdparty/freetype/src/gxvalid/gxvbsln.c | 64 +- src/3rdparty/freetype/src/gxvalid/gxvcommn.c | 68 +- src/3rdparty/freetype/src/gxvalid/gxvcommn.h | 60 +- src/3rdparty/freetype/src/gxvalid/gxverror.h | 66 +- src/3rdparty/freetype/src/gxvalid/gxvfeat.c | 64 +- src/3rdparty/freetype/src/gxvalid/gxvfeat.h | 50 +- src/3rdparty/freetype/src/gxvalid/gxvfgen.c | 114 +- src/3rdparty/freetype/src/gxvalid/gxvjust.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvkern.c | 64 +- src/3rdparty/freetype/src/gxvalid/gxvlcar.c | 64 +- src/3rdparty/freetype/src/gxvalid/gxvmod.c | 64 +- src/3rdparty/freetype/src/gxvalid/gxvmod.h | 56 +- src/3rdparty/freetype/src/gxvalid/gxvmort.c | 65 +- src/3rdparty/freetype/src/gxvalid/gxvmort.h | 50 +- src/3rdparty/freetype/src/gxvalid/gxvmort0.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmort1.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmort2.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmort4.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmort5.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmorx.c | 64 +- src/3rdparty/freetype/src/gxvalid/gxvmorx.h | 50 +- src/3rdparty/freetype/src/gxvalid/gxvmorx0.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmorx1.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmorx2.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmorx4.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvmorx5.c | 66 +- src/3rdparty/freetype/src/gxvalid/gxvopbd.c | 64 +- src/3rdparty/freetype/src/gxvalid/gxvprop.c | 64 +- src/3rdparty/freetype/src/gxvalid/gxvtrak.c | 64 +- src/3rdparty/freetype/src/gxvalid/module.mk | 2 +- src/3rdparty/freetype/src/gxvalid/rules.mk | 2 +- src/3rdparty/freetype/src/gzip/Jamfile | 2 +- src/3rdparty/freetype/src/gzip/ftgzip.c | 64 +- src/3rdparty/freetype/src/gzip/infblock.c | 5 + src/3rdparty/freetype/src/gzip/infcodes.c | 4 + src/3rdparty/freetype/src/gzip/inflate.c | 10 + src/3rdparty/freetype/src/gzip/rules.mk | 2 +- src/3rdparty/freetype/src/lzw/Jamfile | 2 +- src/3rdparty/freetype/src/lzw/ftlzw.c | 56 +- src/3rdparty/freetype/src/lzw/ftzopen.c | 48 +- src/3rdparty/freetype/src/lzw/ftzopen.h | 116 +- src/3rdparty/freetype/src/lzw/rules.mk | 2 +- src/3rdparty/freetype/src/otvalid/Jamfile | 2 +- src/3rdparty/freetype/src/otvalid/module.mk | 2 +- src/3rdparty/freetype/src/otvalid/otvalid.c | 32 +- src/3rdparty/freetype/src/otvalid/otvalid.h | 32 +- src/3rdparty/freetype/src/otvalid/otvbase.c | 46 +- src/3rdparty/freetype/src/otvalid/otvcommn.c | 46 +- src/3rdparty/freetype/src/otvalid/otvcommn.h | 32 +- src/3rdparty/freetype/src/otvalid/otverror.h | 48 +- src/3rdparty/freetype/src/otvalid/otvgdef.c | 46 +- src/3rdparty/freetype/src/otvalid/otvgpos.c | 46 +- src/3rdparty/freetype/src/otvalid/otvgpos.h | 32 +- src/3rdparty/freetype/src/otvalid/otvgsub.c | 46 +- src/3rdparty/freetype/src/otvalid/otvjstf.c | 46 +- src/3rdparty/freetype/src/otvalid/otvmath.c | 50 +- src/3rdparty/freetype/src/otvalid/otvmod.c | 46 +- src/3rdparty/freetype/src/otvalid/otvmod.h | 38 +- src/3rdparty/freetype/src/otvalid/rules.mk | 2 +- src/3rdparty/freetype/src/pcf/Jamfile | 2 +- src/3rdparty/freetype/src/pcf/pcf.h | 59 +- src/3rdparty/freetype/src/pcf/pcfdrivr.c | 163 +- src/3rdparty/freetype/src/pcf/pcfdrivr.h | 5 +- src/3rdparty/freetype/src/pcf/pcferror.h | 46 +- src/3rdparty/freetype/src/pcf/pcfread.c | 407 ++- src/3rdparty/freetype/src/pcf/pcfutil.c | 6 +- src/3rdparty/freetype/src/pfr/Jamfile | 2 +- src/3rdparty/freetype/src/pfr/module.mk | 2 +- src/3rdparty/freetype/src/pfr/pfr.c | 32 +- src/3rdparty/freetype/src/pfr/pfrcmap.c | 32 +- src/3rdparty/freetype/src/pfr/pfrcmap.h | 32 +- src/3rdparty/freetype/src/pfr/pfrdrivr.c | 48 +- src/3rdparty/freetype/src/pfr/pfrdrivr.h | 38 +- src/3rdparty/freetype/src/pfr/pfrerror.h | 46 +- src/3rdparty/freetype/src/pfr/pfrgload.c | 52 +- src/3rdparty/freetype/src/pfr/pfrgload.h | 32 +- src/3rdparty/freetype/src/pfr/pfrload.c | 162 +- src/3rdparty/freetype/src/pfr/pfrload.h | 32 +- src/3rdparty/freetype/src/pfr/pfrobjs.c | 40 +- src/3rdparty/freetype/src/pfr/pfrobjs.h | 32 +- src/3rdparty/freetype/src/pfr/pfrsbit.c | 34 +- src/3rdparty/freetype/src/pfr/pfrsbit.h | 32 +- src/3rdparty/freetype/src/pfr/pfrtypes.h | 32 +- src/3rdparty/freetype/src/pfr/rules.mk | 2 +- src/3rdparty/freetype/src/psaux/Jamfile | 2 +- src/3rdparty/freetype/src/psaux/afmparse.c | 59 +- src/3rdparty/freetype/src/psaux/afmparse.h | 32 +- src/3rdparty/freetype/src/psaux/cffdecode.c | 300 +- src/3rdparty/freetype/src/psaux/cffdecode.h | 32 +- src/3rdparty/freetype/src/psaux/module.mk | 2 +- src/3rdparty/freetype/src/psaux/psarrst.c | 72 +- src/3rdparty/freetype/src/psaux/psarrst.h | 72 +- src/3rdparty/freetype/src/psaux/psaux.c | 32 +- src/3rdparty/freetype/src/psaux/psauxerr.h | 48 +- src/3rdparty/freetype/src/psaux/psauxmod.c | 32 +- src/3rdparty/freetype/src/psaux/psauxmod.h | 36 +- src/3rdparty/freetype/src/psaux/psblues.c | 100 +- src/3rdparty/freetype/src/psaux/psblues.h | 72 +- src/3rdparty/freetype/src/psaux/psconv.c | 46 +- src/3rdparty/freetype/src/psaux/psconv.h | 32 +- src/3rdparty/freetype/src/psaux/pserror.c | 72 +- src/3rdparty/freetype/src/psaux/pserror.h | 72 +- src/3rdparty/freetype/src/psaux/psfixed.h | 75 +- src/3rdparty/freetype/src/psaux/psfont.c | 82 +- src/3rdparty/freetype/src/psaux/psfont.h | 72 +- src/3rdparty/freetype/src/psaux/psft.c | 95 +- src/3rdparty/freetype/src/psaux/psft.h | 72 +- src/3rdparty/freetype/src/psaux/psglue.h | 72 +- src/3rdparty/freetype/src/psaux/pshints.c | 117 +- src/3rdparty/freetype/src/psaux/pshints.h | 72 +- src/3rdparty/freetype/src/psaux/psintrp.c | 148 +- src/3rdparty/freetype/src/psaux/psintrp.h | 72 +- src/3rdparty/freetype/src/psaux/psobjs.c | 486 +-- src/3rdparty/freetype/src/psaux/psobjs.h | 40 +- src/3rdparty/freetype/src/psaux/psread.c | 74 +- src/3rdparty/freetype/src/psaux/psread.h | 72 +- src/3rdparty/freetype/src/psaux/psstack.c | 75 +- src/3rdparty/freetype/src/psaux/psstack.h | 72 +- src/3rdparty/freetype/src/psaux/pstypes.h | 72 +- src/3rdparty/freetype/src/psaux/rules.mk | 2 +- src/3rdparty/freetype/src/psaux/t1cmap.c | 35 +- src/3rdparty/freetype/src/psaux/t1cmap.h | 32 +- src/3rdparty/freetype/src/psaux/t1decode.c | 341 +- src/3rdparty/freetype/src/psaux/t1decode.h | 32 +- src/3rdparty/freetype/src/pshinter/Jamfile | 2 +- src/3rdparty/freetype/src/pshinter/module.mk | 2 +- src/3rdparty/freetype/src/pshinter/pshalgo.c | 50 +- src/3rdparty/freetype/src/pshinter/pshalgo.h | 32 +- src/3rdparty/freetype/src/pshinter/pshglob.c | 39 +- src/3rdparty/freetype/src/pshinter/pshglob.h | 68 +- src/3rdparty/freetype/src/pshinter/pshinter.c | 33 +- src/3rdparty/freetype/src/pshinter/pshmod.c | 35 +- src/3rdparty/freetype/src/pshinter/pshmod.h | 32 +- src/3rdparty/freetype/src/pshinter/pshnterr.h | 46 +- src/3rdparty/freetype/src/pshinter/pshrec.c | 38 +- src/3rdparty/freetype/src/pshinter/pshrec.h | 56 +- src/3rdparty/freetype/src/pshinter/rules.mk | 3 +- src/3rdparty/freetype/src/psnames/Jamfile | 2 +- src/3rdparty/freetype/src/psnames/module.mk | 2 +- src/3rdparty/freetype/src/psnames/psmodule.c | 73 +- src/3rdparty/freetype/src/psnames/psmodule.h | 32 +- src/3rdparty/freetype/src/psnames/psnamerr.h | 48 +- src/3rdparty/freetype/src/psnames/psnames.c | 33 +- src/3rdparty/freetype/src/psnames/pstables.h | 44 +- src/3rdparty/freetype/src/psnames/rules.mk | 21 +- src/3rdparty/freetype/src/raster/Jamfile | 2 +- src/3rdparty/freetype/src/raster/ftmisc.h | 50 +- src/3rdparty/freetype/src/raster/ftraster.c | 1285 +++---- src/3rdparty/freetype/src/raster/ftraster.h | 42 +- src/3rdparty/freetype/src/raster/ftrend1.c | 41 +- src/3rdparty/freetype/src/raster/ftrend1.h | 32 +- src/3rdparty/freetype/src/raster/module.mk | 2 +- src/3rdparty/freetype/src/raster/raster.c | 33 +- src/3rdparty/freetype/src/raster/rasterrs.h | 48 +- src/3rdparty/freetype/src/raster/rules.mk | 5 +- src/3rdparty/freetype/src/sfnt/Jamfile | 4 +- src/3rdparty/freetype/src/sfnt/module.mk | 2 +- src/3rdparty/freetype/src/sfnt/pngshim.c | 35 +- src/3rdparty/freetype/src/sfnt/pngshim.h | 34 +- src/3rdparty/freetype/src/sfnt/rules.mk | 22 +- src/3rdparty/freetype/src/sfnt/sfdriver.c | 259 +- src/3rdparty/freetype/src/sfnt/sfdriver.h | 34 +- src/3rdparty/freetype/src/sfnt/sferrors.h | 46 +- src/3rdparty/freetype/src/sfnt/sfnt.c | 37 +- src/3rdparty/freetype/src/sfnt/sfobjs.c | 654 +--- src/3rdparty/freetype/src/sfnt/sfobjs.h | 34 +- src/3rdparty/freetype/src/sfnt/sfwoff.c | 434 +++ src/3rdparty/freetype/src/sfnt/sfwoff.h | 41 + src/3rdparty/freetype/src/sfnt/ttbdf.c | 54 +- src/3rdparty/freetype/src/sfnt/ttbdf.h | 32 +- src/3rdparty/freetype/src/sfnt/ttcmap.c | 656 ++-- src/3rdparty/freetype/src/sfnt/ttcmap.h | 70 +- src/3rdparty/freetype/src/sfnt/ttcmapc.h | 32 +- src/3rdparty/freetype/src/sfnt/ttcolr.c | 451 +++ src/3rdparty/freetype/src/sfnt/ttcolr.h | 58 + src/3rdparty/freetype/src/sfnt/ttcpal.c | 311 ++ src/3rdparty/freetype/src/sfnt/ttcpal.h | 49 + src/3rdparty/freetype/src/sfnt/ttkern.c | 56 +- src/3rdparty/freetype/src/sfnt/ttkern.h | 34 +- src/3rdparty/freetype/src/sfnt/ttload.c | 569 +-- src/3rdparty/freetype/src/sfnt/ttload.h | 34 +- src/3rdparty/freetype/src/sfnt/ttmtx.c | 187 +- src/3rdparty/freetype/src/sfnt/ttmtx.h | 32 +- src/3rdparty/freetype/src/sfnt/ttpost.c | 117 +- src/3rdparty/freetype/src/sfnt/ttpost.h | 34 +- src/3rdparty/freetype/src/sfnt/ttsbit.c | 64 +- src/3rdparty/freetype/src/sfnt/ttsbit.h | 32 +- src/3rdparty/freetype/src/smooth/Jamfile | 2 +- src/3rdparty/freetype/src/smooth/ftgrays.c | 724 ++-- src/3rdparty/freetype/src/smooth/ftgrays.h | 49 +- src/3rdparty/freetype/src/smooth/ftsmerrs.h | 48 +- src/3rdparty/freetype/src/smooth/ftsmooth.c | 127 +- src/3rdparty/freetype/src/smooth/ftsmooth.h | 32 +- src/3rdparty/freetype/src/smooth/module.mk | 2 +- src/3rdparty/freetype/src/smooth/rules.mk | 5 +- src/3rdparty/freetype/src/smooth/smooth.c | 33 +- src/3rdparty/freetype/src/tools/afblue.pl | 2 +- src/3rdparty/freetype/src/tools/apinames.c | 441 +-- src/3rdparty/freetype/src/tools/glnames.py | 50 +- .../freetype/src/tools/update-copyright-year | 19 +- src/3rdparty/freetype/src/truetype/Jamfile | 2 +- src/3rdparty/freetype/src/truetype/module.mk | 2 +- src/3rdparty/freetype/src/truetype/rules.mk | 3 +- src/3rdparty/freetype/src/truetype/truetype.c | 33 +- src/3rdparty/freetype/src/truetype/ttdriver.c | 224 +- src/3rdparty/freetype/src/truetype/ttdriver.h | 34 +- src/3rdparty/freetype/src/truetype/tterrors.h | 48 +- src/3rdparty/freetype/src/truetype/ttgload.c | 555 +-- src/3rdparty/freetype/src/truetype/ttgload.h | 32 +- src/3rdparty/freetype/src/truetype/ttgxvar.c | 1436 ++++---- src/3rdparty/freetype/src/truetype/ttgxvar.h | 313 +- src/3rdparty/freetype/src/truetype/ttinterp.c | 3609 ++++++++++---------- src/3rdparty/freetype/src/truetype/ttinterp.h | 168 +- src/3rdparty/freetype/src/truetype/ttobjs.c | 493 +-- src/3rdparty/freetype/src/truetype/ttobjs.h | 312 +- src/3rdparty/freetype/src/truetype/ttpload.c | 244 +- src/3rdparty/freetype/src/truetype/ttpload.h | 32 +- src/3rdparty/freetype/src/truetype/ttsubpix.c | 90 +- src/3rdparty/freetype/src/truetype/ttsubpix.h | 52 +- src/3rdparty/freetype/src/type1/Jamfile | 2 +- src/3rdparty/freetype/src/type1/module.mk | 2 +- src/3rdparty/freetype/src/type1/rules.mk | 2 +- src/3rdparty/freetype/src/type1/t1afm.c | 46 +- src/3rdparty/freetype/src/type1/t1afm.h | 32 +- src/3rdparty/freetype/src/type1/t1driver.c | 217 +- src/3rdparty/freetype/src/type1/t1driver.h | 38 +- src/3rdparty/freetype/src/type1/t1errors.h | 46 +- src/3rdparty/freetype/src/type1/t1gload.c | 77 +- src/3rdparty/freetype/src/type1/t1gload.h | 32 +- src/3rdparty/freetype/src/type1/t1load.c | 451 ++- src/3rdparty/freetype/src/type1/t1load.h | 42 +- src/3rdparty/freetype/src/type1/t1objs.c | 213 +- src/3rdparty/freetype/src/type1/t1objs.h | 132 +- src/3rdparty/freetype/src/type1/t1parse.c | 110 +- src/3rdparty/freetype/src/type1/t1parse.h | 101 +- src/3rdparty/freetype/src/type1/t1tokens.h | 32 +- src/3rdparty/freetype/src/type1/type1.c | 32 +- src/3rdparty/freetype/src/type42/Jamfile | 2 +- src/3rdparty/freetype/src/type42/module.mk | 2 +- src/3rdparty/freetype/src/type42/rules.mk | 2 +- src/3rdparty/freetype/src/type42/t42drivr.c | 86 +- src/3rdparty/freetype/src/type42/t42drivr.h | 38 +- src/3rdparty/freetype/src/type42/t42error.h | 46 +- src/3rdparty/freetype/src/type42/t42objs.c | 87 +- src/3rdparty/freetype/src/type42/t42objs.h | 32 +- src/3rdparty/freetype/src/type42/t42parse.c | 100 +- src/3rdparty/freetype/src/type42/t42parse.h | 32 +- src/3rdparty/freetype/src/type42/t42types.h | 32 +- src/3rdparty/freetype/src/type42/type42.c | 32 +- src/3rdparty/freetype/src/winfonts/Jamfile | 2 +- src/3rdparty/freetype/src/winfonts/fnterrs.h | 48 +- src/3rdparty/freetype/src/winfonts/module.mk | 2 +- src/3rdparty/freetype/src/winfonts/rules.mk | 2 +- src/3rdparty/freetype/src/winfonts/winfnt.c | 58 +- src/3rdparty/freetype/src/winfonts/winfnt.h | 40 +- 405 files changed, 19968 insertions(+), 17087 deletions(-) create mode 100644 src/3rdparty/freetype/src/base/ftcolor.c create mode 100644 src/3rdparty/freetype/src/base/fterrors.c create mode 100644 src/3rdparty/freetype/src/sfnt/sfwoff.c create mode 100644 src/3rdparty/freetype/src/sfnt/sfwoff.h create mode 100644 src/3rdparty/freetype/src/sfnt/ttcolr.c create mode 100644 src/3rdparty/freetype/src/sfnt/ttcolr.h create mode 100644 src/3rdparty/freetype/src/sfnt/ttcpal.c create mode 100644 src/3rdparty/freetype/src/sfnt/ttcpal.h (limited to 'src/3rdparty/freetype/src') diff --git a/src/3rdparty/freetype/src/Jamfile b/src/3rdparty/freetype/src/Jamfile index 562480c94a..3ad2d5c962 100644 --- a/src/3rdparty/freetype/src/Jamfile +++ b/src/3rdparty/freetype/src/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/autofit/Jamfile b/src/3rdparty/freetype/src/autofit/Jamfile index 01b866ec61..ea69dee377 100644 --- a/src/3rdparty/freetype/src/autofit/Jamfile +++ b/src/3rdparty/freetype/src/autofit/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/autofit Jamfile # -# Copyright 2003-2018 by +# Copyright (C) 2003-2019 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/src/3rdparty/freetype/src/autofit/afangles.c b/src/3rdparty/freetype/src/autofit/afangles.c index c65a3ae23e..9e1f7a21ff 100644 --- a/src/3rdparty/freetype/src/autofit/afangles.c +++ b/src/3rdparty/freetype/src/autofit/afangles.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* afangles.c */ -/* */ -/* Routines used to compute vector angles with limited accuracy */ -/* and very high speed. It also contains sorting routines (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afangles.c + * + * Routines used to compute vector angles with limited accuracy + * and very high speed. It also contains sorting routines (body). + * + * Copyright (C) 2003-2019 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... + * We are not using `af_angle_atan' anymore, but we keep the source + * code below just in case... */ @@ -30,16 +30,16 @@ /* - * 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 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 + * The approximation * - * dy * PI / (|dx|+|dy|) + * dy * PI / (|dx|+|dy|) * - * should be enough, and much faster to compute. + * should be enough, and much faster to compute. */ FT_LOCAL_DEF( AF_Angle ) af_angle_atan( FT_Fixed dx, diff --git a/src/3rdparty/freetype/src/autofit/afangles.h b/src/3rdparty/freetype/src/autofit/afangles.h index f33f9e108e..18d7dae3a6 100644 --- a/src/3rdparty/freetype/src/autofit/afangles.h +++ b/src/3rdparty/freetype/src/autofit/afangles.h @@ -1,7 +1,7 @@ /* - * afangles.h + * afangles.h * - * This is a dummy file, used to please the build system. It is never - * included by the auto-fitter sources. + * This is a dummy file, used to please the build system. It is never + * included by the auto-fitter sources. * */ diff --git a/src/3rdparty/freetype/src/autofit/afblue.c b/src/3rdparty/freetype/src/autofit/afblue.c index e4078fd044..b99dbeb19c 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.c +++ b/src/3rdparty/freetype/src/autofit/afblue.c @@ -1,22 +1,22 @@ /* This file has been generated by the Perl script `afblue.pl', */ /* using data from file `afblue.dat'. */ -/***************************************************************************/ -/* */ -/* afblue.c */ -/* */ -/* Auto-fitter data for blue strings (body). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afblue.c + * + * Auto-fitter data for blue strings (body). + * + * Copyright (C) 2013-2019 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" @@ -296,6 +296,10 @@ '\0', '\xE0', '\xB4', '\x9F', ' ', '\xE0', '\xB4', '\xA0', ' ', '\xE0', '\xB4', '\xA7', ' ', '\xE0', '\xB4', '\xB6', ' ', '\xE0', '\xB4', '\x98', ' ', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xA5', ' ', '\xE0', '\xB4', '\xB2', /* ട ഠ ധ ശ ഘ ച ഥ ല */ '\0', + '\xE1', '\xA0', '\xB3', ' ', '\xE1', '\xA0', '\xB4', ' ', '\xE1', '\xA0', '\xB6', ' ', '\xE1', '\xA0', '\xBD', ' ', '\xE1', '\xA1', '\x82', ' ', '\xE1', '\xA1', '\x8A', ' ', '\xE2', '\x80', '\x8D', '\xE1', '\xA1', '\xA1', '\xE2', '\x80', '\x8D', ' ', '\xE2', '\x80', '\x8D', '\xE1', '\xA1', '\xB3', '\xE2', '\x80', '\x8D', /* ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ‍ᡡ‍ ‍ᡳ‍ */ + '\0', + '\xE1', '\xA1', '\x83', /* ᡃ */ + '\0', '\xE1', '\x80', '\x81', ' ', '\xE1', '\x80', '\x82', ' ', '\xE1', '\x80', '\x84', ' ', '\xE1', '\x80', '\x92', ' ', '\xE1', '\x80', '\x9D', ' ', '\xE1', '\x81', '\xA5', ' ', '\xE1', '\x81', '\x8A', ' ', '\xE1', '\x81', '\x8B', /* ခ ဂ င ဒ ဝ ၥ ၊ ။ */ '\0', '\xE1', '\x80', '\x84', ' ', '\xE1', '\x80', '\x8E', ' ', '\xE1', '\x80', '\x92', ' ', '\xE1', '\x80', '\x95', ' ', '\xE1', '\x80', '\x97', ' ', '\xE1', '\x80', '\x9D', ' ', '\xE1', '\x81', '\x8A', ' ', '\xE1', '\x81', '\x8B', /* င ဎ ဒ ပ ဗ ဝ ၊ ။ */ @@ -649,6 +653,9 @@ { AF_BLUE_STRING_MALAYALAM_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MYANMAR_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_MYANMAR_BOTTOM, 0 }, diff --git a/src/3rdparty/freetype/src/autofit/afblue.cin b/src/3rdparty/freetype/src/autofit/afblue.cin index 4913e2eb6f..6545d1fd43 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.cin +++ b/src/3rdparty/freetype/src/autofit/afblue.cin @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afblue.c */ -/* */ -/* Auto-fitter data for blue strings (body). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afblue.c + * + * Auto-fitter data for blue strings (body). + * + * Copyright (C) 2013-2019 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" diff --git a/src/3rdparty/freetype/src/autofit/afblue.dat b/src/3rdparty/freetype/src/autofit/afblue.dat index bc2f0d2754..46db43fe22 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.dat +++ b/src/3rdparty/freetype/src/autofit/afblue.dat @@ -1,15 +1,15 @@ -// afblue.dat +// afblue.dat // -// Auto-fitter data for blue strings. +// Auto-fitter data for blue strings. // -// Copyright 2013-2018 by -// David Turner, Robert Wilhelm, and Werner Lemberg. +// Copyright (C) 2013-2019 by +// David Turner, Robert Wilhelm, and Werner Lemberg. // -// This file is part of the FreeType project, and may only be used, -// modified, and distributed under the terms of the FreeType project -// license, LICENSE.TXT. By continuing to use, modify, or distribute -// this file you indicate that you have read the license and -// understand and accept it fully. +// This 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 data specific to blue zones. It gets processed by @@ -392,6 +392,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_MALAYALAM_BOTTOM "ട ഠ ധ ശ ഘ ച ഥ ല" + AF_BLUE_STRING_MONGOLIAN_TOP_BASE + "ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ‍ᡡ‍ ‍ᡳ‍" + AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE + "ᡃ" + AF_BLUE_STRING_MYANMAR_TOP "ခ ဂ င ဒ ဝ ၥ ၊ ။" AF_BLUE_STRING_MYANMAR_BOTTOM @@ -947,6 +952,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_MONG + { AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_MYMR { AF_BLUE_STRING_MYANMAR_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } diff --git a/src/3rdparty/freetype/src/autofit/afblue.h b/src/3rdparty/freetype/src/autofit/afblue.h index de31e259c3..b69b1df521 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.h +++ b/src/3rdparty/freetype/src/autofit/afblue.h @@ -1,22 +1,22 @@ /* This file has been generated by the Perl script `afblue.pl', */ /* using data from file `afblue.dat'. */ -/***************************************************************************/ -/* */ -/* afblue.h */ -/* */ -/* Auto-fitter data for blue strings (specification). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afblue.h + * + * Auto-fitter data for blue strings (specification). + * + * Copyright (C) 2013-2019 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 AFBLUE_H_ @@ -212,56 +212,58 @@ FT_BEGIN_HEADER AF_BLUE_STRING_LISU_BOTTOM = 3506, AF_BLUE_STRING_MALAYALAM_TOP = 3538, AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582, - AF_BLUE_STRING_MYANMAR_TOP = 3614, - AF_BLUE_STRING_MYANMAR_BOTTOM = 3646, - AF_BLUE_STRING_MYANMAR_ASCENDER = 3678, - AF_BLUE_STRING_MYANMAR_DESCENDER = 3706, - AF_BLUE_STRING_NKO_TOP = 3738, - AF_BLUE_STRING_NKO_BOTTOM = 3762, - AF_BLUE_STRING_NKO_SMALL_TOP = 3777, - AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3786, - AF_BLUE_STRING_OL_CHIKI = 3798, - AF_BLUE_STRING_OLD_TURKIC_TOP = 3822, - AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3837, - AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3857, - AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3897, - AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3927, - AF_BLUE_STRING_OSAGE_SMALL_TOP = 3942, - AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3982, - AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4022, - AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4047, - AF_BLUE_STRING_OSMANYA_TOP = 4062, - AF_BLUE_STRING_OSMANYA_BOTTOM = 4102, - AF_BLUE_STRING_SAURASHTRA_TOP = 4142, - AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4174, - AF_BLUE_STRING_SHAVIAN_TOP = 4194, - AF_BLUE_STRING_SHAVIAN_BOTTOM = 4204, - AF_BLUE_STRING_SHAVIAN_DESCENDER = 4229, - AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4239, - AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4274, - AF_BLUE_STRING_SINHALA_TOP = 4289, - AF_BLUE_STRING_SINHALA_BOTTOM = 4321, - AF_BLUE_STRING_SINHALA_DESCENDER = 4353, - AF_BLUE_STRING_SUNDANESE_TOP = 4397, - AF_BLUE_STRING_SUNDANESE_BOTTOM = 4421, - AF_BLUE_STRING_SUNDANESE_DESCENDER = 4453, - AF_BLUE_STRING_TAI_VIET_TOP = 4461, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 4481, - AF_BLUE_STRING_TAMIL_TOP = 4493, - AF_BLUE_STRING_TAMIL_BOTTOM = 4525, - AF_BLUE_STRING_TELUGU_TOP = 4557, - AF_BLUE_STRING_TELUGU_BOTTOM = 4585, - AF_BLUE_STRING_THAI_TOP = 4613, - AF_BLUE_STRING_THAI_BOTTOM = 4637, - AF_BLUE_STRING_THAI_ASCENDER = 4665, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4677, - AF_BLUE_STRING_THAI_DESCENDER = 4689, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4705, - AF_BLUE_STRING_THAI_DIGIT_TOP = 4713, - AF_BLUE_STRING_TIFINAGH = 4725, - AF_BLUE_STRING_VAI_TOP = 4757, - AF_BLUE_STRING_VAI_BOTTOM = 4789, - af_blue_1_1 = 4820, + AF_BLUE_STRING_MONGOLIAN_TOP_BASE = 3614, + AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE = 3658, + AF_BLUE_STRING_MYANMAR_TOP = 3662, + AF_BLUE_STRING_MYANMAR_BOTTOM = 3694, + AF_BLUE_STRING_MYANMAR_ASCENDER = 3726, + AF_BLUE_STRING_MYANMAR_DESCENDER = 3754, + AF_BLUE_STRING_NKO_TOP = 3786, + AF_BLUE_STRING_NKO_BOTTOM = 3810, + AF_BLUE_STRING_NKO_SMALL_TOP = 3825, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3834, + AF_BLUE_STRING_OL_CHIKI = 3846, + AF_BLUE_STRING_OLD_TURKIC_TOP = 3870, + AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3885, + AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3905, + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3945, + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3975, + AF_BLUE_STRING_OSAGE_SMALL_TOP = 3990, + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 4030, + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4070, + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4095, + AF_BLUE_STRING_OSMANYA_TOP = 4110, + AF_BLUE_STRING_OSMANYA_BOTTOM = 4150, + AF_BLUE_STRING_SAURASHTRA_TOP = 4190, + AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4222, + AF_BLUE_STRING_SHAVIAN_TOP = 4242, + AF_BLUE_STRING_SHAVIAN_BOTTOM = 4252, + AF_BLUE_STRING_SHAVIAN_DESCENDER = 4277, + AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4287, + AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4322, + AF_BLUE_STRING_SINHALA_TOP = 4337, + AF_BLUE_STRING_SINHALA_BOTTOM = 4369, + AF_BLUE_STRING_SINHALA_DESCENDER = 4401, + AF_BLUE_STRING_SUNDANESE_TOP = 4445, + AF_BLUE_STRING_SUNDANESE_BOTTOM = 4469, + AF_BLUE_STRING_SUNDANESE_DESCENDER = 4501, + AF_BLUE_STRING_TAI_VIET_TOP = 4509, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 4529, + AF_BLUE_STRING_TAMIL_TOP = 4541, + AF_BLUE_STRING_TAMIL_BOTTOM = 4573, + AF_BLUE_STRING_TELUGU_TOP = 4605, + AF_BLUE_STRING_TELUGU_BOTTOM = 4633, + AF_BLUE_STRING_THAI_TOP = 4661, + AF_BLUE_STRING_THAI_BOTTOM = 4685, + AF_BLUE_STRING_THAI_ASCENDER = 4713, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4725, + AF_BLUE_STRING_THAI_DESCENDER = 4737, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4753, + AF_BLUE_STRING_THAI_DIGIT_TOP = 4761, + AF_BLUE_STRING_TIFINAGH = 4773, + AF_BLUE_STRING_VAI_TOP = 4805, + AF_BLUE_STRING_VAI_BOTTOM = 4837, + af_blue_1_1 = 4868, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -355,24 +357,25 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_LATP = 166, AF_BLUE_STRINGSET_LISU = 173, AF_BLUE_STRINGSET_MLYM = 176, - AF_BLUE_STRINGSET_MYMR = 179, - AF_BLUE_STRINGSET_NKOO = 184, - AF_BLUE_STRINGSET_NONE = 189, - AF_BLUE_STRINGSET_OLCK = 190, - AF_BLUE_STRINGSET_ORKH = 193, - AF_BLUE_STRINGSET_OSGE = 196, - AF_BLUE_STRINGSET_OSMA = 204, - AF_BLUE_STRINGSET_SAUR = 207, - AF_BLUE_STRINGSET_SHAW = 210, - AF_BLUE_STRINGSET_SINH = 216, - AF_BLUE_STRINGSET_SUND = 220, - AF_BLUE_STRINGSET_TAML = 224, - AF_BLUE_STRINGSET_TAVT = 227, - AF_BLUE_STRINGSET_TELU = 230, - AF_BLUE_STRINGSET_TFNG = 233, - AF_BLUE_STRINGSET_THAI = 236, - AF_BLUE_STRINGSET_VAII = 244, - af_blue_2_1 = 247, + AF_BLUE_STRINGSET_MONG = 179, + AF_BLUE_STRINGSET_MYMR = 182, + AF_BLUE_STRINGSET_NKOO = 187, + AF_BLUE_STRINGSET_NONE = 192, + AF_BLUE_STRINGSET_OLCK = 193, + AF_BLUE_STRINGSET_ORKH = 196, + AF_BLUE_STRINGSET_OSGE = 199, + AF_BLUE_STRINGSET_OSMA = 207, + AF_BLUE_STRINGSET_SAUR = 210, + AF_BLUE_STRINGSET_SHAW = 213, + AF_BLUE_STRINGSET_SINH = 219, + AF_BLUE_STRINGSET_SUND = 223, + AF_BLUE_STRINGSET_TAML = 227, + AF_BLUE_STRINGSET_TAVT = 230, + AF_BLUE_STRINGSET_TELU = 233, + AF_BLUE_STRINGSET_TFNG = 236, + AF_BLUE_STRINGSET_THAI = 239, + AF_BLUE_STRINGSET_VAII = 247, + af_blue_2_1 = 250, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/3rdparty/freetype/src/autofit/afblue.hin b/src/3rdparty/freetype/src/autofit/afblue.hin index 682147cb30..30a28dafa5 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.hin +++ b/src/3rdparty/freetype/src/autofit/afblue.hin @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afblue.h */ -/* */ -/* Auto-fitter data for blue strings (specification). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afblue.h + * + * Auto-fitter data for blue strings (specification). + * + * Copyright (C) 2013-2019 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 AFBLUE_H_ diff --git a/src/3rdparty/freetype/src/autofit/afcjk.c b/src/3rdparty/freetype/src/autofit/afcjk.c index 21b6bffa33..a61689bee3 100644 --- a/src/3rdparty/freetype/src/autofit/afcjk.c +++ b/src/3rdparty/freetype/src/autofit/afcjk.c @@ -1,24 +1,24 @@ -/***************************************************************************/ -/* */ -/* afcjk.c */ -/* */ -/* Auto-fitter hinting routines for CJK writing system (body). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afcjk.c + * + * Auto-fitter hinting routines for CJK writing system (body). + * + * Copyright (C) 2006-2019 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 algorithm is based on akito's autohint patch, archived at + * The algorithm is based on akito's autohint patch, archived at * - * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/ + * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/ * */ @@ -27,7 +27,6 @@ #include FT_INTERNAL_DEBUG_H #include "afglobal.h" -#include "afpic.h" #include "aflatin.h" #include "afcjk.h" @@ -44,14 +43,14 @@ #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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_afcjk +#define FT_COMPONENT afcjk /*************************************************************************/ @@ -92,23 +91,29 @@ AF_CJKMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = metrics->root.globals; -#endif - AF_StyleClass style_class = metrics->root.style_class; - AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET - [style_class->script]; + AF_ScriptClass script_class = af_script_classes[style_class->script]; + + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif - void* shaper_buf; const char* p; #ifdef FT_DEBUG_LEVEL_TRACE FT_ULong ch = 0; #endif - p = script_class->standard_charstring; + p = script_class->standard_charstring; + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif /* We check a list of standard characters. The first match wins. */ @@ -193,10 +198,10 @@ goto Exit; /* - * We assume that the glyphs selected for the stem width - * computation are `featureless' enough so that the linking - * algorithm works fine without adjustments of its scoring - * function. + * We assume that the glyphs selected for the stem width + * computation are `featureless' enough so that the linking + * algorithm works fine without adjustments of its scoring + * function. */ af_latin_hints_link_segments( hints, 0, @@ -296,7 +301,14 @@ AF_Blue_Stringset bss = sc->blue_stringset; const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; - void* shaper_buf; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif /* we walk over the blue character strings as specified in the */ @@ -307,7 +319,9 @@ "==========================\n" "\n" )); +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { @@ -483,8 +497,8 @@ if ( num_flats == 0 && num_fills == 0 ) { /* - * we couldn't find a single glyph to compute this blue zone, - * we will simply ignore it then + * we couldn't find a single glyph to compute this blue zone, + * we will simply ignore it then */ FT_TRACE5(( " empty\n" )); continue; @@ -565,15 +579,25 @@ FT_Bool started = 0, same_width = 1; FT_Fixed advance = 0, old_advance = 0; - void* shaper_buf; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif /* in all supported charmaps, digits have character codes 0x30-0x39 */ const char digits[] = "0 1 2 3 4 5 6 7 8 9"; const char* p; - p = digits; + p = digits; + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif while ( *p ) { @@ -890,11 +914,11 @@ } /* - * now compute the `serif' segments + * now compute the `serif' segments * - * In Hanzi, some strokes are wider on one or both of the ends. - * We either identify the stems on the ends as serifs or remove - * the linkage, depending on the length of the stems. + * In Hanzi, some strokes are wider on one or both of the ends. + * We either identify the stems on the ends as serifs or remove + * the linkage, depending on the length of the stems. * */ @@ -1000,21 +1024,21 @@ scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale : hints->y_scale; - /*********************************************************************/ - /* */ - /* We 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 is then processed in the second step to compute the */ - /* edge's properties. */ - /* */ - /* Note that the edges table is sorted along the segment/edge */ - /* position. */ - /* */ - /*********************************************************************/ + /********************************************************************** + * + * We 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 is then 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 ); @@ -1114,17 +1138,17 @@ } } - /******************************************************************/ - /* */ - /* Good, we now compute each edge's properties according to the */ - /* segments found on its position. Basically, these are */ - /* */ - /* - the 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 */ - /* */ - /******************************************************************/ + /******************************************************************* + * + * Good, we now compute each edge's properties according to the + * segments found on its position. Basically, these are + * + * - the 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 */ @@ -1160,6 +1184,8 @@ seg = edge->first; + if ( !seg ) + goto Skip_Loop; do { @@ -1174,7 +1200,7 @@ /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ - is_serif = (FT_Bool)( seg->serif && seg->serif->edge != edge ); + is_serif = FT_BOOL( seg->serif && seg->serif->edge != edge ); if ( seg->link || is_serif ) { @@ -1215,13 +1241,14 @@ edge2->flags |= AF_EDGE_SERIF; } else - edge->link = edge2; + edge->link = edge2; } seg = seg->edge_next; } while ( seg != edge->first ); + Skip_Loop: /* set the round/straight flags */ edge->flags = AF_EDGE_NORMAL; @@ -1364,8 +1391,8 @@ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics ); /* - * correct x_scale and y_scale when needed, since they may have - * been modified af_cjk_scale_dim above + * correct x_scale and y_scale when needed, since they may have + * been modified af_cjk_scale_dim above */ hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale; hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta; @@ -1384,21 +1411,21 @@ other_flags = 0; /* - * We snap the width of vertical stems for the monochrome and - * horizontal LCD rendering targets only. + * 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. + * 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. + * 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; @@ -2094,8 +2121,8 @@ goto Exit; /* - * now hint the remaining edges (serifs and single) in order - * to complete our processing + * now hint the remaining edges (serifs and single) in order + * to complete our processing */ for ( edge = edges; edge < edge_limit; edge++ ) { diff --git a/src/3rdparty/freetype/src/autofit/afcjk.h b/src/3rdparty/freetype/src/autofit/afcjk.h index d229c0c9cf..59acae5342 100644 --- a/src/3rdparty/freetype/src/autofit/afcjk.h +++ b/src/3rdparty/freetype/src/autofit/afcjk.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afcjk.h */ -/* */ -/* Auto-fitter hinting routines for CJK writing system (specification). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afcjk.h + * + * Auto-fitter hinting routines for CJK writing system (specification). + * + * Copyright (C) 2006-2019 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 AFCJK_H_ @@ -41,9 +41,9 @@ FT_BEGIN_HEADER /* - * CJK glyphs tend to fill the square. So we have both vertical and - * horizontal blue zones. But some glyphs have flat bounding strokes that - * leave some space between neighbour glyphs. + * CJK glyphs tend to fill the square. So we have both vertical and + * horizontal blue zones. But some glyphs have flat bounding strokes that + * leave some space between neighbour glyphs. */ #define AF_CJK_IS_TOP_BLUE( b ) \ diff --git a/src/3rdparty/freetype/src/autofit/afcover.h b/src/3rdparty/freetype/src/autofit/afcover.h index 6eeb8fc9fb..ff207a97e0 100644 --- a/src/3rdparty/freetype/src/autofit/afcover.h +++ b/src/3rdparty/freetype/src/autofit/afcover.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afcover.h */ -/* */ -/* Auto-fitter coverages (specification only). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afcover.h + * + * Auto-fitter coverages (specification only). + * + * Copyright (C) 2013-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ /* This header file can be included multiple times. */ diff --git a/src/3rdparty/freetype/src/autofit/afdummy.c b/src/3rdparty/freetype/src/autofit/afdummy.c index f30c517cbb..7e07a41e7d 100644 --- a/src/3rdparty/freetype/src/autofit/afdummy.c +++ b/src/3rdparty/freetype/src/autofit/afdummy.c @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* afdummy.c */ -/* */ -/* Auto-fitter dummy routines to be used if no hinting should be */ -/* performed (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afdummy.c + * + * Auto-fitter dummy routines to be used if no hinting should be + * performed (body). + * + * Copyright (C) 2003-2019 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 "afdummy.h" @@ -38,13 +38,15 @@ static FT_Error - af_dummy_hints_apply( FT_UInt glyph_index, - AF_GlyphHints hints, - FT_Outline* outline ) + af_dummy_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, + FT_Outline* outline, + AF_StyleMetrics metrics ) { FT_Error error; FT_UNUSED( glyph_index ); + FT_UNUSED( metrics ); error = af_glyph_hints_reload( hints, outline ); diff --git a/src/3rdparty/freetype/src/autofit/afdummy.h b/src/3rdparty/freetype/src/autofit/afdummy.h index b382acd92a..ab9227d35d 100644 --- a/src/3rdparty/freetype/src/autofit/afdummy.h +++ b/src/3rdparty/freetype/src/autofit/afdummy.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* afdummy.h */ -/* */ -/* Auto-fitter dummy routines to be used if no hinting should be */ -/* performed (specification). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afdummy.h + * + * Auto-fitter dummy routines to be used if no hinting should be + * performed (specification). + * + * Copyright (C) 2003-2019 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 AFDUMMY_H_ diff --git a/src/3rdparty/freetype/src/autofit/aferrors.h b/src/3rdparty/freetype/src/autofit/aferrors.h index e5de54360f..2ec336f72c 100644 --- a/src/3rdparty/freetype/src/autofit/aferrors.h +++ b/src/3rdparty/freetype/src/autofit/aferrors.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* aferrors.h */ -/* */ -/* Autofitter error codes (specification only). */ -/* */ -/* Copyright 2005-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 is used to define the Autofitter error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * aferrors.h + * + * Autofitter error codes (specification only). + * + * Copyright (C) 2005-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the Autofitter error enumeration + * constants. + * + */ #ifndef AFERRORS_H_ #define AFERRORS_H_ diff --git a/src/3rdparty/freetype/src/autofit/afglobal.c b/src/3rdparty/freetype/src/autofit/afglobal.c index 3d09c53e8a..6a9a1e5aaa 100644 --- a/src/3rdparty/freetype/src/autofit/afglobal.c +++ b/src/3rdparty/freetype/src/autofit/afglobal.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afglobal.c */ -/* */ -/* Auto-fitter routines to compute global hinting values (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afglobal.c + * + * Auto-fitter routines to compute global hinting values (body). + * + * Copyright (C) 2003-2019 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 "afglobal.h" @@ -22,14 +22,14 @@ #include FT_INTERNAL_DEBUG_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_afglobal +#define FT_COMPONENT afglobal /* get writing system specific header files */ @@ -38,7 +38,6 @@ #include "afwrtsys.h" #include "aferrors.h" -#include "afpic.h" #undef SCRIPT @@ -67,8 +66,6 @@ #include "afstyles.h" -#ifndef FT_CONFIG_OPTION_PIC - #undef WRITING_SYSTEM #define WRITING_SYSTEM( ws, WS ) \ &af_ ## ws ## _writing_system_class, @@ -110,8 +107,6 @@ NULL /* do not remove */ }; -#endif /* !FT_CONFIG_OPTION_PIC */ - #ifdef FT_DEBUG_LEVEL_TRACE @@ -159,12 +154,12 @@ } /* scan each style in a Unicode charmap */ - for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + for ( ss = 0; af_style_classes[ss]; ss++ ) { AF_StyleClass style_class = - AF_STYLE_CLASSES_GET[ss]; + af_style_classes[ss]; AF_ScriptClass script_class = - AF_SCRIPT_CLASSES_GET[style_class->script]; + af_script_classes[style_class->script]; AF_Script_UniRange range; @@ -172,8 +167,8 @@ continue; /* - * Scan all Unicode points in the range and set the corresponding - * glyph style index. + * Scan all Unicode points in the range and set the corresponding + * glyph style index. */ if ( style_class->coverage == AF_COVERAGE_DEFAULT ) { @@ -246,9 +241,9 @@ } /* handle the remaining default OpenType features ... */ - for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + for ( ss = 0; af_style_classes[ss]; ss++ ) { - AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss]; + AF_StyleClass style_class = af_style_classes[ss]; if ( style_class->coverage == AF_COVERAGE_DEFAULT ) @@ -256,7 +251,7 @@ } /* ... and finally the default OpenType features of the default script */ - af_shaper_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles, 1 ); + af_shaper_get_coverage( globals, af_style_classes[dflt], gstyles, 1 ); /* mark ASCII digits */ for ( i = 0x30; i <= 0x39; i++ ) @@ -270,8 +265,8 @@ Exit: /* - * By default, all uncovered glyphs are set to the fallback style. - * XXX: Shouldn't we disable hinting or do something similar? + * By default, all uncovered glyphs are set to the fallback style. + * XXX: Shouldn't we disable hinting or do something similar? */ if ( globals->module->fallback_style != AF_STYLE_UNASSIGNED ) { @@ -295,9 +290,9 @@ "==============\n" "\n" )); - for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + for ( ss = 0; af_style_classes[ss]; ss++ ) { - AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss]; + AF_StyleClass style_class = af_style_classes[ss]; FT_UInt count = 0; FT_Long idx; @@ -397,9 +392,9 @@ if ( globals->metrics[nn] ) { AF_StyleClass style_class = - AF_STYLE_CLASSES_GET[nn]; + af_style_classes[nn]; AF_WritingSystemClass writing_system_class = - AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + af_writing_system_classes[style_class->writing_system]; if ( writing_system_class->style_metrics_done ) @@ -448,8 +443,9 @@ style = (AF_Style)( globals->glyph_styles[gindex] & AF_STYLE_UNASSIGNED ); - style_class = AF_STYLE_CLASSES_GET[style]; - writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET + Again: + style_class = af_style_classes[style]; + writing_system_class = af_writing_system_classes [style_class->writing_system]; metrics = globals->metrics[style]; @@ -475,6 +471,16 @@ writing_system_class->style_metrics_done( metrics ); FT_FREE( metrics ); + + /* internal error code -1 indicates */ + /* that no blue zones have been found */ + if ( error == -1 ) + { + style = (AF_Style)( globals->glyph_styles[gindex] & + AF_STYLE_UNASSIGNED ); + goto Again; + } + goto Exit; } } @@ -494,9 +500,9 @@ FT_UInt gindex ) { if ( gindex < (FT_ULong)globals->glyph_count ) - return (FT_Bool)( globals->glyph_styles[gindex] & AF_DIGIT ); + return FT_BOOL( globals->glyph_styles[gindex] & AF_DIGIT ); - return (FT_Bool)0; + return FT_BOOL( 0 ); } diff --git a/src/3rdparty/freetype/src/autofit/afglobal.h b/src/3rdparty/freetype/src/autofit/afglobal.h index 489ed46d9e..52f38350db 100644 --- a/src/3rdparty/freetype/src/autofit/afglobal.h +++ b/src/3rdparty/freetype/src/autofit/afglobal.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* afglobal.h */ -/* */ -/* Auto-fitter routines to compute global hinting values */ -/* (specification). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afglobal.h + * + * Auto-fitter routines to compute global hinting values + * (specification). + * + * Copyright (C) 2003-2019 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 AFGLOBAL_H_ @@ -60,8 +60,8 @@ FT_BEGIN_HEADER /* - * Default values and flags for both autofitter globals (found in - * AF_ModuleRec) and face globals (in AF_FaceGlobalsRec). + * Default values and flags for both autofitter globals (found in + * AF_ModuleRec) and face globals (in AF_FaceGlobalsRec). */ /* index of fallback style in `af_style_classes' */ @@ -98,8 +98,8 @@ FT_BEGIN_HEADER /* - * Note that glyph_styles[] maps each glyph to an index into the - * `af_style_classes' array. + * Note that glyph_styles[] maps each glyph to an index into the + * `af_style_classes' array. * */ typedef struct AF_FaceGlobalsRec_ @@ -140,8 +140,8 @@ FT_BEGIN_HEADER /* - * model the global hints data for a given face, decomposed into - * style-specific items + * model the global hints data for a given face, decomposed into + * style-specific items */ FT_LOCAL( FT_Error ) diff --git a/src/3rdparty/freetype/src/autofit/afhints.c b/src/3rdparty/freetype/src/autofit/afhints.c index 0666dbc8e2..ed111c4117 100644 --- a/src/3rdparty/freetype/src/autofit/afhints.c +++ b/src/3rdparty/freetype/src/autofit/afhints.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afhints.c */ -/* */ -/* Auto-fitter hinting routines (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afhints.c + * + * Auto-fitter hinting routines (body). + * + * Copyright (C) 2003-2019 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 "afhints.h" @@ -22,14 +22,14 @@ #include FT_INTERNAL_DEBUG_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_afhints +#define FT_COMPONENT afhints /* Get new segment for given axis. */ @@ -297,6 +297,19 @@ } + static int + af_get_strong_edge_index( AF_GlyphHints hints, + AF_Edge* strong_edges, + int dimension ) + { + AF_AxisHints axis = &hints->axis[dimension]; + AF_Edge edges = axis->edges; + + + return AF_INDEX_NUM( strong_edges[dimension], edges ); + } + + #ifdef __cplusplus extern "C" { #endif @@ -317,8 +330,10 @@ { AF_DUMP(( " index hedge hseg vedge vseg flags " /* " XXXXX XXXXX XXXXX XXXXX XXXXX XXXXXX" */ - " xorg yorg xscale yscale xfit yfit" )); + " xorg yorg xscale yscale xfit yfit " /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */ + " hbef haft vbef vaft" )); + /* " XXXXX XXXXX XXXXX XXXXX" */ } else AF_DUMP(( " (none)\n" )); @@ -330,6 +345,7 @@ int segment_idx_1 = af_get_segment_index( hints, point_idx, 1 ); char buf1[16], buf2[16], buf3[16], buf4[16]; + char buf5[16], buf6[16], buf7[16], buf8[16]; /* insert extra newline at the beginning of a contour */ @@ -340,7 +356,8 @@ } AF_DUMP(( " %5d %5s %5s %5s %5s %s" - " %5d %5d %7.2f %7.2f %7.2f %7.2f\n", + " %5d %5d %7.2f %7.2f %7.2f %7.2f" + " %5s %5s %5s %5s\n", point_idx, af_print_idx( buf1, af_get_edge_index( hints, segment_idx_1, 1 ) ), @@ -359,7 +376,20 @@ point->ox / 64.0, point->oy / 64.0, point->x / 64.0, - point->y / 64.0 )); + point->y / 64.0, + + af_print_idx( buf5, af_get_strong_edge_index( hints, + point->before, + 1 ) ), + af_print_idx( buf6, af_get_strong_edge_index( hints, + point->after, + 1 ) ), + af_print_idx( buf7, af_get_strong_edge_index( hints, + point->before, + 0 ) ), + af_print_idx( buf8, af_get_strong_edge_index( hints, + point->after, + 0 ) ) )); } AF_DUMP(( "\n" )); } @@ -519,7 +549,7 @@ *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->fx : seg->first->fy; if ( seg->edge ) - *is_blue = (FT_Bool)( seg->edge->blue_edge != 0 ); + *is_blue = FT_BOOL( seg->edge->blue_edge ); else *is_blue = FALSE; @@ -558,8 +588,8 @@ /* - * note: AF_DIMENSION_HORZ corresponds to _vertical_ edges - * since they have a constant X coordinate. + * note: AF_DIMENSION_HORZ corresponds to _vertical_ edges + * since they have a constant X coordinate. */ if ( dimension == AF_DIMENSION_HORZ ) AF_DUMP(( "Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n", @@ -681,8 +711,8 @@ memory = hints->memory; /* - * note that we don't need to free the segment and edge - * buffers since they are really within the hints->points array + * note that we don't need to free the segment and edge + * buffers since they are really within the hints->points array */ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { @@ -776,9 +806,9 @@ } /* - * then reallocate the points arrays if necessary -- - * note that we reserve two additional point positions, used to - * hint metrics appropriately + * then reallocate the points arrays if necessary -- + * note that we reserve two additional point positions, used to + * hint metrics appropriately */ new_max = (FT_UInt)( outline->n_points + 2 ); old_max = (FT_UInt)hints->max_points; @@ -898,6 +928,14 @@ prev = end; } } + +#ifdef FT_DEBUG_AUTOFIT + point->before[0] = NULL; + point->before[1] = NULL; + point->after[0] = NULL; + point->after[1] = NULL; +#endif + } } @@ -918,15 +956,15 @@ { /* - * Compute directions of `in' and `out' vectors. + * Compute directions of `in' and `out' vectors. * - * Note that distances between points that are very near to each - * other are accumulated. In other words, the auto-hinter either - * prepends the small vectors between near points to the first - * non-near vector, or the sum of small vector lengths exceeds a - * threshold, thus `grouping' the small vectors. All intermediate - * points are tagged as weak; the directions are adjusted also to - * be equal to the accumulated one. + * Note that distances between points that are very near to each + * other are accumulated. In other words, the auto-hinter either + * prepends the small vectors between near points to the first + * non-near vector, or the sum of small vector lengths exceeds a + * threshold, thus `grouping' the small vectors. All intermediate + * points are tagged as weak; the directions are adjusted also to + * be equal to the accumulated one. */ FT_Int near_limit2 = 2 * near_limit - 1; @@ -956,12 +994,12 @@ out_y = point->fy - prev->fy; /* - * We use Taxicab metrics to measure the vector length. + * We use Taxicab metrics to measure the vector length. * - * Note that the accumulated distances so far could have the - * opposite direction of the distance measured here. For this - * reason we use `near_limit2' for the comparison to get a - * non-near point even in the worst case. + * Note that the accumulated distances so far could have the + * opposite direction of the distance measured here. For this + * reason we use `near_limit2' for the comparison to get a + * non-near point even in the worst case. */ if ( FT_ABS( out_x ) + FT_ABS( out_y ) >= near_limit2 ) break; @@ -979,11 +1017,11 @@ curr = first; /* - * We abuse the `u' and `v' fields to store index deltas to the - * next and previous non-near point, respectively. + * We abuse the `u' and `v' fields to store index deltas to the + * next and previous non-near point, respectively. * - * To avoid problems with not having non-near points, we point to - * `first' by default as the next non-near point. + * To avoid problems with not having non-near points, we point to + * `first' by default as the next non-near point. * */ curr->u = (FT_Pos)( first - curr ); @@ -1035,12 +1073,12 @@ } /* - * The next step is to `simplify' an outline's topology so that we - * can identify local extrema more reliably: A series of - * non-horizontal or non-vertical vectors pointing into the same - * quadrant are handled as a single, long vector. From a - * topological point of the view, the intermediate points are of no - * interest and thus tagged as weak. + * The next step is to `simplify' an outline's topology so that we + * can identify local extrema more reliably: A series of + * non-horizontal or non-vertical vectors pointing into the same + * quadrant are handled as a single, long vector. From a + * topological point of the view, the intermediate points are of no + * interest and thus tagged as weak. */ for ( point = points; point < point_limit; point++ ) @@ -1080,9 +1118,9 @@ } /* - * Finally, check for remaining weak points. Everything else not - * collected in edges so far is then implicitly classified as strong - * points. + * Finally, check for remaining weak points. Everything else not + * collected in edges so far is then implicitly classified as strong + * points. */ for ( point = points; point < point_limit; point++ ) @@ -1309,6 +1347,12 @@ if ( delta >= 0 ) { u = edge->pos - ( edge->opos - ou ); + +#ifdef FT_DEBUG_AUTOFIT + point->before[dim] = edge; + point->after[dim] = NULL; +#endif + goto Store_Point; } @@ -1318,6 +1362,12 @@ if ( delta >= 0 ) { u = edge->pos + ( ou - edge->opos ); + +#ifdef FT_DEBUG_AUTOFIT + point->before[dim] = NULL; + point->after[dim] = edge; +#endif + goto Store_Point; } @@ -1364,6 +1414,12 @@ { /* we are on the edge */ u = edge->pos; + +#ifdef FT_DEBUG_AUTOFIT + point->before[dim] = NULL; + point->after[dim] = NULL; +#endif + goto Store_Point; } } @@ -1374,6 +1430,11 @@ AF_Edge after = edges + min + 0; +#ifdef FT_DEBUG_AUTOFIT + point->before[dim] = before; + point->after[dim] = after; +#endif + /* assert( before && after && before != after ) */ if ( before->scale == 0 ) before->scale = FT_DivFix( after->pos - before->pos, diff --git a/src/3rdparty/freetype/src/autofit/afhints.h b/src/3rdparty/freetype/src/autofit/afhints.h index 3326ebc44e..e0cf612f0c 100644 --- a/src/3rdparty/freetype/src/autofit/afhints.h +++ b/src/3rdparty/freetype/src/autofit/afhints.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afhints.h */ -/* */ -/* Auto-fitter hinting routines (specification). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afhints.h + * + * Auto-fitter hinting routines (specification). + * + * Copyright (C) 2003-2019 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 AFHINTS_H_ @@ -26,8 +26,8 @@ FT_BEGIN_HEADER /* - * The definition of outline glyph hints. These are shared by all - * writing system analysis routines (until now). + * The definition of outline glyph hints. These are shared by all + * writing system analysis routines (until now). */ typedef enum AF_Dimension_ @@ -56,153 +56,153 @@ FT_BEGIN_HEADER /* - * The following explanations are mostly taken from the article + * The following explanations are mostly taken from the article * - * Real-Time Grid Fitting of Typographic Outlines + * Real-Time Grid Fitting of Typographic Outlines * - * by David Turner and Werner Lemberg + * by David Turner and Werner Lemberg * - * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf + * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf * - * with appropriate updates. + * with appropriate updates. * * - * Segments + * Segments * - * `af_{cjk,latin,...}_hints_compute_segments' are the functions to - * find segments in an outline. + * `af_{cjk,latin,...}_hints_compute_segments' are the functions to + * find segments in an outline. * - * A segment is a series of at least two consecutive points that are - * approximately aligned along a coordinate axis. The analysis to do - * so is specific to a writing system. + * A segment is a series of at least two consecutive points that are + * approximately aligned along a coordinate axis. The analysis to do + * so is specific to a writing system. * * - * Edges + * Edges * - * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find - * edges. + * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find + * edges. * - * As soon as segments are defined, the auto-hinter groups them into - * edges. An edge corresponds to a single position on the main - * dimension that collects one or more segments (allowing for a small - * threshold). + * As soon as segments are defined, the auto-hinter groups them into + * edges. An edge corresponds to a single position on the main + * dimension that collects one or more segments (allowing for a small + * threshold). * - * As an example, the `latin' writing system first tries to grid-fit - * edges, then to align segments on the edges unless it detects that - * they form a serif. + * As an example, the `latin' writing system first tries to grid-fit + * edges, then to align segments on the edges unless it detects that + * they form a serif. * * - * A H - * | | - * | | - * | | - * | | - * C | | F - * +------<-----+ +-----<------+ - * | B G | - * | | - * | | - * +--------------->------------------+ - * D E + * A H + * | | + * | | + * | | + * | | + * C | | F + * +------<-----+ +-----<------+ + * | B G | + * | | + * | | + * +--------------->------------------+ + * D E * * - * Stems + * Stems * - * Stems are detected by `af_{cjk,latin,...}_hint_edges'. + * Stems are detected by `af_{cjk,latin,...}_hint_edges'. * - * Segments need to be `linked' to other ones in order to detect stems. - * A stem is made of two segments that face each other in opposite - * directions and that are sufficiently close to each other. Using - * vocabulary from the TrueType specification, stem segments form a - * `black distance'. + * Segments need to be `linked' to other ones in order to detect stems. + * A stem is made of two segments that face each other in opposite + * directions and that are sufficiently close to each other. Using + * vocabulary from the TrueType specification, stem segments form a + * `black distance'. * - * In the above ASCII drawing, the horizontal segments are BC, DE, and - * FG; the vertical segments are AB, CD, EF, and GH. + * In the above ASCII drawing, the horizontal segments are BC, DE, and + * FG; the vertical segments are AB, CD, EF, and GH. * - * Each segment has at most one `best' candidate to form a black - * distance, or no candidate at all. Notice that two distinct segments - * can have the same candidate, which frequently means a serif. + * Each segment has at most one `best' candidate to form a black + * distance, or no candidate at all. Notice that two distinct segments + * can have the same candidate, which frequently means a serif. * - * A stem is recognized by the following condition: + * A stem is recognized by the following condition: * - * best segment_1 = segment_2 && best segment_2 = segment_1 + * best segment_1 = segment_2 && best segment_2 = segment_1 * - * The best candidate is stored in field `link' in structure - * `AF_Segment'. + * The best candidate is stored in field `link' in structure + * `AF_Segment'. * - * In the above ASCII drawing, the best candidate for both AB and CD is - * GH, while the best candidate for GH is AB. Similarly, the best - * candidate for EF and GH is AB, while the best candidate for AB is - * GH. + * In the above ASCII drawing, the best candidate for both AB and CD is + * GH, while the best candidate for GH is AB. Similarly, the best + * candidate for EF and GH is AB, while the best candidate for AB is + * GH. * - * The detection and handling of stems is dependent on the writing - * system. + * The detection and handling of stems is dependent on the writing + * system. * * - * Serifs + * Serifs * - * Serifs are detected by `af_{cjk,latin,...}_hint_edges'. + * Serifs are detected by `af_{cjk,latin,...}_hint_edges'. * - * In comparison to a stem, a serif (as handled by the auto-hinter - * module that takes care of the `latin' writing system) has + * In comparison to a stem, a serif (as handled by the auto-hinter + * module that takes care of the `latin' writing system) has * - * best segment_1 = segment_2 && best segment_2 != segment_1 + * best segment_1 = segment_2 && best segment_2 != segment_1 * - * where segment_1 corresponds to the serif segment (CD and EF in the - * above ASCII drawing). + * where segment_1 corresponds to the serif segment (CD and EF in the + * above ASCII drawing). * - * The best candidate is stored in field `serif' in structure - * `AF_Segment' (and `link' is set to NULL). + * The best candidate is stored in field `serif' in structure + * `AF_Segment' (and `link' is set to NULL). * * - * Touched points + * Touched points * - * A point is called `touched' if it has been processed somehow by the - * auto-hinter. It basically means that it shouldn't be moved again - * (or moved only under certain constraints to preserve the already - * applied processing). + * A point is called `touched' if it has been processed somehow by the + * auto-hinter. It basically means that it shouldn't be moved again + * (or moved only under certain constraints to preserve the already + * applied processing). * * - * Flat and round segments + * Flat and round segments * - * Segments are `round' or `flat', depending on the series of points - * that define them. A segment is round if the next and previous point - * of an extremum (which can be either a single point or sequence of - * points) are both conic or cubic control points. Otherwise, a - * segment with an extremum is flat. + * Segments are `round' or `flat', depending on the series of points + * that define them. A segment is round if the next and previous point + * of an extremum (which can be either a single point or sequence of + * points) are both conic or cubic control points. Otherwise, a + * segment with an extremum is flat. * * - * Strong Points + * Strong Points * - * Experience has shown that points not part of an edge need to be - * interpolated linearly between their two closest edges, even if these - * are not part of the contour of those particular points. Typical - * candidates for this are + * Experience has shown that points not part of an edge need to be + * interpolated linearly between their two closest edges, even if these + * are not part of the contour of those particular points. Typical + * candidates for this are * - * - angle points (i.e., points where the `in' and `out' direction - * differ greatly) + * - angle points (i.e., points where the `in' and `out' direction + * differ greatly) * - * - inflection points (i.e., where the `in' and `out' angles are the - * same, but the curvature changes sign) [currently, such points - * aren't handled specially in the auto-hinter] + * - inflection points (i.e., where the `in' and `out' angles are the + * same, but the curvature changes sign) [currently, such points + * aren't handled specially in the auto-hinter] * - * `af_glyph_hints_align_strong_points' is the function that takes - * care of such situations; it is equivalent to the TrueType `IP' - * hinting instruction. + * `af_glyph_hints_align_strong_points' is the function that takes + * care of such situations; it is equivalent to the TrueType `IP' + * hinting instruction. * * - * Weak Points + * Weak Points * - * Other points in the outline must be interpolated using the - * coordinates of their previous and next unfitted contour neighbours. - * These are called `weak points' and are touched by the function - * `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP' - * hinting instruction. Typical candidates are control points and - * points on the contour without a major direction. + * Other points in the outline must be interpolated using the + * coordinates of their previous and next unfitted contour neighbours. + * These are called `weak points' and are touched by the function + * `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP' + * hinting instruction. Typical candidates are control points and + * points on the contour without a major direction. * - * The major effect is to reduce possible distortion caused by - * alignment of edges and strong points, thus weak points are processed - * after strong points. + * The major effect is to reduce possible distortion caused by + * alignment of edges and strong points, thus weak points are processed + * after strong points. */ @@ -252,6 +252,12 @@ FT_BEGIN_HEADER AF_Point next; /* next point in contour */ AF_Point prev; /* previous point in contour */ +#ifdef FT_DEBUG_AUTOFIT + /* track `before' and `after' edges for strong points */ + AF_Edge before[2]; + AF_Edge after[2]; +#endif + } AF_PointRec; diff --git a/src/3rdparty/freetype/src/autofit/afindic.c b/src/3rdparty/freetype/src/autofit/afindic.c index dfbea5f34c..a17117c712 100644 --- a/src/3rdparty/freetype/src/autofit/afindic.c +++ b/src/3rdparty/freetype/src/autofit/afindic.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afindic.c */ -/* */ -/* Auto-fitter hinting routines for Indic writing system (body). */ -/* */ -/* Copyright 2007-2018 by */ -/* Rahul Bhalerao , . */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afindic.c + * + * Auto-fitter hinting routines for Indic writing system (body). + * + * Copyright (C) 2007-2019 by + * Rahul Bhalerao , . + * + * 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" diff --git a/src/3rdparty/freetype/src/autofit/afindic.h b/src/3rdparty/freetype/src/autofit/afindic.h index 5688738e6e..bc5bc59fa5 100644 --- a/src/3rdparty/freetype/src/autofit/afindic.h +++ b/src/3rdparty/freetype/src/autofit/afindic.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* afindic.h */ -/* */ -/* Auto-fitter hinting routines for Indic writing system */ -/* (specification). */ -/* */ -/* Copyright 2007-2018 by */ -/* Rahul Bhalerao , . */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afindic.h + * + * Auto-fitter hinting routines for Indic writing system + * (specification). + * + * Copyright (C) 2007-2019 by + * Rahul Bhalerao , . + * + * 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 AFINDIC_H_ diff --git a/src/3rdparty/freetype/src/autofit/aflatin.c b/src/3rdparty/freetype/src/autofit/aflatin.c index 9f1b54056f..27d4024882 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin.c +++ b/src/3rdparty/freetype/src/autofit/aflatin.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* aflatin.c */ -/* */ -/* Auto-fitter hinting routines for latin writing system (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aflatin.c + * + * Auto-fitter hinting routines for latin writing system (body). + * + * Copyright (C) 2003-2019 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 @@ -21,7 +21,6 @@ #include FT_INTERNAL_DEBUG_H #include "afglobal.h" -#include "afpic.h" #include "aflatin.h" #include "aferrors.h" @@ -31,14 +30,14 @@ #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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_aflatin +#define FT_COMPONENT aflatin /* needed for computation of round vs. flat segments */ @@ -83,24 +82,30 @@ AF_LatinMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = metrics->root.globals; -#endif - AF_StyleClass style_class = metrics->root.style_class; - AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET - [style_class->script]; + AF_ScriptClass script_class = af_script_classes[style_class->script]; + + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif - void* shaper_buf; const char* p; #ifdef FT_DEBUG_LEVEL_TRACE FT_ULong ch = 0; #endif - p = script_class->standard_charstring; - shaper_buf = af_shaper_buf_create( face ); + p = script_class->standard_charstring; + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + shaper_buf = af_shaper_buf_create( face ); +#endif /* * We check a list of standard characters to catch features like * `c2sc' (small caps from caps) that don't contain lowercase letters @@ -144,7 +149,11 @@ af_shaper_buf_destroy( face, shaper_buf ); if ( !glyph_index ) + { + FT_TRACE5(( "standard character missing;" + " using fallback stem widths\n" )); goto Exit; + } FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n", ch, glyph_index )); @@ -186,10 +195,10 @@ goto Exit; /* - * We assume that the glyphs selected for the stem width - * computation are `featureless' enough so that the linking - * algorithm works fine without adjustments of its scoring - * function. + * We assume that the glyphs selected for the stem width + * computation are `featureless' enough so that the linking + * algorithm works fine without adjustments of its scoring + * function. */ af_latin_hints_link_segments( hints, 0, @@ -307,7 +316,7 @@ /* Find all blue zones. Flat segments give the reference points, */ /* round segments the overshoot positions. */ - static void + static int af_latin_metrics_init_blues( AF_LatinMetrics metrics, FT_Face face ) { @@ -329,7 +338,14 @@ FT_Pos flat_threshold = FLAT_THRESHOLD( metrics->units_per_em ); - void* shaper_buf; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif /* we walk over the blue character strings as specified in the */ @@ -339,7 +355,9 @@ "============================\n" "\n" )); +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { @@ -884,8 +902,8 @@ 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 + * we couldn't find a single glyph to compute this blue zone, + * we will simply ignore it then */ FT_TRACE5(( " empty\n" )); continue; @@ -967,10 +985,11 @@ af_shaper_buf_destroy( face, shaper_buf ); - /* we finally check whether blue zones are ordered; */ - /* `ref' and `shoot' values of two blue zones must not overlap */ if ( axis->blue_count ) { + /* we finally check whether blue zones are ordered; */ + /* `ref' and `shoot' values of two blue zones must not overlap */ + FT_UInt i; AF_LatinBlue blue_sorted[AF_BLUE_STRINGSET_MAX_LEN + 2]; @@ -1019,11 +1038,34 @@ *a )); } } + + FT_TRACE5(( "\n" )); + + return 0; } + else + { + /* disable hinting for the current style if there are no blue zones */ - FT_TRACE5(( "\n" )); + AF_FaceGlobals globals = metrics->root.globals; + FT_UShort* gstyles = globals->glyph_styles; + + FT_Long i; + + + FT_TRACE5(( "no blue zones found:" + " hinting disabled for this style\n" )); + + for ( i = 0; i < globals->glyph_count; i++ ) + { + if ( ( gstyles[i] & AF_STYLE_MASK ) == sc->style ) + gstyles[i] = AF_STYLE_NONE_DFLT; + } - return; + FT_TRACE5(( "\n" )); + + return 1; + } } @@ -1036,15 +1078,25 @@ FT_Bool started = 0, same_width = 1; FT_Fixed advance = 0, old_advance = 0; - void* shaper_buf; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif /* in all supported charmaps, digits have character codes 0x30-0x39 */ const char digits[] = "0 1 2 3 4 5 6 7 8 9"; const char* p; - p = digits; + p = digits; + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif while ( *p ) { @@ -1092,6 +1144,8 @@ af_latin_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { + FT_Error error = FT_Err_Ok; + FT_CharMap oldmap = face->charmap; @@ -1100,12 +1154,18 @@ if ( !FT_Select_Charmap( face, FT_ENCODING_UNICODE ) ) { af_latin_metrics_init_widths( metrics, face ); - af_latin_metrics_init_blues( metrics, face ); + if ( af_latin_metrics_init_blues( metrics, face ) ) + { + /* use internal error code to indicate missing blue zones */ + error = -1; + goto Exit; + } af_latin_metrics_check_digits( metrics, face ); } + Exit: FT_Set_Charmap( face, oldmap ); - return FT_Err_Ok; + return error; } @@ -1283,7 +1343,7 @@ /* 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 ); + FT_BOOL( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); #ifdef FT_DEBUG_LEVEL_TRACE if ( axis->extra_light ) @@ -1419,13 +1479,13 @@ nn, blue->ref.org, blue->ref.fit / 64.0, - blue->flags & AF_LATIN_BLUE_ACTIVE ? "" - : " (inactive)", + ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? "" + : " (inactive)", nn, blue->shoot.org, blue->shoot.fit / 64.0, - blue->flags & AF_LATIN_BLUE_ACTIVE ? "" - : " (inactive)" )); + ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? "" + : " (inactive)" )); } #endif } @@ -1967,17 +2027,17 @@ if ( len >= len_threshold ) { /* - * The score is the sum of two demerits indicating the - * `badness' of a fit, measured along the segments' main axis - * and orthogonal to it, respectively. + * The score is the sum of two demerits indicating the + * `badness' of a fit, measured along the segments' main axis + * and orthogonal to it, respectively. * - * o The less overlapping along the main axis, the worse it - * is, causing a larger demerit. + * - The less overlapping along the main axis, the worse it + * is, causing a larger demerit. * - * o The nearer the orthogonal distance to a stem width, the - * better it is, causing a smaller demerit. For simplicity, - * however, we only increase the demerit for values that - * exceed the largest stem width. + * - The nearer the orthogonal distance to a stem width, the + * better it is, causing a smaller demerit. For simplicity, + * however, we only increase the demerit for values that + * exceed the largest stem width. */ FT_Pos dist = pos2 - pos1; @@ -2049,13 +2109,8 @@ FT_Memory memory = hints->memory; AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = hints->metrics->globals; -#endif - AF_StyleClass style_class = hints->metrics->style_class; - AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET - [style_class->script]; + AF_ScriptClass script_class = af_script_classes[style_class->script]; FT_Bool top_to_bottom_hinting = 0; @@ -2086,9 +2141,9 @@ top_to_bottom_hinting = script_class->top_to_bottom_hinting; /* - * We ignore all segments that are less than 1 pixel in length - * to avoid many problems with serif fonts. We compute the - * corresponding threshold in font units. + * We ignore all segments that are less than 1 pixel in length + * to avoid many problems with serif fonts. We compute the + * corresponding threshold in font units. */ if ( dim == AF_DIMENSION_HORZ ) segment_length_threshold = FT_DivFix( 64, hints->y_scale ); @@ -2096,26 +2151,26 @@ segment_length_threshold = 0; /* - * Similarly, we ignore segments that have a width delta - * larger than 0.5px (i.e., a width larger than 1px). + * Similarly, we ignore segments that have a width delta + * larger than 0.5px (i.e., a width larger than 1px). */ segment_width_threshold = FT_DivFix( 32, scale ); - /*********************************************************************/ - /* */ - /* We 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 gets processed in the second step to compute the */ - /* edge's properties. */ - /* */ - /* Note that the table of edges is sorted along the segment/edge */ - /* position. */ - /* */ - /*********************************************************************/ + /********************************************************************** + * + * We 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 gets processed in the second step to compute the + * edge's properties. + * + * Note that the table of edges is sorted along the segment/edge + * position. + * + */ /* assure that edge distance threshold is at most 0.25px */ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, @@ -2237,17 +2292,17 @@ } - /******************************************************************/ - /* */ - /* Good, we now compute each edge's properties according to the */ - /* segments found on its position. Basically, these are */ - /* */ - /* - the 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 */ - /* */ - /******************************************************************/ + /******************************************************************* + * + * Good, we now compute each edge's properties according to the + * segments found on its position. Basically, these are + * + * - the 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 */ @@ -2309,9 +2364,9 @@ /* 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 ); + is_serif = FT_BOOL( seg->serif && + seg->serif->edge && + seg->serif->edge != edge ); if ( ( seg->link && seg->link->edge ) || is_serif ) { @@ -2546,8 +2601,8 @@ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics ); /* - * correct x_scale and y_scale if needed, since they may have - * been modified by `af_latin_metrics_scale_dim' above + * correct x_scale and y_scale if needed, since they may have + * been modified by `af_latin_metrics_scale_dim' above */ hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale; hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta; @@ -2566,21 +2621,21 @@ other_flags = 0; /* - * We snap the width of vertical stems for the monochrome and - * horizontal LCD rendering targets only. + * 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. + * 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. + * 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; @@ -2589,11 +2644,11 @@ 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. + * In `light' or `lcd' mode we disable horizontal hinting completely. + * We also do it if the face is italic. * - * However, if warping is enabled (which only works in `light' hinting - * mode), advance widths get adjusted, too. + * However, if warping is enabled (which only works in `light' hinting + * mode), advance widths get adjusted, too. */ if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) @@ -2936,13 +2991,8 @@ AF_Edge anchor = NULL; FT_Int has_serifs = 0; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = hints->metrics->globals; -#endif - AF_StyleClass style_class = hints->metrics->style_class; - AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET - [style_class->script]; + AF_ScriptClass script_class = af_script_classes[style_class->script]; FT_Bool top_to_bottom_hinting = 0; @@ -2976,12 +3026,12 @@ edge2 = edge->link; /* - * If a stem contains both a neutral and a non-neutral blue zone, - * skip the neutral one. Otherwise, outlines with different - * directions might be incorrectly aligned at the same vertical - * position. + * If a stem contains both a neutral and a non-neutral blue zone, + * skip the neutral one. Otherwise, outlines with different + * directions might be incorrectly aligned at the same vertical + * position. * - * If we have two neutral blue zones, skip one of them. + * If we have two neutral blue zones, skip one of them. * */ if ( edge->blue_edge && edge2 && edge2->blue_edge ) @@ -3344,8 +3394,8 @@ if ( has_serifs || !anchor ) { /* - * now hint the remaining edges (serifs and single) in order - * to complete our processing + * now hint the remaining edges (serifs and single) in order + * to complete our processing */ for ( edge = edges; edge < edge_limit; edge++ ) { diff --git a/src/3rdparty/freetype/src/autofit/aflatin.h b/src/3rdparty/freetype/src/autofit/aflatin.h index 432cccce4e..40479538c2 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin.h +++ b/src/3rdparty/freetype/src/autofit/aflatin.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* aflatin.h */ -/* */ -/* Auto-fitter hinting routines for latin writing system */ -/* (specification). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aflatin.h + * + * Auto-fitter hinting routines for latin writing system + * (specification). + * + * Copyright (C) 2003-2019 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 AFLATIN_H_ @@ -45,9 +45,9 @@ FT_BEGIN_HEADER /* - * The following declarations could be embedded in the file `aflatin.c'; - * they have been made semi-public to allow alternate writing system - * hinters to re-use some of them. + * The following declarations could be embedded in the file `aflatin.c'; + * they have been made semi-public to allow alternate writing system + * hinters to re-use some of them. */ @@ -161,8 +161,8 @@ FT_BEGIN_HEADER /* - * The next functions shouldn't normally be exported. However, other - * writing systems might like to use these functions as-is. + * The next functions shouldn't normally be exported. However, other + * writing systems might like to use these functions as-is. */ FT_LOCAL( FT_Error ) af_latin_hints_compute_segments( AF_GlyphHints hints, diff --git a/src/3rdparty/freetype/src/autofit/aflatin2.c b/src/3rdparty/freetype/src/autofit/aflatin2.c index 5c71378118..c601ab8d9a 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin2.c +++ b/src/3rdparty/freetype/src/autofit/aflatin2.c @@ -3,22 +3,22 @@ /* marked as experimental. */ -/***************************************************************************/ -/* */ -/* aflatin2.c */ -/* */ -/* Auto-fitter hinting routines for latin writing system (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aflatin2.c + * + * Auto-fitter hinting routines for latin writing system (body). + * + * Copyright (C) 2003-2019 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 FT_ADVANCES_H @@ -37,14 +37,14 @@ #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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_aflatin2 +#define FT_COMPONENT aflatin2 FT_LOCAL_DEF( FT_Error ) @@ -265,7 +265,7 @@ /* 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 ) + if ( last <= first ) continue; if ( AF_LATIN_IS_TOP_BLUE( bb ) ) @@ -299,6 +299,7 @@ /* 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; @@ -358,8 +359,8 @@ 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 + * we couldn't find a single glyph to compute this blue zone, + * we will simply ignore it then */ FT_TRACE5(( " empty\n" )); continue; @@ -632,7 +633,7 @@ /* 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 ); + FT_BOOL( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); if ( dim == AF_DIMENSION_VERT ) { @@ -1108,13 +1109,13 @@ : 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 + * 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 + * also, unlink serif segments that are linked to segments farther + * than 50% of the standard width */ if ( dim == AF_DIMENSION_HORZ ) { @@ -1126,21 +1127,21 @@ 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. */ - /* */ - /*********************************************************************/ + /********************************************************************** + * + * 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 ); @@ -1230,17 +1231,17 @@ } - /*********************************************************************/ - /* */ - /* 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 */ - /* */ - /*********************************************************************/ + /********************************************************************** + * + * 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 */ @@ -1302,9 +1303,9 @@ /* 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 ); + is_serif = FT_BOOL( seg->serif && + seg->serif->edge && + seg->serif->edge != edge ); if ( ( seg->link && seg->link->edge ) || is_serif ) { @@ -1524,8 +1525,8 @@ 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 + * 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; @@ -1544,21 +1545,21 @@ other_flags = 0; /* - * We snap the width of vertical stems for the monochrome and - * horizontal LCD rendering targets only. + * 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. + * 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. + * 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; @@ -1567,8 +1568,8 @@ 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. + * 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 ) @@ -2233,8 +2234,8 @@ if ( has_serifs || !anchor ) { /* - * now hint the remaining edges (serifs and single) in order - * to complete our processing + * now hint the remaining edges (serifs and single) in order + * to complete our processing */ for ( edge = edges; edge < edge_limit; edge++ ) { diff --git a/src/3rdparty/freetype/src/autofit/aflatin2.h b/src/3rdparty/freetype/src/autofit/aflatin2.h index 0129dc707e..507cef3df2 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin2.h +++ b/src/3rdparty/freetype/src/autofit/aflatin2.h @@ -3,23 +3,23 @@ /* marked as experimental. */ -/***************************************************************************/ -/* */ -/* aflatin2.h */ -/* */ -/* Auto-fitter hinting routines for latin writing system */ -/* (specification). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aflatin2.h + * + * Auto-fitter hinting routines for latin writing system + * (specification). + * + * Copyright (C) 2003-2019 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_ diff --git a/src/3rdparty/freetype/src/autofit/afloader.c b/src/3rdparty/freetype/src/autofit/afloader.c index a55550b338..83743b7be1 100644 --- a/src/3rdparty/freetype/src/autofit/afloader.c +++ b/src/3rdparty/freetype/src/autofit/afloader.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afloader.c */ -/* */ -/* Auto-fitter glyph loading routines (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afloader.c + * + * Auto-fitter glyph loading routines (body). + * + * Copyright (C) 2003-2019 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 "afglobal.h" @@ -21,7 +21,6 @@ #include "afhints.h" #include "aferrors.h" #include "afmodule.h" -#include "afpic.h" #include FT_INTERNAL_CALC_H @@ -119,12 +118,12 @@ } /* - * We depend on the writing system (script analyzers) to supply - * standard widths for the script of the glyph we are looking at. If - * it can't deliver, stem darkening is disabled. + * We depend on the writing system (script analyzers) to supply + * standard widths for the script of the glyph we are looking at. If + * it can't deliver, stem darkening is disabled. */ writing_system_class = - AF_WRITING_SYSTEM_CLASSES_GET[style_metrics->style_class->writing_system]; + af_writing_system_classes[style_metrics->style_class->writing_system]; if ( writing_system_class->style_metrics_getstdw ) writing_system_class->style_metrics_getstdw( style_metrics, @@ -174,22 +173,22 @@ globals->darken_y = af_fixedToInt( darken_y ); /* - * Scale outlines down on the Y-axis to keep them inside their blue - * zones. The stronger the emboldening, the stronger the downscaling - * (plus heuristical padding to prevent outlines still falling out - * their zones due to rounding). + * Scale outlines down on the Y-axis to keep them inside their blue + * zones. The stronger the emboldening, the stronger the downscaling + * (plus heuristical padding to prevent outlines still falling out + * their zones due to rounding). * - * Reason: `FT_Outline_Embolden' works by shifting the rightmost - * points of stems farther to the right, and topmost points farther - * up. This positions points on the Y-axis outside their - * pre-computed blue zones and leads to distortion when applying the - * hints in the code further below. Code outside this emboldening - * block doesn't know we are presenting it with modified outlines the - * analyzer didn't see! + * Reason: `FT_Outline_Embolden' works by shifting the rightmost + * points of stems farther to the right, and topmost points farther + * up. This positions points on the Y-axis outside their + * pre-computed blue zones and leads to distortion when applying the + * hints in the code further below. Code outside this emboldening + * block doesn't know we are presenting it with modified outlines the + * analyzer didn't see! * - * An unfortunate side effect of downscaling is that the emboldening - * effect is slightly decreased. The loss becomes more pronounced - * versus the CFF driver at smaller sizes, e.g., at 9ppem and below. + * An unfortunate side effect of downscaling is that the emboldening + * effect is slightly decreased. The loss becomes more pronounced + * versus the CFF driver at smaller sizes, e.g., at 9ppem and below. */ globals->scale_down_factor = FT_DivFix( em_size - ( darken_by_font_units_y + af_intToFixed( 8 ) ), @@ -232,10 +231,6 @@ AF_StyleClass style_class; AF_WritingSystemClass writing_system_class; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = loader->globals; -#endif - if ( !size ) return FT_THROW( Invalid_Size_Handle ); @@ -282,13 +277,13 @@ } /* - * TODO: This code currently doesn't support fractional advance widths, - * i.e., placing hinted glyphs at anything other than integer - * x-positions. This is only relevant for the warper code, which - * scales and shifts glyphs to optimize blackness of stems (hinting on - * the x-axis by nature places things on pixel integers, hinting on the - * y-axis only, i.e., LIGHT mode, doesn't touch the x-axis). The delta - * values of the scaler would need to be adjusted. + * TODO: This code currently doesn't support fractional advance widths, + * i.e., placing hinted glyphs at anything other than integer + * x-positions. This is only relevant for the warper code, which + * scales and shifts glyphs to optimize blackness of stems (hinting on + * the x-axis by nature places things on pixel integers, hinting on the + * y-axis only, i.e., LIGHT mode, doesn't touch the x-axis). The delta + * values of the scaler would need to be adjusted. */ scaler.face = face; scaler.x_scale = size_internal->autohint_metrics.x_scale; @@ -312,10 +307,10 @@ #endif /* - * Glyphs (really code points) are assigned to scripts. Script - * analysis is done lazily: For each glyph that passes through here, - * the corresponding script analyzer is called, but returns immediately - * if it has been run already. + * Glyphs (really code points) are assigned to scripts. Script + * analysis is done lazily: For each glyph that passes through here, + * the corresponding script analyzer is called, but returns immediately + * if it has been run already. */ error = af_face_globals_get_metrics( loader->globals, glyph_index, style_options, &style_metrics ); @@ -324,7 +319,7 @@ style_class = style_metrics->style_class; writing_system_class = - AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + af_writing_system_classes[style_class->writing_system]; loader->metrics = style_metrics; @@ -342,11 +337,11 @@ } /* - * Do the main work of `af_loader_load_glyph'. Note that we never have - * to deal with composite glyphs as those get loaded into - * FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. - * In the rare cases where FT_LOAD_NO_RECURSE is set, it implies - * FT_LOAD_NO_SCALE and as such the auto-hinter is never called. + * Do the main work of `af_loader_load_glyph'. Note that we never have + * to deal with composite glyphs as those get loaded into + * FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. + * In the rare cases where FT_LOAD_NO_RECURSE is set, it implies + * FT_LOAD_NO_SCALE and as such the auto-hinter is never called. */ load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM | @@ -358,26 +353,26 @@ goto Exit; /* - * Apply stem darkening (emboldening) here before hints are applied to - * the outline. Glyphs are scaled down proportionally to the - * emboldening so that curve points don't fall outside their - * precomputed blue zones. + * Apply stem darkening (emboldening) here before hints are applied to + * the outline. Glyphs are scaled down proportionally to the + * emboldening so that curve points don't fall outside their + * precomputed blue zones. * - * Any emboldening done by the font driver (e.g., the CFF driver) - * doesn't reach here because the autohinter loads the unprocessed - * glyphs in font units for analysis (functions `af_*_metrics_init_*') - * and then above to prepare it for the rasterizers by itself, - * independently of the font driver. So emboldening must be done here, - * within the autohinter. + * Any emboldening done by the font driver (e.g., the CFF driver) + * doesn't reach here because the autohinter loads the unprocessed + * glyphs in font units for analysis (functions `af_*_metrics_init_*') + * and then above to prepare it for the rasterizers by itself, + * independently of the font driver. So emboldening must be done here, + * within the autohinter. * - * All glyphs to be autohinted pass through here one by one. The - * standard widths can therefore change from one glyph to the next, - * depending on what script a glyph is assigned to (each script has its - * own set of standard widths and other metrics). The darkening amount - * must therefore be recomputed for each size and - * `standard_{vertical,horizontal}_width' change. + * All glyphs to be autohinted pass through here one by one. The + * standard widths can therefore change from one glyph to the next, + * depending on what script a glyph is assigned to (each script has its + * own set of standard widths and other metrics). The darkening amount + * must therefore be recomputed for each size and + * `standard_{vertical,horizontal}_width' change. * - * Ignore errors and carry on without emboldening. + * Ignore errors and carry on without emboldening. * */ @@ -426,35 +421,39 @@ /* now load the slot image into the auto-outline */ /* and run the automatic hinting process */ if ( writing_system_class->style_hints_apply ) - writing_system_class->style_hints_apply( glyph_index, - hints, - &gloader->base.outline, - style_metrics ); + { + error = writing_system_class->style_hints_apply( + glyph_index, + hints, + &gloader->base.outline, + style_metrics ); + if ( error ) + goto Exit; + } /* we now need to adjust the metrics according to the change in */ /* width/positioning that occurred during the hinting process */ if ( scaler.render_mode != FT_RENDER_MODE_LIGHT ) { - FT_Pos old_rsb, old_lsb, new_lsb; - FT_Pos pp1x_uh, pp2x_uh; - AF_AxisHints axis = &hints->axis[AF_DIMENSION_HORZ]; - AF_Edge edge1 = axis->edges; /* leftmost edge */ - AF_Edge edge2 = edge1 + - axis->num_edges - 1; /* rightmost edge */ if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) ) { - old_rsb = loader->pp2.x - edge2->opos; + AF_Edge edge1 = axis->edges; /* leftmost edge */ + AF_Edge edge2 = edge1 + + axis->num_edges - 1; /* rightmost edge */ + + FT_Pos old_rsb = loader->pp2.x - edge2->opos; /* loader->pp1.x is always zero at this point of time */ - old_lsb = edge1->opos /* - loader->pp1.x */; - new_lsb = edge1->pos; + FT_Pos old_lsb = edge1->opos; /* - loader->pp1.x */ + FT_Pos new_lsb = edge1->pos; /* remember unhinted values to later account */ /* for rounding errors */ - pp1x_uh = new_lsb - old_lsb; - pp2x_uh = edge2->pos + old_rsb; + FT_Pos pp1x_uh = new_lsb - old_lsb; + FT_Pos pp2x_uh = edge2->pos + old_rsb; + /* prefer too much space over too little space */ /* for very small sizes */ diff --git a/src/3rdparty/freetype/src/autofit/afloader.h b/src/3rdparty/freetype/src/autofit/afloader.h index d4d72d1583..d1e0f3c093 100644 --- a/src/3rdparty/freetype/src/autofit/afloader.h +++ b/src/3rdparty/freetype/src/autofit/afloader.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afloader.h */ -/* */ -/* Auto-fitter glyph loading routines (specification). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afloader.h + * + * Auto-fitter glyph loading routines (specification). + * + * Copyright (C) 2003-2019 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 AFLOADER_H_ @@ -27,11 +27,11 @@ FT_BEGIN_HEADER /* - * The autofitter module's (global) data structure to communicate with - * actual fonts. If necessary, `local' data like the current face, the - * current face's auto-hint data, or the current glyph's parameters - * relevant to auto-hinting are `swapped in'. Cf. functions like - * `af_loader_reset' and `af_loader_load_g'. + * The autofitter module's (global) data structure to communicate with + * actual fonts. If necessary, `local' data like the current face, the + * current face's auto-hint data, or the current glyph's parameters + * relevant to auto-hinting are `swapped in'. Cf. functions like + * `af_loader_reset' and `af_loader_load_g'. */ typedef struct AF_LoaderRec_ diff --git a/src/3rdparty/freetype/src/autofit/afmodule.c b/src/3rdparty/freetype/src/autofit/afmodule.c index dcaa17a27e..3e46a3655a 100644 --- a/src/3rdparty/freetype/src/autofit/afmodule.c +++ b/src/3rdparty/freetype/src/autofit/afmodule.c @@ -1,26 +1,25 @@ -/***************************************************************************/ -/* */ -/* afmodule.c */ -/* */ -/* Auto-fitter module implementation (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afmodule.c + * + * Auto-fitter module implementation (body). + * + * Copyright (C) 2003-2019 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 "afglobal.h" #include "afmodule.h" #include "afloader.h" #include "aferrors.h" -#include "afpic.h" #ifdef FT_DEBUG_AUTOFIT @@ -60,14 +59,14 @@ #include FT_SERVICE_PROPERTIES_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_afmodule +#define FT_COMPONENT afmodule static FT_Error @@ -104,19 +103,6 @@ } -#ifdef FT_CONFIG_OPTION_PIC - -#undef AF_SCRIPT_CLASSES_GET -#define AF_SCRIPT_CLASSES_GET \ - ( GET_PIC( ft_module->library )->af_script_classes ) - -#undef AF_STYLE_CLASSES_GET -#define AF_STYLE_CLASSES_GET \ - ( GET_PIC( ft_module->library )->af_style_classes ) - -#endif - - static FT_Error af_property_set( FT_Module ft_module, const char* property_name, @@ -147,9 +133,9 @@ /* We translate the fallback script to a fallback style that uses */ /* `fallback-script' as its script and `AF_COVERAGE_NONE' as its */ /* coverage value. */ - for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + for ( ss = 0; af_style_classes[ss]; ss++ ) { - AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss]; + AF_StyleClass style_class = af_style_classes[ss]; if ( (FT_UInt)style_class->script == *fallback_script && @@ -160,7 +146,7 @@ } } - if ( !AF_STYLE_CLASSES_GET[ss] ) + if ( !af_style_classes[ss] ) { FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n", fallback_script, property_name )); @@ -357,7 +343,7 @@ { FT_UInt* val = (FT_UInt*)value; - AF_StyleClass style_class = AF_STYLE_CLASSES_GET[fallback_style]; + AF_StyleClass style_class = af_style_classes[fallback_style]; *val = style_class->script; @@ -440,28 +426,16 @@ FT_DEFINE_SERVICEDESCREC1( af_services, - FT_SERVICE_ID_PROPERTIES, &AF_SERVICE_PROPERTIES_GET ) + FT_SERVICE_ID_PROPERTIES, &af_service_properties ) FT_CALLBACK_DEF( FT_Module_Interface ) af_get_interface( FT_Module module, const char* module_interface ) { - /* AF_SERVICES_GET dereferences `library' in PIC mode */ -#ifdef FT_CONFIG_OPTION_PIC - FT_Library library; - - - if ( !module ) - return NULL; - library = module->library; - if ( !library ) - return NULL; -#else FT_UNUSED( module ); -#endif - return ft_service_list_lookup( AF_SERVICES_GET, module_interface ); + return ft_service_list_lookup( af_services, module_interface ); } @@ -533,7 +507,7 @@ glyph_index, load_flags ); #ifdef FT_DEBUG_LEVEL_TRACE - if ( ft_trace_levels[FT_COMPONENT] ) + if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] ) { #endif af_glyph_hints_dump_points( hints, 0 ); @@ -589,7 +563,7 @@ 0x10000L, /* version 1.0 of the autofitter */ 0x20000L, /* requires FreeType 2.0 or above */ - (const void*)&AF_INTERFACE_GET, + (const void*)&af_autofitter_interface, (FT_Module_Constructor)af_autofitter_init, /* module_init */ (FT_Module_Destructor) af_autofitter_done, /* module_done */ diff --git a/src/3rdparty/freetype/src/autofit/afmodule.h b/src/3rdparty/freetype/src/autofit/afmodule.h index 56f64eaf23..b410809aa8 100644 --- a/src/3rdparty/freetype/src/autofit/afmodule.h +++ b/src/3rdparty/freetype/src/autofit/afmodule.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afmodule.h */ -/* */ -/* Auto-fitter module implementation (specification). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afmodule.h + * + * Auto-fitter module implementation (specification). + * + * Copyright (C) 2003-2019 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 AFMODULE_H_ @@ -28,8 +28,8 @@ FT_BEGIN_HEADER /* - * This is the `extended' FT_Module structure that holds the - * autofitter's global data. + * This is the `extended' FT_Module structure that holds the + * autofitter's global data. */ typedef struct AF_ModuleRec_ diff --git a/src/3rdparty/freetype/src/autofit/afranges.c b/src/3rdparty/freetype/src/autofit/afranges.c index cf67fafb11..45c8bbfc95 100644 --- a/src/3rdparty/freetype/src/autofit/afranges.c +++ b/src/3rdparty/freetype/src/autofit/afranges.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afranges.c */ -/* */ -/* Auto-fitter Unicode script ranges (body). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afranges.c + * + * Auto-fitter Unicode script ranges (body). + * + * Copyright (C) 2013-2019 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 "afranges.h" @@ -664,6 +664,21 @@ }; + const AF_Script_UniRangeRec af_mong_uniranges[] = + { + AF_UNIRANGE_REC( 0x1800, 0x18AF ), /* Mongolian */ + AF_UNIRANGE_REC( 0x11660, 0x1167F ), /* Mongolian Supplement */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_mong_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1885, 0x1886 ), + AF_UNIRANGE_REC( 0x18A9, 0x18A9 ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_mymr_uniranges[] = { AF_UNIRANGE_REC( 0x1000, 0x109F ), /* Myanmar */ diff --git a/src/3rdparty/freetype/src/autofit/afranges.h b/src/3rdparty/freetype/src/autofit/afranges.h index ba3b5e7ccb..d5917aefed 100644 --- a/src/3rdparty/freetype/src/autofit/afranges.h +++ b/src/3rdparty/freetype/src/autofit/afranges.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afranges.h */ -/* */ -/* Auto-fitter Unicode script ranges (specification). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afranges.h + * + * Auto-fitter Unicode script ranges (specification). + * + * Copyright (C) 2013-2019 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 AFRANGES_H_ diff --git a/src/3rdparty/freetype/src/autofit/afscript.h b/src/3rdparty/freetype/src/autofit/afscript.h index 623a1734a6..2da8c70183 100644 --- a/src/3rdparty/freetype/src/autofit/afscript.h +++ b/src/3rdparty/freetype/src/autofit/afscript.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afscript.h */ -/* */ -/* Auto-fitter scripts (specification only). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afscript.h + * + * Auto-fitter scripts (specification only). + * + * Copyright (C) 2013-2019 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 following part can be included multiple times. */ @@ -243,6 +243,12 @@ HINTING_BOTTOM_TO_TOP, "\xE0\xB4\xA0 \xE0\xB4\xB1" ) /* ഠ റ */ + SCRIPT( mong, MONG, + "Mongolian", + HB_SCRIPT_MONGOLIAN, + HINTING_TOP_TO_BOTTOM, + "\xE1\xA1\x82 \xE1\xA0\xAA" ) /* ᡂ ᠪ */ + SCRIPT( mymr, MYMR, "Myanmar", HB_SCRIPT_MYANMAR, diff --git a/src/3rdparty/freetype/src/autofit/afshaper.c b/src/3rdparty/freetype/src/autofit/afshaper.c index f30828173c..a5191c6915 100644 --- a/src/3rdparty/freetype/src/autofit/afshaper.c +++ b/src/3rdparty/freetype/src/autofit/afshaper.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afshaper.c */ -/* */ -/* HarfBuzz interface for accessing OpenType features (body). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afshaper.c + * + * HarfBuzz interface for accessing OpenType features (body). + * + * Copyright (C) 2013-2019 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 @@ -26,14 +26,14 @@ #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_afshaper +#define FT_COMPONENT afshaper /* @@ -591,14 +591,9 @@ void* af_shaper_buf_create( FT_Face face ) { - FT_Error error; - FT_Memory memory = face->memory; - FT_ULong* buf; - - - FT_MEM_ALLOC( buf, sizeof ( FT_ULong ) ); + FT_UNUSED( face ); - return (void*)buf; + return NULL; } @@ -606,10 +601,8 @@ af_shaper_buf_destroy( FT_Face face, void* buf ) { - FT_Memory memory = face->memory; - - - FT_FREE( buf ); + FT_UNUSED( face ); + FT_UNUSED( buf ); } diff --git a/src/3rdparty/freetype/src/autofit/afshaper.h b/src/3rdparty/freetype/src/autofit/afshaper.h index 7efd9f6a4e..06a1e06616 100644 --- a/src/3rdparty/freetype/src/autofit/afshaper.h +++ b/src/3rdparty/freetype/src/autofit/afshaper.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afshaper.h */ -/* */ -/* HarfBuzz interface for accessing OpenType features (specification). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afshaper.h + * + * HarfBuzz interface for accessing OpenType features (specification). + * + * Copyright (C) 2013-2019 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 AFSHAPER_H_ diff --git a/src/3rdparty/freetype/src/autofit/afstyles.h b/src/3rdparty/freetype/src/autofit/afstyles.h index e2688b3fc2..8d1d70812f 100644 --- a/src/3rdparty/freetype/src/autofit/afstyles.h +++ b/src/3rdparty/freetype/src/autofit/afstyles.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afstyles.h */ -/* */ -/* Auto-fitter styles (specification only). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afstyles.h + * + * Auto-fitter styles (specification only). + * + * Copyright (C) 2013-2019 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 following part can be included multiple times. */ @@ -322,6 +322,13 @@ AF_BLUE_STRINGSET_MLYM, AF_COVERAGE_DEFAULT ) + STYLE( mong_dflt, MONG_DFLT, + "Mongolian default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_MONG, + AF_BLUE_STRINGSET_MONG, + AF_COVERAGE_DEFAULT ) + STYLE( mymr_dflt, MYMR_DFLT, "Myanmar default style", AF_WRITING_SYSTEM_LATIN, diff --git a/src/3rdparty/freetype/src/autofit/aftypes.h b/src/3rdparty/freetype/src/autofit/aftypes.h index 6bd8c895b2..579003d27d 100644 --- a/src/3rdparty/freetype/src/autofit/aftypes.h +++ b/src/3rdparty/freetype/src/autofit/aftypes.h @@ -1,30 +1,30 @@ -/***************************************************************************/ -/* */ -/* aftypes.h */ -/* */ -/* Auto-fitter types (specification only). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aftypes.h + * + * Auto-fitter types (specification only). + * + * Copyright (C) 2003-2019 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 auto-fitter is a complete rewrite of the old auto-hinter. - * Its main feature is the ability to differentiate between different - * writing systems and scripts in order to apply specific rules. + * The auto-fitter is a complete rewrite of the old auto-hinter. + * Its main feature is the ability to differentiate between different + * writing systems and scripts in order to apply specific rules. * - * The code has also been compartmentalized into several entities that - * should make algorithmic experimentation easier than with the old - * code. + * The code has also been compartmentalized into several entities that + * should make algorithmic experimentation easier than with the old + * code. * *************************************************************************/ @@ -102,9 +102,9 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * 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). + * 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; @@ -118,7 +118,7 @@ extern void* _af_debug_hints; #if 0 /* - * compute the angle of a given 2-D vector + * compute the angle of a given 2-D vector */ FT_LOCAL( AF_Angle ) af_angle_atan( FT_Pos dx, @@ -126,8 +126,8 @@ extern void* _af_debug_hints; /* - * compute `angle2 - angle1'; the result is always within - * the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1] + * 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, @@ -150,8 +150,9 @@ extern void* _af_debug_hints; FT_END_STMNT - /* opaque handle to glyph-specific hints -- see `afhints.h' for more - * details + /* + * opaque handle to glyph-specific hints -- see `afhints.h' for more + * details */ typedef struct AF_GlyphHintsRec_* AF_GlyphHints; @@ -165,8 +166,8 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * A scaler models the target pixel device that will receive the - * auto-hinted glyph image. + * A scaler models the target pixel device that will receive the + * auto-hinted glyph image. */ #define AF_SCALER_FLAG_NO_HORIZONTAL 1U /* disable horizontal hinting */ @@ -197,8 +198,9 @@ extern void* _af_debug_hints; typedef struct AF_StyleMetricsRec_* AF_StyleMetrics; - /* This function parses an FT_Face to compute global metrics for - * a specific style. + /* + * This function parses an FT_Face to compute global metrics for + * a specific style. */ typedef FT_Error (*AF_WritingSystem_InitMetricsFunc)( AF_StyleMetrics metrics, @@ -237,22 +239,22 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * For the auto-hinter, a writing system consists of multiple scripts that - * can be handled similarly *in a typographical way*; the relationship is - * not based on history. For example, both the Greek and the unrelated - * Armenian scripts share the same features like ascender, descender, - * x-height, etc. Essentially, a writing system is covered by a - * submodule of the auto-fitter; it contains + * For the auto-hinter, a writing system consists of multiple scripts that + * can be handled similarly *in a typographical way*; the relationship is + * not based on history. For example, both the Greek and the unrelated + * Armenian scripts share the same features like ascender, descender, + * x-height, etc. Essentially, a writing system is covered by a + * submodule of the auto-fitter; it contains * - * - a specific global analyzer that computes global metrics specific to - * the script (based on script-specific characters to identify ascender - * height, x-height, etc.), + * - a specific global analyzer that computes global metrics specific to + * the script (based on script-specific characters to identify ascender + * height, x-height, etc.), * - * - a specific glyph analyzer that computes segments and edges for each - * glyph covered by the script, + * - a specific glyph analyzer that computes segments and edges for each + * glyph covered by the script, * - * - a specific grid-fitting algorithm that distorts the scaled glyph - * outline according to the results of the glyph analyzer. + * - a specific grid-fitting algorithm that distorts the scaled glyph + * outline according to the results of the glyph analyzer. */ #define AFWRTSYS_H_ /* don't load header files */ @@ -300,12 +302,12 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * Each script is associated with two sets of Unicode ranges to test - * whether the font face supports the script, and which non-base - * characters the script contains. + * Each script is associated with two sets of Unicode ranges to test + * whether the font face supports the script, and which non-base + * characters the script contains. * - * We use four-letter script tags from the OpenType specification, - * extended by `NONE', which indicates `no script'. + * We use four-letter script tags from the OpenType specification, + * extended by `NONE', which indicates `no script'. */ #undef SCRIPT @@ -361,41 +363,41 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * Usually, a font contains more glyphs than can be addressed by its - * character map. + * Usually, a font contains more glyphs than can be addressed by its + * character map. * - * In the PostScript font world, encoding vectors specific to a given - * task are used to select such glyphs, and these glyphs can be often - * recognized by having a suffix in its glyph names. For example, a - * superscript glyph `A' might be called `A.sup'. Unfortunately, this - * naming scheme is not standardized and thus unusable for us. + * In the PostScript font world, encoding vectors specific to a given + * task are used to select such glyphs, and these glyphs can be often + * recognized by having a suffix in its glyph names. For example, a + * superscript glyph `A' might be called `A.sup'. Unfortunately, this + * naming scheme is not standardized and thus unusable for us. * - * In the OpenType world, a better solution was invented, namely - * `features', which cleanly separate a character's input encoding from - * the corresponding glyph's appearance, and which don't use glyph names - * at all. For our purposes, and slightly generalized, an OpenType - * feature is a name of a mapping that maps character codes to - * non-standard glyph indices (features get used for other things also). - * For example, the `sups' feature provides superscript glyphs, thus - * mapping character codes like `A' or `B' to superscript glyph - * representation forms. How this mapping happens is completely - * uninteresting to us. + * In the OpenType world, a better solution was invented, namely + * `features', which cleanly separate a character's input encoding from + * the corresponding glyph's appearance, and which don't use glyph names + * at all. For our purposes, and slightly generalized, an OpenType + * feature is a name of a mapping that maps character codes to + * non-standard glyph indices (features get used for other things also). + * For example, the `sups' feature provides superscript glyphs, thus + * mapping character codes like `A' or `B' to superscript glyph + * representation forms. How this mapping happens is completely + * uninteresting to us. * - * For the auto-hinter, a `coverage' represents all glyphs of an OpenType - * feature collected in a set (as listed below) that can be hinted - * together. To continue the above example, superscript glyphs must not - * be hinted together with normal glyphs because the blue zones - * completely differ. + * For the auto-hinter, a `coverage' represents all glyphs of an OpenType + * feature collected in a set (as listed below) that can be hinted + * together. To continue the above example, superscript glyphs must not + * be hinted together with normal glyphs because the blue zones + * completely differ. * - * Note that FreeType itself doesn't compute coverages; it only provides - * the glyphs addressable by the default Unicode character map. Instead, - * we use the HarfBuzz library (if available), which has many functions - * exactly for this purpose. + * Note that FreeType itself doesn't compute coverages; it only provides + * the glyphs addressable by the default Unicode character map. Instead, + * we use the HarfBuzz library (if available), which has many functions + * exactly for this purpose. * - * AF_COVERAGE_DEFAULT is special: It should cover everything that isn't - * listed separately (including the glyphs addressable by the character - * map). In case HarfBuzz isn't available, it exactly covers the glyphs - * addressable by the character map. + * AF_COVERAGE_DEFAULT is special: It should cover everything that isn't + * listed separately (including the glyphs addressable by the character + * map). In case HarfBuzz isn't available, it exactly covers the glyphs + * addressable by the character map. * */ @@ -423,8 +425,8 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * The topmost structure for modelling the auto-hinter glyph input data - * is a `style class', grouping everything together. + * The topmost structure for modelling the auto-hinter glyph input data + * is a `style class', grouping everything together. */ #undef STYLE @@ -486,8 +488,6 @@ extern void* _af_debug_hints; /* Declare and define vtables for classes */ -#ifndef FT_CONFIG_OPTION_PIC - #define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \ FT_CALLBACK_TABLE const AF_WritingSystemClassRec \ writing_system_class; @@ -562,87 +562,9 @@ extern void* _af_debug_hints; coverage \ }; -#else /* FT_CONFIG_OPTION_PIC */ - -#define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \ - FT_LOCAL( void ) \ - FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ); - -#define AF_DEFINE_WRITING_SYSTEM_CLASS( \ - writing_system_class, \ - system, \ - m_size, \ - m_init, \ - m_scale, \ - m_done, \ - m_stdw, \ - h_init, \ - h_apply ) \ - FT_LOCAL_DEF( void ) \ - FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ) \ - { \ - ac->writing_system = system; \ - \ - ac->style_metrics_size = m_size; \ - \ - ac->style_metrics_init = m_init; \ - ac->style_metrics_scale = m_scale; \ - ac->style_metrics_done = m_done; \ - ac->style_metrics_getstdw = m_stdw; \ - \ - ac->style_hints_init = h_init; \ - ac->style_hints_apply = h_apply; \ - } - - -#define AF_DECLARE_SCRIPT_CLASS( script_class ) \ - FT_LOCAL( void ) \ - FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ); - -#define AF_DEFINE_SCRIPT_CLASS( \ - script_class, \ - script_, \ - ranges, \ - nonbase_ranges, \ - top_to_bottom, \ - std_charstring ) \ - FT_LOCAL_DEF( void ) \ - FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ - { \ - ac->script = script_; \ - ac->script_uni_ranges = ranges; \ - ac->script_uni_nonbase_ranges = nonbase_ranges; \ - ac->top_to_bottom_hinting = top_to_bottom; \ - ac->standard_charstring = std_charstring; \ - } - - -#define AF_DECLARE_STYLE_CLASS( style_class ) \ - FT_LOCAL( void ) \ - FT_Init_Class_ ## style_class( AF_StyleClassRec* ac ); - -#define AF_DEFINE_STYLE_CLASS( \ - style_class, \ - style_, \ - writing_system_, \ - script_, \ - blue_stringset_, \ - coverage_ ) \ - FT_LOCAL_DEF( void ) \ - FT_Init_Class_ ## style_class( AF_StyleClassRec* ac ) \ - { \ - ac->style = style_; \ - ac->writing_system = writing_system_; \ - ac->script = script_; \ - ac->blue_stringset = blue_stringset_; \ - ac->coverage = coverage_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ + FT_END_HEADER #endif /* AFTYPES_H_ */ diff --git a/src/3rdparty/freetype/src/autofit/afwarp.c b/src/3rdparty/freetype/src/autofit/afwarp.c index 2a75ea7b35..84e9753ad9 100644 --- a/src/3rdparty/freetype/src/autofit/afwarp.c +++ b/src/3rdparty/freetype/src/autofit/afwarp.c @@ -1,40 +1,40 @@ -/***************************************************************************/ -/* */ -/* afwarp.c */ -/* */ -/* Auto-fitter warping algorithm (body). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afwarp.c + * + * Auto-fitter warping algorithm (body). + * + * Copyright (C) 2006-2019 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. + * 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_afwarp +#define FT_COMPONENT afwarp /* The weights cover the range 0/64 - 63/64 of a pixel. Obviously, */ diff --git a/src/3rdparty/freetype/src/autofit/afwarp.h b/src/3rdparty/freetype/src/autofit/afwarp.h index 520b1be907..9a2c9a42c1 100644 --- a/src/3rdparty/freetype/src/autofit/afwarp.h +++ b/src/3rdparty/freetype/src/autofit/afwarp.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afwarp.h */ -/* */ -/* Auto-fitter warping algorithm (specification). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afwarp.h + * + * Auto-fitter warping algorithm (specification). + * + * Copyright (C) 2006-2019 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_ @@ -47,12 +47,14 @@ FT_BEGIN_HEADER } 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_Fixed *a_delta ); + FT_Pos *a_delta ); +#endif FT_END_HEADER diff --git a/src/3rdparty/freetype/src/autofit/afwrtsys.h b/src/3rdparty/freetype/src/autofit/afwrtsys.h index 4675f3242d..5611cf441a 100644 --- a/src/3rdparty/freetype/src/autofit/afwrtsys.h +++ b/src/3rdparty/freetype/src/autofit/afwrtsys.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afwrtsys.h */ -/* */ -/* Auto-fitter writing systems (specification only). */ -/* */ -/* Copyright 2013-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afwrtsys.h + * + * Auto-fitter writing systems (specification only). + * + * Copyright (C) 2013-2019 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 AFWRTSYS_H_ diff --git a/src/3rdparty/freetype/src/autofit/autofit.c b/src/3rdparty/freetype/src/autofit/autofit.c index c1605160a1..facfec1744 100644 --- a/src/3rdparty/freetype/src/autofit/autofit.c +++ b/src/3rdparty/freetype/src/autofit/autofit.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* autofit.c */ -/* */ -/* Auto-fitter module (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * autofit.c + * + * Auto-fitter module (body). + * + * Copyright (C) 2003-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT @@ -30,7 +30,6 @@ #include "aflatin2.c" #include "afloader.c" #include "afmodule.c" -#include "afpic.c" #include "afranges.c" #include "afshaper.c" #include "afwarp.c" diff --git a/src/3rdparty/freetype/src/autofit/module.mk b/src/3rdparty/freetype/src/autofit/module.mk index ff05f83e7e..cf77b169f7 100644 --- a/src/3rdparty/freetype/src/autofit/module.mk +++ b/src/3rdparty/freetype/src/autofit/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2018 by +# Copyright (C) 2003-2019 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/src/3rdparty/freetype/src/autofit/rules.mk b/src/3rdparty/freetype/src/autofit/rules.mk index 75171b412c..c59da33a55 100644 --- a/src/3rdparty/freetype/src/autofit/rules.mk +++ b/src/3rdparty/freetype/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2018 by +# Copyright (C) 2003-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -38,7 +38,6 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ $(AUTOF_DIR)/aflatin.c \ $(AUTOF_DIR)/afloader.c \ $(AUTOF_DIR)/afmodule.c \ - $(AUTOF_DIR)/afpic.c \ $(AUTOF_DIR)/afranges.c \ $(AUTOF_DIR)/afshaper.c \ $(AUTOF_DIR)/afwarp.c diff --git a/src/3rdparty/freetype/src/base/Jamfile b/src/3rdparty/freetype/src/base/Jamfile index 4994c1b4ca..8e1ec42756 100644 --- a/src/3rdparty/freetype/src/base/Jamfile +++ b/src/3rdparty/freetype/src/base/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/base Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -20,7 +20,9 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; _sources = basepic ftadvanc ftcalc + ftcolor ftdbgmem + fterrors ftfntfmt ftgloadr fthash @@ -47,8 +49,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; # Add the optional/replaceable files. # { - local _sources = ftapi - ftbbox + local _sources = ftbbox ftbdf ftbitmap ftcid diff --git a/src/3rdparty/freetype/src/base/ftadvanc.c b/src/3rdparty/freetype/src/base/ftadvanc.c index 230c84d6ad..0dfba57036 100644 --- a/src/3rdparty/freetype/src/base/ftadvanc.c +++ b/src/3rdparty/freetype/src/base/ftadvanc.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftadvanc.c */ -/* */ -/* Quick computation of advance widths (body). */ -/* */ -/* Copyright 2008-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftadvanc.c + * + * Quick computation of advance widths (body). + * + * Copyright (C) 2008-2019 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 diff --git a/src/3rdparty/freetype/src/base/ftbase.c b/src/3rdparty/freetype/src/base/ftbase.c index f914b9b247..fb8cbfcc27 100644 --- a/src/3rdparty/freetype/src/base/ftbase.c +++ b/src/3rdparty/freetype/src/base/ftbase.c @@ -1,28 +1,29 @@ -/***************************************************************************/ -/* */ -/* ftbase.c */ -/* */ -/* Single object library component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftbase.c + * + * Single object library component (body only). + * + * Copyright (C) 1996-2019 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 #define FT_MAKE_OPTION_SINGLE_OBJECT -#include "basepic.c" #include "ftadvanc.c" #include "ftcalc.c" +#include "ftcolor.c" #include "ftdbgmem.c" +#include "fterrors.c" #include "ftfntfmt.c" #include "ftgloadr.c" #include "fthash.c" @@ -30,7 +31,6 @@ #include "ftmac.c" #include "ftobjs.c" #include "ftoutln.c" -#include "ftpic.c" #include "ftpsprop.c" #include "ftrfork.c" #include "ftsnames.c" diff --git a/src/3rdparty/freetype/src/base/ftbase.h b/src/3rdparty/freetype/src/base/ftbase.h index 7e8cfad959..35b1c47fd9 100644 --- a/src/3rdparty/freetype/src/base/ftbase.h +++ b/src/3rdparty/freetype/src/base/ftbase.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftbase.h */ -/* */ -/* Private functions used in the `base' module (specification). */ -/* */ -/* Copyright 2008-2018 by */ -/* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftbase.h + * + * Private functions used in the `base' module (specification). + * + * Copyright (C) 2008-2019 by + * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef FTBASE_H_ diff --git a/src/3rdparty/freetype/src/base/ftbbox.c b/src/3rdparty/freetype/src/base/ftbbox.c index 151e85c97a..a0b2c46f7b 100644 --- a/src/3rdparty/freetype/src/base/ftbbox.c +++ b/src/3rdparty/freetype/src/base/ftbbox.c @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* ftbbox.c */ -/* */ -/* FreeType bbox computation (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified 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 component has a _single_ role: to compute exact outline bounding */ - /* boxes. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftbbox.c + * + * FreeType bbox computation (body). + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used + * modified and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This component has a _single_ role: to compute exact outline bounding + * boxes. + * + */ #include @@ -61,26 +61,28 @@ ( p->y < bbox.yMin || p->y > bbox.yMax ) - /*************************************************************************/ - /* */ - /* */ - /* BBox_Move_To */ - /* */ - /* */ - /* This function is used as a `move_to' emitter during */ - /* FT_Outline_Decompose(). It simply records the destination point */ - /* in `user->last'. We also update bbox in case contour starts with */ - /* an implicit `on' point. */ - /* */ - /* */ - /* to :: A pointer to the destination vector. */ - /* */ - /* */ - /* user :: A pointer to the current walk context. */ - /* */ - /* */ - /* Always 0. Needed for the interface only. */ - /* */ + /************************************************************************** + * + * @Function: + * BBox_Move_To + * + * @Description: + * This function is used as a `move_to' emitter during + * FT_Outline_Decompose(). It simply records the destination point + * in `user->last'. We also update bbox in case contour starts with + * an implicit `on' point. + * + * @Input: + * to :: + * A pointer to the destination vector. + * + * @InOut: + * user :: + * A pointer to the current walk context. + * + * @Return: + * Always 0. Needed for the interface only. + */ static int BBox_Move_To( FT_Vector* to, TBBox_Rec* user ) @@ -93,26 +95,28 @@ } - /*************************************************************************/ - /* */ - /* */ - /* BBox_Line_To */ - /* */ - /* */ - /* This function is used as a `line_to' emitter during */ - /* FT_Outline_Decompose(). It simply records the destination point */ - /* in `user->last'; no further computations are necessary because */ - /* bbox already contains both explicit ends of the line segment. */ - /* */ - /* */ - /* to :: A pointer to the destination vector. */ - /* */ - /* */ - /* user :: A pointer to the current walk context. */ - /* */ - /* */ - /* Always 0. Needed for the interface only. */ - /* */ + /************************************************************************** + * + * @Function: + * BBox_Line_To + * + * @Description: + * This function is used as a `line_to' emitter during + * FT_Outline_Decompose(). It simply records the destination point + * in `user->last'; no further computations are necessary because + * bbox already contains both explicit ends of the line segment. + * + * @Input: + * to :: + * A pointer to the destination vector. + * + * @InOut: + * user :: + * A pointer to the current walk context. + * + * @Return: + * Always 0. Needed for the interface only. + */ static int BBox_Line_To( FT_Vector* to, TBBox_Rec* user ) @@ -123,28 +127,33 @@ } - /*************************************************************************/ - /* */ - /* */ - /* BBox_Conic_Check */ - /* */ - /* */ - /* Find the extrema of a 1-dimensional conic Bezier curve and update */ - /* a bounding range. This version uses direct computation, as it */ - /* doesn't need square roots. */ - /* */ - /* */ - /* y1 :: The start coordinate. */ - /* */ - /* y2 :: The coordinate of the control point. */ - /* */ - /* y3 :: The end coordinate. */ - /* */ - /* */ - /* min :: The address of the current minimum. */ - /* */ - /* max :: The address of the current maximum. */ - /* */ + /************************************************************************** + * + * @Function: + * BBox_Conic_Check + * + * @Description: + * Find the extrema of a 1-dimensional conic Bezier curve and update + * a bounding range. This version uses direct computation, as it + * doesn't need square roots. + * + * @Input: + * y1 :: + * The start coordinate. + * + * y2 :: + * The coordinate of the control point. + * + * y3 :: + * The end coordinate. + * + * @InOut: + * min :: + * The address of the current minimum. + * + * max :: + * The address of the current maximum. + */ static void BBox_Conic_Check( FT_Pos y1, FT_Pos y2, @@ -168,32 +177,35 @@ } - /*************************************************************************/ - /* */ - /* */ - /* BBox_Conic_To */ - /* */ - /* */ - /* This function is used as a `conic_to' emitter during */ - /* FT_Outline_Decompose(). It checks a conic Bezier curve with the */ - /* current bounding box, and computes its extrema if necessary to */ - /* update it. */ - /* */ - /* */ - /* control :: A pointer to a control point. */ - /* */ - /* to :: A pointer to the destination vector. */ - /* */ - /* */ - /* user :: The address of the current walk context. */ - /* */ - /* */ - /* Always 0. Needed for the interface only. */ - /* */ - /* */ - /* In the case of a non-monotonous arc, we compute directly the */ - /* extremum coordinates, as it is sufficiently fast. */ - /* */ + /************************************************************************** + * + * @Function: + * BBox_Conic_To + * + * @Description: + * This function is used as a `conic_to' emitter during + * FT_Outline_Decompose(). It checks a conic Bezier curve with the + * current bounding box, and computes its extrema if necessary to + * update it. + * + * @Input: + * control :: + * A pointer to a control point. + * + * to :: + * A pointer to the destination vector. + * + * @InOut: + * user :: + * The address of the current walk context. + * + * @Return: + * Always 0. Needed for the interface only. + * + * @Note: + * In the case of a non-monotonous arc, we compute directly the + * extremum coordinates, as it is sufficiently fast. + */ static int BBox_Conic_To( FT_Vector* control, FT_Vector* to, @@ -222,30 +234,36 @@ } - /*************************************************************************/ - /* */ - /* */ - /* BBox_Cubic_Check */ - /* */ - /* */ - /* Find the extrema of a 1-dimensional cubic Bezier curve and */ - /* update a bounding range. This version uses iterative splitting */ - /* because it is faster than the exact solution with square roots. */ - /* */ - /* */ - /* p1 :: The start coordinate. */ - /* */ - /* p2 :: The coordinate of the first control point. */ - /* */ - /* p3 :: The coordinate of the second control point. */ - /* */ - /* p4 :: The end coordinate. */ - /* */ - /* */ - /* min :: The address of the current minimum. */ - /* */ - /* max :: The address of the current maximum. */ - /* */ + /************************************************************************** + * + * @Function: + * BBox_Cubic_Check + * + * @Description: + * Find the extrema of a 1-dimensional cubic Bezier curve and + * update a bounding range. This version uses iterative splitting + * because it is faster than the exact solution with square roots. + * + * @Input: + * p1 :: + * The start coordinate. + * + * p2 :: + * The coordinate of the first control point. + * + * p3 :: + * The coordinate of the second control point. + * + * p4 :: + * The end coordinate. + * + * @InOut: + * min :: + * The address of the current minimum. + * + * max :: + * The address of the current maximum. + */ static FT_Pos cubic_peak( FT_Pos q1, FT_Pos q2, @@ -301,9 +319,9 @@ q2 = q2 + q1; q4 = q4 + q3; q3 = q3 + q2; - q4 = ( q4 + q3 ) / 8; - q3 = q3 / 4; - q2 = q2 / 2; + q4 = ( q4 + q3 ) >> 3; + q3 = q3 >> 2; + q2 = q2 >> 1; } else /* second half */ { @@ -312,9 +330,9 @@ q3 = q3 + q4; q1 = q1 + q2; q2 = q2 + q3; - q1 = ( q1 + q2 ) / 8; - q2 = q2 / 4; - q3 = q3 / 2; + q1 = ( q1 + q2 ) >> 3; + q2 = q2 >> 2; + q3 = q3 >> 1; } /* check whether either end reached the maximum */ @@ -361,34 +379,38 @@ } - /*************************************************************************/ - /* */ - /* */ - /* BBox_Cubic_To */ - /* */ - /* */ - /* This function is used as a `cubic_to' emitter during */ - /* FT_Outline_Decompose(). It checks a cubic Bezier curve with the */ - /* current bounding box, and computes its extrema if necessary to */ - /* update it. */ - /* */ - /* */ - /* control1 :: A pointer to the first control point. */ - /* */ - /* control2 :: A pointer to the second control point. */ - /* */ - /* to :: A pointer to the destination vector. */ - /* */ - /* */ - /* user :: The address of the current walk context. */ - /* */ - /* */ - /* Always 0. Needed for the interface only. */ - /* */ - /* */ - /* In the case of a non-monotonous arc, we don't compute directly */ - /* extremum coordinates, we subdivide instead. */ - /* */ + /************************************************************************** + * + * @Function: + * BBox_Cubic_To + * + * @Description: + * This function is used as a `cubic_to' emitter during + * FT_Outline_Decompose(). It checks a cubic Bezier curve with the + * current bounding box, and computes its extrema if necessary to + * update it. + * + * @Input: + * control1 :: + * A pointer to the first control point. + * + * control2 :: + * A pointer to the second control point. + * + * to :: + * A pointer to the destination vector. + * + * @InOut: + * user :: + * The address of the current walk context. + * + * @Return: + * Always 0. Needed for the interface only. + * + * @Note: + * In the case of a non-monotonous arc, we don't compute directly + * extremum coordinates, we subdivide instead. + */ static int BBox_Cubic_To( FT_Vector* control1, FT_Vector* control2, @@ -490,12 +512,6 @@ FT_Error error; TBBox_Rec user; -#ifdef FT_CONFIG_OPTION_PIC - FT_Outline_Funcs bbox_interface; - - - Init_Class_bbox_interface( &bbox_interface ); -#endif user.bbox = bbox; diff --git a/src/3rdparty/freetype/src/base/ftbdf.c b/src/3rdparty/freetype/src/base/ftbdf.c index c4ea502fbc..c0fccd7b7c 100644 --- a/src/3rdparty/freetype/src/base/ftbdf.c +++ b/src/3rdparty/freetype/src/base/ftbdf.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftbdf.c */ -/* */ -/* FreeType API for accessing BDF-specific strings (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftbdf.c + * + * FreeType API for accessing BDF-specific strings (body). + * + * Copyright (C) 2002-2019 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 diff --git a/src/3rdparty/freetype/src/base/ftbitmap.c b/src/3rdparty/freetype/src/base/ftbitmap.c index a9746663fa..0e0a76fe40 100644 --- a/src/3rdparty/freetype/src/base/ftbitmap.c +++ b/src/3rdparty/freetype/src/base/ftbitmap.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftbitmap.c */ -/* */ -/* FreeType utility functions for bitmaps (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftbitmap.c + * + * FreeType utility functions for bitmaps (body). + * + * Copyright (C) 2004-2019 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 @@ -24,8 +24,18 @@ #include FT_INTERNAL_OBJECTS_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 bitmap + + static - const FT_Bitmap null_bitmap = { 0, 0, 0, 0, 0, 0, 0, 0 }; + const FT_Bitmap null_bitmap = { 0, 0, 0, NULL, 0, 0, 0, NULL }; /* documentation is in ftbitmap.h */ @@ -783,6 +793,338 @@ } + /* documentation is in ftbitmap.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Blend( FT_Library library, + const FT_Bitmap* source_, + const FT_Vector source_offset_, + FT_Bitmap* target, + FT_Vector *atarget_offset, + FT_Color color ) + { + FT_Error error = FT_Err_Ok; + FT_Memory memory; + + FT_Bitmap source_bitmap; + const FT_Bitmap* source; + + FT_Vector source_offset; + FT_Vector target_offset; + + FT_Bool free_source_bitmap = 0; + FT_Bool free_target_bitmap_on_error = 0; + + FT_Pos source_llx, source_lly, source_urx, source_ury; + FT_Pos target_llx, target_lly, target_urx, target_ury; + FT_Pos final_llx, final_lly, final_urx, final_ury; + + unsigned int final_rows, final_width; + long x, y; + + + if ( !library || !target || !source_ || !atarget_offset ) + return FT_THROW( Invalid_Argument ); + + memory = library->memory; + + if ( !( target->pixel_mode == FT_PIXEL_MODE_NONE || + ( target->pixel_mode == FT_PIXEL_MODE_BGRA && + target->buffer ) ) ) + return FT_THROW( Invalid_Argument ); + + if ( source_->pixel_mode == FT_PIXEL_MODE_NONE ) + return FT_Err_Ok; /* nothing to do */ + + /* pitches must have the same sign */ + if ( target->pixel_mode == FT_PIXEL_MODE_BGRA && + ( source_->pitch ^ target->pitch ) < 0 ) + return FT_THROW( Invalid_Argument ); + + if ( !( source_->width && source_->rows ) ) + return FT_Err_Ok; /* nothing to do */ + + /* assure integer pixel offsets */ + source_offset.x = FT_PIX_FLOOR( source_offset_.x ); + source_offset.y = FT_PIX_FLOOR( source_offset_.y ); + target_offset.x = FT_PIX_FLOOR( atarget_offset->x ); + target_offset.y = FT_PIX_FLOOR( atarget_offset->y ); + + /* get source bitmap dimensions */ + source_llx = source_offset.x; + if ( FT_LONG_MIN + (FT_Pos)( source_->rows << 6 ) + 64 > source_offset.y ) + { + FT_TRACE5(( + "FT_Bitmap_Blend: y coordinate overflow in source bitmap\n" )); + return FT_THROW( Invalid_Argument ); + } + source_lly = source_offset.y - ( source_->rows << 6 ); + + if ( FT_LONG_MAX - (FT_Pos)( source_->width << 6 ) - 64 < source_llx ) + { + FT_TRACE5(( + "FT_Bitmap_Blend: x coordinate overflow in source bitmap\n" )); + return FT_THROW( Invalid_Argument ); + } + source_urx = source_llx + ( source_->width << 6 ); + source_ury = source_offset.y; + + /* get target bitmap dimensions */ + if ( target->width && target->rows ) + { + target_llx = target_offset.x; + if ( FT_LONG_MIN + (FT_Pos)( target->rows << 6 ) > target_offset.y ) + { + FT_TRACE5(( + "FT_Bitmap_Blend: y coordinate overflow in target bitmap\n" )); + return FT_THROW( Invalid_Argument ); + } + target_lly = target_offset.y - ( target->rows << 6 ); + + if ( FT_LONG_MAX - (FT_Pos)( target->width << 6 ) < target_llx ) + { + FT_TRACE5(( + "FT_Bitmap_Blend: x coordinate overflow in target bitmap\n" )); + return FT_THROW( Invalid_Argument ); + } + target_urx = target_llx + ( target->width << 6 ); + target_ury = target_offset.y; + } + else + { + target_llx = FT_LONG_MAX; + target_lly = FT_LONG_MAX; + target_urx = FT_LONG_MIN; + target_ury = FT_LONG_MIN; + } + + /* compute final bitmap dimensions */ + final_llx = FT_MIN( source_llx, target_llx ); + final_lly = FT_MIN( source_lly, target_lly ); + final_urx = FT_MAX( source_urx, target_urx ); + final_ury = FT_MAX( source_ury, target_ury ); + + final_width = ( final_urx - final_llx ) >> 6; + final_rows = ( final_ury - final_lly ) >> 6; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE5(( "FT_Bitmap_Blend:\n" + " source bitmap: (%d, %d) -- (%d, %d); %d x %d\n", + source_llx / 64, source_lly / 64, + source_urx / 64, source_ury / 64, + source_->width, source_->rows )); + + if ( target->width && target->rows ) + FT_TRACE5(( " target bitmap: (%d, %d) -- (%d, %d); %d x %d\n", + target_llx / 64, target_lly / 64, + target_urx / 64, target_ury / 64, + target->width, target->rows )); + else + FT_TRACE5(( " target bitmap: empty\n" )); + + if ( final_width && final_rows ) + FT_TRACE5(( " final bitmap: (%d, %d) -- (%d, %d); %d x %d\n", + final_llx / 64, final_lly / 64, + final_urx / 64, final_ury / 64, + final_width, final_rows )); + else + FT_TRACE5(( " final bitmap: empty\n" )); +#endif /* FT_DEBUG_LEVEL_TRACE */ + + if ( !( final_width && final_rows ) ) + return FT_Err_Ok; /* nothing to do */ + + /* for blending, set offset vector of final bitmap */ + /* temporarily to (0,0) */ + source_llx -= final_llx; + source_lly -= final_lly; + + if ( target->width && target->rows ) + { + target_llx -= final_llx; + target_lly -= final_lly; + } + + /* set up target bitmap */ + if ( target->pixel_mode == FT_PIXEL_MODE_NONE ) + { + /* create new empty bitmap */ + target->width = final_width; + target->rows = final_rows; + target->pixel_mode = FT_PIXEL_MODE_BGRA; + target->pitch = (int)final_width * 4; + target->num_grays = 256; + + if ( FT_LONG_MAX / target->pitch < (int)target->rows ) + { + FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%d x %d)\n", + final_width, final_rows )); + return FT_THROW( Invalid_Argument ); + } + + if ( FT_ALLOC( target->buffer, target->pitch * (int)target->rows ) ) + return error; + + free_target_bitmap_on_error = 1; + } + else if ( target->width != final_width || + target->rows != final_rows ) + { + /* adjust old bitmap to enlarged size */ + int pitch, new_pitch; + + unsigned char* buffer = NULL; + + + pitch = target->pitch; + + if ( pitch < 0 ) + pitch = -pitch; + + new_pitch = (int)final_width * 4; + + if ( FT_LONG_MAX / new_pitch < (int)final_rows ) + { + FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%d x %d)\n", + final_width, final_rows )); + return FT_THROW( Invalid_Argument ); + } + + /* TODO: provide an in-buffer solution for large bitmaps */ + /* to avoid allocation of a new buffer */ + if ( FT_ALLOC( buffer, new_pitch * (int)final_rows ) ) + goto Error; + + /* copy data to new buffer */ + x = target_llx >> 6; + y = target_lly >> 6; + + /* the bitmap flow is from top to bottom, */ + /* but y is measured from bottom to top */ + if ( target->pitch < 0 ) + { + /* XXX */ + } + else + { + unsigned char* p = + target->buffer; + unsigned char* q = + buffer + + ( final_rows - y - target->rows ) * new_pitch + + x * 4; + unsigned char* limit_p = + p + pitch * (int)target->rows; + + + while ( p < limit_p ) + { + FT_MEM_COPY( q, p, pitch ); + + p += pitch; + q += new_pitch; + } + } + + FT_FREE( target->buffer ); + + target->width = final_width; + target->rows = final_rows; + + if ( target->pitch < 0 ) + target->pitch = -new_pitch; + else + target->pitch = new_pitch; + + target->buffer = buffer; + } + + /* adjust source bitmap if necessary */ + if ( source_->pixel_mode != FT_PIXEL_MODE_GRAY ) + { + FT_Bitmap_Init( &source_bitmap ); + error = FT_Bitmap_Convert( library, source_, &source_bitmap, 1 ); + if ( error ) + goto Error; + + source = &source_bitmap; + free_source_bitmap = 1; + } + else + source = source_; + + /* do blending; the code below returns pre-multiplied channels, */ + /* similar to what FreeType gets from `CBDT' tables */ + x = source_llx >> 6; + y = source_lly >> 6; + + /* the bitmap flow is from top to bottom, */ + /* but y is measured from bottom to top */ + if ( target->pitch < 0 ) + { + /* XXX */ + } + else + { + unsigned char* p = + source->buffer; + unsigned char* q = + target->buffer + + ( target->rows - y - source->rows ) * target->pitch + + x * 4; + unsigned char* limit_p = + p + source->pitch * (int)source->rows; + + + while ( p < limit_p ) + { + unsigned char* r = p; + unsigned char* s = q; + unsigned char* limit_r = r + source->width; + + + while ( r < limit_r ) + { + int aa = *r++; + int fa = color.alpha * aa / 255; + + int fb = color.blue * fa / 255; + int fg = color.green * fa / 255; + int fr = color.red * fa / 255; + + int ba2 = 255 - fa; + + int bb = s[0]; + int bg = s[1]; + int br = s[2]; + int ba = s[3]; + + + *s++ = (unsigned char)( bb * ba2 / 255 + fb ); + *s++ = (unsigned char)( bg * ba2 / 255 + fg ); + *s++ = (unsigned char)( br * ba2 / 255 + fr ); + *s++ = (unsigned char)( ba * ba2 / 255 + fa ); + } + + p += source->pitch; + q += target->pitch; + } + } + + atarget_offset->x = final_llx; + atarget_offset->y = final_lly + ( final_rows << 6 ); + + Error: + if ( error && free_target_bitmap_on_error ) + FT_Bitmap_Done( library, target ); + + if ( free_source_bitmap ) + FT_Bitmap_Done( library, &source_bitmap ); + + return error; + } + + /* documentation is in ftbitmap.h */ FT_EXPORT_DEF( FT_Error ) diff --git a/src/3rdparty/freetype/src/base/ftcalc.c b/src/3rdparty/freetype/src/base/ftcalc.c index f4ff45f8ef..315dc44185 100644 --- a/src/3rdparty/freetype/src/base/ftcalc.c +++ b/src/3rdparty/freetype/src/base/ftcalc.c @@ -1,35 +1,35 @@ -/***************************************************************************/ -/* */ -/* ftcalc.c */ -/* */ -/* Arithmetic computations (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* Support for 1-complement arithmetic has been totally dropped in this */ - /* release. You can still write your own code if you need it. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Implementing basic computation routines. */ - /* */ - /* FT_MulDiv(), FT_MulFix(), FT_DivFix(), FT_RoundFix(), FT_CeilFix(), */ - /* and FT_FloorFix() are declared in freetype.h. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftcalc.c + * + * Arithmetic computations (body). + * + * Copyright (C) 1996-2019 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. + * + */ + + /************************************************************************** + * + * Support for 1-complement arithmetic has been totally dropped in this + * release. You can still write your own code if you need it. + * + */ + + /************************************************************************** + * + * Implementing basic computation routines. + * + * FT_MulDiv(), FT_MulFix(), FT_DivFix(), FT_RoundFix(), FT_CeilFix(), + * and FT_FloorFix() are declared in freetype.h. + * + */ #include @@ -58,14 +58,14 @@ #endif /* !FT_LONG64 */ - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_calc +#define FT_COMPONENT calc /* transfer sign, leaving a positive number; */ @@ -516,10 +516,10 @@ #elif 0 /* - * This code is nonportable. See comment below. + * This code is nonportable. See comment below. * - * However, on a platform where right-shift of a signed quantity fills - * the leftmost bits by copying the sign bit, it might be faster. + * However, on a platform where right-shift of a signed quantity fills + * the leftmost bits by copying the sign bit, it might be faster. */ FT_Long sa, sb; @@ -527,22 +527,22 @@ /* - * This is a clever way of converting a signed number `a' into its - * absolute value (stored back into `a') and its sign. The sign is - * stored in `sa'; 0 means `a' was positive or zero, and -1 means `a' - * was negative. (Similarly for `b' and `sb'). + * This is a clever way of converting a signed number `a' into its + * absolute value (stored back into `a') and its sign. The sign is + * stored in `sa'; 0 means `a' was positive or zero, and -1 means `a' + * was negative. (Similarly for `b' and `sb'). * - * Unfortunately, it doesn't work (at least not portably). + * Unfortunately, it doesn't work (at least not portably). * - * It makes the assumption that right-shift on a negative signed value - * fills the leftmost bits by copying the sign bit. This is wrong. - * According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206, - * the result of right-shift of a negative signed value is - * implementation-defined. At least one implementation fills the - * leftmost bits with 0s (i.e., it is exactly the same as an unsigned - * right shift). This means that when `a' is negative, `sa' ends up - * with the value 1 rather than -1. After that, everything else goes - * wrong. + * It makes the assumption that right-shift on a negative signed value + * fills the leftmost bits by copying the sign bit. This is wrong. + * According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206, + * the result of right-shift of a negative signed value is + * implementation-defined. At least one implementation fills the + * leftmost bits with 0s (i.e., it is exactly the same as an unsigned + * right shift). This means that when `a' is negative, `sa' ends up + * with the value 1 rather than -1. After that, everything else goes + * wrong. */ sa = ( a_ >> ( sizeof ( a_ ) * 8 - 1 ) ); a = ( a_ ^ sa ) - sa; @@ -701,8 +701,8 @@ if ( !delta ) return FT_THROW( Invalid_Argument ); /* matrix can't be inverted */ - matrix->xy = - FT_DivFix( matrix->xy, delta ); - matrix->yx = - FT_DivFix( matrix->yx, delta ); + matrix->xy = -FT_DivFix( matrix->xy, delta ); + matrix->yx = -FT_DivFix( matrix->yx, delta ); xx = matrix->xx; yy = matrix->yy; @@ -745,6 +745,76 @@ } + /* documentation is in ftcalc.h */ + + FT_BASE_DEF( FT_Bool ) + FT_Matrix_Check( const FT_Matrix* matrix ) + { + FT_Matrix m; + FT_Fixed val[4]; + FT_Fixed nonzero_minval, maxval; + FT_Fixed temp1, temp2; + FT_UInt i; + + + if ( !matrix ) + return 0; + + val[0] = FT_ABS( matrix->xx ); + val[1] = FT_ABS( matrix->xy ); + val[2] = FT_ABS( matrix->yx ); + val[3] = FT_ABS( matrix->yy ); + + /* + * To avoid overflow, we ensure that each value is not larger than + * + * int(sqrt(2^31 / 4)) = 23170 ; + * + * we also check that no value becomes zero if we have to scale. + */ + + maxval = 0; + nonzero_minval = FT_LONG_MAX; + + for ( i = 0; i < 4; i++ ) + { + if ( val[i] > maxval ) + maxval = val[i]; + if ( val[i] && val[i] < nonzero_minval ) + nonzero_minval = val[i]; + } + + /* we only handle 32bit values */ + if ( maxval > 0x7FFFFFFFL ) + return 0; + + if ( maxval > 23170 ) + { + FT_Fixed scale = FT_DivFix( maxval, 23170 ); + + + if ( !FT_DivFix( nonzero_minval, scale ) ) + return 0; /* value range too large */ + + m.xx = FT_DivFix( matrix->xx, scale ); + m.xy = FT_DivFix( matrix->xy, scale ); + m.yx = FT_DivFix( matrix->yx, scale ); + m.yy = FT_DivFix( matrix->yy, scale ); + } + else + m = *matrix; + + temp1 = FT_ABS( m.xx * m.yy - m.xy * m.yx ); + temp2 = m.xx * m.xx + m.xy * m.xy + m.yx * m.yx + m.yy * m.yy; + + if ( temp1 == 0 || + temp2 / temp1 > 50 ) + return 0; + + return 1; + } + + /* documentation is in ftcalc.h */ FT_BASE_DEF( void ) @@ -913,9 +983,13 @@ FT_Pos out_x, FT_Pos out_y ) { + /* we silently ignore overflow errors since such large values */ + /* lead to even more (harmless) rendering errors later on */ + #ifdef FT_LONG64 - FT_Int64 delta = (FT_Int64)in_x * out_y - (FT_Int64)in_y * out_x; + FT_Int64 delta = SUB_INT64( MUL_INT64( in_x, out_y ), + MUL_INT64( in_y, out_x ) ); return ( delta > 0 ) - ( delta < 0 ); @@ -925,8 +999,6 @@ FT_Int result; - /* we silently ignore overflow errors, since such large values */ - /* lead to even more (harmless) rendering errors later on */ if ( ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L && ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L ) { diff --git a/src/3rdparty/freetype/src/base/ftcid.c b/src/3rdparty/freetype/src/base/ftcid.c index f5184649bf..190b23f357 100644 --- a/src/3rdparty/freetype/src/base/ftcid.c +++ b/src/3rdparty/freetype/src/base/ftcid.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcid.c */ -/* */ -/* FreeType API for accessing CID font information. */ -/* */ -/* Copyright 2007-2018 by */ -/* Derek Clegg and Michael Toftdal. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcid.c + * + * FreeType API for accessing CID font information. + * + * Copyright (C) 2007-2019 by + * Derek Clegg and Michael Toftdal. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include diff --git a/src/3rdparty/freetype/src/base/ftcolor.c b/src/3rdparty/freetype/src/base/ftcolor.c new file mode 100644 index 0000000000..8cb057a365 --- /dev/null +++ b/src/3rdparty/freetype/src/base/ftcolor.c @@ -0,0 +1,157 @@ +/**************************************************************************** + * + * ftcolor.c + * + * FreeType's glyph color management (body). + * + * Copyright (C) 2018-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#include +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_TRUETYPE_TYPES_H +#include FT_COLOR_H + + +#ifdef TT_CONFIG_OPTION_COLOR_LAYERS + + static + const FT_Palette_Data null_palette_data = { 0, NULL, NULL, 0, NULL }; + + + /* documentation is in ftcolor.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Palette_Data_Get( FT_Face face, + FT_Palette_Data *apalette_data ) + { + if ( !face ) + return FT_THROW( Invalid_Face_Handle ); + if ( !apalette_data) + return FT_THROW( Invalid_Argument ); + + if ( FT_IS_SFNT( face ) ) + *apalette_data = ( (TT_Face)face )->palette_data; + else + *apalette_data = null_palette_data; + + return FT_Err_Ok; + } + + + /* documentation is in ftcolor.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Palette_Select( FT_Face face, + FT_UShort palette_index, + FT_Color* *apalette ) + { + FT_Error error; + + TT_Face ttface; + SFNT_Service sfnt; + + + if ( !face ) + return FT_THROW( Invalid_Face_Handle ); + + if ( !FT_IS_SFNT( face ) ) + { + if ( apalette ) + *apalette = NULL; + + return FT_Err_Ok; + } + + ttface = (TT_Face)face; + sfnt = (SFNT_Service)ttface->sfnt; + + error = sfnt->set_palette( ttface, palette_index ); + if ( error ) + return error; + + ttface->palette_index = palette_index; + + if ( apalette ) + *apalette = ttface->palette; + + return FT_Err_Ok; + } + + + /* documentation is in ftcolor.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Palette_Set_Foreground_Color( FT_Face face, + FT_Color foreground_color ) + { + TT_Face ttface; + + + if ( !face ) + return FT_THROW( Invalid_Face_Handle ); + + if ( !FT_IS_SFNT( face ) ) + return FT_Err_Ok; + + ttface = (TT_Face)face; + + ttface->foreground_color = foreground_color; + ttface->have_foreground_color = 1; + + return FT_Err_Ok; + } + +#else /* !TT_CONFIG_OPTION_COLOR_LAYERS */ + + FT_EXPORT_DEF( FT_Error ) + FT_Palette_Data_Get( FT_Face face, + FT_Palette_Data *apalette_data ) + { + FT_UNUSED( face ); + FT_UNUSED( apalette_data ); + + + return FT_THROW( Unimplemented_Feature ); + } + + + FT_EXPORT_DEF( FT_Error ) + FT_Palette_Select( FT_Face face, + FT_UShort palette_index, + FT_Color* *apalette ) + { + FT_UNUSED( face ); + FT_UNUSED( palette_index ); + FT_UNUSED( apalette ); + + + return FT_THROW( Unimplemented_Feature ); + } + + + FT_EXPORT_DEF( FT_Error ) + FT_Palette_Set_Foreground_Color( FT_Face face, + FT_Color foreground_color ) + { + FT_UNUSED( face ); + FT_UNUSED( foreground_color ); + + + return FT_THROW( Unimplemented_Feature ); + } + +#endif /* !TT_CONFIG_OPTION_COLOR_LAYERS */ + + +/* END */ diff --git a/src/3rdparty/freetype/src/base/ftdbgmem.c b/src/3rdparty/freetype/src/base/ftdbgmem.c index c33d8acb4e..55cd269e1f 100644 --- a/src/3rdparty/freetype/src/base/ftdbgmem.c +++ b/src/3rdparty/freetype/src/base/ftdbgmem.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftdbgmem.c */ -/* */ -/* Memory debugger (body). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftdbgmem.c + * + * Memory debugger (body). + * + * Copyright (C) 2001-2019 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 @@ -50,9 +50,9 @@ #define FT_MEM_VAL( addr ) ( (FT_PtrDist)(FT_Pointer)( addr ) ) /* - * This structure holds statistics for a single allocation/release - * site. This is useful to know where memory operations happen the - * most. + * This structure holds statistics for a single allocation/release + * site. This is useful to know where memory operations happen the + * most. */ typedef struct FT_MemSourceRec_ { @@ -76,17 +76,17 @@ /* - * We don't need a resizable array for the memory sources because - * their number is pretty limited within FreeType. + * We don't need a resizable array for the memory sources because + * their number is pretty limited within FreeType. */ #define FT_MEM_SOURCE_BUCKETS 128 /* - * This structure holds information related to a single allocated - * memory block. If KEEPALIVE is defined, blocks that are freed by - * FreeType are never released to the system. Instead, their `size' - * field is set to `-size'. This is mainly useful to detect double - * frees, at the price of a large memory footprint during execution. + * This structure holds information related to a single allocated + * memory block. If KEEPALIVE is defined, blocks that are freed by + * FreeType are never released to the system. Instead, their `size' + * field is set to `-size'. This is mainly useful to detect double + * frees, at the price of a large memory footprint during execution. */ typedef struct FT_MemNodeRec_ { @@ -106,8 +106,8 @@ /* - * The global structure, containing compound statistics and all hash - * tables. + * The global structure, containing compound statistics and all hash + * tables. */ typedef struct FT_MemTableRec_ { @@ -146,8 +146,8 @@ /* - * Prime numbers are ugly to handle. It would be better to implement - * L-Hashing, which is 10% faster and doesn't require divisions. + * Prime numbers are ugly to handle. It would be better to implement + * L-Hashing, which is 10% faster and doesn't require divisions. */ static const FT_Int ft_mem_primes[] = { diff --git a/src/3rdparty/freetype/src/base/ftdebug.c b/src/3rdparty/freetype/src/base/ftdebug.c index fe26309101..ec72337873 100644 --- a/src/3rdparty/freetype/src/base/ftdebug.c +++ b/src/3rdparty/freetype/src/base/ftdebug.c @@ -1,44 +1,44 @@ -/***************************************************************************/ -/* */ -/* ftdebug.c */ -/* */ -/* Debugging and logging component (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 component contains various macros and functions used to ease the */ - /* debugging of the FreeType engine. Its main purpose is in assertion */ - /* checking, tracing, and error detection. */ - /* */ - /* There are now three debugging modes: */ - /* */ - /* - trace mode */ - /* */ - /* Error and trace messages are sent to the log file (which can be the */ - /* standard error output). */ - /* */ - /* - error mode */ - /* */ - /* Only error messages are generated. */ - /* */ - /* - release mode: */ - /* */ - /* No error message is sent or generated. The code is free from any */ - /* debugging parts. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftdebug.c + * + * Debugging and logging component (body). + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This component contains various macros and functions used to ease the + * debugging of the FreeType engine. Its main purpose is in assertion + * checking, tracing, and error detection. + * + * There are now three debugging modes: + * + * - trace mode + * + * Error and trace messages are sent to the log file (which can be the + * standard error output). + * + * - error mode + * + * Only error messages are generated. + * + * - release mode: + * + * No error message is sent or generated. The code is free from any + * debugging parts. + * + */ #include @@ -87,9 +87,19 @@ int line, const char* file ) { +#if 0 + /* activating the code in this block makes FreeType very chatty */ + fprintf( stderr, + "%s:%d: error 0x%02x: %s\n", + file, + line, + error, + FT_Error_String( error ) ); +#else FT_UNUSED( error ); FT_UNUSED( line ); FT_UNUSED( file ); +#endif return 0; } @@ -100,9 +110,16 @@ #ifdef FT_DEBUG_LEVEL_TRACE - /* array of trace levels, initialized to 0 */ - int ft_trace_levels[trace_count]; + /* array of trace levels, initialized to 0; */ + /* this gets adjusted at run-time */ + static int ft_trace_levels_enabled[trace_count]; + /* array of trace levels, always initialized to 0 */ + static int ft_trace_levels_disabled[trace_count]; + + /* a pointer to either `ft_trace_levels_enabled' */ + /* or `ft_trace_levels_disabled' */ + int* ft_trace_levels; /* define array of trace toggle names */ #define FT_TRACE_DEF( x ) #x , @@ -140,24 +157,42 @@ } - /*************************************************************************/ - /* */ - /* Initialize the tracing sub-system. This is done by retrieving the */ - /* value of the `FT2_DEBUG' environment variable. It must be a list of */ - /* toggles, separated by spaces, `;', or `,'. Example: */ - /* */ - /* export FT2_DEBUG="any:3 memory:7 stream:5" */ - /* */ - /* This requests that all levels be set to 3, except the trace level for */ - /* the memory and stream components which are set to 7 and 5, */ - /* respectively. */ - /* */ - /* See the file `include/freetype/internal/fttrace.h' for details of */ - /* the available toggle names. */ - /* */ - /* The level must be between 0 and 7; 0 means quiet (except for serious */ - /* runtime errors), and 7 means _very_ verbose. */ - /* */ + /* documentation is in ftdebug.h */ + + FT_BASE_DEF( void ) + FT_Trace_Disable( void ) + { + ft_trace_levels = ft_trace_levels_disabled; + } + + + /* documentation is in ftdebug.h */ + + FT_BASE_DEF( void ) + FT_Trace_Enable( void ) + { + ft_trace_levels = ft_trace_levels_enabled; + } + + + /************************************************************************** + * + * Initialize the tracing sub-system. This is done by retrieving the + * value of the `FT2_DEBUG' environment variable. It must be a list of + * toggles, separated by spaces, `;', or `,'. Example: + * + * export FT2_DEBUG="any:3 memory:7 stream:5" + * + * This requests that all levels be set to 3, except the trace level for + * the memory and stream components which are set to 7 and 5, + * respectively. + * + * See the file `include/freetype/internal/fttrace.h' for details of + * the available toggle names. + * + * The level must be between 0 and 7; 0 means quiet (except for serious + * runtime errors), and 7 means _very_ verbose. + */ FT_BASE_DEF( void ) ft_debug_init( void ) { @@ -223,14 +258,16 @@ { /* special case for `any' */ for ( n = 0; n < trace_count; n++ ) - ft_trace_levels[n] = level; + ft_trace_levels_enabled[n] = level; } else - ft_trace_levels[found] = level; + ft_trace_levels_enabled[found] = level; } } } } + + ft_trace_levels = ft_trace_levels_enabled; } @@ -260,6 +297,22 @@ } + FT_BASE_DEF( void ) + FT_Trace_Disable( void ) + { + /* nothing */ + } + + + /* documentation is in ftdebug.h */ + + FT_BASE_DEF( void ) + FT_Trace_Enable( void ) + { + /* nothing */ + } + + #endif /* !FT_DEBUG_LEVEL_TRACE */ diff --git a/src/3rdparty/freetype/src/base/fterrors.c b/src/3rdparty/freetype/src/base/fterrors.c new file mode 100644 index 0000000000..84fe590289 --- /dev/null +++ b/src/3rdparty/freetype/src/base/fterrors.c @@ -0,0 +1,46 @@ +/**************************************************************************** + * + * fterrors.c + * + * FreeType API for error code handling. + * + * Copyright (C) 2018-2019 by + * Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#include +#include FT_INTERNAL_DEBUG_H +#include FT_ERRORS_H + + + /* documentation is in fterrors.h */ + + FT_EXPORT_DEF( const char* ) + FT_Error_String( FT_Error error_code ) + { + if ( error_code < 0 || + error_code >= FT_ERR_CAT( FT_ERR_PREFIX, Max ) ) + return NULL; + +#if defined( FT_CONFIG_OPTION_ERROR_STRINGS ) || \ + defined( FT_DEBUG_LEVEL_ERROR ) + +#undef FTERRORS_H_ +#define FT_ERROR_START_LIST switch ( FT_ERROR_BASE( error_code ) ) { +#define FT_ERRORDEF( e, v, s ) case v: return s; +#define FT_ERROR_END_LIST } + +#include FT_ERRORS_H + +#endif /* defined( FT_CONFIG_OPTION_ERROR_STRINGS ) || ... */ + + return NULL; + } diff --git a/src/3rdparty/freetype/src/base/ftfntfmt.c b/src/3rdparty/freetype/src/base/ftfntfmt.c index a2900ceb09..54ba537416 100644 --- a/src/3rdparty/freetype/src/base/ftfntfmt.c +++ b/src/3rdparty/freetype/src/base/ftfntfmt.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftfntfmt.c */ -/* */ -/* FreeType utility file for font formats (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftfntfmt.c + * + * FreeType utility file for font formats (body). + * + * Copyright (C) 2002-2019 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 diff --git a/src/3rdparty/freetype/src/base/ftfstype.c b/src/3rdparty/freetype/src/base/ftfstype.c index e6cdf6e2ec..45e2d8089b 100644 --- a/src/3rdparty/freetype/src/base/ftfstype.c +++ b/src/3rdparty/freetype/src/base/ftfstype.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftfstype.c */ -/* */ -/* FreeType utility file to access FSType data (body). */ -/* */ -/* Copyright 2008-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftfstype.c + * + * FreeType utility file to access FSType data (body). + * + * Copyright (C) 2008-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_TYPE1_TABLES_H diff --git a/src/3rdparty/freetype/src/base/ftgasp.c b/src/3rdparty/freetype/src/base/ftgasp.c index 4f80bba630..720fb113ca 100644 --- a/src/3rdparty/freetype/src/base/ftgasp.c +++ b/src/3rdparty/freetype/src/base/ftgasp.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftgasp.c */ -/* */ -/* Access of TrueType's `gasp' table (body). */ -/* */ -/* Copyright 2007-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftgasp.c + * + * Access of TrueType's `gasp' table (body). + * + * Copyright (C) 2007-2019 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 diff --git a/src/3rdparty/freetype/src/base/ftgloadr.c b/src/3rdparty/freetype/src/base/ftgloadr.c index 47202496b9..bfeed461a8 100644 --- a/src/3rdparty/freetype/src/base/ftgloadr.c +++ b/src/3rdparty/freetype/src/base/ftgloadr.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftgloadr.c */ -/* */ -/* The FreeType glyph loader (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftgloadr.c + * + * The FreeType glyph loader (body). + * + * Copyright (C) 2002-2019 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 @@ -23,7 +23,7 @@ #include FT_INTERNAL_OBJECTS_H #undef FT_COMPONENT -#define FT_COMPONENT trace_gloader +#define FT_COMPONENT gloader /*************************************************************************/ @@ -38,31 +38,31 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* The glyph loader is a simple object which is used to load a set of */ - /* glyphs easily. It is critical for the correct loading of composites. */ - /* */ - /* Ideally, one can see it as a stack of abstract `glyph' objects. */ - /* */ - /* loader.base Is really the bottom of the stack. It describes a */ - /* single glyph image made of the juxtaposition of */ - /* several glyphs (those `in the stack'). */ - /* */ - /* loader.current Describes the top of the stack, on which a new */ - /* glyph can be loaded. */ - /* */ - /* Rewind Clears the stack. */ - /* Prepare Set up `loader.current' for addition of a new glyph */ - /* image. */ - /* Add Add the `current' glyph image to the `base' one, */ - /* and prepare for another one. */ - /* */ - /* The glyph loader is now a base object. Each driver used to */ - /* re-implement it in one way or the other, which wasted code and */ - /* energy. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * The glyph loader is a simple object which is used to load a set of + * glyphs easily. It is critical for the correct loading of composites. + * + * Ideally, one can see it as a stack of abstract `glyph' objects. + * + * loader.base Is really the bottom of the stack. It describes a + * single glyph image made of the juxtaposition of + * several glyphs (those `in the stack'). + * + * loader.current Describes the top of the stack, on which a new + * glyph can be loaded. + * + * Rewind Clears the stack. + * Prepare Set up `loader.current' for addition of a new glyph + * image. + * Add Add the `current' glyph image to the `base' one, + * and prepare for another one. + * + * The glyph loader is now a base object. Each driver used to + * re-implement it in one way or the other, which wasted code and + * energy. + * + */ /* create a new glyph loader */ @@ -99,12 +99,12 @@ } - /* reset the glyph loader, frees all allocated tables */ - /* and starts from zero */ + /* reset glyph loader, free all allocated tables, */ + /* and start from zero */ FT_BASE_DEF( void ) FT_GlyphLoader_Reset( FT_GlyphLoader loader ) { - FT_Memory memory = loader->memory; + FT_Memory memory = loader->memory; FT_FREE( loader->base.outline.points ); @@ -129,7 +129,7 @@ { if ( loader ) { - FT_Memory memory = loader->memory; + FT_Memory memory = loader->memory; FT_GlyphLoader_Reset( loader ); @@ -361,46 +361,4 @@ } - FT_BASE_DEF( FT_Error ) - FT_GlyphLoader_CopyPoints( FT_GlyphLoader target, - FT_GlyphLoader source ) - { - FT_Error error; - FT_UInt num_points = (FT_UInt)source->base.outline.n_points; - FT_UInt num_contours = (FT_UInt)source->base.outline.n_contours; - - - error = FT_GlyphLoader_CheckPoints( target, num_points, num_contours ); - if ( !error ) - { - FT_Outline* out = &target->base.outline; - FT_Outline* in = &source->base.outline; - - - FT_ARRAY_COPY( out->points, in->points, - num_points ); - FT_ARRAY_COPY( out->tags, in->tags, - num_points ); - FT_ARRAY_COPY( out->contours, in->contours, - num_contours ); - - /* do we need to copy the extra points? */ - if ( target->use_extra && source->use_extra ) - { - FT_ARRAY_COPY( target->base.extra_points, source->base.extra_points, - num_points ); - FT_ARRAY_COPY( target->base.extra_points2, source->base.extra_points2, - num_points ); - } - - out->n_points = (short)num_points; - out->n_contours = (short)num_contours; - - FT_GlyphLoader_Adjust_Points( target ); - } - - return error; - } - - /* END */ diff --git a/src/3rdparty/freetype/src/base/ftglyph.c b/src/3rdparty/freetype/src/base/ftglyph.c index 6759aa25d0..e6b1327901 100644 --- a/src/3rdparty/freetype/src/base/ftglyph.c +++ b/src/3rdparty/freetype/src/base/ftglyph.c @@ -1,31 +1,31 @@ -/***************************************************************************/ -/* */ -/* ftglyph.c */ -/* */ -/* FreeType convenience functions to handle glyphs (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 the definition of several convenience functions */ - /* that can be used by client applications to easily retrieve glyph */ - /* bitmaps and outlines from a given face. */ - /* */ - /* These functions should be optional if you are writing a font server */ - /* or text layout engine on top of FreeType. However, they are pretty */ - /* handy for many other simple uses of the library. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftglyph.c + * + * FreeType convenience functions to handle glyphs (body). + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + /************************************************************************** + * + * This file contains the definition of several convenience functions + * that can be used by client applications to easily retrieve glyph + * bitmaps and outlines from a given face. + * + * These functions should be optional if you are writing a font server + * or text layout engine on top of FreeType. However, they are pretty + * handy for many other simple uses of the library. + * + */ #include @@ -36,16 +36,15 @@ #include FT_BITMAP_H #include FT_INTERNAL_OBJECTS_H -#include "basepic.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_glyph +#define FT_COMPONENT glyph /*************************************************************************/ @@ -77,7 +76,7 @@ /* do lazy copying whenever possible */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { - glyph->bitmap = slot->bitmap; + glyph->bitmap = slot->bitmap; slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } else @@ -359,37 +358,28 @@ /* documentation is in ftglyph.h */ - FT_EXPORT_DEF( FT_Error ) - FT_Get_Glyph( FT_GlyphSlot slot, - FT_Glyph *aglyph ) + FT_EXPORT( FT_Error ) + FT_New_Glyph( FT_Library library, + FT_Glyph_Format format, + FT_Glyph *aglyph ) { - FT_Library library; - FT_Error error; - FT_Glyph glyph; - const FT_Glyph_Class* clazz = NULL; - - if ( !slot ) - return FT_THROW( Invalid_Slot_Handle ); - - library = slot->library; - - if ( !aglyph ) + if ( !library || !aglyph ) return FT_THROW( Invalid_Argument ); /* if it is a bitmap, that's easy :-) */ - if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) - clazz = FT_BITMAP_GLYPH_CLASS_GET; + if ( format == FT_GLYPH_FORMAT_BITMAP ) + clazz = &ft_bitmap_glyph_class; /* if it is an outline */ - else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) - clazz = FT_OUTLINE_GLYPH_CLASS_GET; + else if ( format == FT_GLYPH_FORMAT_OUTLINE ) + clazz = &ft_outline_glyph_class; else { /* try to find a renderer that supports the glyph image format */ - FT_Renderer render = FT_Lookup_Renderer( library, slot->format, 0 ); + FT_Renderer render = FT_Lookup_Renderer( library, format, 0 ); if ( render ) @@ -397,13 +387,31 @@ } if ( !clazz ) - { - error = FT_THROW( Invalid_Glyph_Format ); - goto Exit; - } + return FT_THROW( Invalid_Glyph_Format ); + + /* create FT_Glyph object */ + return ft_new_glyph( library, clazz, aglyph ); + } + + + /* documentation is in ftglyph.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Get_Glyph( FT_GlyphSlot slot, + FT_Glyph *aglyph ) + { + FT_Error error; + FT_Glyph glyph; + + + if ( !slot ) + return FT_THROW( Invalid_Slot_Handle ); + + if ( !aglyph ) + return FT_THROW( Invalid_Argument ); /* create FT_Glyph object */ - error = ft_new_glyph( library, clazz, &glyph ); + error = FT_New_Glyph( slot->library, slot->format, &glyph ); if ( error ) goto Exit; @@ -427,7 +435,7 @@ glyph->advance.y = slot->advance.y * 1024; /* now import the image from the glyph slot */ - error = clazz->glyph_init( glyph, slot ); + error = glyph->clazz->glyph_init( glyph, slot ); Exit2: /* if an error occurred, destroy the glyph */ @@ -505,8 +513,8 @@ { acbox->xMin = FT_PIX_FLOOR( acbox->xMin ); acbox->yMin = FT_PIX_FLOOR( acbox->yMin ); - acbox->xMax = FT_PIX_CEIL( acbox->xMax ); - acbox->yMax = FT_PIX_CEIL( acbox->yMax ); + acbox->xMax = FT_PIX_CEIL_LONG( acbox->xMax ); + acbox->yMax = FT_PIX_CEIL_LONG( acbox->yMax ); } /* convert to integer pixels if needed */ @@ -536,7 +544,6 @@ FT_BitmapGlyph bitmap = NULL; const FT_Glyph_Class* clazz; - /* FT_BITMAP_GLYPH_CLASS_GET dereferences `library' in PIC mode */ FT_Library library; @@ -553,7 +560,7 @@ goto Bad; /* when called with a bitmap glyph, do nothing and return successfully */ - if ( clazz == FT_BITMAP_GLYPH_CLASS_GET ) + if ( clazz == &ft_bitmap_glyph_class ) goto Exit; if ( !clazz->glyph_prepare ) @@ -569,7 +576,7 @@ dummy.format = clazz->glyph_format; /* create result bitmap glyph */ - error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, &b ); + error = ft_new_glyph( library, &ft_bitmap_glyph_class, &b ); if ( error ) goto Exit; bitmap = (FT_BitmapGlyph)b; diff --git a/src/3rdparty/freetype/src/base/ftgxval.c b/src/3rdparty/freetype/src/base/ftgxval.c index 19e2d6acb5..0677d26faa 100644 --- a/src/3rdparty/freetype/src/base/ftgxval.c +++ b/src/3rdparty/freetype/src/base/ftgxval.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* ftgxval.c */ -/* */ -/* FreeType API for validating TrueTypeGX/AAT tables (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* Masatake YAMATO, Redhat K.K, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftgxval.c + * + * FreeType API for validating TrueTypeGX/AAT tables (body). + * + * Copyright (C) 2004-2019 by + * Masatake YAMATO, Redhat K.K, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include diff --git a/src/3rdparty/freetype/src/base/fthash.c b/src/3rdparty/freetype/src/base/fthash.c index 21bc8dd5b4..387e6d26db 100644 --- a/src/3rdparty/freetype/src/base/fthash.c +++ b/src/3rdparty/freetype/src/base/fthash.c @@ -1,10 +1,10 @@ -/***************************************************************************/ -/* */ -/* fthash.c */ -/* */ -/* Hashing functions (body). */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * fthash.c + * + * Hashing functions (body). + * + */ /* * Copyright 2000 Computing Research Labs, New Mexico State University @@ -30,13 +30,13 @@ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - /*************************************************************************/ - /* */ - /* This file is based on code from bdf.c,v 1.22 2000/03/16 20:08:50 */ - /* */ - /* taken from Mark Leisher's xmbdfed package */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * This file is based on code from bdf.c,v 1.22 2000/03/16 20:08:50 + * + * taken from Mark Leisher's xmbdfed package + * + */ #include diff --git a/src/3rdparty/freetype/src/base/ftinit.c b/src/3rdparty/freetype/src/base/ftinit.c index 1fa4721094..c73cd78b83 100644 --- a/src/3rdparty/freetype/src/base/ftinit.c +++ b/src/3rdparty/freetype/src/base/ftinit.c @@ -1,40 +1,40 @@ -/***************************************************************************/ -/* */ -/* ftinit.c */ -/* */ -/* FreeType initialization layer (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 purpose of this file is to implement the following two */ - /* functions: */ - /* */ - /* FT_Add_Default_Modules(): */ - /* This function is used to add the set of default modules to a */ - /* fresh new library object. The set is taken from the header file */ - /* `freetype/config/ftmodule.h'. See the document `FreeType 2.0 */ - /* Build System' for more information. */ - /* */ - /* FT_Init_FreeType(): */ - /* This function creates a system object for the current platform, */ - /* builds a library out of it, then calls FT_Default_Drivers(). */ - /* */ - /* Note that even if FT_Init_FreeType() uses the implementation of the */ - /* system object defined at build time, client applications are still */ - /* able to provide their own `ftsystem.c'. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftinit.c + * + * FreeType initialization layer (body). + * + * Copyright (C) 1996-2019 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 purpose of this file is to implement the following two + * functions: + * + * FT_Add_Default_Modules(): + * This function is used to add the set of default modules to a + * fresh new library object. The set is taken from the header file + * `freetype/config/ftmodule.h'. See the document `FreeType 2.0 + * Build System' for more information. + * + * FT_Init_FreeType(): + * This function creates a system object for the current platform, + * builds a library out of it, then calls FT_Default_Drivers(). + * + * Note that even if FT_Init_FreeType() uses the implementation of the + * system object defined at build time, client applications are still + * able to provide their own `ftsystem.c'. + * + */ #include @@ -42,20 +42,16 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_MODULE_H -#include "basepic.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_init - - -#ifndef FT_CONFIG_OPTION_PIC +#define FT_COMPONENT init #undef FT_USE_MODULE @@ -78,120 +74,6 @@ }; -#else /* FT_CONFIG_OPTION_PIC */ - - -#ifdef __cplusplus -#define FT_EXTERNC extern "C" -#else -#define FT_EXTERNC extern -#endif - - /* declare the module's class creation/destruction functions */ -#undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - FT_EXTERNC FT_Error \ - FT_Create_Class_ ## x( FT_Library library, \ - FT_Module_Class* *output_class ); \ - FT_EXTERNC void \ - FT_Destroy_Class_ ## x( FT_Library library, \ - FT_Module_Class* clazz ); - -#include FT_CONFIG_MODULES_H - - /* count all module classes */ -#undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) MODULE_CLASS_ ## x, - - enum - { -#include FT_CONFIG_MODULES_H - FT_NUM_MODULE_CLASSES - }; - - /* destroy all module classes */ -#undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - if ( classes[i] ) \ - { \ - FT_Destroy_Class_ ## x( library, classes[i] ); \ - } \ - i++; - - - FT_BASE_DEF( void ) - ft_destroy_default_module_classes( FT_Library library ) - { - FT_Module_Class* *classes; - FT_Memory memory; - FT_UInt i; - BasePIC* pic_container = (BasePIC*)library->pic_container.base; - - - if ( !pic_container->default_module_classes ) - return; - - memory = library->memory; - classes = pic_container->default_module_classes; - i = 0; - -#include FT_CONFIG_MODULES_H - - FT_FREE( classes ); - pic_container->default_module_classes = NULL; - } - - - /* initialize all module classes and the pointer table */ -#undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - error = FT_Create_Class_ ## x( library, &clazz ); \ - if ( error ) \ - goto Exit; \ - classes[i++] = clazz; - - - FT_BASE_DEF( FT_Error ) - ft_create_default_module_classes( FT_Library library ) - { - FT_Error error; - FT_Memory memory; - FT_Module_Class* *classes = NULL; - FT_Module_Class* clazz; - FT_UInt i; - BasePIC* pic_container = (BasePIC*)library->pic_container.base; - - - memory = library->memory; - - pic_container->default_module_classes = NULL; - - if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * - ( FT_NUM_MODULE_CLASSES + 1 ) ) ) - return error; - - /* initialize all pointers to 0, especially the last one */ - for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ ) - classes[i] = NULL; - classes[FT_NUM_MODULE_CLASSES] = NULL; - - i = 0; - -#include FT_CONFIG_MODULES_H - - Exit: - if ( error ) - ft_destroy_default_module_classes( library ); - else - pic_container->default_module_classes = classes; - - return error; - } - - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* documentation is in ftmodapi.h */ FT_EXPORT_DEF( void ) @@ -201,16 +83,10 @@ const FT_Module_Class* const* cur; - /* FT_DEFAULT_MODULES_GET dereferences `library' in PIC mode */ -#ifdef FT_CONFIG_OPTION_PIC - if ( !library ) - return; -#endif - /* GCC 4.6 warns the type difference: * FT_Module_Class** != const FT_Module_Class* const* */ - cur = (const FT_Module_Class* const*)FT_DEFAULT_MODULES_GET; + cur = (const FT_Module_Class* const*)ft_default_modules; /* test for valid `library' delayed to FT_Add_Module() */ while ( *cur ) @@ -300,6 +176,9 @@ module_name, property_name, property_value ); + + if ( !*p ) + break; } } diff --git a/src/3rdparty/freetype/src/base/ftlcdfil.c b/src/3rdparty/freetype/src/base/ftlcdfil.c index 8d314df080..d9f4af4293 100644 --- a/src/3rdparty/freetype/src/base/ftlcdfil.c +++ b/src/3rdparty/freetype/src/base/ftlcdfil.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftlcdfil.c */ -/* */ -/* FreeType API for color filtering of subpixel bitmap glyphs (body). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftlcdfil.c + * + * FreeType API for color filtering of subpixel bitmap glyphs (body). + * + * Copyright (C) 2006-2019 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 @@ -34,9 +34,9 @@ /* add padding according to filter weights */ FT_BASE_DEF (void) - ft_lcd_padding( FT_Pos* Min, - FT_Pos* Max, - FT_GlyphSlot slot ) + ft_lcd_padding( FT_BBox* cbox, + FT_GlyphSlot slot, + FT_Render_Mode mode ) { FT_Byte* lcd_weights; FT_Bitmap_LcdFilterFunc lcd_filter_func; @@ -56,10 +56,20 @@ if ( lcd_filter_func == ft_lcd_filter_fir ) { - *Min -= lcd_weights[0] ? 43 : - lcd_weights[1] ? 22 : 0; - *Max += lcd_weights[4] ? 43 : - lcd_weights[3] ? 22 : 0; + if ( mode == FT_RENDER_MODE_LCD ) + { + cbox->xMin -= lcd_weights[0] ? 43 : + lcd_weights[1] ? 22 : 0; + cbox->xMax += lcd_weights[4] ? 43 : + lcd_weights[3] ? 22 : 0; + } + else if ( mode == FT_RENDER_MODE_LCD_V ) + { + cbox->yMin -= lcd_weights[0] ? 43 : + lcd_weights[1] ? 22 : 0; + cbox->yMax += lcd_weights[4] ? 43 : + lcd_weights[3] ? 22 : 0; + } } } @@ -67,13 +77,13 @@ /* FIR filter used by the default and light filters */ FT_BASE_DEF( void ) ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, FT_LcdFiveTapFilter weights ) { FT_UInt width = (FT_UInt)bitmap->width; FT_UInt height = (FT_UInt)bitmap->rows; FT_Int pitch = bitmap->pitch; FT_Byte* origin = bitmap->buffer; + FT_Byte mode = bitmap->pixel_mode; /* take care of bitmap flow */ @@ -81,7 +91,7 @@ origin += pitch * (FT_Int)( height - 1 ); /* horizontal in-place FIR filter */ - if ( mode == FT_RENDER_MODE_LCD && width >= 2 ) + if ( mode == FT_PIXEL_MODE_LCD && width >= 2 ) { FT_Byte* line = origin; @@ -124,7 +134,7 @@ } /* vertical in-place FIR filter */ - else if ( mode == FT_RENDER_MODE_LCD_V && height >= 2 ) + else if ( mode == FT_PIXEL_MODE_LCD_V && height >= 2 ) { FT_Byte* column = origin; @@ -173,13 +183,13 @@ /* intra-pixel filter used by the legacy filter */ static void _ft_lcd_filter_legacy( FT_Bitmap* bitmap, - FT_Render_Mode mode, FT_Byte* weights ) { FT_UInt width = (FT_UInt)bitmap->width; FT_UInt height = (FT_UInt)bitmap->rows; FT_Int pitch = bitmap->pitch; FT_Byte* origin = bitmap->buffer; + FT_Byte mode = bitmap->pixel_mode; static const unsigned int filters[3][3] = { @@ -196,7 +206,7 @@ origin += pitch * (FT_Int)( height - 1 ); /* horizontal in-place intra-pixel filter */ - if ( mode == FT_RENDER_MODE_LCD && width >= 3 ) + if ( mode == FT_PIXEL_MODE_LCD && width >= 3 ) { FT_Byte* line = origin; @@ -233,7 +243,7 @@ } } } - else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 ) + else if ( mode == FT_PIXEL_MODE_LCD_V && height >= 3 ) { FT_Byte* column = origin; @@ -275,6 +285,8 @@ #endif /* USE_LEGACY */ + /* documentation in ftlcdfil.h */ + FT_EXPORT_DEF( FT_Error ) FT_Library_SetLcdFilterWeights( FT_Library library, unsigned char *weights ) @@ -292,6 +304,8 @@ } + /* documentation in ftlcdfil.h */ + FT_EXPORT_DEF( FT_Error ) FT_Library_SetLcdFilter( FT_Library library, FT_LcdFilter filter ) @@ -341,18 +355,41 @@ return FT_Err_Ok; } + + FT_EXPORT_DEF( FT_Error ) + FT_Library_SetLcdGeometry( FT_Library library, + FT_Vector* sub ) + { + FT_UNUSED( library ); + FT_UNUSED( sub ); + + return FT_THROW( Unimplemented_Feature ); + } + #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - /* add padding according to accommodate outline shifts */ + /* add padding to accommodate outline shifts */ FT_BASE_DEF (void) - ft_lcd_padding( FT_Pos* Min, - FT_Pos* Max, - FT_GlyphSlot slot ) + ft_lcd_padding( FT_BBox* cbox, + FT_GlyphSlot slot, + FT_Render_Mode mode ) { - FT_UNUSED( slot ); + FT_Vector* sub = slot->library->lcd_geometry; - *Min -= 21; - *Max += 21; + if ( mode == FT_RENDER_MODE_LCD ) + { + cbox->xMin -= FT_MAX( FT_MAX( sub[0].x, sub[1].x ), sub[2].x ); + cbox->xMax -= FT_MIN( FT_MIN( sub[0].x, sub[1].x ), sub[2].x ); + cbox->yMin -= FT_MAX( FT_MAX( sub[0].y, sub[1].y ), sub[2].y ); + cbox->yMax -= FT_MIN( FT_MIN( sub[0].y, sub[1].y ), sub[2].y ); + } + else if ( mode == FT_RENDER_MODE_LCD_V ) + { + cbox->xMin -= FT_MAX( FT_MAX( sub[0].y, sub[1].y ), sub[2].y ); + cbox->xMax -= FT_MIN( FT_MIN( sub[0].y, sub[1].y ), sub[2].y ); + cbox->yMin += FT_MIN( FT_MIN( sub[0].x, sub[1].x ), sub[2].x ); + cbox->yMax += FT_MAX( FT_MAX( sub[0].x, sub[1].x ), sub[2].x ); + } } @@ -377,6 +414,24 @@ return FT_THROW( Unimplemented_Feature ); } + + /* documentation in ftlcdfil.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Library_SetLcdGeometry( FT_Library library, + FT_Vector sub[3] ) + { + if ( !library ) + return FT_THROW( Invalid_Library_Handle ); + + if ( !sub ) + return FT_THROW( Invalid_Argument ); + + ft_memcpy( library->lcd_geometry, sub, 3 * sizeof( FT_Vector ) ); + + return FT_THROW( Unimplemented_Feature ); + } + #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ diff --git a/src/3rdparty/freetype/src/base/ftmac.c b/src/3rdparty/freetype/src/base/ftmac.c index fd4c0cc274..5f23ceea9f 100644 --- a/src/3rdparty/freetype/src/base/ftmac.c +++ b/src/3rdparty/freetype/src/base/ftmac.c @@ -1,23 +1,23 @@ -/***************************************************************************/ -/* */ -/* ftmac.c */ -/* */ -/* Mac FOND support. Written by just@letterror.com. */ -/* Heavily modified by mpsuzuki, George Williams, and Sean McBride. */ -/* */ -/* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */ -/* classic platforms built by MPW. */ -/* */ -/* Copyright 1996-2018 by */ -/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftmac.c + * + * Mac FOND support. Written by just@letterror.com. + * Heavily modified by mpsuzuki, George Williams, and Sean McBride. + * + * This file is for Mac OS X only; see builds/mac/ftoldmac.c for + * classic platforms built by MPW. + * + * Copyright (C) 1996-2019 by + * Just van Rossum, 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. + * + */ /* @@ -954,17 +954,17 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Face */ - /* */ - /* */ - /* This is the Mac-specific implementation of FT_New_Face. In */ - /* addition to the standard FT_New_Face() functionality, it also */ - /* accepts pathnames to Mac suitcase files. For further */ - /* documentation see the original FT_New_Face() in freetype.h. */ - /* */ + /************************************************************************** + * + * @Function: + * FT_New_Face + * + * @Description: + * This is the Mac-specific implementation of FT_New_Face. In + * addition to the standard FT_New_Face() functionality, it also + * accepts pathnames to Mac suitcase files. For further + * documentation see the original FT_New_Face() in freetype.h. + */ FT_EXPORT_DEF( FT_Error ) FT_New_Face( FT_Library library, const char* pathname, @@ -995,17 +995,18 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Face_From_FSRef */ - /* */ - /* */ - /* FT_New_Face_From_FSRef is identical to FT_New_Face except it */ - /* accepts an FSRef instead of a path. */ - /* */ - /* This function is deprecated because Carbon data types (FSRef) */ - /* are not cross-platform, and thus not suitable for the FreeType API. */ + /************************************************************************** + * + * @Function: + * FT_New_Face_From_FSRef + * + * @Description: + * FT_New_Face_From_FSRef is identical to FT_New_Face except it + * accepts an FSRef instead of a path. + * + * This function is deprecated because Carbon data types (FSRef) + * are not cross-platform, and thus not suitable for the FreeType API. + */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSRef( FT_Library library, const FSRef* ref, @@ -1040,16 +1041,17 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Face_From_FSSpec */ - /* */ - /* */ - /* FT_New_Face_From_FSSpec is identical to FT_New_Face except it */ - /* accepts an FSSpec instead of a path. */ - /* */ - /* This function is deprecated because FSSpec is deprecated in Mac OS X */ + /************************************************************************** + * + * @Function: + * FT_New_Face_From_FSSpec + * + * @Description: + * FT_New_Face_From_FSSpec is identical to FT_New_Face except it + * accepts an FSSpec instead of a path. + * + * This function is deprecated because FSSpec is deprecated in Mac OS X + */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSSpec( FT_Library library, const FSSpec* spec, diff --git a/src/3rdparty/freetype/src/base/ftmm.c b/src/3rdparty/freetype/src/base/ftmm.c index 800441bcac..ba9e67f008 100644 --- a/src/3rdparty/freetype/src/base/ftmm.c +++ b/src/3rdparty/freetype/src/base/ftmm.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftmm.c */ -/* */ -/* Multiple Master font support (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftmm.c + * + * Multiple Master font support (body). + * + * Copyright (C) 1996-2019 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 @@ -25,14 +25,14 @@ #include FT_SERVICE_METRICS_VARIATIONS_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_mm +#define FT_COMPONENT mm static FT_Error @@ -199,6 +199,67 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Set_MM_WeightVector( FT_Face face, + FT_UInt len, + FT_Fixed* weightvector ) + { + FT_Error error; + FT_Service_MultiMasters service; + + + /* check of `face' delayed to `ft_face_get_mm_service' */ + + if ( len && !weightvector ) + return FT_THROW( Invalid_Argument ); + + error = ft_face_get_mm_service( face, &service ); + if ( !error ) + { + error = FT_ERR( Invalid_Argument ); + if ( service->set_mm_weightvector ) + error = service->set_mm_weightvector( face, len, weightvector ); + } + + /* enforce recomputation of auto-hinting data */ + if ( !error && face->autohint.finalizer ) + { + face->autohint.finalizer( face->autohint.data ); + face->autohint.data = NULL; + } + + return error; + } + + + FT_EXPORT_DEF( FT_Error ) + FT_Get_MM_WeightVector( FT_Face face, + FT_UInt* len, + FT_Fixed* weightvector ) + { + FT_Error error; + FT_Service_MultiMasters service; + + + /* check of `face' delayed to `ft_face_get_mm_service' */ + + if ( len && !weightvector ) + return FT_THROW( Invalid_Argument ); + + error = ft_face_get_mm_service( face, &service ); + if ( !error ) + { + error = FT_ERR( Invalid_Argument ); + if ( service->get_mm_weightvector ) + error = service->get_mm_weightvector( face, len, weightvector ); + } + + return error; + } + + /* documentation is in ftmm.h */ FT_EXPORT_DEF( FT_Error ) diff --git a/src/3rdparty/freetype/src/base/ftobjs.c b/src/3rdparty/freetype/src/base/ftobjs.c index 8d07e35ae3..e301f8f11a 100644 --- a/src/3rdparty/freetype/src/base/ftobjs.c +++ b/src/3rdparty/freetype/src/base/ftobjs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftobjs.c */ -/* */ -/* The FreeType private base classes (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftobjs.c + * + * The FreeType private base classes (body). + * + * Copyright (C) 1996-2019 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 @@ -79,6 +79,18 @@ #pragma warning( pop ) #endif + static const char* const pixel_modes[] = + { + "none", + "monochrome bitmap", + "gray 8-bit bitmap", + "gray 2-bit bitmap", + "gray 4-bit bitmap", + "LCD 8-bit bitmap", + "vertical LCD 8-bit bitmap", + "BGRA 32-bit color image bitmap" + }; + #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -259,14 +271,14 @@ } - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_objs +#define FT_COMPONENT objs /*************************************************************************/ @@ -330,7 +342,9 @@ } - FT_BASE_DEF( void ) + /* overflow-resistant presetting of bitmap position and dimensions; */ + /* also check whether the size is too large for rendering */ + FT_BASE_DEF( FT_Bool ) ft_glyphslot_preset_bitmap( FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector* origin ) @@ -340,15 +354,15 @@ FT_Pixel_Mode pixel_mode; - FT_BBox cbox; + FT_BBox cbox, pbox; FT_Pos x_shift = 0; FT_Pos y_shift = 0; FT_Pos x_left, y_top; FT_Pos width, height, pitch; - if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) - return; + if ( slot->format != FT_GLYPH_FORMAT_OUTLINE ) + return 1; if ( origin ) { @@ -360,76 +374,89 @@ /* taking into account the origin shift */ FT_Outline_Get_CBox( outline, &cbox ); - cbox.xMin += x_shift; - cbox.yMin += y_shift; - cbox.xMax += x_shift; - cbox.yMax += y_shift; + /* rough estimate of pixel box */ + pbox.xMin = ( cbox.xMin >> 6 ) + ( x_shift >> 6 ); + pbox.yMin = ( cbox.yMin >> 6 ) + ( y_shift >> 6 ); + pbox.xMax = ( cbox.xMax >> 6 ) + ( x_shift >> 6 ); + pbox.yMax = ( cbox.yMax >> 6 ) + ( y_shift >> 6 ); + + /* tiny remainder box */ + cbox.xMin = ( cbox.xMin & 63 ) + ( x_shift & 63 ); + cbox.yMin = ( cbox.yMin & 63 ) + ( y_shift & 63 ); + cbox.xMax = ( cbox.xMax & 63 ) + ( x_shift & 63 ); + cbox.yMax = ( cbox.yMax & 63 ) + ( y_shift & 63 ); switch ( mode ) { case FT_RENDER_MODE_MONO: pixel_mode = FT_PIXEL_MODE_MONO; #if 1 - /* undocumented but confirmed: bbox values get rounded */ - /* unless the rounded box can collapse for a narrow glyph */ - if ( cbox.xMax - cbox.xMin < 64 ) - { - cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); - cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); - } - else - { - cbox.xMin = FT_PIX_ROUND_LONG( cbox.xMin ); - cbox.xMax = FT_PIX_ROUND_LONG( cbox.xMax ); - } + /* x */ + + /* undocumented but confirmed: bbox values get rounded; */ + /* we do asymmetric rounding so that the center of a pixel */ + /* gets always included */ + + pbox.xMin += ( cbox.xMin + 31 ) >> 6; + pbox.xMax += ( cbox.xMax + 32 ) >> 6; - if ( cbox.yMax - cbox.yMin < 64 ) + /* if the bbox collapsed, we add a pixel based on the total */ + /* rounding remainder to cover most of the original cbox */ + + if ( pbox.xMin == pbox.xMax ) { - cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); + if ( ( ( cbox.xMin + 31 ) & 63 ) - 31 + + ( ( cbox.xMax + 32 ) & 63 ) - 32 < 0 ) + pbox.xMin -= 1; + else + pbox.xMax += 1; } - else + + /* y */ + + pbox.yMin += ( cbox.yMin + 31 ) >> 6; + pbox.yMax += ( cbox.yMax + 32 ) >> 6; + + if ( pbox.yMin == pbox.yMax ) { - cbox.yMin = FT_PIX_ROUND_LONG( cbox.yMin ); - cbox.yMax = FT_PIX_ROUND_LONG( cbox.yMax ); + if ( ( ( cbox.yMin + 31 ) & 63 ) - 31 + + ( ( cbox.yMax + 32 ) & 63 ) - 32 < 0 ) + pbox.yMin -= 1; + else + pbox.yMax += 1; } + + break; #else - cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); - cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); - cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); + goto Adjust; #endif - break; case FT_RENDER_MODE_LCD: pixel_mode = FT_PIXEL_MODE_LCD; - ft_lcd_padding( &cbox.xMin, &cbox.xMax, slot ); - goto Round; + ft_lcd_padding( &cbox, slot, mode ); + goto Adjust; case FT_RENDER_MODE_LCD_V: pixel_mode = FT_PIXEL_MODE_LCD_V; - ft_lcd_padding( &cbox.yMin, &cbox.yMax, slot ); - goto Round; + ft_lcd_padding( &cbox, slot, mode ); + goto Adjust; case FT_RENDER_MODE_NORMAL: case FT_RENDER_MODE_LIGHT: default: pixel_mode = FT_PIXEL_MODE_GRAY; - Round: - cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); - cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); - cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); + Adjust: + pbox.xMin += cbox.xMin >> 6; + pbox.yMin += cbox.yMin >> 6; + pbox.xMax += ( cbox.xMax + 63 ) >> 6; + pbox.yMax += ( cbox.yMax + 63 ) >> 6; } - x_shift = SUB_LONG( x_shift, cbox.xMin ); - y_shift = SUB_LONG( y_shift, cbox.yMin ); + x_left = pbox.xMin; + y_top = pbox.yMax; - x_left = cbox.xMin >> 6; - y_top = cbox.yMax >> 6; - - width = ( (FT_ULong)cbox.xMax - (FT_ULong)cbox.xMin ) >> 6; - height = ( (FT_ULong)cbox.yMax - (FT_ULong)cbox.yMin ) >> 6; + width = pbox.xMax - pbox.xMin; + height = pbox.yMax - pbox.yMin; switch ( pixel_mode ) { @@ -459,6 +486,16 @@ bitmap->width = (unsigned int)width; bitmap->rows = (unsigned int)height; bitmap->pitch = pitch; + + if ( pbox.xMin < -0x8000 || pbox.xMax > 0x7FFF || + pbox.yMin < -0x8000 || pbox.yMax > 0x7FFF ) + { + FT_TRACE3(( "ft_glyphslot_preset_bitmap: [%ld %ld %ld %ld]\n", + pbox.xMin, pbox.yMin, pbox.xMax, pbox.yMax )); + return 1; + } + + return 0; } @@ -807,7 +844,7 @@ * - Do only auto-hinting if we have * * - a hinter module, - * - a scalable font format dealing with outlines, + * - a scalable font, * - not a tricky font, and * - no transforms except simple slants and/or rotations by * integer multiples of 90 degrees. @@ -825,8 +862,7 @@ if ( hinter && !( load_flags & FT_LOAD_NO_HINTING ) && !( load_flags & FT_LOAD_NO_AUTOHINT ) && - FT_DRIVER_IS_SCALABLE( driver ) && - FT_DRIVER_USES_OUTLINES( driver ) && + FT_IS_SCALABLE( face ) && !FT_IS_TRICKY( face ) && ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) || ( face->internal->transform_matrix.yx == 0 && @@ -846,7 +882,7 @@ /* only the new Adobe engine (for both CFF and Type 1) is `light'; */ /* we use `strstr' to catch both `Type 1' and `CID Type 1' */ is_light_type1 = - ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL && + ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL && ((PS_Driver)driver)->hinting_engine == FT_HINTING_ADOBE; /* the check for `num_locations' assures that we actually */ @@ -926,8 +962,9 @@ #ifdef GRID_FIT_METRICS if ( !( load_flags & FT_LOAD_NO_HINTING ) ) - ft_glyphslot_grid_fit_metrics( slot, - FT_BOOL( load_flags & FT_LOAD_VERTICAL_LAYOUT ) ); + ft_glyphslot_grid_fit_metrics( + slot, + FT_BOOL( load_flags & FT_LOAD_VERTICAL_LAYOUT ) ); #endif } } @@ -995,6 +1032,9 @@ } } + slot->glyph_index = glyph_index; + slot->internal->load_flags = load_flags; + /* do we need to render the image or preset the bitmap now? */ if ( !error && ( load_flags & FT_LOAD_NO_SCALE ) == 0 && @@ -1014,17 +1054,21 @@ ft_glyphslot_preset_bitmap( slot, mode, NULL ); } - FT_TRACE5(( "FT_Load_Glyph: index %d, flags %x\n", - glyph_index, load_flags )); +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE5(( "FT_Load_Glyph: index %d, flags 0x%x\n", + glyph_index, load_flags )); FT_TRACE5(( " x advance: %f\n", slot->advance.x / 64.0 )); FT_TRACE5(( " y advance: %f\n", slot->advance.y / 64.0 )); FT_TRACE5(( " linear x advance: %f\n", slot->linearHoriAdvance / 65536.0 )); FT_TRACE5(( " linear y advance: %f\n", slot->linearVertAdvance / 65536.0 )); - FT_TRACE5(( " bitmap %dx%d, mode %d\n", - slot->bitmap.width, slot->bitmap.rows, - slot->bitmap.pixel_mode )); + 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 )); +#endif Exit: return error; @@ -1162,20 +1206,20 @@ } - /*************************************************************************/ - /* */ - /* */ - /* find_unicode_charmap */ - /* */ - /* */ - /* This function finds a Unicode charmap, if there is one. */ - /* And if there is more than one, it tries to favour the more */ - /* extensive one, i.e., one that supports UCS-4 against those which */ - /* are limited to the BMP (said UCS-2 encoding.) */ - /* */ - /* This function is called from open_face() (just below), and also */ - /* from FT_Select_Charmap( ..., FT_ENCODING_UNICODE ). */ - /* */ + /************************************************************************** + * + * @Function: + * find_unicode_charmap + * + * @Description: + * This function finds a Unicode charmap, if there is one. + * And if there is more than one, it tries to favour the more + * extensive one, i.e., one that supports UCS-4 against those which + * are limited to the BMP (said UCS-2 encoding.) + * + * This function is called from open_face() (just below), and also + * from FT_Select_Charmap( ..., FT_ENCODING_UNICODE ). + */ static FT_Error find_unicode_charmap( FT_Face face ) { @@ -1192,26 +1236,26 @@ return FT_THROW( Invalid_CharMap_Handle ); /* - * The original TrueType specification(s) only specified charmap - * formats that are capable of mapping 8 or 16 bit character codes to - * glyph indices. + * The original TrueType specification(s) only specified charmap + * formats that are capable of mapping 8 or 16 bit character codes to + * glyph indices. * - * However, recent updates to the Apple and OpenType specifications - * introduced new formats that are capable of mapping 32-bit character - * codes as well. And these are already used on some fonts, mainly to - * map non-BMP Asian ideographs as defined in Unicode. + * However, recent updates to the Apple and OpenType specifications + * introduced new formats that are capable of mapping 32-bit character + * codes as well. And these are already used on some fonts, mainly to + * map non-BMP Asian ideographs as defined in Unicode. * - * For compatibility purposes, these fonts generally come with - * *several* Unicode charmaps: + * For compatibility purposes, these fonts generally come with + * *several* Unicode charmaps: * - * - One of them in the "old" 16-bit format, that cannot access - * all glyphs in the font. + * - One of them in the "old" 16-bit format, that cannot access + * all glyphs in the font. * - * - Another one in the "new" 32-bit format, that can access all - * the glyphs. + * - Another one in the "new" 32-bit format, that can access all + * the glyphs. * - * This function has been written to always favor a 32-bit charmap - * when found. Otherwise, a 16-bit one is returned when found. + * This function has been written to always favor a 32-bit charmap + * when found. Otherwise, a 16-bit one is returned when found. */ /* Since the `interesting' table, with IDs (3,10), is normally the */ @@ -1255,15 +1299,15 @@ } - /*************************************************************************/ - /* */ - /* */ - /* find_variant_selector_charmap */ - /* */ - /* */ - /* This function finds the variant selector charmap, if there is one. */ - /* There can only be one (platform=0, specific=5, format=14). */ - /* */ + /************************************************************************** + * + * @Function: + * find_variant_selector_charmap + * + * @Description: + * This function finds the variant selector charmap, if there is one. + * There can only be one (platform=0, specific=5, format=14). + */ static FT_CharMap find_variant_selector_charmap( FT_Face face ) { @@ -1294,14 +1338,14 @@ } - /*************************************************************************/ - /* */ - /* */ - /* open_face */ - /* */ - /* */ - /* This function does some work for FT_Open_Face(). */ - /* */ + /************************************************************************** + * + * @Function: + * open_face + * + * @Description: + * This function does some work for FT_Open_Face(). + */ static FT_Error open_face( FT_Driver driver, FT_Stream *astream, @@ -2176,13 +2220,13 @@ { #undef FT_COMPONENT -#define FT_COMPONENT trace_raccess +#define FT_COMPONENT raccess FT_Memory memory = library->memory; FT_Error error = FT_ERR( Unknown_File_Format ); FT_UInt i; - char * file_names[FT_RACCESS_N_RULES]; + char* file_names[FT_RACCESS_N_RULES]; FT_Long offsets[FT_RACCESS_N_RULES]; FT_Error errors[FT_RACCESS_N_RULES]; FT_Bool is_darwin_vfs, vfs_rfork_has_no_font = FALSE; /* not tested */ @@ -2254,7 +2298,7 @@ return error; #undef FT_COMPONENT -#define FT_COMPONENT trace_objs +#define FT_COMPONENT objs } @@ -2282,7 +2326,7 @@ { #undef FT_COMPONENT -#define FT_COMPONENT trace_raccess +#define FT_COMPONENT raccess #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE3(( "Try as dfont: " )); @@ -2295,7 +2339,7 @@ FT_TRACE3(( "%s\n", error ? "failed" : "successful" )); #undef FT_COMPONENT -#define FT_COMPONENT trace_objs +#define FT_COMPONENT objs } @@ -2693,8 +2737,8 @@ /* close the attached stream */ FT_Stream_Free( stream, - (FT_Bool)( parameters->stream && - ( parameters->flags & FT_OPEN_STREAM ) ) ); + FT_BOOL( parameters->stream && + ( parameters->flags & FT_OPEN_STREAM ) ) ); Exit: return error; @@ -3464,7 +3508,8 @@ if ( !face ) return FT_THROW( Invalid_Face_Handle ); - if ( encoding == FT_ENCODING_NONE ) + /* FT_ENCODING_NONE is a valid encoding for BDF, PCF, and Windows FNT */ + if ( encoding == FT_ENCODING_NONE && !face->num_charmaps ) return FT_THROW( Invalid_Argument ); /* FT_ENCODING_UNICODE is special. We try to find the `best' Unicode */ @@ -3485,7 +3530,7 @@ if ( cur[0]->encoding == encoding ) { face->charmap = cur[0]; - return 0; + return FT_Err_Ok; } } @@ -3510,14 +3555,12 @@ if ( !cur || !charmap ) return FT_THROW( Invalid_CharMap_Handle ); - if ( FT_Get_CMap_Format( charmap ) == 14 ) - return FT_THROW( Invalid_Argument ); - limit = cur + face->num_charmaps; for ( ; cur < limit; cur++ ) { - if ( cur[0] == charmap ) + if ( cur[0] == charmap && + FT_Get_CMap_Format ( charmap ) != 14 ) { face->charmap = cur[0]; return FT_Err_Ok; @@ -4016,8 +4059,8 @@ /* documentation is in freetype.h */ FT_EXPORT_DEF( FT_UInt ) - FT_Get_Name_Index( FT_Face face, - FT_String* glyph_name ) + FT_Get_Name_Index( FT_Face face, + const FT_String* glyph_name ) { FT_UInt result = 0; @@ -4487,16 +4530,89 @@ FT_Render_Mode render_mode ) { FT_Error error = FT_Err_Ok; + FT_Face face = slot->face; FT_Renderer renderer; - /* if it is already a bitmap, no need to do anything */ 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 ) + { + FT_LayerIterator iterator; + + FT_UInt base_glyph = slot->glyph_index; + + FT_Bool have_layers; + FT_UInt glyph_index; + FT_UInt color_index; + + + /* check whether we have colored glyph layers */ + iterator.p = NULL; + have_layers = FT_Get_Color_Glyph_Layer( face, + base_glyph, + &glyph_index, + &color_index, + &iterator ); + if ( have_layers ) + { + error = FT_New_GlyphSlot( face, NULL ); + if ( !error ) + { + TT_Face ttface = (TT_Face)face; + SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; + + + do + { + FT_Int32 load_flags = slot->internal->load_flags; + + + /* disable the `FT_LOAD_COLOR' flag to avoid recursion */ + /* right here in this function */ + load_flags &= ~FT_LOAD_COLOR; + + /* render into the new `face->glyph' glyph slot */ + load_flags |= FT_LOAD_RENDER; + + error = FT_Load_Glyph( face, glyph_index, load_flags ); + if ( error ) + break; + + /* blend new `face->glyph' into old `slot'; */ + /* at the first call, `slot' is still empty */ + error = sfnt->colr_blend( ttface, + color_index, + slot, + face->glyph ); + if ( error ) + break; + + } while ( FT_Get_Color_Glyph_Layer( face, + base_glyph, + &glyph_index, + &color_index, + &iterator ) ); + + if ( !error ) + slot->format = FT_GLYPH_FORMAT_BITMAP; + + /* this call also restores `slot' as the glyph slot */ + FT_Done_GlyphSlot( face->glyph ); + } + + if ( !error ) + return error; + + /* Failed to do the colored layer. Draw outline instead. */ + slot->format = FT_GLYPH_FORMAT_OUTLINE; + } + } + { FT_ListNode node = NULL; @@ -4532,7 +4648,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE #undef FT_COMPONENT -#define FT_COMPONENT trace_bitmap +#define FT_COMPONENT checksum /* * Computing the MD5 checksum is expensive, unnecessarily distorting a @@ -4542,9 +4658,9 @@ */ /* we use FT_TRACE3 in this block */ - if ( !error && - ft_trace_levels[trace_bitmap] >= 3 && - slot->bitmap.buffer ) + if ( !error && + ft_trace_levels[trace_checksum] >= 3 && + slot->bitmap.buffer ) { FT_Bitmap bitmap; FT_Error err; @@ -4565,8 +4681,11 @@ int pitch = bitmap.pitch; - FT_TRACE3(( "FT_Render_Glyph: bitmap %dx%d, mode %d\n", - rows, pitch, slot->bitmap.pixel_mode )); + FT_TRACE3(( "FT_Render_Glyph: bitmap %dx%d, %s (mode %d)\n", + pitch, + rows, + pixel_modes[slot->bitmap.pixel_mode], + slot->bitmap.pixel_mode )); for ( i = 0; i < rows; i++ ) for ( j = 0; j < pitch; j++ ) @@ -4594,49 +4713,56 @@ */ /* we use FT_TRACE7 in this block */ - if ( !error && - ft_trace_levels[trace_bitmap] >= 7 && - slot->bitmap.rows < 128U && - slot->bitmap.width < 128U && - slot->bitmap.buffer ) + if ( !error && + ft_trace_levels[trace_checksum] >= 7 ) { - int rows = (int)slot->bitmap.rows; - int width = (int)slot->bitmap.width; - int pitch = slot->bitmap.pitch; - int i, j, m; - unsigned char* topleft = slot->bitmap.buffer; + if ( slot->bitmap.rows < 128U && + slot->bitmap.width < 128U && + slot->bitmap.buffer ) + { + int rows = (int)slot->bitmap.rows; + int width = (int)slot->bitmap.width; + int pitch = slot->bitmap.pitch; + int i, j, m; - if ( pitch < 0 ) - topleft -= pitch * ( rows - 1 ); + unsigned char* topleft = slot->bitmap.buffer; - FT_TRACE7(( "Netpbm image: start\n" )); - switch ( slot->bitmap.pixel_mode ) - { - case FT_PIXEL_MODE_MONO: - FT_TRACE7(( "P1 %d %d\n", width, rows )); - for ( i = 0; i < rows; i++ ) - { - for ( j = 0; j < width; ) - for ( m = 128; m > 0 && j < width; m >>= 1, j++ ) - FT_TRACE7(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 )); - FT_TRACE7(( "\n" )); - } - break; - default: - FT_TRACE7(( "P2 %d %d 255\n", width, rows )); - for ( i = 0; i < rows; i++ ) + if ( pitch < 0 ) + topleft -= pitch * ( rows - 1 ); + + FT_TRACE7(( "Netpbm image: start\n" )); + switch ( slot->bitmap.pixel_mode ) { - for ( j = 0; j < width; j += 1 ) - FT_TRACE7(( " %3u", topleft[i * pitch + j] )); - FT_TRACE7(( "\n" )); + case FT_PIXEL_MODE_MONO: + FT_TRACE7(( "P1 %d %d\n", width, rows )); + for ( i = 0; i < rows; i++ ) + { + for ( j = 0; j < width; ) + for ( m = 128; m > 0 && j < width; m >>= 1, j++ ) + FT_TRACE7(( " %d", + ( topleft[i * pitch + j / 8] & m ) != 0 )); + FT_TRACE7(( "\n" )); + } + break; + + default: + FT_TRACE7(( "P2 %d %d 255\n", width, rows )); + for ( i = 0; i < rows; i++ ) + { + for ( j = 0; j < width; j += 1 ) + FT_TRACE7(( " %3u", topleft[i * pitch + j] )); + FT_TRACE7(( "\n" )); + } } + FT_TRACE7(( "Netpbm image: end\n" )); } - FT_TRACE7(( "Netpbm image: end\n" )); + else + FT_TRACE7(( "Netpbm image: too large, omitted\n" )); } #undef FT_COMPONENT -#define FT_COMPONENT trace_objs +#define FT_COMPONENT objs #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -4675,21 +4801,22 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* Destroy_Module */ - /* */ - /* */ - /* Destroys a given module object. For drivers, this also destroys */ - /* all child faces. */ - /* */ - /* */ - /* module :: A handle to the target driver object. */ - /* */ - /* */ - /* The driver _must_ be LOCKED! */ - /* */ + /************************************************************************** + * + * @Function: + * Destroy_Module + * + * @Description: + * Destroys a given module object. For drivers, this also destroys + * all child faces. + * + * @InOut: + * module :: + * A handle to the target driver object. + * + * @Note: + * The driver _must_ be LOCKED! + */ static void Destroy_Module( FT_Module module ) { @@ -5028,9 +5155,9 @@ service = (FT_Service_Properties)interface; if ( set ) - missing_func = (FT_Bool)( !service->set_property ); + missing_func = FT_BOOL( !service->set_property ); else - missing_func = (FT_Bool)( !service->get_property ); + missing_func = FT_BOOL( !service->get_property ); if ( missing_func ) { @@ -5156,13 +5283,6 @@ library->memory = memory; -#ifdef FT_CONFIG_OPTION_PIC - /* initialize position independent code containers */ - error = ft_pic_container_init( library ); - if ( error ) - goto Fail; -#endif - library->version_major = FREETYPE_MAJOR; library->version_minor = FREETYPE_MINOR; library->version_patch = FREETYPE_PATCH; @@ -5173,13 +5293,6 @@ *alibrary = library; return FT_Err_Ok; - -#ifdef FT_CONFIG_OPTION_PIC - Fail: - ft_pic_container_destroy( library ); - FT_FREE( library ); - return error; -#endif } @@ -5237,10 +5350,10 @@ * * Example: * - * - the cff font driver uses the pshinter module in cff_size_done - * - if the pshinter module is destroyed before the cff font driver, - * opened FT_Face objects managed by the driver are not properly - * destroyed, resulting in a memory leak + * - the cff font driver uses the pshinter module in cff_size_done + * - if the pshinter module is destroyed before the cff font driver, + * opened FT_Face objects managed by the driver are not properly + * destroyed, resulting in a memory leak * * Some faces are dependent on other faces, like Type42 faces that * depend on TrueType faces synthesized internally. @@ -5310,11 +5423,6 @@ } #endif -#ifdef FT_CONFIG_OPTION_PIC - /* Destroy pic container contents */ - ft_pic_container_destroy( library ); -#endif - FT_FREE( library ); Exit: @@ -5402,4 +5510,41 @@ } + /* documentation is in freetype.h */ + + FT_EXPORT_DEF( FT_Bool ) + FT_Get_Color_Glyph_Layer( FT_Face face, + FT_UInt base_glyph, + FT_UInt *aglyph_index, + FT_UInt *acolor_index, + FT_LayerIterator* iterator ) + { + TT_Face ttface; + SFNT_Service sfnt; + + + if ( !face || + !aglyph_index || + !acolor_index || + !iterator || + base_glyph >= (FT_UInt)face->num_glyphs ) + 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_layer( ttface, + base_glyph, + aglyph_index, + acolor_index, + iterator ); + else + return 0; + } + + /* END */ diff --git a/src/3rdparty/freetype/src/base/ftotval.c b/src/3rdparty/freetype/src/base/ftotval.c index a2944a7950..007576ce6e 100644 --- a/src/3rdparty/freetype/src/base/ftotval.c +++ b/src/3rdparty/freetype/src/base/ftotval.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftotval.c */ -/* */ -/* FreeType API for validating OpenType tables (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftotval.c + * + * FreeType API for validating OpenType tables (body). + * + * Copyright (C) 2004-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_INTERNAL_DEBUG_H diff --git a/src/3rdparty/freetype/src/base/ftoutln.c b/src/3rdparty/freetype/src/base/ftoutln.c index cb91321deb..0e2ba3475d 100644 --- a/src/3rdparty/freetype/src/base/ftoutln.c +++ b/src/3rdparty/freetype/src/base/ftoutln.c @@ -1,26 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftoutln.c */ -/* */ -/* FreeType outline management (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* All functions are declared in freetype.h. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftoutln.c + * + * FreeType outline management (body). + * + * Copyright (C) 1996-2019 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 @@ -31,14 +24,14 @@ #include FT_TRIGONOMETRY_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_outline +#define FT_COMPONENT outline static @@ -53,8 +46,7 @@ void* user ) { #undef SCALED -#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << shift ) \ - : ( (x) << shift ) ) - delta ) +#define SCALED( x ) ( (x) * ( 1L << shift ) - delta ) FT_Vector v_last; FT_Vector v_control; @@ -296,14 +288,22 @@ } + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Error ) - FT_Outline_New_Internal( FT_Memory memory, - FT_UInt numPoints, - FT_Int numContours, - FT_Outline *anoutline ) + FT_Outline_New( FT_Library library, + FT_UInt numPoints, + FT_Int numContours, + FT_Outline *anoutline ) { - FT_Error error; + FT_Error error; + FT_Memory memory; + + if ( !library ) + return FT_THROW( Invalid_Library_Handle ); + + memory = library->memory; if ( !anoutline || !memory ) return FT_THROW( Invalid_Argument ); @@ -330,28 +330,12 @@ Fail: anoutline->flags |= FT_OUTLINE_OWNER; - FT_Outline_Done_Internal( memory, anoutline ); + FT_Outline_Done( library, anoutline ); return error; } - /* documentation is in ftoutln.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_Outline_New( FT_Library library, - FT_UInt numPoints, - FT_Int numContours, - FT_Outline *anoutline ) - { - if ( !library ) - return FT_THROW( Invalid_Library_Handle ); - - return FT_Outline_New_Internal( library->memory, numPoints, - numContours, anoutline ); - } - - /* documentation is in ftoutln.h */ FT_EXPORT_DEF( FT_Error ) @@ -436,13 +420,23 @@ } + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Error ) - FT_Outline_Done_Internal( FT_Memory memory, - FT_Outline* outline ) + FT_Outline_Done( FT_Library library, + FT_Outline* outline ) { + FT_Memory memory; + + + if ( !library ) + return FT_THROW( Invalid_Library_Handle ); + if ( !outline ) return FT_THROW( Invalid_Outline ); + memory = library->memory; + if ( !memory ) return FT_THROW( Invalid_Argument ); @@ -458,21 +452,6 @@ } - /* documentation is in ftoutln.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_Outline_Done( FT_Library library, - FT_Outline* outline ) - { - /* check for valid `outline' in FT_Outline_Done_Internal() */ - - if ( !library ) - return FT_THROW( Invalid_Library_Handle ); - - return FT_Outline_Done_Internal( library->memory, outline ); - } - - /* documentation is in ftoutln.h */ FT_EXPORT_DEF( void ) @@ -619,6 +598,7 @@ FT_Error error; FT_Renderer renderer; FT_ListNode node; + FT_BBox cbox; if ( !library ) @@ -630,11 +610,26 @@ if ( !params ) return FT_THROW( Invalid_Argument ); + FT_Outline_Get_CBox( outline, &cbox ); + if ( cbox.xMin < -0x1000000L || cbox.yMin < -0x1000000L || + cbox.xMax > 0x1000000L || cbox.yMax > 0x1000000L ) + return FT_THROW( Invalid_Outline ); + renderer = library->cur_renderer; node = library->renderers.head; params->source = (void*)outline; + /* preset clip_box for direct mode */ + if ( params->flags & FT_RASTER_FLAG_DIRECT && + !( params->flags & FT_RASTER_FLAG_CLIP ) ) + { + params->clip_box.xMin = cbox.xMin >> 6; + params->clip_box.yMin = cbox.yMin >> 6; + params->clip_box.xMax = ( cbox.xMax + 63 ) >> 6; + params->clip_box.yMax = ( cbox.yMax + 63 ) >> 6; + } + error = FT_ERR( Cannot_Render_Glyph ); while ( renderer ) { @@ -911,9 +906,9 @@ FT_Pos xstrength, FT_Pos ystrength ) { - FT_Vector* points; - FT_Int c, first, last; - FT_Int orientation; + FT_Vector* points; + FT_Int c, first, last; + FT_Orientation orientation; if ( !outline ) @@ -1044,7 +1039,7 @@ FT_EXPORT_DEF( FT_Orientation ) FT_Outline_Get_Orientation( FT_Outline* outline ) { - FT_BBox cbox; + FT_BBox cbox = { 0, 0, 0, 0 }; FT_Int xshift, yshift; FT_Vector* points; FT_Vector v_prev, v_cur; @@ -1090,7 +1085,8 @@ v_cur.y = points[n].y >> yshift; area = ADD_LONG( area, - ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) ); + MUL_LONG( v_cur.y - v_prev.y, + v_cur.x + v_prev.x ) ); v_prev = v_cur; } diff --git a/src/3rdparty/freetype/src/base/ftpatent.c b/src/3rdparty/freetype/src/base/ftpatent.c index e23ee2e3f4..020f4646eb 100644 --- a/src/3rdparty/freetype/src/base/ftpatent.c +++ b/src/3rdparty/freetype/src/base/ftpatent.c @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* ftpatent.c */ -/* */ -/* FreeType API for checking patented TrueType bytecode instructions */ -/* (body). Obsolete, retained for backward compatibility. */ -/* */ -/* Copyright 2007-2018 by */ -/* David Turner. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftpatent.c + * + * FreeType API for checking patented TrueType bytecode instructions + * (body). Obsolete, retained for backward compatibility. + * + * Copyright (C) 2007-2019 by + * David Turner. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_FREETYPE_H diff --git a/src/3rdparty/freetype/src/base/ftpfr.c b/src/3rdparty/freetype/src/base/ftpfr.c index bfe13520eb..aeff1db8bd 100644 --- a/src/3rdparty/freetype/src/base/ftpfr.c +++ b/src/3rdparty/freetype/src/base/ftpfr.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftpfr.c */ -/* */ -/* FreeType API for accessing PFR-specific data (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftpfr.c + * + * FreeType API for accessing PFR-specific data (body). + * + * Copyright (C) 2002-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_INTERNAL_DEBUG_H diff --git a/src/3rdparty/freetype/src/base/ftpsprop.c b/src/3rdparty/freetype/src/base/ftpsprop.c index 459b5e6054..52b9d453ad 100644 --- a/src/3rdparty/freetype/src/base/ftpsprop.c +++ b/src/3rdparty/freetype/src/base/ftpsprop.c @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* ftpsprop.c */ -/* */ -/* Get and set properties of PostScript drivers (body). */ -/* See `ftdriver.h' for available properties. */ -/* */ -/* Copyright 2017-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftpsprop.c + * + * Get and set properties of PostScript drivers (body). + * See `ftdriver.h' for available properties. + * + * Copyright (C) 2017-2019 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 @@ -25,14 +25,14 @@ #include FT_INTERNAL_POSTSCRIPT_PROPS_H - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_psprops +#define FT_COMPONENT psprops FT_BASE_CALLBACK_DEF( FT_Error ) diff --git a/src/3rdparty/freetype/src/base/ftrfork.c b/src/3rdparty/freetype/src/base/ftrfork.c index c3a2b9151a..73b7eb0ded 100644 --- a/src/3rdparty/freetype/src/base/ftrfork.c +++ b/src/3rdparty/freetype/src/base/ftrfork.c @@ -1,38 +1,38 @@ -/***************************************************************************/ -/* */ -/* ftrfork.c */ -/* */ -/* Embedded resource forks accessor (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* Masatake YAMATO and Redhat K.K. */ -/* */ -/* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */ -/* derived from ftobjs.c. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* Development of the code in this file is support of */ -/* Information-technology Promotion Agency, Japan. */ -/***************************************************************************/ +/**************************************************************************** + * + * ftrfork.c + * + * Embedded resource forks accessor (body). + * + * Copyright (C) 2004-2019 by + * Masatake YAMATO and Redhat K.K. + * + * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are + * derived from ftobjs.c. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + +/**************************************************************************** + * Development of the code in this file is support of + * Information-technology Promotion Agency, Japan. + */ #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_RFORK_H -#include "basepic.h" + #include "ftbase.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_raccess +#define FT_COMPONENT raccess /*************************************************************************/ @@ -438,7 +438,7 @@ static FT_Error raccess_guess_linux_double_from_file_name( FT_Library library, - char * file_name, + char* file_name, FT_Long *result_offset ); static char * @@ -468,10 +468,10 @@ if ( errors[i] ) continue; - errors[i] = (FT_RACCESS_GUESS_TABLE_GET[i].func)( library, - stream, base_name, - &(new_names[i]), - &(offsets[i]) ); + errors[i] = ft_raccess_guess_table[i].func( library, + stream, base_name, + &(new_names[i]), + &(offsets[i]) ); } return; @@ -488,7 +488,7 @@ if ( rule_index >= FT_RACCESS_N_RULES ) return FT_RFork_Rule_invalid; - return FT_RACCESS_GUESS_TABLE_GET[rule_index].type; + return ft_raccess_guess_table[rule_index].type; } @@ -847,7 +847,7 @@ { FT_Open_Args args2; FT_Stream stream2; - char * nouse = NULL; + char* nouse = NULL; FT_Error error; @@ -909,9 +909,9 @@ #else /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ - /*************************************************************************/ - /* Dummy function; just sets errors */ - /*************************************************************************/ + /************************************************************************** + * Dummy function; just sets errors + */ FT_BASE_DEF( void ) FT_Raccess_Guess( FT_Library library, diff --git a/src/3rdparty/freetype/src/base/ftsnames.c b/src/3rdparty/freetype/src/base/ftsnames.c index 90ea1e2be7..7ab3fe3cfa 100644 --- a/src/3rdparty/freetype/src/base/ftsnames.c +++ b/src/3rdparty/freetype/src/base/ftsnames.c @@ -1,22 +1,22 @@ -/***************************************************************************/ -/* */ -/* ftsnames.c */ -/* */ -/* Simple interface to access SFNT name tables (which are used */ -/* to hold font names, copyright info, notices, etc.) (body). */ -/* */ -/* This is _not_ used to retrieve glyph names! */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftsnames.c + * + * Simple interface to access SFNT name tables (which are used + * to hold font names, copyright info, notices, etc.) (body). + * + * This is _not_ used to retrieve glyph names! + * + * Copyright (C) 1996-2019 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 @@ -142,7 +142,45 @@ } -#endif /* TT_CONFIG_OPTION_SFNT_NAMES */ +#else /* !TT_CONFIG_OPTION_SFNT_NAMES */ + + + FT_EXPORT_DEF( FT_UInt ) + FT_Get_Sfnt_Name_Count( FT_Face face ) + { + FT_UNUSED( face ); + + return 0; + } + + + FT_EXPORT_DEF( FT_Error ) + FT_Get_Sfnt_Name( FT_Face face, + FT_UInt idx, + FT_SfntName *aname ) + { + FT_UNUSED( face ); + FT_UNUSED( idx ); + FT_UNUSED( aname ); + + return FT_THROW( Unimplemented_Feature ); + } + + + FT_EXPORT_DEF( FT_Error ) + FT_Get_Sfnt_LangTag( FT_Face face, + FT_UInt langID, + FT_SfntLangTag *alangTag ) + { + FT_UNUSED( face ); + FT_UNUSED( langID ); + FT_UNUSED( alangTag ); + + return FT_THROW( Unimplemented_Feature ); + } + + +#endif /* !TT_CONFIG_OPTION_SFNT_NAMES */ /* END */ diff --git a/src/3rdparty/freetype/src/base/ftstream.c b/src/3rdparty/freetype/src/base/ftstream.c index 18df7dcfef..4b0890d7fd 100644 --- a/src/3rdparty/freetype/src/base/ftstream.c +++ b/src/3rdparty/freetype/src/base/ftstream.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftstream.c */ -/* */ -/* I/O stream support (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftstream.c + * + * I/O stream support (body). + * + * Copyright (C) 2000-2019 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 @@ -21,14 +21,14 @@ #include FT_INTERNAL_DEBUG_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_stream +#define FT_COMPONENT stream FT_BASE_DEF( void ) @@ -219,13 +219,14 @@ { FT_Memory memory = stream->memory; + #ifdef FT_DEBUG_MEMORY ft_mem_free( memory, *pbytes ); - *pbytes = NULL; #else FT_FREE( *pbytes ); #endif } + *pbytes = NULL; } @@ -238,6 +239,8 @@ FT_ULong read_bytes; + FT_TRACE7(( "FT_Stream_EnterFrame: %ld bytes\n", count )); + /* check for nested frame access */ FT_ASSERT( stream && stream->cursor == 0 ); @@ -281,6 +284,7 @@ FT_FREE( stream->base ); error = FT_THROW( Invalid_Stream_Operation ); } + stream->cursor = stream->base; stream->limit = stream->cursor + count; stream->pos += read_bytes; @@ -321,13 +325,16 @@ /* In this case, the loader code handles the 0-length table */ /* gracefully; however, stream.cursor is really set to 0 by the */ /* FT_Stream_EnterFrame() call, and this is not an error. */ - /* */ + + FT_TRACE7(( "FT_Stream_ExitFrame\n" )); + FT_ASSERT( stream ); if ( stream->read ) { FT_Memory memory = stream->memory; + #ifdef FT_DEBUG_MEMORY ft_mem_free( memory, stream->base ); stream->base = NULL; @@ -335,6 +342,7 @@ FT_FREE( stream->base ); #endif } + stream->cursor = NULL; stream->limit = NULL; } diff --git a/src/3rdparty/freetype/src/base/ftstroke.c b/src/3rdparty/freetype/src/base/ftstroke.c index 6ae1819067..1b2c0f657c 100644 --- a/src/3rdparty/freetype/src/base/ftstroke.c +++ b/src/3rdparty/freetype/src/base/ftstroke.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftstroke.c */ -/* */ -/* FreeType path stroker (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftstroke.c + * + * FreeType path stroker (body). + * + * Copyright (C) 2002-2019 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 @@ -24,15 +24,10 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H -#include "basepic.h" - - /* declare an extern to access `ft_outline_glyph_class' globally */ - /* allocated in `ftglyph.c', and use the FT_OUTLINE_GLYPH_CLASS_GET */ - /* macro to access it when FT_CONFIG_OPTION_PIC is defined */ -#ifndef FT_CONFIG_OPTION_PIC + /* declare an extern to access `ft_outline_glyph_class' globally */ + /* allocated in `ftglyph.c' */ FT_CALLBACK_TABLE const FT_Glyph_Class ft_outline_glyph_class; -#endif /* documentation is in ftstroke.h */ @@ -91,16 +86,18 @@ base[4].x = base[2].x; - b = base[1].x; - a = base[3].x = ( base[2].x + b ) / 2; - b = base[1].x = ( base[0].x + b ) / 2; - base[2].x = ( a + b ) / 2; + a = base[0].x + base[1].x; + b = base[1].x + base[2].x; + base[3].x = b >> 1; + base[2].x = ( a + b ) >> 2; + base[1].x = a >> 1; base[4].y = base[2].y; - b = base[1].y; - a = base[3].y = ( base[2].y + b ) / 2; - b = base[1].y = ( base[0].y + b ) / 2; - base[2].y = ( a + b ) / 2; + a = base[0].y + base[1].y; + b = base[1].y + base[2].y; + base[3].y = b >> 1; + base[2].y = ( a + b ) >> 2; + base[1].y = a >> 1; } @@ -158,28 +155,32 @@ static void ft_cubic_split( FT_Vector* base ) { - FT_Pos a, b, c, d; + FT_Pos a, b, c; base[6].x = base[3].x; - c = base[1].x; - d = base[2].x; - base[1].x = a = ( base[0].x + c ) / 2; - base[5].x = b = ( base[3].x + d ) / 2; - c = ( c + d ) / 2; - base[2].x = a = ( a + c ) / 2; - base[4].x = b = ( b + c ) / 2; - base[3].x = ( a + b ) / 2; + 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 >> 1; + c += b; + base[4].x = c >> 2; + base[1].x = a >> 1; + a += b; + base[2].x = a >> 2; + base[3].x = ( a + c ) >> 3; base[6].y = base[3].y; - c = base[1].y; - d = base[2].y; - base[1].y = a = ( base[0].y + c ) / 2; - base[5].y = b = ( base[3].y + d ) / 2; - c = ( c + d ) / 2; - base[2].y = a = ( a + c ) / 2; - base[4].y = b = ( b + c ) / 2; - base[3].y = ( a + b ) / 2; + 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 >> 1; + c += b; + base[4].y = c >> 2; + base[1].y = a >> 1; + a += b; + base[2].y = a >> 2; + base[3].y = ( a + c ) >> 3; } @@ -372,6 +373,7 @@ /* it contains the `adjusted' starting coordinates */ border->num_points = --count; border->points[start] = border->points[count]; + border->tags[start] = border->tags[count]; if ( reverse ) { @@ -436,8 +438,8 @@ } else { - /* don't add zero-length lineto */ - if ( border->num_points > 0 && + /* don't add zero-length lineto, but always add moveto */ + if ( border->num_points > (FT_UInt)border->start && FT_IS_SMALL( border->points[border->num_points - 1].x - to->x ) && FT_IS_SMALL( border->points[border->num_points - 1].y - to->y ) ) return error; @@ -2087,8 +2089,8 @@ /* documentation is in ftstroke.h */ /* - * The following is very similar to FT_Outline_Decompose, except - * that we do support opened paths, and do not scale the outline. + * The following is very similar to FT_Outline_Decompose, except + * that we do support opened paths, and do not scale the outline. */ FT_EXPORT_DEF( FT_Error ) FT_Stroker_ParseOutline( FT_Stroker stroker, @@ -2306,17 +2308,12 @@ FT_Error error = FT_ERR( Invalid_Argument ); FT_Glyph glyph = NULL; - /* for FT_OUTLINE_GLYPH_CLASS_GET (in PIC mode) */ - FT_Library library = stroker->library; - - FT_UNUSED( library ); - if ( !pglyph ) goto Exit; glyph = *pglyph; - if ( !glyph || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET ) + if ( !glyph || glyph->clazz != &ft_outline_glyph_class ) goto Exit; { @@ -2386,17 +2383,12 @@ FT_Error error = FT_ERR( Invalid_Argument ); FT_Glyph glyph = NULL; - /* for FT_OUTLINE_GLYPH_CLASS_GET (in PIC mode) */ - FT_Library library = stroker->library; - - FT_UNUSED( library ); - if ( !pglyph ) goto Exit; glyph = *pglyph; - if ( !glyph || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET ) + if ( !glyph || glyph->clazz != &ft_outline_glyph_class ) goto Exit; { diff --git a/src/3rdparty/freetype/src/base/ftsynth.c b/src/3rdparty/freetype/src/base/ftsynth.c index c28346707b..f87ed65e75 100644 --- a/src/3rdparty/freetype/src/base/ftsynth.c +++ b/src/3rdparty/freetype/src/base/ftsynth.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftsynth.c */ -/* */ -/* FreeType synthesizing code for emboldening and slanting (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftsynth.c + * + * FreeType synthesizing code for emboldening and slanting (body). + * + * Copyright (C) 2000-2019 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 @@ -24,14 +24,14 @@ #include FT_BITMAP_H - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_synth +#define FT_COMPONENT synth /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/base/ftsystem.c b/src/3rdparty/freetype/src/base/ftsystem.c index 6adebdb938..f92b3a03d5 100644 --- a/src/3rdparty/freetype/src/base/ftsystem.c +++ b/src/3rdparty/freetype/src/base/ftsystem.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* ftsystem.c */ -/* */ -/* ANSI-specific FreeType low-level system interface (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 the default interface used by FreeType to access */ - /* low-level, i.e. memory management, i/o access as well as thread */ - /* synchronisation. It can be replaced by user-specific routines if */ - /* necessary. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftsystem.c + * + * ANSI-specific FreeType low-level system interface (body). + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + /************************************************************************** + * + * This file contains the default interface used by FreeType to access + * low-level, i.e. memory management, i/o access as well as thread + * synchronisation. It can be replaced by user-specific routines if + * necessary. + * + */ #include @@ -34,37 +34,39 @@ #include FT_TYPES_H - /*************************************************************************/ - /* */ - /* MEMORY MANAGEMENT INTERFACE */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* It is not necessary to do any error checking for the */ - /* allocation-related functions. This will be done by the higher level */ - /* routines like ft_mem_alloc() or ft_mem_realloc(). */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* ft_alloc */ - /* */ - /* */ - /* The memory allocation function. */ - /* */ - /* */ - /* memory :: A pointer to the memory object. */ - /* */ - /* size :: The requested size in bytes. */ - /* */ - /* */ - /* The address of newly allocated block. */ - /* */ + /************************************************************************** + * + * MEMORY MANAGEMENT INTERFACE + * + */ + + /************************************************************************** + * + * It is not necessary to do any error checking for the + * allocation-related functions. This will be done by the higher level + * routines like ft_mem_alloc() or ft_mem_realloc(). + * + */ + + + /************************************************************************** + * + * @Function: + * ft_alloc + * + * @Description: + * The memory allocation function. + * + * @Input: + * memory :: + * A pointer to the memory object. + * + * size :: + * The requested size in bytes. + * + * @Return: + * The address of newly allocated block. + */ FT_CALLBACK_DEF( void* ) ft_alloc( FT_Memory memory, long size ) @@ -75,26 +77,30 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ft_realloc */ - /* */ - /* */ - /* The memory reallocation function. */ - /* */ - /* */ - /* memory :: A pointer to the memory object. */ - /* */ - /* cur_size :: The current size of the allocated memory block. */ - /* */ - /* new_size :: The newly requested size in bytes. */ - /* */ - /* block :: The current address of the block in memory. */ - /* */ - /* */ - /* The address of the reallocated memory block. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_realloc + * + * @Description: + * The memory reallocation function. + * + * @Input: + * memory :: + * A pointer to the memory object. + * + * cur_size :: + * The current size of the allocated memory block. + * + * new_size :: + * The newly requested size in bytes. + * + * block :: + * The current address of the block in memory. + * + * @Return: + * The address of the reallocated memory block. + */ FT_CALLBACK_DEF( void* ) ft_realloc( FT_Memory memory, long cur_size, @@ -108,19 +114,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ft_free */ - /* */ - /* */ - /* The memory release function. */ - /* */ - /* */ - /* memory :: A pointer to the memory object. */ - /* */ - /* block :: The address of block in memory to be freed. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_free + * + * @Description: + * The memory release function. + * + * @Input: + * memory :: + * A pointer to the memory object. + * + * block :: + * The address of block in memory to be freed. + */ FT_CALLBACK_DEF( void ) ft_free( FT_Memory memory, void* block ) @@ -131,39 +139,40 @@ } - /*************************************************************************/ - /* */ - /* RESOURCE MANAGEMENT INTERFACE */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * RESOURCE MANAGEMENT INTERFACE + * + */ #ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_io +#define FT_COMPONENT io /* We use the macro STREAM_FILE for convenience to extract the */ /* system-specific stream handle from a given FreeType stream object */ #define STREAM_FILE( stream ) ( (FT_FILE*)stream->descriptor.pointer ) - /*************************************************************************/ - /* */ - /* */ - /* ft_ansi_stream_close */ - /* */ - /* */ - /* The function to close a stream. */ - /* */ - /* */ - /* stream :: A pointer to the stream object. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_ansi_stream_close + * + * @Description: + * The function to close a stream. + * + * @Input: + * stream :: + * A pointer to the stream object. + */ FT_CALLBACK_DEF( void ) ft_ansi_stream_close( FT_Stream stream ) { @@ -175,28 +184,32 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ft_ansi_stream_io */ - /* */ - /* */ - /* The function to open a stream. */ - /* */ - /* */ - /* stream :: A pointer to the stream object. */ - /* */ - /* offset :: The position in the data stream to start reading. */ - /* */ - /* buffer :: The address of buffer to store the read data. */ - /* */ - /* count :: The number of bytes to read from the stream. */ - /* */ - /* */ - /* The number of bytes actually read. If `count' is zero (this is, */ - /* the function is used for seeking), a non-zero return value */ - /* indicates an error. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_ansi_stream_io + * + * @Description: + * The function to open a stream. + * + * @Input: + * stream :: + * A pointer to the stream object. + * + * offset :: + * The position in the data stream to start reading. + * + * buffer :: + * The address of buffer to store the read data. + * + * count :: + * The number of bytes to read from the stream. + * + * @Return: + * The number of bytes actually read. If `count' is zero (this is, + * the function is used for seeking), a non-zero return value + * indicates an error. + */ FT_CALLBACK_DEF( unsigned long ) ft_ansi_stream_io( FT_Stream stream, unsigned long offset, diff --git a/src/3rdparty/freetype/src/base/fttrigon.c b/src/3rdparty/freetype/src/base/fttrigon.c index d6dd098c42..38721977c7 100644 --- a/src/3rdparty/freetype/src/base/fttrigon.c +++ b/src/3rdparty/freetype/src/base/fttrigon.c @@ -1,33 +1,33 @@ -/***************************************************************************/ -/* */ -/* fttrigon.c */ -/* */ -/* FreeType trigonometric functions (body). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This is a fixed-point CORDIC implementation of trigonometric */ - /* functions as well as transformations between Cartesian and polar */ - /* coordinates. The angles are represented as 16.16 fixed-point values */ - /* in degrees, i.e., the angular resolution is 2^-16 degrees. Note that */ - /* only vectors longer than 2^16*180/pi (or at least 22 bits) on a */ - /* discrete Cartesian grid can have the same or better angular */ - /* resolution. Therefore, to maintain this precision, some functions */ - /* require an interim upscaling of the vectors, whereas others operate */ - /* with 24-bit long vectors directly. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * fttrigon.c + * + * FreeType trigonometric functions (body). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + /************************************************************************** + * + * This is a fixed-point CORDIC implementation of trigonometric + * functions as well as transformations between Cartesian and polar + * coordinates. The angles are represented as 16.16 fixed-point values + * in degrees, i.e., the angular resolution is 2^-16 degrees. Note that + * only vectors longer than 2^16*180/pi (or at least 22 bits) on a + * discrete Cartesian grid can have the same or better angular + * resolution. Therefore, to maintain this precision, some functions + * require an interim upscaling of the vectors, whereas others operate + * with 24-bit long vectors directly. + * + */ #include #include FT_INTERNAL_OBJECTS_H @@ -325,10 +325,10 @@ FT_EXPORT_DEF( FT_Fixed ) FT_Tan( FT_Angle angle ) { - FT_Vector v; + FT_Vector v = { 1 << 24, 0 }; - FT_Vector_Unit( &v, angle ); + ft_trig_pseudo_rotate( &v, angle ); return FT_DivFix( v.y, v.x ); } @@ -372,14 +372,6 @@ } - /* these macros return 0 for positive numbers, - and -1 for negative ones */ -#define FT_SIGN_LONG( x ) ( (x) >> ( FT_SIZEOF_LONG * 8 - 1 ) ) -#define FT_SIGN_INT( x ) ( (x) >> ( FT_SIZEOF_INT * 8 - 1 ) ) -#define FT_SIGN_INT32( x ) ( (x) >> 31 ) -#define FT_SIGN_INT16( x ) ( (x) >> 15 ) - - /* documentation is in fttrigon.h */ FT_EXPORT_DEF( void ) @@ -408,8 +400,8 @@ FT_Int32 half = (FT_Int32)1L << ( shift - 1 ); - vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift; - vec->y = ( v.y + half + FT_SIGN_LONG( v.y ) ) >> shift; + vec->x = ( v.x + half - ( v.x < 0 ) ) >> shift; + vec->y = ( v.y + half - ( v.y < 0 ) ) >> shift; } else { diff --git a/src/3rdparty/freetype/src/base/fttype1.c b/src/3rdparty/freetype/src/base/fttype1.c index aa8f8ccbbb..26d4f1c3a8 100644 --- a/src/3rdparty/freetype/src/base/fttype1.c +++ b/src/3rdparty/freetype/src/base/fttype1.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* fttype1.c */ -/* */ -/* FreeType utility file for PS names support (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * fttype1.c + * + * FreeType utility file for PS names support (body). + * + * Copyright (C) 2002-2019 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 diff --git a/src/3rdparty/freetype/src/base/ftutil.c b/src/3rdparty/freetype/src/base/ftutil.c index 4de5f2c145..92bd857e92 100644 --- a/src/3rdparty/freetype/src/base/ftutil.c +++ b/src/3rdparty/freetype/src/base/ftutil.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftutil.c */ -/* */ -/* FreeType utility file for memory and list management (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftutil.c + * + * FreeType utility file for memory and list management (body). + * + * Copyright (C) 2002-2019 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 @@ -23,14 +23,14 @@ #include FT_LIST_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_memory +#define FT_COMPONENT memory /*************************************************************************/ @@ -54,7 +54,7 @@ FT_Error error; FT_Pointer block = ft_mem_qalloc( memory, size, &error ); - if ( !error && size > 0 ) + if ( !error && block && size > 0 ) FT_MEM_ZERO( block, size ); *p_error = error; @@ -101,7 +101,7 @@ block = ft_mem_qrealloc( memory, item_size, cur_count, new_count, block, &error ); - if ( !error && new_count > cur_count ) + if ( !error && block && new_count > cur_count ) FT_MEM_ZERO( (char*)block + cur_count * item_size, ( new_count - cur_count ) * item_size ); @@ -185,7 +185,7 @@ FT_Pointer p = ft_mem_qalloc( memory, (FT_Long)size, &error ); - if ( !error && address ) + if ( !error && address && size > 0 ) ft_memcpy( p, address, size ); *p_error = error; @@ -236,7 +236,7 @@ /*************************************************************************/ #undef FT_COMPONENT -#define FT_COMPONENT trace_list +#define FT_COMPONENT list /* documentation is in ftlist.h */ diff --git a/src/3rdparty/freetype/src/base/ftver.rc b/src/3rdparty/freetype/src/base/ftver.rc index a2903d5883..1354497423 100644 --- a/src/3rdparty/freetype/src/base/ftver.rc +++ b/src/3rdparty/freetype/src/base/ftver.rc @@ -4,7 +4,7 @@ /* */ /* FreeType VERSIONINFO resource for Windows DLLs. */ /* */ -/* Copyright 2018 by */ +/* Copyright (C) 2018-2019 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 -#define FT_VERSION 2,9,1,0 -#define FT_VERSION_STR "2.9.1" +#define FT_VERSION 2,10,1,0 +#define FT_VERSION_STR "2.10.1" VS_VERSION_INFO VERSIONINFO FILEVERSION FT_VERSION @@ -28,7 +28,7 @@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG #endif -#ifdef _DLL +#ifdef DLL_EXPORT FILETYPE VFT_DLL #define FT_FILENAME "freetype.dll" #else @@ -45,7 +45,7 @@ BEGIN VALUE "FileVersion", FT_VERSION_STR VALUE "ProductName", "FreeType" VALUE "ProductVersion", FT_VERSION_STR - VALUE "LegalCopyright", "\251 2018 The FreeType Project www.freetype.org. All rights reserved." + VALUE "LegalCopyright", "\251 2018-2019 The FreeType Project www.freetype.org. All rights reserved." VALUE "InternalName", "freetype" VALUE "OriginalFilename", FT_FILENAME END diff --git a/src/3rdparty/freetype/src/base/ftwinfnt.c b/src/3rdparty/freetype/src/base/ftwinfnt.c index 11bd28afb7..59daa77031 100644 --- a/src/3rdparty/freetype/src/base/ftwinfnt.c +++ b/src/3rdparty/freetype/src/base/ftwinfnt.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftwinfnt.c */ -/* */ -/* FreeType API for accessing Windows FNT specific info (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftwinfnt.c + * + * FreeType API for accessing Windows FNT specific info (body). + * + * Copyright (C) 2003-2019 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 diff --git a/src/3rdparty/freetype/src/base/rules.mk b/src/3rdparty/freetype/src/base/rules.mk index e9805bd068..4b24c6dce7 100644 --- a/src/3rdparty/freetype/src/base/rules.mk +++ b/src/3rdparty/freetype/src/base/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -36,17 +36,17 @@ BASE_COMPILE := $(CC) $(ANSIFLAGS) \ # All files listed here should be included in `ftbase.c' (for a `single' # build). # -BASE_SRC := $(BASE_DIR)/basepic.c \ - $(BASE_DIR)/ftadvanc.c \ +BASE_SRC := $(BASE_DIR)/ftadvanc.c \ $(BASE_DIR)/ftcalc.c \ + $(BASE_DIR)/ftcolor.c \ $(BASE_DIR)/ftdbgmem.c \ + $(BASE_DIR)/fterrors.c \ $(BASE_DIR)/ftfntfmt.c \ $(BASE_DIR)/ftgloadr.c \ $(BASE_DIR)/fthash.c \ $(BASE_DIR)/ftlcdfil.c \ $(BASE_DIR)/ftobjs.c \ $(BASE_DIR)/ftoutln.c \ - $(BASE_DIR)/ftpic.c \ $(BASE_DIR)/ftpsprop.c \ $(BASE_DIR)/ftrfork.c \ $(BASE_DIR)/ftsnames.c \ @@ -60,8 +60,7 @@ ifneq ($(ftmac_c),) endif # for simplicity, we also handle `md5.c' (which gets included by `ftobjs.h') -BASE_H := $(BASE_DIR)/basepic.h \ - $(BASE_DIR)/ftbase.h \ +BASE_H := $(BASE_DIR)/ftbase.h \ $(BASE_DIR)/md5.c \ $(BASE_DIR)/md5.h diff --git a/src/3rdparty/freetype/src/bdf/Jamfile b/src/3rdparty/freetype/src/bdf/Jamfile index d9e441c188..a49c7f5d33 100644 --- a/src/3rdparty/freetype/src/bdf/Jamfile +++ b/src/3rdparty/freetype/src/bdf/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/bdf Jamfile # -# Copyright 2002-2018 by +# Copyright (C) 2002-2019 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/src/3rdparty/freetype/src/bdf/bdf.h b/src/3rdparty/freetype/src/bdf/bdf.h index 9012727c7e..d9abd2378f 100644 --- a/src/3rdparty/freetype/src/bdf/bdf.h +++ b/src/3rdparty/freetype/src/bdf/bdf.h @@ -51,11 +51,11 @@ FT_BEGIN_HEADER /* end of bdfP.h */ - /*************************************************************************/ - /* */ - /* BDF font options macros and types. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * BDF font options macros and types. + * + */ #define BDF_CORRECT_METRICS 0x01 /* Correct invalid metrics when loading. */ @@ -93,11 +93,11 @@ FT_BEGIN_HEADER void* client_data ); - /*************************************************************************/ - /* */ - /* BDF font property macros and types. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * BDF font property macros and types. + * + */ #define BDF_ATOM 1 @@ -109,9 +109,9 @@ FT_BEGIN_HEADER /* There are a set of defaults and each font has their own. */ typedef struct bdf_property_t_ { - char* name; /* Name of the property. */ - int format; /* Format of the property. */ - int builtin; /* A builtin property. */ + const char* name; /* Name of the property. */ + int format; /* Format of the property. */ + int builtin; /* A builtin property. */ union { char* atom; @@ -123,11 +123,11 @@ FT_BEGIN_HEADER } bdf_property_t; - /*************************************************************************/ - /* */ - /* BDF font metric and glyph types. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * BDF font metric and glyph types. + * + */ typedef struct bdf_bbx_t_ @@ -147,7 +147,7 @@ FT_BEGIN_HEADER typedef struct bdf_glyph_t_ { char* name; /* Glyph name. */ - long encoding; /* Glyph encoding. */ + unsigned long encoding; /* Glyph encoding. */ unsigned short swidth; /* Scalable width. */ unsigned short dwidth; /* Device width. */ bdf_bbx_t bbx; /* Glyph bounding box. */ @@ -158,20 +158,6 @@ FT_BEGIN_HEADER } bdf_glyph_t; - typedef struct bdf_glyphlist_t_ - { - unsigned short pad; /* Pad to 4-byte boundary. */ - unsigned short bpp; /* Bits per pixel. */ - long start; /* Beginning encoding value of glyphs. */ - long end; /* Ending encoding value of glyphs. */ - bdf_glyph_t* glyphs; /* Glyphs themselves. */ - unsigned long glyphs_size; /* Glyph structures allocated. */ - unsigned long glyphs_used; /* Glyph structures used. */ - bdf_bbx_t bbx; /* Overall bounding box of glyphs. */ - - } bdf_glyphlist_t; - - typedef struct bdf_font_t_ { char* name; /* Name of the font. */ @@ -185,7 +171,7 @@ FT_BEGIN_HEADER unsigned short monowidth; /* Logical width for monowidth font. */ - long default_char; /* Encoding of the default glyph. */ + unsigned long default_char; /* Encoding of the default glyph. */ long font_ascent; /* Font ascent. */ long font_descent; /* Font descent. */ @@ -205,16 +191,8 @@ FT_BEGIN_HEADER char* comments; /* Font comments. */ unsigned long comments_len; /* Length of comment string. */ - bdf_glyphlist_t overflow; /* Storage used for glyph insertion. */ - void* internal; /* Internal data for the font. */ - /* The size of the next two arrays must be in sync with the */ - /* size of the `have' array in the `bdf_parse_t' structure. */ - unsigned long nmod[34816]; /* Bitmap indicating modified glyphs. */ - unsigned long umod[34816]; /* Bitmap indicating modified */ - /* unencoded glyphs. */ - unsigned short modified; /* Boolean indicating font modified. */ unsigned short bpp; /* Bits per pixel. */ FT_Memory memory; @@ -226,11 +204,11 @@ FT_BEGIN_HEADER } bdf_font_t; - /*************************************************************************/ - /* */ - /* Types for load/save callbacks. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Types for load/save callbacks. + * + */ /* Error codes. */ @@ -247,11 +225,11 @@ FT_BEGIN_HEADER #define BDF_INVALID_LINE -100 - /*************************************************************************/ - /* */ - /* BDF font API. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * BDF font API. + * + */ FT_LOCAL( FT_Error ) bdf_load_font( FT_Stream stream, diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.c b/src/3rdparty/freetype/src/bdf/bdfdrivr.c index ca937f89ce..60eb93305e 100644 --- a/src/3rdparty/freetype/src/bdf/bdfdrivr.c +++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.c @@ -41,14 +41,14 @@ THE SOFTWARE. #include "bdferror.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_bdfdriver +#define FT_COMPONENT bdfdriver typedef struct BDF_CMapRec_ @@ -99,14 +99,17 @@ THE SOFTWARE. min = 0; max = cmap->num_encodings; + mid = ( min + max ) >> 1; while ( min < max ) { FT_ULong code; - mid = ( min + max ) >> 1; - code = (FT_ULong)encodings[mid].enc; + if ( mid >= max || mid < min ) + mid = ( min + max ) >> 1; + + code = encodings[mid].enc; if ( charcode == code ) { @@ -120,6 +123,9 @@ THE SOFTWARE. max = mid; else min = mid + 1; + + /* prediction in a continuous block */ + mid += charcode - code; } return result; @@ -139,14 +145,17 @@ THE SOFTWARE. min = 0; max = cmap->num_encodings; + mid = ( min + max ) >> 1; while ( min < max ) { FT_ULong code; /* same as BDF_encoding_el.enc */ - mid = ( min + max ) >> 1; - code = (FT_ULong)encodings[mid].enc; + if ( mid >= max || mid < min ) + mid = ( min + max ) >> 1; + + code = encodings[mid].enc; if ( charcode == code ) { @@ -160,12 +169,15 @@ THE SOFTWARE. max = mid; else min = mid + 1; + + /* prediction in a continuous block */ + mid += charcode - code; } charcode = 0; if ( min < cmap->num_encodings ) { - charcode = (FT_ULong)encodings[min].enc; + charcode = encodings[min].enc; result = encodings[min].glyph + 1; } @@ -204,13 +216,13 @@ THE SOFTWARE. bdf_font_t* font = bdf->bdffont; bdf_property_t* prop; - char* strings[4] = { NULL, NULL, NULL, NULL }; - size_t nn, len, lengths[4]; + const char* strings[4] = { NULL, NULL, NULL, NULL }; + size_t lengths[4], nn, len; face->style_flags = 0; - prop = bdf_get_font_property( font, (char *)"SLANT" ); + prop = bdf_get_font_property( font, "SLANT" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' || @@ -218,30 +230,30 @@ THE SOFTWARE. { face->style_flags |= FT_STYLE_FLAG_ITALIC; strings[2] = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ) - ? (char *)"Oblique" - : (char *)"Italic"; + ? "Oblique" + : "Italic"; } - prop = bdf_get_font_property( font, (char *)"WEIGHT_NAME" ); + prop = bdf_get_font_property( font, "WEIGHT_NAME" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) ) { face->style_flags |= FT_STYLE_FLAG_BOLD; - strings[1] = (char *)"Bold"; + strings[1] = "Bold"; } - prop = bdf_get_font_property( font, (char *)"SETWIDTH_NAME" ); + prop = bdf_get_font_property( font, "SETWIDTH_NAME" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && *(prop->value.atom) && !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) - strings[3] = (char *)(prop->value.atom); + strings[3] = (const char *)(prop->value.atom); - prop = bdf_get_font_property( font, (char *)"ADD_STYLE_NAME" ); + prop = bdf_get_font_property( font, "ADD_STYLE_NAME" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && *(prop->value.atom) && !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) - strings[0] = (char *)(prop->value.atom); + strings[0] = (const char *)(prop->value.atom); for ( len = 0, nn = 0; nn < 4; nn++ ) { @@ -255,7 +267,7 @@ THE SOFTWARE. if ( len == 0 ) { - strings[0] = (char *)"Regular"; + strings[0] = "Regular"; lengths[0] = ft_strlen( strings[0] ); len = lengths[0] + 1; } @@ -271,7 +283,7 @@ THE SOFTWARE. for ( nn = 0; nn < 4; nn++ ) { - char* src = strings[nn]; + const char* src = strings[nn]; len = lengths[nn]; @@ -401,8 +413,7 @@ THE SOFTWARE. bdfface->face_index = 0; bdfface->face_flags |= FT_FACE_FLAG_FIXED_SIZES | - FT_FACE_FLAG_HORIZONTAL | - FT_FACE_FLAG_FAST_GLYPHS; + FT_FACE_FLAG_HORIZONTAL; prop = bdf_get_font_property( font, "SPACING" ); if ( prop && prop->format == BDF_ATOM && @@ -863,7 +874,7 @@ THE SOFTWARE. /* * - * BDF SERVICE + * BDF SERVICE * */ @@ -939,7 +950,7 @@ THE SOFTWARE. /* * - * SERVICES LIST + * SERVICES LIST * */ diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.h b/src/3rdparty/freetype/src/bdf/bdfdrivr.h index 94550818c1..b37b84ea31 100644 --- a/src/3rdparty/freetype/src/bdf/bdfdrivr.h +++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.h @@ -36,14 +36,10 @@ THE SOFTWARE. FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif - typedef struct BDF_encoding_el_ { - FT_Long enc; + FT_ULong enc; FT_UShort glyph; } BDF_encoding_el; @@ -60,9 +56,6 @@ FT_BEGIN_HEADER BDF_encoding_el* en_table; - FT_CharMap charmap_handle; - FT_CharMapRec charmap; /* a single charmap per face */ - FT_UInt default_glyph; } BDF_FaceRec, *BDF_Face; diff --git a/src/3rdparty/freetype/src/bdf/bdferror.h b/src/3rdparty/freetype/src/bdf/bdferror.h index b462c7d3b5..dbe41c02ab 100644 --- a/src/3rdparty/freetype/src/bdf/bdferror.h +++ b/src/3rdparty/freetype/src/bdf/bdferror.h @@ -20,11 +20,11 @@ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - /*************************************************************************/ - /* */ - /* This file is used to define the BDF error enumeration constants. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * This file is used to define the BDF error enumeration constants. + * + */ #ifndef BDFERROR_H_ #define BDFERROR_H_ diff --git a/src/3rdparty/freetype/src/bdf/bdflib.c b/src/3rdparty/freetype/src/bdf/bdflib.c index 2f5c99d544..63813f7edc 100644 --- a/src/3rdparty/freetype/src/bdf/bdflib.c +++ b/src/3rdparty/freetype/src/bdf/bdflib.c @@ -22,13 +22,13 @@ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - /*************************************************************************/ - /* */ - /* This file is based on bdf.c,v 1.22 2000/03/16 20:08:50 */ - /* */ - /* taken from Mark Leisher's xmbdfed package */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * This file is based on bdf.c,v 1.22 2000/03/16 20:08:50 + * + * taken from Mark Leisher's xmbdfed package + * + */ #include @@ -42,21 +42,21 @@ #include "bdferror.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_bdflib +#define FT_COMPONENT bdflib - /*************************************************************************/ - /* */ - /* Default BDF font options. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Default BDF font options. + * + */ static const bdf_options_t _bdf_opts = @@ -68,100 +68,100 @@ }; - /*************************************************************************/ - /* */ - /* Builtin BDF font properties. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Builtin BDF font properties. + * + */ /* List of most properties that might appear in a font. Doesn't include */ /* the RAW_* and AXIS_* properties in X11R6 polymorphic fonts. */ static const bdf_property_t _bdf_properties[] = { - { (char *)"ADD_STYLE_NAME", BDF_ATOM, 1, { 0 } }, - { (char *)"AVERAGE_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"AVG_CAPITAL_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"AVG_LOWERCASE_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"CAP_HEIGHT", BDF_INTEGER, 1, { 0 } }, - { (char *)"CHARSET_COLLECTIONS", BDF_ATOM, 1, { 0 } }, - { (char *)"CHARSET_ENCODING", BDF_ATOM, 1, { 0 } }, - { (char *)"CHARSET_REGISTRY", BDF_ATOM, 1, { 0 } }, - { (char *)"COMMENT", BDF_ATOM, 1, { 0 } }, - { (char *)"COPYRIGHT", BDF_ATOM, 1, { 0 } }, - { (char *)"DEFAULT_CHAR", BDF_CARDINAL, 1, { 0 } }, - { (char *)"DESTINATION", BDF_CARDINAL, 1, { 0 } }, - { (char *)"DEVICE_FONT_NAME", BDF_ATOM, 1, { 0 } }, - { (char *)"END_SPACE", BDF_INTEGER, 1, { 0 } }, - { (char *)"FACE_NAME", BDF_ATOM, 1, { 0 } }, - { (char *)"FAMILY_NAME", BDF_ATOM, 1, { 0 } }, - { (char *)"FIGURE_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"FONT", BDF_ATOM, 1, { 0 } }, - { (char *)"FONTNAME_REGISTRY", BDF_ATOM, 1, { 0 } }, - { (char *)"FONT_ASCENT", BDF_INTEGER, 1, { 0 } }, - { (char *)"FONT_DESCENT", BDF_INTEGER, 1, { 0 } }, - { (char *)"FOUNDRY", BDF_ATOM, 1, { 0 } }, - { (char *)"FULL_NAME", BDF_ATOM, 1, { 0 } }, - { (char *)"ITALIC_ANGLE", BDF_INTEGER, 1, { 0 } }, - { (char *)"MAX_SPACE", BDF_INTEGER, 1, { 0 } }, - { (char *)"MIN_SPACE", BDF_INTEGER, 1, { 0 } }, - { (char *)"NORM_SPACE", BDF_INTEGER, 1, { 0 } }, - { (char *)"NOTICE", BDF_ATOM, 1, { 0 } }, - { (char *)"PIXEL_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"POINT_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"QUAD_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_ASCENT", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_AVERAGE_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_AVG_CAPITAL_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_AVG_LOWERCASE_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_CAP_HEIGHT", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_DESCENT", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_END_SPACE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_FIGURE_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_MAX_SPACE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_MIN_SPACE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_NORM_SPACE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_PIXEL_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_POINT_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_PIXELSIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_POINTSIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_QUAD_WIDTH", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_SMALL_CAP_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_STRIKEOUT_ASCENT", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_STRIKEOUT_DESCENT", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_SUBSCRIPT_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_SUBSCRIPT_X", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_SUBSCRIPT_Y", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_SUPERSCRIPT_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_SUPERSCRIPT_X", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_SUPERSCRIPT_Y", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_UNDERLINE_POSITION", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_UNDERLINE_THICKNESS", BDF_INTEGER, 1, { 0 } }, - { (char *)"RAW_X_HEIGHT", BDF_INTEGER, 1, { 0 } }, - { (char *)"RELATIVE_SETWIDTH", BDF_CARDINAL, 1, { 0 } }, - { (char *)"RELATIVE_WEIGHT", BDF_CARDINAL, 1, { 0 } }, - { (char *)"RESOLUTION", BDF_INTEGER, 1, { 0 } }, - { (char *)"RESOLUTION_X", BDF_CARDINAL, 1, { 0 } }, - { (char *)"RESOLUTION_Y", BDF_CARDINAL, 1, { 0 } }, - { (char *)"SETWIDTH_NAME", BDF_ATOM, 1, { 0 } }, - { (char *)"SLANT", BDF_ATOM, 1, { 0 } }, - { (char *)"SMALL_CAP_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"SPACING", BDF_ATOM, 1, { 0 } }, - { (char *)"STRIKEOUT_ASCENT", BDF_INTEGER, 1, { 0 } }, - { (char *)"STRIKEOUT_DESCENT", BDF_INTEGER, 1, { 0 } }, - { (char *)"SUBSCRIPT_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"SUBSCRIPT_X", BDF_INTEGER, 1, { 0 } }, - { (char *)"SUBSCRIPT_Y", BDF_INTEGER, 1, { 0 } }, - { (char *)"SUPERSCRIPT_SIZE", BDF_INTEGER, 1, { 0 } }, - { (char *)"SUPERSCRIPT_X", BDF_INTEGER, 1, { 0 } }, - { (char *)"SUPERSCRIPT_Y", BDF_INTEGER, 1, { 0 } }, - { (char *)"UNDERLINE_POSITION", BDF_INTEGER, 1, { 0 } }, - { (char *)"UNDERLINE_THICKNESS", BDF_INTEGER, 1, { 0 } }, - { (char *)"WEIGHT", BDF_CARDINAL, 1, { 0 } }, - { (char *)"WEIGHT_NAME", BDF_ATOM, 1, { 0 } }, - { (char *)"X_HEIGHT", BDF_INTEGER, 1, { 0 } }, - { (char *)"_MULE_BASELINE_OFFSET", BDF_INTEGER, 1, { 0 } }, - { (char *)"_MULE_RELATIVE_COMPOSE", BDF_INTEGER, 1, { 0 } }, + { "ADD_STYLE_NAME", BDF_ATOM, 1, { 0 } }, + { "AVERAGE_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "AVG_CAPITAL_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "AVG_LOWERCASE_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "CAP_HEIGHT", BDF_INTEGER, 1, { 0 } }, + { "CHARSET_COLLECTIONS", BDF_ATOM, 1, { 0 } }, + { "CHARSET_ENCODING", BDF_ATOM, 1, { 0 } }, + { "CHARSET_REGISTRY", BDF_ATOM, 1, { 0 } }, + { "COMMENT", BDF_ATOM, 1, { 0 } }, + { "COPYRIGHT", BDF_ATOM, 1, { 0 } }, + { "DEFAULT_CHAR", BDF_CARDINAL, 1, { 0 } }, + { "DESTINATION", BDF_CARDINAL, 1, { 0 } }, + { "DEVICE_FONT_NAME", BDF_ATOM, 1, { 0 } }, + { "END_SPACE", BDF_INTEGER, 1, { 0 } }, + { "FACE_NAME", BDF_ATOM, 1, { 0 } }, + { "FAMILY_NAME", BDF_ATOM, 1, { 0 } }, + { "FIGURE_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "FONT", BDF_ATOM, 1, { 0 } }, + { "FONTNAME_REGISTRY", BDF_ATOM, 1, { 0 } }, + { "FONT_ASCENT", BDF_INTEGER, 1, { 0 } }, + { "FONT_DESCENT", BDF_INTEGER, 1, { 0 } }, + { "FOUNDRY", BDF_ATOM, 1, { 0 } }, + { "FULL_NAME", BDF_ATOM, 1, { 0 } }, + { "ITALIC_ANGLE", BDF_INTEGER, 1, { 0 } }, + { "MAX_SPACE", BDF_INTEGER, 1, { 0 } }, + { "MIN_SPACE", BDF_INTEGER, 1, { 0 } }, + { "NORM_SPACE", BDF_INTEGER, 1, { 0 } }, + { "NOTICE", BDF_ATOM, 1, { 0 } }, + { "PIXEL_SIZE", BDF_INTEGER, 1, { 0 } }, + { "POINT_SIZE", BDF_INTEGER, 1, { 0 } }, + { "QUAD_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "RAW_ASCENT", BDF_INTEGER, 1, { 0 } }, + { "RAW_AVERAGE_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "RAW_AVG_CAPITAL_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "RAW_AVG_LOWERCASE_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "RAW_CAP_HEIGHT", BDF_INTEGER, 1, { 0 } }, + { "RAW_DESCENT", BDF_INTEGER, 1, { 0 } }, + { "RAW_END_SPACE", BDF_INTEGER, 1, { 0 } }, + { "RAW_FIGURE_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "RAW_MAX_SPACE", BDF_INTEGER, 1, { 0 } }, + { "RAW_MIN_SPACE", BDF_INTEGER, 1, { 0 } }, + { "RAW_NORM_SPACE", BDF_INTEGER, 1, { 0 } }, + { "RAW_PIXEL_SIZE", BDF_INTEGER, 1, { 0 } }, + { "RAW_POINT_SIZE", BDF_INTEGER, 1, { 0 } }, + { "RAW_PIXELSIZE", BDF_INTEGER, 1, { 0 } }, + { "RAW_POINTSIZE", BDF_INTEGER, 1, { 0 } }, + { "RAW_QUAD_WIDTH", BDF_INTEGER, 1, { 0 } }, + { "RAW_SMALL_CAP_SIZE", BDF_INTEGER, 1, { 0 } }, + { "RAW_STRIKEOUT_ASCENT", BDF_INTEGER, 1, { 0 } }, + { "RAW_STRIKEOUT_DESCENT", BDF_INTEGER, 1, { 0 } }, + { "RAW_SUBSCRIPT_SIZE", BDF_INTEGER, 1, { 0 } }, + { "RAW_SUBSCRIPT_X", BDF_INTEGER, 1, { 0 } }, + { "RAW_SUBSCRIPT_Y", BDF_INTEGER, 1, { 0 } }, + { "RAW_SUPERSCRIPT_SIZE", BDF_INTEGER, 1, { 0 } }, + { "RAW_SUPERSCRIPT_X", BDF_INTEGER, 1, { 0 } }, + { "RAW_SUPERSCRIPT_Y", BDF_INTEGER, 1, { 0 } }, + { "RAW_UNDERLINE_POSITION", BDF_INTEGER, 1, { 0 } }, + { "RAW_UNDERLINE_THICKNESS", BDF_INTEGER, 1, { 0 } }, + { "RAW_X_HEIGHT", BDF_INTEGER, 1, { 0 } }, + { "RELATIVE_SETWIDTH", BDF_CARDINAL, 1, { 0 } }, + { "RELATIVE_WEIGHT", BDF_CARDINAL, 1, { 0 } }, + { "RESOLUTION", BDF_INTEGER, 1, { 0 } }, + { "RESOLUTION_X", BDF_CARDINAL, 1, { 0 } }, + { "RESOLUTION_Y", BDF_CARDINAL, 1, { 0 } }, + { "SETWIDTH_NAME", BDF_ATOM, 1, { 0 } }, + { "SLANT", BDF_ATOM, 1, { 0 } }, + { "SMALL_CAP_SIZE", BDF_INTEGER, 1, { 0 } }, + { "SPACING", BDF_ATOM, 1, { 0 } }, + { "STRIKEOUT_ASCENT", BDF_INTEGER, 1, { 0 } }, + { "STRIKEOUT_DESCENT", BDF_INTEGER, 1, { 0 } }, + { "SUBSCRIPT_SIZE", BDF_INTEGER, 1, { 0 } }, + { "SUBSCRIPT_X", BDF_INTEGER, 1, { 0 } }, + { "SUBSCRIPT_Y", BDF_INTEGER, 1, { 0 } }, + { "SUPERSCRIPT_SIZE", BDF_INTEGER, 1, { 0 } }, + { "SUPERSCRIPT_X", BDF_INTEGER, 1, { 0 } }, + { "SUPERSCRIPT_Y", BDF_INTEGER, 1, { 0 } }, + { "UNDERLINE_POSITION", BDF_INTEGER, 1, { 0 } }, + { "UNDERLINE_THICKNESS", BDF_INTEGER, 1, { 0 } }, + { "WEIGHT", BDF_CARDINAL, 1, { 0 } }, + { "WEIGHT_NAME", BDF_ATOM, 1, { 0 } }, + { "X_HEIGHT", BDF_INTEGER, 1, { 0 } }, + { "_MULE_BASELINE_OFFSET", BDF_INTEGER, 1, { 0 } }, + { "_MULE_RELATIVE_COMPOSE", BDF_INTEGER, 1, { 0 } }, }; static const unsigned long @@ -196,11 +196,10 @@ #define ACMSG9 "SWIDTH field missing at line %ld. Set automatically.\n" #define ACMSG10 "DWIDTH field missing at line %ld. Set to glyph width.\n" #define ACMSG11 "SIZE bits per pixel field adjusted to %hd.\n" -#define ACMSG12 "Duplicate encoding %ld (%s) changed to unencoded.\n" -#define ACMSG13 "Glyph %ld extra rows removed.\n" -#define ACMSG14 "Glyph %ld extra columns removed.\n" +#define ACMSG13 "Glyph %lu extra rows removed.\n" +#define ACMSG14 "Glyph %lu extra columns removed.\n" #define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n" -#define ACMSG16 "Glyph %ld missing columns padded with zero bits.\n" +#define ACMSG16 "Glyph %lu missing columns padded with zero bits.\n" #define ACMSG17 "Adjusting number of glyphs to %ld.\n" /* Error messages. */ @@ -219,11 +218,11 @@ #define DBGMSG2 " (0x%lX)\n" - /*************************************************************************/ - /* */ - /* Utility types and functions. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Utility types and functions. + * + */ /* Function type for parsing lines of a BDF font. */ @@ -270,8 +269,6 @@ bdf_font_t* font; bdf_options_t* opts; - unsigned long have[34816]; /* must be in sync with `nmod' and `umod' */ - /* arrays from `bdf_font_t' structure */ _bdf_list_t list; FT_Memory memory; @@ -367,7 +364,7 @@ /* An empty string for empty fields. */ - static const char empty[1] = { 0 }; /* XXX eliminate this */ + static const char empty[] = ""; /* XXX eliminate this */ static char * @@ -410,13 +407,14 @@ static FT_Error _bdf_list_split( _bdf_list_t* list, - char* separators, + const char* separators, char* line, unsigned long linelen ) { unsigned long final_empty; int mult; - char *sp, *ep, *end; + const char *sp, *end; + char *ep; char seps[32]; FT_Error error = FT_Err_Ok; @@ -476,7 +474,7 @@ } /* Assign the field appropriately. */ - list->field[list->used++] = ( ep > sp ) ? sp : (char*)empty; + list->field[list->used++] = ( ep > sp ) ? (char*)sp : (char*)empty; sp = ep; @@ -695,7 +693,7 @@ /* Routine to convert a decimal ASCII string to an unsigned long integer. */ static unsigned long - _bdf_atoul( char* s ) + _bdf_atoul( const char* s ) { unsigned long v; @@ -720,7 +718,7 @@ /* Routine to convert a decimal ASCII string to a signed long integer. */ static long - _bdf_atol( char* s ) + _bdf_atol( const char* s ) { long v, neg; @@ -753,7 +751,7 @@ /* Routine to convert a decimal ASCII string to an unsigned short integer. */ static unsigned short - _bdf_atous( char* s ) + _bdf_atous( const char* s ) { unsigned short v; @@ -778,7 +776,7 @@ /* Routine to convert a decimal ASCII string to a signed short integer. */ static short - _bdf_atos( char* s ) + _bdf_atos( const char* s ) { short v, neg; @@ -831,7 +829,7 @@ static FT_Error - bdf_create_property( char* name, + bdf_create_property( const char* name, int format, bdf_font_t* font ) { @@ -900,11 +898,11 @@ } - /*************************************************************************/ - /* */ - /* BDF font file parsing flags and functions. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * BDF font file parsing flags and functions. + * + */ /* Parse flags. */ @@ -1001,7 +999,7 @@ FT_MEM_COPY( name, font->name, len ); - error = _bdf_list_split( &list, (char *)"-", name, (unsigned long)len ); + error = _bdf_list_split( &list, "-", name, (unsigned long)len ); if ( error ) goto Fail; @@ -1100,7 +1098,7 @@ static FT_Error _bdf_add_property( bdf_font_t* font, - char* name, + const char* name, char* value, unsigned long lineno ) { @@ -1232,7 +1230,7 @@ /* present, and the SPACING property should override the default */ /* spacing. */ if ( _bdf_strncmp( name, "DEFAULT_CHAR", 12 ) == 0 ) - font->default_char = fp->value.l; + font->default_char = fp->value.ul; else if ( _bdf_strncmp( name, "FONT_ASCENT", 11 ) == 0 ) font->font_ascent = fp->value.l; else if ( _bdf_strncmp( name, "FONT_DESCENT", 12 ) == 0 ) @@ -1265,6 +1263,25 @@ }; + static FT_Error + _bdf_parse_end( char* line, + unsigned long linelen, + unsigned long lineno, + void* call_data, + void* client_data ) + { + /* a no-op; we ignore everything after `ENDFONT' */ + + FT_UNUSED( line ); + FT_UNUSED( linelen ); + FT_UNUSED( lineno ); + FT_UNUSED( call_data ); + FT_UNUSED( client_data ); + + return FT_Err_Ok; + } + + /* Actually parse the glyph info and bitmaps. */ static FT_Error _bdf_parse_glyphs( char* line, @@ -1278,6 +1295,7 @@ unsigned char* bp; unsigned long i, slen, nibbles; + _bdf_line_func_t* next; _bdf_parse_t* p; bdf_glyph_t* glyph; bdf_font_t* font; @@ -1285,11 +1303,11 @@ FT_Memory memory; FT_Error error = FT_Err_Ok; - FT_UNUSED( call_data ); FT_UNUSED( lineno ); /* only used in debug mode */ - p = (_bdf_parse_t *)client_data; + next = (_bdf_line_func_t *)call_data; + p = (_bdf_parse_t *) client_data; font = p->font; memory = font->memory; @@ -1319,7 +1337,7 @@ goto Exit; } - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1] ); @@ -1370,6 +1388,7 @@ by_encoding ); p->flags &= ~BDF_START_; + *next = _bdf_parse_end; goto Exit; } @@ -1405,7 +1424,7 @@ /* encoding can be checked for an unencoded character. */ FT_FREE( p->glyph_name ); - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; @@ -1443,7 +1462,7 @@ goto Exit; } - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; @@ -1458,40 +1477,11 @@ if ( p->glyph_enc == -1 && p->list.used > 2 ) p->glyph_enc = _bdf_atol( p->list.field[2] ); - if ( p->glyph_enc < -1 ) + if ( p->glyph_enc < -1 || p->glyph_enc >= 0x110000L ) p->glyph_enc = -1; FT_TRACE4(( DBGMSG2, p->glyph_enc )); - /* Check that the encoding is in the Unicode range because */ - /* otherwise p->have (a bitmap with static size) overflows. */ - if ( p->glyph_enc > 0 && - (size_t)p->glyph_enc >= sizeof ( p->have ) / - sizeof ( unsigned long ) * 32 ) - { - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "ENCODING" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } - - /* Check whether this encoding has already been encountered. */ - /* If it has then change it to unencoded so it gets added if */ - /* indicated. */ - if ( p->glyph_enc >= 0 ) - { - if ( _bdf_glyph_modified( p->have, p->glyph_enc ) ) - { - /* Emit a message saying a glyph has been moved to the */ - /* unencoded area. */ - FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG12, - p->glyph_enc, p->glyph_name )); - p->glyph_enc = -1; - font->modified = 1; - } - else - _bdf_set_glyph_modified( p->have, p->glyph_enc ); - } - if ( p->glyph_enc >= 0 ) { /* Make sure there are enough glyphs allocated in case the */ @@ -1508,7 +1498,7 @@ glyph = font->glyphs + font->glyphs_used++; glyph->name = p->glyph_name; - glyph->encoding = p->glyph_enc; + glyph->encoding = (unsigned long)p->glyph_enc; /* Reset the initial glyph info. */ p->glyph_name = NULL; @@ -1532,7 +1522,7 @@ glyph = font->unencoded + font->unencoded_used; glyph->name = p->glyph_name; - glyph->encoding = (long)font->unencoded_used++; + glyph->encoding = font->unencoded_used++; /* Reset the initial glyph info. */ p->glyph_name = NULL; @@ -1556,6 +1546,9 @@ goto Exit; } + if ( !( p->flags & BDF_ENCODING_ ) ) + goto Missing_Encoding; + /* Point at the glyph being constructed. */ if ( p->glyph_enc == -1 ) glyph = font->unencoded + ( font->unencoded_used - 1 ); @@ -1573,7 +1566,6 @@ { FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG13, glyph->encoding )); p->flags |= BDF_GLYPH_HEIGHT_CHECK_; - font->modified = 1; } goto Exit; @@ -1601,7 +1593,6 @@ { FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding )); p->flags |= BDF_GLYPH_WIDTH_CHECK_; - font->modified = 1; } /* Remove possible garbage at the right. */ @@ -1616,7 +1607,6 @@ { FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); p->flags |= BDF_GLYPH_WIDTH_CHECK_; - font->modified = 1; } p->row++; @@ -1626,10 +1616,7 @@ /* Expect the SWIDTH (scalable width) field next. */ if ( _bdf_strncmp( line, "SWIDTH", 6 ) == 0 ) { - if ( !( p->flags & BDF_ENCODING_ ) ) - goto Missing_Encoding; - - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; @@ -1642,10 +1629,7 @@ /* Expect the DWIDTH (scalable width) field next. */ if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 ) { - if ( !( p->flags & BDF_ENCODING_ ) ) - goto Missing_Encoding; - - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; @@ -1670,10 +1654,7 @@ /* Expect the BBX field next. */ if ( _bdf_strncmp( line, "BBX", 3 ) == 0 ) { - if ( !( p->flags & BDF_ENCODING_ ) ) - goto Missing_Encoding; - - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; @@ -1720,14 +1701,7 @@ { glyph->swidth = sw; - if ( p->glyph_enc == -1 ) - _bdf_set_glyph_modified( font->umod, - font->unencoded_used - 1 ); - else - _bdf_set_glyph_modified( font->nmod, glyph->encoding ); - p->flags |= BDF_SWIDTH_ADJ_; - font->modified = 1; } } @@ -1823,26 +1797,24 @@ { p->font->font_ascent = p->font->bbx.ascent; ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); - error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", + error = _bdf_add_property( p->font, "FONT_ASCENT", nbuf, lineno ); if ( error ) goto Exit; FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent )); - p->font->modified = 1; } if ( bdf_get_font_property( p->font, "FONT_DESCENT" ) == 0 ) { p->font->font_descent = p->font->bbx.descent; ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); - error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", + error = _bdf_add_property( p->font, "FONT_DESCENT", nbuf, lineno ); if ( error ) goto Exit; FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent )); - p->font->modified = 1; } p->flags &= ~BDF_PROPS_; @@ -1875,7 +1847,7 @@ } else { - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; name = p->list.field[0]; @@ -1989,7 +1961,7 @@ if ( error ) goto Exit; p->font->spacing = p->opts->font_spacing; - p->font->default_char = -1; + p->font->default_char = ~0UL; goto Exit; } @@ -2005,7 +1977,7 @@ goto Exit; } - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; @@ -2044,7 +2016,7 @@ goto Exit; } - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; @@ -2067,7 +2039,7 @@ /* The next thing to check for is the FONT field. */ if ( _bdf_strncmp( line, "FONT", 4 ) == 0 ) { - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; _bdf_list_shift( &p->list, 1 ); @@ -2110,7 +2082,7 @@ goto Exit; } - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + error = _bdf_list_split( &p->list, " +", line, linelen ); if ( error ) goto Exit; @@ -2165,7 +2137,7 @@ /* for compiling fonts. */ p->font->font_ascent = p->font->bbx.ascent; ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); - error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", + error = _bdf_add_property( p->font, "FONT_ASCENT", nbuf, lineno ); if ( error ) goto Exit; @@ -2173,14 +2145,12 @@ p->font->font_descent = p->font->bbx.descent; ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); - error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", + error = _bdf_add_property( p->font, "FONT_DESCENT", nbuf, lineno ); if ( error ) goto Exit; FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent )); - p->font->modified = 1; - *next = _bdf_parse_glyphs; /* A special return value. */ @@ -2196,11 +2166,11 @@ } - /*************************************************************************/ - /* */ - /* API. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * API. + * + */ FT_LOCAL_DEF( FT_Error ) @@ -2246,7 +2216,6 @@ { FT_TRACE2(( "bdf_load_font: " ACMSG15, p->cnt, p->font->glyphs_used + p->font->unencoded_used )); - p->font->modified = 1; } /* Once the font has been loaded, adjust the overall font metrics if */ @@ -2259,7 +2228,6 @@ FT_TRACE2(( "bdf_load_font: " ACMSG3, p->font->bbx.width, p->maxrb - p->minlb )); p->font->bbx.width = (unsigned short)( p->maxrb - p->minlb ); - p->font->modified = 1; } if ( p->font->bbx.x_offset != p->minlb ) @@ -2267,7 +2235,6 @@ FT_TRACE2(( "bdf_load_font: " ACMSG4, p->font->bbx.x_offset, p->minlb )); p->font->bbx.x_offset = p->minlb; - p->font->modified = 1; } if ( p->font->bbx.ascent != p->maxas ) @@ -2275,7 +2242,6 @@ FT_TRACE2(( "bdf_load_font: " ACMSG5, p->font->bbx.ascent, p->maxas )); p->font->bbx.ascent = p->maxas; - p->font->modified = 1; } if ( p->font->bbx.descent != p->maxds ) @@ -2284,7 +2250,6 @@ p->font->bbx.descent, p->maxds )); p->font->bbx.descent = p->maxds; p->font->bbx.y_offset = (short)( -p->maxds ); - p->font->modified = 1; } if ( p->maxas + p->maxds != p->font->bbx.height ) @@ -2415,16 +2380,6 @@ FT_FREE( font->glyphs ); FT_FREE( font->unencoded ); - /* Free up the overflow storage if it was used. */ - for ( i = 0, glyphs = font->overflow.glyphs; - i < font->overflow.glyphs_used; i++, glyphs++ ) - { - FT_FREE( glyphs->name ); - FT_FREE( glyphs->bitmap ); - } - - FT_FREE( font->overflow.glyphs ); - /* bdf_cleanup */ ft_hash_str_free( &(font->proptbl), memory ); diff --git a/src/3rdparty/freetype/src/bzip2/Jamfile b/src/3rdparty/freetype/src/bzip2/Jamfile index 3548eab597..4b77916a8d 100644 --- a/src/3rdparty/freetype/src/bzip2/Jamfile +++ b/src/3rdparty/freetype/src/bzip2/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/bzip2 Jamfile # -# Copyright 2010-2018 by +# Copyright (C) 2010-2019 by # Joel Klinghed # # based on `src/lzw/Jamfile' diff --git a/src/3rdparty/freetype/src/bzip2/ftbzip2.c b/src/3rdparty/freetype/src/bzip2/ftbzip2.c index 16019485a9..1fda59b60c 100644 --- a/src/3rdparty/freetype/src/bzip2/ftbzip2.c +++ b/src/3rdparty/freetype/src/bzip2/ftbzip2.c @@ -1,25 +1,25 @@ -/***************************************************************************/ -/* */ -/* ftbzip2.c */ -/* */ -/* FreeType support for .bz2 compressed files. */ -/* */ -/* This optional component relies on libbz2. It should mainly be used to */ -/* parse compressed PCF fonts, as found with many X11 server */ -/* distributions. */ -/* */ -/* Copyright 2010-2018 by */ -/* Joel Klinghed. */ -/* */ -/* based on `src/gzip/ftgzip.c' */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftbzip2.c + * + * FreeType support for .bz2 compressed files. + * + * This optional component relies on libbz2. It should mainly be used to + * parse compressed PCF fonts, as found with many X11 server + * distributions. + * + * Copyright (C) 2010-2019 by + * Joel Klinghed. + * + * based on `src/gzip/ftgzip.c' + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include @@ -43,10 +43,6 @@ #ifdef FT_CONFIG_OPTION_USE_BZIP2 -#ifdef FT_CONFIG_OPTION_PIC -#error "bzip2 code does not support PIC yet" -#endif - #define BZ_NO_STDIO /* Do not need FILE */ #include @@ -475,8 +471,8 @@ memory = source->memory; /* - * check the header right now; this prevents allocating unnecessary - * objects when we don't need them + * check the header right now; this prevents allocating unnecessary + * objects when we don't need them */ error = ft_bzip2_check_header( source ); if ( error ) diff --git a/src/3rdparty/freetype/src/bzip2/rules.mk b/src/3rdparty/freetype/src/bzip2/rules.mk index 95954d7520..f365c1f76d 100644 --- a/src/3rdparty/freetype/src/bzip2/rules.mk +++ b/src/3rdparty/freetype/src/bzip2/rules.mk @@ -2,7 +2,7 @@ # FreeType 2 BZIP2 support configuration rules # -# Copyright 2010-2018 by +# Copyright (C) 2010-2019 by # Joel Klinghed. # # based on `src/lzw/rules.mk' diff --git a/src/3rdparty/freetype/src/cache/Jamfile b/src/3rdparty/freetype/src/cache/Jamfile index 53f4c7b603..51f7196d1b 100644 --- a/src/3rdparty/freetype/src/cache/Jamfile +++ b/src/3rdparty/freetype/src/cache/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cache Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/cache/ftcache.c b/src/3rdparty/freetype/src/cache/ftcache.c index 1b425af911..a6a3e63ef0 100644 --- a/src/3rdparty/freetype/src/cache/ftcache.c +++ b/src/3rdparty/freetype/src/cache/ftcache.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcache.c */ -/* */ -/* The FreeType Caching sub-system (body only). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcache.c + * + * The FreeType Caching sub-system (body only). + * + * Copyright (C) 2000-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT diff --git a/src/3rdparty/freetype/src/cache/ftcbasic.c b/src/3rdparty/freetype/src/cache/ftcbasic.c index 994aa12286..a473585ebc 100644 --- a/src/3rdparty/freetype/src/cache/ftcbasic.c +++ b/src/3rdparty/freetype/src/cache/ftcbasic.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcbasic.c */ -/* */ -/* The FreeType basic cache interface (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcbasic.c + * + * The FreeType basic cache interface (body). + * + * Copyright (C) 2003-2019 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 @@ -27,11 +27,11 @@ #include "ftccback.h" #include "ftcerror.h" -#define FT_COMPONENT trace_cache +#define FT_COMPONENT cache /* - * Basic Families + * Basic Families * */ typedef struct FTC_BasicAttrRec_ diff --git a/src/3rdparty/freetype/src/cache/ftccache.c b/src/3rdparty/freetype/src/cache/ftccache.c index 12ec585a25..f38ca44ddd 100644 --- a/src/3rdparty/freetype/src/cache/ftccache.c +++ b/src/3rdparty/freetype/src/cache/ftccache.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftccache.c */ -/* */ -/* The FreeType internal cache interface (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftccache.c + * + * The FreeType internal cache interface (body). + * + * Copyright (C) 2000-2019 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 @@ -25,7 +25,7 @@ #include "ftcerror.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_cache +#define FT_COMPONENT cache #define FTC_HASH_MAX_LOAD 2 diff --git a/src/3rdparty/freetype/src/cache/ftccache.h b/src/3rdparty/freetype/src/cache/ftccache.h index 859c547e46..140ceadb11 100644 --- a/src/3rdparty/freetype/src/cache/ftccache.h +++ b/src/3rdparty/freetype/src/cache/ftccache.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftccache.h */ -/* */ -/* FreeType internal cache interface (specification). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftccache.h + * + * FreeType internal cache interface (specification). + * + * Copyright (C) 2000-2019 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 FTCCACHE_H_ @@ -42,17 +42,17 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* Each cache controls one or more cache nodes. Each node is part of */ - /* the global_lru list of the manager. Its `data' field however is used */ - /* as a reference count for now. */ - /* */ - /* A node can be anything, depending on the type of information held by */ - /* the cache. It can be an individual glyph image, a set of bitmaps */ - /* glyphs for a given size, some metrics, etc. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Each cache controls one or more cache nodes. Each node is part of + * the global_lru list of the manager. Its `data' field however is used + * as a reference count for now. + * + * A node can be anything, depending on the type of information held by + * the cache. It can be an individual glyph image, a set of bitmaps + * glyphs for a given size, some metrics, etc. + * + */ /* structure size should be 20 bytes on 32-bits machines */ typedef struct FTC_NodeRec_ @@ -302,11 +302,11 @@ FT_BEGIN_HEADER * * Example: * - * { - * FTC_CACHE_TRYLOOP( cache ) - * error = load_data( ... ); - * FTC_CACHE_TRYLOOP_END() - * } + * { + * FTC_CACHE_TRYLOOP( cache ) + * error = load_data( ... ); + * FTC_CACHE_TRYLOOP_END() + * } * */ #define FTC_CACHE_TRYLOOP( cache ) \ diff --git a/src/3rdparty/freetype/src/cache/ftccback.h b/src/3rdparty/freetype/src/cache/ftccback.h index e51d8d6e55..9321bc3d4e 100644 --- a/src/3rdparty/freetype/src/cache/ftccback.h +++ b/src/3rdparty/freetype/src/cache/ftccback.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftccback.h */ -/* */ -/* Callback functions of the caching sub-system (specification only). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftccback.h + * + * Callback functions of the caching sub-system (specification only). + * + * Copyright (C) 2004-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef FTCCBACK_H_ #define FTCCBACK_H_ diff --git a/src/3rdparty/freetype/src/cache/ftccmap.c b/src/3rdparty/freetype/src/cache/ftccmap.c index d20b0f48fe..76ba10e3e9 100644 --- a/src/3rdparty/freetype/src/cache/ftccmap.c +++ b/src/3rdparty/freetype/src/cache/ftccmap.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftccmap.c */ -/* */ -/* FreeType CharMap cache (body) */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftccmap.c + * + * FreeType CharMap cache (body) + * + * Copyright (C) 2000-2019 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 @@ -28,21 +28,21 @@ #include "ftcerror.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_cache - - - /*************************************************************************/ - /* */ - /* Each FTC_CMapNode contains a simple array to map a range of character */ - /* codes to equivalent glyph indices. */ - /* */ - /* For now, the implementation is very basic: Each node maps a range of */ - /* 128 consecutive character codes to their corresponding glyph indices. */ - /* */ - /* We could do more complex things, but I don't think it is really very */ - /* useful. */ - /* */ - /*************************************************************************/ +#define FT_COMPONENT cache + + + /************************************************************************** + * + * Each FTC_CMapNode contains a simple array to map a range of character + * codes to equivalent glyph indices. + * + * For now, the implementation is very basic: Each node maps a range of + * 128 consecutive character codes to their corresponding glyph indices. + * + * We could do more complex things, but I don't think it is really very + * useful. + * + */ /* number of glyph indices / character code per node */ diff --git a/src/3rdparty/freetype/src/cache/ftcerror.h b/src/3rdparty/freetype/src/cache/ftcerror.h index a26cd5935b..e2d6417180 100644 --- a/src/3rdparty/freetype/src/cache/ftcerror.h +++ b/src/3rdparty/freetype/src/cache/ftcerror.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* ftcerror.h */ -/* */ -/* Caching sub-system error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the caching sub-system error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftcerror.h + * + * Caching sub-system error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the caching sub-system error enumeration + * constants. + * + */ #ifndef FTCERROR_H_ #define FTCERROR_H_ diff --git a/src/3rdparty/freetype/src/cache/ftcglyph.c b/src/3rdparty/freetype/src/cache/ftcglyph.c index 782cc0ed09..2a0e97d4af 100644 --- a/src/3rdparty/freetype/src/cache/ftcglyph.c +++ b/src/3rdparty/freetype/src/cache/ftcglyph.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcglyph.c */ -/* */ -/* FreeType Glyph Image (FT_Glyph) cache (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcglyph.c + * + * FreeType Glyph Image (FT_Glyph) cache (body). + * + * Copyright (C) 2000-2019 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 diff --git a/src/3rdparty/freetype/src/cache/ftcglyph.h b/src/3rdparty/freetype/src/cache/ftcglyph.h index 23c24d223f..5a1f0e2a74 100644 --- a/src/3rdparty/freetype/src/cache/ftcglyph.h +++ b/src/3rdparty/freetype/src/cache/ftcglyph.h @@ -1,101 +1,101 @@ -/***************************************************************************/ -/* */ -/* ftcglyph.h */ -/* */ -/* FreeType abstract glyph cache (specification). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcglyph.h + * + * FreeType abstract glyph cache (specification). + * + * Copyright (C) 2000-2019 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. + * + */ /* * - * FTC_GCache is an _abstract_ cache object optimized to store glyph - * data. It works as follows: + * FTC_GCache is an _abstract_ cache object optimized to store glyph + * data. It works as follows: * - * - It manages FTC_GNode objects. Each one of them can hold one or more - * glyph `items'. Item types are not specified in the FTC_GCache but - * in classes that extend it. + * - It manages FTC_GNode objects. Each one of them can hold one or more + * glyph `items'. Item types are not specified in the FTC_GCache but + * in classes that extend it. * - * - Glyph attributes, like face ID, character size, render mode, etc., - * can be grouped into abstract `glyph families'. This avoids storing - * the attributes within the FTC_GCache, since it is likely that many - * FTC_GNodes will belong to the same family in typical uses. + * - Glyph attributes, like face ID, character size, render mode, etc., + * can be grouped into abstract `glyph families'. This avoids storing + * the attributes within the FTC_GCache, since it is likely that many + * FTC_GNodes will belong to the same family in typical uses. * - * - Each FTC_GNode is thus an FTC_Node with two additional fields: + * - Each FTC_GNode is thus an FTC_Node with two additional fields: * - * * gindex: A glyph index, or the first index in a glyph range. - * * family: A pointer to a glyph `family'. + * * gindex: A glyph index, or the first index in a glyph range. + * * family: A pointer to a glyph `family'. * - * - Family types are not fully specific in the FTC_Family type, but - * by classes that extend it. + * - Family types are not fully specific in the FTC_Family type, but + * by classes that extend it. * - * Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache. - * They share an FTC_Family sub-class called FTC_BasicFamily which is - * used to store the following data: face ID, pixel/point sizes, load - * flags. For more details see the file `src/cache/ftcbasic.c'. + * Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache. + * They share an FTC_Family sub-class called FTC_BasicFamily which is + * used to store the following data: face ID, pixel/point sizes, load + * flags. For more details see the file `src/cache/ftcbasic.c'. * - * Client applications can extend FTC_GNode with their own FTC_GNode - * and FTC_Family sub-classes to implement more complex caches (e.g., - * handling automatic synthesis, like obliquing & emboldening, colored - * glyphs, etc.). + * Client applications can extend FTC_GNode with their own FTC_GNode + * and FTC_Family sub-classes to implement more complex caches (e.g., + * handling automatic synthesis, like obliquing & emboldening, colored + * glyphs, etc.). * - * See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and - * `ftcsbits.h', which both extend FTC_GCache with additional - * optimizations. + * See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and + * `ftcsbits.h', which both extend FTC_GCache with additional + * optimizations. * - * A typical FTC_GCache implementation must provide at least the - * following: + * A typical FTC_GCache implementation must provide at least the + * following: * - * - FTC_GNode sub-class, e.g. MyNode, with relevant methods: - * my_node_new (must call FTC_GNode_Init) - * my_node_free (must call FTC_GNode_Done) - * my_node_compare (must call FTC_GNode_Compare) - * my_node_remove_faceid (must call ftc_gnode_unselect in case - * of match) + * - FTC_GNode sub-class, e.g. MyNode, with relevant methods: + * my_node_new (must call FTC_GNode_Init) + * my_node_free (must call FTC_GNode_Done) + * my_node_compare (must call FTC_GNode_Compare) + * my_node_remove_faceid (must call ftc_gnode_unselect in case + * of match) * - * - FTC_Family sub-class, e.g. MyFamily, with relevant methods: - * my_family_compare - * my_family_init - * my_family_reset (optional) - * my_family_done + * - FTC_Family sub-class, e.g. MyFamily, with relevant methods: + * my_family_compare + * my_family_init + * my_family_reset (optional) + * my_family_done * - * - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query - * data. + * - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query + * data. * - * - Constant structures for a FTC_GNodeClass. + * - Constant structures for a FTC_GNodeClass. * - * - MyCacheNew() can be implemented easily as a call to the convenience - * function FTC_GCache_New. + * - MyCacheNew() can be implemented easily as a call to the convenience + * function FTC_GCache_New. * - * - MyCacheLookup with a call to FTC_GCache_Lookup. This function will - * automatically: + * - MyCacheLookup with a call to FTC_GCache_Lookup. This function will + * automatically: * - * - Search for the corresponding family in the cache, or create - * a new one if necessary. Put it in FTC_GQUERY(myquery).family + * - Search for the corresponding family in the cache, or create + * a new one if necessary. Put it in FTC_GQUERY(myquery).family * - * - Call FTC_Cache_Lookup. + * - Call FTC_Cache_Lookup. * - * If it returns NULL, you should create a new node, then call - * ftc_cache_add as usual. + * If it returns NULL, you should create a new node, then call + * ftc_cache_add as usual. */ - /*************************************************************************/ - /* */ - /* Important: The functions defined in this file are only used to */ - /* implement an abstract glyph cache class. You need to */ - /* provide additional logic to implement a complete cache. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Important: The functions defined in this file are only used to + * implement an abstract glyph cache class. You need to + * provide additional logic to implement a complete cache. + * + */ /*************************************************************************/ @@ -125,11 +125,11 @@ FT_BEGIN_HEADER /* - * We can group glyphs into `families'. Each family correspond to a - * given face ID, character size, transform, etc. + * We can group glyphs into `families'. Each family correspond to a + * given face ID, character size, transform, etc. * - * Families are implemented as MRU list nodes. They are - * reference-counted. + * Families are implemented as MRU list nodes. They are + * reference-counted. */ typedef struct FTC_FamilyRec_ @@ -167,12 +167,12 @@ FT_BEGIN_HEADER #define FTC_GQUERY( x ) ( (FTC_GQuery)(x) ) - /*************************************************************************/ - /* */ - /* These functions are exported so that they can be called from */ - /* user-provided cache classes; otherwise, they are really part of the */ - /* cache sub-system internals. */ - /* */ + /************************************************************************** + * + * These functions are exported so that they can be called from + * user-provided cache classes; otherwise, they are really part of the + * cache sub-system internals. + */ /* must be called by derived FTC_Node_InitFunc routines */ FT_LOCAL( void ) diff --git a/src/3rdparty/freetype/src/cache/ftcimage.c b/src/3rdparty/freetype/src/cache/ftcimage.c index 77a100153e..9e64d51a22 100644 --- a/src/3rdparty/freetype/src/cache/ftcimage.c +++ b/src/3rdparty/freetype/src/cache/ftcimage.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcimage.c */ -/* */ -/* FreeType Image cache (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcimage.c + * + * FreeType Image cache (body). + * + * Copyright (C) 2000-2019 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 diff --git a/src/3rdparty/freetype/src/cache/ftcimage.h b/src/3rdparty/freetype/src/cache/ftcimage.h index 24a221053b..dcb101fabc 100644 --- a/src/3rdparty/freetype/src/cache/ftcimage.h +++ b/src/3rdparty/freetype/src/cache/ftcimage.h @@ -1,35 +1,35 @@ -/***************************************************************************/ -/* */ -/* ftcimage.h */ -/* */ -/* FreeType Generic Image cache (specification) */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcimage.h + * + * FreeType Generic Image cache (specification) + * + * Copyright (C) 2000-2019 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. + * + */ /* - * FTC_ICache is an _abstract_ cache used to store a single FT_Glyph - * image per cache node. + * FTC_ICache is an _abstract_ cache used to store a single FT_Glyph + * image per cache node. * - * FTC_ICache extends FTC_GCache. For an implementation example, - * see FTC_ImageCache in `src/cache/ftbasic.c'. + * FTC_ICache extends FTC_GCache. For an implementation example, + * see FTC_ImageCache in `src/cache/ftbasic.c'. */ - /*************************************************************************/ - /* */ - /* Each image cache really manages FT_Glyph objects. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Each image cache really manages FT_Glyph objects. + * + */ #ifndef FTCIMAGE_H_ diff --git a/src/3rdparty/freetype/src/cache/ftcmanag.c b/src/3rdparty/freetype/src/cache/ftcmanag.c index 2bcd9df502..bd585968e3 100644 --- a/src/3rdparty/freetype/src/cache/ftcmanag.c +++ b/src/3rdparty/freetype/src/cache/ftcmanag.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcmanag.c */ -/* */ -/* FreeType Cache Manager (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcmanag.c + * + * FreeType Cache Manager (body). + * + * Copyright (C) 2000-2019 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 @@ -26,13 +26,9 @@ #include "ftccback.h" #include "ftcerror.h" -#ifdef FT_CONFIG_OPTION_PIC -#error "cache system does not support PIC yet" -#endif - #undef FT_COMPONENT -#define FT_COMPONENT trace_cache +#define FT_COMPONENT cache static FT_Error diff --git a/src/3rdparty/freetype/src/cache/ftcmanag.h b/src/3rdparty/freetype/src/cache/ftcmanag.h index b4b4755356..60c66c8fc8 100644 --- a/src/3rdparty/freetype/src/cache/ftcmanag.h +++ b/src/3rdparty/freetype/src/cache/ftcmanag.h @@ -1,47 +1,47 @@ -/***************************************************************************/ -/* */ -/* ftcmanag.h */ -/* */ -/* FreeType Cache Manager (specification). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* A cache manager is in charge of the following: */ - /* */ - /* - Maintain a mapping between generic FTC_FaceIDs and live FT_Face */ - /* objects. The mapping itself is performed through a user-provided */ - /* callback. However, the manager maintains a small cache of FT_Face */ - /* and FT_Size objects in order to speed up things considerably. */ - /* */ - /* - Manage one or more cache objects. Each cache is in charge of */ - /* holding a varying number of `cache nodes'. Each cache node */ - /* represents a minimal amount of individually accessible cached */ - /* data. For example, a cache node can be an FT_Glyph image */ - /* containing a vector outline, or some glyph metrics, or anything */ - /* else. */ - /* */ - /* Each cache node has a certain size in bytes that is added to the */ - /* total amount of `cache memory' within the manager. */ - /* */ - /* All cache nodes are located in a global LRU list, where the oldest */ - /* node is at the tail of the list. */ - /* */ - /* Each node belongs to a single cache, and includes a reference */ - /* count to avoid destroying it (due to caching). */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftcmanag.h + * + * FreeType Cache Manager (specification). + * + * Copyright (C) 2000-2019 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. + * + */ + + + /************************************************************************** + * + * A cache manager is in charge of the following: + * + * - Maintain a mapping between generic FTC_FaceIDs and live FT_Face + * objects. The mapping itself is performed through a user-provided + * callback. However, the manager maintains a small cache of FT_Face + * and FT_Size objects in order to speed up things considerably. + * + * - Manage one or more cache objects. Each cache is in charge of + * holding a varying number of `cache nodes'. Each cache node + * represents a minimal amount of individually accessible cached + * data. For example, a cache node can be an FT_Glyph image + * containing a vector outline, or some glyph metrics, or anything + * else. + * + * Each cache node has a certain size in bytes that is added to the + * total amount of `cache memory' within the manager. + * + * All cache nodes are located in a global LRU list, where the oldest + * node is at the tail of the list. + * + * Each node belongs to a single cache, and includes a reference + * count to avoid destroying it (due to caching). + * + */ /*************************************************************************/ @@ -72,12 +72,12 @@ FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /*
*/ - /* cache_subsystem */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * @Section: + * cache_subsystem + * + */ #define FTC_MAX_FACES_DEFAULT 2 @@ -110,27 +110,28 @@ FT_BEGIN_HEADER } FTC_ManagerRec; - /*************************************************************************/ - /* */ - /* */ - /* FTC_Manager_Compress */ - /* */ - /* */ - /* This function is used to check the state of the cache manager if */ - /* its `num_bytes' field is greater than its `max_bytes' field. It */ - /* will flush as many old cache nodes as possible (ignoring cache */ - /* nodes with a non-zero reference count). */ - /* */ - /* */ - /* manager :: A handle to the cache manager. */ - /* */ - /* */ - /* Client applications should not call this function directly. It is */ - /* normally invoked by specific cache implementations. */ - /* */ - /* The reason this function is exported is to allow client-specific */ - /* cache classes. */ - /* */ + /************************************************************************** + * + * @Function: + * FTC_Manager_Compress + * + * @Description: + * This function is used to check the state of the cache manager if + * its `num_bytes' field is greater than its `max_bytes' field. It + * will flush as many old cache nodes as possible (ignoring cache + * nodes with a non-zero reference count). + * + * @InOut: + * manager :: + * A handle to the cache manager. + * + * @Note: + * Client applications should not call this function directly. It is + * normally invoked by specific cache implementations. + * + * The reason this function is exported is to allow client-specific + * cache classes. + */ FT_LOCAL( void ) FTC_Manager_Compress( FTC_Manager manager ); diff --git a/src/3rdparty/freetype/src/cache/ftcmru.c b/src/3rdparty/freetype/src/cache/ftcmru.c index 1087be4d89..18a7b80054 100644 --- a/src/3rdparty/freetype/src/cache/ftcmru.c +++ b/src/3rdparty/freetype/src/cache/ftcmru.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcmru.c */ -/* */ -/* FreeType MRU support (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcmru.c + * + * FreeType MRU support (body). + * + * Copyright (C) 2003-2019 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 diff --git a/src/3rdparty/freetype/src/cache/ftcmru.h b/src/3rdparty/freetype/src/cache/ftcmru.h index 82396b917d..58721ed340 100644 --- a/src/3rdparty/freetype/src/cache/ftcmru.h +++ b/src/3rdparty/freetype/src/cache/ftcmru.h @@ -1,43 +1,43 @@ -/***************************************************************************/ -/* */ -/* ftcmru.h */ -/* */ -/* Simple MRU list-cache (specification). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* An MRU is a list that cannot hold more than a certain number of */ - /* elements (`max_elements'). All elements in the list are sorted in */ - /* least-recently-used order, i.e., the `oldest' element is at the tail */ - /* of the list. */ - /* */ - /* When doing a lookup (either through `Lookup()' or `Lookup_Node()'), */ - /* the list is searched for an element with the corresponding key. If */ - /* it is found, the element is moved to the head of the list and is */ - /* returned. */ - /* */ - /* If no corresponding element is found, the lookup routine will try to */ - /* obtain a new element with the relevant key. If the list is already */ - /* full, the oldest element from the list is discarded and replaced by a */ - /* new one; a new element is added to the list otherwise. */ - /* */ - /* Note that it is possible to pre-allocate the element list nodes. */ - /* This is handy if `max_elements' is sufficiently small, as it saves */ - /* allocations/releases during the lookup process. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftcmru.h + * + * Simple MRU list-cache (specification). + * + * Copyright (C) 2000-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * An MRU is a list that cannot hold more than a certain number of + * elements (`max_elements'). All elements in the list are sorted in + * least-recently-used order, i.e., the `oldest' element is at the tail + * of the list. + * + * When doing a lookup (either through `Lookup()' or `Lookup_Node()'), + * the list is searched for an element with the corresponding key. If + * it is found, the element is moved to the head of the list and is + * returned. + * + * If no corresponding element is found, the lookup routine will try to + * obtain a new element with the relevant key. If the list is already + * full, the oldest element from the list is discarded and replaced by a + * new one; a new element is added to the list otherwise. + * + * Note that it is possible to pre-allocate the element list nodes. + * This is handy if `max_elements' is sufficiently small, as it saves + * allocations/releases during the lookup process. + * + */ #ifndef FTCMRU_H_ diff --git a/src/3rdparty/freetype/src/cache/ftcsbits.c b/src/3rdparty/freetype/src/cache/ftcsbits.c index 018f1ecdb7..06b46c896e 100644 --- a/src/3rdparty/freetype/src/cache/ftcsbits.c +++ b/src/3rdparty/freetype/src/cache/ftcsbits.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcsbits.c */ -/* */ -/* FreeType sbits manager (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcsbits.c + * + * FreeType sbits manager (body). + * + * Copyright (C) 2000-2019 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 @@ -27,7 +27,7 @@ #include "ftcerror.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_cache +#define FT_COMPONENT cache /*************************************************************************/ @@ -91,14 +91,14 @@ /* - * This function tries to load a small bitmap within a given FTC_SNode. - * Note that it returns a non-zero error code _only_ in the case of - * out-of-memory condition. For all other errors (e.g., corresponding - * to a bad font file), this function will mark the sbit as `unavailable' - * and return a value of 0. + * This function tries to load a small bitmap within a given FTC_SNode. + * Note that it returns a non-zero error code _only_ in the case of + * out-of-memory condition. For all other errors (e.g., corresponding + * to a bad font file), this function will mark the sbit as `unavailable' + * and return a value of 0. * - * You should also read the comment within the @ftc_snode_compare - * function below to see how out-of-memory is handled during a lookup. + * You should also read the comment within the @ftc_snode_compare + * function below to see how out-of-memory is handled during a lookup. */ static FT_Error ftc_snode_load( FTC_SNode snode, @@ -347,34 +347,34 @@ /* - * The following code illustrates what to do when you want to - * perform operations that may fail within a lookup function. + * The following code illustrates what to do when you want to + * perform operations that may fail within a lookup function. * - * Here, we want to load a small bitmap on-demand; we thus - * need to call the `ftc_snode_load' function which may return - * a non-zero error code only when we are out of memory (OOM). + * Here, we want to load a small bitmap on-demand; we thus + * need to call the `ftc_snode_load' function which may return + * a non-zero error code only when we are out of memory (OOM). * - * The correct thing to do is to use @FTC_CACHE_TRYLOOP and - * @FTC_CACHE_TRYLOOP_END in order to implement a retry loop - * that is capable of flushing the cache incrementally when - * an OOM errors occur. + * The correct thing to do is to use @FTC_CACHE_TRYLOOP and + * @FTC_CACHE_TRYLOOP_END in order to implement a retry loop + * that is capable of flushing the cache incrementally when + * an OOM errors occur. * - * However, we need to `lock' the node before this operation to - * prevent it from being flushed within the loop. + * However, we need to `lock' the node before this operation to + * prevent it from being flushed within the loop. * - * When we exit the loop, we unlock the node, then check the `error' - * variable. If it is non-zero, this means that the cache was - * completely flushed and that no usable memory was found to load - * the bitmap. + * When we exit the loop, we unlock the node, then check the `error' + * variable. If it is non-zero, this means that the cache was + * completely flushed and that no usable memory was found to load + * the bitmap. * - * We then prefer to return a value of 0 (i.e., NO MATCH). This - * ensures that the caller will try to allocate a new node. - * This operation consequently _fail_ and the lookup function - * returns the appropriate OOM error code. + * We then prefer to return a value of 0 (i.e., NO MATCH). This + * ensures that the caller will try to allocate a new node. + * This operation consequently _fail_ and the lookup function + * returns the appropriate OOM error code. * - * Note that `buffer == NULL && width == 255' is a hack used to - * tag `unavailable' bitmaps in the array. We should never try - * to load these. + * Note that `buffer == NULL && width == 255' is a hack used to + * tag `unavailable' bitmaps in the array. We should never try + * to load these. * */ diff --git a/src/3rdparty/freetype/src/cache/ftcsbits.h b/src/3rdparty/freetype/src/cache/ftcsbits.h index 206a1bb3fc..f1b71c2835 100644 --- a/src/3rdparty/freetype/src/cache/ftcsbits.h +++ b/src/3rdparty/freetype/src/cache/ftcsbits.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftcsbits.h */ -/* */ -/* A small-bitmap cache (specification). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftcsbits.h + * + * A small-bitmap cache (specification). + * + * Copyright (C) 2000-2019 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 FTCSBITS_H_ diff --git a/src/3rdparty/freetype/src/cache/rules.mk b/src/3rdparty/freetype/src/cache/rules.mk index 558935976d..1618d98303 100644 --- a/src/3rdparty/freetype/src/cache/rules.mk +++ b/src/3rdparty/freetype/src/cache/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2000-2018 by +# Copyright (C) 2000-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -15,7 +15,7 @@ # Cache driver directory # -CACHE_DIR := $(SRC_DIR)/cache +CACHE_DIR := $(SRC_DIR)/cache # compilation flags for the driver diff --git a/src/3rdparty/freetype/src/cff/Jamfile b/src/3rdparty/freetype/src/cff/Jamfile index 53c904fcfe..10f49cef12 100644 --- a/src/3rdparty/freetype/src/cff/Jamfile +++ b/src/3rdparty/freetype/src/cff/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cff Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/cff/cff.c b/src/3rdparty/freetype/src/cff/cff.c index 1a755d5dad..a34ba9b710 100644 --- a/src/3rdparty/freetype/src/cff/cff.c +++ b/src/3rdparty/freetype/src/cff/cff.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cff.c */ -/* */ -/* FreeType OpenType driver component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cff.c + * + * FreeType OpenType driver component (body only). + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT @@ -23,7 +23,6 @@ #include "cffdrivr.c" #include "cffgload.c" #include "cffparse.c" -#include "cffpic.c" #include "cffload.c" #include "cffobjs.c" diff --git a/src/3rdparty/freetype/src/cff/cffcmap.c b/src/3rdparty/freetype/src/cff/cffcmap.c index e45ae1127b..15cc94cafb 100644 --- a/src/3rdparty/freetype/src/cff/cffcmap.c +++ b/src/3rdparty/freetype/src/cff/cffcmap.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffcmap.c */ -/* */ -/* CFF character mapping table (cmap) support (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffcmap.c + * + * CFF character mapping table (cmap) support (body). + * + * Copyright (C) 2002-2019 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 @@ -161,6 +161,9 @@ if ( !charset->sids ) return FT_THROW( No_Unicode_Glyph_Name ); + if ( !psnames->unicodes_init ) + return FT_THROW( Unimplemented_Feature ); + return psnames->unicodes_init( memory, unicodes, cff->num_glyphs, diff --git a/src/3rdparty/freetype/src/cff/cffcmap.h b/src/3rdparty/freetype/src/cff/cffcmap.h index 856a43dd1b..07366bc748 100644 --- a/src/3rdparty/freetype/src/cff/cffcmap.h +++ b/src/3rdparty/freetype/src/cff/cffcmap.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffcmap.h */ -/* */ -/* CFF character mapping table (cmap) support (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffcmap.h + * + * CFF character mapping table (cmap) support (specification). + * + * Copyright (C) 2002-2019 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 CFFCMAP_H_ diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.c b/src/3rdparty/freetype/src/cff/cffdrivr.c index df896848da..2324989811 100644 --- a/src/3rdparty/freetype/src/cff/cffdrivr.c +++ b/src/3rdparty/freetype/src/cff/cffdrivr.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffdrivr.c */ -/* */ -/* OpenType font driver implementation (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffdrivr.c + * + * OpenType font driver implementation (body). + * + * Copyright (C) 1996-2019 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 @@ -42,7 +42,6 @@ #endif #include "cfferrs.h" -#include "cffpic.h" #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_GLYPH_DICT_H @@ -50,14 +49,14 @@ #include FT_DRIVER_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cffdriver +#define FT_COMPONENT cffdriver /*************************************************************************/ @@ -73,38 +72,42 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* cff_get_kerning */ - /* */ - /* */ - /* A driver method used to return the kerning vector between two */ - /* glyphs of the same face. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* left_glyph :: The index of the left glyph in the kern pair. */ - /* */ - /* right_glyph :: The index of the right glyph in the kern pair. */ - /* */ - /* */ - /* kerning :: The kerning vector. This is in font units for */ - /* scalable formats, and in pixels for fixed-sizes */ - /* formats. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Only horizontal layouts (left-to-right & right-to-left) are */ - /* supported by this function. Other layouts, or more sophisticated */ - /* kernings, are out of scope of this method (the basic driver */ - /* interface is meant to be simple). */ - /* */ - /* They can be implemented by format-specific interfaces. */ - /* */ + /************************************************************************** + * + * @Function: + * cff_get_kerning + * + * @Description: + * A driver method used to return the kerning vector between two + * glyphs of the same face. + * + * @Input: + * face :: + * A handle to the source face object. + * + * left_glyph :: + * The index of the left glyph in the kern pair. + * + * right_glyph :: + * The index of the right glyph in the kern pair. + * + * @Output: + * kerning :: + * The kerning vector. This is in font units for + * scalable formats, and in pixels for fixed-sizes + * formats. + * + * @Return: + * FreeType error code. 0 means success. + * + * @Note: + * Only horizontal layouts (left-to-right & right-to-left) are + * supported by this function. Other layouts, or more sophisticated + * kernings, are out of scope of this method (the basic driver + * interface is meant to be simple). + * + * They can be implemented by format-specific interfaces. + */ FT_CALLBACK_DEF( FT_Error ) cff_get_kerning( FT_Face ttface, /* TT_Face */ FT_UInt left_glyph, @@ -125,32 +128,36 @@ } - /*************************************************************************/ - /* */ - /* */ - /* cff_glyph_load */ - /* */ - /* */ - /* A driver method used to load a glyph within a given glyph slot. */ - /* */ - /* */ - /* slot :: A handle to the target slot object where the glyph */ - /* will be loaded. */ - /* */ - /* size :: A handle to the source face size at which the glyph */ - /* must be scaled, loaded, etc. */ - /* */ - /* glyph_index :: The index of the glyph in the font file. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* FT_LOAD_??? constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * cff_glyph_load + * + * @Description: + * A driver method used to load a glyph within a given glyph slot. + * + * @Input: + * slot :: + * A handle to the target slot object where the glyph + * will be loaded. + * + * size :: + * A handle to the source face size at which the glyph + * must be scaled, loaded, etc. + * + * glyph_index :: + * The index of the glyph in the font file. + * + * load_flags :: + * A flag indicating what to load for this glyph. The + * FT_LOAD_??? constants can be used to control the + * glyph loading process (e.g., whether the outline + * should be scaled, whether to load bitmaps or not, + * whether to hint the outline, etc). + * + * @Return: + * FreeType error code. 0 means success. + */ FT_CALLBACK_DEF( FT_Error ) cff_glyph_load( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ FT_Size cffsize, /* CFF_Size */ @@ -302,7 +309,7 @@ /* - * GLYPH DICT SERVICE + * GLYPH DICT SERVICE * */ @@ -341,7 +348,7 @@ FT_ERROR(( "cff_get_glyph_name:" " cannot get glyph name from a CFF2 font\n" " " - " without the `PSNames' module\n" )); + " without the `psnames' module\n" )); error = FT_THROW( Missing_Module ); goto Exit; } @@ -352,7 +359,7 @@ FT_ERROR(( "cff_get_glyph_name:" " cannot get glyph name from CFF & CEF fonts\n" " " - " without the `PSNames' module\n" )); + " without the `psnames' module\n" )); error = FT_THROW( Missing_Module ); goto Exit; } @@ -374,8 +381,8 @@ static FT_UInt - cff_get_name_index( CFF_Face face, - FT_String* glyph_name ) + cff_get_name_index( CFF_Face face, + const FT_String* glyph_name ) { CFF_Font cff; CFF_Charset charset; @@ -408,7 +415,7 @@ FT_ERROR(( "cff_get_name_index:" " cannot get glyph index from a CFF2 font\n" " " - " without the `PSNames' module\n" )); + " without the `psnames' module\n" )); return 0; } } @@ -446,7 +453,7 @@ /* - * POSTSCRIPT INFO SERVICE + * POSTSCRIPT INFO SERVICE * */ @@ -593,7 +600,7 @@ /* - * POSTSCRIPT NAME SERVICE + * POSTSCRIPT NAME SERVICE * */ @@ -654,8 +661,8 @@ FT_Library library = FT_FACE_LIBRARY( face ); - if ( cmap->clazz != &CFF_CMAP_ENCODING_CLASS_REC_GET && - cmap->clazz != &CFF_CMAP_UNICODE_CLASS_REC_GET ) + if ( cmap->clazz != &cff_cmap_encoding_class_rec && + cmap->clazz != &cff_cmap_unicode_class_rec ) { FT_Module sfnt = FT_Get_Module( library, "sfnt" ); FT_Service_TTCMaps service = @@ -682,7 +689,7 @@ /* - * CID INFO SERVICE + * CID INFO SERVICE * */ static FT_Error @@ -788,7 +795,7 @@ goto Fail; } - if ( glyph_index > cff->num_glyphs ) + if ( glyph_index >= cff->num_glyphs ) { error = FT_THROW( Invalid_Argument ); goto Fail; @@ -818,7 +825,7 @@ /* - * PROPERTY SERVICE + * PROPERTY SERVICE * */ @@ -832,7 +839,7 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* - * MULTIPLE MASTER SERVICE + * MULTIPLE MASTER SERVICE * */ @@ -860,6 +867,30 @@ } + static FT_Error + cff_set_mm_weightvector( CFF_Face face, + FT_UInt len, + FT_Fixed* weightvector ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->set_mm_weightvector( FT_FACE( face ), len, weightvector ); + } + + + static FT_Error + cff_get_mm_weightvector( CFF_Face face, + FT_UInt* len, + FT_Fixed* weightvector ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->get_mm_weightvector( FT_FACE( face ), len, weightvector ); + } + + static FT_Error cff_get_mm_var( CFF_Face face, FT_MM_Var* *master ) @@ -909,22 +940,24 @@ FT_DEFINE_SERVICE_MULTIMASTERSREC( cff_service_multi_masters, - (FT_Get_MM_Func) NULL, /* get_mm */ - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ - (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */ - (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */ - (FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */ - (FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */ - (FT_Set_Instance_Func) cff_set_instance, /* set_instance */ - - (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ - (FT_Done_Blend_Func) cff_done_blend /* done_blend */ + (FT_Get_MM_Func) NULL, /* get_mm */ + (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ + (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */ + (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */ + (FT_Set_Var_Design_Func) cff_set_var_design, /* set_var_design */ + (FT_Get_Var_Design_Func) cff_get_var_design, /* get_var_design */ + (FT_Set_Instance_Func) cff_set_instance, /* set_instance */ + (FT_Set_MM_WeightVector_Func)cff_set_mm_weightvector, /* set_mm_weightvector */ + (FT_Get_MM_WeightVector_Func)cff_get_mm_weightvector, /* get_mm_weightvector */ + + (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ + (FT_Done_Blend_Func) cff_done_blend /* done_blend */ ) /* - * METRICS VARIATIONS SERVICE + * METRICS VARIATIONS SERVICE * */ @@ -968,7 +1001,7 @@ /* - * CFFLOAD SERVICE + * CFFLOAD SERVICE * */ @@ -1001,54 +1034,54 @@ cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET, - FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET, - FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, - FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, - FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET + FT_SERVICE_ID_MULTI_MASTERS, &cff_service_multi_masters, + FT_SERVICE_ID_METRICS_VARIATIONS, &cff_service_metrics_variations, + FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name, + FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict, + FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info, + FT_SERVICE_ID_CID, &cff_service_cid_info, + FT_SERVICE_ID_PROPERTIES, &cff_service_properties, + FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load ) #elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES FT_DEFINE_SERVICEDESCREC8( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, - FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, - FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET + FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name, + FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict, + FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info, + FT_SERVICE_ID_CID, &cff_service_cid_info, + FT_SERVICE_ID_PROPERTIES, &cff_service_properties, + FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load ) #elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_DEFINE_SERVICEDESCREC9( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET, - FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET, - FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, - FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET + FT_SERVICE_ID_MULTI_MASTERS, &cff_service_multi_masters, + FT_SERVICE_ID_METRICS_VARIATIONS, &cff_service_metrics_var, + FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name, + FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info, + FT_SERVICE_ID_CID, &cff_service_cid_info, + FT_SERVICE_ID_PROPERTIES, &cff_service_properties, + FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load ) #else FT_DEFINE_SERVICEDESCREC7( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, - FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET + FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name, + FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info, + FT_SERVICE_ID_CID, &cff_service_cid_info, + FT_SERVICE_ID_PROPERTIES, &cff_service_properties, + FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load ) #endif @@ -1062,27 +1095,16 @@ FT_Module_Interface result; - /* CFF_SERVICES_GET dereferences `library' in PIC mode */ -#ifdef FT_CONFIG_OPTION_PIC - if ( !driver ) - return NULL; - library = driver->library; - if ( !library ) - return NULL; -#endif - - result = ft_service_list_lookup( CFF_SERVICES_GET, module_interface ); + result = ft_service_list_lookup( cff_services, module_interface ); if ( result ) return result; - /* `driver' is not yet evaluated in non-PIC mode */ -#ifndef FT_CONFIG_OPTION_PIC + /* `driver' is not yet evaluated */ if ( !driver ) return NULL; library = driver->library; if ( !library ) return NULL; -#endif /* we pass our request to the `sfnt' module */ sfnt = FT_Get_Module( library, "sfnt" ); diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.h b/src/3rdparty/freetype/src/cff/cffdrivr.h index ad7c3ad70a..f2bbcfe4f1 100644 --- a/src/3rdparty/freetype/src/cff/cffdrivr.h +++ b/src/3rdparty/freetype/src/cff/cffdrivr.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffdrivr.h */ -/* */ -/* High-level OpenType driver interface (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffdrivr.h + * + * High-level OpenType driver interface (specification). + * + * Copyright (C) 1996-2019 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 CFFDRIVER_H_ @@ -26,10 +26,8 @@ FT_BEGIN_HEADER - FT_DECLARE_DRIVER( cff_driver_class ) - FT_END_HEADER #endif /* CFFDRIVER_H_ */ diff --git a/src/3rdparty/freetype/src/cff/cfferrs.h b/src/3rdparty/freetype/src/cff/cfferrs.h index b2e1bfaf9d..78d47a156d 100644 --- a/src/3rdparty/freetype/src/cff/cfferrs.h +++ b/src/3rdparty/freetype/src/cff/cfferrs.h @@ -1,26 +1,26 @@ -/***************************************************************************/ -/* */ -/* cfferrs.h */ -/* */ -/* CFF error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the CFF error enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * cfferrs.h + * + * CFF error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the CFF error enumeration constants. + * + */ #ifndef CFFERRS_H_ #define CFFERRS_H_ diff --git a/src/3rdparty/freetype/src/cff/cffgload.c b/src/3rdparty/freetype/src/cff/cffgload.c index c58471ce86..36aa7d1b9c 100644 --- a/src/3rdparty/freetype/src/cff/cffgload.c +++ b/src/3rdparty/freetype/src/cff/cffgload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffgload.c */ -/* */ -/* OpenType Glyph Loader (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffgload.c + * + * OpenType Glyph Loader (body). + * + * Copyright (C) 1996-2019 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 @@ -31,14 +31,14 @@ #include "cfferrs.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cffgload +#define FT_COMPONENT cffgload FT_LOCAL_DEF( FT_Error ) @@ -280,16 +280,16 @@ glyph->root.outline.n_points = 0; glyph->root.outline.n_contours = 0; - glyph->root.metrics.width = (FT_Pos)metrics.width << 6; - glyph->root.metrics.height = (FT_Pos)metrics.height << 6; + glyph->root.metrics.width = (FT_Pos)metrics.width * 64; + glyph->root.metrics.height = (FT_Pos)metrics.height * 64; - glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6; - glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6; - glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6; + glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX * 64; + glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY * 64; + glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance * 64; - glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6; - glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6; - glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6; + glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX * 64; + glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY * 64; + glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance * 64; glyph->root.format = FT_GLYPH_FORMAT_BITMAP; @@ -414,7 +414,7 @@ decoder.width_only = TRUE; decoder.builder.no_recurse = - (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE ); + FT_BOOL( load_flags & FT_LOAD_NO_RECURSE ); /* now load the unscaled outline */ error = cff_get_glyph_data( face, glyph_index, diff --git a/src/3rdparty/freetype/src/cff/cffgload.h b/src/3rdparty/freetype/src/cff/cffgload.h index 803f3974fc..754c55acf9 100644 --- a/src/3rdparty/freetype/src/cff/cffgload.h +++ b/src/3rdparty/freetype/src/cff/cffgload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffgload.h */ -/* */ -/* OpenType Glyph Loader (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffgload.h + * + * OpenType Glyph Loader (specification). + * + * Copyright (C) 1996-2019 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 CFFGLOAD_H_ diff --git a/src/3rdparty/freetype/src/cff/cffload.c b/src/3rdparty/freetype/src/cff/cffload.c index 1c6fe51566..12efd18dc4 100644 --- a/src/3rdparty/freetype/src/cff/cffload.c +++ b/src/3rdparty/freetype/src/cff/cffload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffload.c */ -/* */ -/* OpenType and CFF data/program tables loader (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffload.c + * + * OpenType and CFF data/program tables loader (body). + * + * Copyright (C) 1996-2019 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 @@ -196,14 +196,14 @@ } - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cffload +#define FT_COMPONENT cffload /* read an offset from the index's stream current position */ @@ -1398,7 +1398,14 @@ FT_UInt master; - FT_ASSERT( lenNDV == 0 || NDV ); + /* protect against malformed fonts */ + if ( !( lenNDV == 0 || NDV ) ) + { + FT_TRACE4(( " cff_blend_build_vector:" + " Malformed Normalize Design Vector data\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } blend->builtBV = FALSE; @@ -2080,13 +2087,13 @@ /* * Initialize the random number generator. * - * . If we have a face-specific seed, use it. + * - If we have a face-specific seed, use it. * If non-zero, update it to a positive value. * - * . Otherwise, use the seed from the CFF driver. + * - Otherwise, use the seed from the CFF driver. * If non-zero, update it to a positive value. * - * . If the random value is zero, use the seed given by the subfont's + * - If the random value is zero, use the seed given by the subfont's * `initialRandomSeed' value. * */ diff --git a/src/3rdparty/freetype/src/cff/cffload.h b/src/3rdparty/freetype/src/cff/cffload.h index 14d14e2112..42d2696f33 100644 --- a/src/3rdparty/freetype/src/cff/cffload.h +++ b/src/3rdparty/freetype/src/cff/cffload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffload.h */ -/* */ -/* OpenType & CFF data/program tables loader (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffload.h + * + * OpenType & CFF data/program tables loader (specification). + * + * Copyright (C) 1996-2019 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 CFFLOAD_H_ diff --git a/src/3rdparty/freetype/src/cff/cffobjs.c b/src/3rdparty/freetype/src/cff/cffobjs.c index a2d7aec65e..f76245f30b 100644 --- a/src/3rdparty/freetype/src/cff/cffobjs.c +++ b/src/3rdparty/freetype/src/cff/cffobjs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffobjs.c */ -/* */ -/* OpenType objects manager (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffobjs.c + * + * OpenType objects manager (body). + * + * Copyright (C) 1996-2019 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 @@ -37,7 +37,6 @@ #include "cffobjs.h" #include "cffload.h" #include "cffcmap.h" -#include "cffpic.h" #include "cfferrs.h" @@ -45,21 +44,21 @@ #include FT_SERVICE_CFF_TABLE_LOAD_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cffobjs +#define FT_COMPONENT cffobjs - /*************************************************************************/ - /* */ - /* SIZE FUNCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * SIZE FUNCTIONS + * + */ static PSH_Globals_Funcs @@ -341,11 +340,11 @@ } - /*************************************************************************/ - /* */ - /* SLOT FUNCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * SLOT FUNCTIONS + * + */ FT_LOCAL_DEF( void ) cff_slot_done( FT_GlyphSlot slot ) @@ -383,11 +382,11 @@ } - /*************************************************************************/ - /* */ - /* FACE FUNCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * FACE FUNCTIONS + * + */ static FT_String* cff_strcpy( FT_Memory memory, @@ -645,14 +644,14 @@ dict = &cff->top_font.font_dict; - /* we need the `PSNames' module for CFF and CEF formats */ + /* we need the `psnames' module for CFF and CEF formats */ /* which aren't CID-keyed */ if ( dict->cid_registry == 0xFFFFU && !psnames ) { FT_ERROR(( "cff_face_init:" " cannot open CFF & CEF fonts\n" " " - " without the `PSNames' module\n" )); + " without the `psnames' module\n" )); error = FT_THROW( Missing_Module ); goto Exit; } @@ -963,12 +962,12 @@ cffface->style_name = style_name; else /* assume "Regular" style if we don't know better */ - cffface->style_name = cff_strcpy( memory, (char *)"Regular" ); + cffface->style_name = cff_strcpy( memory, "Regular" ); - /*******************************************************************/ - /* */ - /* Compute face flags. */ - /* */ + /******************************************************************** + * + * Compute face flags. + */ flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */ FT_FACE_FLAG_HORIZONTAL | /* horizontal data */ FT_FACE_FLAG_HINTER; /* has native hinter */ @@ -989,10 +988,10 @@ cffface->face_flags |= flags; - /*******************************************************************/ - /* */ - /* Compute style flags. */ - /* */ + /******************************************************************** + * + * Compute style flags. + */ flags = 0; if ( dict->italic_angle ) @@ -1028,10 +1027,10 @@ if ( dict->cid_registry != 0xFFFFU && pure_cff ) cffface->face_flags |= FT_FACE_FLAG_CID_KEYED; - /*******************************************************************/ - /* */ - /* Compute char maps. */ - /* */ + /******************************************************************** + * + * Compute char maps. + */ /* Try to synthesize a Unicode charmap if there is none available */ /* already. If an OpenType font contains a Unicode "cmap", we */ @@ -1070,10 +1069,11 @@ nn = (FT_UInt)cffface->num_charmaps; - error = FT_CMap_New( &CFF_CMAP_UNICODE_CLASS_REC_GET, NULL, + error = FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL ); if ( error && - FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) && + FT_ERR_NEQ( error, Unimplemented_Feature ) ) goto Exit; error = FT_Err_Ok; @@ -1094,19 +1094,19 @@ { cmaprec.encoding_id = TT_ADOBE_ID_STANDARD; cmaprec.encoding = FT_ENCODING_ADOBE_STANDARD; - clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET; + clazz = &cff_cmap_encoding_class_rec; } else if ( encoding->offset == 1 ) { cmaprec.encoding_id = TT_ADOBE_ID_EXPERT; cmaprec.encoding = FT_ENCODING_ADOBE_EXPERT; - clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET; + clazz = &cff_cmap_encoding_class_rec; } else { cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM; cmaprec.encoding = FT_ENCODING_ADOBE_CUSTOM; - clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET; + clazz = &cff_cmap_encoding_class_rec; } error = FT_CMap_New( clazz, NULL, &cmaprec, NULL ); diff --git a/src/3rdparty/freetype/src/cff/cffobjs.h b/src/3rdparty/freetype/src/cff/cffobjs.h index 616a25b3b5..03bc78a67f 100644 --- a/src/3rdparty/freetype/src/cff/cffobjs.h +++ b/src/3rdparty/freetype/src/cff/cffobjs.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffobjs.h */ -/* */ -/* OpenType objects manager (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffobjs.h + * + * OpenType objects manager (specification). + * + * Copyright (C) 1996-2019 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 CFFOBJS_H_ @@ -51,10 +51,10 @@ FT_BEGIN_HEADER cff_slot_init( FT_GlyphSlot slot ); - /*************************************************************************/ - /* */ - /* Face functions */ - /* */ + /************************************************************************** + * + * Face functions + */ FT_LOCAL( FT_Error ) cff_face_init( FT_Stream stream, FT_Face face, /* CFF_Face */ @@ -66,10 +66,10 @@ FT_BEGIN_HEADER cff_face_done( FT_Face face ); /* CFF_Face */ - /*************************************************************************/ - /* */ - /* Driver functions */ - /* */ + /************************************************************************** + * + * Driver functions + */ FT_LOCAL( FT_Error ) cff_driver_init( FT_Module module ); /* PS_Driver */ diff --git a/src/3rdparty/freetype/src/cff/cffparse.c b/src/3rdparty/freetype/src/cff/cffparse.c index b9611cf548..008752c3ae 100644 --- a/src/3rdparty/freetype/src/cff/cffparse.c +++ b/src/3rdparty/freetype/src/cff/cffparse.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffparse.c */ -/* */ -/* CFF token stream parser (body) */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffparse.c + * + * CFF token stream parser (body) + * + * Copyright (C) 1996-2019 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 @@ -22,20 +22,20 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_LIST_H #include "cfferrs.h" -#include "cffpic.h" #include "cffload.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cffparse +#define FT_COMPONENT cffparse FT_LOCAL_DEF( FT_Error ) @@ -77,6 +77,23 @@ } +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + static void + finalize_t2_strings( FT_Memory memory, + void* data, + void* user ) + { + CFF_T2_String t2 = (CFF_T2_String)data; + + + FT_UNUSED( user ); + + memory->free( memory, t2->start ); + memory->free( memory, data ); + } +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + + FT_LOCAL_DEF( void ) cff_parser_done( CFF_Parser parser ) { @@ -84,13 +101,65 @@ FT_FREE( parser->stack ); + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + FT_List_Finalize( &parser->t2_strings, + finalize_t2_strings, + memory, + NULL ); +#endif + } + + + /* Assuming `first >= last'. */ + + static FT_Error + cff_parser_within_limits( CFF_Parser parser, + FT_Byte* first, + FT_Byte* last ) + { +#ifndef CFF_CONFIG_OPTION_OLD_ENGINE + + /* Fast path for regular FreeType builds with the "new" engine; */ + /* `first >= parser->start' can be assumed. */ + + FT_UNUSED( first ); + + return last < parser->limit ? FT_Err_Ok : FT_THROW( Invalid_Argument ); + +#else /* CFF_CONFIG_OPTION_OLD_ENGINE */ + + FT_ListNode node; + + + if ( first >= parser->start && + last < parser->limit ) + return FT_Err_Ok; + + node = parser->t2_strings.head; + + while ( node ) + { + CFF_T2_String t2 = (CFF_T2_String)node->data; + + + if ( first >= t2->start && + last < t2->limit ) + return FT_Err_Ok; + + node = node->next; + } + + return FT_THROW( Invalid_Argument ); + +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ } /* read an integer */ static FT_Long - cff_parse_integer( FT_Byte* start, - FT_Byte* limit ) + cff_parse_integer( CFF_Parser parser, + FT_Byte* start ) { FT_Byte* p = start; FT_Int v = *p++; @@ -99,14 +168,14 @@ if ( v == 28 ) { - if ( p + 2 > limit ) + if ( cff_parser_within_limits( parser, p, p + 1 ) ) goto Bad; val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] ); } else if ( v == 29 ) { - if ( p + 4 > limit ) + if ( cff_parser_within_limits( parser, p, p + 3 ) ) goto Bad; val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) | @@ -120,14 +189,14 @@ } else if ( v < 251 ) { - if ( p + 1 > limit ) + if ( cff_parser_within_limits( parser, p, p ) ) goto Bad; val = ( v - 247 ) * 256 + p[0] + 108; } else { - if ( p + 1 > limit ) + if ( cff_parser_within_limits( parser, p, p ) ) goto Bad; val = -( v - 251 ) * 256 - p[0] - 108; @@ -176,10 +245,10 @@ /* read a real */ static FT_Fixed - cff_parse_real( FT_Byte* start, - FT_Byte* limit, - FT_Long power_ten, - FT_Long* scaling ) + cff_parse_real( CFF_Parser parser, + FT_Byte* start, + FT_Long power_ten, + FT_Long* scaling ) { FT_Byte* p = start; FT_Int nib; @@ -214,7 +283,7 @@ p++; /* Make sure we don't read past the end. */ - if ( p >= limit ) + if ( cff_parser_within_limits( parser, p, p ) ) goto Bad; } @@ -251,7 +320,7 @@ p++; /* Make sure we don't read past the end. */ - if ( p >= limit ) + if ( cff_parser_within_limits( parser, p, p ) ) goto Bad; } @@ -290,7 +359,7 @@ p++; /* Make sure we don't read past the end. */ - if ( p >= limit ) + if ( cff_parser_within_limits( parser, p, p ) ) goto Bad; } @@ -457,7 +526,7 @@ if ( **d == 30 ) { /* binary-coded decimal is truncated to integer */ - return cff_parse_real( *d, parser->limit, 0, NULL ) >> 16; + return cff_parse_real( parser, *d, 0, NULL ) >> 16; } else if ( **d == 255 ) @@ -483,7 +552,7 @@ } else - return cff_parse_integer( *d, parser->limit ); + return cff_parse_integer( parser, *d ); } @@ -494,10 +563,10 @@ FT_Long scaling ) { if ( **d == 30 ) - return cff_parse_real( *d, parser->limit, scaling, NULL ); + return cff_parse_real( parser, *d, scaling, NULL ); else { - FT_Long val = cff_parse_integer( *d, parser->limit ); + FT_Long val = cff_parse_integer( parser, *d ); if ( scaling ) @@ -562,14 +631,14 @@ FT_ASSERT( scaling ); if ( **d == 30 ) - return cff_parse_real( *d, parser->limit, 0, scaling ); + return cff_parse_real( parser, *d, 0, scaling ); else { FT_Long number; FT_Int integer_length; - number = cff_parse_integer( d[0], d[1] ); + number = cff_parse_integer( parser, d[0] ); if ( number > 0x7FFFL ) { @@ -605,7 +674,6 @@ FT_Vector* offset = &dict->font_offset; FT_ULong* upm = &dict->units_per_em; FT_Byte** data = parser->stack; - FT_Error error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 6 ) @@ -617,8 +685,6 @@ int i; - error = FT_Err_Ok; - dict->has_font_matrix = TRUE; /* We expect a well-formed font matrix, this is, the matrix elements */ @@ -647,22 +713,11 @@ ( max_scaling - min_scaling ) < 0 || ( max_scaling - min_scaling ) > 9 ) { - /* Return default matrix in case of unlikely values. */ - FT_TRACE1(( "cff_parse_font_matrix:" " strange scaling values (minimum %d, maximum %d),\n" " " " using default matrix\n", min_scaling, max_scaling )); - - matrix->xx = 0x10000L; - matrix->yx = 0; - matrix->xy = 0; - matrix->yy = 0x10000L; - offset->x = 0; - offset->y = 0; - *upm = 1; - - goto Exit; + goto Unlikely; } for ( i = 0; i < 6; i++ ) @@ -709,10 +764,31 @@ (double)matrix->yy / *upm / 65536, (double)offset->x / *upm / 65536, (double)offset->y / *upm / 65536 )); + + if ( !FT_Matrix_Check( matrix ) ) + { + FT_TRACE1(( "cff_parse_font_matrix:" + " degenerate values, using default matrix\n" )); + goto Unlikely; + } + + return FT_Err_Ok; } + else + return FT_THROW( Stack_Underflow ); - Exit: - return error; + Unlikely: + /* Return default matrix in case of unlikely values. */ + + matrix->xx = 0x10000L; + matrix->yx = 0; + matrix->xy = 0; + matrix->yy = 0x10000L; + offset->x = 0; + offset->y = 0; + *upm = 1; + + return FT_Err_Ok; } @@ -802,7 +878,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE /* beautify tracing message */ - if ( ft_trace_levels[FT_COMPONENT] < 4 ) + if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] < 4 ) FT_TRACE1(( "Multiple Master CFFs not supported yet," " handling first master design only\n" )); else @@ -1003,9 +1079,6 @@ CFF_FIELD( code, name, id, cff_kind_bool ) -#ifndef FT_CONFIG_OPTION_PIC - - #undef CFF_FIELD #undef CFF_FIELD_DELTA @@ -1118,199 +1191,20 @@ #endif /* FT_DEBUG_LEVEL_TRACE */ -#else /* FT_CONFIG_OPTION_PIC */ - - - void - FT_Destroy_Class_cff_field_handlers( FT_Library library, - CFF_Field_Handler* clazz ) - { - FT_Memory memory = library->memory; - - - if ( clazz ) - FT_FREE( clazz ); - } - - - FT_Error - FT_Create_Class_cff_field_handlers( FT_Library library, - CFF_Field_Handler** output_class ) - { - CFF_Field_Handler* clazz = NULL; - FT_Error error; - FT_Memory memory = library->memory; - - int i = 0; - - -#undef CFF_FIELD -#define CFF_FIELD( code, name, id, kind ) i++; -#undef CFF_FIELD_DELTA -#define CFF_FIELD_DELTA( code, name, max, id ) i++; -#undef CFF_FIELD_CALLBACK -#define CFF_FIELD_CALLBACK( code, name, id ) i++; -#undef CFF_FIELD_BLEND -#define CFF_FIELD_BLEND( code, id ) i++; - -#include "cfftoken.h" - - i++; /* { 0, 0, 0, 0, 0, 0, 0 } */ - - if ( FT_ALLOC( clazz, sizeof ( CFF_Field_Handler ) * i ) ) - return error; - - i = 0; - - -#ifndef FT_DEBUG_LEVEL_TRACE - - -#undef CFF_FIELD_CALLBACK -#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \ - clazz[i].kind = cff_kind_callback; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = 0; \ - clazz[i].size = 0; \ - clazz[i].reader = cff_parse_ ## name_; \ - clazz[i].array_max = 0; \ - clazz[i].count_offset = 0; \ - i++; - -#undef CFF_FIELD -#define CFF_FIELD( code_, name_, id_, kind_ ) \ - clazz[i].kind = kind_; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ - clazz[i].size = FT_FIELD_SIZE( name_ ); \ - clazz[i].reader = 0; \ - clazz[i].array_max = 0; \ - clazz[i].count_offset = 0; \ - i++; \ - -#undef CFF_FIELD_DELTA -#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \ - clazz[i].kind = cff_kind_delta; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ - clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \ - clazz[i].reader = 0; \ - clazz[i].array_max = max_; \ - clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \ - i++; - -#undef CFF_FIELD_BLEND -#define CFF_FIELD_BLEND( code_, id_ ) \ - clazz[i].kind = cff_kind_blend; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = 0; \ - clazz[i].size = 0; \ - clazz[i].reader = cff_parse_blend; \ - clazz[i].array_max = 0; \ - clazz[i].count_offset = 0; \ - i++; - -#include "cfftoken.h" - - clazz[i].kind = 0; - clazz[i].code = 0; - clazz[i].offset = 0; - clazz[i].size = 0; - clazz[i].reader = 0; - clazz[i].array_max = 0; - clazz[i].count_offset = 0; - - -#else /* FT_DEBUG_LEVEL_TRACE */ - - -#undef CFF_FIELD_CALLBACK -#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \ - clazz[i].kind = cff_kind_callback; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = 0; \ - clazz[i].size = 0; \ - clazz[i].reader = cff_parse_ ## name_; \ - clazz[i].array_max = 0; \ - clazz[i].count_offset = 0; \ - clazz[i].id = id_; \ - i++; - -#undef CFF_FIELD -#define CFF_FIELD( code_, name_, id_, kind_ ) \ - clazz[i].kind = kind_; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ - clazz[i].size = FT_FIELD_SIZE( name_ ); \ - clazz[i].reader = 0; \ - clazz[i].array_max = 0; \ - clazz[i].count_offset = 0; \ - clazz[i].id = id_; \ - i++; \ - -#undef CFF_FIELD_DELTA -#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \ - clazz[i].kind = cff_kind_delta; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ - clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \ - clazz[i].reader = 0; \ - clazz[i].array_max = max_; \ - clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \ - clazz[i].id = id_; \ - i++; - -#undef CFF_FIELD_BLEND -#define CFF_FIELD_BLEND( code_, id_ ) \ - clazz[i].kind = cff_kind_blend; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = 0; \ - clazz[i].size = 0; \ - clazz[i].reader = cff_parse_blend; \ - clazz[i].array_max = 0; \ - clazz[i].count_offset = 0; \ - clazz[i].id = id_; \ - i++; - -#include "cfftoken.h" - - clazz[i].kind = 0; - clazz[i].code = 0; - clazz[i].offset = 0; - clazz[i].size = 0; - clazz[i].reader = 0; - clazz[i].array_max = 0; - clazz[i].count_offset = 0; - clazz[i].id = 0; - - -#endif /* FT_DEBUG_LEVEL_TRACE */ - - - *output_class = clazz; - - return FT_Err_Ok; - } - - -#endif /* FT_CONFIG_OPTION_PIC */ - - FT_LOCAL_DEF( FT_Error ) cff_parser_run( CFF_Parser parser, FT_Byte* start, FT_Byte* limit ) { + FT_Byte* p = start; + FT_Error error = FT_Err_Ok; + #ifdef CFF_CONFIG_OPTION_OLD_ENGINE PSAux_Service psaux; -#endif - FT_Byte* p = start; - FT_Error error = FT_Err_Ok; FT_Library library = parser->library; - - FT_UNUSED( library ); - + FT_Memory memory = library->memory; +#endif parser->top = parser->stack; parser->start = start; @@ -1321,6 +1215,7 @@ { FT_UInt v = *p; + /* Opcode 31 is legacy MM T2 operator, not a number. */ /* Opcode 255 is reserved and should not appear in fonts; */ /* it is used internally for CFF2 blends. */ @@ -1369,8 +1264,11 @@ FT_Byte* charstring_base; FT_ULong charstring_len; - FT_Fixed* stack; - FT_Byte* q; + FT_Fixed* stack; + FT_ListNode node; + CFF_T2_String t2; + size_t t2_size; + FT_Byte* q; charstring_base = ++p; @@ -1405,17 +1303,39 @@ error = psaux->cff_decoder_funcs->parse_charstrings_old( &decoder, charstring_base, charstring_len, 1 ); + if ( error ) + goto Exit; /* Now copy the stack data in the temporary decoder object, */ /* converting it back to charstring number representations */ /* (this is ugly, I know). */ - /* */ - /* We overwrite the original top DICT charstring under the */ - /* assumption that the charstring representation of the result */ - /* of `cff_decoder_parse_charstrings' is shorter, which should */ - /* be always true. */ - q = charstring_base - 1; + node = (FT_ListNode)memory->alloc( memory, + sizeof ( FT_ListNodeRec ) ); + if ( !node ) + goto Out_Of_Memory_Error; + + FT_List_Add( &parser->t2_strings, node ); + + t2 = (CFF_T2_String)memory->alloc( memory, + sizeof ( CFF_T2_StringRec ) ); + if ( !t2 ) + goto Out_Of_Memory_Error; + + node->data = t2; + + /* `5' is the conservative upper bound of required bytes per stack */ + /* element. */ + + t2_size = 5 * ( decoder.top - decoder.stack ); + + q = (FT_Byte*)memory->alloc( memory, t2_size ); + if ( !q ) + goto Out_Of_Memory_Error; + + t2->start = q; + t2->limit = q + t2_size; + stack = decoder.stack; while ( stack < decoder.top ) @@ -1431,7 +1351,7 @@ if ( *stack < 0 ) { - num = (FT_ULong)-*stack; + num = (FT_ULong)NEG_LONG( *stack ); neg = 1; } else @@ -1523,7 +1443,7 @@ } code = code | parser->object_code; - for ( field = CFF_FIELD_HANDLERS_GET; field->kind; field++ ) + for ( field = cff_field_handlers; field->kind; field++ ) { if ( field->code == (FT_Int)code ) { @@ -1672,11 +1592,17 @@ parser->top = parser->stack; } p++; - } + } /* while ( p < limit ) */ Exit: return error; +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + Out_Of_Memory_Error: + error = FT_THROW( Out_Of_Memory ); + goto Exit; +#endif + Stack_Overflow: error = FT_THROW( Invalid_Argument ); goto Exit; diff --git a/src/3rdparty/freetype/src/cff/cffparse.h b/src/3rdparty/freetype/src/cff/cffparse.h index 8a8caeca44..4e74709a2d 100644 --- a/src/3rdparty/freetype/src/cff/cffparse.h +++ b/src/3rdparty/freetype/src/cff/cffparse.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffparse.h */ -/* */ -/* CFF token stream parser (specification) */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffparse.h + * + * CFF token stream parser (specification) + * + * Copyright (C) 1996-2019 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 CFFPARSE_H_ @@ -33,11 +33,11 @@ FT_BEGIN_HEADER #define CFF_MAX_STACK_DEPTH 96 /* - * There are plans to remove the `maxstack' operator in a forthcoming - * revision of the CFF2 specification, increasing the (then static) stack - * size to 513. By making the default stack size equal to the maximum - * stack size, the operator is essentially disabled, which has the - * desired effect in FreeType. + * There are plans to remove the `maxstack' operator in a forthcoming + * revision of the CFF2 specification, increasing the (then static) stack + * size to 513. By making the default stack size equal to the maximum + * stack size, the operator is essentially disabled, which has the + * desired effect in FreeType. */ #define CFF2_MAX_STACK 513 #define CFF2_DEFAULT_STACK 513 @@ -60,6 +60,10 @@ FT_BEGIN_HEADER FT_Byte** top; FT_UInt stackSize; /* allocated size */ +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + FT_ListRec t2_strings; +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + FT_UInt object_code; void* object; @@ -130,6 +134,15 @@ FT_BEGIN_HEADER FT_END_HEADER +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + typedef struct CFF_T2_String_ + { + FT_Byte* start; + FT_Byte* limit; + + } CFF_T2_StringRec, *CFF_T2_String; +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + #endif /* CFFPARSE_H_ */ diff --git a/src/3rdparty/freetype/src/cff/cfftoken.h b/src/3rdparty/freetype/src/cff/cfftoken.h index fec1ca20bd..063a7b3be0 100644 --- a/src/3rdparty/freetype/src/cff/cfftoken.h +++ b/src/3rdparty/freetype/src/cff/cfftoken.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cfftoken.h */ -/* */ -/* CFF token definitions (specification only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cfftoken.h + * + * CFF token definitions (specification only). + * + * Copyright (C) 1996-2019 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. + * + */ #undef FT_STRUCTURE diff --git a/src/3rdparty/freetype/src/cff/module.mk b/src/3rdparty/freetype/src/cff/module.mk index 8013d5dcab..8c610959d3 100644 --- a/src/3rdparty/freetype/src/cff/module.mk +++ b/src/3rdparty/freetype/src/cff/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/cff/rules.mk b/src/3rdparty/freetype/src/cff/rules.mk index bce672927e..6e2dc476ef 100644 --- a/src/3rdparty/freetype/src/cff/rules.mk +++ b/src/3rdparty/freetype/src/cff/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -31,8 +31,7 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ $(CFF_DIR)/cffgload.c \ $(CFF_DIR)/cffload.c \ $(CFF_DIR)/cffobjs.c \ - $(CFF_DIR)/cffparse.c \ - $(CFF_DIR)/cffpic.c + $(CFF_DIR)/cffparse.c # CFF driver headers diff --git a/src/3rdparty/freetype/src/cid/Jamfile b/src/3rdparty/freetype/src/cid/Jamfile index 1c232fda3f..1cfb702574 100644 --- a/src/3rdparty/freetype/src/cid/Jamfile +++ b/src/3rdparty/freetype/src/cid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cid Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/cid/ciderrs.h b/src/3rdparty/freetype/src/cid/ciderrs.h index a5a86e3fc6..be80bed3be 100644 --- a/src/3rdparty/freetype/src/cid/ciderrs.h +++ b/src/3rdparty/freetype/src/cid/ciderrs.h @@ -1,26 +1,26 @@ -/***************************************************************************/ -/* */ -/* ciderrs.h */ -/* */ -/* CID error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the CID error enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ciderrs.h + * + * CID error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the CID error enumeration constants. + * + */ #ifndef CIDERRS_H_ #define CIDERRS_H_ diff --git a/src/3rdparty/freetype/src/cid/cidgload.c b/src/3rdparty/freetype/src/cid/cidgload.c index d14f9a2cc9..f59f2880f0 100644 --- a/src/3rdparty/freetype/src/cid/cidgload.c +++ b/src/3rdparty/freetype/src/cid/cidgload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidgload.c */ -/* */ -/* CID-keyed Type1 Glyph Loader (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidgload.c + * + * CID-keyed Type1 Glyph Loader (body). + * + * Copyright (C) 1996-2019 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 @@ -31,14 +31,14 @@ #include "ciderrs.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cidgload +#define FT_COMPONENT cidgload FT_CALLBACK_DEF( FT_Error ) @@ -393,8 +393,7 @@ must_finish_decoder = TRUE; /* set up the decoder */ - decoder.builder.no_recurse = FT_BOOL( - ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) ); + decoder.builder.no_recurse = FT_BOOL( load_flags & FT_LOAD_NO_RECURSE ); error = cid_load_glyph( &decoder, glyph_index ); if ( error ) diff --git a/src/3rdparty/freetype/src/cid/cidgload.h b/src/3rdparty/freetype/src/cid/cidgload.h index 4811852ae4..37eba7ca7b 100644 --- a/src/3rdparty/freetype/src/cid/cidgload.h +++ b/src/3rdparty/freetype/src/cid/cidgload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidgload.h */ -/* */ -/* OpenType Glyph Loader (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidgload.h + * + * OpenType Glyph Loader (specification). + * + * Copyright (C) 1996-2019 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 CIDGLOAD_H_ diff --git a/src/3rdparty/freetype/src/cid/cidload.c b/src/3rdparty/freetype/src/cid/cidload.c index 27cd09b3c3..fce3e37da7 100644 --- a/src/3rdparty/freetype/src/cid/cidload.c +++ b/src/3rdparty/freetype/src/cid/cidload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidload.c */ -/* */ -/* CID-keyed Type1 font loader (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidload.c + * + * CID-keyed Type1 font loader (body). + * + * Copyright (C) 1996-2019 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 @@ -21,20 +21,21 @@ #include FT_CONFIG_CONFIG_H #include FT_MULTIPLE_MASTERS_H #include FT_INTERNAL_TYPE1_TYPES_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #include "cidload.h" #include "ciderrs.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cidload +#define FT_COMPONENT cidload /* read a single offset */ @@ -81,6 +82,8 @@ /* if the keyword has a dedicated callback, call it */ if ( keyword->type == T1_FIELD_TYPE_CALLBACK ) { + FT_TRACE4(( " %s", keyword->ident )); + keyword->reader( (FT_Face)face, parser ); error = parser->root.error; goto Exit; @@ -131,6 +134,8 @@ } } + FT_TRACE4(( " %s", keyword->ident )); + dummy_object = object; /* now, load the keyword data in the object's field(s) */ @@ -141,12 +146,15 @@ else error = cid_parser_load_field( &loader->parser, keyword, &dummy_object ); + + FT_TRACE4(( "\n" )); + Exit: return error; } - FT_CALLBACK_DEF( FT_Error ) + FT_CALLBACK_DEF( void ) cid_parse_font_matrix( CID_Face face, CID_Parser* parser ) { @@ -171,14 +179,25 @@ result = cid_parser_to_fixed_array( parser, 6, temp, 3 ); if ( result < 6 ) - return FT_THROW( Invalid_File_Format ); + { + FT_ERROR(( "cid_parse_font_matrix: not enough matrix elements\n" )); + goto Exit; + } + + FT_TRACE4(( " [%f %f %f %f %f %f]\n", + (double)temp[0] / 65536 / 1000, + (double)temp[1] / 65536 / 1000, + (double)temp[2] / 65536 / 1000, + (double)temp[3] / 65536 / 1000, + (double)temp[4] / 65536 / 1000, + (double)temp[5] / 65536 / 1000 )); temp_scale = FT_ABS( temp[3] ); if ( temp_scale == 0 ) { FT_ERROR(( "cid_parse_font_matrix: invalid font matrix\n" )); - return FT_THROW( Invalid_File_Format ); + goto Exit; } /* atypical case */ @@ -200,16 +219,24 @@ matrix->xy = temp[2]; matrix->yy = temp[3]; + if ( !FT_Matrix_Check( matrix ) ) + { + FT_ERROR(( "t1_parse_font_matrix: invalid font matrix\n" )); + parser->root.error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + /* note that the font offsets are expressed in integer font units */ offset->x = temp[4] >> 16; offset->y = temp[5] >> 16; } - return FT_Err_Ok; + Exit: + return; } - FT_CALLBACK_DEF( FT_Error ) + FT_CALLBACK_DEF( void ) parse_fd_array( CID_Face face, CID_Parser* parser ) { @@ -224,10 +251,11 @@ if ( num_dicts < 0 ) { FT_ERROR(( "parse_fd_array: invalid number of dictionaries\n" )); - error = FT_THROW( Invalid_File_Format ); goto Exit; } + FT_TRACE4(( " %d\n", num_dicts )); + /* * A single entry in the FDArray must (at least) contain the following * structure elements. @@ -263,27 +291,31 @@ cid->num_dicts = num_dicts; - /* don't forget to set a few defaults */ + /* set some default values (the same as for Type 1 fonts) */ for ( n = 0; n < cid->num_dicts; n++ ) { CID_FaceDict dict = cid->font_dicts + n; - /* default value for lenIV */ - dict->private_dict.lenIV = 4; + dict->private_dict.blue_shift = 7; + dict->private_dict.blue_fuzz = 1; + dict->private_dict.lenIV = 4; + dict->private_dict.expansion_factor = (FT_Fixed)( 0.06 * 0x10000L ); + dict->private_dict.blue_scale = (FT_Fixed)( + 0.039625 * 0x10000L * 1000 ); } } Exit: - return error; + return; } - /* by mistake, `expansion_factor' appears both in PS_PrivateRec */ + /* By mistake, `expansion_factor' appears both in PS_PrivateRec */ /* and CID_FaceDictRec (both are public header files and can't */ - /* changed); we simply copy the value */ + /* changed). We simply copy the value. */ - FT_CALLBACK_DEF( FT_Error ) + FT_CALLBACK_DEF( void ) parse_expansion_factor( CID_Face face, CID_Parser* parser ) { @@ -296,9 +328,43 @@ dict->expansion_factor = cid_parser_to_fixed( parser, 0 ); dict->private_dict.expansion_factor = dict->expansion_factor; + + FT_TRACE4(( "%d\n", dict->expansion_factor )); + } + + return; + } + + + /* By mistake, `CID_FaceDictRec' doesn't contain a field for the */ + /* `FontName' keyword. FreeType doesn't need it, but it is nice */ + /* to catch it for producing better trace output. */ + + FT_CALLBACK_DEF( void ) + parse_font_name( CID_Face face, + CID_Parser* parser ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) + { + T1_TokenRec token; + FT_UInt len; + + + cid_parser_to_token( parser, &token ); + + len = (FT_UInt)( token.limit - token.start ); + if ( len ) + FT_TRACE4(( " %.*s\n", len, token.start )); + else + FT_TRACE4(( " \n" )); } +#else + FT_UNUSED( face ); + FT_UNUSED( parser ); +#endif - return FT_Err_Ok; + return; } @@ -311,6 +377,7 @@ T1_FIELD_CALLBACK( "FDArray", parse_fd_array, 0 ) T1_FIELD_CALLBACK( "FontMatrix", cid_parse_font_matrix, 0 ) T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 ) + T1_FIELD_CALLBACK( "FontName", parse_font_name, 0 ) { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 } }; @@ -356,7 +423,16 @@ /* if /FDArray was found, then cid->num_dicts is > 0, and */ /* we can start increasing parser->num_dict */ if ( face->cid.num_dicts > 0 ) + { parser->num_dict++; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( " FontDict %d", parser->num_dict )); + if ( parser->num_dict > face->cid.num_dicts ) + FT_TRACE4(( " (ignored)" )); + FT_TRACE4(( "\n" )); +#endif + } } } @@ -757,7 +833,7 @@ if ( cid->fd_bytes < 0 || cid->gd_bytes < 1 ) { - FT_ERROR(( "cid_parse_dict:" + FT_ERROR(( "cid_face_open:" " Invalid `FDBytes' or `GDBytes' value\n" )); error = FT_THROW( Invalid_File_Format ); goto Exit; @@ -766,7 +842,7 @@ /* allow at most 32bit offsets */ if ( cid->fd_bytes > 4 || cid->gd_bytes > 4 ) { - FT_ERROR(( "cid_parse_dict:" + FT_ERROR(( "cid_face_open:" " Values of `FDBytes' or `GDBytes' larger than 4\n" " " " are not supported\n" )); @@ -782,17 +858,36 @@ CID_FaceDict dict = cid->font_dicts + n; + /* the upper limits are ad-hoc values */ + if ( dict->private_dict.blue_shift > 1000 || + dict->private_dict.blue_shift < 0 ) + { + FT_TRACE2(( "cid_face_open:" + " setting unlikely BlueShift value %d to default (7)\n", + dict->private_dict.blue_shift )); + dict->private_dict.blue_shift = 7; + } + + if ( dict->private_dict.blue_fuzz > 1000 || + dict->private_dict.blue_fuzz < 0 ) + { + FT_TRACE2(( "cid_face_open:" + " setting unlikely BlueFuzz value %d to default (1)\n", + dict->private_dict.blue_fuzz )); + dict->private_dict.blue_fuzz = 1; + } + if ( dict->sd_bytes < 0 || ( dict->num_subrs && dict->sd_bytes < 1 ) ) { - FT_ERROR(( "cid_parse_dict: Invalid `SDBytes' value\n" )); + FT_ERROR(( "cid_face_open: Invalid `SDBytes' value\n" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } if ( dict->sd_bytes > 4 ) { - FT_ERROR(( "cid_parse_dict:" + FT_ERROR(( "cid_face_open:" " Values of `SDBytes' larger than 4" " are not supported\n" )); error = FT_THROW( Invalid_File_Format ); @@ -801,7 +896,7 @@ if ( dict->subrmap_offset > binary_length ) { - FT_ERROR(( "cid_parse_dict: Invalid `SubrMapOffset' value\n" )); + FT_ERROR(( "cid_face_open: Invalid `SubrMapOffset' value\n" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -812,7 +907,7 @@ dict->num_subrs > ( binary_length - dict->subrmap_offset ) / (FT_UInt)dict->sd_bytes ) ) { - FT_ERROR(( "cid_parse_dict: Invalid `SubrCount' value\n" )); + FT_ERROR(( "cid_face_open: Invalid `SubrCount' value\n" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -820,7 +915,7 @@ if ( cid->cidmap_offset > binary_length ) { - FT_ERROR(( "cid_parse_dict: Invalid `CIDMapOffset' value\n" )); + FT_ERROR(( "cid_face_open: Invalid `CIDMapOffset' value\n" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -829,7 +924,7 @@ cid->cid_count > ( binary_length - cid->cidmap_offset ) / entry_len ) { - FT_ERROR(( "cid_parse_dict: Invalid `CIDCount' value\n" )); + FT_ERROR(( "cid_face_open: Invalid `CIDCount' value\n" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } diff --git a/src/3rdparty/freetype/src/cid/cidload.h b/src/3rdparty/freetype/src/cid/cidload.h index 3f8bd08620..fb9d46216d 100644 --- a/src/3rdparty/freetype/src/cid/cidload.h +++ b/src/3rdparty/freetype/src/cid/cidload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidload.h */ -/* */ -/* CID-keyed Type1 font loader (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidload.h + * + * CID-keyed Type1 font loader (specification). + * + * Copyright (C) 1996-2019 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 CIDLOAD_H_ diff --git a/src/3rdparty/freetype/src/cid/cidobjs.c b/src/3rdparty/freetype/src/cid/cidobjs.c index 77afe1c875..4e9728719b 100644 --- a/src/3rdparty/freetype/src/cid/cidobjs.c +++ b/src/3rdparty/freetype/src/cid/cidobjs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidobjs.c */ -/* */ -/* CID objects manager (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidobjs.c + * + * CID objects manager (body). + * + * Copyright (C) 1996-2019 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 @@ -31,21 +31,21 @@ #include "ciderrs.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cidobjs +#define FT_COMPONENT cidobjs - /*************************************************************************/ - /* */ - /* SLOT FUNCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * SLOT FUNCTIONS + * + */ FT_LOCAL_DEF( void ) cid_slot_done( FT_GlyphSlot slot ) @@ -85,11 +85,11 @@ } - /*************************************************************************/ - /* */ - /* SIZE FUNCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * SIZE FUNCTIONS + * + */ static PSH_Globals_Funcs @@ -174,23 +174,24 @@ } - /*************************************************************************/ - /* */ - /* FACE FUNCTIONS */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* */ - /* cid_face_done */ - /* */ - /* */ - /* Finalizes a given face object. */ - /* */ - /* */ - /* face :: A pointer to the face object to destroy. */ - /* */ + /************************************************************************** + * + * FACE FUNCTIONS + * + */ + + /************************************************************************** + * + * @Function: + * cid_face_done + * + * @Description: + * Finalizes a given face object. + * + * @Input: + * face :: + * A pointer to the face object to destroy. + */ FT_LOCAL_DEF( void ) cid_face_done( FT_Face cidface ) /* CID_Face */ { @@ -252,29 +253,34 @@ } - /*************************************************************************/ - /* */ - /* */ - /* cid_face_init */ - /* */ - /* */ - /* Initializes a given CID face object. */ - /* */ - /* */ - /* stream :: The source font stream. */ - /* */ - /* face_index :: The index of the font face in the resource. */ - /* */ - /* num_params :: Number of additional generic parameters. Ignored. */ - /* */ - /* params :: Additional generic parameters. Ignored. */ - /* */ - /* */ - /* face :: The newly built face object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * cid_face_init + * + * @Description: + * Initializes a given CID face object. + * + * @Input: + * stream :: + * The source font stream. + * + * face_index :: + * The index of the font face in the resource. + * + * num_params :: + * Number of additional generic parameters. Ignored. + * + * params :: + * Additional generic parameters. Ignored. + * + * @InOut: + * face :: + * The newly built face object. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) cid_face_init( FT_Stream stream, FT_Face cidface, /* CID_Face */ @@ -449,20 +455,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* cid_driver_init */ - /* */ - /* */ - /* Initializes a given CID driver object. */ - /* */ - /* */ - /* driver :: A handle to the target driver object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * cid_driver_init + * + * @Description: + * Initializes a given CID driver object. + * + * @Input: + * driver :: + * A handle to the target driver object. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) cid_driver_init( FT_Module module ) { @@ -505,17 +512,18 @@ } - /*************************************************************************/ - /* */ - /* */ - /* cid_driver_done */ - /* */ - /* */ - /* Finalizes a given CID driver. */ - /* */ - /* */ - /* driver :: A handle to the target CID driver. */ - /* */ + /************************************************************************** + * + * @Function: + * cid_driver_done + * + * @Description: + * Finalizes a given CID driver. + * + * @Input: + * driver :: + * A handle to the target CID driver. + */ FT_LOCAL_DEF( void ) cid_driver_done( FT_Module driver ) { diff --git a/src/3rdparty/freetype/src/cid/cidobjs.h b/src/3rdparty/freetype/src/cid/cidobjs.h index 0221f017dd..89c9aa74ab 100644 --- a/src/3rdparty/freetype/src/cid/cidobjs.h +++ b/src/3rdparty/freetype/src/cid/cidobjs.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidobjs.h */ -/* */ -/* CID objects manager (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidobjs.h + * + * CID objects manager (specification). + * + * Copyright (C) 1996-2019 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 CIDOBJS_H_ @@ -34,60 +34,60 @@ FT_BEGIN_HEADER typedef struct CID_Glyph_Hints_ CID_Glyph_Hints; - /*************************************************************************/ - /* */ - /* */ - /* CID_Driver */ - /* */ - /* */ - /* A handle to a Type 1 driver object. */ - /* */ + /************************************************************************** + * + * @Type: + * CID_Driver + * + * @Description: + * A handle to a Type 1 driver object. + */ typedef struct CID_DriverRec_* CID_Driver; - /*************************************************************************/ - /* */ - /* */ - /* CID_Size */ - /* */ - /* */ - /* A handle to a Type 1 size object. */ - /* */ + /************************************************************************** + * + * @Type: + * CID_Size + * + * @Description: + * A handle to a Type 1 size object. + */ typedef struct CID_SizeRec_* CID_Size; - /*************************************************************************/ - /* */ - /* */ - /* CID_GlyphSlot */ - /* */ - /* */ - /* A handle to a Type 1 glyph slot object. */ - /* */ + /************************************************************************** + * + * @Type: + * CID_GlyphSlot + * + * @Description: + * A handle to a Type 1 glyph slot object. + */ typedef struct CID_GlyphSlotRec_* CID_GlyphSlot; - /*************************************************************************/ - /* */ - /* */ - /* CID_CharMap */ - /* */ - /* */ - /* A handle to a Type 1 character mapping object. */ - /* */ - /* */ - /* The Type 1 format doesn't use a charmap but an encoding table. */ - /* The driver is responsible for making up charmap objects */ - /* corresponding to these tables. */ - /* */ + /************************************************************************** + * + * @Type: + * CID_CharMap + * + * @Description: + * A handle to a Type 1 character mapping object. + * + * @Note: + * The Type 1 format doesn't use a charmap but an encoding table. + * The driver is responsible for making up charmap objects + * corresponding to these tables. + */ typedef struct CID_CharMapRec_* CID_CharMap; - /*************************************************************************/ - /* */ - /* HERE BEGINS THE TYPE 1 SPECIFIC STUFF */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * HERE BEGINS THE TYPE 1 SPECIFIC STUFF + * + */ typedef struct CID_SizeRec_ diff --git a/src/3rdparty/freetype/src/cid/cidparse.c b/src/3rdparty/freetype/src/cid/cidparse.c index b1c7f3cb2c..1be46ec328 100644 --- a/src/3rdparty/freetype/src/cid/cidparse.c +++ b/src/3rdparty/freetype/src/cid/cidparse.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidparse.c */ -/* */ -/* CID-keyed Type1 parser (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidparse.c + * + * CID-keyed Type1 parser (body). + * + * Copyright (C) 1996-2019 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 @@ -26,14 +26,14 @@ #include "ciderrs.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cidparse +#define FT_COMPONENT cidparse /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/cid/cidparse.h b/src/3rdparty/freetype/src/cid/cidparse.h index 61602f7674..ec1f6a346d 100644 --- a/src/3rdparty/freetype/src/cid/cidparse.h +++ b/src/3rdparty/freetype/src/cid/cidparse.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidparse.h */ -/* */ -/* CID-keyed Type1 parser (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidparse.h + * + * CID-keyed Type1 parser (specification). + * + * Copyright (C) 1996-2019 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 CIDPARSE_H_ @@ -29,35 +29,43 @@ FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* */ - /* CID_Parser */ - /* */ - /* */ - /* A CID_Parser is an object used to parse a Type 1 fonts very */ - /* quickly. */ - /* */ - /* */ - /* root :: The root PS_ParserRec fields. */ - /* */ - /* stream :: The current input stream. */ - /* */ - /* postscript :: A pointer to the data to be parsed. */ - /* */ - /* postscript_len :: The length of the data to be parsed. */ - /* */ - /* data_offset :: The start position of the binary data (i.e., the */ - /* end of the data to be parsed. */ - /* */ - /* binary_length :: The length of the data after the `StartData' */ - /* command if the data format is hexadecimal. */ - /* */ - /* cid :: A structure which holds the information about */ - /* the current font. */ - /* */ - /* num_dict :: The number of font dictionaries. */ - /* */ + /************************************************************************** + * + * @Struct: + * CID_Parser + * + * @Description: + * A CID_Parser is an object used to parse a Type 1 fonts very + * quickly. + * + * @Fields: + * root :: + * The root PS_ParserRec fields. + * + * stream :: + * The current input stream. + * + * postscript :: + * A pointer to the data to be parsed. + * + * postscript_len :: + * The length of the data to be parsed. + * + * data_offset :: + * The start position of the binary data (i.e., the + * end of the data to be parsed. + * + * binary_length :: + * The length of the data after the `StartData' + * command if the data format is hexadecimal. + * + * cid :: + * A structure which holds the information about + * the current font. + * + * num_dict :: + * The number of font dictionaries. + */ typedef struct CID_Parser_ { PS_ParserRec root; @@ -86,11 +94,11 @@ FT_BEGIN_HEADER cid_parser_done( CID_Parser* parser ); - /*************************************************************************/ - /* */ - /* PARSING ROUTINES */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * PARSING ROUTINES + * + */ #define cid_parser_skip_spaces( p ) \ (p)->root.funcs.skip_spaces( &(p)->root ) diff --git a/src/3rdparty/freetype/src/cid/cidriver.c b/src/3rdparty/freetype/src/cid/cidriver.c index d9faf353ea..4d91e87529 100644 --- a/src/3rdparty/freetype/src/cid/cidriver.c +++ b/src/3rdparty/freetype/src/cid/cidriver.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidriver.c */ -/* */ -/* CID driver interface (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidriver.c + * + * CID driver interface (body). + * + * Copyright (C) 1996-2019 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 @@ -34,18 +34,18 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ciddriver +#define FT_COMPONENT ciddriver /* - * POSTSCRIPT NAME SERVICE + * POSTSCRIPT NAME SERVICE * */ @@ -69,7 +69,7 @@ /* - * POSTSCRIPT INFO SERVICE + * POSTSCRIPT INFO SERVICE * */ @@ -105,7 +105,7 @@ /* - * CID INFO SERVICE + * CID INFO SERVICE * */ static FT_Error @@ -173,7 +173,7 @@ /* - * PROPERTY SERVICE + * PROPERTY SERVICE * */ @@ -185,7 +185,7 @@ /* - * SERVICE LIST + * SERVICE LIST * */ diff --git a/src/3rdparty/freetype/src/cid/cidriver.h b/src/3rdparty/freetype/src/cid/cidriver.h index 59d9ded901..3402fd7e99 100644 --- a/src/3rdparty/freetype/src/cid/cidriver.h +++ b/src/3rdparty/freetype/src/cid/cidriver.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidriver.h */ -/* */ -/* High-level CID driver interface (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidriver.h + * + * High-level CID driver interface (specification). + * + * Copyright (C) 1996-2019 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 CIDRIVER_H_ @@ -26,15 +26,9 @@ FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif - - FT_CALLBACK_TABLE const FT_Driver_ClassRec t1cid_driver_class; - FT_END_HEADER #endif /* CIDRIVER_H_ */ diff --git a/src/3rdparty/freetype/src/cid/cidtoken.h b/src/3rdparty/freetype/src/cid/cidtoken.h index b0e2dac6aa..f505c9e166 100644 --- a/src/3rdparty/freetype/src/cid/cidtoken.h +++ b/src/3rdparty/freetype/src/cid/cidtoken.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cidtoken.h */ -/* */ -/* CID token definitions (specification only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cidtoken.h + * + * CID token definitions (specification only). + * + * Copyright (C) 1996-2019 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. + * + */ #undef FT_STRUCTURE @@ -21,17 +21,20 @@ #undef T1CODE #define T1CODE T1_FIELD_LOCATION_CID_INFO - T1_FIELD_KEY ( "CIDFontName", cid_font_name, 0 ) - T1_FIELD_FIXED ( "CIDFontVersion", cid_version, 0 ) - T1_FIELD_NUM ( "CIDFontType", cid_font_type, 0 ) - T1_FIELD_STRING( "Registry", registry, 0 ) - T1_FIELD_STRING( "Ordering", ordering, 0 ) - T1_FIELD_NUM ( "Supplement", supplement, 0 ) - T1_FIELD_NUM ( "UIDBase", uid_base, 0 ) - T1_FIELD_NUM ( "CIDMapOffset", cidmap_offset, 0 ) - T1_FIELD_NUM ( "FDBytes", fd_bytes, 0 ) - T1_FIELD_NUM ( "GDBytes", gd_bytes, 0 ) - T1_FIELD_NUM ( "CIDCount", cid_count, 0 ) + T1_FIELD_KEY ( "CIDFontName", cid_font_name, 0 ) + T1_FIELD_FIXED ( "CIDFontVersion", cid_version, 0 ) + T1_FIELD_NUM ( "CIDFontType", cid_font_type, 0 ) + T1_FIELD_STRING ( "Registry", registry, 0 ) + T1_FIELD_STRING ( "Ordering", ordering, 0 ) + T1_FIELD_NUM ( "Supplement", supplement, 0 ) + T1_FIELD_NUM ( "UIDBase", uid_base, 0 ) + + T1_FIELD_NUM_TABLE( "XUID", xuid, 16, 0 ) + + T1_FIELD_NUM ( "CIDMapOffset", cidmap_offset, 0 ) + T1_FIELD_NUM ( "FDBytes", fd_bytes, 0 ) + T1_FIELD_NUM ( "GDBytes", gd_bytes, 0 ) + T1_FIELD_NUM ( "CIDCount", cid_count, 0 ) #undef FT_STRUCTURE diff --git a/src/3rdparty/freetype/src/cid/module.mk b/src/3rdparty/freetype/src/cid/module.mk index 9010e339a4..875c683c72 100644 --- a/src/3rdparty/freetype/src/cid/module.mk +++ b/src/3rdparty/freetype/src/cid/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/cid/rules.mk b/src/3rdparty/freetype/src/cid/rules.mk index 94333bda06..2b68dd48a0 100644 --- a/src/3rdparty/freetype/src/cid/rules.mk +++ b/src/3rdparty/freetype/src/cid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/cid/type1cid.c b/src/3rdparty/freetype/src/cid/type1cid.c index 61770e3f1e..d21801cec1 100644 --- a/src/3rdparty/freetype/src/cid/type1cid.c +++ b/src/3rdparty/freetype/src/cid/type1cid.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* type1cid.c */ -/* */ -/* FreeType OpenType driver component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * type1cid.c + * + * FreeType OpenType driver component (body only). + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT diff --git a/src/3rdparty/freetype/src/gxvalid/Jamfile b/src/3rdparty/freetype/src/gxvalid/Jamfile index 74f3c51ff0..a08e7a998d 100644 --- a/src/3rdparty/freetype/src/gxvalid/Jamfile +++ b/src/3rdparty/freetype/src/gxvalid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/gxvalid Jamfile # -# Copyright 2005-2018 by +# Copyright (C) 2005-2019 by # suzuki toshiya, Masatake YAMATO and Red Hat K.K. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/3rdparty/freetype/src/gxvalid/README b/src/3rdparty/freetype/src/gxvalid/README index af8128e0e7..d493587842 100644 --- a/src/3rdparty/freetype/src/gxvalid/README +++ b/src/3rdparty/freetype/src/gxvalid/README @@ -518,7 +518,7 @@ gxvalid: TrueType GX validator ------------------------------------------------------------------------ -Copyright 2004-2018 by +Copyright (C) 2004-2019 by suzuki toshiya, Masatake YAMATO, Red hat K.K., David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/src/3rdparty/freetype/src/gxvalid/gxvalid.c b/src/3rdparty/freetype/src/gxvalid/gxvalid.c index d0577a247e..462e461bf2 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvalid.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvalid.c @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* gxvalid.c */ -/* */ -/* FreeType validator for TrueTypeGX/AAT tables (body only). */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvalid.c + * + * FreeType validator for TrueTypeGX/AAT tables (body only). + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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 diff --git a/src/3rdparty/freetype/src/gxvalid/gxvalid.h b/src/3rdparty/freetype/src/gxvalid/gxvalid.h index 19f0379982..969cd0927a 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvalid.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvalid.h @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* gxvalid.h */ -/* */ -/* TrueTypeGX/AAT table validation (specification only). */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvalid.h + * + * TrueTypeGX/AAT table validation (specification only). + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #ifndef GXVALID_H_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvbsln.c b/src/3rdparty/freetype/src/gxvalid/gxvbsln.c index c367d38483..f22f2545fa 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvbsln.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvbsln.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvbsln.c */ -/* */ -/* TrueTypeGX/AAT bsln table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvbsln.c + * + * TrueTypeGX/AAT bsln table validation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvalid.h" #include "gxvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvbsln +#define FT_COMPONENT gxvbsln /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvcommn.c b/src/3rdparty/freetype/src/gxvalid/gxvcommn.c index b96601108b..c5cb8ebe8b 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvcommn.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvcommn.c @@ -1,41 +1,41 @@ -/***************************************************************************/ -/* */ -/* gxvcommn.c */ -/* */ -/* TrueTypeGX/AAT common tables validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvcommn.c + * + * TrueTypeGX/AAT common tables validation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvcommon +#define FT_COMPONENT gxvcommon /*************************************************************************/ @@ -384,8 +384,8 @@ ( P += 2, gxv_lookup_value_load( P - 2, SIGNSPEC ) ) static GXV_LookupValueDesc - gxv_lookup_value_load( FT_Bytes p, - int signspec ) + gxv_lookup_value_load( FT_Bytes p, + GXV_LookupValue_SignSpec signspec ) { GXV_LookupValueDesc v; diff --git a/src/3rdparty/freetype/src/gxvalid/gxvcommn.h b/src/3rdparty/freetype/src/gxvalid/gxvcommn.h index 8e4ff9cafc..334dc9dfb3 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvcommn.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvcommn.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* gxvcommn.h */ -/* */ -/* TrueTypeGX/AAT common tables validation (specification). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvcommn.h + * + * TrueTypeGX/AAT common tables validation (specification). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ /* * keywords in variable naming * --------------------------- - * table: Of type FT_Bytes, pointing to the start of this table/subtable. - * limit: Of type FT_Bytes, pointing to the end of this table/subtable, + * table: Of type FT_Bytes, pointing to the start of this table/subtable. + * limit: Of type FT_Bytes, pointing to the end of this table/subtable, * including padding for alignment. - * offset: Of type FT_UInt, the number of octets from the start to target. - * length: Of type FT_UInt, the number of octets from the start to the - * end in this table/subtable, including padding for alignment. + * offset: Of type FT_UInt, the number of octets from the start to target. + * length: Of type FT_UInt, the number of octets from the start to the + * end in this table/subtable, including padding for alignment. * * _MIN, _MAX: Should be added to the tail of macros, as INT_MIN, etc. */ diff --git a/src/3rdparty/freetype/src/gxvalid/gxverror.h b/src/3rdparty/freetype/src/gxvalid/gxverror.h index d1151258a9..da0edb35f9 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxverror.h +++ b/src/3rdparty/freetype/src/gxvalid/gxverror.h @@ -1,36 +1,36 @@ -/***************************************************************************/ -/* */ -/* gxverror.h */ -/* */ -/* TrueTypeGX/AAT validation module error codes (specification only). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the OpenType validation module error */ - /* enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * gxverror.h + * + * TrueTypeGX/AAT validation module error codes (specification only). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ + + + /************************************************************************** + * + * This file is used to define the OpenType validation module error + * enumeration constants. + * + */ #ifndef GXVERROR_H_ #define GXVERROR_H_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvfeat.c b/src/3rdparty/freetype/src/gxvalid/gxvfeat.c index 2c805d1d11..e1a12a18ed 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvfeat.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvfeat.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* gxvfeat.c */ -/* */ -/* TrueTypeGX/AAT feat table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvfeat.c + * + * TrueTypeGX/AAT feat table validation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvalid.h" @@ -30,14 +30,14 @@ #include "gxvfeat.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvfeat +#define FT_COMPONENT gxvfeat /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvfeat.h b/src/3rdparty/freetype/src/gxvalid/gxvfeat.h index 2d943806c1..6c9892910c 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvfeat.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvfeat.h @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* gxvfeat.h */ -/* */ -/* TrueTypeGX/AAT feat table validation (specification). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvfeat.h + * + * TrueTypeGX/AAT feat table validation (specification). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #ifndef GXVFEAT_H_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvfgen.c b/src/3rdparty/freetype/src/gxvalid/gxvfgen.c index 840c0f3524..5ecb9443c3 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvfgen.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvfgen.c @@ -1,62 +1,62 @@ -/***************************************************************************/ -/* */ -/* gxfgen.c */ -/* */ -/* Generate feature registry data for gxv `feat' validator. */ -/* This program is derived from gxfeatreg.c in gxlayout. */ -/* */ -/* Copyright 2004-2018 by */ -/* Masatake YAMATO and Redhat K.K. */ -/* */ -/* This file 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxfgen.c + * + * Generate feature registry data for gxv `feat' validator. + * This program is derived from gxfeatreg.c in gxlayout. + * + * Copyright (C) 2004-2019 by + * Masatake YAMATO and Redhat K.K. + * + * This file 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. + * + */ -/***************************************************************************/ -/* */ -/* gxfeatreg.c */ -/* */ -/* Database of font features pre-defined by Apple Computer, Inc. */ -/* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html */ -/* (body). */ -/* */ -/* Copyright 2003 by */ -/* Masatake YAMATO and Redhat K.K. */ -/* */ -/* This file 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxfeatreg.c + * + * Database of font features pre-defined by Apple Computer, Inc. + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html + * (body). + * + * Copyright 2003 by + * Masatake YAMATO and Redhat K.K. + * + * This file may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ -/***************************************************************************/ -/* */ -/* Development of gxfeatreg.c is supported by */ -/* Information-technology Promotion Agency, Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * Development of gxfeatreg.c is supported by + * Information-technology Promotion Agency, Japan. + * + */ -/***************************************************************************/ -/* */ -/* This file is compiled as a stand-alone executable. */ -/* This file is never compiled into `libfreetype2'. */ -/* The output of this file is used in `gxvfeat.c'. */ -/* ----------------------------------------------------------------------- */ -/* Compile: gcc `pkg-config --cflags freetype2` gxvfgen.c -o gxvfgen */ -/* Run: ./gxvfgen > tmp.c */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * This file is compiled as a stand-alone executable. + * This file is never compiled into `libfreetype2'. + * The output of this file is used in `gxvfeat.c'. + * ----------------------------------------------------------------------- + * Compile: gcc `pkg-config --cflags freetype2` gxvfgen.c -o gxvfgen + * Run: ./gxvfgen > tmp.c + * + */ - /*******************************************************************/ - /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */ - /*******************************************************************/ + /******************************************************************** + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ /* * If you add a new setting to a feature, check the number of settings @@ -65,9 +65,9 @@ */ #define FEATREG_MAX_SETTING 12 - /*******************************************************************/ - /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */ - /*******************************************************************/ + /******************************************************************** + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ #include diff --git a/src/3rdparty/freetype/src/gxvalid/gxvjust.c b/src/3rdparty/freetype/src/gxvalid/gxvjust.c index 00c4293195..a582377859 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvjust.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvjust.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* gxvjust.c */ -/* */ -/* TrueTypeGX/AAT just table validation (body). */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvjust.c + * + * TrueTypeGX/AAT just table validation (body). + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvalid.h" @@ -31,14 +31,14 @@ #include FT_SFNT_NAMES_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvjust +#define FT_COMPONENT gxvjust /* * referred `just' table format specification: @@ -72,6 +72,8 @@ const FT_String* msg_tag, GXV_Validator gxvalid ) { + FT_UNUSED( msg_tag ); + if ( gid < gxvalid->face->num_glyphs ) return; diff --git a/src/3rdparty/freetype/src/gxvalid/gxvkern.c b/src/3rdparty/freetype/src/gxvalid/gxvkern.c index 9c0efd7a4f..a7532335a5 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvkern.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvkern.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* gxvkern.c */ -/* */ -/* TrueTypeGX/AAT kern table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvkern.c + * + * TrueTypeGX/AAT kern table validation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvalid.h" @@ -32,14 +32,14 @@ #include FT_SERVICE_GX_VALIDATE_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvkern +#define FT_COMPONENT gxvkern /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvlcar.c b/src/3rdparty/freetype/src/gxvalid/gxvlcar.c index 0f261a9ace..13b3de3eaa 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvlcar.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvlcar.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvlcar.c */ -/* */ -/* TrueTypeGX/AAT lcar table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvlcar.c + * + * TrueTypeGX/AAT lcar table validation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvalid.h" #include "gxvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvlcar +#define FT_COMPONENT gxvlcar /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmod.c b/src/3rdparty/freetype/src/gxvalid/gxvmod.c index 1a3c862927..eeadeb3e1d 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmod.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmod.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* gxvmod.c */ -/* */ -/* FreeType's TrueTypeGX/AAT validation module implementation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmod.c + * + * FreeType's TrueTypeGX/AAT validation module implementation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include @@ -37,14 +37,14 @@ #include "gxvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmodule +#define FT_COMPONENT gxvmodule static FT_Error diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmod.h b/src/3rdparty/freetype/src/gxvalid/gxvmod.h index 745c62e105..6ecd7312c9 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmod.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvmod.h @@ -1,29 +1,29 @@ -/***************************************************************************/ -/* */ -/* gxvmod.h */ -/* */ -/* FreeType's TrueTypeGX/AAT validation module implementation */ -/* (specification). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmod.h + * + * FreeType's TrueTypeGX/AAT validation module implementation + * (specification). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #ifndef GXVMOD_H_ @@ -35,10 +35,6 @@ FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif - FT_EXPORT_VAR( const FT_Module_Class ) gxv_module_class; diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort.c b/src/3rdparty/freetype/src/gxvalid/gxvmort.c index b361cb2b9d..288ef6988b 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmort.c */ -/* */ -/* TrueTypeGX/AAT mort table validation (body). */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmort.c + * + * TrueTypeGX/AAT mort table validation (body). + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmort.h" #include "gxvfeat.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmort +#define FT_COMPONENT gxvmort static void @@ -123,6 +123,7 @@ GXV_Validator gxvalid ) { FT_UNUSED( gxvalid ); + FT_UNUSED( coverage ); #ifdef FT_DEBUG_LEVEL_TRACE if ( coverage & 0x8000U ) diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort.h b/src/3rdparty/freetype/src/gxvalid/gxvmort.h index d8030645e9..0619e24fb9 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort.h @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* gxvmort.h */ -/* */ -/* TrueTypeGX/AAT common definition for mort table (specification). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmort.h + * + * TrueTypeGX/AAT common definition for mort table (specification). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #ifndef GXVMORT_H_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort0.c b/src/3rdparty/freetype/src/gxvalid/gxvmort0.c index 95cf53d5eb..2c01bf95ec 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort0.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort0.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmort0.c */ -/* */ -/* TrueTypeGX/AAT mort table validation */ -/* body for type0 (Indic Script Rearrangement) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmort0.c + * + * TrueTypeGX/AAT mort table validation + * body for type0 (Indic Script Rearrangement) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmort.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmort +#define FT_COMPONENT gxvmort static const char* GXV_Mort_IndicScript_Msg[] = diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort1.c b/src/3rdparty/freetype/src/gxvalid/gxvmort1.c index a7683a17b0..c71ba13351 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort1.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort1.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmort1.c */ -/* */ -/* TrueTypeGX/AAT mort table validation */ -/* body for type1 (Contextual Substitution) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmort1.c + * + * TrueTypeGX/AAT mort table validation + * body for type1 (Contextual Substitution) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmort.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmort +#define FT_COMPONENT gxvmort typedef struct GXV_mort_subtable_type1_StateOptRec_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort2.c b/src/3rdparty/freetype/src/gxvalid/gxvmort2.c index c23c2775a1..889d3bd582 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort2.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort2.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmort2.c */ -/* */ -/* TrueTypeGX/AAT mort table validation */ -/* body for type2 (Ligature Substitution) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmort2.c + * + * TrueTypeGX/AAT mort table validation + * body for type2 (Ligature Substitution) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmort.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmort +#define FT_COMPONENT gxvmort typedef struct GXV_mort_subtable_type2_StateOptRec_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort4.c b/src/3rdparty/freetype/src/gxvalid/gxvmort4.c index 9d21a5fc29..f8ce6cf789 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort4.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort4.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmort4.c */ -/* */ -/* TrueTypeGX/AAT mort table validation */ -/* body for type4 (Non-Contextual Glyph Substitution) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmort4.c + * + * TrueTypeGX/AAT mort table validation + * body for type4 (Non-Contextual Glyph Substitution) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmort.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmort +#define FT_COMPONENT gxvmort static void diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort5.c b/src/3rdparty/freetype/src/gxvalid/gxvmort5.c index 42cb428aa8..1ba1e5ded0 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort5.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort5.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmort5.c */ -/* */ -/* TrueTypeGX/AAT mort table validation */ -/* body for type5 (Contextual Glyph Insertion) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmort5.c + * + * TrueTypeGX/AAT mort table validation + * body for type5 (Contextual Glyph Insertion) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmort.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmort +#define FT_COMPONENT gxvmort /* diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx.c index 9fd6e6b971..8bd45c27e6 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx.c @@ -1,41 +1,41 @@ -/***************************************************************************/ -/* */ -/* gxvmorx.c */ -/* */ -/* TrueTypeGX/AAT morx table validation (body). */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmorx.c + * + * TrueTypeGX/AAT morx table validation (body). + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmorx.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmorx +#define FT_COMPONENT gxvmorx static void diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx.h b/src/3rdparty/freetype/src/gxvalid/gxvmorx.h index 6d9925e92b..e257270342 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx.h @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* gxvmorx.h */ -/* */ -/* TrueTypeGX/AAT common definition for morx table (specification). */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmorx.h + * + * TrueTypeGX/AAT common definition for morx table (specification). + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #ifndef GXVMORX_H_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx0.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx0.c index 302261b7fa..d7764a0ae8 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx0.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx0.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmorx0.c */ -/* */ -/* TrueTypeGX/AAT morx table validation */ -/* body for type0 (Indic Script Rearrangement) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmorx0.c + * + * TrueTypeGX/AAT morx table validation + * body for type0 (Indic Script Rearrangement) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmorx.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmorx +#define FT_COMPONENT gxvmorx static void diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx1.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx1.c index 890ca74b1d..5b41b3605f 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx1.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx1.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmorx1.c */ -/* */ -/* TrueTypeGX/AAT morx table validation */ -/* body for type1 (Contextual Substitution) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmorx1.c + * + * TrueTypeGX/AAT morx table validation + * body for type1 (Contextual Substitution) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmorx.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmorx +#define FT_COMPONENT gxvmorx typedef struct GXV_morx_subtable_type1_StateOptRec_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx2.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx2.c index 3135031d45..ec4c81299d 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx2.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx2.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmorx2.c */ -/* */ -/* TrueTypeGX/AAT morx table validation */ -/* body for type2 (Ligature Substitution) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmorx2.c + * + * TrueTypeGX/AAT morx table validation + * body for type2 (Ligature Substitution) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmorx.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmorx +#define FT_COMPONENT gxvmorx typedef struct GXV_morx_subtable_type2_StateOptRec_ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx4.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx4.c index 1e2397b0c5..7b041534c0 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx4.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx4.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmorx4.c */ -/* */ -/* TrueTypeGX/AAT morx table validation */ -/* body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmorx4.c + * + * TrueTypeGX/AAT morx table validation + * body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmorx.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmorx +#define FT_COMPONENT gxvmorx FT_LOCAL_DEF( void ) diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx5.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx5.c index db4f9290c8..70a4623656 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx5.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx5.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvmorx5.c */ -/* */ -/* TrueTypeGX/AAT morx table validation */ -/* body for type5 (Contextual Glyph Insertion) subtable. */ -/* */ -/* Copyright 2005-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvmorx5.c + * + * TrueTypeGX/AAT morx table validation + * body for type5 (Contextual Glyph Insertion) subtable. + * + * Copyright (C) 2005-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvmorx.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvmorx +#define FT_COMPONENT gxvmorx /* diff --git a/src/3rdparty/freetype/src/gxvalid/gxvopbd.c b/src/3rdparty/freetype/src/gxvalid/gxvopbd.c index e2c167ea59..f055a22054 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvopbd.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvopbd.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvopbd.c */ -/* */ -/* TrueTypeGX/AAT opbd table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvopbd.c + * + * TrueTypeGX/AAT opbd table validation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvalid.h" #include "gxvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvopbd +#define FT_COMPONENT gxvopbd /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvprop.c b/src/3rdparty/freetype/src/gxvalid/gxvprop.c index a67b6bdd00..e1911edd48 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvprop.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvprop.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvprop.c */ -/* */ -/* TrueTypeGX/AAT prop table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvprop.c + * + * TrueTypeGX/AAT prop table validation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvalid.h" #include "gxvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvprop +#define FT_COMPONENT gxvprop /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvtrak.c b/src/3rdparty/freetype/src/gxvalid/gxvtrak.c index d501b5014b..b7794b7af4 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvtrak.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvtrak.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* gxvtrak.c */ -/* */ -/* TrueTypeGX/AAT trak table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - -/***************************************************************************/ -/* */ -/* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout is supported by the Information-technology */ -/* Promotion Agency(IPA), Japan. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * gxvtrak.c + * + * TrueTypeGX/AAT trak table validation (body). + * + * Copyright (C) 2004-2019 by + * suzuki toshiya, Masatake YAMATO, Red Hat K.K., + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * 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. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ #include "gxvalid.h" #include "gxvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_gxvtrak +#define FT_COMPONENT gxvtrak /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/gxvalid/module.mk b/src/3rdparty/freetype/src/gxvalid/module.mk index b64879dcee..04067ce617 100644 --- a/src/3rdparty/freetype/src/gxvalid/module.mk +++ b/src/3rdparty/freetype/src/gxvalid/module.mk @@ -2,7 +2,7 @@ # FreeType 2 gxvalid module definition # -# Copyright 2004-2018 by +# Copyright (C) 2004-2019 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/src/3rdparty/freetype/src/gxvalid/rules.mk b/src/3rdparty/freetype/src/gxvalid/rules.mk index 3a17c030a6..4ef463bc21 100644 --- a/src/3rdparty/freetype/src/gxvalid/rules.mk +++ b/src/3rdparty/freetype/src/gxvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2018 by +# Copyright (C) 2004-2019 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/src/3rdparty/freetype/src/gzip/Jamfile b/src/3rdparty/freetype/src/gzip/Jamfile index a7b4c8c950..2c808b74a5 100644 --- a/src/3rdparty/freetype/src/gzip/Jamfile +++ b/src/3rdparty/freetype/src/gzip/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/gzip Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/gzip/ftgzip.c b/src/3rdparty/freetype/src/gzip/ftgzip.c index f8011c2dd8..5e78bc6f8d 100644 --- a/src/3rdparty/freetype/src/gzip/ftgzip.c +++ b/src/3rdparty/freetype/src/gzip/ftgzip.c @@ -1,23 +1,23 @@ -/***************************************************************************/ -/* */ -/* ftgzip.c */ -/* */ -/* FreeType support for .gz compressed files. */ -/* */ -/* This optional component relies on zlib. It should mainly be used to */ -/* parse compressed PCF fonts, as found with many X11 server */ -/* distributions. */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftgzip.c + * + * FreeType support for .gz compressed files. + * + * This optional component relies on zlib. It should mainly be used to + * parse compressed PCF fonts, as found with many X11 server + * distributions. + * + * Copyright (C) 2002-2019 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 @@ -41,10 +41,6 @@ #ifdef FT_CONFIG_OPTION_USE_ZLIB -#ifdef FT_CONFIG_OPTION_PIC -#error "gzip code does not support PIC yet" -#endif - #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB #include @@ -637,8 +633,8 @@ memory = source->memory; /* - * check the header right now; this prevents allocating un-necessary - * objects when we don't need them + * check the header right now; this prevents allocating un-necessary + * objects when we don't need them */ error = ft_gzip_check_header( source ); if ( error ) @@ -660,12 +656,12 @@ } /* - * We use the following trick to try to dramatically improve the - * performance while dealing with small files. If the original stream - * size is less than a certain threshold, we try to load the whole font - * file into memory. This saves us from using the 32KB buffer needed - * to inflate the file, plus the two 4KB intermediate input/output - * buffers used in the `FT_GZipFile' structure. + * We use the following trick to try to dramatically improve the + * performance while dealing with small files. If the original stream + * size is less than a certain threshold, we try to load the whole font + * file into memory. This saves us from using the 32KB buffer needed + * to inflate the file, plus the two 4KB intermediate input/output + * buffers used in the `FT_GZipFile' structure. */ { FT_ULong zip_size = ft_gzip_get_uncompressed_size( source ); @@ -735,7 +731,7 @@ /* check for `input' delayed to `inflate' */ - if ( !memory || ! output_len || !output ) + if ( !memory || !output_len || !output ) return FT_THROW( Invalid_Argument ); /* this function is modeled after zlib's `uncompress' function */ @@ -750,7 +746,7 @@ stream.zfree = (free_func) ft_gzip_free; stream.opaque = memory; - err = inflateInit2( &stream, MAX_WBITS ); + err = inflateInit2( &stream, MAX_WBITS|32 ); if ( err != Z_OK ) return FT_THROW( Invalid_Argument ); diff --git a/src/3rdparty/freetype/src/gzip/infblock.c b/src/3rdparty/freetype/src/gzip/infblock.c index d6e2dc297d..2b4f0c2b53 100644 --- a/src/3rdparty/freetype/src/gzip/infblock.c +++ b/src/3rdparty/freetype/src/gzip/infblock.c @@ -235,6 +235,7 @@ int r ) s->sub.trees.index = 0; Tracev((stderr, "inflate: table sizes ok\n")); s->mode = BTREE; + /* fall through */ case BTREE: while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10)) { @@ -260,6 +261,7 @@ int r ) s->sub.trees.index = 0; Tracev((stderr, "inflate: bits tree ok\n")); s->mode = DTREE; + /* fall through */ case DTREE: while (t = s->sub.trees.table, s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) @@ -335,6 +337,7 @@ int r ) } ZFREE(z, s->sub.trees.blens); s->mode = CODES; + /* fall through */ case CODES: UPDATE if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) @@ -351,11 +354,13 @@ int r ) break; } s->mode = DRY; + /* fall through */ case DRY: FLUSH if (s->read != s->write) LEAVE s->mode = DONE; + /* fall through */ case DONE: r = Z_STREAM_END; LEAVE diff --git a/src/3rdparty/freetype/src/gzip/infcodes.c b/src/3rdparty/freetype/src/gzip/infcodes.c index f7bfd58c4f..ba30654990 100644 --- a/src/3rdparty/freetype/src/gzip/infcodes.c +++ b/src/3rdparty/freetype/src/gzip/infcodes.c @@ -117,6 +117,7 @@ int r ) c->sub.code.need = c->lbits; c->sub.code.tree = c->ltree; c->mode = LEN; + /* fall through */ case LEN: /* i: get length/literal/eob next */ j = c->sub.code.need; NEEDBITS(j) @@ -164,6 +165,7 @@ int r ) c->sub.code.tree = c->dtree; Tracevv((stderr, "inflate: length %u\n", c->len)); c->mode = DIST; + /* fall through */ case DIST: /* i: get distance next */ j = c->sub.code.need; NEEDBITS(j) @@ -194,6 +196,7 @@ int r ) DUMPBITS(j) Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); c->mode = COPY; + /* fall through */ case COPY: /* o: copying bytes in window, waiting for space */ f = q - c->sub.copy.dist; while (f < s->window) /* modulo window size-"while" instead */ @@ -225,6 +228,7 @@ int r ) if (s->read != s->write) LEAVE c->mode = END; + /* fall through */ case END: r = Z_STREAM_END; LEAVE diff --git a/src/3rdparty/freetype/src/gzip/inflate.c b/src/3rdparty/freetype/src/gzip/inflate.c index 8877fa3eb2..95e2653662 100644 --- a/src/3rdparty/freetype/src/gzip/inflate.c +++ b/src/3rdparty/freetype/src/gzip/inflate.c @@ -174,6 +174,7 @@ int f ) break; } z->state->mode = FLAG; + /* fall through */ case FLAG: NEEDBYTE b = NEXTBYTE; @@ -191,18 +192,22 @@ int f ) break; } z->state->mode = DICT4; + /* fall through */ case DICT4: NEEDBYTE z->state->sub.check.need = (uLong)NEXTBYTE << 24; z->state->mode = DICT3; + /* fall through */ case DICT3: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE << 16; z->state->mode = DICT2; + /* fall through */ case DICT2: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE << 8; z->state->mode = DICT1; + /* fall through */ case DICT1: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE; @@ -234,18 +239,22 @@ int f ) break; } z->state->mode = CHECK4; + /* fall through */ case CHECK4: NEEDBYTE z->state->sub.check.need = (uLong)NEXTBYTE << 24; z->state->mode = CHECK3; + /* fall through */ case CHECK3: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE << 16; z->state->mode = CHECK2; + /* fall through */ case CHECK2: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE << 8; z->state->mode = CHECK1; + /* fall through */ case CHECK1: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE; @@ -259,6 +268,7 @@ int f ) } Tracev((stderr, "inflate: zlib check ok\n")); z->state->mode = DONE; + /* fall through */ case DONE: return Z_STREAM_END; case BAD: diff --git a/src/3rdparty/freetype/src/gzip/rules.mk b/src/3rdparty/freetype/src/gzip/rules.mk index 1a2e48bebd..44206a1dae 100644 --- a/src/3rdparty/freetype/src/gzip/rules.mk +++ b/src/3rdparty/freetype/src/gzip/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2018 by +# Copyright (C) 2002-2019 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/src/3rdparty/freetype/src/lzw/Jamfile b/src/3rdparty/freetype/src/lzw/Jamfile index cb83aa4a56..ba2d6ebb45 100644 --- a/src/3rdparty/freetype/src/lzw/Jamfile +++ b/src/3rdparty/freetype/src/lzw/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/lzw Jamfile # -# Copyright 2004-2018 by +# Copyright (C) 2004-2019 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/src/3rdparty/freetype/src/lzw/ftlzw.c b/src/3rdparty/freetype/src/lzw/ftlzw.c index cb46f93c68..9805a1e3bd 100644 --- a/src/3rdparty/freetype/src/lzw/ftlzw.c +++ b/src/3rdparty/freetype/src/lzw/ftlzw.c @@ -1,25 +1,25 @@ -/***************************************************************************/ -/* */ -/* ftlzw.c */ -/* */ -/* FreeType support for .Z compressed files. */ -/* */ -/* This optional component relies on NetBSD's zopen(). It should mainly */ -/* be used to parse compressed PCF fonts, as found with many X11 server */ -/* distributions. */ -/* */ -/* Copyright 2004-2018 by */ -/* Albert Chin-A-Young. */ -/* */ -/* based on code in `src/gzip/ftgzip.c' */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftlzw.c + * + * FreeType support for .Z compressed files. + * + * This optional component relies on NetBSD's zopen(). It should mainly + * be used to parse compressed PCF fonts, as found with many X11 server + * distributions. + * + * Copyright (C) 2004-2019 by + * Albert Chin-A-Young. + * + * based on code in `src/gzip/ftgzip.c' + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_INTERNAL_MEMORY_H @@ -42,10 +42,6 @@ #ifdef FT_CONFIG_OPTION_USE_LZW -#ifdef FT_CONFIG_OPTION_PIC -#error "lzw code does not support PIC yet" -#endif - #include "ftzopen.h" @@ -361,11 +357,11 @@ memory = source->memory; /* - * Check the header right now; this prevents allocation of a huge - * LZWFile object (400 KByte of heap memory) if not necessary. + * Check the header right now; this prevents allocation of a huge + * LZWFile object (400 KByte of heap memory) if not necessary. * - * Did I mention that you should never use .Z compressed font - * files? + * Did I mention that you should never use .Z compressed font + * files? */ error = ft_lzw_check_header( source ); if ( error ) diff --git a/src/3rdparty/freetype/src/lzw/ftzopen.c b/src/3rdparty/freetype/src/lzw/ftzopen.c index 2b868ba9f2..67e6760f95 100644 --- a/src/3rdparty/freetype/src/lzw/ftzopen.c +++ b/src/3rdparty/freetype/src/lzw/ftzopen.c @@ -1,23 +1,23 @@ -/***************************************************************************/ -/* */ -/* ftzopen.c */ -/* */ -/* FreeType support for .Z compressed files. */ -/* */ -/* This optional component relies on NetBSD's zopen(). It should mainly */ -/* be used to parse compressed PCF fonts, as found with many X11 server */ -/* distributions. */ -/* */ -/* Copyright 2005-2018 by */ -/* David Turner. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftzopen.c + * + * FreeType support for .Z compressed files. + * + * This optional component relies on NetBSD's zopen(). It should mainly + * be used to parse compressed PCF fonts, as found with many X11 server + * distributions. + * + * Copyright (C) 2005-2019 by + * David Turner. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * 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 "ftzopen.h" #include FT_INTERNAL_MEMORY_H @@ -167,11 +167,11 @@ new_size += new_size >> 2; /* don't grow too fast */ /* - * Note that the `suffix' array is located in the same memory block - * pointed to by `prefix'. + * Note that the `suffix' array is located in the same memory block + * pointed to by `prefix'. * - * I know that sizeof(FT_Byte) == 1 by definition, but it is clearer - * to write it literally. + * I know that sizeof(FT_Byte) == 1 by definition, but it is clearer + * to write it literally. * */ if ( FT_REALLOC_MULT( state->prefix, old_size, new_size, diff --git a/src/3rdparty/freetype/src/lzw/ftzopen.h b/src/3rdparty/freetype/src/lzw/ftzopen.h index 4fd267eb90..44fe36d6c5 100644 --- a/src/3rdparty/freetype/src/lzw/ftzopen.h +++ b/src/3rdparty/freetype/src/lzw/ftzopen.h @@ -1,23 +1,23 @@ -/***************************************************************************/ -/* */ -/* ftzopen.h */ -/* */ -/* FreeType support for .Z compressed files. */ -/* */ -/* This optional component relies on NetBSD's zopen(). It should mainly */ -/* be used to parse compressed PCF fonts, as found with many X11 server */ -/* distributions. */ -/* */ -/* Copyright 2005-2018 by */ -/* David Turner. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftzopen.h + * + * FreeType support for .Z compressed files. + * + * This optional component relies on NetBSD's zopen(). It should mainly + * be used to parse compressed PCF fonts, as found with many X11 server + * distributions. + * + * Copyright (C) 2005-2019 by + * David Turner. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * 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 FTZOPEN_H_ #define FTZOPEN_H_ @@ -27,9 +27,9 @@ /* - * This is a complete re-implementation of the LZW file reader, - * since the old one was incredibly badly written, using - * 400 KByte of heap memory before decompressing anything. + * This is a complete re-implementation of the LZW file reader, + * since the old one was incredibly badly written, using + * 400 KByte of heap memory before decompressing anything. * */ @@ -58,56 +58,56 @@ /* - * state of LZW decompressor + * state of LZW decompressor * - * small technical note - * -------------------- + * small technical note + * -------------------- * - * We use a few tricks in this implementation that are explained here to - * ease debugging and maintenance. + * We use a few tricks in this implementation that are explained here to + * ease debugging and maintenance. * - * - First of all, the `prefix' and `suffix' arrays contain the suffix - * and prefix for codes over 256; this means that + * - First of all, the `prefix' and `suffix' arrays contain the suffix + * and prefix for codes over 256; this means that * - * prefix_of(code) == state->prefix[code-256] - * suffix_of(code) == state->suffix[code-256] + * prefix_of(code) == state->prefix[code-256] + * suffix_of(code) == state->suffix[code-256] * - * Each prefix is a 16-bit code, and each suffix an 8-bit byte. + * Each prefix is a 16-bit code, and each suffix an 8-bit byte. * - * Both arrays are stored in a single memory block, pointed to by - * `state->prefix'. This means that the following equality is always - * true: + * Both arrays are stored in a single memory block, pointed to by + * `state->prefix'. This means that the following equality is always + * true: * - * state->suffix == (FT_Byte*)(state->prefix + state->prefix_size) + * state->suffix == (FT_Byte*)(state->prefix + state->prefix_size) * - * Of course, state->prefix_size is the number of prefix/suffix slots - * in the arrays, corresponding to codes 256..255+prefix_size. + * Of course, state->prefix_size is the number of prefix/suffix slots + * in the arrays, corresponding to codes 256..255+prefix_size. * - * - `free_ent' is the index of the next free entry in the `prefix' - * and `suffix' arrays. This means that the corresponding `next free - * code' is really `256+free_ent'. + * - `free_ent' is the index of the next free entry in the `prefix' + * and `suffix' arrays. This means that the corresponding `next free + * code' is really `256+free_ent'. * - * Moreover, `max_free' is the maximum value that `free_ent' can reach. + * Moreover, `max_free' is the maximum value that `free_ent' can reach. * - * `max_free' corresponds to `(1 << max_bits) - 256'. Note that this - * value is always <= 0xFF00, which means that both `free_ent' and - * `max_free' can be stored in an FT_UInt variable, even on 16-bit - * machines. + * `max_free' corresponds to `(1 << max_bits) - 256'. Note that this + * value is always <= 0xFF00, which means that both `free_ent' and + * `max_free' can be stored in an FT_UInt variable, even on 16-bit + * machines. * - * If `free_ent == max_free', you cannot add new codes to the - * prefix/suffix table. + * If `free_ent == max_free', you cannot add new codes to the + * prefix/suffix table. * - * - `num_bits' is the current number of code bits, starting at 9 and - * growing each time `free_ent' reaches the value of `free_bits'. The - * latter is computed as follows + * - `num_bits' is the current number of code bits, starting at 9 and + * growing each time `free_ent' reaches the value of `free_bits'. The + * latter is computed as follows * - * if num_bits < max_bits: - * free_bits = (1 << num_bits)-256 - * else: - * free_bits = max_free + 1 + * if num_bits < max_bits: + * free_bits = (1 << num_bits)-256 + * else: + * free_bits = max_free + 1 * - * Since the value of `max_free + 1' can never be reached by - * `free_ent', `num_bits' cannot grow larger than `max_bits'. + * Since the value of `max_free + 1' can never be reached by + * `free_ent', `num_bits' cannot grow larger than `max_bits'. */ typedef struct FT_LzwStateRec_ diff --git a/src/3rdparty/freetype/src/lzw/rules.mk b/src/3rdparty/freetype/src/lzw/rules.mk index 18933c41c2..930b32e6b1 100644 --- a/src/3rdparty/freetype/src/lzw/rules.mk +++ b/src/3rdparty/freetype/src/lzw/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2018 by +# Copyright (C) 2004-2019 by # Albert Chin-A-Young. # # based on `src/lzw/rules.mk' diff --git a/src/3rdparty/freetype/src/otvalid/Jamfile b/src/3rdparty/freetype/src/otvalid/Jamfile index 21b8e0cb0f..36db0e1f83 100644 --- a/src/3rdparty/freetype/src/otvalid/Jamfile +++ b/src/3rdparty/freetype/src/otvalid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/otvalid Jamfile # -# Copyright 2004-2018 by +# Copyright (C) 2004-2019 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/src/3rdparty/freetype/src/otvalid/module.mk b/src/3rdparty/freetype/src/otvalid/module.mk index 34f3dab32f..5ea5b7b57b 100644 --- a/src/3rdparty/freetype/src/otvalid/module.mk +++ b/src/3rdparty/freetype/src/otvalid/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2018 by +# Copyright (C) 2004-2019 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/src/3rdparty/freetype/src/otvalid/otvalid.c b/src/3rdparty/freetype/src/otvalid/otvalid.c index 4423ca1012..e3964b99ae 100644 --- a/src/3rdparty/freetype/src/otvalid/otvalid.c +++ b/src/3rdparty/freetype/src/otvalid/otvalid.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* otvalid.c */ -/* */ -/* FreeType validator for OpenType tables (body only). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvalid.c + * + * FreeType validator for OpenType tables (body only). + * + * Copyright (C) 2004-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT diff --git a/src/3rdparty/freetype/src/otvalid/otvalid.h b/src/3rdparty/freetype/src/otvalid/otvalid.h index d7801abae5..5ca819f261 100644 --- a/src/3rdparty/freetype/src/otvalid/otvalid.h +++ b/src/3rdparty/freetype/src/otvalid/otvalid.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* otvalid.h */ -/* */ -/* OpenType table validation (specification only). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvalid.h + * + * OpenType table validation (specification only). + * + * Copyright (C) 2004-2019 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 OTVALID_H_ diff --git a/src/3rdparty/freetype/src/otvalid/otvbase.c b/src/3rdparty/freetype/src/otvalid/otvbase.c index a01d45c707..be69d7ca31 100644 --- a/src/3rdparty/freetype/src/otvalid/otvbase.c +++ b/src/3rdparty/freetype/src/otvalid/otvbase.c @@ -1,33 +1,33 @@ -/***************************************************************************/ -/* */ -/* otvbase.c */ -/* */ -/* OpenType BASE table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvbase.c + * + * OpenType BASE table validation (body). + * + * Copyright (C) 2004-2019 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 "otvalid.h" #include "otvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_otvbase +#define FT_COMPONENT otvbase static void diff --git a/src/3rdparty/freetype/src/otvalid/otvcommn.c b/src/3rdparty/freetype/src/otvalid/otvcommn.c index 0ccfb03c08..5ed1723506 100644 --- a/src/3rdparty/freetype/src/otvalid/otvcommn.c +++ b/src/3rdparty/freetype/src/otvalid/otvcommn.c @@ -1,32 +1,32 @@ -/***************************************************************************/ -/* */ -/* otvcommn.c */ -/* */ -/* OpenType common tables validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvcommn.c + * + * OpenType common tables validation (body). + * + * Copyright (C) 2004-2019 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 "otvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_otvcommon +#define FT_COMPONENT otvcommon /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/otvalid/otvcommn.h b/src/3rdparty/freetype/src/otvalid/otvcommn.h index a392784cf1..bfcc5b974a 100644 --- a/src/3rdparty/freetype/src/otvalid/otvcommn.h +++ b/src/3rdparty/freetype/src/otvalid/otvcommn.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* otvcommn.h */ -/* */ -/* OpenType common tables validation (specification). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvcommn.h + * + * OpenType common tables validation (specification). + * + * Copyright (C) 2004-2019 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 OTVCOMMN_H_ diff --git a/src/3rdparty/freetype/src/otvalid/otverror.h b/src/3rdparty/freetype/src/otvalid/otverror.h index 2fcf42e387..a7d35acf1a 100644 --- a/src/3rdparty/freetype/src/otvalid/otverror.h +++ b/src/3rdparty/freetype/src/otvalid/otverror.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* otverror.h */ -/* */ -/* OpenType validation module error codes (specification only). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the OpenType validation module error */ - /* enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * otverror.h + * + * OpenType validation module error codes (specification only). + * + * Copyright (C) 2004-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the OpenType validation module error + * enumeration constants. + * + */ #ifndef OTVERROR_H_ #define OTVERROR_H_ diff --git a/src/3rdparty/freetype/src/otvalid/otvgdef.c b/src/3rdparty/freetype/src/otvalid/otvgdef.c index 08f3171541..2529b544d2 100644 --- a/src/3rdparty/freetype/src/otvalid/otvgdef.c +++ b/src/3rdparty/freetype/src/otvalid/otvgdef.c @@ -1,33 +1,33 @@ -/***************************************************************************/ -/* */ -/* otvgdef.c */ -/* */ -/* OpenType GDEF table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvgdef.c + * + * OpenType GDEF table validation (body). + * + * Copyright (C) 2004-2019 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 "otvalid.h" #include "otvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_otvgdef +#define FT_COMPONENT otvgdef /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/otvalid/otvgpos.c b/src/3rdparty/freetype/src/otvalid/otvgpos.c index 696b35cae6..f3bddeac6c 100644 --- a/src/3rdparty/freetype/src/otvalid/otvgpos.c +++ b/src/3rdparty/freetype/src/otvalid/otvgpos.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* otvgpos.c */ -/* */ -/* OpenType GPOS table validation (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvgpos.c + * + * OpenType GPOS table validation (body). + * + * Copyright (C) 2002-2019 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 "otvalid.h" @@ -21,14 +21,14 @@ #include "otvgpos.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_otvgpos +#define FT_COMPONENT otvgpos static void diff --git a/src/3rdparty/freetype/src/otvalid/otvgpos.h b/src/3rdparty/freetype/src/otvalid/otvgpos.h index 95f9ac3ee8..b3154312eb 100644 --- a/src/3rdparty/freetype/src/otvalid/otvgpos.h +++ b/src/3rdparty/freetype/src/otvalid/otvgpos.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* otvgpos.h */ -/* */ -/* OpenType GPOS table validator (specification). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvgpos.h + * + * OpenType GPOS table validator (specification). + * + * Copyright (C) 2004-2019 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 OTVGPOS_H_ diff --git a/src/3rdparty/freetype/src/otvalid/otvgsub.c b/src/3rdparty/freetype/src/otvalid/otvgsub.c index d35ea67f30..97da997d3d 100644 --- a/src/3rdparty/freetype/src/otvalid/otvgsub.c +++ b/src/3rdparty/freetype/src/otvalid/otvgsub.c @@ -1,33 +1,33 @@ -/***************************************************************************/ -/* */ -/* otvgsub.c */ -/* */ -/* OpenType GSUB table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvgsub.c + * + * OpenType GSUB table validation (body). + * + * Copyright (C) 2004-2019 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 "otvalid.h" #include "otvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_otvgsub +#define FT_COMPONENT otvgsub /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/otvalid/otvjstf.c b/src/3rdparty/freetype/src/otvalid/otvjstf.c index 94d4af90f6..d4e6d87178 100644 --- a/src/3rdparty/freetype/src/otvalid/otvjstf.c +++ b/src/3rdparty/freetype/src/otvalid/otvjstf.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* otvjstf.c */ -/* */ -/* OpenType JSTF table validation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvjstf.c + * + * OpenType JSTF table validation (body). + * + * Copyright (C) 2004-2019 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 "otvalid.h" @@ -21,14 +21,14 @@ #include "otvgpos.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_otvjstf +#define FT_COMPONENT otvjstf #define JstfPriorityFunc otv_JstfPriority_validate diff --git a/src/3rdparty/freetype/src/otvalid/otvmath.c b/src/3rdparty/freetype/src/otvalid/otvmath.c index b9800f60a2..3aaf0ec0ec 100644 --- a/src/3rdparty/freetype/src/otvalid/otvmath.c +++ b/src/3rdparty/freetype/src/otvalid/otvmath.c @@ -1,21 +1,21 @@ -/***************************************************************************/ -/* */ -/* otvmath.c */ -/* */ -/* OpenType MATH table validation (body). */ -/* */ -/* Copyright 2007-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Written by George Williams. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvmath.c + * + * OpenType MATH table validation (body). + * + * Copyright (C) 2007-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Written by George Williams. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include "otvalid.h" @@ -23,14 +23,14 @@ #include "otvgpos.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_otvmath +#define FT_COMPONENT otvmath diff --git a/src/3rdparty/freetype/src/otvalid/otvmod.c b/src/3rdparty/freetype/src/otvalid/otvmod.c index 89ee449d16..f417bd220f 100644 --- a/src/3rdparty/freetype/src/otvalid/otvmod.c +++ b/src/3rdparty/freetype/src/otvalid/otvmod.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* otvmod.c */ -/* */ -/* FreeType's OpenType validation module implementation (body). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvmod.c + * + * FreeType's OpenType validation module implementation (body). + * + * Copyright (C) 2004-2019 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 @@ -28,14 +28,14 @@ #include "otvcommn.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_otvmodule +#define FT_COMPONENT otvmodule static FT_Error diff --git a/src/3rdparty/freetype/src/otvalid/otvmod.h b/src/3rdparty/freetype/src/otvalid/otvmod.h index 6917bccee5..5539de7ec6 100644 --- a/src/3rdparty/freetype/src/otvalid/otvmod.h +++ b/src/3rdparty/freetype/src/otvalid/otvmod.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* otvmod.h */ -/* */ -/* FreeType's OpenType validation module implementation */ -/* (specification). */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * otvmod.h + * + * FreeType's OpenType validation module implementation + * (specification). + * + * Copyright (C) 2004-2019 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 OTVMOD_H_ @@ -27,10 +27,6 @@ FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif - FT_EXPORT_VAR( const FT_Module_Class ) otv_module_class; diff --git a/src/3rdparty/freetype/src/otvalid/rules.mk b/src/3rdparty/freetype/src/otvalid/rules.mk index d4fc723740..3c6ece1c19 100644 --- a/src/3rdparty/freetype/src/otvalid/rules.mk +++ b/src/3rdparty/freetype/src/otvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2018 by +# Copyright (C) 2004-2019 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/src/3rdparty/freetype/src/pcf/Jamfile b/src/3rdparty/freetype/src/pcf/Jamfile index 7b92b12ddc..fd17d53f0d 100644 --- a/src/3rdparty/freetype/src/pcf/Jamfile +++ b/src/3rdparty/freetype/src/pcf/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pcf Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/pcf/pcf.h b/src/3rdparty/freetype/src/pcf/pcf.h index f0390cb1eb..33be4bcd85 100644 --- a/src/3rdparty/freetype/src/pcf/pcf.h +++ b/src/3rdparty/freetype/src/pcf/pcf.h @@ -99,11 +99,25 @@ FT_BEGIN_HEADER FT_Short ascent; FT_Short descent; FT_Short attributes; - FT_ULong bits; + + FT_ULong bits; /* offset into the PCF_BITMAPS table */ } PCF_MetricRec, *PCF_Metric; + typedef struct PCF_EncRec_ + { + FT_UShort firstCol; + FT_UShort lastCol; + FT_UShort firstRow; + FT_UShort lastRow; + FT_UShort defaultChar; + + FT_UShort* offset; + + } PCF_EncRec, *PCF_Enc; + + typedef struct PCF_AccelRec_ { FT_Byte noOverlap; @@ -124,41 +138,32 @@ FT_BEGIN_HEADER } PCF_AccelRec, *PCF_Accel; - typedef struct PCF_EncodingRec_ - { - FT_Long enc; - FT_UShort glyph; - - } PCF_EncodingRec, *PCF_Encoding; - - + /* + * This file uses X11 terminology for PCF data; an `encoding' in X11 speak + * is the same as a `character code' in FreeType speak. + */ typedef struct PCF_FaceRec_ { - FT_FaceRec root; - - FT_StreamRec comp_stream; - FT_Stream comp_source; + FT_FaceRec root; - char* charset_encoding; - char* charset_registry; + FT_StreamRec comp_stream; + FT_Stream comp_source; - PCF_TocRec toc; - PCF_AccelRec accel; + char* charset_encoding; + char* charset_registry; - int nprops; - PCF_Property properties; + PCF_TocRec toc; + PCF_AccelRec accel; - FT_ULong nmetrics; - PCF_Metric metrics; - FT_ULong nencodings; - PCF_Encoding encodings; + int nprops; + PCF_Property properties; - FT_Short defaultChar; + FT_ULong nmetrics; + PCF_Metric metrics; - FT_ULong bitmapsFormat; + PCF_EncRec enc; - FT_CharMap charmap_handle; - FT_CharMapRec charmap; /* a single charmap per face */ + FT_ULong bitmapsFormat; } PCF_FaceRec, *PCF_Face; diff --git a/src/3rdparty/freetype/src/pcf/pcfdrivr.c b/src/3rdparty/freetype/src/pcf/pcfdrivr.c index 0119d94853..b39592c794 100644 --- a/src/3rdparty/freetype/src/pcf/pcfdrivr.c +++ b/src/3rdparty/freetype/src/pcf/pcfdrivr.c @@ -45,7 +45,7 @@ THE SOFTWARE. #include "pcfutil.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_pcfread +#define FT_COMPONENT pcfread #include FT_SERVICE_BDF_H #include FT_SERVICE_FONT_FORMAT_H @@ -53,21 +53,24 @@ THE SOFTWARE. #include FT_DRIVER_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_pcfdriver +#define FT_COMPONENT pcfdriver + /* + * This file uses X11 terminology for PCF data; an `encoding' in X11 speak + * is the same as a `character code' in FreeType speak. + */ typedef struct PCF_CMapRec_ { - FT_CMapRec root; - FT_ULong num_encodings; - PCF_Encoding encodings; + FT_CMapRec root; + PCF_Enc enc; } PCF_CMapRec, *PCF_CMap; @@ -82,8 +85,7 @@ THE SOFTWARE. FT_UNUSED( init_data ); - cmap->num_encodings = face->nencodings; - cmap->encodings = face->encodings; + cmap->enc = &face->enc; return FT_Err_Ok; } @@ -95,8 +97,7 @@ THE SOFTWARE. PCF_CMap cmap = (PCF_CMap)pcfcmap; - cmap->encodings = NULL; - cmap->num_encodings = 0; + cmap->enc = NULL; } @@ -104,36 +105,26 @@ THE SOFTWARE. pcf_cmap_char_index( FT_CMap pcfcmap, /* PCF_CMap */ FT_UInt32 charcode ) { - PCF_CMap cmap = (PCF_CMap)pcfcmap; - PCF_Encoding encodings = cmap->encodings; - FT_ULong min, max, mid; - FT_UInt result = 0; + PCF_CMap cmap = (PCF_CMap)pcfcmap; + PCF_Enc enc = cmap->enc; + FT_UShort charcodeRow; + FT_UShort charcodeCol; - min = 0; - max = cmap->num_encodings; + if ( charcode > (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) || + charcode < (FT_UInt32)( enc->firstRow * 256 + enc->firstCol ) ) + return 0; - while ( min < max ) - { - FT_ULong code; + charcodeRow = (FT_UShort)( charcode >> 8 ); + charcodeCol = (FT_UShort)( charcode & 0xFF ); + if ( charcodeCol < enc->firstCol || + charcodeCol > enc->lastCol ) + return 0; - mid = ( min + max ) >> 1; - code = (FT_ULong)encodings[mid].enc; - - if ( charcode == code ) - { - result = encodings[mid].glyph + 1; - break; - } - - if ( charcode < code ) - max = mid; - else - min = mid + 1; - } - - return result; + return (FT_UInt)enc->offset[( charcodeRow - enc->firstRow ) * + ( enc->lastCol - enc->firstCol + 1 ) + + charcodeCol - enc->firstCol]; } @@ -141,52 +132,43 @@ THE SOFTWARE. pcf_cmap_char_next( FT_CMap pcfcmap, /* PCF_CMap */ FT_UInt32 *acharcode ) { - PCF_CMap cmap = (PCF_CMap)pcfcmap; - PCF_Encoding encodings = cmap->encodings; - FT_ULong min, max, mid; - FT_ULong charcode = *acharcode + 1; - FT_UInt result = 0; - + PCF_CMap cmap = (PCF_CMap)pcfcmap; + PCF_Enc enc = cmap->enc; + FT_UInt32 charcode = *acharcode; + FT_UShort charcodeRow; + FT_UShort charcodeCol; + FT_Int result = 0; - min = 0; - max = cmap->num_encodings; - while ( min < max ) + while ( charcode < (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) ) { - FT_ULong code; + charcode++; + if ( charcode < (FT_UInt32)( enc->firstRow * 256 + enc->firstCol ) ) + charcode = (FT_UInt32)( enc->firstRow * 256 + enc->firstCol ); - mid = ( min + max ) >> 1; - code = (FT_ULong)encodings[mid].enc; + charcodeRow = (FT_UShort)( charcode >> 8 ); + charcodeCol = (FT_UShort)( charcode & 0xFF ); - if ( charcode == code ) + if ( charcodeCol < enc->firstCol ) + charcodeCol = enc->firstCol; + else if ( charcodeCol > enc->lastCol ) { - result = encodings[mid].glyph + 1; - goto Exit; + charcodeRow++; + charcodeCol = enc->firstCol; } - if ( charcode < code ) - max = mid; - else - min = mid + 1; - } + charcode = (FT_UInt32)( charcodeRow * 256 + charcodeCol ); - charcode = 0; - if ( min < cmap->num_encodings ) - { - charcode = (FT_ULong)encodings[min].enc; - result = encodings[min].glyph + 1; + result = (FT_UInt)enc->offset[( charcodeRow - enc->firstRow ) * + ( enc->lastCol - enc->firstCol + 1 ) + + charcodeCol - enc->firstCol]; + if ( result != 0xFFFFU ) + break; } - Exit: - if ( charcode > 0xFFFFFFFFUL ) - { - FT_TRACE1(( "pcf_cmap_char_next: charcode 0x%x > 32bit API" )); - *acharcode = 0; - /* XXX: result should be changed to indicate an overflow error */ - } - else - *acharcode = (FT_UInt32)charcode; + *acharcode = charcode; + return result; } @@ -216,8 +198,8 @@ THE SOFTWARE. memory = FT_FACE_MEMORY( face ); - FT_FREE( face->encodings ); FT_FREE( face->metrics ); + FT_FREE( face->enc.offset ); /* free properties */ if ( face->properties ) @@ -512,9 +494,6 @@ THE SOFTWARE. stream = face->root.stream; - if ( glyph_index > 0 ) - glyph_index--; - metric = face->metrics + glyph_index; bitmap->rows = (unsigned int)( metric->ascent + @@ -601,11 +580,11 @@ THE SOFTWARE. } - /* - * - * BDF SERVICE - * - */ + /* + * + * BDF SERVICE + * + */ static FT_Error pcf_get_bdf_property( PCF_Face face, @@ -633,9 +612,9 @@ THE SOFTWARE. } /* - * The PCF driver loads all properties as signed integers. - * This really doesn't seem to be a problem, because this is - * sufficient for any meaningful values. + * The PCF driver loads all properties as signed integers. + * This really doesn't seem to be a problem, because this is + * sufficient for any meaningful values. */ aproperty->type = BDF_PROPERTY_TYPE_INTEGER; aproperty->u.integer = (FT_Int32)prop->value.l; @@ -668,7 +647,7 @@ THE SOFTWARE. /* - * PROPERTY SERVICE + * PROPERTY SERVICE * */ static FT_Error @@ -777,11 +756,11 @@ THE SOFTWARE. (FT_Properties_GetFunc)pcf_property_get ) /* get_property */ - /* - * - * SERVICE LIST - * - */ + /* + * + * SERVICE LIST + * + */ static const FT_ServiceDescRec pcf_services[] = { diff --git a/src/3rdparty/freetype/src/pcf/pcfdrivr.h b/src/3rdparty/freetype/src/pcf/pcfdrivr.h index 29d30497cd..73db0823d2 100644 --- a/src/3rdparty/freetype/src/pcf/pcfdrivr.h +++ b/src/3rdparty/freetype/src/pcf/pcfdrivr.h @@ -31,11 +31,8 @@ THE SOFTWARE. #include #include FT_INTERNAL_DRIVER_H -FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif +FT_BEGIN_HEADER FT_EXPORT_VAR( const FT_Driver_ClassRec ) pcf_driver_class; diff --git a/src/3rdparty/freetype/src/pcf/pcferror.h b/src/3rdparty/freetype/src/pcf/pcferror.h index add8ef2230..2e69d1d219 100644 --- a/src/3rdparty/freetype/src/pcf/pcferror.h +++ b/src/3rdparty/freetype/src/pcf/pcferror.h @@ -1,26 +1,26 @@ -/***************************************************************************/ -/* */ -/* pcferror.h */ -/* */ -/* PCF error codes (specification only). */ -/* */ -/* Copyright 2001, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the PCF error enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * pcferror.h + * + * PCF error codes (specification only). + * + * Copyright 2001, 2012 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the PCF error enumeration constants. + * + */ #ifndef PCFERROR_H_ #define PCFERROR_H_ diff --git a/src/3rdparty/freetype/src/pcf/pcfread.c b/src/3rdparty/freetype/src/pcf/pcfread.c index 537da0dc79..2ffe22d71c 100644 --- a/src/3rdparty/freetype/src/pcf/pcfread.c +++ b/src/3rdparty/freetype/src/pcf/pcfread.c @@ -37,14 +37,14 @@ THE SOFTWARE. #include "pcferror.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_pcfread +#define FT_COMPONENT pcfread #ifdef FT_DEBUG_LEVEL_TRACE @@ -178,23 +178,23 @@ THE SOFTWARE. } /* - * We now check whether the `size' and `offset' values are reasonable: - * `offset' + `size' must not exceed the stream size. + * We now check whether the `size' and `offset' values are reasonable: + * `offset' + `size' must not exceed the stream size. * - * Note, however, that X11's `pcfWriteFont' routine (used by the - * `bdftopcf' program to create PDF font files) has two special - * features. + * Note, however, that X11's `pcfWriteFont' routine (used by the + * `bdftopcf' program to create PCF font files) has two special + * features. * - * - It always assigns the accelerator table a size of 100 bytes in the - * TOC, regardless of its real size, which can vary between 34 and 72 - * bytes. + * - It always assigns the accelerator table a size of 100 bytes in the + * TOC, regardless of its real size, which can vary between 34 and 72 + * bytes. * - * - Due to the way the routine is designed, it ships out the last font - * table with its real size, ignoring the TOC's size value. Since - * the TOC size values are always rounded up to a multiple of 4, the - * difference can be up to three bytes for all tables except the - * accelerator table, for which the difference can be as large as 66 - * bytes. + * - Due to the way the routine is designed, it ships out the last font + * table with its real size, ignoring the TOC's size value. Since + * the TOC size values are always rounded up to a multiple of 4, the + * difference can be up to three bytes for all tables except the + * accelerator table, for which the difference can be as large as 66 + * bytes. * */ @@ -743,33 +743,39 @@ THE SOFTWARE. if ( !orig_nmetrics ) return FT_THROW( Invalid_Table ); - /* PCF is a format from ancient times; Unicode was in its */ - /* infancy, and widely used two-byte character sets for CJK */ - /* scripts (Big 5, GB 2312, JIS X 0208, etc.) did have at most */ - /* 15000 characters. Even the more exotic CNS 11643 and CCCII */ - /* standards, which were essentially three-byte character sets, */ - /* provided less then 65536 assigned characters. */ - /* */ - /* While technically possible to have a larger number of glyphs */ - /* in PCF files, we thus limit the number to 65536. */ - if ( orig_nmetrics > 65536 ) + /* + * PCF is a format from ancient times; Unicode was in its infancy, and + * widely used two-byte character sets for CJK scripts (Big 5, GB 2312, + * JIS X 0208, etc.) did have at most 15000 characters. Even the more + * exotic CNS 11643 and CCCII standards, which were essentially + * three-byte character sets, provided less then 65536 assigned + * characters. + * + * While technically possible to have a larger number of glyphs in PCF + * files, we thus limit the number to 65535, taking into account that we + * synthesize the metrics of glyph 0 to be a copy of the `default + * character', and that 0xFFFF in the encodings array indicates a + * missing glyph. + */ + if ( orig_nmetrics > 65534 ) { FT_TRACE0(( "pcf_get_metrics:" - " only loading first 65536 metrics\n" )); - nmetrics = 65536; + " only loading first 65534 metrics\n" )); + nmetrics = 65534; } else nmetrics = orig_nmetrics; - face->nmetrics = nmetrics; + face->nmetrics = nmetrics + 1; - if ( FT_NEW_ARRAY( face->metrics, nmetrics ) ) + if ( FT_NEW_ARRAY( face->metrics, face->nmetrics ) ) return error; - metrics = face->metrics; + /* we handle glyph index 0 later on */ + metrics = face->metrics + 1; FT_TRACE4(( "\n" )); - for ( i = 0; i < nmetrics; i++, metrics++ ) + for ( i = 1; i < face->nmetrics; i++, metrics++ ) { FT_TRACE5(( " idx %ld:", i )); error = pcf_get_metric( stream, format, metrics ); @@ -808,12 +814,10 @@ THE SOFTWARE. pcf_get_bitmaps( FT_Stream stream, PCF_Face face ) { - FT_Error error; - FT_Memory memory = FT_FACE( face )->memory; - FT_Long* offsets = NULL; - FT_Long bitmapSizes[GLYPHPADOPTIONS]; - FT_ULong format, size; - FT_ULong nbitmaps, orig_nbitmaps, i, sizebitmaps = 0; + FT_Error error; + FT_ULong bitmapSizes[GLYPHPADOPTIONS]; + FT_ULong format, size, pos; + FT_ULong nbitmaps, orig_nbitmaps, i, sizebitmaps = 0; error = pcf_seek_to_table_type( stream, @@ -859,31 +863,46 @@ THE SOFTWARE. FT_TRACE4(( " number of bitmaps: %ld\n", orig_nbitmaps )); /* see comment in `pcf_get_metrics' */ - if ( orig_nbitmaps > 65536 ) + if ( orig_nbitmaps > 65534 ) { FT_TRACE0(( "pcf_get_bitmaps:" - " only loading first 65536 bitmaps\n" )); - nbitmaps = 65536; + " only loading first 65534 bitmaps\n" )); + nbitmaps = 65534; } else nbitmaps = orig_nbitmaps; - if ( nbitmaps != face->nmetrics ) + /* no extra bitmap for glyph 0 */ + if ( nbitmaps != face->nmetrics - 1 ) return FT_THROW( Invalid_File_Format ); - if ( FT_NEW_ARRAY( offsets, nbitmaps ) ) - return error; + /* start position of bitmap data */ + pos = stream->pos + nbitmaps * 4 + 4 * 4; FT_TRACE5(( "\n" )); - for ( i = 0; i < nbitmaps; i++ ) + for ( i = 1; i <= nbitmaps; i++ ) { + FT_ULong offset; + + if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - (void)FT_READ_LONG( offsets[i] ); + (void)FT_READ_ULONG( offset ); else - (void)FT_READ_LONG_LE( offsets[i] ); + (void)FT_READ_ULONG_LE( offset ); + + FT_TRACE5(( " bitmap %lu: offset %lu (0x%lX)\n", + i, offset, offset )); - FT_TRACE5(( " bitmap %ld: offset %ld (0x%lX)\n", - i, offsets[i], offsets[i] )); + /* right now, we only check the offset with a rough estimate; */ + /* actual bitmaps are only loaded on demand */ + if ( offset > size ) + { + FT_TRACE0(( "pcf_get_bitmaps:" + " invalid offset to bitmap data of glyph %lu\n", i )); + face->metrics[i].bits = pos; + } + else + face->metrics[i].bits = pos + offset; } if ( error ) goto Bail; @@ -891,62 +910,84 @@ THE SOFTWARE. for ( i = 0; i < GLYPHPADOPTIONS; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - (void)FT_READ_LONG( bitmapSizes[i] ); + (void)FT_READ_ULONG( bitmapSizes[i] ); else - (void)FT_READ_LONG_LE( bitmapSizes[i] ); + (void)FT_READ_ULONG_LE( bitmapSizes[i] ); if ( error ) goto Bail; - sizebitmaps = (FT_ULong)bitmapSizes[PCF_GLYPH_PAD_INDEX( format )]; + sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )]; - FT_TRACE4(( " %ld-bit padding implies a size of %ld\n", + FT_TRACE4(( " %ld-bit padding implies a size of %lu\n", 8 << i, bitmapSizes[i] )); } - FT_TRACE4(( " %ld bitmaps, using %ld-bit padding\n", + FT_TRACE4(( " %lu bitmaps, using %ld-bit padding\n", nbitmaps, 8 << PCF_GLYPH_PAD_INDEX( format ) )); - FT_TRACE4(( " bitmap size: %ld\n", sizebitmaps )); + FT_TRACE4(( " bitmap size: %lu\n", sizebitmaps )); FT_UNUSED( sizebitmaps ); /* only used for debugging */ - /* right now, we only check the bitmap offsets; */ - /* actual bitmaps are only loaded on demand */ - for ( i = 0; i < nbitmaps; i++ ) - { - /* rough estimate */ - if ( ( offsets[i] < 0 ) || - ( (FT_ULong)offsets[i] > size ) ) - { - FT_TRACE0(( "pcf_get_bitmaps:" - " invalid offset to bitmap data of glyph %ld\n", i )); - } - else - face->metrics[i].bits = stream->pos + (FT_ULong)offsets[i]; - } - face->bitmapsFormat = format; Bail: - FT_FREE( offsets ); return error; } + /* + * This file uses X11 terminology for PCF data; an `encoding' in X11 speak + * is the same as a character code in FreeType speak. + */ +#define PCF_ENC_SIZE 10 + + static + const FT_Frame_Field pcf_enc_header[] = + { +#undef FT_STRUCTURE +#define FT_STRUCTURE PCF_EncRec + + FT_FRAME_START( PCF_ENC_SIZE ), + FT_FRAME_USHORT_LE( firstCol ), + FT_FRAME_USHORT_LE( lastCol ), + FT_FRAME_USHORT_LE( firstRow ), + FT_FRAME_USHORT_LE( lastRow ), + FT_FRAME_USHORT_LE( defaultChar ), + FT_FRAME_END + }; + + + static + const FT_Frame_Field pcf_enc_msb_header[] = + { +#undef FT_STRUCTURE +#define FT_STRUCTURE PCF_EncRec + + FT_FRAME_START( PCF_ENC_SIZE ), + FT_FRAME_USHORT( firstCol ), + FT_FRAME_USHORT( lastCol ), + FT_FRAME_USHORT( firstRow ), + FT_FRAME_USHORT( lastRow ), + FT_FRAME_USHORT( defaultChar ), + FT_FRAME_END + }; + + static FT_Error pcf_get_encodings( FT_Stream stream, PCF_Face face ) { - FT_Error error; - FT_Memory memory = FT_FACE( face )->memory; - FT_ULong format, size; - int firstCol, lastCol; - int firstRow, lastRow; - FT_ULong nencoding; - FT_UShort encodingOffset; - int i, j; - FT_ULong k; - PCF_Encoding encoding = NULL; + FT_Error error; + FT_Memory memory = FT_FACE( face )->memory; + FT_ULong format, size; + PCF_Enc enc = &face->enc; + FT_ULong nencoding; + FT_UShort* offset; + FT_UShort defaultCharRow, defaultCharCol; + FT_UShort encodingOffset, defaultCharEncodingOffset; + FT_UShort i, j; + FT_Byte* pos; error = pcf_seek_to_table_type( stream, @@ -956,105 +997,148 @@ THE SOFTWARE. &format, &size ); if ( error ) - return error; + goto Bail; - error = FT_Stream_EnterFrame( stream, 14 ); - if ( error ) - return error; + if ( FT_READ_ULONG_LE( format ) ) + goto Bail; - format = FT_GET_ULONG_LE(); + FT_TRACE4(( "pcf_get_encodings:\n" + " format: 0x%lX (%s)\n", + format, + PCF_BYTE_ORDER( format ) == MSBFirst ? "MSB" : "LSB" )); + + if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && + !PCF_FORMAT_MATCH( format, PCF_BDF_ENCODINGS ) ) + return FT_THROW( Invalid_File_Format ); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) { - firstCol = FT_GET_SHORT(); - lastCol = FT_GET_SHORT(); - firstRow = FT_GET_SHORT(); - lastRow = FT_GET_SHORT(); - face->defaultChar = FT_GET_SHORT(); + if ( FT_STREAM_READ_FIELDS( pcf_enc_msb_header, enc ) ) + goto Bail; } else { - firstCol = FT_GET_SHORT_LE(); - lastCol = FT_GET_SHORT_LE(); - firstRow = FT_GET_SHORT_LE(); - lastRow = FT_GET_SHORT_LE(); - face->defaultChar = FT_GET_SHORT_LE(); + if ( FT_STREAM_READ_FIELDS( pcf_enc_header, enc ) ) + goto Bail; } - FT_Stream_ExitFrame( stream ); - - FT_TRACE4(( "pcf_get_encodings:\n" - " format: 0x%lX (%s)\n", - format, - PCF_BYTE_ORDER( format ) == MSBFirst ? "MSB" : "LSB" )); - - if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) - return FT_THROW( Invalid_File_Format ); - FT_TRACE4(( " firstCol 0x%X, lastCol 0x%X\n" - " firstRow 0x%X, lastRow 0x%X\n", - firstCol, lastCol, - firstRow, lastRow )); + " 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 */ - if ( firstCol < 0 || - firstCol > lastCol || - lastCol > 0xFF || - firstRow < 0 || - firstRow > lastRow || - lastRow > 0xFF ) + if ( enc->firstCol > enc->lastCol || + enc->lastCol > 0xFF || + enc->firstRow > enc->lastRow || + enc->lastRow > 0xFF ) return FT_THROW( Invalid_Table ); - nencoding = (FT_ULong)( lastCol - firstCol + 1 ) * - (FT_ULong)( lastRow - firstRow + 1 ); + nencoding = (FT_ULong)( enc->lastCol - enc->firstCol + 1 ) * + (FT_ULong)( enc->lastRow - enc->firstRow + 1 ); - if ( FT_NEW_ARRAY( encoding, nencoding ) ) - return error; + if ( FT_NEW_ARRAY( enc->offset, nencoding ) ) + goto Bail; error = FT_Stream_EnterFrame( stream, 2 * nencoding ); if ( error ) - goto Bail; + goto Exit; FT_TRACE5(( "\n" )); - k = 0; - for ( i = firstRow; i <= lastRow; i++ ) + defaultCharRow = enc->defaultChar >> 8; + defaultCharCol = enc->defaultChar & 0xFF; + + /* validate default character */ + if ( defaultCharRow < enc->firstRow || + defaultCharRow > enc->lastRow || + defaultCharCol < enc->firstCol || + defaultCharCol > enc->lastCol ) + { + enc->defaultChar = enc->firstRow * 256U + enc->firstCol; + FT_TRACE0(( "pcf_get_encodings:" + " Invalid default character set to %u\n", + enc->defaultChar )); + + defaultCharRow = enc->firstRow; + defaultCharCol = enc->firstCol; + } + + /* + * FreeType mandates that glyph index 0 is the `undefined glyph', which + * PCF calls the `default character'. However, FreeType needs glyph + * index 0 to be used for the undefined glyph only, which is is not the + * case for PCF. For this reason, we add one slot for glyph index 0 and + * simply copy the default character to it. + * + * `stream->cursor' still points to the beginning of the frame; we can + * thus easily get the offset to the default character. + */ + pos = stream->cursor + + 2 * ( ( defaultCharRow - enc->firstRow ) * + ( enc->lastCol - enc->firstCol + 1 ) + + defaultCharCol - enc->firstCol ); + + if ( PCF_BYTE_ORDER( format ) == MSBFirst ) + defaultCharEncodingOffset = FT_PEEK_USHORT( pos ); + else + defaultCharEncodingOffset = FT_PEEK_USHORT_LE( pos ); + + if ( defaultCharEncodingOffset == 0xFFFF ) + { + FT_TRACE0(( "pcf_get_encodings:" + " No glyph for default character,\n" + " " + " setting it to the first glyph of the font\n" )); + defaultCharEncodingOffset = 1; + } + else + { + defaultCharEncodingOffset++; + + if ( defaultCharEncodingOffset >= face->nmetrics ) + { + FT_TRACE0(( "pcf_get_encodings:" + " Invalid glyph index for default character,\n" + " " + " setting it to the first glyph of the font\n" )); + defaultCharEncodingOffset = 1; + } + } + + /* copy metrics of default character to index 0 */ + face->metrics[0] = face->metrics[defaultCharEncodingOffset]; + + /* now loop over all values */ + offset = enc->offset; + for ( i = enc->firstRow; i <= enc->lastRow; i++ ) { - for ( j = firstCol; j <= lastCol; j++ ) + for ( j = enc->firstCol; j <= enc->lastCol; j++ ) { /* X11's reference implementation uses the equivalent to */ /* `FT_GET_SHORT', however PCF fonts with more than 32768 */ - /* characters (e.g. `unifont.pcf') clearly show that an */ + /* characters (e.g., `unifont.pcf') clearly show that an */ /* unsigned value is needed. */ if ( PCF_BYTE_ORDER( format ) == MSBFirst ) encodingOffset = FT_GET_USHORT(); else encodingOffset = FT_GET_USHORT_LE(); - if ( encodingOffset != 0xFFFFU ) - { - encoding[k].enc = i * 256 + j; - encoding[k].glyph = encodingOffset; - - FT_TRACE5(( " code %d (0x%04X): idx %d\n", - encoding[k].enc, encoding[k].enc, encoding[k].glyph )); - - k++; - } + /* everything is off by 1 due to the artificial glyph 0 */ + *offset++ = encodingOffset == 0xFFFF ? 0xFFFF + : encodingOffset + 1; } } FT_Stream_ExitFrame( stream ); - if ( FT_RENEW_ARRAY( encoding, nencoding, k ) ) - goto Bail; - - face->nencodings = k; - face->encodings = encoding; - return error; + Exit: + FT_FREE( enc->offset ); + Bail: - FT_FREE( encoding ); return error; } @@ -1228,9 +1312,8 @@ THE SOFTWARE. PCF_Property prop; - size_t nn, len; - char* strings[4] = { NULL, NULL, NULL, NULL }; - size_t lengths[4]; + const char* strings[4] = { NULL, NULL, NULL, NULL }; + size_t lengths[4], nn, len; face->style_flags = 0; @@ -1242,8 +1325,8 @@ THE SOFTWARE. { face->style_flags |= FT_STYLE_FLAG_ITALIC; strings[2] = ( *(prop->value.atom) == 'O' || - *(prop->value.atom) == 'o' ) ? (char *)"Oblique" - : (char *)"Italic"; + *(prop->value.atom) == 'o' ) ? "Oblique" + : "Italic"; } prop = pcf_find_property( pcf, "WEIGHT_NAME" ); @@ -1251,20 +1334,20 @@ THE SOFTWARE. ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) ) { face->style_flags |= FT_STYLE_FLAG_BOLD; - strings[1] = (char*)"Bold"; + strings[1] = "Bold"; } prop = pcf_find_property( pcf, "SETWIDTH_NAME" ); if ( prop && prop->isString && *(prop->value.atom) && !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) - strings[3] = (char*)( prop->value.atom ); + strings[3] = (const char*)( prop->value.atom ); prop = pcf_find_property( pcf, "ADD_STYLE_NAME" ); if ( prop && prop->isString && *(prop->value.atom) && !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) - strings[0] = (char*)( prop->value.atom ); + strings[0] = (const char*)( prop->value.atom ); for ( len = 0, nn = 0; nn < 4; nn++ ) { @@ -1278,7 +1361,7 @@ THE SOFTWARE. if ( len == 0 ) { - strings[0] = (char*)"Regular"; + strings[0] = "Regular"; lengths[0] = ft_strlen( strings[0] ); len = lengths[0] + 1; } @@ -1294,7 +1377,7 @@ THE SOFTWARE. for ( nn = 0; nn < 4; nn++ ) { - char* src = strings[nn]; + const char* src = strings[nn]; len = lengths[nn]; @@ -1397,8 +1480,7 @@ THE SOFTWARE. root->face_flags |= FT_FACE_FLAG_FIXED_SIZES | - FT_FACE_FLAG_HORIZONTAL | - FT_FACE_FLAG_FAST_GLYPHS; + FT_FACE_FLAG_HORIZONTAL; if ( face->accel.constantWidth ) root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; @@ -1482,14 +1564,7 @@ THE SOFTWARE. else root->family_name = NULL; - /* - * Note: We shift all glyph indices by +1 since we must - * respect the convention that glyph 0 always corresponds - * to the `missing glyph'. - * - * This implies bumping the number of `available' glyphs by 1. - */ - root->num_glyphs = (FT_Long)( face->nmetrics + 1 ); + root->num_glyphs = (FT_Long)face->nmetrics; root->num_fixed_sizes = 1; if ( FT_NEW_ARRAY( root->available_sizes, 1 ) ) diff --git a/src/3rdparty/freetype/src/pcf/pcfutil.c b/src/3rdparty/freetype/src/pcf/pcfutil.c index 0451ee8def..045c42d60f 100644 --- a/src/3rdparty/freetype/src/pcf/pcfutil.c +++ b/src/3rdparty/freetype/src/pcf/pcfutil.c @@ -37,7 +37,7 @@ in this Software without prior written authorization from The Open Group. /* - * Invert bit order within each BYTE of an array. + * Invert bit order within each BYTE of an array. */ FT_LOCAL_DEF( void ) @@ -59,7 +59,7 @@ in this Software without prior written authorization from The Open Group. /* - * Invert byte order within each 16-bits of an array. + * Invert byte order within each 16-bits of an array. */ FT_LOCAL_DEF( void ) @@ -78,7 +78,7 @@ in this Software without prior written authorization from The Open Group. } /* - * Invert byte order within each 32-bits of an array. + * Invert byte order within each 32-bits of an array. */ FT_LOCAL_DEF( void ) diff --git a/src/3rdparty/freetype/src/pfr/Jamfile b/src/3rdparty/freetype/src/pfr/Jamfile index cb55a7ee89..fbca8065c4 100644 --- a/src/3rdparty/freetype/src/pfr/Jamfile +++ b/src/3rdparty/freetype/src/pfr/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pfr Jamfile # -# Copyright 2002-2018 by +# Copyright (C) 2002-2019 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/src/3rdparty/freetype/src/pfr/module.mk b/src/3rdparty/freetype/src/pfr/module.mk index 27fec8e5f6..30d876d4c8 100644 --- a/src/3rdparty/freetype/src/pfr/module.mk +++ b/src/3rdparty/freetype/src/pfr/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2018 by +# Copyright (C) 2002-2019 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/src/3rdparty/freetype/src/pfr/pfr.c b/src/3rdparty/freetype/src/pfr/pfr.c index 1760882fcd..6d885ea47f 100644 --- a/src/3rdparty/freetype/src/pfr/pfr.c +++ b/src/3rdparty/freetype/src/pfr/pfr.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfr.c */ -/* */ -/* FreeType PFR driver component. */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfr.c + * + * FreeType PFR driver component. + * + * Copyright (C) 2002-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT diff --git a/src/3rdparty/freetype/src/pfr/pfrcmap.c b/src/3rdparty/freetype/src/pfr/pfrcmap.c index 60643780a1..bfa1b9ea05 100644 --- a/src/3rdparty/freetype/src/pfr/pfrcmap.c +++ b/src/3rdparty/freetype/src/pfr/pfrcmap.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrcmap.c */ -/* */ -/* FreeType PFR cmap handling (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrcmap.c + * + * FreeType PFR cmap handling (body). + * + * Copyright (C) 2002-2019 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 diff --git a/src/3rdparty/freetype/src/pfr/pfrcmap.h b/src/3rdparty/freetype/src/pfr/pfrcmap.h index c70a0c83c5..1e203a0514 100644 --- a/src/3rdparty/freetype/src/pfr/pfrcmap.h +++ b/src/3rdparty/freetype/src/pfr/pfrcmap.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrcmap.h */ -/* */ -/* FreeType PFR cmap handling (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrcmap.h + * + * FreeType PFR cmap handling (specification). + * + * Copyright (C) 2002-2019 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 PFRCMAP_H_ diff --git a/src/3rdparty/freetype/src/pfr/pfrdrivr.c b/src/3rdparty/freetype/src/pfr/pfrdrivr.c index 6c7e50128a..f67eebf118 100644 --- a/src/3rdparty/freetype/src/pfr/pfrdrivr.c +++ b/src/3rdparty/freetype/src/pfr/pfrdrivr.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrdrivr.c */ -/* */ -/* FreeType PFR driver interface (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrdrivr.c + * + * FreeType PFR driver interface (body). + * + * Copyright (C) 2002-2019 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 @@ -57,10 +57,10 @@ } - /* - * PFR METRICS SERVICE - * - */ + /* + * PFR METRICS SERVICE + * + */ FT_CALLBACK_DEF( FT_Error ) pfr_get_advance( FT_Face pfrface, /* PFR_Face */ @@ -145,10 +145,10 @@ }; - /* - * SERVICE LIST - * - */ + /* + * SERVICE LIST + * + */ static const FT_ServiceDescRec pfr_services[] = { diff --git a/src/3rdparty/freetype/src/pfr/pfrdrivr.h b/src/3rdparty/freetype/src/pfr/pfrdrivr.h index cab852789b..33b7b9413f 100644 --- a/src/3rdparty/freetype/src/pfr/pfrdrivr.h +++ b/src/3rdparty/freetype/src/pfr/pfrdrivr.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrdrivr.h */ -/* */ -/* High-level Type PFR driver interface (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrdrivr.h + * + * High-level Type PFR driver interface (specification). + * + * Copyright (C) 2002-2019 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 PFRDRIVR_H_ @@ -26,14 +26,8 @@ FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif - - FT_EXPORT_VAR( const FT_Driver_ClassRec ) pfr_driver_class; - FT_END_HEADER diff --git a/src/3rdparty/freetype/src/pfr/pfrerror.h b/src/3rdparty/freetype/src/pfr/pfrerror.h index 7027c818e8..4829cfc000 100644 --- a/src/3rdparty/freetype/src/pfr/pfrerror.h +++ b/src/3rdparty/freetype/src/pfr/pfrerror.h @@ -1,26 +1,26 @@ -/***************************************************************************/ -/* */ -/* pfrerror.h */ -/* */ -/* PFR error codes (specification only). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 is used to define the PFR error enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * pfrerror.h + * + * PFR error codes (specification only). + * + * Copyright (C) 2002-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the PFR error enumeration constants. + * + */ #ifndef PFRERROR_H_ #define PFRERROR_H_ diff --git a/src/3rdparty/freetype/src/pfr/pfrgload.c b/src/3rdparty/freetype/src/pfr/pfrgload.c index b7990196b6..6ef5856a8d 100644 --- a/src/3rdparty/freetype/src/pfr/pfrgload.c +++ b/src/3rdparty/freetype/src/pfr/pfrgload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrgload.c */ -/* */ -/* FreeType PFR glyph loader (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrgload.c + * + * FreeType PFR glyph loader (body). + * + * Copyright (C) 2002-2019 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 "pfrgload.h" @@ -24,7 +24,7 @@ #include "pfrerror.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_pfr +#define FT_COMPONENT pfr /*************************************************************************/ @@ -359,9 +359,9 @@ FT_UInt format, format_low, args_format = 0, args_count, n; - /***************************************************************/ - /* read instruction */ - /* */ + /**************************************************************** + * read instruction + */ PFR_CHECK( 1 ); format = PFR_NEXT_BYTE( p ); format_low = format & 15; @@ -426,9 +426,9 @@ args_format = format_low; } - /***********************************************************/ - /* now read arguments */ - /* */ + /************************************************************ + * now read arguments + */ cur = pos; for ( n = 0; n < args_count; n++ ) { @@ -513,9 +513,9 @@ FT_TRACE7(( "\n" )); - /***********************************************************/ - /* finally, execute instruction */ - /* */ + /************************************************************ + * finally, execute instruction + */ switch ( format >> 4 ) { case 0: /* end glyph => EXIT */ diff --git a/src/3rdparty/freetype/src/pfr/pfrgload.h b/src/3rdparty/freetype/src/pfr/pfrgload.h index 01f48d7706..d0e1420b67 100644 --- a/src/3rdparty/freetype/src/pfr/pfrgload.h +++ b/src/3rdparty/freetype/src/pfr/pfrgload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrgload.h */ -/* */ -/* FreeType PFR glyph loader (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrgload.h + * + * FreeType PFR glyph loader (specification). + * + * Copyright (C) 2002-2019 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 PFRGLOAD_H_ diff --git a/src/3rdparty/freetype/src/pfr/pfrload.c b/src/3rdparty/freetype/src/pfr/pfrload.c index 2776da462a..ccf0b7e1f8 100644 --- a/src/3rdparty/freetype/src/pfr/pfrload.c +++ b/src/3rdparty/freetype/src/pfr/pfrload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrload.c */ -/* */ -/* FreeType PFR loader (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrload.c + * + * FreeType PFR loader (body). + * + * Copyright (C) 2002-2019 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 "pfrload.h" @@ -23,92 +23,92 @@ #include "pfrerror.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_pfr +#define FT_COMPONENT pfr /* - * The overall structure of a PFR file is as follows. + * The overall structure of a PFR file is as follows. * - * PFR header - * 58 bytes (contains nPhysFonts) + * PFR header + * 58 bytes (contains nPhysFonts) * - * Logical font directory (size at most 2^16 bytes) - * 2 bytes (nLogFonts) - * + nLogFonts * 5 bytes + * Logical font directory (size at most 2^16 bytes) + * 2 bytes (nLogFonts) + * + nLogFonts * 5 bytes * - * ==> nLogFonts <= 13106 + * ==> nLogFonts <= 13106 * - * Logical font section (size at most 2^24 bytes) - * nLogFonts * logFontRecord + * Logical font section (size at most 2^24 bytes) + * nLogFonts * logFontRecord * - * logFontRecord (size at most 2^16 bytes) - * 12 bytes (fontMatrix) - * + 1 byte (flags) - * + 0-5 bytes (depending on `flags') - * + 0-(1+255*(2+255)) = 0-65536 (depending on `flags') - * + 5 bytes (physical font info) - * + 0-1 bytes (depending on PFR header) + * logFontRecord (size at most 2^16 bytes) + * 12 bytes (fontMatrix) + * + 1 byte (flags) + * + 0-5 bytes (depending on `flags') + * + 0-(1+255*(2+255)) = 0-65536 (depending on `flags') + * + 5 bytes (physical font info) + * + 0-1 bytes (depending on PFR header) * - * ==> minimum size 18 bytes + * ==> minimum size 18 bytes * - * Physical font section (size at most 2^24 bytes) - * nPhysFonts * (physFontRecord - * + nBitmapSizes * nBmapChars * bmapCharRecord) + * Physical font section (size at most 2^24 bytes) + * nPhysFonts * (physFontRecord + * + nBitmapSizes * nBmapChars * bmapCharRecord) * - * physFontRecord (size at most 2^24 bytes) - * 14 bytes (font info) - * + 1 byte (flags) - * + 0-2 (depending on `flags') - * + 0-? (structure too complicated to be shown here; depending on - * `flags'; contains `nBitmapSizes' and `nBmapChars') - * + 3 bytes (nAuxBytes) - * + nAuxBytes - * + 1 byte (nBlueValues) - * + 2 * nBlueValues - * + 6 bytes (hinting data) - * + 2 bytes (nCharacters) - * + nCharacters * (4-10 bytes) (depending on `flags') + * physFontRecord (size at most 2^24 bytes) + * 14 bytes (font info) + * + 1 byte (flags) + * + 0-2 (depending on `flags') + * + 0-? (structure too complicated to be shown here; depending on + * `flags'; contains `nBitmapSizes' and `nBmapChars') + * + 3 bytes (nAuxBytes) + * + nAuxBytes + * + 1 byte (nBlueValues) + * + 2 * nBlueValues + * + 6 bytes (hinting data) + * + 2 bytes (nCharacters) + * + nCharacters * (4-10 bytes) (depending on `flags') * - * ==> minimum size 27 bytes + * ==> minimum size 27 bytes * - * bmapCharRecord - * 4-7 bytes + * bmapCharRecord + * 4-7 bytes * - * Glyph program strings (three possible types: simpleGps, compoundGps, - * and bitmapGps; size at most 2^24 bytes) - * simpleGps (size at most 2^16 bytes) - * 1 byte (flags) - * 1-2 bytes (n[XY]orus, depending on `flags') - * 0-(64+512*2) = 0-1088 bytes (depending on `n[XY]orus') - * 0-? (structure too complicated to be shown here; depending on - * `flags') - * 1-? glyph data (faintly resembling PS Type 1 charstrings) + * Glyph program strings (three possible types: simpleGps, compoundGps, + * and bitmapGps; size at most 2^24 bytes) + * simpleGps (size at most 2^16 bytes) + * 1 byte (flags) + * 1-2 bytes (n[XY]orus, depending on `flags') + * 0-(64+512*2) = 0-1088 bytes (depending on `n[XY]orus') + * 0-? (structure too complicated to be shown here; depending on + * `flags') + * 1-? glyph data (faintly resembling PS Type 1 charstrings) * - * ==> minimum size 3 bytes + * ==> minimum size 3 bytes * - * compoundGps (size at most 2^16 bytes) - * 1 byte (nElements <= 63, flags) - * + 0-(1+255*(2+255)) = 0-65536 (depending on `flags') - * + nElements * (6-14 bytes) + * compoundGps (size at most 2^16 bytes) + * 1 byte (nElements <= 63, flags) + * + 0-(1+255*(2+255)) = 0-65536 (depending on `flags') + * + nElements * (6-14 bytes) * - * bitmapGps (size at most 2^16 bytes) - * 1 byte (flags) - * 3-13 bytes (position info, depending on `flags') - * 0-? bitmap data + * bitmapGps (size at most 2^16 bytes) + * 1 byte (flags) + * 3-13 bytes (position info, depending on `flags') + * 0-? bitmap data * - * ==> minimum size 4 bytes + * ==> minimum size 4 bytes * - * PFR trailer - * 8 bytes + * PFR trailer + * 8 bytes * * - * ==> minimum size of a valid PFR: - * 58 (header) - * + 2 (nLogFonts) - * + 27 (1 physFontRecord) - * + 8 (trailer) - * ----- - * 95 bytes + * ==> minimum size of a valid PFR: + * 58 (header) + * + 2 (nLogFonts) + * + 27 (1 physFontRecord) + * + 8 (trailer) + * ----- + * 95 bytes * */ diff --git a/src/3rdparty/freetype/src/pfr/pfrload.h b/src/3rdparty/freetype/src/pfr/pfrload.h index 36e809a762..2e7ffd0127 100644 --- a/src/3rdparty/freetype/src/pfr/pfrload.h +++ b/src/3rdparty/freetype/src/pfr/pfrload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrload.h */ -/* */ -/* FreeType PFR loader (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrload.h + * + * FreeType PFR loader (specification). + * + * Copyright (C) 2002-2019 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 PFRLOAD_H_ diff --git a/src/3rdparty/freetype/src/pfr/pfrobjs.c b/src/3rdparty/freetype/src/pfr/pfrobjs.c index 737b97b5ff..9765f95c2f 100644 --- a/src/3rdparty/freetype/src/pfr/pfrobjs.c +++ b/src/3rdparty/freetype/src/pfr/pfrobjs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrobjs.c */ -/* */ -/* FreeType PFR object methods (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrobjs.c + * + * FreeType PFR object methods (body). + * + * Copyright (C) 2002-2019 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 "pfrobjs.h" @@ -29,7 +29,7 @@ #include "pfrerror.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_pfr +#define FT_COMPONENT pfr /*************************************************************************/ @@ -122,7 +122,7 @@ stream, (FT_UInt)( face_index & 0xFFFF ), face->header.log_dir_offset, - FT_BOOL( face->header.phy_font_max_size_high != 0 ) ); + FT_BOOL( face->header.phy_font_max_size_high ) ); if ( error ) goto Exit; @@ -370,7 +370,7 @@ FT_Bool scaling; - scaling = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); + scaling = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) ); /* copy outline data */ *outline = slot->glyph.loader->base.outline; @@ -378,7 +378,7 @@ outline->flags &= ~FT_OUTLINE_OWNER; outline->flags |= FT_OUTLINE_REVERSE_FILL; - if ( size && pfrsize->metrics.y_ppem < 24 ) + if ( pfrsize->metrics.y_ppem < 24 ) outline->flags |= FT_OUTLINE_HIGH_PRECISION; /* compute the advance vector */ diff --git a/src/3rdparty/freetype/src/pfr/pfrobjs.h b/src/3rdparty/freetype/src/pfr/pfrobjs.h index 59c709f58d..39cffd07c5 100644 --- a/src/3rdparty/freetype/src/pfr/pfrobjs.h +++ b/src/3rdparty/freetype/src/pfr/pfrobjs.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrobjs.h */ -/* */ -/* FreeType PFR object methods (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrobjs.h + * + * FreeType PFR object methods (specification). + * + * Copyright (C) 2002-2019 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 PFROBJS_H_ diff --git a/src/3rdparty/freetype/src/pfr/pfrsbit.c b/src/3rdparty/freetype/src/pfr/pfrsbit.c index ba909ddca7..00a9616455 100644 --- a/src/3rdparty/freetype/src/pfr/pfrsbit.c +++ b/src/3rdparty/freetype/src/pfr/pfrsbit.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrsbit.c */ -/* */ -/* FreeType PFR bitmap loader (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrsbit.c + * + * FreeType PFR bitmap loader (body). + * + * Copyright (C) 2002-2019 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 "pfrsbit.h" @@ -24,7 +24,7 @@ #include "pfrerror.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_pfr +#define FT_COMPONENT pfr /*************************************************************************/ diff --git a/src/3rdparty/freetype/src/pfr/pfrsbit.h b/src/3rdparty/freetype/src/pfr/pfrsbit.h index 07b27bc06c..6568b90943 100644 --- a/src/3rdparty/freetype/src/pfr/pfrsbit.h +++ b/src/3rdparty/freetype/src/pfr/pfrsbit.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrsbit.h */ -/* */ -/* FreeType PFR bitmap loader (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrsbit.h + * + * FreeType PFR bitmap loader (specification). + * + * Copyright (C) 2002-2019 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 PFRSBIT_H_ diff --git a/src/3rdparty/freetype/src/pfr/pfrtypes.h b/src/3rdparty/freetype/src/pfr/pfrtypes.h index 058d6aadc9..6a5f9d571b 100644 --- a/src/3rdparty/freetype/src/pfr/pfrtypes.h +++ b/src/3rdparty/freetype/src/pfr/pfrtypes.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pfrtypes.h */ -/* */ -/* FreeType PFR data structures (specification only). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pfrtypes.h + * + * FreeType PFR data structures (specification only). + * + * Copyright (C) 2002-2019 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 PFRTYPES_H_ diff --git a/src/3rdparty/freetype/src/pfr/rules.mk b/src/3rdparty/freetype/src/pfr/rules.mk index 3acb795696..f14ca699e2 100644 --- a/src/3rdparty/freetype/src/pfr/rules.mk +++ b/src/3rdparty/freetype/src/pfr/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2018 by +# Copyright (C) 2002-2019 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/src/3rdparty/freetype/src/psaux/Jamfile b/src/3rdparty/freetype/src/psaux/Jamfile index a231d5974f..30bcc1c097 100644 --- a/src/3rdparty/freetype/src/psaux/Jamfile +++ b/src/3rdparty/freetype/src/psaux/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/psaux Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/psaux/afmparse.c b/src/3rdparty/freetype/src/psaux/afmparse.c index 0c33d5949b..f78adbba3d 100644 --- a/src/3rdparty/freetype/src/psaux/afmparse.c +++ b/src/3rdparty/freetype/src/psaux/afmparse.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afmparse.c */ -/* */ -/* AFM parser (body). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afmparse.c + * + * AFM parser (body). + * + * Copyright (C) 2006-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_FREETYPE_H @@ -28,13 +28,13 @@ #include "psauxerr.h" -/***************************************************************************/ -/* */ -/* AFM_Stream */ -/* */ -/* The use of AFM_Stream is largely inspired by parseAFM.[ch] from t1lib. */ -/* */ -/* */ + /************************************************************************** + * + * AFM_Stream + * + * The use of AFM_Stream is largely inspired by parseAFM.[ch] from t1lib. + * + */ enum { @@ -193,11 +193,11 @@ } - /*************************************************************************/ - /* */ - /* AFM_Parser */ - /* */ - /* */ + /************************************************************************** + * + * AFM_Parser + * + */ /* all keys defined in Ch. 7-10 of 5004.AFM_Spec.pdf */ typedef enum AFM_Token_ @@ -953,7 +953,8 @@ error = afm_parse_kern_data( parser ); if ( error ) goto Fail; - /* fall through since we only support kern data */ + /* we only support kern data, so ... */ + /* fall through */ case AFM_TOKEN_ENDFONTMETRICS: return FT_Err_Ok; diff --git a/src/3rdparty/freetype/src/psaux/afmparse.h b/src/3rdparty/freetype/src/psaux/afmparse.h index 86f852a247..2ceb77553b 100644 --- a/src/3rdparty/freetype/src/psaux/afmparse.h +++ b/src/3rdparty/freetype/src/psaux/afmparse.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afmparse.h */ -/* */ -/* AFM parser (specification). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afmparse.h + * + * AFM parser (specification). + * + * Copyright (C) 2006-2019 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 AFMPARSE_H_ diff --git a/src/3rdparty/freetype/src/psaux/cffdecode.c b/src/3rdparty/freetype/src/psaux/cffdecode.c index 80d622c0e1..17cccf818b 100644 --- a/src/3rdparty/freetype/src/psaux/cffdecode.c +++ b/src/3rdparty/freetype/src/psaux/cffdecode.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffdecode.c */ -/* */ -/* PostScript CFF (Type 2) decoding routines (body). */ -/* */ -/* Copyright 2017-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffdecode.c + * + * PostScript CFF (Type 2) decoding routines (body). + * + * Copyright (C) 2017-2019 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 @@ -28,14 +28,14 @@ #include "psauxerr.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cffdecode +#define FT_COMPONENT cffdecode #ifdef CFF_CONFIG_OPTION_OLD_ENGINE @@ -235,8 +235,8 @@ return FT_THROW( Syntax_Error ); } - adx += decoder->builder.left_bearing.x; - ady += decoder->builder.left_bearing.y; + adx = ADD_LONG( adx, decoder->builder.left_bearing.x ); + ady = ADD_LONG( ady, decoder->builder.left_bearing.y ); #ifdef FT_CONFIG_OPTION_INCREMENTAL /* Incremental fonts don't necessarily have valid charsets. */ @@ -378,23 +378,26 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* cff_compute_bias */ - /* */ - /* */ - /* Computes the bias value in dependence of the number of glyph */ - /* subroutines. */ - /* */ - /* */ - /* in_charstring_type :: The `CharstringType' value of the top DICT */ - /* dictionary. */ - /* */ - /* num_subrs :: The number of glyph subroutines. */ - /* */ - /* */ - /* The bias value. */ + /************************************************************************** + * + * @Function: + * cff_compute_bias + * + * @Description: + * Computes the bias value in dependence of the number of glyph + * subroutines. + * + * @Input: + * in_charstring_type :: + * The `CharstringType' value of the top DICT + * dictionary. + * + * num_subrs :: + * The number of glyph subroutines. + * + * @Return: + * The bias value. + */ static FT_Int cff_compute_bias( FT_Int in_charstring_type, FT_UInt num_subrs ) @@ -464,28 +467,32 @@ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - /*************************************************************************/ - /* */ - /* */ - /* cff_decoder_parse_charstrings */ - /* */ - /* */ - /* Parses a given Type 2 charstrings program. */ - /* */ - /* */ - /* decoder :: The current Type 1 decoder. */ - /* */ - /* */ - /* charstring_base :: The base of the charstring stream. */ - /* */ - /* charstring_len :: The length in bytes of the charstring stream. */ - /* */ - /* in_dict :: Set to 1 if function is called from top or */ - /* private DICT (needed for Multiple Master CFFs). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * cff_decoder_parse_charstrings + * + * @Description: + * Parses a given Type 2 charstrings program. + * + * @InOut: + * decoder :: + * The current Type 1 decoder. + * + * @Input: + * charstring_base :: + * The base of the charstring stream. + * + * charstring_len :: + * The length in bytes of the charstring stream. + * + * in_dict :: + * Set to 1 if function is called from top or + * private DICT (needed for Multiple Master CFFs). + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) cff_decoder_parse_charstrings( CFF_Decoder* decoder, FT_Byte* charstring_base, @@ -543,10 +550,10 @@ FT_Byte v; - /********************************************************************/ - /* */ - /* Decode operator or operand */ - /* */ + /********************************************************************* + * + * Decode operator or operand + */ v = *ip++; if ( v >= 32 || v == 28 ) { @@ -853,6 +860,15 @@ case cff_op_flex1: case cff_op_callsubr: case cff_op_callgsubr: + /* deprecated opcodes */ + case cff_op_dotsection: + /* invalid Type 1 opcodes */ + case cff_op_hsbw: + case cff_op_closepath: + case cff_op_callothersubr: + case cff_op_seac: + case cff_op_sbw: + case cff_op_setcurrentpoint: goto MM_Error; default: @@ -948,10 +964,10 @@ case cff_op_hstemhm: case cff_op_vstemhm: /* the number of arguments is always even here */ - FT_TRACE4(( - op == cff_op_hstem ? " hstem\n" : - ( op == cff_op_vstem ? " vstem\n" : - ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) )); + FT_TRACE4(( "%s\n", + op == cff_op_hstem ? " hstem" : + ( op == cff_op_vstem ? " vstem" : + ( op == cff_op_hstemhm ? " hstemhm" : " vstemhm" ) ) )); if ( hinter ) hinter->stems( hinter->hints, @@ -965,7 +981,8 @@ case cff_op_hintmask: case cff_op_cntrmask: - FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" )); + FT_TRACE4(( "%s", op == cff_op_hintmask ? " hintmask" + : " cntrmask" )); /* implement vstem when needed -- */ /* the specification doesn't say it, but this also works */ @@ -1078,8 +1095,8 @@ FT_Int phase = ( op == cff_op_hlineto ); - FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" - : " vlineto\n" )); + FT_TRACE4(( "%s\n", op == cff_op_hlineto ? " hlineto" + : " vlineto" )); if ( num_args < 0 ) goto Stack_Underflow; @@ -1250,8 +1267,8 @@ FT_Int nargs; - FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" - : " hvcurveto\n" )); + FT_TRACE4(( "%s\n", op == cff_op_vhcurveto ? " vhcurveto" + : " hvcurveto" )); if ( cff_builder_start_point( builder, x, y ) ) goto Fail; @@ -1539,9 +1556,9 @@ } if ( dx < 0 ) - dx = -dx; + dx = NEG_LONG( dx ); if ( dy < 0 ) - dy = -dy; + dy = NEG_LONG( dy ); /* strange test, but here it is... */ horizontal = ( dx > dy ); @@ -1551,7 +1568,7 @@ x = ADD_LONG( x, args[0] ); y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, - (FT_Bool)( count == 3 ) ); + FT_BOOL( count == 3 ) ); args += 2; } @@ -1589,7 +1606,7 @@ x = ADD_LONG( x, args[0] ); y = ADD_LONG( y, args[1] ); cff_builder_add_point( builder, x, y, - (FT_Bool)( count == 4 || count == 1 ) ); + FT_BOOL( count == 4 || count == 1 ) ); args += 2; } @@ -1705,16 +1722,20 @@ break; case cff_op_random: - FT_TRACE4(( " random\n" )); + { + FT_UInt32* randval = in_dict ? &decoder->cff->top_font.random + : &decoder->current_subfont->random; - /* only use the lower 16 bits of `random' */ - /* to generate a number in the range (0;1] */ - args[0] = (FT_Fixed) - ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); - args++; - decoder->current_subfont->random = - cff_random( decoder->current_subfont->random ); + FT_TRACE4(( " random\n" )); + + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + args[0] = (FT_Fixed)( ( *randval & 0xFFFF ) + 1 ); + args++; + + *randval = cff_random( *randval ); + } break; case cff_op_mul: @@ -1727,7 +1748,10 @@ case cff_op_sqrt: FT_TRACE4(( " sqrt\n" )); - if ( args[0] > 0 ) + /* without upper limit the loop below might not finish */ + if ( args[0] > 0x7FFFFFFFL ) + args[0] = 46341; + else if ( args[0] > 0 ) { FT_Fixed root = args[0]; FT_Fixed new_root; @@ -1800,6 +1824,7 @@ if ( idx >= 0 ) { + idx = idx % count; while ( idx > 0 ) { FT_Fixed tmp = args[count - 1]; @@ -1814,6 +1839,10 @@ } else { + /* before C99 it is implementation-defined whether */ + /* the result of `%' is negative if the first operand */ + /* is negative */ + idx = -( NEG_INT( idx ) % count ); while ( idx < 0 ) { FT_Fixed tmp = args[0]; @@ -1914,6 +1943,7 @@ case cff_op_blend: /* this operator was removed from the Type2 specification */ /* in version 16-March-2000 */ + if ( num_designs ) { FT_Int num_results = (FT_Int)( args[0] >> 16 ); @@ -1923,7 +1953,8 @@ if ( num_results < 0 ) goto Syntax_Error; - if ( num_results * (FT_Int)num_designs > num_args ) + if ( num_results > num_args || + num_results * (FT_Int)num_designs > num_args ) goto Stack_Underflow; /* since we currently don't handle interpolation of multiple */ @@ -1932,6 +1963,8 @@ args -= num_results * ( num_designs - 1 ); num_args -= num_results * ( num_designs - 1 ); } + else + goto Syntax_Error; break; case cff_op_dotsection: @@ -1998,20 +2031,31 @@ break; case cff_op_callothersubr: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ + { + FT_Fixed arg; - FT_TRACE4(( " callothersubr (invalid op)\n" )); - /* subsequent `pop' operands should add the arguments, */ - /* this is the implementation described for `unknown' other */ - /* subroutines in the Type1 spec. */ - /* */ - /* XXX Fix return arguments (see discussion below). */ - args -= 2 + ( args[-2] >> 16 ); - if ( args < stack ) - goto Stack_Underflow; + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from */ + /* probably Type 1 to CFF, and some parsers seem to accept */ + /* it */ + + FT_TRACE4(( " callothersubr (invalid op)\n" )); + + /* subsequent `pop' operands should add the arguments, */ + /* this is the implementation described for `unknown' */ + /* other subroutines in the Type1 spec. */ + /* */ + /* XXX Fix return arguments (see discussion below). */ + + arg = 2 + ( args[-2] >> 16 ); + if ( arg >= CFF_MAX_OPERANDS ) + goto Stack_Underflow; + + args -= arg; + if ( args < stack ) + goto Stack_Underflow; + } break; case cff_op_pop: @@ -2251,28 +2295,34 @@ #endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ - /*************************************************************************/ - /* */ - /* */ - /* cff_decoder_init */ - /* */ - /* */ - /* Initializes a given glyph decoder. */ - /* */ - /* */ - /* decoder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* slot :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting is active. */ - /* */ - /* hint_mode :: The hinting mode. */ - /* */ + /************************************************************************** + * + * @Function: + * cff_decoder_init + * + * @Description: + * Initializes a given glyph decoder. + * + * @InOut: + * decoder :: + * A pointer to the glyph builder to initialize. + * + * @Input: + * face :: + * The current face object. + * + * size :: + * The current size object. + * + * slot :: + * The current glyph object. + * + * hinting :: + * Whether hinting is active. + * + * hint_mode :: + * The hinting mode. + */ FT_LOCAL_DEF( void ) cff_decoder_init( CFF_Decoder* decoder, TT_Face face, diff --git a/src/3rdparty/freetype/src/psaux/cffdecode.h b/src/3rdparty/freetype/src/psaux/cffdecode.h index 0d4f5fef63..a6691979f0 100644 --- a/src/3rdparty/freetype/src/psaux/cffdecode.h +++ b/src/3rdparty/freetype/src/psaux/cffdecode.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* cffdecode.h */ -/* */ -/* PostScript CFF (Type 2) decoding routines (specification). */ -/* */ -/* Copyright 2017-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * cffdecode.h + * + * PostScript CFF (Type 2) decoding routines (specification). + * + * Copyright (C) 2017-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef CFFDECODE_H_ diff --git a/src/3rdparty/freetype/src/psaux/module.mk b/src/3rdparty/freetype/src/psaux/module.mk index 6584d075a2..bb0886abdf 100644 --- a/src/3rdparty/freetype/src/psaux/module.mk +++ b/src/3rdparty/freetype/src/psaux/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/psaux/psarrst.c b/src/3rdparty/freetype/src/psaux/psarrst.c index a8780947f9..011803b416 100644 --- a/src/3rdparty/freetype/src/psaux/psarrst.c +++ b/src/3rdparty/freetype/src/psaux/psarrst.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psarrst.c */ -/* */ -/* Adobe's code for Array Stacks (body). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psarrst.c + * + * Adobe's code for Array Stacks (body). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include "psft.h" diff --git a/src/3rdparty/freetype/src/psaux/psarrst.h b/src/3rdparty/freetype/src/psaux/psarrst.h index b3568eb61f..098617b257 100644 --- a/src/3rdparty/freetype/src/psaux/psarrst.h +++ b/src/3rdparty/freetype/src/psaux/psarrst.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psarrst.h */ -/* */ -/* Adobe's code for Array Stacks (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psarrst.h + * + * Adobe's code for Array Stacks (specification). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSARRST_H_ diff --git a/src/3rdparty/freetype/src/psaux/psaux.c b/src/3rdparty/freetype/src/psaux/psaux.c index fb447fcdbb..1db0462551 100644 --- a/src/3rdparty/freetype/src/psaux/psaux.c +++ b/src/3rdparty/freetype/src/psaux/psaux.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psaux.c */ -/* */ -/* FreeType auxiliary PostScript driver component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psaux.c + * + * FreeType auxiliary PostScript driver component (body only). + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT diff --git a/src/3rdparty/freetype/src/psaux/psauxerr.h b/src/3rdparty/freetype/src/psaux/psauxerr.h index cc33fd2eea..523e1886c2 100644 --- a/src/3rdparty/freetype/src/psaux/psauxerr.h +++ b/src/3rdparty/freetype/src/psaux/psauxerr.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* psauxerr.h */ -/* */ -/* PS auxiliary module error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the PS auxiliary module error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * psauxerr.h + * + * PS auxiliary module error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the PS auxiliary module error enumeration + * constants. + * + */ #ifndef PSAUXERR_H_ #define PSAUXERR_H_ diff --git a/src/3rdparty/freetype/src/psaux/psauxmod.c b/src/3rdparty/freetype/src/psaux/psauxmod.c index ee497085cc..5df8e69056 100644 --- a/src/3rdparty/freetype/src/psaux/psauxmod.c +++ b/src/3rdparty/freetype/src/psaux/psauxmod.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psauxmod.c */ -/* */ -/* FreeType auxiliary PostScript module implementation (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psauxmod.c + * + * FreeType auxiliary PostScript module implementation (body). + * + * Copyright (C) 2000-2019 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 diff --git a/src/3rdparty/freetype/src/psaux/psauxmod.h b/src/3rdparty/freetype/src/psaux/psauxmod.h index f30978f022..a0eda0bfc0 100644 --- a/src/3rdparty/freetype/src/psaux/psauxmod.h +++ b/src/3rdparty/freetype/src/psaux/psauxmod.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psauxmod.h */ -/* */ -/* FreeType auxiliary PostScript module implementation (specification). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psauxmod.h + * + * FreeType auxiliary PostScript module implementation (specification). + * + * Copyright (C) 2000-2019 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 PSAUXMOD_H_ @@ -28,10 +28,6 @@ FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif - FT_CALLBACK_TABLE const CFF_Builder_FuncsRec cff_builder_funcs; diff --git a/src/3rdparty/freetype/src/psaux/psblues.c b/src/3rdparty/freetype/src/psaux/psblues.c index ae39d03c77..89738ce474 100644 --- a/src/3rdparty/freetype/src/psaux/psblues.c +++ b/src/3rdparty/freetype/src/psaux/psblues.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psblues.c */ -/* */ -/* Adobe's code for handling Blue Zones (body). */ -/* */ -/* Copyright 2009-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psblues.c + * + * Adobe's code for handling Blue Zones (body). + * + * Copyright 2009-2014 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include "psft.h" @@ -44,14 +44,14 @@ #include "psfont.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cf2blues +#define FT_COMPONENT cf2blues /* @@ -452,13 +452,13 @@ * zones in the same pass (see `BlueLock'). If a hint is captured, * return true and position the edge(s) in one of 3 ways: * - * 1) If `BlueScale' suppresses overshoot, position the captured edge - * at the flat edge of the zone. - * 2) If overshoot is not suppressed and `BlueShift' requires - * overshoot, position the captured edge a minimum of 1 device pixel - * from the flat edge. - * 3) If overshoot is not suppressed or required, position the captured - * edge at the nearest device pixel. + * 1) If `BlueScale' suppresses overshoot, position the captured edge + * at the flat edge of the zone. + * 2) If overshoot is not suppressed and `BlueShift' requires + * overshoot, position the captured edge a minimum of 1 device pixel + * from the flat edge. + * 3) If overshoot is not suppressed or required, position the captured + * edge at the nearest device pixel. * */ FT_LOCAL_DEF( FT_Bool ) diff --git a/src/3rdparty/freetype/src/psaux/psblues.h b/src/3rdparty/freetype/src/psaux/psblues.h index 25ef6849c7..55fb88ecdd 100644 --- a/src/3rdparty/freetype/src/psaux/psblues.h +++ b/src/3rdparty/freetype/src/psaux/psblues.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psblues.h */ -/* */ -/* Adobe's code for handling Blue Zones (specification). */ -/* */ -/* Copyright 2009-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psblues.h + * + * Adobe's code for handling Blue Zones (specification). + * + * Copyright 2009-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ /* diff --git a/src/3rdparty/freetype/src/psaux/psconv.c b/src/3rdparty/freetype/src/psaux/psconv.c index a03385000d..c88761681c 100644 --- a/src/3rdparty/freetype/src/psaux/psconv.c +++ b/src/3rdparty/freetype/src/psaux/psconv.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psconv.c */ -/* */ -/* Some convenience conversions (body). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psconv.c + * + * Some convenience conversions (body). + * + * Copyright (C) 2006-2019 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 @@ -24,14 +24,14 @@ #include "psauxerr.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_psconv +#define FT_COMPONENT psconv /* The following array is used by various functions to quickly convert */ diff --git a/src/3rdparty/freetype/src/psaux/psconv.h b/src/3rdparty/freetype/src/psaux/psconv.h index d643ffcfc2..6b24bf6fc9 100644 --- a/src/3rdparty/freetype/src/psaux/psconv.h +++ b/src/3rdparty/freetype/src/psaux/psconv.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psconv.h */ -/* */ -/* Some convenience conversions (specification). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psconv.h + * + * Some convenience conversions (specification). + * + * Copyright (C) 2006-2019 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 PSCONV_H_ diff --git a/src/3rdparty/freetype/src/psaux/pserror.c b/src/3rdparty/freetype/src/psaux/pserror.c index 9169e5222d..98cebcf74d 100644 --- a/src/3rdparty/freetype/src/psaux/pserror.c +++ b/src/3rdparty/freetype/src/psaux/pserror.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* pserror.c */ -/* */ -/* Adobe's code for error handling (body). */ -/* */ -/* Copyright 2006-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pserror.c + * + * Adobe's code for error handling (body). + * + * Copyright 2006-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include "psft.h" diff --git a/src/3rdparty/freetype/src/psaux/pserror.h b/src/3rdparty/freetype/src/psaux/pserror.h index 13d52062bf..b2156b3318 100644 --- a/src/3rdparty/freetype/src/psaux/pserror.h +++ b/src/3rdparty/freetype/src/psaux/pserror.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* pserror.h */ -/* */ -/* Adobe's code for error handling (specification). */ -/* */ -/* Copyright 2006-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pserror.h + * + * Adobe's code for error handling (specification). + * + * Copyright 2006-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSERROR_H_ diff --git a/src/3rdparty/freetype/src/psaux/psfixed.h b/src/3rdparty/freetype/src/psaux/psfixed.h index 219589e7fc..7dff9ef1bd 100644 --- a/src/3rdparty/freetype/src/psaux/psfixed.h +++ b/src/3rdparty/freetype/src/psaux/psfixed.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psfixed.h */ -/* */ -/* Adobe's code for Fixed Point Mathematics (specification only). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psfixed.h + * + * Adobe's code for Fixed Point Mathematics (specification only). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSFIXED_H_ @@ -72,8 +72,7 @@ FT_BEGIN_HEADER #define cf2_fixedFraction( x ) \ ( (x) - cf2_fixedFloor( x ) ) #define cf2_fracToFixed( x ) \ - ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \ - : ( ( (x) + 0x2000 ) >> 14 ) ) + ( ( (x) + 0x2000 - ( (x) < 0 ) ) >> 14 ) /* signed numeric types */ diff --git a/src/3rdparty/freetype/src/psaux/psfont.c b/src/3rdparty/freetype/src/psaux/psfont.c index dde67a739d..00e4210819 100644 --- a/src/3rdparty/freetype/src/psaux/psfont.c +++ b/src/3rdparty/freetype/src/psaux/psfont.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psfont.c */ -/* */ -/* Adobe's code for font instances (body). */ -/* */ -/* Copyright 2007-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psfont.c + * + * Adobe's code for font instances (body). + * + * Copyright 2007-2014 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include @@ -274,9 +274,6 @@ if ( !font->isT1 ) { - FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; - - /* check for variation vectors */ vstore = cf2_getVStore( decoder ); hasVariations = ( vstore->dataCount != 0 ); @@ -284,6 +281,9 @@ if ( hasVariations ) { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; + + /* check whether Private DICT in this subfont needs to be reparsed */ font->error = cf2_getNormalizedVector( decoder, &lenNormalizedV, @@ -331,7 +331,7 @@ } /* copy hinted flag on each call */ - font->hinted = (FT_Bool)( font->renderingFlags & CF2_FlagsHinted ); + font->hinted = FT_BOOL( font->renderingFlags & CF2_FlagsHinted ); /* determine if transform has changed; */ /* include Fontmatrix but ignore translation */ @@ -366,7 +366,7 @@ if ( font->stemDarkened != ( font->renderingFlags & CF2_FlagsDarkened ) ) { font->stemDarkened = - (FT_Bool)( font->renderingFlags & CF2_FlagsDarkened ); + FT_BOOL( font->renderingFlags & CF2_FlagsDarkened ); /* blue zones depend on darkened flag */ needExtraSetup = TRUE; diff --git a/src/3rdparty/freetype/src/psaux/psfont.h b/src/3rdparty/freetype/src/psaux/psfont.h index e611ac4bdc..8fbacbb6e3 100644 --- a/src/3rdparty/freetype/src/psaux/psfont.h +++ b/src/3rdparty/freetype/src/psaux/psfont.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psfont.h */ -/* */ -/* Adobe's code for font instances (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psfont.h + * + * Adobe's code for font instances (specification). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSFONT_H_ diff --git a/src/3rdparty/freetype/src/psaux/psft.c b/src/3rdparty/freetype/src/psaux/psft.c index 1f750174a1..54be468343 100644 --- a/src/3rdparty/freetype/src/psaux/psft.c +++ b/src/3rdparty/freetype/src/psaux/psft.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psft.c */ -/* */ -/* FreeType Glue Component to Adobe's Interpreter (body). */ -/* */ -/* Copyright 2013-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psft.c + * + * FreeType Glue Component to Adobe's Interpreter (body). + * + * Copyright 2013-2014 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include "psft.h" @@ -120,12 +120,12 @@ } - /********************************************/ - /* */ - /* functions for handling client outline; */ - /* FreeType uses coordinates in 26.6 format */ - /* */ - /********************************************/ + /********************************************* + * + * functions for handling client outline; + * FreeType uses coordinates in 26.6 format + * + */ static void cf2_builder_moveTo( CF2_OutlineCallbacks callbacks, @@ -767,13 +767,14 @@ cf2_freeT1SeacComponent( PS_Decoder* decoder, CF2_Buffer buf ) { +#ifdef FT_CONFIG_OPTION_INCREMENTAL + T1_Face face; FT_Data data; FT_ASSERT( decoder ); -#ifdef FT_CONFIG_OPTION_INCREMENTAL face = (T1_Face)decoder->builder.face; data.pointer = buf->start; @@ -783,7 +784,13 @@ face->root.internal->incremental_interface->funcs->free_glyph_data( face->root.internal->incremental_interface->object, &data ); -#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + +#else /* !FT_CONFIG_OPTION_INCREMENTAL */ + + FT_UNUSED( decoder ); + FT_UNUSED( buf ); + +#endif /* !FT_CONFIG_OPTION_INCREMENTAL */ } diff --git a/src/3rdparty/freetype/src/psaux/psft.h b/src/3rdparty/freetype/src/psaux/psft.h index ab172110bb..4c930f0d73 100644 --- a/src/3rdparty/freetype/src/psaux/psft.h +++ b/src/3rdparty/freetype/src/psaux/psft.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psft.h */ -/* */ -/* FreeType Glue Component to Adobe's Interpreter (specification). */ -/* */ -/* Copyright 2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psft.h + * + * FreeType Glue Component to Adobe's Interpreter (specification). + * + * Copyright 2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSFT_H_ diff --git a/src/3rdparty/freetype/src/psaux/psglue.h b/src/3rdparty/freetype/src/psaux/psglue.h index 5545e12a5b..022aafbfca 100644 --- a/src/3rdparty/freetype/src/psaux/psglue.h +++ b/src/3rdparty/freetype/src/psaux/psglue.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psglue.h */ -/* */ -/* Adobe's code for shared stuff (specification only). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psglue.h + * + * Adobe's code for shared stuff (specification only). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSGLUE_H_ diff --git a/src/3rdparty/freetype/src/psaux/pshints.c b/src/3rdparty/freetype/src/psaux/pshints.c index 3615196425..1cbecd2b19 100644 --- a/src/3rdparty/freetype/src/psaux/pshints.c +++ b/src/3rdparty/freetype/src/psaux/pshints.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* pshints.c */ -/* */ -/* Adobe's code for handling CFF hints (body). */ -/* */ -/* Copyright 2007-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshints.c + * + * Adobe's code for handling CFF hints (body). + * + * Copyright 2007-2014 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include "psft.h" @@ -45,14 +45,14 @@ #include "psintrp.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cf2hints +#define FT_COMPONENT cf2hints typedef struct CF2_HintMoveRec_ @@ -217,52 +217,49 @@ FT_LOCAL_DEF( FT_Bool ) cf2_hint_isValid( const CF2_Hint hint ) { - return (FT_Bool)( hint->flags != 0 ); + return FT_BOOL( hint->flags ); } static FT_Bool cf2_hint_isPair( const CF2_Hint hint ) { - return (FT_Bool)( ( hint->flags & - ( CF2_PairBottom | CF2_PairTop ) ) != 0 ); + return FT_BOOL( hint->flags & ( CF2_PairBottom | CF2_PairTop ) ); } static FT_Bool cf2_hint_isPairTop( const CF2_Hint hint ) { - return (FT_Bool)( ( hint->flags & CF2_PairTop ) != 0 ); + return FT_BOOL( hint->flags & CF2_PairTop ); } FT_LOCAL_DEF( FT_Bool ) cf2_hint_isTop( const CF2_Hint hint ) { - return (FT_Bool)( ( hint->flags & - ( CF2_PairTop | CF2_GhostTop ) ) != 0 ); + return FT_BOOL( hint->flags & ( CF2_PairTop | CF2_GhostTop ) ); } FT_LOCAL_DEF( FT_Bool ) cf2_hint_isBottom( const CF2_Hint hint ) { - return (FT_Bool)( ( hint->flags & - ( CF2_PairBottom | CF2_GhostBottom ) ) != 0 ); + return FT_BOOL( hint->flags & ( CF2_PairBottom | CF2_GhostBottom ) ); } static FT_Bool cf2_hint_isLocked( const CF2_Hint hint ) { - return (FT_Bool)( ( hint->flags & CF2_Locked ) != 0 ); + return FT_BOOL( hint->flags & CF2_Locked ); } static FT_Bool cf2_hint_isSynthetic( const CF2_Hint hint ) { - return (FT_Bool)( ( hint->flags & CF2_Synthetic ) != 0 ); + return FT_BOOL( hint->flags & CF2_Synthetic ); } @@ -334,7 +331,7 @@ cf2_hintmap_map( CF2_HintMap hintmap, CF2_Fixed csCoord ) { - if ( hintmap->count == 0 || ! hintmap->hinted ) + if ( hintmap->count == 0 || !hintmap->hinted ) { /* there are no hints; use uniform scale and zero offset */ return FT_MulFix( csCoord, hintmap->scale ); @@ -497,7 +494,7 @@ { move = moveDown; /* true if non-optimum move */ - saveEdge = (FT_Bool)( moveUp < -moveDown ); + saveEdge = FT_BOOL( moveUp < -moveDown ); } else { @@ -1025,10 +1022,10 @@ } } - FT_TRACE6(( initialMap ? "flags: [p]air [g]host [t]op " - "[b]ottom [L]ocked [S]ynthetic\n" - "Initial hintmap\n" - : "Hints:\n" )); + 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 ); /* @@ -1215,7 +1212,7 @@ * (`u'). * * See notation in - * http://softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm. + * http://geomalgorithms.com/a05-_intersect-1.html. * Calculations are done in 16.16, but must handle the squaring of * line lengths in character space. We scale all vectors by 1/32 to * avoid overflow. This allows values up to 4095 to be squared. The diff --git a/src/3rdparty/freetype/src/psaux/pshints.h b/src/3rdparty/freetype/src/psaux/pshints.h index 92e37e98ae..31a8230364 100644 --- a/src/3rdparty/freetype/src/psaux/pshints.h +++ b/src/3rdparty/freetype/src/psaux/pshints.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* pshints.h */ -/* */ -/* Adobe's code for handling CFF hints (body). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshints.h + * + * Adobe's code for handling CFF hints (body). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSHINT_H_ diff --git a/src/3rdparty/freetype/src/psaux/psintrp.c b/src/3rdparty/freetype/src/psaux/psintrp.c index da5a8dad1d..e2f3accdd5 100644 --- a/src/3rdparty/freetype/src/psaux/psintrp.c +++ b/src/3rdparty/freetype/src/psaux/psintrp.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psintrp.c */ -/* */ -/* Adobe's CFF Interpreter (body). */ -/* */ -/* Copyright 2007-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psintrp.c + * + * Adobe's CFF Interpreter (body). + * + * Copyright 2007-2014 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include "psft.h" @@ -52,14 +52,14 @@ #include "t1decode.h" /* for t1 seac */ - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_cf2interp +#define FT_COMPONENT cf2interp FT_LOCAL_DEF( void ) @@ -287,7 +287,7 @@ { CF2_UInt i; CF2_UInt count = cf2_stack_count( opStack ); - FT_Bool hasWidthArg = (FT_Bool)( count & 1 ); + FT_Bool hasWidthArg = FT_BOOL( count & 1 ); /* variable accumulates delta values from operand stack */ CF2_Fixed position = hintOffset; @@ -364,7 +364,7 @@ if ( doConditionalLastRead ) { - FT_Bool lastIsX = (FT_Bool)( + FT_Bool lastIsX = FT_BOOL( cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) > cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) ); CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx ); @@ -612,14 +612,14 @@ cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 ); charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack ); - *charstring = *buf; /* structure copy */ - - charstringIndex = 0; /* entry is valid now */ /* catch errors so far */ if ( *error ) goto exit; + *charstring = *buf; /* structure copy */ + charstringIndex = 0; /* entry is valid now */ + /* main interpreter loop */ while ( 1 ) { @@ -663,6 +663,7 @@ /* Skip outline commands first time round. */ /* `endchar' will trigger initial hintmap build */ /* and rewind the charstring. */ + FT_TRACE4(( " \n" )); cf2_stack_clear( opStack ); continue; } @@ -775,7 +776,8 @@ case cf2_cmdHSTEMHM: case cf2_cmdHSTEM: - FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" )); + FT_TRACE4(( "%s\n", op1 == cf2_cmdHSTEMHM ? " hstemhm" + : " hstem" )); if ( !font->isT1 ) { @@ -805,7 +807,8 @@ case cf2_cmdVSTEMHM: case cf2_cmdVSTEM: - FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" )); + FT_TRACE4(( "%s\n", op1 == cf2_cmdVSTEMHM ? " vstemhm" + : " vstem" )); if ( !font->isT1 ) { @@ -888,7 +891,7 @@ FT_Bool isX = FT_BOOL( op1 == cf2_cmdHLINETO ); - FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" )); + FT_TRACE4(( "%s\n", isX ? " hlineto" : " vlineto" )); for ( idx = 0; idx < count; idx++ ) { @@ -916,8 +919,8 @@ CF2_UInt idx = 0; - FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n" - : " rrcurveto\n" )); + FT_TRACE4(( "%s\n", op1 == cf2_cmdRCURVELINE ? " rcurveline" + : " rrcurveto" )); while ( idx + 6 <= count ) { @@ -957,10 +960,10 @@ FT_TRACE4(( " unknown op (%d)\n", op1 )); else { - FT_TRACE4(( " closepath" )); + FT_TRACE4(( " closepath\n" )); /* if there is no path, `closepath' is a no-op */ - ps_builder_close_contour( &decoder->builder ); + cf2_glyphpath_closeOpenPath( &glyphPath ); haveWidth = TRUE; } @@ -972,8 +975,8 @@ CF2_Int subrNum; - FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr" - : " callsubr" )); + FT_TRACE4(( "%s", op1 == cf2_cmdCALLGSUBR ? " callgsubr" + : " callsubr" )); if ( ( !font->isT1 && charstringIndex > CF2_MAX_SUBR ) || ( font->isT1 && charstringIndex > T1_MAX_SUBRS_CALLS ) ) @@ -1212,8 +1215,8 @@ FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 ); - FT_TRACE4(( isV ? " vstem3\n" - : " hstem3\n" )); + FT_TRACE4(( "%s\n", isV ? " vstem3" + : " hstem3" )); FT_ASSERT( cf2_stack_count( opStack ) == 6 ); @@ -1644,16 +1647,17 @@ subr_no = cf2_stack_popInt( opStack ); arg_cnt = cf2_stack_popInt( opStack ); - /*******************************************************/ - /* */ - /* remove all operands to callothersubr from the stack */ - /* */ - /* for handled othersubrs, where we know the number of */ - /* arguments, we increase the stack by the value of */ - /* known_othersubr_result_cnt */ - /* */ - /* for unhandled othersubrs the following pops adjust */ - /* the stack pointer as necessary */ + /******************************************************** + * + * remove all operands to callothersubr from the stack + * + * for handled othersubrs, where we know the number of + * arguments, we increase the stack by the value of + * known_othersubr_result_cnt + * + * for unhandled othersubrs the following pops adjust + * the stack pointer as necessary + */ count = cf2_stack_count( opStack ); FT_ASSERT( (CF2_UInt)arg_cnt <= count ); @@ -2416,7 +2420,7 @@ PS_Builder* builder; - FT_TRACE4(( " hsbw" )); + FT_TRACE4(( " hsbw\n" )); builder = &decoder->builder; @@ -2562,7 +2566,7 @@ case cf2_cmdHINTMASK: /* the final \n in the tracing message gets added in */ /* `cf2_hintmask_read' (which also traces the mask bytes) */ - FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" )); + FT_TRACE4(( "%s", op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" )); /* never add hints after the mask is computed */ if ( cf2_stack_count( opStack ) > 1 && @@ -2828,7 +2832,7 @@ count = count1 & ~2U; idx += count1 - count; - FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" )); + FT_TRACE4(( "%s\n", alternate ? " hvcurveto" : " vhcurveto" )); while ( idx < count ) { diff --git a/src/3rdparty/freetype/src/psaux/psintrp.h b/src/3rdparty/freetype/src/psaux/psintrp.h index 4790aaa302..669c09c0ae 100644 --- a/src/3rdparty/freetype/src/psaux/psintrp.h +++ b/src/3rdparty/freetype/src/psaux/psintrp.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psintrp.h */ -/* */ -/* Adobe's CFF Interpreter (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psintrp.h + * + * Adobe's CFF Interpreter (specification). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSINTRP_H_ diff --git a/src/3rdparty/freetype/src/psaux/psobjs.c b/src/3rdparty/freetype/src/psaux/psobjs.c index f54bc7e416..8bfdb92332 100644 --- a/src/3rdparty/freetype/src/psaux/psobjs.c +++ b/src/3rdparty/freetype/src/psaux/psobjs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psobjs.c */ -/* */ -/* Auxiliary functions for PostScript fonts (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psobjs.c + * + * Auxiliary functions for PostScript fonts (body). + * + * Copyright (C) 1996-2019 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 @@ -29,14 +29,14 @@ #include "psauxmod.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_psobjs +#define FT_COMPONENT psobjs /*************************************************************************/ @@ -47,26 +47,29 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* ps_table_new */ - /* */ - /* */ - /* Initializes a PS_Table. */ - /* */ - /* */ - /* table :: The address of the target table. */ - /* */ - /* */ - /* count :: The table size = the maximum number of elements. */ - /* */ - /* memory :: The memory object to use for all subsequent */ - /* reallocations. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * ps_table_new + * + * @Description: + * Initializes a PS_Table. + * + * @InOut: + * table :: + * The address of the target table. + * + * @Input: + * count :: + * The table size = the maximum number of elements. + * + * memory :: + * The memory object to use for all subsequent + * reallocations. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) ps_table_new( PS_Table table, FT_Int count, @@ -144,33 +147,37 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ps_table_add */ - /* */ - /* */ - /* Adds an object to a PS_Table, possibly growing its memory block. */ - /* */ - /* */ - /* table :: The target table. */ - /* */ - /* */ - /* idx :: The index of the object in the table. */ - /* */ - /* object :: The address of the object to copy in memory. */ - /* */ - /* length :: The length in bytes of the source object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. An error is returned if a */ - /* reallocation fails. */ - /* */ + /************************************************************************** + * + * @Function: + * ps_table_add + * + * @Description: + * Adds an object to a PS_Table, possibly growing its memory block. + * + * @InOut: + * table :: + * The target table. + * + * @Input: + * idx :: + * The index of the object in the table. + * + * object :: + * The address of the object to copy in memory. + * + * length :: + * The length in bytes of the source object. + * + * @Return: + * FreeType error code. 0 means success. An error is returned if a + * reallocation fails. + */ FT_LOCAL_DEF( FT_Error ) - ps_table_add( PS_Table table, - FT_Int idx, - void* object, - FT_UInt length ) + ps_table_add( PS_Table table, + FT_Int idx, + const void* object, + FT_UInt length ) { if ( idx < 0 || idx >= table->max_elems ) { @@ -216,22 +223,23 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ps_table_done */ - /* */ - /* */ - /* Finalizes a PS_TableRec (i.e., reallocate it to its current */ - /* cursor). */ - /* */ - /* */ - /* table :: The target table. */ - /* */ - /* */ - /* This function does NOT release the heap's memory block. It is up */ - /* to the caller to clean it, or reference it in its own structures. */ - /* */ + /************************************************************************** + * + * @Function: + * ps_table_done + * + * @Description: + * Finalizes a PS_TableRec (i.e., reallocate it to its current + * cursor). + * + * @InOut: + * table :: + * The target table. + * + * @Note: + * This function does NOT release the heap's memory block. It is up + * to the caller to clean it, or reference it in its own structures. + */ FT_LOCAL_DEF( void ) ps_table_done( PS_Table table ) { @@ -498,12 +506,12 @@ } - /***********************************************************************/ - /* */ - /* All exported parsing routines handle leading whitespace and stop at */ - /* the first character which isn't part of the just handled token. */ - /* */ - /***********************************************************************/ + /************************************************************************ + * + * All exported parsing routines handle leading whitespace and stop at + * the first character which isn't part of the just handled token. + * + */ FT_LOCAL_DEF( void ) @@ -1100,18 +1108,22 @@ { case T1_FIELD_TYPE_BOOL: val = ps_tobool( &cur, limit ); + FT_TRACE4(( " %s", val ? "true" : "false" )); goto Store_Integer; case T1_FIELD_TYPE_FIXED: val = PS_Conv_ToFixed( &cur, limit, 0 ); + FT_TRACE4(( " %f", (double)val / 65536 )); goto Store_Integer; case T1_FIELD_TYPE_FIXED_1000: val = PS_Conv_ToFixed( &cur, limit, 3 ); + FT_TRACE4(( " %f", (double)val / 65536 / 1000 )); goto Store_Integer; case T1_FIELD_TYPE_INTEGER: val = PS_Conv_ToInt( &cur, limit ); + FT_TRACE4(( " %ld", val )); /* fall through */ Store_Integer: @@ -1188,6 +1200,13 @@ FT_MEM_COPY( string, cur, len ); string[len] = 0; +#ifdef FT_DEBUG_LEVEL_TRACE + if ( token.type == T1_TOKEN_TYPE_STRING ) + FT_TRACE4(( " (%s)", string )); + else + FT_TRACE4(( " /%s", string )); +#endif + *(FT_String**)q = string; } break; @@ -1213,6 +1232,12 @@ bbox->yMin = FT_RoundFix( temp[1] ); bbox->xMax = FT_RoundFix( temp[2] ); bbox->yMax = FT_RoundFix( temp[3] ); + + FT_TRACE4(( " [%d %d %d %d]", + bbox->xMin / 65536, + bbox->yMin / 65536, + bbox->xMax / 65536, + bbox->yMax / 65536 )); } break; @@ -1251,6 +1276,7 @@ skip_spaces( &cur, limit ); } + FT_TRACE4(( " [" )); for ( i = 0; i < max_objects; i++ ) { FT_BBox* bbox = (FT_BBox*)objects[i]; @@ -1260,7 +1286,14 @@ bbox->yMin = FT_RoundFix( temp[i + max_objects] ); bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] ); bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] ); + + FT_TRACE4(( " [%d %d %d %d]", + bbox->xMin / 65536, + bbox->yMin / 65536, + bbox->xMax / 65536, + bbox->yMax / 65536 )); } + FT_TRACE4(( "]" )); FT_FREE( temp ); } @@ -1333,6 +1366,8 @@ *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) = (FT_Byte)num_elements; + FT_TRACE4(( " [" )); + /* we now load each element, adjusting the field.offset on each one */ token = elements; for ( ; num_elements > 0; num_elements--, token++ ) @@ -1351,6 +1386,8 @@ fieldrec.offset += fieldrec.size; } + FT_TRACE4(( "]" )); + #if 0 /* obsolete -- keep for reference */ if ( pflags ) *pflags |= 1L << field->flag_bit; @@ -1410,6 +1447,8 @@ bytes, max_bytes ); + parser->cursor = cur; + if ( delimiters ) { if ( cur < parser->limit && *cur != '>' ) @@ -1419,11 +1458,9 @@ goto Exit; } - cur++; + parser->cursor++; } - parser->cursor = cur; - Exit: return error; } @@ -1509,26 +1546,31 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* t1_builder_init */ - /* */ - /* */ - /* Initializes a given glyph builder. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* glyph :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting should be applied. */ - /* */ + /************************************************************************** + * + * @Function: + * t1_builder_init + * + * @Description: + * Initializes a given glyph builder. + * + * @InOut: + * builder :: + * A pointer to the glyph builder to initialize. + * + * @Input: + * face :: + * The current face object. + * + * size :: + * The current size object. + * + * glyph :: + * The current glyph object. + * + * hinting :: + * Whether hinting should be applied. + */ FT_LOCAL_DEF( void ) t1_builder_init( T1_Builder builder, FT_Face face, @@ -1572,19 +1614,20 @@ } - /*************************************************************************/ - /* */ - /* */ - /* t1_builder_done */ - /* */ - /* */ - /* Finalizes a given glyph builder. Its contents can still be used */ - /* after the call, but the function saves important information */ - /* within the corresponding glyph slot. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to finalize. */ - /* */ + /************************************************************************** + * + * @Function: + * t1_builder_done + * + * @Description: + * Finalizes a given glyph builder. Its contents can still be used + * after the call, but the function saves important information + * within the corresponding glyph slot. + * + * @Input: + * builder :: + * A pointer to the glyph builder to finalize. + */ FT_LOCAL_DEF( void ) t1_builder_done( T1_Builder builder ) { @@ -1769,26 +1812,31 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* cff_builder_init */ - /* */ - /* */ - /* Initializes a given glyph builder. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* glyph :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting is active. */ - /* */ + /************************************************************************** + * + * @Function: + * cff_builder_init + * + * @Description: + * Initializes a given glyph builder. + * + * @InOut: + * builder :: + * A pointer to the glyph builder to initialize. + * + * @Input: + * face :: + * The current face object. + * + * size :: + * The current size object. + * + * glyph :: + * The current glyph object. + * + * hinting :: + * Whether hinting is active. + */ FT_LOCAL_DEF( void ) cff_builder_init( CFF_Builder* builder, TT_Face face, @@ -1841,19 +1889,20 @@ } - /*************************************************************************/ - /* */ - /* */ - /* cff_builder_done */ - /* */ - /* */ - /* Finalizes a given glyph builder. Its contents can still be used */ - /* after the call, but the function saves important information */ - /* within the corresponding glyph slot. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to finalize. */ - /* */ + /************************************************************************** + * + * @Function: + * cff_builder_done + * + * @Description: + * Finalizes a given glyph builder. Its contents can still be used + * after the call, but the function saves important information + * within the corresponding glyph slot. + * + * @Input: + * builder :: + * A pointer to the glyph builder to finalize. + */ FT_LOCAL_DEF( void ) cff_builder_done( CFF_Builder* builder ) { @@ -1993,6 +2042,14 @@ first = outline->n_contours <= 1 ? 0 : outline->contours[outline->n_contours - 2] + 1; + /* in malformed fonts it can happen that a contour was started */ + /* but no points were added */ + if ( outline->n_contours && first == outline->n_points ) + { + outline->n_contours--; + return; + } + /* We must not include the last point in the path if it */ /* is located on the first point. */ if ( outline->n_points > 1 ) @@ -2033,26 +2090,31 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* ps_builder_init */ - /* */ - /* */ - /* Initializes a given glyph builder. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* glyph :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting should be applied. */ - /* */ + /************************************************************************** + * + * @Function: + * ps_builder_init + * + * @Description: + * Initializes a given glyph builder. + * + * @InOut: + * builder :: + * A pointer to the glyph builder to initialize. + * + * @Input: + * face :: + * The current face object. + * + * size :: + * The current size object. + * + * glyph :: + * The current glyph object. + * + * hinting :: + * Whether hinting should be applied. + */ FT_LOCAL_DEF( void ) ps_builder_init( PS_Builder* ps_builder, void* builder, @@ -2116,19 +2178,20 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ps_builder_done */ - /* */ - /* */ - /* Finalizes a given glyph builder. Its contents can still be used */ - /* after the call, but the function saves important information */ - /* within the corresponding glyph slot. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to finalize. */ - /* */ + /************************************************************************** + * + * @Function: + * ps_builder_done + * + * @Description: + * Finalizes a given glyph builder. Its contents can still be used + * after the call, but the function saves important information + * within the corresponding glyph slot. + * + * @Input: + * builder :: + * A pointer to the glyph builder to finalize. + */ FT_LOCAL_DEF( void ) ps_builder_done( PS_Builder* builder ) { @@ -2336,23 +2399,26 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* ps_decoder_init */ - /* */ - /* */ - /* Creates a wrapper decoder for use in the combined */ - /* Type 1 / CFF interpreter. */ - /* */ - /* */ - /* ps_decoder :: A pointer to the decoder to initialize. */ - /* */ - /* */ - /* decoder :: A pointer to the original decoder. */ - /* */ - /* is_t1 :: Flag indicating Type 1 or CFF */ - /* */ + /************************************************************************** + * + * @Function: + * ps_decoder_init + * + * @Description: + * Creates a wrapper decoder for use in the combined + * Type 1 / CFF interpreter. + * + * @InOut: + * ps_decoder :: + * A pointer to the decoder to initialize. + * + * @Input: + * decoder :: + * A pointer to the original decoder. + * + * is_t1 :: + * Flag indicating Type 1 or CFF + */ FT_LOCAL_DEF( void ) ps_decoder_init( PS_Decoder* ps_decoder, void* decoder, diff --git a/src/3rdparty/freetype/src/psaux/psobjs.h b/src/3rdparty/freetype/src/psaux/psobjs.h index 8e0fe5fa4c..c44dc450ec 100644 --- a/src/3rdparty/freetype/src/psaux/psobjs.h +++ b/src/3rdparty/freetype/src/psaux/psobjs.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psobjs.h */ -/* */ -/* Auxiliary functions for PostScript fonts (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psobjs.h + * + * Auxiliary functions for PostScript fonts (specification). + * + * Copyright (C) 1996-2019 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 PSOBJS_H_ @@ -53,10 +53,10 @@ FT_BEGIN_HEADER FT_Memory memory ); FT_LOCAL( FT_Error ) - ps_table_add( PS_Table table, - FT_Int idx, - void* object, - FT_UInt length ); + ps_table_add( PS_Table table, + FT_Int idx, + const void* object, + FT_UInt length ); FT_LOCAL( void ) ps_table_done( PS_Table table ); diff --git a/src/3rdparty/freetype/src/psaux/psread.c b/src/3rdparty/freetype/src/psaux/psread.c index 719863ce17..86bfc03c6e 100644 --- a/src/3rdparty/freetype/src/psaux/psread.c +++ b/src/3rdparty/freetype/src/psaux/psread.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psread.c */ -/* */ -/* Adobe's code for stream handling (body). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psread.c + * + * Adobe's code for stream handling (body). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include "psft.h" @@ -105,7 +105,7 @@ FT_LOCAL_DEF( FT_Bool ) cf2_buf_isEnd( CF2_Buffer buf ) { - return (FT_Bool)( buf->ptr >= buf->end ); + return FT_BOOL( buf->ptr >= buf->end ); } diff --git a/src/3rdparty/freetype/src/psaux/psread.h b/src/3rdparty/freetype/src/psaux/psread.h index 464b29ba74..9e55fe0447 100644 --- a/src/3rdparty/freetype/src/psaux/psread.h +++ b/src/3rdparty/freetype/src/psaux/psread.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psread.h */ -/* */ -/* Adobe's code for stream handling (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psread.h + * + * Adobe's code for stream handling (specification). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSREAD_H_ diff --git a/src/3rdparty/freetype/src/psaux/psstack.c b/src/3rdparty/freetype/src/psaux/psstack.c index 69d063349a..6659068001 100644 --- a/src/3rdparty/freetype/src/psaux/psstack.c +++ b/src/3rdparty/freetype/src/psaux/psstack.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psstack.c */ -/* */ -/* Adobe's code for emulating a CFF stack (body). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psstack.c + * + * Adobe's code for emulating a CFF stack (body). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #include "psft.h" @@ -258,6 +258,9 @@ return; } + /* before C99 it is implementation-defined whether */ + /* the result of `%' is negative if the first operand */ + /* is negative */ if ( shift < 0 ) shift = -( ( -shift ) % count ); else diff --git a/src/3rdparty/freetype/src/psaux/psstack.h b/src/3rdparty/freetype/src/psaux/psstack.h index 38f7b41c68..18cd39bc6a 100644 --- a/src/3rdparty/freetype/src/psaux/psstack.h +++ b/src/3rdparty/freetype/src/psaux/psstack.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* psstack.h */ -/* */ -/* Adobe's code for emulating a CFF stack (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psstack.h + * + * Adobe's code for emulating a CFF stack (specification). + * + * Copyright 2007-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSSTACK_H_ diff --git a/src/3rdparty/freetype/src/psaux/pstypes.h b/src/3rdparty/freetype/src/psaux/pstypes.h index dfbaa3d475..041287e8d5 100644 --- a/src/3rdparty/freetype/src/psaux/pstypes.h +++ b/src/3rdparty/freetype/src/psaux/pstypes.h @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* pstypes.h */ -/* */ -/* Adobe's code for defining data types (specification only). */ -/* */ -/* Copyright 2011-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pstypes.h + * + * Adobe's code for defining data types (specification only). + * + * Copyright 2011-2013 Adobe Systems Incorporated. + * + * This software, and all works of authorship, whether in source or + * object code form as indicated by the copyright notice(s) included + * herein (collectively, the "Work") is made available, and may only be + * used, modified, and distributed under the FreeType Project License, + * LICENSE.TXT. Additionally, subject to the terms and conditions of the + * FreeType Project License, each contributor to the Work hereby grants + * to any individual or legal entity exercising permissions granted by + * the FreeType Project License and this section (hereafter, "You" or + * "Your") a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except as stated in this section) patent + * license to make, have made, use, offer to sell, sell, import, and + * otherwise transfer the Work, where such license applies only to those + * patent claims licensable by such contributor that are necessarily + * infringed by their contribution(s) alone or by combination of their + * contribution(s) with the Work to which such contribution(s) was + * submitted. If You institute patent litigation against any entity + * (including a cross-claim or counterclaim in a lawsuit) alleging that + * the Work or a contribution incorporated within the Work constitutes + * direct or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate as of + * the date such litigation is filed. + * + * By using, modifying, or distributing the Work you indicate that you + * have read and understood the terms and conditions of the + * FreeType Project License as well as those provided in this section, + * and you accept them fully. + * + */ #ifndef PSTYPES_H_ diff --git a/src/3rdparty/freetype/src/psaux/rules.mk b/src/3rdparty/freetype/src/psaux/rules.mk index a87bfe9687..2de734d547 100644 --- a/src/3rdparty/freetype/src/psaux/rules.mk +++ b/src/3rdparty/freetype/src/psaux/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/psaux/t1cmap.c b/src/3rdparty/freetype/src/psaux/t1cmap.c index 112a7892ba..d62d2d5c81 100644 --- a/src/3rdparty/freetype/src/psaux/t1cmap.c +++ b/src/3rdparty/freetype/src/psaux/t1cmap.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1cmap.c */ -/* */ -/* Type 1 character map support (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1cmap.c + * + * Type 1 character map support (body). + * + * Copyright (C) 2002-2019 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 "t1cmap.h" @@ -305,6 +305,9 @@ FT_UNUSED( pointer ); + if ( !psnames->unicodes_init ) + return FT_THROW( Unimplemented_Feature ); + return psnames->unicodes_init( memory, unicodes, (FT_UInt)face->type1.num_glyphs, diff --git a/src/3rdparty/freetype/src/psaux/t1cmap.h b/src/3rdparty/freetype/src/psaux/t1cmap.h index 4308e31d2d..d325e7b5a6 100644 --- a/src/3rdparty/freetype/src/psaux/t1cmap.h +++ b/src/3rdparty/freetype/src/psaux/t1cmap.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1cmap.h */ -/* */ -/* Type 1 character map support (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1cmap.h + * + * Type 1 character map support (specification). + * + * Copyright (C) 2002-2019 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 T1CMAP_H_ diff --git a/src/3rdparty/freetype/src/psaux/t1decode.c b/src/3rdparty/freetype/src/psaux/t1decode.c index 6ad145661f..c2b3729b53 100644 --- a/src/3rdparty/freetype/src/psaux/t1decode.c +++ b/src/3rdparty/freetype/src/psaux/t1decode.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1decode.c */ -/* */ -/* PostScript Type 1 decoding routines (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1decode.c + * + * PostScript Type 1 decoding routines (body). + * + * Copyright (C) 2000-2019 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 @@ -31,14 +31,14 @@ /* ensure proper sign extension */ #define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) ) - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_t1decode +#define FT_COMPONENT t1decode typedef enum T1_Operator_ @@ -109,24 +109,26 @@ }; - /*************************************************************************/ - /* */ - /* */ - /* t1_lookup_glyph_by_stdcharcode_ps */ - /* */ - /* */ - /* Looks up a given glyph by its StandardEncoding charcode. Used to */ - /* implement the SEAC Type 1 operator in the Adobe engine */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* charcode :: The character code to look for. */ - /* */ - /* */ - /* A glyph index in the font face. Returns -1 if the corresponding */ - /* glyph wasn't found. */ - /* */ + /************************************************************************** + * + * @Function: + * t1_lookup_glyph_by_stdcharcode_ps + * + * @Description: + * Looks up a given glyph by its StandardEncoding charcode. Used to + * implement the SEAC Type 1 operator in the Adobe engine + * + * @Input: + * face :: + * The current face object. + * + * charcode :: + * The character code to look for. + * + * @Return: + * A glyph index in the font face. Returns -1 if the corresponding + * glyph wasn't found. + */ FT_LOCAL_DEF( FT_Int ) t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder, FT_Int charcode ) @@ -159,24 +161,27 @@ #ifdef T1_CONFIG_OPTION_OLD_ENGINE - /*************************************************************************/ - /* */ - /* */ - /* t1_lookup_glyph_by_stdcharcode */ - /* */ - /* */ - /* Looks up a given glyph by its StandardEncoding charcode. Used to */ - /* implement the SEAC Type 1 operator. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* charcode :: The character code to look for. */ - /* */ - /* */ - /* A glyph index in the font face. Returns -1 if the corresponding */ - /* glyph wasn't found. */ - /* */ + + /************************************************************************** + * + * @Function: + * t1_lookup_glyph_by_stdcharcode + * + * @Description: + * Looks up a given glyph by its StandardEncoding charcode. Used to + * implement the SEAC Type 1 operator. + * + * @Input: + * face :: + * The current face object. + * + * charcode :: + * The character code to look for. + * + * @Return: + * A glyph index in the font face. Returns -1 if the corresponding + * glyph wasn't found. + */ static FT_Int t1_lookup_glyph_by_stdcharcode( T1_Decoder decoder, FT_Int charcode ) @@ -217,30 +222,36 @@ } - /*************************************************************************/ - /* */ - /* */ - /* t1operator_seac */ - /* */ - /* */ - /* Implements the `seac' Type 1 operator for a Type 1 decoder. */ - /* */ - /* */ - /* decoder :: The current CID decoder. */ - /* */ - /* asb :: The accent's side bearing. */ - /* */ - /* adx :: The horizontal offset of the accent. */ - /* */ - /* ady :: The vertical offset of the accent. */ - /* */ - /* bchar :: The base character's StandardEncoding charcode. */ - /* */ - /* achar :: The accent character's StandardEncoding charcode. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * t1operator_seac + * + * @Description: + * Implements the `seac' Type 1 operator for a Type 1 decoder. + * + * @Input: + * decoder :: + * The current CID decoder. + * + * asb :: + * The accent's side bearing. + * + * adx :: + * The horizontal offset of the accent. + * + * ady :: + * The vertical offset of the accent. + * + * bchar :: + * The base character's StandardEncoding charcode. + * + * achar :: + * The accent character's StandardEncoding charcode. + * + * @Return: + * FreeType error code. 0 means success. + */ static FT_Error t1operator_seac( T1_Decoder decoder, FT_Pos asb, @@ -399,24 +410,27 @@ } - /*************************************************************************/ - /* */ - /* */ - /* t1_decoder_parse_charstrings */ - /* */ - /* */ - /* Parses a given Type 1 charstrings program. */ - /* */ - /* */ - /* decoder :: The current Type 1 decoder. */ - /* */ - /* charstring_base :: The base address of the charstring stream. */ - /* */ - /* charstring_len :: The length in bytes of the charstring stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * t1_decoder_parse_charstrings + * + * @Description: + * Parses a given Type 1 charstrings program. + * + * @Input: + * decoder :: + * The current Type 1 decoder. + * + * charstring_base :: + * The base address of the charstring stream. + * + * charstring_len :: + * The length in bytes of the charstring stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) t1_decoder_parse_charstrings( T1_Decoder decoder, FT_Byte* charstring_base, @@ -466,9 +480,6 @@ if ( decoder->buildchar && decoder->len_buildchar > 0 ) FT_ARRAY_ZERO( decoder->buildchar, decoder->len_buildchar ); - FT_TRACE4(( "\n" - "Start charstring\n" )); - zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; @@ -503,11 +514,11 @@ } #endif - /*********************************************************************/ - /* */ - /* Decode operator or operand */ - /* */ - /* */ + /********************************************************************** + * + * Decode operator or operand + * + */ /* first of all, decompress operator or value */ switch ( *ip++ ) @@ -710,11 +721,11 @@ large_int = FALSE; } - /*********************************************************************/ - /* */ - /* Push value on stack, or process operator */ - /* */ - /* */ + /********************************************************************** + * + * Push value on stack, or process operator + * + */ if ( op == op_none ) { if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS ) @@ -752,16 +763,17 @@ subr_no = Fix2Int( top[1] ); arg_cnt = Fix2Int( top[0] ); - /***********************************************************/ - /* */ - /* remove all operands to callothersubr from the stack */ - /* */ - /* for handled othersubrs, where we know the number of */ - /* arguments, we increase the stack by the value of */ - /* known_othersubr_result_cnt */ - /* */ - /* for unhandled othersubrs the following pops adjust the */ - /* stack pointer as necessary */ + /************************************************************ + * + * remove all operands to callothersubr from the stack + * + * for handled othersubrs, where we know the number of + * arguments, we increase the stack by the value of + * known_othersubr_result_cnt + * + * for unhandled othersubrs the following pops adjust the + * stack pointer as necessary + */ if ( arg_cnt > top - decoder->stack ) goto Stack_Underflow; @@ -1223,7 +1235,10 @@ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) + { + FT_TRACE4(( "\n" )); return FT_Err_Ok; + } break; @@ -1255,7 +1270,10 @@ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) + { + FT_TRACE4(( "\n" )); return FT_Err_Ok; + } break; @@ -1638,26 +1656,31 @@ return FT_THROW( Stack_Underflow ); } -#else /* T1_CONFIG_OPTION_OLD_ENGINE */ - - /*************************************************************************/ - /* */ - /* */ - /* t1_decoder_parse_metrics */ - /* */ - /* */ - /* Parses a given Type 1 charstrings program to extract width */ - /* */ - /* */ - /* decoder :: The current Type 1 decoder. */ - /* */ - /* charstring_base :: The base address of the charstring stream. */ - /* */ - /* charstring_len :: The length in bytes of the charstring stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + +#else /* !T1_CONFIG_OPTION_OLD_ENGINE */ + + + /************************************************************************** + * + * @Function: + * t1_decoder_parse_metrics + * + * @Description: + * Parses a given Type 1 charstrings program to extract width + * + * @Input: + * decoder :: + * The current Type 1 decoder. + * + * charstring_base :: + * The base address of the charstring stream. + * + * charstring_len :: + * The length in bytes of the charstring stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) t1_decoder_parse_metrics( T1_Decoder decoder, FT_Byte* charstring_base, @@ -1680,9 +1703,6 @@ builder->parse_state = T1_Parse_Start; - FT_TRACE4(( "\n" - "Start charstring: get width\n" )); - zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; @@ -1703,11 +1723,11 @@ } #endif - /*********************************************************************/ - /* */ - /* Decode operator or operand */ - /* */ - /* */ + /********************************************************************** + * + * Decode operator or operand + * + */ /* first of all, decompress operator or value */ switch ( *ip++ ) @@ -1817,11 +1837,11 @@ } } - /*********************************************************************/ - /* */ - /* Push value on stack, or process operator */ - /* */ - /* */ + /********************************************************************** + * + * Push value on stack, or process operator + * + */ if ( op == op_none ) { if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS ) @@ -1875,6 +1895,7 @@ /* we only want to compute the glyph's metrics */ /* (lsb + advance width), not load the rest of */ /* it; so exit immediately */ + FT_TRACE4(( "\n" )); return FT_Err_Ok; case op_sbw: @@ -1893,6 +1914,7 @@ /* we only want to compute the glyph's metrics */ /* (lsb + advance width), not load the rest of */ /* it; so exit immediately */ + FT_TRACE4(( "\n" )); return FT_Err_Ok; default: @@ -1917,7 +1939,8 @@ Stack_Underflow: return FT_THROW( Stack_Underflow ); } -#endif /* T1_CONFIG_OPTION_OLD_ENGINE */ + +#endif /* !T1_CONFIG_OPTION_OLD_ENGINE */ /* initialize T1 decoder */ @@ -1934,7 +1957,7 @@ { FT_ZERO( decoder ); - /* retrieve PSNames interface from list of current modules */ + /* retrieve `psnames' interface from list of current modules */ { FT_Service_PsCMaps psnames; diff --git a/src/3rdparty/freetype/src/psaux/t1decode.h b/src/3rdparty/freetype/src/psaux/t1decode.h index 1d9718d678..1b5d6263d3 100644 --- a/src/3rdparty/freetype/src/psaux/t1decode.h +++ b/src/3rdparty/freetype/src/psaux/t1decode.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1decode.h */ -/* */ -/* PostScript Type 1 decoding routines (specification). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1decode.h + * + * PostScript Type 1 decoding routines (specification). + * + * Copyright (C) 2000-2019 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 T1DECODE_H_ diff --git a/src/3rdparty/freetype/src/pshinter/Jamfile b/src/3rdparty/freetype/src/pshinter/Jamfile index 3f5f0ae40e..0e44c19148 100644 --- a/src/3rdparty/freetype/src/pshinter/Jamfile +++ b/src/3rdparty/freetype/src/pshinter/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pshinter Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/pshinter/module.mk b/src/3rdparty/freetype/src/pshinter/module.mk index 06707be3b4..0a12a260e1 100644 --- a/src/3rdparty/freetype/src/pshinter/module.mk +++ b/src/3rdparty/freetype/src/pshinter/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/pshinter/pshalgo.c b/src/3rdparty/freetype/src/pshinter/pshalgo.c index b98077c62e..0c5ae62699 100644 --- a/src/3rdparty/freetype/src/pshinter/pshalgo.c +++ b/src/3rdparty/freetype/src/pshinter/pshalgo.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pshalgo.c */ -/* */ -/* PostScript hinting algorithm (body). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshalgo.c + * + * PostScript hinting algorithm (body). + * + * Copyright (C) 2001-2019 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 @@ -26,7 +26,7 @@ #undef FT_COMPONENT -#define FT_COMPONENT trace_pshalgo +#define FT_COMPONENT pshalgo #ifdef DEBUG_HINTER @@ -53,8 +53,8 @@ psh_hint_overlap( PSH_Hint hint1, PSH_Hint hint2 ) { - return hint1->org_pos + hint1->org_len >= hint2->org_pos && - hint2->org_pos + hint2->org_len >= hint1->org_pos; + return ADD_INT( hint1->org_pos, hint1->org_len ) >= hint2->org_pos && + ADD_INT( hint2->org_pos, hint2->org_len ) >= hint1->org_pos; } @@ -479,7 +479,7 @@ if ( dimension == 1 ) psh_blues_snap_stem( &globals->blues, - hint->org_pos + hint->org_len, + ADD_INT( hint->org_pos, hint->org_len ), hint->org_pos, &align ); @@ -658,8 +658,8 @@ #if 0 /* not used for now, experimental */ /* - * A variant to perform "light" hinting (i.e. FT_RENDER_MODE_LIGHT) - * of stems + * A variant to perform "light" hinting (i.e. FT_RENDER_MODE_LIGHT) + * of stems */ static void psh_hint_align_light( PSH_Hint hint, @@ -703,7 +703,7 @@ if ( dimension == 1 ) psh_blues_snap_stem( &globals->blues, - hint->org_pos + hint->org_len, + ADD_INT( hint->org_pos, hint->org_len ), hint->org_pos, &align ); @@ -1538,8 +1538,8 @@ PSH_Hint hint = sort[nn]; - if ( org_u >= hint->org_pos && - org_u <= hint->org_pos + hint->org_len ) + if ( org_u >= hint->org_pos && + org_u <= ADD_INT( hint->org_pos, hint->org_len ) ) { point->hint = hint; break; diff --git a/src/3rdparty/freetype/src/pshinter/pshalgo.h b/src/3rdparty/freetype/src/pshinter/pshalgo.h index c50683fbec..6859e95cd2 100644 --- a/src/3rdparty/freetype/src/pshinter/pshalgo.h +++ b/src/3rdparty/freetype/src/pshinter/pshalgo.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pshalgo.h */ -/* */ -/* PostScript hinting algorithm (specification). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshalgo.h + * + * PostScript hinting algorithm (specification). + * + * Copyright (C) 2001-2019 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 PSHALGO_H_ diff --git a/src/3rdparty/freetype/src/pshinter/pshglob.c b/src/3rdparty/freetype/src/pshinter/pshglob.c index accc04921d..b021e6e42a 100644 --- a/src/3rdparty/freetype/src/pshinter/pshglob.c +++ b/src/3rdparty/freetype/src/pshinter/pshglob.c @@ -1,25 +1,26 @@ -/***************************************************************************/ -/* */ -/* pshglob.c */ -/* */ -/* PostScript hinter global hinting management (body). */ -/* Inspired by the new auto-hinter module. */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshglob.c + * + * PostScript hinter global hinting management (body). + * Inspired by the new auto-hinter module. + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used + * modified and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_CALC_H #include "pshglob.h" #ifdef DEBUG_HINTER @@ -568,7 +569,7 @@ for ( ; count > 0; count--, zone++ ) { - delta = stem_top - zone->org_bottom; + delta = SUB_LONG( stem_top, zone->org_bottom ); if ( delta < -blues->blue_fuzz ) break; @@ -590,7 +591,7 @@ for ( ; count > 0; count--, zone-- ) { - delta = zone->org_top - stem_bot; + delta = SUB_LONG( zone->org_top, stem_bot ); if ( delta < -blues->blue_fuzz ) break; diff --git a/src/3rdparty/freetype/src/pshinter/pshglob.h b/src/3rdparty/freetype/src/pshinter/pshglob.h index cf80bf40e6..0049d4c0bc 100644 --- a/src/3rdparty/freetype/src/pshinter/pshglob.h +++ b/src/3rdparty/freetype/src/pshinter/pshglob.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pshglob.h */ -/* */ -/* PostScript hinter global hinting management. */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshglob.h + * + * PostScript hinter global hinting management. + * + * Copyright (C) 2001-2019 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 PSHGLOB_H_ @@ -36,27 +36,27 @@ FT_BEGIN_HEADER /*************************************************************************/ - /*************************************************************************/ - /* */ - /* @constant: */ - /* PS_GLOBALS_MAX_BLUE_ZONES */ - /* */ - /* @description: */ - /* The maximum number of blue zones in a font global hints structure. */ - /* See @PS_Globals_BluesRec. */ - /* */ + /************************************************************************** + * + * @constant: + * PS_GLOBALS_MAX_BLUE_ZONES + * + * @description: + * The maximum number of blue zones in a font global hints structure. + * See @PS_Globals_BluesRec. + */ #define PS_GLOBALS_MAX_BLUE_ZONES 16 - /*************************************************************************/ - /* */ - /* @constant: */ - /* PS_GLOBALS_MAX_STD_WIDTHS */ - /* */ - /* @description: */ - /* The maximum number of standard and snap widths in either the */ - /* horizontal or vertical direction. See @PS_Globals_WidthsRec. */ - /* */ + /************************************************************************** + * + * @constant: + * PS_GLOBALS_MAX_STD_WIDTHS + * + * @description: + * The maximum number of standard and snap widths in either the + * horizontal or vertical direction. See @PS_Globals_WidthsRec. + */ #define PS_GLOBALS_MAX_STD_WIDTHS 16 diff --git a/src/3rdparty/freetype/src/pshinter/pshinter.c b/src/3rdparty/freetype/src/pshinter/pshinter.c index 0eedac452d..16c3a0a117 100644 --- a/src/3rdparty/freetype/src/pshinter/pshinter.c +++ b/src/3rdparty/freetype/src/pshinter/pshinter.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pshinter.c */ -/* */ -/* FreeType PostScript Hinting module */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshinter.c + * + * FreeType PostScript Hinting module + * + * Copyright (C) 2001-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT @@ -22,7 +22,6 @@ #include "pshalgo.c" #include "pshglob.c" #include "pshmod.c" -#include "pshpic.c" #include "pshrec.c" diff --git a/src/3rdparty/freetype/src/pshinter/pshmod.c b/src/3rdparty/freetype/src/pshinter/pshmod.c index 0b8f6f99b8..2d36ea2a6a 100644 --- a/src/3rdparty/freetype/src/pshinter/pshmod.c +++ b/src/3rdparty/freetype/src/pshinter/pshmod.c @@ -1,26 +1,25 @@ -/***************************************************************************/ -/* */ -/* pshmod.c */ -/* */ -/* FreeType PostScript hinter module implementation (body). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshmod.c + * + * FreeType PostScript hinter module implementation (body). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_INTERNAL_OBJECTS_H #include "pshrec.h" #include "pshalgo.h" -#include "pshpic.h" /* the Postscript Hinter module structure */ @@ -111,7 +110,7 @@ 0x10000L, 0x20000L, - &PSHINTER_INTERFACE_GET, /* module-specific interface */ + &pshinter_interface, /* module-specific interface */ (FT_Module_Constructor)ps_hinter_init, /* module_init */ (FT_Module_Destructor) ps_hinter_done, /* module_done */ diff --git a/src/3rdparty/freetype/src/pshinter/pshmod.h b/src/3rdparty/freetype/src/pshinter/pshmod.h index 556de2fbc0..ea8771308a 100644 --- a/src/3rdparty/freetype/src/pshinter/pshmod.h +++ b/src/3rdparty/freetype/src/pshinter/pshmod.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pshmod.h */ -/* */ -/* PostScript hinter module interface (specification). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshmod.h + * + * PostScript hinter module interface (specification). + * + * Copyright (C) 2001-2019 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 PSHMOD_H_ diff --git a/src/3rdparty/freetype/src/pshinter/pshnterr.h b/src/3rdparty/freetype/src/pshinter/pshnterr.h index b9d02d2956..fb9dbca2b1 100644 --- a/src/3rdparty/freetype/src/pshinter/pshnterr.h +++ b/src/3rdparty/freetype/src/pshinter/pshnterr.h @@ -1,26 +1,26 @@ -/***************************************************************************/ -/* */ -/* pshnterr.h */ -/* */ -/* PS Hinter error codes (specification only). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the PSHinter error enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * pshnterr.h + * + * PS Hinter error codes (specification only). + * + * Copyright (C) 2003-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the PSHinter error enumeration constants. + * + */ #ifndef PSHNTERR_H_ #define PSHNTERR_H_ diff --git a/src/3rdparty/freetype/src/pshinter/pshrec.c b/src/3rdparty/freetype/src/pshinter/pshrec.c index 6648d13d60..9dd09efe4c 100644 --- a/src/3rdparty/freetype/src/pshinter/pshrec.c +++ b/src/3rdparty/freetype/src/pshinter/pshrec.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pshrec.c */ -/* */ -/* FreeType PostScript hints recorder (body). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pshrec.c + * + * FreeType PostScript hints recorder (body). + * + * Copyright (C) 2001-2019 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 @@ -28,7 +28,7 @@ #include "pshnterr.h" #undef FT_COMPONENT -#define FT_COMPONENT trace_pshrec +#define FT_COMPONENT pshrec #ifdef DEBUG_HINTER PS_Hints ps_debug_hints = NULL; @@ -666,7 +666,7 @@ if ( len == -21 ) { flags |= PS_HINT_FLAG_BOTTOM; - pos += len; + pos = ADD_INT( pos, len ); } len = 0; } @@ -1187,7 +1187,7 @@ /* compute integer stem positions in font units */ for ( n = 0; n < count * 2; n++ ) { - y += coords[n]; + y = ADD_LONG( y, coords[n] ); stems[n] = FIXED_TO_INT( y ); } diff --git a/src/3rdparty/freetype/src/pshinter/pshrec.h b/src/3rdparty/freetype/src/pshinter/pshrec.h index 7e3dfe0d53..02cc2102ec 100644 --- a/src/3rdparty/freetype/src/pshinter/pshrec.h +++ b/src/3rdparty/freetype/src/pshinter/pshrec.h @@ -1,31 +1,31 @@ -/***************************************************************************/ -/* */ -/* pshrec.h */ -/* */ -/* Postscript (Type1/Type2) hints recorder (specification). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /**************************************************************************/ - /* */ - /* The functions defined here are called from the Type 1, CID and CFF */ - /* font drivers to record the hints of a given character/glyph. */ - /* */ - /* The hints are recorded in a unified format, and are later processed */ - /* by the `optimizer' and `fitter' to adjust the outlines to the pixel */ - /* grid. */ - /* */ - /**************************************************************************/ +/**************************************************************************** + * + * pshrec.h + * + * Postscript (Type1/Type2) hints recorder (specification). + * + * Copyright (C) 2001-2019 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 functions defined here are called from the Type 1, CID and CFF + * font drivers to record the hints of a given character/glyph. + * + * The hints are recorded in a unified format, and are later processed + * by the `optimizer' and `fitter' to adjust the outlines to the pixel + * grid. + * + */ #ifndef PSHREC_H_ diff --git a/src/3rdparty/freetype/src/pshinter/rules.mk b/src/3rdparty/freetype/src/pshinter/rules.mk index 966690efc2..58227d10f2 100644 --- a/src/3rdparty/freetype/src/pshinter/rules.mk +++ b/src/3rdparty/freetype/src/pshinter/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -31,7 +31,6 @@ PSHINTER_COMPILE := $(CC) $(ANSIFLAGS) \ PSHINTER_DRV_SRC := $(PSHINTER_DIR)/pshalgo.c \ $(PSHINTER_DIR)/pshglob.c \ $(PSHINTER_DIR)/pshmod.c \ - $(PSHINTER_DIR)/pshpic.c \ $(PSHINTER_DIR)/pshrec.c diff --git a/src/3rdparty/freetype/src/psnames/Jamfile b/src/3rdparty/freetype/src/psnames/Jamfile index a0fd37397a..75978a8787 100644 --- a/src/3rdparty/freetype/src/psnames/Jamfile +++ b/src/3rdparty/freetype/src/psnames/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/psnames Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/psnames/module.mk b/src/3rdparty/freetype/src/psnames/module.mk index 410f48a191..0806a318a7 100644 --- a/src/3rdparty/freetype/src/psnames/module.mk +++ b/src/3rdparty/freetype/src/psnames/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/psnames/psmodule.c b/src/3rdparty/freetype/src/psnames/psmodule.c index 8929ebe751..0ec440e67b 100644 --- a/src/3rdparty/freetype/src/psnames/psmodule.c +++ b/src/3rdparty/freetype/src/psnames/psmodule.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psmodule.c */ -/* */ -/* PSNames module implementation (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psmodule.c + * + * psnames module implementation (body). + * + * Copyright (C) 1996-2019 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 @@ -24,16 +24,16 @@ #include "psmodule.h" /* - * The file `pstables.h' with its arrays and its function - * `ft_get_adobe_glyph_index' is useful for other projects also (for - * example, `pdfium' is using it). However, if used as a C++ header, - * including it in two different source files makes it necessary to use - * `extern const' for the declaration of its arrays, otherwise the data - * would be duplicated as mandated by the C++ standard. + * The file `pstables.h' with its arrays and its function + * `ft_get_adobe_glyph_index' is useful for other projects also (for + * example, `pdfium' is using it). However, if used as a C++ header, + * including it in two different source files makes it necessary to use + * `extern const' for the declaration of its arrays, otherwise the data + * would be duplicated as mandated by the C++ standard. * - * For this reason, we use `DEFINE_PS_TABLES' to guard the function - * definitions, and `DEFINE_PS_TABLES_DATA' to provide both proper array - * declarations and definitions. + * For this reason, we use `DEFINE_PS_TABLES' to guard the function + * definitions, and `DEFINE_PS_TABLES_DATA' to provide both proper array + * declarations and definitions. */ #include "pstables.h" #define DEFINE_PS_TABLES @@ -41,7 +41,6 @@ #include "pstables.h" #include "psnamerr.h" -#include "pspic.h" #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES @@ -393,7 +392,9 @@ /* Reallocate if the number of used entries is much smaller. */ if ( count < num_glyphs / 2 ) { - (void)FT_RENEW_ARRAY( table->maps, num_glyphs, count ); + (void)FT_RENEW_ARRAY( table->maps, + num_glyphs + EXTRA_GLYPH_LIST_SIZE, + count ); error = FT_Err_Ok; } @@ -577,28 +578,16 @@ FT_DEFINE_SERVICEDESCREC1( pscmaps_services, - FT_SERVICE_ID_POSTSCRIPT_CMAPS, &PSCMAPS_INTERFACE_GET ) + FT_SERVICE_ID_POSTSCRIPT_CMAPS, &pscmaps_interface ) static FT_Pointer psnames_get_service( FT_Module module, const char* service_id ) { - /* PSCMAPS_SERVICES_GET dereferences `library' in PIC mode */ -#ifdef FT_CONFIG_OPTION_PIC - FT_Library library; - - - if ( !module ) - return NULL; - library = module->library; - if ( !library ) - return NULL; -#else FT_UNUSED( module ); -#endif - return ft_service_list_lookup( PSCMAPS_SERVICES_GET, service_id ); + return ft_service_list_lookup( pscmaps_services, service_id ); } #endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ @@ -621,7 +610,7 @@ 0x20000L, /* driver requires FreeType 2 or above */ PUT_PS_NAMES_SERVICE( - (void*)&PSCMAPS_INTERFACE_GET ), /* module specific interface */ + (void*)&pscmaps_interface ), /* module specific interface */ (FT_Module_Constructor)NULL, /* module_init */ (FT_Module_Destructor) NULL, /* module_done */ diff --git a/src/3rdparty/freetype/src/psnames/psmodule.h b/src/3rdparty/freetype/src/psnames/psmodule.h index 3e94f8b437..0df9a7d889 100644 --- a/src/3rdparty/freetype/src/psnames/psmodule.h +++ b/src/3rdparty/freetype/src/psnames/psmodule.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* psmodule.h */ -/* */ -/* High-level PSNames module interface (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psmodule.h + * + * High-level psnames module interface (specification). + * + * Copyright (C) 1996-2019 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 PSMODULE_H_ diff --git a/src/3rdparty/freetype/src/psnames/psnamerr.h b/src/3rdparty/freetype/src/psnames/psnamerr.h index 14eb76c99c..67ab1765d3 100644 --- a/src/3rdparty/freetype/src/psnames/psnamerr.h +++ b/src/3rdparty/freetype/src/psnames/psnamerr.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* psnamerr.h */ -/* */ -/* PS names module error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the PS names module error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * psnamerr.h + * + * PS names module error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the PS names module error enumeration + * constants. + * + */ #ifndef PSNAMERR_H_ #define PSNAMERR_H_ diff --git a/src/3rdparty/freetype/src/psnames/psnames.c b/src/3rdparty/freetype/src/psnames/psnames.c index febb80d594..4722f98831 100644 --- a/src/3rdparty/freetype/src/psnames/psnames.c +++ b/src/3rdparty/freetype/src/psnames/psnames.c @@ -1,26 +1,25 @@ -/***************************************************************************/ -/* */ -/* psnames.c */ -/* */ -/* FreeType PSNames module component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * psnames.c + * + * FreeType psnames module component (body only). + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT #include #include "psmodule.c" -#include "pspic.c" /* END */ diff --git a/src/3rdparty/freetype/src/psnames/pstables.h b/src/3rdparty/freetype/src/psnames/pstables.h index 79545ee039..c0139bbc60 100644 --- a/src/3rdparty/freetype/src/psnames/pstables.h +++ b/src/3rdparty/freetype/src/psnames/pstables.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* pstables.h */ -/* */ -/* PostScript glyph names. */ -/* */ -/* Copyright 2005-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pstables.h + * + * PostScript glyph names. + * + * Copyright (C) 2005-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ /* This file has been generated automatically -- do not edit! */ @@ -609,12 +609,12 @@ /* - * This table is a compressed version of the Adobe Glyph List (AGL), - * optimized for efficient searching. It has been generated by the - * `glnames.py' python script located in the `src/tools' directory. + * This table is a compressed version of the Adobe Glyph List (AGL), + * optimized for efficient searching. It has been generated by the + * `glnames.py' python script located in the `src/tools' directory. * - * The lookup function to get the Unicode value for a given string - * is defined below the table. + * The lookup function to get the Unicode value for a given string + * is defined below the table. */ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST @@ -4137,7 +4137,7 @@ #ifdef DEFINE_PS_TABLES /* - * This function searches the compressed table efficiently. + * This function searches the compressed table efficiently. */ static unsigned long ft_get_adobe_glyph_index( const char* name, diff --git a/src/3rdparty/freetype/src/psnames/rules.mk b/src/3rdparty/freetype/src/psnames/rules.mk index 4d629d841c..dcc203e391 100644 --- a/src/3rdparty/freetype/src/psnames/rules.mk +++ b/src/3rdparty/freetype/src/psnames/rules.mk @@ -1,9 +1,9 @@ # -# FreeType 2 PSNames driver configuration rules +# FreeType 2 psnames driver configuration rules # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -13,7 +13,7 @@ # fully. -# PSNames driver directory +# psnames driver directory # PSNAMES_DIR := $(SRC_DIR)/psnames @@ -26,20 +26,19 @@ PSNAMES_COMPILE := $(CC) $(ANSIFLAGS) \ $(FT_CFLAGS) -# PSNames driver sources (i.e., C files) +# psnames driver sources (i.e., C files) # -PSNAMES_DRV_SRC := $(PSNAMES_DIR)/psmodule.c \ - $(PSNAMES_DIR)/pspic.c +PSNAMES_DRV_SRC := $(PSNAMES_DIR)/psmodule.c -# PSNames driver headers +# psnames driver headers # PSNAMES_DRV_H := $(PSNAMES_DRV_SRC:%.c=%.h) \ $(PSNAMES_DIR)/psnamerr.h \ $(PSNAMES_DIR)/pstables.h -# PSNames driver object(s) +# psnames driver object(s) # # PSNAMES_DRV_OBJ_M is used during `multi' builds # PSNAMES_DRV_OBJ_S is used during `single' builds @@ -47,19 +46,19 @@ PSNAMES_DRV_H := $(PSNAMES_DRV_SRC:%.c=%.h) \ PSNAMES_DRV_OBJ_M := $(PSNAMES_DRV_SRC:$(PSNAMES_DIR)/%.c=$(OBJ_DIR)/%.$O) PSNAMES_DRV_OBJ_S := $(OBJ_DIR)/psnames.$O -# PSNames driver source file for single build +# psnames driver source file for single build # PSNAMES_DRV_SRC_S := $(PSNAMES_DIR)/psnames.c -# PSNames driver - single object +# psnames driver - single object # $(PSNAMES_DRV_OBJ_S): $(PSNAMES_DRV_SRC_S) $(PSNAMES_DRV_SRC) \ $(FREETYPE_H) $(PSNAMES_DRV_H) $(PSNAMES_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PSNAMES_DRV_SRC_S)) -# PSNames driver - multiple objects +# psnames driver - multiple objects # $(OBJ_DIR)/%.$O: $(PSNAMES_DIR)/%.c $(FREETYPE_H) $(PSNAMES_DRV_H) $(PSNAMES_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) diff --git a/src/3rdparty/freetype/src/raster/Jamfile b/src/3rdparty/freetype/src/raster/Jamfile index 838e7ef57e..3990c05cd8 100644 --- a/src/3rdparty/freetype/src/raster/Jamfile +++ b/src/3rdparty/freetype/src/raster/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/raster Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/raster/ftmisc.h b/src/3rdparty/freetype/src/raster/ftmisc.h index 7e40119071..a246569e3b 100644 --- a/src/3rdparty/freetype/src/raster/ftmisc.h +++ b/src/3rdparty/freetype/src/raster/ftmisc.h @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* ftmisc.h */ -/* */ -/* Miscellaneous macros for stand-alone rasterizer (specification */ -/* only). */ -/* */ -/* Copyright 2005-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified 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 is *not* portable! You have to adapt */ - /* its definitions to your platform. */ - /* */ - /***************************************************/ +/**************************************************************************** + * + * ftmisc.h + * + * Miscellaneous macros for stand-alone rasterizer (specification + * only). + * + * Copyright (C) 2005-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used + * modified and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /**************************************************** + * + * This file is *not* portable! You have to adapt + * its definitions to your platform. + * + */ #ifndef FTMISC_H_ #define FTMISC_H_ diff --git a/src/3rdparty/freetype/src/raster/ftraster.c b/src/3rdparty/freetype/src/raster/ftraster.c index 4354730d54..023b6c1eff 100644 --- a/src/3rdparty/freetype/src/raster/ftraster.c +++ b/src/3rdparty/freetype/src/raster/ftraster.c @@ -1,51 +1,51 @@ -/***************************************************************************/ -/* */ -/* ftraster.c */ -/* */ -/* The FreeType glyph rasterizer (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 can be compiled without the rest of the FreeType engine, by */ - /* defining the STANDALONE_ macro when compiling it. You also need to */ - /* put the files `ftimage.h' and `ftmisc.h' into the $(incdir) */ - /* directory. Typically, you should do something like */ - /* */ - /* - copy `src/raster/ftraster.c' (this file) to your current directory */ - /* */ - /* - copy `include/freetype/ftimage.h' and `src/raster/ftmisc.h' to your */ - /* current directory */ - /* */ - /* - compile `ftraster' with the STANDALONE_ macro defined, as in */ - /* */ - /* cc -c -DSTANDALONE_ ftraster.c */ - /* */ - /* The renderer can be initialized with a call to */ - /* `ft_standard_raster.raster_new'; a bitmap can be generated */ - /* with a call to `ft_standard_raster.raster_render'. */ - /* */ - /* See the comments and documentation in the file `ftimage.h' for more */ - /* details on how the raster works. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This is a rewrite of the FreeType 1.x scan-line converter */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftraster.c + * + * The FreeType glyph rasterizer (body). + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + /************************************************************************** + * + * This file can be compiled without the rest of the FreeType engine, by + * defining the STANDALONE_ macro when compiling it. You also need to + * put the files `ftimage.h' and `ftmisc.h' into the $(incdir) + * directory. Typically, you should do something like + * + * - copy `src/raster/ftraster.c' (this file) to your current directory + * + * - copy `include/freetype/ftimage.h' and `src/raster/ftmisc.h' to your + * current directory + * + * - compile `ftraster' with the STANDALONE_ macro defined, as in + * + * cc -c -DSTANDALONE_ ftraster.c + * + * The renderer can be initialized with a call to + * `ft_standard_raster.raster_new'; a bitmap can be generated + * with a call to `ft_standard_raster.raster_render'. + * + * See the comments and documentation in the file `ftimage.h' for more + * details on how the raster works. + * + */ + + + /************************************************************************** + * + * This is a rewrite of the FreeType 1.x scan-line converter + * + */ #ifdef STANDALONE_ @@ -65,82 +65,81 @@ #include #include "ftraster.h" #include FT_INTERNAL_CALC_H /* for FT_MulDiv and FT_MulDiv_No_Round */ - -#include "rastpic.h" +#include FT_OUTLINE_H /* for FT_Outline_Get_CBox */ #endif /* !STANDALONE_ */ - /*************************************************************************/ - /* */ - /* A simple technical note on how the raster works */ - /* ----------------------------------------------- */ - /* */ - /* Converting an outline into a bitmap is achieved in several steps: */ - /* */ - /* 1 - Decomposing the outline into successive `profiles'. Each */ - /* profile is simply an array of scanline intersections on a given */ - /* dimension. A profile's main attributes are */ - /* */ - /* o its scanline position boundaries, i.e. `Ymin' and `Ymax' */ - /* */ - /* o an array of intersection coordinates for each scanline */ - /* between `Ymin' and `Ymax' */ - /* */ - /* o a direction, indicating whether it was built going `up' or */ - /* `down', as this is very important for filling rules */ - /* */ - /* o its drop-out mode */ - /* */ - /* 2 - Sweeping the target map's scanlines in order to compute segment */ - /* `spans' which are then filled. Additionally, this pass */ - /* performs drop-out control. */ - /* */ - /* The outline data is parsed during step 1 only. The profiles are */ - /* built from the bottom of the render pool, used as a stack. The */ - /* following graphics shows the profile list under construction: */ - /* */ - /* __________________________________________________________ _ _ */ - /* | | | | | */ - /* | profile | coordinates for | profile | coordinates for |--> */ - /* | 1 | profile 1 | 2 | profile 2 |--> */ - /* |_________|_________________|_________|_________________|__ _ _ */ - /* */ - /* ^ ^ */ - /* | | */ - /* start of render pool top */ - /* */ - /* The top of the profile stack is kept in the `top' variable. */ - /* */ - /* As you can see, a profile record is pushed on top of the render */ - /* pool, which is then followed by its coordinates/intersections. If */ - /* a change of direction is detected in the outline, a new profile is */ - /* generated until the end of the outline. */ - /* */ - /* Note that when all profiles have been generated, the function */ - /* Finalize_Profile_Table() is used to record, for each profile, its */ - /* bottom-most scanline as well as the scanline above its upmost */ - /* boundary. These positions are called `y-turns' because they (sort */ - /* of) correspond to local extrema. They are stored in a sorted list */ - /* built from the top of the render pool as a downwards stack: */ - /* */ - /* _ _ _______________________________________ */ - /* | | */ - /* <--| sorted list of | */ - /* <--| extrema scanlines | */ - /* _ _ __________________|____________________| */ - /* */ - /* ^ ^ */ - /* | | */ - /* maxBuff sizeBuff = end of pool */ - /* */ - /* This list is later used during the sweep phase in order to */ - /* optimize performance (see technical note on the sweep below). */ - /* */ - /* Of course, the raster detects whether the two stacks collide and */ - /* handles the situation properly. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * A simple technical note on how the raster works + * ----------------------------------------------- + * + * Converting an outline into a bitmap is achieved in several steps: + * + * 1 - Decomposing the outline into successive `profiles'. Each + * profile is simply an array of scanline intersections on a given + * dimension. A profile's main attributes are + * + * o its scanline position boundaries, i.e. `Ymin' and `Ymax' + * + * o an array of intersection coordinates for each scanline + * between `Ymin' and `Ymax' + * + * o a direction, indicating whether it was built going `up' or + * `down', as this is very important for filling rules + * + * o its drop-out mode + * + * 2 - Sweeping the target map's scanlines in order to compute segment + * `spans' which are then filled. Additionally, this pass + * performs drop-out control. + * + * The outline data is parsed during step 1 only. The profiles are + * built from the bottom of the render pool, used as a stack. The + * following graphics shows the profile list under construction: + * + * __________________________________________________________ _ _ + * | | | | | + * | profile | coordinates for | profile | coordinates for |--> + * | 1 | profile 1 | 2 | profile 2 |--> + * |_________|_________________|_________|_________________|__ _ _ + * + * ^ ^ + * | | + * start of render pool top + * + * The top of the profile stack is kept in the `top' variable. + * + * As you can see, a profile record is pushed on top of the render + * pool, which is then followed by its coordinates/intersections. If + * a change of direction is detected in the outline, a new profile is + * generated until the end of the outline. + * + * Note that when all profiles have been generated, the function + * Finalize_Profile_Table() is used to record, for each profile, its + * bottom-most scanline as well as the scanline above its upmost + * boundary. These positions are called `y-turns' because they (sort + * of) correspond to local extrema. They are stored in a sorted list + * built from the top of the render pool as a downwards stack: + * + * _ _ _______________________________________ + * | | + * <--| sorted list of | + * <--| extrema scanlines | + * _ _ __________________|____________________| + * + * ^ ^ + * | | + * maxBuff sizeBuff = end of pool + * + * This list is later used during the sweep phase in order to + * optimize performance (see technical note on the sweep below). + * + * Of course, the raster detects whether the two stacks collide and + * handles the situation properly. + * + */ /*************************************************************************/ @@ -163,14 +162,14 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_raster +#define FT_COMPONENT raster #ifdef STANDALONE_ @@ -400,7 +399,7 @@ #define RAS_ARGS /* void */ -#define RAS_ARG /* void */ +#define RAS_ARG void #define RAS_VARS /* void */ #define RAS_VAR /* void */ @@ -452,9 +451,9 @@ #define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision ) #define TRUNC( x ) ( (Long)(x) >> ras.precision_bits ) #define FRAC( x ) ( (x) & ( ras.precision - 1 ) ) -#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << ras.scale_shift ) \ - : ( (x) << ras.scale_shift ) ) \ - - ras.precision_half ) + + /* scale and shift grid to pixel centers */ +#define SCALED( x ) ( (x) * ras.precision_scale - ras.precision_half ) #define IS_BOTTOM_OVERSHOOT( x ) \ (Bool)( CEILING( x ) - x >= ras.precision_half ) @@ -476,13 +475,10 @@ Int precision_bits; /* precision related variables */ Int precision; Int precision_half; - Int precision_shift; + Int precision_scale; Int precision_step; Int precision_jitter; - Int scale_shift; /* == precision_shift for bitmaps */ - /* == precision_shift+1 for pixmaps */ - PLong buff; /* The profiles buffer */ PLong sizeBuff; /* Render pool size */ PLong maxBuff; /* Profiles buffer size */ @@ -495,8 +491,7 @@ TPoint* arc; /* current Bezier arc pointer */ UShort bWidth; /* target bitmap width */ - PByte bTarget; /* target bitmap buffer */ - PByte gTarget; /* target pixmap buffer */ + PByte bOrigin; /* target bitmap bottom-left origin */ Long lastX, lastY; Long minY, maxY; @@ -519,8 +514,6 @@ FT_Outline outline; Long traceOfs; /* current offset in target bitmap */ - Long traceG; /* current offset in target pixmap */ - Short traceIncr; /* sweep's increment in target bitmap */ /* dispatch variables */ @@ -553,8 +546,7 @@ #ifdef FT_STATIC_RASTER - static black_TWorker cur_ras; -#define ras cur_ras + static black_TWorker ras; #else /* !FT_STATIC_RASTER */ @@ -572,18 +564,19 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* Set_High_Precision */ - /* */ - /* */ - /* Set precision variables according to param flag. */ - /* */ - /* */ - /* High :: Set to True for high precision (typically for ppem < 24), */ - /* false otherwise. */ - /* */ + /************************************************************************** + * + * @Function: + * Set_High_Precision + * + * @Description: + * Set precision variables according to param flag. + * + * @Input: + * High :: + * Set to True for high precision (typically for ppem < 24), + * false otherwise. + */ static void Set_High_Precision( RAS_ARGS Int High ) { @@ -625,29 +618,31 @@ FT_TRACE6(( "Set_High_Precision(%s)\n", High ? "true" : "false" )); ras.precision = 1 << ras.precision_bits; - ras.precision_half = ras.precision / 2; - ras.precision_shift = ras.precision_bits - Pixel_Bits; + ras.precision_half = ras.precision >> 1; + ras.precision_scale = ras.precision >> Pixel_Bits; } - /*************************************************************************/ - /* */ - /* */ - /* New_Profile */ - /* */ - /* */ - /* Create a new profile in the render pool. */ - /* */ - /* */ - /* aState :: The state/orientation of the new profile. */ - /* */ - /* overshoot :: Whether the profile's unrounded start position */ - /* differs by at least a half pixel. */ - /* */ - /* */ - /* SUCCESS on success. FAILURE in case of overflow or of incoherent */ - /* profile. */ - /* */ + /************************************************************************** + * + * @Function: + * New_Profile + * + * @Description: + * Create a new profile in the render pool. + * + * @Input: + * aState :: + * The state/orientation of the new profile. + * + * overshoot :: + * Whether the profile's unrounded start position + * differs by at least a half pixel. + * + * @Return: + * SUCCESS on success. FAILURE in case of overflow or of incoherent + * profile. + */ static Bool New_Profile( RAS_ARGS TStates aState, Bool overshoot ) @@ -665,7 +660,6 @@ return FAILURE; } - ras.cProfile->flags = 0; ras.cProfile->start = 0; ras.cProfile->height = 0; ras.cProfile->offset = ras.top; @@ -706,21 +700,22 @@ } - /*************************************************************************/ - /* */ - /* */ - /* End_Profile */ - /* */ - /* */ - /* Finalize the current profile. */ - /* */ - /* */ - /* overshoot :: Whether the profile's unrounded end position differs */ - /* by at least a half pixel. */ - /* */ - /* */ - /* SUCCESS on success. FAILURE in case of overflow or incoherency. */ - /* */ + /************************************************************************** + * + * @Function: + * End_Profile + * + * @Description: + * Finalize the current profile. + * + * @Input: + * overshoot :: + * Whether the profile's unrounded end position differs + * by at least a half pixel. + * + * @Return: + * SUCCESS on success. FAILURE in case of overflow or incoherency. + */ static Bool End_Profile( RAS_ARGS Bool overshoot ) { @@ -778,21 +773,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Insert_Y_Turn */ - /* */ - /* */ - /* Insert a salient into the sorted list placed on top of the render */ - /* pool. */ - /* */ - /* */ - /* New y scanline position. */ - /* */ - /* */ - /* SUCCESS on success. FAILURE in case of overflow. */ - /* */ + /************************************************************************** + * + * @Function: + * Insert_Y_Turn + * + * @Description: + * Insert a salient into the sorted list placed on top of the render + * pool. + * + * @Input: + * New y scanline position. + * + * @Return: + * SUCCESS on success. FAILURE in case of overflow. + */ static Bool Insert_Y_Turn( RAS_ARGS Int y ) { @@ -834,17 +829,17 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Finalize_Profile_Table */ - /* */ - /* */ - /* Adjust all links in the profiles list. */ - /* */ - /* */ - /* SUCCESS on success. FAILURE in case of overflow. */ - /* */ + /************************************************************************** + * + * @Function: + * Finalize_Profile_Table + * + * @Description: + * Adjust all links in the profiles list. + * + * @Return: + * SUCCESS on success. FAILURE in case of overflow. + */ static Bool Finalize_Profile_Table( RAS_ARG ) { @@ -894,22 +889,22 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Split_Conic */ - /* */ - /* */ - /* Subdivide one conic Bezier into two joint sub-arcs in the Bezier */ - /* stack. */ - /* */ - /* */ - /* None (subdivided Bezier is taken from the top of the stack). */ - /* */ - /* */ - /* This routine is the `beef' of this component. It is _the_ inner */ - /* loop that should be optimized to hell to get the best performance. */ - /* */ + /************************************************************************** + * + * @Function: + * Split_Conic + * + * @Description: + * Subdivide one conic Bezier into two joint sub-arcs in the Bezier + * stack. + * + * @Input: + * None (subdivided Bezier is taken from the top of the stack). + * + * @Note: + * This routine is the `beef' of this component. It is _the_ inner + * loop that should be optimized to hell to get the best performance. + */ static void Split_Conic( TPoint* base ) { @@ -917,89 +912,101 @@ base[4].x = base[2].x; - b = base[1].x; - a = base[3].x = ( base[2].x + b ) / 2; - b = base[1].x = ( base[0].x + b ) / 2; - base[2].x = ( a + b ) / 2; + a = base[0].x + base[1].x; + b = base[1].x + base[2].x; + base[3].x = b >> 1; + base[2].x = ( a + b ) >> 2; + base[1].x = a >> 1; base[4].y = base[2].y; - b = base[1].y; - a = base[3].y = ( base[2].y + b ) / 2; - b = base[1].y = ( base[0].y + b ) / 2; - base[2].y = ( a + b ) / 2; + a = base[0].y + base[1].y; + b = base[1].y + base[2].y; + base[3].y = b >> 1; + base[2].y = ( a + b ) >> 2; + base[1].y = a >> 1; /* hand optimized. gcc doesn't seem to be too good at common */ /* expression substitution and instruction scheduling ;-) */ } - /*************************************************************************/ - /* */ - /* */ - /* Split_Cubic */ - /* */ - /* */ - /* Subdivide a third-order Bezier arc into two joint sub-arcs in the */ - /* Bezier stack. */ - /* */ - /* */ - /* This routine is the `beef' of the component. It is one of _the_ */ - /* inner loops that should be optimized like hell to get the best */ - /* performance. */ - /* */ + /************************************************************************** + * + * @Function: + * Split_Cubic + * + * @Description: + * Subdivide a third-order Bezier arc into two joint sub-arcs in the + * Bezier stack. + * + * @Note: + * This routine is the `beef' of the component. It is one of _the_ + * inner loops that should be optimized like hell to get the best + * performance. + */ static void Split_Cubic( TPoint* base ) { - Long a, b, c, d; + Long a, b, c; base[6].x = base[3].x; - c = base[1].x; - d = base[2].x; - base[1].x = a = ( base[0].x + c + 1 ) >> 1; - base[5].x = b = ( base[3].x + d + 1 ) >> 1; - c = ( c + d + 1 ) >> 1; - base[2].x = a = ( a + c + 1 ) >> 1; - base[4].x = b = ( b + c + 1 ) >> 1; - base[3].x = ( a + b + 1 ) >> 1; + 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 >> 1; + c += b; + base[4].x = c >> 2; + base[1].x = a >> 1; + a += b; + base[2].x = a >> 2; + base[3].x = ( a + c ) >> 3; base[6].y = base[3].y; - c = base[1].y; - d = base[2].y; - base[1].y = a = ( base[0].y + c + 1 ) >> 1; - base[5].y = b = ( base[3].y + d + 1 ) >> 1; - c = ( c + d + 1 ) >> 1; - base[2].y = a = ( a + c + 1 ) >> 1; - base[4].y = b = ( b + c + 1 ) >> 1; - base[3].y = ( a + b + 1 ) >> 1; + 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 >> 1; + c += b; + base[4].y = c >> 2; + base[1].y = a >> 1; + a += b; + base[2].y = a >> 2; + base[3].y = ( a + c ) >> 3; } - /*************************************************************************/ - /* */ - /* */ - /* Line_Up */ - /* */ - /* */ - /* Compute the x-coordinates of an ascending line segment and store */ - /* them in the render pool. */ - /* */ - /* */ - /* x1 :: The x-coordinate of the segment's start point. */ - /* */ - /* y1 :: The y-coordinate of the segment's start point. */ - /* */ - /* x2 :: The x-coordinate of the segment's end point. */ - /* */ - /* y2 :: The y-coordinate of the segment's end point. */ - /* */ - /* miny :: A lower vertical clipping bound value. */ - /* */ - /* maxy :: An upper vertical clipping bound value. */ - /* */ - /* */ - /* SUCCESS on success, FAILURE on render pool overflow. */ - /* */ + /************************************************************************** + * + * @Function: + * Line_Up + * + * @Description: + * Compute the x-coordinates of an ascending line segment and store + * them in the render pool. + * + * @Input: + * x1 :: + * The x-coordinate of the segment's start point. + * + * y1 :: + * The y-coordinate of the segment's start point. + * + * x2 :: + * The x-coordinate of the segment's end point. + * + * y2 :: + * The y-coordinate of the segment's end point. + * + * miny :: + * A lower vertical clipping bound value. + * + * maxy :: + * An upper vertical clipping bound value. + * + * @Return: + * SUCCESS on success, FAILURE on render pool overflow. + */ static Bool Line_Up( RAS_ARGS Long x1, Long y1, @@ -1114,31 +1121,37 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Line_Down */ - /* */ - /* */ - /* Compute the x-coordinates of an descending line segment and store */ - /* them in the render pool. */ - /* */ - /* */ - /* x1 :: The x-coordinate of the segment's start point. */ - /* */ - /* y1 :: The y-coordinate of the segment's start point. */ - /* */ - /* x2 :: The x-coordinate of the segment's end point. */ - /* */ - /* y2 :: The y-coordinate of the segment's end point. */ - /* */ - /* miny :: A lower vertical clipping bound value. */ - /* */ - /* maxy :: An upper vertical clipping bound value. */ - /* */ - /* */ - /* SUCCESS on success, FAILURE on render pool overflow. */ - /* */ + /************************************************************************** + * + * @Function: + * Line_Down + * + * @Description: + * Compute the x-coordinates of an descending line segment and store + * them in the render pool. + * + * @Input: + * x1 :: + * The x-coordinate of the segment's start point. + * + * y1 :: + * The y-coordinate of the segment's start point. + * + * x2 :: + * The x-coordinate of the segment's end point. + * + * y2 :: + * The y-coordinate of the segment's end point. + * + * miny :: + * A lower vertical clipping bound value. + * + * maxy :: + * An upper vertical clipping bound value. + * + * @Return: + * SUCCESS on success, FAILURE on render pool overflow. + */ static Bool Line_Down( RAS_ARGS Long x1, Long y1, @@ -1165,27 +1178,31 @@ typedef void (*TSplitter)( TPoint* base ); - /*************************************************************************/ - /* */ - /* */ - /* Bezier_Up */ - /* */ - /* */ - /* Compute the x-coordinates of an ascending Bezier arc and store */ - /* them in the render pool. */ - /* */ - /* */ - /* degree :: The degree of the Bezier arc (either 2 or 3). */ - /* */ - /* splitter :: The function to split Bezier arcs. */ - /* */ - /* miny :: A lower vertical clipping bound value. */ - /* */ - /* maxy :: An upper vertical clipping bound value. */ - /* */ - /* */ - /* SUCCESS on success, FAILURE on render pool overflow. */ - /* */ + /************************************************************************** + * + * @Function: + * Bezier_Up + * + * @Description: + * Compute the x-coordinates of an ascending Bezier arc and store + * them in the render pool. + * + * @Input: + * degree :: + * The degree of the Bezier arc (either 2 or 3). + * + * splitter :: + * The function to split Bezier arcs. + * + * miny :: + * A lower vertical clipping bound value. + * + * maxy :: + * An upper vertical clipping bound value. + * + * @Return: + * SUCCESS on success, FAILURE on render pool overflow. + */ static Bool Bezier_Up( RAS_ARGS Int degree, TSplitter splitter, @@ -1298,27 +1315,31 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Bezier_Down */ - /* */ - /* */ - /* Compute the x-coordinates of an descending Bezier arc and store */ - /* them in the render pool. */ - /* */ - /* */ - /* degree :: The degree of the Bezier arc (either 2 or 3). */ - /* */ - /* splitter :: The function to split Bezier arcs. */ - /* */ - /* miny :: A lower vertical clipping bound value. */ - /* */ - /* maxy :: An upper vertical clipping bound value. */ - /* */ - /* */ - /* SUCCESS on success, FAILURE on render pool overflow. */ - /* */ + /************************************************************************** + * + * @Function: + * Bezier_Down + * + * @Description: + * Compute the x-coordinates of an descending Bezier arc and store + * them in the render pool. + * + * @Input: + * degree :: + * The degree of the Bezier arc (either 2 or 3). + * + * splitter :: + * The function to split Bezier arcs. + * + * miny :: + * A lower vertical clipping bound value. + * + * maxy :: + * An upper vertical clipping bound value. + * + * @Return: + * SUCCESS on success, FAILURE on render pool overflow. + */ static Bool Bezier_Down( RAS_ARGS Int degree, TSplitter splitter, @@ -1347,25 +1368,27 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Line_To */ - /* */ - /* */ - /* Inject a new line segment and adjust the Profiles list. */ - /* */ - /* */ - /* x :: The x-coordinate of the segment's end point (its start point */ - /* is stored in `lastX'). */ - /* */ - /* y :: The y-coordinate of the segment's end point (its start point */ - /* is stored in `lastY'). */ - /* */ - /* */ - /* SUCCESS on success, FAILURE on render pool overflow or incorrect */ - /* profile. */ - /* */ + /************************************************************************** + * + * @Function: + * Line_To + * + * @Description: + * Inject a new line segment and adjust the Profiles list. + * + * @Input: + * x :: + * The x-coordinate of the segment's end point (its start point + * is stored in `lastX'). + * + * y :: + * The y-coordinate of the segment's end point (its start point + * is stored in `lastY'). + * + * @Return: + * SUCCESS on success, FAILURE on render pool overflow or incorrect + * profile. + */ static Bool Line_To( RAS_ARGS Long x, Long y ) @@ -1441,29 +1464,33 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Conic_To */ - /* */ - /* */ - /* Inject a new conic arc and adjust the profile list. */ - /* */ - /* */ - /* cx :: The x-coordinate of the arc's new control point. */ - /* */ - /* cy :: The y-coordinate of the arc's new control point. */ - /* */ - /* x :: The x-coordinate of the arc's end point (its start point is */ - /* stored in `lastX'). */ - /* */ - /* y :: The y-coordinate of the arc's end point (its start point is */ - /* stored in `lastY'). */ - /* */ - /* */ - /* SUCCESS on success, FAILURE on render pool overflow or incorrect */ - /* profile. */ - /* */ + /************************************************************************** + * + * @Function: + * Conic_To + * + * @Description: + * Inject a new conic arc and adjust the profile list. + * + * @Input: + * cx :: + * The x-coordinate of the arc's new control point. + * + * cy :: + * The y-coordinate of the arc's new control point. + * + * x :: + * The x-coordinate of the arc's end point (its start point is + * stored in `lastX'). + * + * y :: + * The y-coordinate of the arc's end point (its start point is + * stored in `lastY'). + * + * @Return: + * SUCCESS on success, FAILURE on render pool overflow or incorrect + * profile. + */ static Bool Conic_To( RAS_ARGS Long cx, Long cy, @@ -1558,33 +1585,39 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Cubic_To */ - /* */ - /* */ - /* Inject a new cubic arc and adjust the profile list. */ - /* */ - /* */ - /* cx1 :: The x-coordinate of the arc's first new control point. */ - /* */ - /* cy1 :: The y-coordinate of the arc's first new control point. */ - /* */ - /* cx2 :: The x-coordinate of the arc's second new control point. */ - /* */ - /* cy2 :: The y-coordinate of the arc's second new control point. */ - /* */ - /* x :: The x-coordinate of the arc's end point (its start point is */ - /* stored in `lastX'). */ - /* */ - /* y :: The y-coordinate of the arc's end point (its start point is */ - /* stored in `lastY'). */ - /* */ - /* */ - /* SUCCESS on success, FAILURE on render pool overflow or incorrect */ - /* profile. */ - /* */ + /************************************************************************** + * + * @Function: + * Cubic_To + * + * @Description: + * Inject a new cubic arc and adjust the profile list. + * + * @Input: + * cx1 :: + * The x-coordinate of the arc's first new control point. + * + * cy1 :: + * The y-coordinate of the arc's first new control point. + * + * cx2 :: + * The x-coordinate of the arc's second new control point. + * + * cy2 :: + * The y-coordinate of the arc's second new control point. + * + * x :: + * The x-coordinate of the arc's end point (its start point is + * stored in `lastX'). + * + * y :: + * The y-coordinate of the arc's end point (its start point is + * stored in `lastY'). + * + * @Return: + * SUCCESS on success, FAILURE on render pool overflow or incorrect + * profile. + */ static Bool Cubic_To( RAS_ARGS Long cx1, Long cy1, @@ -1705,27 +1738,30 @@ } while ( 0 ) - /*************************************************************************/ - /* */ - /* */ - /* Decompose_Curve */ - /* */ - /* */ - /* Scan the outline arrays in order to emit individual segments and */ - /* Beziers by calling Line_To() and Bezier_To(). It handles all */ - /* weird cases, like when the first point is off the curve, or when */ - /* there are simply no `on' points in the contour! */ - /* */ - /* */ - /* first :: The index of the first point in the contour. */ - /* */ - /* last :: The index of the last point in the contour. */ - /* */ - /* flipped :: If set, flip the direction of the curve. */ - /* */ - /* */ - /* SUCCESS on success, FAILURE on error. */ - /* */ + /************************************************************************** + * + * @Function: + * Decompose_Curve + * + * @Description: + * Scan the outline arrays in order to emit individual segments and + * Beziers by calling Line_To() and Bezier_To(). It handles all + * weird cases, like when the first point is off the curve, or when + * there are simply no `on' points in the contour! + * + * @Input: + * first :: + * The index of the first point in the contour. + * + * last :: + * The index of the last point in the contour. + * + * flipped :: + * If set, flip the direction of the curve. + * + * @Return: + * SUCCESS on success, FAILURE on error. + */ static Bool Decompose_Curve( RAS_ARGS UShort first, UShort last, @@ -1934,22 +1970,23 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Convert_Glyph */ - /* */ - /* */ - /* Convert a glyph into a series of segments and arcs and make a */ - /* profiles list with them. */ - /* */ - /* */ - /* flipped :: If set, flip the direction of curve. */ - /* */ - /* */ - /* SUCCESS on success, FAILURE if any error was encountered during */ - /* rendering. */ - /* */ + /************************************************************************** + * + * @Function: + * Convert_Glyph + * + * @Description: + * Convert a glyph into a series of segments and arcs and make a + * profiles list with them. + * + * @Input: + * flipped :: + * If set, flip the direction of curve. + * + * @Return: + * SUCCESS on success, FAILURE if any error was encountered during + * rendering. + */ static Bool Convert_Glyph( RAS_ARGS Int flipped ) { @@ -2028,12 +2065,12 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* Init_Linked */ - /* */ - /* Initializes an empty linked list. */ - /* */ + /************************************************************************** + * + * Init_Linked + * + * Initializes an empty linked list. + */ static void Init_Linked( TProfileList* l ) { @@ -2041,12 +2078,12 @@ } - /*************************************************************************/ - /* */ - /* InsNew */ - /* */ - /* Inserts a new profile in a linked list. */ - /* */ + /************************************************************************** + * + * InsNew + * + * Inserts a new profile in a linked list. + */ static void InsNew( PProfileList list, PProfile profile ) @@ -2072,12 +2109,12 @@ } - /*************************************************************************/ - /* */ - /* DelOld */ - /* */ - /* Removes an old profile from a linked list. */ - /* */ + /************************************************************************** + * + * DelOld + * + * Removes an old profile from a linked list. + */ static void DelOld( PProfileList list, PProfile profile ) @@ -2105,14 +2142,14 @@ } - /*************************************************************************/ - /* */ - /* Sort */ - /* */ - /* Sorts a trace list. In 95%, the list is already sorted. We need */ - /* an algorithm which is fast in this case. Bubble sort is enough */ - /* and simple. */ - /* */ + /************************************************************************** + * + * Sort + * + * Sorts a trace list. In 95%, the list is already sorted. We need + * an algorithm which is fast in this case. Bubble sort is enough + * and simple. + */ static void Sort( PProfileList list ) { @@ -2163,14 +2200,14 @@ } - /*************************************************************************/ - /* */ - /* Vertical Sweep Procedure Set */ - /* */ - /* These four routines are used during the vertical black/white sweep */ - /* phase by the generic Draw_Sweep() function. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Vertical Sweep Procedure Set + * + * These four routines are used during the vertical black/white sweep + * phase by the generic Draw_Sweep() function. + * + */ static void Vertical_Sweep_Init( RAS_ARGS Short* min, @@ -2183,8 +2220,6 @@ ras.traceIncr = (Short)-pitch; ras.traceOfs = -*min * pitch; - if ( pitch > 0 ) - ras.traceOfs += (Long)( ras.target.rows - 1 ) * pitch; } @@ -2215,13 +2250,18 @@ /* Drop-out control */ - e1 = TRUNC( CEILING( x1 ) ); + e1 = CEILING( x1 ); + e2 = FLOOR( x2 ); + /* take care of the special case where both the left */ + /* and right contour lie exactly on pixel centers */ if ( dropOutControl != 2 && - x2 - x1 - ras.precision <= ras.precision_jitter ) + x2 - x1 - ras.precision <= ras.precision_jitter && + e1 != x1 && e2 != x2 ) e2 = e1; - else - e2 = TRUNC( FLOOR( x2 ) ); + + e1 = TRUNC( e1 ); + e2 = TRUNC( e2 ); if ( e2 >= 0 && e1 < ras.bWidth ) { @@ -2242,7 +2282,7 @@ f1 = (Byte) ( 0xFF >> ( e1 & 7 ) ); f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) ); - target = ras.bTarget + ras.traceOfs + c1; + target = ras.bOrigin + ras.traceOfs + c1; c2 -= c1; if ( c2 > 0 ) @@ -2252,12 +2292,9 @@ /* memset() is slower than the following code on many platforms. */ /* This is due to the fact that, in the vast majority of cases, */ /* the span length in bytes is relatively small. */ - c2--; - while ( c2 > 0 ) - { + while ( --c2 > 0 ) *(++target) = 0xFF; - c2--; - } + target[1] |= f2; } else @@ -2400,7 +2437,7 @@ f1 = (Short)( e1 & 7 ); if ( e1 >= 0 && e1 < ras.bWidth && - ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) ) + ras.bOrigin[ras.traceOfs + c1] & ( 0x80 >> f1 ) ) goto Exit; } else @@ -2416,7 +2453,7 @@ c1 = (Short)( e1 >> 3 ); f1 = (Short)( e1 & 7 ); - ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 ); + ras.bOrigin[ras.traceOfs + c1] |= (char)( 0x80 >> f1 ); } Exit: @@ -2431,14 +2468,14 @@ } - /***********************************************************************/ - /* */ - /* Horizontal Sweep Procedure Set */ - /* */ - /* These four routines are used during the horizontal black/white */ - /* sweep phase by the generic Draw_Sweep() function. */ - /* */ - /***********************************************************************/ + /************************************************************************ + * + * Horizontal Sweep Procedure Set + * + * These four routines are used during the horizontal black/white + * sweep phase by the generic Draw_Sweep() function. + * + */ static void Horizontal_Sweep_Init( RAS_ARGS Short* min, @@ -2483,19 +2520,14 @@ { Byte f1; PByte bits; - PByte p; FT_TRACE7(( " -> y=%d (drop-out)", e1 )); - bits = ras.bTarget + ( y >> 3 ); + bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch; f1 = (Byte)( 0x80 >> ( y & 7 ) ); - p = bits - e1 * ras.target.pitch; - if ( ras.target.pitch > 0 ) - p += (Long)( ras.target.rows - 1 ) * ras.target.pitch; - - p[0] |= f1; + bits[0] |= f1; } } @@ -2597,13 +2629,9 @@ e1 = TRUNC( e1 ); - bits = ras.bTarget + ( y >> 3 ); + bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch; f1 = (Byte)( 0x80 >> ( y & 7 ) ); - bits -= e1 * ras.target.pitch; - if ( ras.target.pitch > 0 ) - bits += (Long)( ras.target.rows - 1 ) * ras.target.pitch; - if ( e1 >= 0 && (ULong)e1 < ras.target.rows && *bits & f1 ) @@ -2619,12 +2647,8 @@ { FT_TRACE7(( " -> y=%d (drop-out)", e1 )); - bits = ras.bTarget + ( y >> 3 ); + bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch; f1 = (Byte)( 0x80 >> ( y & 7 ) ); - bits -= e1 * ras.target.pitch; - - if ( ras.target.pitch > 0 ) - bits += (Long)( ras.target.rows - 1 ) * ras.target.pitch; bits[0] |= f1; } @@ -2642,11 +2666,11 @@ } - /*************************************************************************/ - /* */ - /* Generic Sweep Drawing routine */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Generic Sweep Drawing routine + * + */ static Bool Draw_Sweep( RAS_ARG ) @@ -2764,7 +2788,7 @@ P_Left = draw_left; P_Right = draw_right; - while ( P_Left ) + while ( P_Left && P_Right ) { x1 = P_Left ->X; x2 = P_Right->X; @@ -2865,7 +2889,7 @@ P_Left = draw_left; P_Right = draw_right; - while ( P_Left ) + while ( P_Left && P_Right ) { if ( P_Left->countL ) { @@ -2888,20 +2912,109 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Render_Single_Pass */ - /* */ - /* */ - /* Perform one sweep with sub-banding. */ - /* */ - /* */ - /* flipped :: If set, flip the direction of the outline. */ - /* */ - /* */ - /* Renderer error code. */ - /* */ +#ifdef STANDALONE_ + + /************************************************************************** + * + * The following functions should only compile in stand-alone mode, + * i.e., when building this component without the rest of FreeType. + * + */ + + /************************************************************************** + * + * @Function: + * FT_Outline_Get_CBox + * + * @Description: + * Return an outline's `control box'. The control box encloses all + * the outline's points, including Bézier control points. Though it + * coincides with the exact bounding box for most glyphs, it can be + * slightly larger in some situations (like when rotating an outline + * that contains Bézier outside arcs). + * + * Computing the control box is very fast, while getting the bounding + * box can take much more time as it needs to walk over all segments + * and arcs in the outline. To get the latter, you can use the + * `ftbbox' component, which is dedicated to this single task. + * + * @Input: + * outline :: + * A pointer to the source outline descriptor. + * + * @Output: + * acbox :: + * The outline's control box. + * + * @Note: + * See @FT_Glyph_Get_CBox for a discussion of tricky fonts. + */ + + static void + FT_Outline_Get_CBox( const FT_Outline* outline, + FT_BBox *acbox ) + { + Long xMin, yMin, xMax, yMax; + + + if ( outline && acbox ) + { + if ( outline->n_points == 0 ) + { + xMin = 0; + yMin = 0; + xMax = 0; + yMax = 0; + } + else + { + FT_Vector* vec = outline->points; + FT_Vector* limit = vec + outline->n_points; + + + xMin = xMax = vec->x; + yMin = yMax = vec->y; + vec++; + + for ( ; vec < limit; vec++ ) + { + Long x, y; + + + x = vec->x; + if ( x < xMin ) xMin = x; + if ( x > xMax ) xMax = x; + + y = vec->y; + if ( y < yMin ) yMin = y; + if ( y > yMax ) yMax = y; + } + } + acbox->xMin = xMin; + acbox->xMax = xMax; + acbox->yMin = yMin; + acbox->yMax = yMax; + } + } + +#endif /* STANDALONE_ */ + + + /************************************************************************** + * + * @Function: + * Render_Single_Pass + * + * @Description: + * Perform one sweep with sub-banding. + * + * @Input: + * flipped :: + * If set, flip the direction of the outline. + * + * @Return: + * Renderer error code. + */ static int Render_Single_Pass( RAS_ARGS Bool flipped ) { @@ -2963,17 +3076,17 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Render_Glyph */ - /* */ - /* */ - /* Render a glyph in a bitmap. Sub-banding if needed. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * Render_Glyph + * + * @Description: + * Render a glyph in a bitmap. Sub-banding if needed. + * + * @Return: + * FreeType error code. 0 means success. + */ static FT_Error Render_Glyph( RAS_ARG ) { @@ -2982,7 +3095,6 @@ Set_High_Precision( RAS_VARS ras.outline.flags & FT_OUTLINE_HIGH_PRECISION ); - ras.scale_shift = ras.precision_shift; if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS ) ras.dropOutControl = 2; @@ -3013,7 +3125,10 @@ ras.band_stack[0].y_max = (Short)( ras.target.rows - 1 ); ras.bWidth = (UShort)ras.target.width; - ras.bTarget = (Byte*)ras.target.buffer; + ras.bOrigin = (Byte*)ras.target.buffer; + + if ( ras.target.pitch > 0 ) + ras.bOrigin += (Long)( ras.target.rows - 1 ) * ras.target.pitch; if ( ( error = Render_Single_Pass( RAS_VARS 0 ) ) != 0 ) return error; @@ -3146,7 +3261,9 @@ const FT_Outline* outline = (const FT_Outline*)params->source; const FT_Bitmap* target_map = params->target; +#ifndef FT_STATIC_RASTER black_TWorker worker[1]; +#endif Long buffer[FT_MAX_BLACK_POOL]; @@ -3185,25 +3302,11 @@ if ( !target_map->buffer ) return FT_THROW( Invalid ); - /* reject too large outline coordinates */ - { - FT_Vector* vec = outline->points; - FT_Vector* limit = vec + outline->n_points; - - - for ( ; vec < limit; vec++ ) - { - if ( vec->x < -0x1000000L || vec->x > 0x1000000L || - vec->y < -0x1000000L || vec->y > 0x1000000L ) - return FT_THROW( Invalid ); - } - } - ras.outline = *outline; ras.target = *target_map; - worker->buff = buffer; - worker->sizeBuff = (&buffer)[1]; /* Points to right after buffer. */ + ras.buff = buffer; + ras.sizeBuff = (&buffer)[1]; /* Points to right after buffer. */ return Render_Glyph( RAS_VAR ); } diff --git a/src/3rdparty/freetype/src/raster/ftraster.h b/src/3rdparty/freetype/src/raster/ftraster.h index 40b5d6d321..50d34201a1 100644 --- a/src/3rdparty/freetype/src/raster/ftraster.h +++ b/src/3rdparty/freetype/src/raster/ftraster.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftraster.h */ -/* */ -/* The FreeType glyph rasterizer (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftraster.h + * + * The FreeType glyph rasterizer (specification). + * + * Copyright (C) 1996-2019 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 FTRASTER_H_ @@ -28,11 +28,11 @@ FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* Uncomment the following line if you are using ftraster.c as a */ - /* standalone module, fully independent of FreeType. */ - /* */ + /************************************************************************** + * + * Uncomment the following line if you are using ftraster.c as a + * standalone module, fully independent of FreeType. + */ /* #define STANDALONE_ */ FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_standard_raster; diff --git a/src/3rdparty/freetype/src/raster/ftrend1.c b/src/3rdparty/freetype/src/raster/ftrend1.c index a7ce9731d7..62c727182a 100644 --- a/src/3rdparty/freetype/src/raster/ftrend1.c +++ b/src/3rdparty/freetype/src/raster/ftrend1.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftrend1.c */ -/* */ -/* The FreeType glyph rasterizer interface (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftrend1.c + * + * The FreeType glyph rasterizer interface (body). + * + * Copyright (C) 1996-2019 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 @@ -22,7 +22,6 @@ #include FT_OUTLINE_H #include "ftrend1.h" #include "ftraster.h" -#include "rastpic.h" #include "rasterrs.h" @@ -128,7 +127,11 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } - ft_glyphslot_preset_bitmap( slot, mode, origin ); + if ( ft_glyphslot_preset_bitmap( slot, mode, origin ) ) + { + error = FT_THROW( Raster_Overflow ); + goto Exit; + } /* allocate new one */ if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) @@ -197,7 +200,7 @@ (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, /* get_glyph_cbox */ (FT_Renderer_SetModeFunc) ft_raster1_set_mode, /* set_mode */ - (FT_Raster_Funcs*)&FT_STANDARD_RASTER_GET /* raster_class */ + (FT_Raster_Funcs*)&ft_standard_raster /* raster_class */ ) diff --git a/src/3rdparty/freetype/src/raster/ftrend1.h b/src/3rdparty/freetype/src/raster/ftrend1.h index 2abdf2d703..82ecac686c 100644 --- a/src/3rdparty/freetype/src/raster/ftrend1.h +++ b/src/3rdparty/freetype/src/raster/ftrend1.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftrend1.h */ -/* */ -/* The FreeType glyph rasterizer interface (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftrend1.h + * + * The FreeType glyph rasterizer interface (specification). + * + * Copyright (C) 1996-2019 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 FTREND1_H_ diff --git a/src/3rdparty/freetype/src/raster/module.mk b/src/3rdparty/freetype/src/raster/module.mk index b115f416b2..0a6d4b09d9 100644 --- a/src/3rdparty/freetype/src/raster/module.mk +++ b/src/3rdparty/freetype/src/raster/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/raster/raster.c b/src/3rdparty/freetype/src/raster/raster.c index 76edd21e1e..e3ac9e566a 100644 --- a/src/3rdparty/freetype/src/raster/raster.c +++ b/src/3rdparty/freetype/src/raster/raster.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* raster.c */ -/* */ -/* FreeType monochrome rasterer module component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * raster.c + * + * FreeType monochrome rasterer module component (body only). + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT @@ -21,7 +21,6 @@ #include "ftraster.c" #include "ftrend1.c" -#include "rastpic.c" /* END */ diff --git a/src/3rdparty/freetype/src/raster/rasterrs.h b/src/3rdparty/freetype/src/raster/rasterrs.h index 22a3e15340..7266407365 100644 --- a/src/3rdparty/freetype/src/raster/rasterrs.h +++ b/src/3rdparty/freetype/src/raster/rasterrs.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* rasterrs.h */ -/* */ -/* monochrome renderer error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the monochrome renderer error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * rasterrs.h + * + * monochrome renderer error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the monochrome renderer error enumeration + * constants. + * + */ #ifndef RASTERRS_H_ #define RASTERRS_H_ diff --git a/src/3rdparty/freetype/src/raster/rules.mk b/src/3rdparty/freetype/src/raster/rules.mk index 9aef1f0bab..7664671e80 100644 --- a/src/3rdparty/freetype/src/raster/rules.mk +++ b/src/3rdparty/freetype/src/raster/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -28,8 +28,7 @@ RASTER_COMPILE := $(CC) $(ANSIFLAGS) \ # raster driver sources (i.e., C files) # RASTER_DRV_SRC := $(RASTER_DIR)/ftraster.c \ - $(RASTER_DIR)/ftrend1.c \ - $(RASTER_DIR)/rastpic.c + $(RASTER_DIR)/ftrend1.c # raster driver headers diff --git a/src/3rdparty/freetype/src/sfnt/Jamfile b/src/3rdparty/freetype/src/sfnt/Jamfile index 57977fc966..f646b3526e 100644 --- a/src/3rdparty/freetype/src/sfnt/Jamfile +++ b/src/3rdparty/freetype/src/sfnt/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/sfnt Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -22,6 +22,8 @@ SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ; sfobjs ttbdf ttcmap + ttcolr + ttcpal ttkern ttload ttmtx diff --git a/src/3rdparty/freetype/src/sfnt/module.mk b/src/3rdparty/freetype/src/sfnt/module.mk index 51ca67e784..8c3b44fec7 100644 --- a/src/3rdparty/freetype/src/sfnt/module.mk +++ b/src/3rdparty/freetype/src/sfnt/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/sfnt/pngshim.c b/src/3rdparty/freetype/src/sfnt/pngshim.c index cd110776c8..ca85d9751f 100644 --- a/src/3rdparty/freetype/src/sfnt/pngshim.c +++ b/src/3rdparty/freetype/src/sfnt/pngshim.c @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* pngshim.c */ -/* */ -/* PNG Bitmap glyph support. */ -/* */ -/* Copyright 2013-2018 by */ -/* Google, Inc. */ -/* Written by Stuart Gill and Behdad Esfahbod. */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pngshim.c + * + * PNG Bitmap glyph support. + * + * Copyright (C) 2013-2019 by + * Google, Inc. + * Written by Stuart Gill and Behdad Esfahbod. + * + * 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 @@ -68,7 +68,6 @@ ( ( __clang_major__ >= 4 ) || \ ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ defined( __OPTIMIZE__ ) && \ - !defined( __EMSCRIPTEN__ ) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #ifdef __clang__ diff --git a/src/3rdparty/freetype/src/sfnt/pngshim.h b/src/3rdparty/freetype/src/sfnt/pngshim.h index 194238c3a2..06c6f6b20e 100644 --- a/src/3rdparty/freetype/src/sfnt/pngshim.h +++ b/src/3rdparty/freetype/src/sfnt/pngshim.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* pngshim.h */ -/* */ -/* PNG Bitmap glyph support. */ -/* */ -/* Copyright 2013-2018 by */ -/* Google, Inc. */ -/* Written by Stuart Gill and Behdad Esfahbod. */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * pngshim.h + * + * PNG Bitmap glyph support. + * + * Copyright (C) 2013-2019 by + * Google, Inc. + * Written by Stuart Gill and Behdad Esfahbod. + * + * 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 PNGSHIM_H_ diff --git a/src/3rdparty/freetype/src/sfnt/rules.mk b/src/3rdparty/freetype/src/sfnt/rules.mk index 83acc66a8f..ee3314eac3 100644 --- a/src/3rdparty/freetype/src/sfnt/rules.mk +++ b/src/3rdparty/freetype/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -28,17 +28,19 @@ SFNT_COMPILE := $(CC) $(ANSIFLAGS) \ # SFNT driver sources (i.e., C files) # -SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c \ - $(SFNT_DIR)/ttmtx.c \ +SFNT_DRV_SRC := $(SFNT_DIR)/pngshim.c \ + $(SFNT_DIR)/sfdriver.c \ + $(SFNT_DIR)/sfobjs.c \ + $(SFNT_DIR)/sfwoff.c \ + $(SFNT_DIR)/ttbdf.c \ $(SFNT_DIR)/ttcmap.c \ - $(SFNT_DIR)/ttsbit.c \ - $(SFNT_DIR)/ttpost.c \ + $(SFNT_DIR)/ttcolr.c \ + $(SFNT_DIR)/ttcpal.c \ $(SFNT_DIR)/ttkern.c \ - $(SFNT_DIR)/ttbdf.c \ - $(SFNT_DIR)/sfobjs.c \ - $(SFNT_DIR)/sfdriver.c \ - $(SFNT_DIR)/sfntpic.c \ - $(SFNT_DIR)/pngshim.c + $(SFNT_DIR)/ttload.c \ + $(SFNT_DIR)/ttmtx.c \ + $(SFNT_DIR)/ttpost.c \ + $(SFNT_DIR)/ttsbit.c # SFNT driver headers # diff --git a/src/3rdparty/freetype/src/sfnt/sfdriver.c b/src/3rdparty/freetype/src/sfnt/sfdriver.c index 303e1ca9f1..2611685284 100644 --- a/src/3rdparty/freetype/src/sfnt/sfdriver.c +++ b/src/3rdparty/freetype/src/sfnt/sfdriver.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* sfdriver.c */ -/* */ -/* High-level SFNT driver interface (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * sfdriver.c + * + * High-level SFNT driver interface (body). + * + * Copyright (C) 1996-2019 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 @@ -25,7 +25,6 @@ #include "sfdriver.h" #include "ttload.h" #include "sfobjs.h" -#include "sfntpic.h" #include "sferrors.h" @@ -33,6 +32,11 @@ #include "ttsbit.h" #endif +#ifdef TT_CONFIG_OPTION_COLOR_LAYERS +#include "ttcolr.h" +#include "ttcpal.h" +#endif + #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES #include "ttpost.h" #endif @@ -57,18 +61,18 @@ #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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_sfdriver +#define FT_COMPONENT sfdriver /* - * SFNT TABLE SERVICE + * SFNT TABLE SERVICE * */ @@ -155,7 +159,7 @@ #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES /* - * GLYPH DICT SERVICE + * GLYPH DICT SERVICE * */ @@ -178,8 +182,8 @@ static FT_UInt - sfnt_get_name_index( FT_Face face, - FT_String* glyph_name ) + sfnt_get_name_index( FT_Face face, + const FT_String* glyph_name ) { TT_Face ttface = (TT_Face)face; @@ -222,7 +226,7 @@ /* - * POSTSCRIPT NAME SERVICE + * POSTSCRIPT NAME SERVICE * */ @@ -371,47 +375,61 @@ { case 15: k4 ^= (FT_UInt32)tail[14] << 16; + /* fall through */ case 14: k4 ^= (FT_UInt32)tail[13] << 8; + /* fall through */ case 13: k4 ^= (FT_UInt32)tail[12]; k4 *= c4; k4 = ROTL32( k4, 18 ); k4 *= c1; h4 ^= k4; + /* fall through */ case 12: k3 ^= (FT_UInt32)tail[11] << 24; + /* fall through */ case 11: k3 ^= (FT_UInt32)tail[10] << 16; + /* fall through */ case 10: k3 ^= (FT_UInt32)tail[9] << 8; + /* fall through */ case 9: k3 ^= (FT_UInt32)tail[8]; k3 *= c3; k3 = ROTL32( k3, 17 ); k3 *= c4; h3 ^= k3; + /* fall through */ case 8: k2 ^= (FT_UInt32)tail[7] << 24; + /* fall through */ case 7: k2 ^= (FT_UInt32)tail[6] << 16; + /* fall through */ case 6: k2 ^= (FT_UInt32)tail[5] << 8; + /* fall through */ case 5: k2 ^= (FT_UInt32)tail[4]; k2 *= c2; k2 = ROTL32( k2, 16 ); k2 *= c3; h2 ^= k2; + /* fall through */ case 4: k1 ^= (FT_UInt32)tail[3] << 24; + /* fall through */ case 3: k1 ^= (FT_UInt32)tail[2] << 16; + /* fall through */ case 2: k1 ^= (FT_UInt32)tail[1] << 8; + /* fall through */ case 1: k1 ^= (FT_UInt32)tail[0]; k1 *= c1; @@ -460,14 +478,12 @@ typedef int (*char_type_func)( int c ); - /* handling of PID/EID 3/0 and 3/1 is the same */ + /* Handling of PID/EID 3/0 and 3/1 is the same. */ #define IS_WIN( n ) ( (n)->platformID == 3 && \ - ( (n)->encodingID == 1 || (n)->encodingID == 0 ) && \ - (n)->languageID == 0x409 ) + ( (n)->encodingID == 1 || (n)->encodingID == 0 ) ) #define IS_APPLE( n ) ( (n)->platformID == 1 && \ - (n)->encodingID == 0 && \ - (n)->languageID == 0 ) + (n)->encodingID == 0 ) static char* get_win_string( FT_Memory memory, @@ -491,42 +507,40 @@ if ( FT_STREAM_SEEK( entry->stringOffset ) || FT_FRAME_ENTER( entry->stringLength ) ) - { - FT_FREE( result ); - entry->stringLength = 0; - entry->stringOffset = 0; - FT_FREE( entry->string ); - - return NULL; - } + goto get_win_string_error; r = (FT_String*)result; p = (FT_Char*)stream->cursor; for ( len = entry->stringLength / 2; len > 0; len--, p += 2 ) { - if ( p[0] == 0 ) + if ( p[0] == 0 && char_type( p[1] ) ) + *r++ = p[1]; + else { - if ( char_type( p[1] ) ) - *r++ = p[1]; - else - { - if ( report_invalid_characters ) - { - FT_TRACE0(( "get_win_string:" - " Character `%c' (0x%X) invalid in PS name string\n", - p[1], p[1] )); - /* it's not the job of FreeType to correct PS names... */ - *r++ = p[1]; - } - } + if ( report_invalid_characters ) + FT_TRACE0(( "get_win_string:" + " Character 0x%X invalid in PS name string\n", + ((unsigned)p[0])*256 + (unsigned)p[1] )); + break; } } - *r = '\0'; + if ( !len ) + *r = '\0'; FT_FRAME_EXIT(); - return result; + if ( !len ) + return result; + + get_win_string_error: + FT_FREE( result ); + + entry->stringLength = 0; + entry->stringOffset = 0; + FT_FREE( entry->string ); + + return NULL; } @@ -552,14 +566,7 @@ if ( FT_STREAM_SEEK( entry->stringOffset ) || FT_FRAME_ENTER( entry->stringLength ) ) - { - FT_FREE( result ); - entry->stringOffset = 0; - entry->stringLength = 0; - FT_FREE( entry->string ); - - return NULL; - } + goto get_apple_string_error; r = (FT_String*)result; p = (FT_Char*)stream->cursor; @@ -571,20 +578,28 @@ else { if ( report_invalid_characters ) - { FT_TRACE0(( "get_apple_string:" " Character `%c' (0x%X) invalid in PS name string\n", *p, *p )); - /* it's not the job of FreeType to correct PS names... */ - *r++ = *p; - } + break; } } - *r = '\0'; + if ( !len ) + *r = '\0'; FT_FRAME_EXIT(); - return result; + if ( !len ) + return result; + + get_apple_string_error: + FT_FREE( result ); + + entry->stringOffset = 0; + entry->stringLength = 0; + FT_FREE( entry->string ); + + return NULL; } @@ -607,10 +622,10 @@ if ( name->nameID == id && name->stringLength > 0 ) { - if ( IS_WIN( name ) ) + if ( IS_WIN( name ) && ( name->languageID == 0x409 || *win == -1 ) ) *win = n; - if ( IS_APPLE( name ) ) + if ( IS_APPLE( name ) && ( name->languageID == 0 || *apple == -1 ) ) *apple = n; } } @@ -643,9 +658,9 @@ /* - * Find the shortest decimal representation of a 16.16 fixed point - * number. The function fills `buf' with the result, returning a pointer - * to the position after the representation's last byte. + * Find the shortest decimal representation of a 16.16 fixed point + * number. The function fills `buf' with the result, returning a pointer + * to the position after the representation's last byte. */ static char* @@ -673,7 +688,7 @@ if ( fixed < 0 ) { *p++ = '-'; - fixed = -fixed; + fixed = NEG_INT( fixed ); } int_part = ( fixed >> 16 ) & 0xFFFF; @@ -828,13 +843,20 @@ face->name_table.names + win, sfnt_is_alphanumeric, 0 ); - else + if ( !result && apple != -1 ) result = get_apple_string( face->root.memory, face->name_table.stream, face->name_table.names + apple, sfnt_is_alphanumeric, 0 ); + if ( !result ) + { + FT_TRACE0(( "sfnt_get_var_ps_name:" + " No valid PS name prefix for font instances found\n" )); + return NULL; + } + len = ft_strlen( result ); /* sanitize if necessary; we reserve space for 36 bytes (a 128bit */ @@ -1052,7 +1074,7 @@ face->name_table.names + win, sfnt_is_postscript, 1 ); - else + if ( !result && apple != -1 ) result = get_apple_string( face->root.memory, face->name_table.stream, face->name_table.names + apple, @@ -1073,7 +1095,7 @@ /* - * TT CMAP INFO + * TT CMAP INFO */ FT_DEFINE_SERVICE_TTCMAPSREC( tt_service_get_cmap_info, @@ -1132,41 +1154,41 @@ /* - * SERVICE LIST + * SERVICE LIST */ #if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF FT_DEFINE_SERVICEDESCREC5( sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &SFNT_SERVICE_GLYPH_DICT_GET, - FT_SERVICE_ID_BDF, &SFNT_SERVICE_BDF_GET, - FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET ) + FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name, + FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict, + FT_SERVICE_ID_BDF, &sfnt_service_bdf, + FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info ) #elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES FT_DEFINE_SERVICEDESCREC4( sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &SFNT_SERVICE_GLYPH_DICT_GET, - FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET ) + FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name, + FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict, + FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info ) #elif defined TT_CONFIG_OPTION_BDF FT_DEFINE_SERVICEDESCREC4( sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_BDF, &SFNT_SERVICE_BDF_GET, - FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET ) + FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name, + FT_SERVICE_ID_BDF, &sfnt_service_bdf, + FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info ) #else FT_DEFINE_SERVICEDESCREC3( sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET ) + FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name, + FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info ) #endif @@ -1174,21 +1196,9 @@ sfnt_get_interface( FT_Module module, const char* module_interface ) { - /* SFNT_SERVICES_GET dereferences `library' in PIC mode */ -#ifdef FT_CONFIG_OPTION_PIC - FT_Library library; - - - if ( !module ) - return NULL; - library = module->library; - if ( !library ) - return NULL; -#else FT_UNUSED( module ); -#endif - return ft_service_list_lookup( SFNT_SERVICES_GET, module_interface ); + return ft_service_list_lookup( sfnt_services, module_interface ); } @@ -1198,6 +1208,12 @@ #define PUT_EMBEDDED_BITMAPS( a ) NULL #endif +#ifdef TT_CONFIG_OPTION_COLOR_LAYERS +#define PUT_COLOR_LAYERS( a ) a +#else +#define PUT_COLOR_LAYERS( a ) NULL +#endif + #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES #define PUT_PS_NAMES( a ) a #else @@ -1256,9 +1272,24 @@ /* 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 */ + PUT_COLOR_LAYERS( tt_face_load_colr ), + /* TT_Load_Table_Func load_colr */ + PUT_COLOR_LAYERS( tt_face_free_cpal ), + /* TT_Free_Table_Func free_cpal */ + PUT_COLOR_LAYERS( tt_face_free_colr ), + /* TT_Free_Table_Func free_colr */ + PUT_COLOR_LAYERS( tt_face_palette_set ), + /* 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( tt_face_colr_blend_layer ), + /* TT_Blend_Colr_Func colr_blend */ tt_face_get_metrics, /* TT_Get_Metrics_Func get_metrics */ @@ -1277,7 +1308,7 @@ 0x10000L, /* driver version 1.0 */ 0x20000L, /* driver requires FreeType 2.0 or higher */ - (const void*)&SFNT_INTERFACE_GET, /* module specific interface */ + (const void*)&sfnt_interface, /* module specific interface */ (FT_Module_Constructor)NULL, /* module_init */ (FT_Module_Destructor) NULL, /* module_done */ diff --git a/src/3rdparty/freetype/src/sfnt/sfdriver.h b/src/3rdparty/freetype/src/sfnt/sfdriver.h index 81c22d2887..8c174634b3 100644 --- a/src/3rdparty/freetype/src/sfnt/sfdriver.h +++ b/src/3rdparty/freetype/src/sfnt/sfdriver.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* sfdriver.h */ -/* */ -/* High-level SFNT driver interface (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * sfdriver.h + * + * High-level SFNT driver interface (specification). + * + * Copyright (C) 1996-2019 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 SFDRIVER_H_ @@ -26,10 +26,8 @@ FT_BEGIN_HEADER - FT_DECLARE_MODULE( sfnt_module_class ) - FT_END_HEADER #endif /* SFDRIVER_H_ */ diff --git a/src/3rdparty/freetype/src/sfnt/sferrors.h b/src/3rdparty/freetype/src/sfnt/sferrors.h index 74003d4b38..43e148d295 100644 --- a/src/3rdparty/freetype/src/sfnt/sferrors.h +++ b/src/3rdparty/freetype/src/sfnt/sferrors.h @@ -1,26 +1,26 @@ -/***************************************************************************/ -/* */ -/* sferrors.h */ -/* */ -/* SFNT error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the SFNT error enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * sferrors.h + * + * SFNT error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the SFNT error enumeration constants. + * + */ #ifndef SFERRORS_H_ #define SFERRORS_H_ diff --git a/src/3rdparty/freetype/src/sfnt/sfnt.c b/src/3rdparty/freetype/src/sfnt/sfnt.c index 8b9a6b345d..b4faf34a3a 100644 --- a/src/3rdparty/freetype/src/sfnt/sfnt.c +++ b/src/3rdparty/freetype/src/sfnt/sfnt.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* sfnt.c */ -/* */ -/* Single object library component. */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * sfnt.c + * + * Single object library component. + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT @@ -21,10 +21,13 @@ #include "pngshim.c" #include "sfdriver.c" -#include "sfntpic.c" #include "sfobjs.c" +#include "sfwoff.c" #include "ttbdf.c" #include "ttcmap.c" +#include "ttcolr.c" +#include "ttcpal.c" + #include "ttkern.c" #include "ttload.c" #include "ttmtx.c" diff --git a/src/3rdparty/freetype/src/sfnt/sfobjs.c b/src/3rdparty/freetype/src/sfnt/sfobjs.c index 6ba8509f56..6edf3ae1de 100644 --- a/src/3rdparty/freetype/src/sfnt/sfobjs.c +++ b/src/3rdparty/freetype/src/sfnt/sfobjs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* sfobjs.c */ -/* */ -/* SFNT object management (base). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * sfobjs.c + * + * SFNT object management (base). + * + * Copyright (C) 1996-2019 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 @@ -21,13 +21,13 @@ #include "ttload.h" #include "ttcmap.h" #include "ttkern.h" +#include "sfwoff.h" #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_DEBUG_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_SFNT_NAMES_H -#include FT_GZIP_H #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_SERVICE_MULTIPLE_MASTERS_H @@ -41,14 +41,14 @@ #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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_sfobjs +#define FT_COMPONENT sfobjs @@ -337,403 +337,6 @@ } -#define WRITE_USHORT( p, v ) \ - do \ - { \ - *(p)++ = (FT_Byte)( (v) >> 8 ); \ - *(p)++ = (FT_Byte)( (v) >> 0 ); \ - \ - } while ( 0 ) - -#define WRITE_ULONG( p, v ) \ - do \ - { \ - *(p)++ = (FT_Byte)( (v) >> 24 ); \ - *(p)++ = (FT_Byte)( (v) >> 16 ); \ - *(p)++ = (FT_Byte)( (v) >> 8 ); \ - *(p)++ = (FT_Byte)( (v) >> 0 ); \ - \ - } while ( 0 ) - - - static void - sfnt_stream_close( FT_Stream stream ) - { - FT_Memory memory = stream->memory; - - - FT_FREE( stream->base ); - - stream->size = 0; - stream->base = NULL; - stream->close = NULL; - } - - - FT_CALLBACK_DEF( int ) - compare_offsets( const void* a, - const void* b ) - { - WOFF_Table table1 = *(WOFF_Table*)a; - WOFF_Table table2 = *(WOFF_Table*)b; - - FT_ULong offset1 = table1->Offset; - FT_ULong offset2 = table2->Offset; - - - if ( offset1 > offset2 ) - return 1; - else if ( offset1 < offset2 ) - return -1; - else - return 0; - } - - - /* Replace `face->root.stream' with a stream containing the extracted */ - /* SFNT of a WOFF font. */ - - static FT_Error - woff_open_font( FT_Stream stream, - TT_Face face ) - { - FT_Memory memory = stream->memory; - FT_Error error = FT_Err_Ok; - - WOFF_HeaderRec woff; - WOFF_Table tables = NULL; - WOFF_Table* indices = NULL; - - FT_ULong woff_offset; - - FT_Byte* sfnt = NULL; - FT_Stream sfnt_stream = NULL; - - FT_Byte* sfnt_header; - FT_ULong sfnt_offset; - - FT_Int nn; - FT_ULong old_tag = 0; - - static const FT_Frame_Field woff_header_fields[] = - { -#undef FT_STRUCTURE -#define FT_STRUCTURE WOFF_HeaderRec - - FT_FRAME_START( 44 ), - FT_FRAME_ULONG ( signature ), - FT_FRAME_ULONG ( flavor ), - FT_FRAME_ULONG ( length ), - FT_FRAME_USHORT( num_tables ), - FT_FRAME_USHORT( reserved ), - FT_FRAME_ULONG ( totalSfntSize ), - FT_FRAME_USHORT( majorVersion ), - FT_FRAME_USHORT( minorVersion ), - FT_FRAME_ULONG ( metaOffset ), - FT_FRAME_ULONG ( metaLength ), - FT_FRAME_ULONG ( metaOrigLength ), - FT_FRAME_ULONG ( privOffset ), - FT_FRAME_ULONG ( privLength ), - FT_FRAME_END - }; - - - FT_ASSERT( stream == face->root.stream ); - FT_ASSERT( FT_STREAM_POS() == 0 ); - - if ( FT_STREAM_READ_FIELDS( woff_header_fields, &woff ) ) - return error; - - /* Make sure we don't recurse back here or hit TTC code. */ - if ( woff.flavor == TTAG_wOFF || woff.flavor == TTAG_ttcf ) - return FT_THROW( Invalid_Table ); - - /* Miscellaneous checks. */ - if ( woff.length != stream->size || - woff.num_tables == 0 || - 44 + woff.num_tables * 20UL >= woff.length || - 12 + woff.num_tables * 16UL >= woff.totalSfntSize || - ( woff.totalSfntSize & 3 ) != 0 || - ( woff.metaOffset == 0 && ( woff.metaLength != 0 || - woff.metaOrigLength != 0 ) ) || - ( woff.metaLength != 0 && woff.metaOrigLength == 0 ) || - ( woff.privOffset == 0 && woff.privLength != 0 ) ) - { - FT_ERROR(( "woff_font_open: invalid WOFF header\n" )); - return FT_THROW( Invalid_Table ); - } - - /* Don't trust `totalSfntSize' before thorough checks. */ - if ( FT_ALLOC( sfnt, 12 + woff.num_tables * 16UL ) || - FT_NEW( sfnt_stream ) ) - goto Exit; - - sfnt_header = sfnt; - - /* Write sfnt header. */ - { - FT_UInt searchRange, entrySelector, rangeShift, x; - - - x = woff.num_tables; - entrySelector = 0; - while ( x ) - { - x >>= 1; - entrySelector += 1; - } - entrySelector--; - - searchRange = ( 1 << entrySelector ) * 16; - rangeShift = woff.num_tables * 16 - searchRange; - - WRITE_ULONG ( sfnt_header, woff.flavor ); - WRITE_USHORT( sfnt_header, woff.num_tables ); - WRITE_USHORT( sfnt_header, searchRange ); - WRITE_USHORT( sfnt_header, entrySelector ); - WRITE_USHORT( sfnt_header, rangeShift ); - } - - /* While the entries in the sfnt header must be sorted by the */ - /* tag value, the tables themselves are not. We thus have to */ - /* sort them by offset and check that they don't overlap. */ - - if ( FT_NEW_ARRAY( tables, woff.num_tables ) || - FT_NEW_ARRAY( indices, woff.num_tables ) ) - goto Exit; - - FT_TRACE2(( "\n" - " tag offset compLen origLen checksum\n" - " -------------------------------------------\n" )); - - if ( FT_FRAME_ENTER( 20L * woff.num_tables ) ) - goto Exit; - - for ( nn = 0; nn < woff.num_tables; nn++ ) - { - WOFF_Table table = tables + nn; - - table->Tag = FT_GET_TAG4(); - table->Offset = FT_GET_ULONG(); - table->CompLength = FT_GET_ULONG(); - table->OrigLength = FT_GET_ULONG(); - table->CheckSum = FT_GET_ULONG(); - - FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx %08lx\n", - (FT_Char)( table->Tag >> 24 ), - (FT_Char)( table->Tag >> 16 ), - (FT_Char)( table->Tag >> 8 ), - (FT_Char)( table->Tag ), - table->Offset, - table->CompLength, - table->OrigLength, - table->CheckSum )); - - if ( table->Tag <= old_tag ) - { - FT_FRAME_EXIT(); - - FT_ERROR(( "woff_font_open: table tags are not sorted\n" )); - error = FT_THROW( Invalid_Table ); - goto Exit; - } - - old_tag = table->Tag; - indices[nn] = table; - } - - FT_FRAME_EXIT(); - - /* Sort by offset. */ - - ft_qsort( indices, - woff.num_tables, - sizeof ( WOFF_Table ), - compare_offsets ); - - /* Check offsets and lengths. */ - - woff_offset = 44 + woff.num_tables * 20L; - sfnt_offset = 12 + woff.num_tables * 16L; - - for ( nn = 0; nn < woff.num_tables; nn++ ) - { - WOFF_Table table = indices[nn]; - - - if ( table->Offset != woff_offset || - table->CompLength > woff.length || - table->Offset > woff.length - table->CompLength || - table->OrigLength > woff.totalSfntSize || - sfnt_offset > woff.totalSfntSize - table->OrigLength || - table->CompLength > table->OrigLength ) - { - FT_ERROR(( "woff_font_open: invalid table offsets\n" )); - error = FT_THROW( Invalid_Table ); - goto Exit; - } - - table->OrigOffset = sfnt_offset; - - /* The offsets must be multiples of 4. */ - woff_offset += ( table->CompLength + 3 ) & ~3U; - sfnt_offset += ( table->OrigLength + 3 ) & ~3U; - } - - /* - * Final checks! - * - * We don't decode and check the metadata block. - * We don't check table checksums either. - * But other than those, I think we implement all - * `MUST' checks from the spec. - */ - - if ( woff.metaOffset ) - { - if ( woff.metaOffset != woff_offset || - woff.metaOffset + woff.metaLength > woff.length ) - { - FT_ERROR(( "woff_font_open:" - " invalid `metadata' offset or length\n" )); - error = FT_THROW( Invalid_Table ); - goto Exit; - } - - /* We have padding only ... */ - woff_offset += woff.metaLength; - } - - if ( woff.privOffset ) - { - /* ... if it isn't the last block. */ - woff_offset = ( woff_offset + 3 ) & ~3U; - - if ( woff.privOffset != woff_offset || - woff.privOffset + woff.privLength > woff.length ) - { - FT_ERROR(( "woff_font_open: invalid `private' offset or length\n" )); - error = FT_THROW( Invalid_Table ); - goto Exit; - } - - /* No padding for the last block. */ - woff_offset += woff.privLength; - } - - if ( sfnt_offset != woff.totalSfntSize || - woff_offset != woff.length ) - { - FT_ERROR(( "woff_font_open: invalid `sfnt' table structure\n" )); - error = FT_THROW( Invalid_Table ); - goto Exit; - } - - /* Now use `totalSfntSize'. */ - if ( FT_REALLOC( sfnt, - 12 + woff.num_tables * 16UL, - woff.totalSfntSize ) ) - goto Exit; - - sfnt_header = sfnt + 12; - - /* Write the tables. */ - - for ( nn = 0; nn < woff.num_tables; nn++ ) - { - WOFF_Table table = tables + nn; - - - /* Write SFNT table entry. */ - WRITE_ULONG( sfnt_header, table->Tag ); - WRITE_ULONG( sfnt_header, table->CheckSum ); - WRITE_ULONG( sfnt_header, table->OrigOffset ); - WRITE_ULONG( sfnt_header, table->OrigLength ); - - /* Write table data. */ - if ( FT_STREAM_SEEK( table->Offset ) || - FT_FRAME_ENTER( table->CompLength ) ) - goto Exit; - - if ( table->CompLength == table->OrigLength ) - { - /* Uncompressed data; just copy. */ - ft_memcpy( sfnt + table->OrigOffset, - stream->cursor, - table->OrigLength ); - } - else - { -#ifdef FT_CONFIG_OPTION_USE_ZLIB - - /* Uncompress with zlib. */ - FT_ULong output_len = table->OrigLength; - - - error = FT_Gzip_Uncompress( memory, - sfnt + table->OrigOffset, &output_len, - stream->cursor, table->CompLength ); - if ( error ) - goto Exit; - if ( output_len != table->OrigLength ) - { - FT_ERROR(( "woff_font_open: compressed table length mismatch\n" )); - error = FT_THROW( Invalid_Table ); - goto Exit; - } - -#else /* !FT_CONFIG_OPTION_USE_ZLIB */ - - error = FT_THROW( Unimplemented_Feature ); - goto Exit; - -#endif /* !FT_CONFIG_OPTION_USE_ZLIB */ - } - - FT_FRAME_EXIT(); - - /* We don't check whether the padding bytes in the WOFF file are */ - /* actually '\0'. For the output, however, we do set them properly. */ - sfnt_offset = table->OrigOffset + table->OrigLength; - while ( sfnt_offset & 3 ) - { - sfnt[sfnt_offset] = '\0'; - sfnt_offset++; - } - } - - /* Ok! Finally ready. Swap out stream and return. */ - FT_Stream_OpenMemory( sfnt_stream, sfnt, woff.totalSfntSize ); - sfnt_stream->memory = stream->memory; - sfnt_stream->close = sfnt_stream_close; - - FT_Stream_Free( - face->root.stream, - ( face->root.face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 ); - - face->root.stream = sfnt_stream; - - face->root.face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM; - - Exit: - FT_FREE( tables ); - FT_FREE( indices ); - - if ( error ) - { - FT_FREE( sfnt ); - FT_Stream_Close( sfnt_stream ); - FT_FREE( sfnt_stream ); - } - - return error; - } - - -#undef WRITE_USHORT -#undef WRITE_ULONG - - /* Fill in face->ttc_header. If the font is not a TTC, it is */ /* synthesized into a TTC with one offset table. */ static FT_Error @@ -918,7 +521,9 @@ /* Stream may have changed in sfnt_open_font. */ stream = face->root.stream; - FT_TRACE2(( "sfnt_init_face: %08p, %d\n", face, face_instance_index )); + FT_TRACE2(( "sfnt_init_face: %08p (index %d)\n", + face, + face_instance_index )); face_index = FT_ABS( face_instance_index ) & 0xFFFF; @@ -1001,15 +606,15 @@ face->variation_support |= TT_FACE_FLAG_VAR_FVAR; /* - * As documented in the OpenType specification, an entry for the - * default instance may be omitted in the named instance table. In - * particular this means that even if there is no named instance - * table in the font we actually do have a named instance, namely the - * default instance. + * As documented in the OpenType specification, an entry for the + * default instance may be omitted in the named instance table. In + * particular this means that even if there is no named instance + * table in the font we actually do have a named instance, namely the + * default instance. * - * For consistency, we always want the default instance in our list - * of named instances. If it is missing, we try to synthesize it - * later on. Here, we have to adjust `num_instances' accordingly. + * For consistency, we always want the default instance in our list + * of named instances. If it is missing, we try to synthesize it + * later on. Here, we have to adjust `num_instances' accordingly. */ if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) && @@ -1341,6 +946,13 @@ if ( sfnt->load_eblc ) LOAD_( eblc ); + /* colored glyph support */ + if ( sfnt->load_cpal ) + { + LOAD_( cpal ); + LOAD_( colr ); + } + /* consider the pclt, kerning, and gasp tables as optional */ LOAD_( pclt ); LOAD_( gasp ); @@ -1389,12 +1001,13 @@ FT_Long flags = root->face_flags; - /*********************************************************************/ - /* */ - /* Compute face flags. */ - /* */ + /********************************************************************** + * + * Compute face flags. + */ if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_CBLC || - face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX ) + face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX || + face->colr ) flags |= FT_FACE_FLAG_COLOR; /* color glyphs */ if ( has_outline == TRUE ) @@ -1438,10 +1051,10 @@ root->face_flags = flags; - /*********************************************************************/ - /* */ - /* Compute style flags. */ - /* */ + /********************************************************************** + * + * Compute style flags. + */ flags = 0; if ( has_outline == TRUE && face->os2.version != 0xFFFFU ) @@ -1471,14 +1084,14 @@ root->style_flags |= flags; - /*********************************************************************/ - /* */ - /* Polish the charmaps. */ - /* */ - /* Try to set the charmap encoding according to the platform & */ - /* encoding ID of each charmap. Emulate Unicode charmap if one */ - /* is missing. */ - /* */ + /********************************************************************** + * + * Polish the charmaps. + * + * Try to set the charmap encoding according to the platform & + * encoding ID of each charmap. Emulate Unicode charmap if one + * is missing. + */ tt_face_build_cmaps( face ); /* ignore errors */ @@ -1521,7 +1134,8 @@ error = FT_CMap_New( (FT_CMap_Class)&tt_cmap_unicode_class_rec, NULL, &cmaprec, NULL ); if ( error && - FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) && + FT_ERR_NEQ( error, Unimplemented_Feature ) ) goto Exit; error = FT_Err_Ok; @@ -1533,9 +1147,9 @@ #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* - * Now allocate the root array of FT_Bitmap_Size records and - * populate them. Unfortunately, it isn't possible to indicate bit - * depths in the FT_Bitmap_Size record. This is a design error. + * Now allocate the root array of FT_Bitmap_Size records and + * populate them. Unfortunately, it isn't possible to indicate bit + * depths in the FT_Bitmap_Size record. This is a design error. */ { FT_UInt count; @@ -1615,10 +1229,10 @@ root->face_flags |= FT_FACE_FLAG_SCALABLE; - /*********************************************************************/ - /* */ - /* Set up metrics. */ - /* */ + /********************************************************************** + * + * Set up metrics. + */ if ( FT_IS_SCALABLE( root ) ) { /* XXX What about if outline header is missing */ @@ -1630,59 +1244,73 @@ root->units_per_EM = face->header.Units_Per_EM; - /* XXX: Computing the ascender/descender/height is very different */ - /* from what the specification tells you. Apparently, we */ - /* must be careful because */ - /* */ - /* - not all fonts have an OS/2 table; in this case, we take */ - /* the values in the horizontal header. However, these */ - /* values very often are not reliable. */ - /* */ - /* - otherwise, the correct typographic values are in the */ - /* sTypoAscender, sTypoDescender & sTypoLineGap fields. */ - /* */ - /* However, certain fonts have these fields set to 0. */ - /* Rather, they have usWinAscent & usWinDescent correctly */ - /* set (but with different values). */ - /* */ - /* As an example, Arial Narrow is implemented through four */ - /* files ARIALN.TTF, ARIALNI.TTF, ARIALNB.TTF & ARIALNBI.TTF */ - /* */ - /* Strangely, all fonts have the same values in their */ - /* sTypoXXX fields, except ARIALNB which sets them to 0. */ - /* */ - /* On the other hand, they all have different */ - /* usWinAscent/Descent values -- as a conclusion, the OS/2 */ - /* table cannot be used to compute the text height reliably! */ - /* */ - - /* The ascender and descender are taken from the `hhea' table. */ - /* If zero, they are taken from the `OS/2' table. */ - - root->ascender = face->horizontal.Ascender; - root->descender = face->horizontal.Descender; - - root->height = root->ascender - root->descender + - face->horizontal.Line_Gap; - - if ( !( root->ascender || root->descender ) ) + /* + * Computing the ascender/descender/height is tricky. + * + * The OpenType specification v1.8.3 says: + * + * [OS/2's] sTypoAscender, sTypoDescender and sTypoLineGap fields + * are intended to allow applications to lay out documents in a + * typographically-correct and portable fashion. + * + * This is somewhat at odds with the decades of backwards + * compatibility, operating systems and applications doing whatever + * they want, not to mention broken fonts. + * + * Not all fonts have an OS/2 table; in this case, we take the values + * in the horizontal header, although there is nothing stopping the + * values from being unreliable. Even with a OS/2 table, certain fonts + * set the sTypoAscender, sTypoDescender and sTypoLineGap fields to 0 + * and instead correctly set usWinAscent and usWinDescent. + * + * As an example, Arial Narrow is shipped as four files ARIALN.TTF, + * ARIALNI.TTF, ARIALNB.TTF and ARIALNBI.TTF. Strangely, all fonts have + * the same values in their sTypo* fields, except ARIALNB.ttf which + * sets them to 0. All of them have different usWinAscent/Descent + * values. The OS/2 table therefore cannot be trusted for computing the + * text height reliably. + * + * As a compromise, do the following: + * + * 1. If the OS/2 table exists and the fsSelection bit 7 is set + * (USE_TYPO_METRICS), trust the font and use the sTypo* metrics. + * 2. Otherwise, use the `hhea' table's metrics. + * 3. If they are zero and the OS/2 table exists, + * 1. use the OS/2 table's sTypo* metrics if they are non-zero. + * 2. Otherwise, use the OS/2 table's usWin* metrics. + */ + + if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 128 ) { - if ( face->os2.version != 0xFFFFU ) - { - if ( face->os2.sTypoAscender || face->os2.sTypoDescender ) - { - root->ascender = face->os2.sTypoAscender; - root->descender = face->os2.sTypoDescender; + root->ascender = face->os2.sTypoAscender; + root->descender = face->os2.sTypoDescender; + root->height = root->ascender - root->descender + + face->os2.sTypoLineGap; + } + else + { + root->ascender = face->horizontal.Ascender; + root->descender = face->horizontal.Descender; + root->height = root->ascender - root->descender + + face->horizontal.Line_Gap; - root->height = root->ascender - root->descender + - face->os2.sTypoLineGap; - } - else + if ( !( root->ascender || root->descender ) ) + { + if ( face->os2.version != 0xFFFFU ) { - root->ascender = (FT_Short)face->os2.usWinAscent; - root->descender = -(FT_Short)face->os2.usWinDescent; - - root->height = root->ascender - root->descender; + if ( face->os2.sTypoAscender || face->os2.sTypoDescender ) + { + root->ascender = face->os2.sTypoAscender; + root->descender = face->os2.sTypoDescender; + root->height = root->ascender - root->descender + + face->os2.sTypoLineGap; + } + else + { + root->ascender = (FT_Short)face->os2.usWinAscent; + root->descender = -(FT_Short)face->os2.usWinDescent; + root->height = root->ascender - root->descender; + } } } } @@ -1737,6 +1365,13 @@ /* destroy the embedded bitmaps table if it is loaded */ if ( sfnt->free_eblc ) sfnt->free_eblc( face ); + + /* destroy color table data if it is loaded */ + if ( sfnt->free_cpal ) + { + sfnt->free_cpal( face ); + sfnt->free_colr( face ); + } } #ifdef TT_CONFIG_OPTION_BDF @@ -1792,11 +1427,18 @@ FT_FREE( face->sbit_strike_map ); face->root.num_fixed_sizes = 0; -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_FREE( face->postscript_name ); + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_FREE( face->var_postscript_prefix ); #endif + /* freeing glyph color palette data */ + FT_FREE( face->palette_data.palette_name_ids ); + FT_FREE( face->palette_data.palette_flags ); + FT_FREE( face->palette_data.palette_entry_name_ids ); + FT_FREE( face->palette ); + face->sfnt = NULL; } diff --git a/src/3rdparty/freetype/src/sfnt/sfobjs.h b/src/3rdparty/freetype/src/sfnt/sfobjs.h index 1b8d1be5b1..3fbf2dd6bd 100644 --- a/src/3rdparty/freetype/src/sfnt/sfobjs.h +++ b/src/3rdparty/freetype/src/sfnt/sfobjs.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* sfobjs.h */ -/* */ -/* SFNT object management (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * sfobjs.h + * + * SFNT object management (specification). + * + * Copyright (C) 1996-2019 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 SFOBJS_H_ @@ -53,7 +53,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* SFDRIVER_H_ */ +#endif /* SFOBJS_H_ */ /* END */ diff --git a/src/3rdparty/freetype/src/sfnt/sfwoff.c b/src/3rdparty/freetype/src/sfnt/sfwoff.c new file mode 100644 index 0000000000..ca4821a20a --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/sfwoff.c @@ -0,0 +1,434 @@ +/**************************************************************************** + * + * sfwoff.c + * + * WOFF format management (base). + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#include +#include "sfwoff.h" +#include FT_TRUETYPE_TAGS_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_GZIP_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 sfwoff + + +#define WRITE_USHORT( p, v ) \ + do \ + { \ + *(p)++ = (FT_Byte)( (v) >> 8 ); \ + *(p)++ = (FT_Byte)( (v) >> 0 ); \ + \ + } while ( 0 ) + +#define WRITE_ULONG( p, v ) \ + do \ + { \ + *(p)++ = (FT_Byte)( (v) >> 24 ); \ + *(p)++ = (FT_Byte)( (v) >> 16 ); \ + *(p)++ = (FT_Byte)( (v) >> 8 ); \ + *(p)++ = (FT_Byte)( (v) >> 0 ); \ + \ + } while ( 0 ) + + + static void + sfnt_stream_close( FT_Stream stream ) + { + FT_Memory memory = stream->memory; + + + FT_FREE( stream->base ); + + stream->size = 0; + stream->base = NULL; + stream->close = NULL; + } + + + FT_CALLBACK_DEF( int ) + compare_offsets( const void* a, + const void* b ) + { + WOFF_Table table1 = *(WOFF_Table*)a; + WOFF_Table table2 = *(WOFF_Table*)b; + + FT_ULong offset1 = table1->Offset; + FT_ULong offset2 = table2->Offset; + + + if ( offset1 > offset2 ) + return 1; + else if ( offset1 < offset2 ) + return -1; + else + return 0; + } + + + /* Replace `face->root.stream' with a stream containing the extracted */ + /* SFNT of a WOFF font. */ + + FT_LOCAL_DEF( FT_Error ) + woff_open_font( FT_Stream stream, + TT_Face face ) + { + FT_Memory memory = stream->memory; + FT_Error error = FT_Err_Ok; + + WOFF_HeaderRec woff; + WOFF_Table tables = NULL; + WOFF_Table* indices = NULL; + + FT_ULong woff_offset; + + FT_Byte* sfnt = NULL; + FT_Stream sfnt_stream = NULL; + + FT_Byte* sfnt_header; + FT_ULong sfnt_offset; + + FT_Int nn; + FT_ULong old_tag = 0; + + static const FT_Frame_Field woff_header_fields[] = + { +#undef FT_STRUCTURE +#define FT_STRUCTURE WOFF_HeaderRec + + FT_FRAME_START( 44 ), + FT_FRAME_ULONG ( signature ), + FT_FRAME_ULONG ( flavor ), + FT_FRAME_ULONG ( length ), + FT_FRAME_USHORT( num_tables ), + FT_FRAME_USHORT( reserved ), + FT_FRAME_ULONG ( totalSfntSize ), + FT_FRAME_USHORT( majorVersion ), + FT_FRAME_USHORT( minorVersion ), + FT_FRAME_ULONG ( metaOffset ), + FT_FRAME_ULONG ( metaLength ), + FT_FRAME_ULONG ( metaOrigLength ), + FT_FRAME_ULONG ( privOffset ), + FT_FRAME_ULONG ( privLength ), + FT_FRAME_END + }; + + + FT_ASSERT( stream == face->root.stream ); + FT_ASSERT( FT_STREAM_POS() == 0 ); + + if ( FT_STREAM_READ_FIELDS( woff_header_fields, &woff ) ) + return error; + + /* Make sure we don't recurse back here or hit TTC code. */ + if ( woff.flavor == TTAG_wOFF || woff.flavor == TTAG_ttcf ) + return FT_THROW( Invalid_Table ); + + /* Miscellaneous checks. */ + if ( woff.length != stream->size || + woff.num_tables == 0 || + 44 + woff.num_tables * 20UL >= woff.length || + 12 + woff.num_tables * 16UL >= woff.totalSfntSize || + ( woff.totalSfntSize & 3 ) != 0 || + ( woff.metaOffset == 0 && ( woff.metaLength != 0 || + woff.metaOrigLength != 0 ) ) || + ( woff.metaLength != 0 && woff.metaOrigLength == 0 ) || + ( woff.privOffset == 0 && woff.privLength != 0 ) ) + { + FT_ERROR(( "woff_font_open: invalid WOFF header\n" )); + return FT_THROW( Invalid_Table ); + } + + /* Don't trust `totalSfntSize' before thorough checks. */ + if ( FT_ALLOC( sfnt, 12 + woff.num_tables * 16UL ) || + FT_NEW( sfnt_stream ) ) + goto Exit; + + sfnt_header = sfnt; + + /* Write sfnt header. */ + { + FT_UInt searchRange, entrySelector, rangeShift, x; + + + x = woff.num_tables; + entrySelector = 0; + while ( x ) + { + x >>= 1; + entrySelector += 1; + } + entrySelector--; + + searchRange = ( 1 << entrySelector ) * 16; + rangeShift = woff.num_tables * 16 - searchRange; + + WRITE_ULONG ( sfnt_header, woff.flavor ); + WRITE_USHORT( sfnt_header, woff.num_tables ); + WRITE_USHORT( sfnt_header, searchRange ); + WRITE_USHORT( sfnt_header, entrySelector ); + WRITE_USHORT( sfnt_header, rangeShift ); + } + + /* While the entries in the sfnt header must be sorted by the */ + /* tag value, the tables themselves are not. We thus have to */ + /* sort them by offset and check that they don't overlap. */ + + if ( FT_NEW_ARRAY( tables, woff.num_tables ) || + FT_NEW_ARRAY( indices, woff.num_tables ) ) + goto Exit; + + FT_TRACE2(( "\n" + " tag offset compLen origLen checksum\n" + " -------------------------------------------\n" )); + + if ( FT_FRAME_ENTER( 20L * woff.num_tables ) ) + goto Exit; + + for ( nn = 0; nn < woff.num_tables; nn++ ) + { + WOFF_Table table = tables + nn; + + table->Tag = FT_GET_TAG4(); + table->Offset = FT_GET_ULONG(); + table->CompLength = FT_GET_ULONG(); + table->OrigLength = FT_GET_ULONG(); + table->CheckSum = FT_GET_ULONG(); + + FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx %08lx\n", + (FT_Char)( table->Tag >> 24 ), + (FT_Char)( table->Tag >> 16 ), + (FT_Char)( table->Tag >> 8 ), + (FT_Char)( table->Tag ), + table->Offset, + table->CompLength, + table->OrigLength, + table->CheckSum )); + + if ( table->Tag <= old_tag ) + { + FT_FRAME_EXIT(); + + FT_ERROR(( "woff_font_open: table tags are not sorted\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + old_tag = table->Tag; + indices[nn] = table; + } + + FT_FRAME_EXIT(); + + /* Sort by offset. */ + + ft_qsort( indices, + woff.num_tables, + sizeof ( WOFF_Table ), + compare_offsets ); + + /* Check offsets and lengths. */ + + woff_offset = 44 + woff.num_tables * 20L; + sfnt_offset = 12 + woff.num_tables * 16L; + + for ( nn = 0; nn < woff.num_tables; nn++ ) + { + WOFF_Table table = indices[nn]; + + + if ( table->Offset != woff_offset || + table->CompLength > woff.length || + table->Offset > woff.length - table->CompLength || + table->OrigLength > woff.totalSfntSize || + sfnt_offset > woff.totalSfntSize - table->OrigLength || + table->CompLength > table->OrigLength ) + { + FT_ERROR(( "woff_font_open: invalid table offsets\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + table->OrigOffset = sfnt_offset; + + /* The offsets must be multiples of 4. */ + woff_offset += ( table->CompLength + 3 ) & ~3U; + sfnt_offset += ( table->OrigLength + 3 ) & ~3U; + } + + /* + * Final checks! + * + * We don't decode and check the metadata block. + * We don't check table checksums either. + * But other than those, I think we implement all + * `MUST' checks from the spec. + */ + + if ( woff.metaOffset ) + { + if ( woff.metaOffset != woff_offset || + woff.metaOffset + woff.metaLength > woff.length ) + { + FT_ERROR(( "woff_font_open:" + " invalid `metadata' offset or length\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* We have padding only ... */ + woff_offset += woff.metaLength; + } + + if ( woff.privOffset ) + { + /* ... if it isn't the last block. */ + woff_offset = ( woff_offset + 3 ) & ~3U; + + if ( woff.privOffset != woff_offset || + woff.privOffset + woff.privLength > woff.length ) + { + FT_ERROR(( "woff_font_open: invalid `private' offset or length\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* No padding for the last block. */ + woff_offset += woff.privLength; + } + + if ( sfnt_offset != woff.totalSfntSize || + woff_offset != woff.length ) + { + FT_ERROR(( "woff_font_open: invalid `sfnt' table structure\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* Now use `totalSfntSize'. */ + if ( FT_REALLOC( sfnt, + 12 + woff.num_tables * 16UL, + woff.totalSfntSize ) ) + goto Exit; + + sfnt_header = sfnt + 12; + + /* Write the tables. */ + + for ( nn = 0; nn < woff.num_tables; nn++ ) + { + WOFF_Table table = tables + nn; + + + /* Write SFNT table entry. */ + WRITE_ULONG( sfnt_header, table->Tag ); + WRITE_ULONG( sfnt_header, table->CheckSum ); + WRITE_ULONG( sfnt_header, table->OrigOffset ); + WRITE_ULONG( sfnt_header, table->OrigLength ); + + /* Write table data. */ + if ( FT_STREAM_SEEK( table->Offset ) || + FT_FRAME_ENTER( table->CompLength ) ) + goto Exit; + + if ( table->CompLength == table->OrigLength ) + { + /* Uncompressed data; just copy. */ + ft_memcpy( sfnt + table->OrigOffset, + stream->cursor, + table->OrigLength ); + } + else + { +#ifdef FT_CONFIG_OPTION_USE_ZLIB + + /* Uncompress with zlib. */ + FT_ULong output_len = table->OrigLength; + + + error = FT_Gzip_Uncompress( memory, + sfnt + table->OrigOffset, &output_len, + stream->cursor, table->CompLength ); + if ( error ) + goto Exit; + if ( output_len != table->OrigLength ) + { + FT_ERROR(( "woff_font_open: compressed table length mismatch\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + +#else /* !FT_CONFIG_OPTION_USE_ZLIB */ + + error = FT_THROW( Unimplemented_Feature ); + goto Exit; + +#endif /* !FT_CONFIG_OPTION_USE_ZLIB */ + } + + FT_FRAME_EXIT(); + + /* We don't check whether the padding bytes in the WOFF file are */ + /* actually '\0'. For the output, however, we do set them properly. */ + sfnt_offset = table->OrigOffset + table->OrigLength; + while ( sfnt_offset & 3 ) + { + sfnt[sfnt_offset] = '\0'; + sfnt_offset++; + } + } + + /* Ok! Finally ready. Swap out stream and return. */ + FT_Stream_OpenMemory( sfnt_stream, sfnt, woff.totalSfntSize ); + sfnt_stream->memory = stream->memory; + sfnt_stream->close = sfnt_stream_close; + + FT_Stream_Free( + face->root.stream, + ( face->root.face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 ); + + face->root.stream = sfnt_stream; + + face->root.face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM; + + Exit: + FT_FREE( tables ); + FT_FREE( indices ); + + if ( error ) + { + FT_FREE( sfnt ); + FT_Stream_Close( sfnt_stream ); + FT_FREE( sfnt_stream ); + } + + return error; + } + + +#undef WRITE_USHORT +#undef WRITE_ULONG + + +/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/sfwoff.h b/src/3rdparty/freetype/src/sfnt/sfwoff.h new file mode 100644 index 0000000000..15495c32a2 --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/sfwoff.h @@ -0,0 +1,41 @@ +/**************************************************************************** + * + * sfwoff.h + * + * WOFFF format management (specification). + * + * Copyright (C) 1996-2019 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 SFWOFF_H_ +#define SFWOFF_H_ + + +#include +#include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_OBJECTS_H + + +FT_BEGIN_HEADER + + + FT_LOCAL( FT_Error ) + woff_open_font( FT_Stream stream, + TT_Face face ); + + +FT_END_HEADER + +#endif /* SFWOFF_H_ */ + + +/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/ttbdf.c b/src/3rdparty/freetype/src/sfnt/ttbdf.c index 534201f229..853599fc43 100644 --- a/src/3rdparty/freetype/src/sfnt/ttbdf.c +++ b/src/3rdparty/freetype/src/sfnt/ttbdf.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttbdf.c */ -/* */ -/* TrueType and OpenType embedded BDF properties (body). */ -/* */ -/* Copyright 2005-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttbdf.c + * + * TrueType and OpenType embedded BDF properties (body). + * + * Copyright (C) 2005-2019 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 @@ -27,14 +27,14 @@ #ifdef TT_CONFIG_OPTION_BDF - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttbdf +#define FT_COMPONENT ttbdf FT_LOCAL_DEF( void ) @@ -45,7 +45,7 @@ if ( bdf->loaded ) { - FT_Stream stream = FT_FACE(face)->stream; + FT_Stream stream = FT_FACE( face )->stream; if ( bdf->table ) @@ -111,8 +111,8 @@ FT_UInt num_items = FT_PEEK_USHORT( p + 2 ); /* - * We don't need to check the value sets themselves, since this - * is done later. + * We don't need to check the value sets themselves, since this + * is done later. */ strike += 10 * num_items; @@ -142,7 +142,7 @@ BDF_PropertyRec *aprop ) { TT_BDF bdf = &face->bdf; - FT_Size size = FT_FACE(face)->size; + FT_Size size = FT_FACE( face )->size; FT_Error error = FT_Err_Ok; FT_Byte* p; FT_UInt count; diff --git a/src/3rdparty/freetype/src/sfnt/ttbdf.h b/src/3rdparty/freetype/src/sfnt/ttbdf.h index 809a663001..e4164e61fc 100644 --- a/src/3rdparty/freetype/src/sfnt/ttbdf.h +++ b/src/3rdparty/freetype/src/sfnt/ttbdf.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttbdf.h */ -/* */ -/* TrueType and OpenType embedded BDF properties (specification). */ -/* */ -/* Copyright 2005-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttbdf.h + * + * TrueType and OpenType embedded BDF properties (specification). + * + * Copyright (C) 2005-2019 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 TTBDF_H_ diff --git a/src/3rdparty/freetype/src/sfnt/ttcmap.c b/src/3rdparty/freetype/src/sfnt/ttcmap.c index 996e66485f..683f3b1818 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcmap.c +++ b/src/3rdparty/freetype/src/sfnt/ttcmap.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttcmap.c */ -/* */ -/* TrueType character mapping table (cmap) support (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttcmap.c + * + * TrueType character mapping table (cmap) support (body). + * + * Copyright (C) 2002-2019 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 @@ -27,17 +27,16 @@ #include "ttload.h" #include "ttcmap.h" #include "ttpost.h" -#include "sfntpic.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttcmap +#define FT_COMPONENT ttcmap #define TT_PEEK_SHORT FT_PEEK_SHORT @@ -77,19 +76,19 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 0 */ - /* length 2 USHORT table length in bytes */ - /* language 4 USHORT Mac language code */ - /* glyph_ids 6 BYTE[256] array of glyph indices */ - /* 262 */ - /* */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 0 + * length 2 USHORT table length in bytes + * language 4 USHORT Mac language code + * glyph_ids 6 BYTE[256] array of glyph indices + * 262 + */ #ifdef TT_CONFIG_CMAP_FORMAT_0 @@ -238,57 +237,57 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 2 */ - /* length 2 USHORT table length in bytes */ - /* language 4 USHORT Mac language code */ - /* keys 6 USHORT[256] sub-header keys */ - /* subs 518 SUBHEAD[NSUBS] sub-headers array */ - /* glyph_ids 518+NSUB*8 USHORT[] glyph ID array */ - /* */ - /* The `keys' table is used to map charcode high bytes to sub-headers. */ - /* The value of `NSUBS' is the number of sub-headers defined in the */ - /* table and is computed by finding the maximum of the `keys' table. */ - /* */ - /* Note that for any `n', `keys[n]' is a byte offset within the `subs' */ - /* table, i.e., it is the corresponding sub-header index multiplied */ - /* by 8. */ - /* */ - /* Each sub-header has the following format. */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* first 0 USHORT first valid low-byte */ - /* count 2 USHORT number of valid low-bytes */ - /* delta 4 SHORT see below */ - /* offset 6 USHORT see below */ - /* */ - /* A sub-header defines, for each high byte, the range of valid */ - /* low bytes within the charmap. Note that the range defined by `first' */ - /* and `count' must be completely included in the interval [0..255] */ - /* according to the specification. */ - /* */ - /* If a character code is contained within a given sub-header, then */ - /* mapping it to a glyph index is done as follows. */ - /* */ - /* * The value of `offset' is read. This is a _byte_ distance from the */ - /* location of the `offset' field itself into a slice of the */ - /* `glyph_ids' table. Let's call it `slice' (it is a USHORT[], too). */ - /* */ - /* * The value `slice[char.lo - first]' is read. If it is 0, there is */ - /* no glyph for the charcode. Otherwise, the value of `delta' is */ - /* added to it (modulo 65536) to form a new glyph index. */ - /* */ - /* It is up to the validation routine to check that all offsets fall */ - /* within the glyph IDs table (and not within the `subs' table itself or */ - /* outside of the CMap). */ - /* */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 2 + * length 2 USHORT table length in bytes + * language 4 USHORT Mac language code + * keys 6 USHORT[256] sub-header keys + * subs 518 SUBHEAD[NSUBS] sub-headers array + * glyph_ids 518+NSUB*8 USHORT[] glyph ID array + * + * The `keys' table is used to map charcode high bytes to sub-headers. + * The value of `NSUBS' is the number of sub-headers defined in the + * table and is computed by finding the maximum of the `keys' table. + * + * Note that for any `n', `keys[n]' is a byte offset within the `subs' + * table, i.e., it is the corresponding sub-header index multiplied + * by 8. + * + * Each sub-header has the following format. + * + * NAME OFFSET TYPE DESCRIPTION + * + * first 0 USHORT first valid low-byte + * count 2 USHORT number of valid low-bytes + * delta 4 SHORT see below + * offset 6 USHORT see below + * + * A sub-header defines, for each high byte, the range of valid + * low bytes within the charmap. Note that the range defined by `first' + * and `count' must be completely included in the interval [0..255] + * according to the specification. + * + * If a character code is contained within a given sub-header, then + * mapping it to a glyph index is done as follows. + * + * - The value of `offset' is read. This is a _byte_ distance from the + * location of the `offset' field itself into a slice of the + * `glyph_ids' table. Let's call it `slice' (it is a USHORT[], too). + * + * - The value `slice[char.lo - first]' is read. If it is 0, there is + * no glyph for the charcode. Otherwise, the value of `delta' is + * added to it (modulo 65536) to form a new glyph index. + * + * It is up to the validation routine to check that all offsets fall + * within the glyph IDs table (and not within the `subs' table itself or + * outside of the CMap). + */ #ifdef TT_CONFIG_CMAP_FORMAT_2 @@ -626,68 +625,68 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 4 */ - /* length 2 USHORT table length */ - /* in bytes */ - /* language 4 USHORT Mac language code */ - /* */ - /* segCountX2 6 USHORT 2*NUM_SEGS */ - /* searchRange 8 USHORT 2*(1 << LOG_SEGS) */ - /* entrySelector 10 USHORT LOG_SEGS */ - /* rangeShift 12 USHORT segCountX2 - */ - /* searchRange */ - /* */ - /* endCount 14 USHORT[NUM_SEGS] end charcode for */ - /* each segment; last */ - /* is 0xFFFF */ - /* */ - /* pad 14+NUM_SEGS*2 USHORT padding */ - /* */ - /* startCount 16+NUM_SEGS*2 USHORT[NUM_SEGS] first charcode for */ - /* each segment */ - /* */ - /* idDelta 16+NUM_SEGS*4 SHORT[NUM_SEGS] delta for each */ - /* segment */ - /* idOffset 16+NUM_SEGS*6 SHORT[NUM_SEGS] range offset for */ - /* each segment; can be */ - /* zero */ - /* */ - /* glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph ID */ - /* ranges */ - /* */ - /* Character codes are modelled by a series of ordered (increasing) */ - /* intervals called segments. Each segment has start and end codes, */ - /* provided by the `startCount' and `endCount' arrays. Segments must */ - /* not overlap, and the last segment should always contain the value */ - /* 0xFFFF for `endCount'. */ - /* */ - /* The fields `searchRange', `entrySelector' and `rangeShift' are better */ - /* ignored (they are traces of over-engineering in the TrueType */ - /* specification). */ - /* */ - /* Each segment also has a signed `delta', as well as an optional offset */ - /* within the `glyphIds' table. */ - /* */ - /* If a segment's idOffset is 0, the glyph index corresponding to any */ - /* charcode within the segment is obtained by adding the value of */ - /* `idDelta' directly to the charcode, modulo 65536. */ - /* */ - /* Otherwise, a glyph index is taken from the glyph IDs sub-array for */ - /* the segment, and the value of `idDelta' is added to it. */ - /* */ - /* */ - /* Finally, note that a lot of fonts contain an invalid last segment, */ - /* where `start' and `end' are correctly set to 0xFFFF but both `delta' */ - /* and `offset' are incorrect (e.g., `opens___.ttf' which comes with */ - /* OpenOffice.org). We need special code to deal with them correctly. */ - /* */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 4 + * length 2 USHORT table length + * in bytes + * language 4 USHORT Mac language code + * + * segCountX2 6 USHORT 2*NUM_SEGS + * searchRange 8 USHORT 2*(1 << LOG_SEGS) + * entrySelector 10 USHORT LOG_SEGS + * rangeShift 12 USHORT segCountX2 - + * searchRange + * + * endCount 14 USHORT[NUM_SEGS] end charcode for + * each segment; last + * is 0xFFFF + * + * pad 14+NUM_SEGS*2 USHORT padding + * + * startCount 16+NUM_SEGS*2 USHORT[NUM_SEGS] first charcode for + * each segment + * + * idDelta 16+NUM_SEGS*4 SHORT[NUM_SEGS] delta for each + * segment + * idOffset 16+NUM_SEGS*6 SHORT[NUM_SEGS] range offset for + * each segment; can be + * zero + * + * glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph ID + * ranges + * + * Character codes are modelled by a series of ordered (increasing) + * intervals called segments. Each segment has start and end codes, + * provided by the `startCount' and `endCount' arrays. Segments must + * not overlap, and the last segment should always contain the value + * 0xFFFF for `endCount'. + * + * The fields `searchRange', `entrySelector' and `rangeShift' are better + * ignored (they are traces of over-engineering in the TrueType + * specification). + * + * Each segment also has a signed `delta', as well as an optional offset + * within the `glyphIds' table. + * + * If a segment's idOffset is 0, the glyph index corresponding to any + * charcode within the segment is obtained by adding the value of + * `idDelta' directly to the charcode, modulo 65536. + * + * Otherwise, a glyph index is taken from the glyph IDs sub-array for + * the segment, and the value of `idDelta' is added to it. + * + * + * Finally, note that a lot of fonts contain an invalid last segment, + * where `start' and `end' are correctly set to 0xFFFF but both `delta' + * and `offset' are incorrect (e.g., `opens___.ttf' which comes with + * OpenOffice.org). We need special code to deal with them correctly. + */ #ifdef TT_CONFIG_CMAP_FORMAT_4 @@ -1573,23 +1572,23 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 6 */ - /* length 2 USHORT table length in bytes */ - /* language 4 USHORT Mac language code */ - /* */ - /* first 6 USHORT first segment code */ - /* count 8 USHORT segment size in chars */ - /* glyphIds 10 USHORT[count] glyph IDs */ - /* */ - /* A very simplified segment mapping. */ - /* */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 6 + * length 2 USHORT table length in bytes + * language 4 USHORT Mac language code + * + * first 6 USHORT first segment code + * count 8 USHORT segment size in chars + * glyphIds 10 USHORT[count] glyph IDs + * + * A very simplified segment mapping. + */ #ifdef TT_CONFIG_CMAP_FORMAT_6 @@ -1768,26 +1767,26 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 8 */ - /* reserved 2 USHORT reserved */ - /* length 4 ULONG length in bytes */ - /* language 8 ULONG Mac language code */ - /* is32 12 BYTE[8192] 32-bitness bitmap */ - /* count 8204 ULONG number of groups */ - /* */ - /* This header is followed by `count' groups of the following format: */ - /* */ - /* start 0 ULONG first charcode */ - /* end 4 ULONG last charcode */ - /* startId 8 ULONG start glyph ID for the group */ - /* */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 8 + * reserved 2 USHORT reserved + * length 4 ULONG length in bytes + * language 8 ULONG Mac language code + * is32 12 BYTE[8192] 32-bitness bitmap + * count 8204 ULONG number of groups + * + * This header is followed by `count' groups of the following format: + * + * start 0 ULONG first charcode + * end 4 ULONG last charcode + * startId 8 ULONG start glyph ID for the group + */ #ifdef TT_CONFIG_CMAP_FORMAT_8 @@ -2037,22 +2036,22 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 10 */ - /* reserved 2 USHORT reserved */ - /* length 4 ULONG length in bytes */ - /* language 8 ULONG Mac language code */ - /* */ - /* start 12 ULONG first char in range */ - /* count 16 ULONG number of chars in range */ - /* glyphIds 20 USHORT[count] glyph indices covered */ - /* */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 10 + * reserved 2 USHORT reserved + * length 4 ULONG length in bytes + * language 8 ULONG Mac language code + * + * start 12 ULONG first char in range + * count 16 ULONG number of chars in range + * glyphIds 20 USHORT[count] glyph indices covered + */ #ifdef TT_CONFIG_CMAP_FORMAT_10 @@ -2209,26 +2208,26 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 12 */ - /* reserved 2 USHORT reserved */ - /* length 4 ULONG length in bytes */ - /* language 8 ULONG Mac language code */ - /* count 12 ULONG number of groups */ - /* 16 */ - /* */ - /* This header is followed by `count' groups of the following format: */ - /* */ - /* start 0 ULONG first charcode */ - /* end 4 ULONG last charcode */ - /* startId 8 ULONG start glyph ID for the group */ - /* */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 12 + * reserved 2 USHORT reserved + * length 4 ULONG length in bytes + * language 8 ULONG Mac language code + * count 12 ULONG number of groups + * 16 + * + * This header is followed by `count' groups of the following format: + * + * start 0 ULONG first charcode + * end 4 ULONG last charcode + * startId 8 ULONG start glyph ID for the group + */ #ifdef TT_CONFIG_CMAP_FORMAT_12 @@ -2369,10 +2368,7 @@ /* if `gindex' is invalid, the remaining values */ /* in this group are invalid, too */ if ( gindex >= (FT_UInt)face->num_glyphs ) - { - gindex = 0; continue; - } cmap->cur_charcode = char_code; cmap->cur_gindex = gindex; @@ -2565,26 +2561,26 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 13 */ - /* reserved 2 USHORT reserved */ - /* length 4 ULONG length in bytes */ - /* language 8 ULONG Mac language code */ - /* count 12 ULONG number of groups */ - /* 16 */ - /* */ - /* This header is followed by `count' groups of the following format: */ - /* */ - /* start 0 ULONG first charcode */ - /* end 4 ULONG last charcode */ - /* glyphId 8 ULONG glyph ID for the whole group */ - /* */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 13 + * reserved 2 USHORT reserved + * length 4 ULONG length in bytes + * language 8 ULONG Mac language code + * count 12 ULONG number of groups + * 16 + * + * This header is followed by `count' groups of the following format: + * + * start 0 ULONG first charcode + * end 4 ULONG last charcode + * glyphId 8 ULONG glyph ID for the whole group + */ #ifdef TT_CONFIG_CMAP_FORMAT_13 @@ -2891,58 +2887,59 @@ /*************************************************************************/ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* TABLE OVERVIEW */ - /* -------------- */ - /* */ - /* NAME OFFSET TYPE DESCRIPTION */ - /* */ - /* format 0 USHORT must be 14 */ - /* length 2 ULONG table length in bytes */ - /* numSelector 6 ULONG number of variation sel. records */ - /* */ - /* Followed by numSelector records, each of which looks like */ - /* */ - /* varSelector 0 UINT24 Unicode codepoint of sel. */ - /* defaultOff 3 ULONG offset to a default UVS table */ - /* describing any variants to be found in */ - /* the normal Unicode subtable. */ - /* nonDefOff 7 ULONG offset to a non-default UVS table */ - /* describing any variants not in the */ - /* standard cmap, with GIDs here */ - /* (either offset may be 0 NULL) */ - /* */ - /* Selectors are sorted by code point. */ - /* */ - /* A default Unicode Variation Selector (UVS) subtable is just a list of */ - /* ranges of code points which are to be found in the standard cmap. No */ - /* glyph IDs (GIDs) here. */ - /* */ - /* numRanges 0 ULONG number of ranges following */ - /* */ - /* A range looks like */ - /* */ - /* uniStart 0 UINT24 code point of the first character in */ - /* this range */ - /* additionalCnt 3 UBYTE count of additional characters in this */ - /* range (zero means a range of a single */ - /* character) */ - /* */ - /* Ranges are sorted by `uniStart'. */ - /* */ - /* A non-default Unicode Variation Selector (UVS) subtable is a list of */ - /* mappings from codepoint to GID. */ - /* */ - /* numMappings 0 ULONG number of mappings */ - /* */ - /* A range looks like */ - /* */ - /* uniStart 0 UINT24 code point of the first character in */ - /* this range */ - /* GID 3 USHORT and its GID */ - /* */ - /* Ranges are sorted by `uniStart'. */ + /************************************************************************** + * + * TABLE OVERVIEW + * -------------- + * + * NAME OFFSET TYPE DESCRIPTION + * + * format 0 USHORT must be 14 + * length 2 ULONG table length in bytes + * numSelector 6 ULONG number of variation sel. records + * + * Followed by numSelector records, each of which looks like + * + * varSelector 0 UINT24 Unicode codepoint of sel. + * defaultOff 3 ULONG offset to a default UVS table + * describing any variants to be found in + * the normal Unicode subtable. + * nonDefOff 7 ULONG offset to a non-default UVS table + * describing any variants not in the + * standard cmap, with GIDs here + * (either offset may be 0 NULL) + * + * Selectors are sorted by code point. + * + * A default Unicode Variation Selector (UVS) subtable is just a list of + * ranges of code points which are to be found in the standard cmap. No + * glyph IDs (GIDs) here. + * + * numRanges 0 ULONG number of ranges following + * + * A range looks like + * + * uniStart 0 UINT24 code point of the first character in + * this range + * additionalCnt 3 UBYTE count of additional characters in this + * range (zero means a range of a single + * character) + * + * Ranges are sorted by `uniStart'. + * + * A non-default Unicode Variation Selector (UVS) subtable is a list of + * mappings from codepoint to GID. + * + * numMappings 0 ULONG number of mappings + * + * A range looks like + * + * uniStart 0 UINT24 code point of the first character in + * this range + * GID 3 USHORT and its GID + * + * Ranges are sorted by `uniStart'. + */ #ifdef TT_CONFIG_CMAP_FORMAT_14 @@ -3661,7 +3658,7 @@ tt_get_glyph_name( TT_Face face, FT_UInt idx ) { - FT_String* PSname; + FT_String* PSname = NULL; tt_face_get_ps_name( face, idx, &PSname ); @@ -3681,6 +3678,9 @@ FT_UNUSED( pointer ); + if ( !psnames->unicodes_init ) + return FT_THROW( Unimplemented_Feature ); + return psnames->unicodes_init( memory, unicodes, face->root.num_glyphs, @@ -3749,7 +3749,6 @@ #endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ -#ifndef FT_CONFIG_OPTION_PIC static const TT_CMap_Class tt_cmap_classes[] = { @@ -3758,61 +3757,6 @@ NULL, }; -#else /*FT_CONFIG_OPTION_PIC*/ - - void - FT_Destroy_Class_tt_cmap_classes( FT_Library library, - TT_CMap_Class* clazz ) - { - FT_Memory memory = library->memory; - - - if ( clazz ) - FT_FREE( clazz ); - } - - - FT_Error - FT_Create_Class_tt_cmap_classes( FT_Library library, - TT_CMap_Class** output_class ) - { - TT_CMap_Class* clazz = NULL; - TT_CMap_ClassRec* recs; - FT_Error error; - FT_Memory memory = library->memory; - - int i = 0; - - -#define TTCMAPCITEM( a ) i++; -#include "ttcmapc.h" - - /* allocate enough space for both the pointers */ - /* plus terminator and the class instances */ - if ( FT_ALLOC( clazz, sizeof ( *clazz ) * ( i + 1 ) + - sizeof ( TT_CMap_ClassRec ) * i ) ) - return error; - - /* the location of the class instances follows the array of pointers */ - recs = (TT_CMap_ClassRec*)( (char*)clazz + - sizeof ( *clazz ) * ( i + 1 ) ); - i = 0; - -#undef TTCMAPCITEM -#define TTCMAPCITEM( a ) \ - FT_Init_Class_ ## a( &recs[i] ); \ - clazz[i] = &recs[i]; \ - i++; -#include "ttcmapc.h" - - clazz[i] = NULL; - - *output_class = clazz; - return FT_Err_Ok; - } - -#endif /*FT_CONFIG_OPTION_PIC*/ - /* parse the `cmap' table and build the corresponding TT_CMap objects */ /* in the current face */ @@ -3859,7 +3803,7 @@ { FT_Byte* volatile cmap = table + offset; volatile FT_UInt format = TT_PEEK_USHORT( cmap ); - const TT_CMap_Class* volatile pclazz = TT_CMAP_CLASSES_GET; + const TT_CMap_Class* volatile pclazz = tt_cmap_classes; TT_CMap_Class volatile clazz; diff --git a/src/3rdparty/freetype/src/sfnt/ttcmap.h b/src/3rdparty/freetype/src/sfnt/ttcmap.h index d264d99d2c..36801c939e 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcmap.h +++ b/src/3rdparty/freetype/src/sfnt/ttcmap.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttcmap.h */ -/* */ -/* TrueType character mapping table (cmap) support (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttcmap.h + * + * TrueType character mapping table (cmap) support (specification). + * + * Copyright (C) 2002-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef TTCMAP_H_ @@ -56,8 +56,6 @@ FT_BEGIN_HEADER } TT_CMap_ClassRec; -#ifndef FT_CONFIG_OPTION_PIC - #define FT_DEFINE_TT_CMAP( class_, \ size_, \ init_, \ @@ -92,42 +90,6 @@ FT_BEGIN_HEADER get_cmap_info_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ - -#define FT_DEFINE_TT_CMAP( class_, \ - size_, \ - init_, \ - done_, \ - char_index_, \ - char_next_, \ - char_var_index_, \ - char_var_default_, \ - variant_list_, \ - charvariant_list_, \ - variantchar_list_, \ - format_, \ - validate_, \ - get_cmap_info_ ) \ - void \ - FT_Init_Class_ ## class_( TT_CMap_ClassRec* clazz ) \ - { \ - clazz->clazz.size = size_; \ - clazz->clazz.init = init_; \ - clazz->clazz.done = done_; \ - clazz->clazz.char_index = char_index_; \ - clazz->clazz.char_next = char_next_; \ - clazz->clazz.char_var_index = char_var_index_; \ - clazz->clazz.char_var_default = char_var_default_; \ - clazz->clazz.variant_list = variant_list_; \ - clazz->clazz.charvariant_list = charvariant_list_; \ - clazz->clazz.variantchar_list = variantchar_list_; \ - clazz->format = format_; \ - clazz->validate = validate_; \ - clazz->get_cmap_info = get_cmap_info_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - typedef struct TT_ValidatorRec_ { diff --git a/src/3rdparty/freetype/src/sfnt/ttcmapc.h b/src/3rdparty/freetype/src/sfnt/ttcmapc.h index 4980e9dd3d..ace9e69ca8 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcmapc.h +++ b/src/3rdparty/freetype/src/sfnt/ttcmapc.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttcmapc.h */ -/* */ -/* TT CMAP classes definitions (specification only). */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttcmapc.h + * + * TT CMAP classes definitions (specification only). + * + * Copyright (C) 2009-2019 by + * Oran Agra and Mickey Gabel. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifdef TT_CONFIG_CMAP_FORMAT_0 diff --git a/src/3rdparty/freetype/src/sfnt/ttcolr.c b/src/3rdparty/freetype/src/sfnt/ttcolr.c new file mode 100644 index 0000000000..6b537d95b8 --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/ttcolr.c @@ -0,0 +1,451 @@ +/**************************************************************************** + * + * ttcolr.c + * + * TrueType and OpenType colored glyph layer support (body). + * + * Copyright (C) 2018-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Originally written by Shao Yu Zhang . + * + * 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. + * + */ + + + /************************************************************************** + * + * `COLR' table specification: + * + * https://www.microsoft.com/typography/otspec/colr.htm + * + */ + + +#include +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_TRUETYPE_TAGS_H +#include FT_COLOR_H + + +#ifdef TT_CONFIG_OPTION_COLOR_LAYERS + +#include "ttcolr.h" + + + /* NOTE: These are the table sizes calculated through the specs. */ +#define BASE_GLYPH_SIZE 6 +#define LAYER_SIZE 4 +#define COLR_HEADER_SIZE 14 + + + typedef struct BaseGlyphRecord_ + { + FT_UShort gid; + FT_UShort first_layer_index; + FT_UShort num_layers; + + } BaseGlyphRecord; + + + typedef struct Colr_ + { + FT_UShort version; + FT_UShort num_base_glyphs; + FT_UShort num_layers; + + FT_Byte* base_glyphs; + FT_Byte* layers; + + /* The memory which backs up the `COLR' table. */ + void* table; + FT_ULong table_size; + + } Colr; + + + /************************************************************************** + * + * 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 ttcolr + + + FT_LOCAL_DEF( FT_Error ) + tt_face_load_colr( TT_Face face, + FT_Stream stream ) + { + FT_Error error; + FT_Memory memory = face->root.memory; + + FT_Byte* table = NULL; + FT_Byte* p = NULL; + + Colr* colr = NULL; + + FT_ULong base_glyph_offset, layer_offset; + FT_ULong table_size; + + + /* `COLR' always needs `CPAL' */ + if ( !face->cpal ) + return FT_THROW( Invalid_File_Format ); + + error = face->goto_table( face, TTAG_COLR, stream, &table_size ); + if ( error ) + goto NoColr; + + if ( table_size < COLR_HEADER_SIZE ) + goto InvalidTable; + + if ( FT_FRAME_EXTRACT( table_size, table ) ) + goto NoColr; + + p = table; + + if ( FT_NEW( colr ) ) + goto NoColr; + + colr->version = FT_NEXT_USHORT( p ); + if ( colr->version != 0 ) + goto InvalidTable; + + colr->num_base_glyphs = FT_NEXT_USHORT( p ); + base_glyph_offset = FT_NEXT_ULONG( p ); + + if ( base_glyph_offset >= table_size ) + goto InvalidTable; + if ( colr->num_base_glyphs * BASE_GLYPH_SIZE > + table_size - base_glyph_offset ) + goto InvalidTable; + + layer_offset = FT_NEXT_ULONG( p ); + colr->num_layers = FT_NEXT_USHORT( p ); + + if ( layer_offset >= table_size ) + goto InvalidTable; + if ( colr->num_layers * LAYER_SIZE > table_size - layer_offset ) + goto InvalidTable; + + colr->base_glyphs = (FT_Byte*)( table + base_glyph_offset ); + colr->layers = (FT_Byte*)( table + layer_offset ); + colr->table = table; + colr->table_size = table_size; + + face->colr = colr; + + return FT_Err_Ok; + + InvalidTable: + error = FT_THROW( Invalid_Table ); + + NoColr: + FT_FRAME_RELEASE( table ); + FT_FREE( colr ); + + return error; + } + + + FT_LOCAL_DEF( void ) + tt_face_free_colr( TT_Face face ) + { + FT_Stream stream = face->root.stream; + FT_Memory memory = face->root.memory; + + Colr* colr = (Colr*)face->colr; + + + if ( colr ) + { + FT_FRAME_RELEASE( colr->table ); + FT_FREE( colr ); + } + } + + + static FT_Bool + find_base_glyph_record( FT_Byte* base_glyph_begin, + FT_Int num_base_glyph, + FT_UInt glyph_id, + BaseGlyphRecord* record ) + { + FT_Int min = 0; + FT_Int max = num_base_glyph - 1; + + + while ( min <= max ) + { + FT_Int mid = min + ( max - min ) / 2; + FT_Byte* p = base_glyph_begin + mid * BASE_GLYPH_SIZE; + + FT_UShort gid = FT_NEXT_USHORT( p ); + + + if ( gid < glyph_id ) + min = mid + 1; + else if (gid > glyph_id ) + max = mid - 1; + else + { + record->gid = gid; + record->first_layer_index = FT_NEXT_USHORT( p ); + record->num_layers = FT_NEXT_USHORT( p ); + + return 1; + } + } + + return 0; + } + + + FT_LOCAL_DEF( FT_Bool ) + tt_face_get_colr_layer( TT_Face face, + FT_UInt base_glyph, + FT_UInt *aglyph_index, + FT_UInt *acolor_index, + FT_LayerIterator* iterator ) + { + Colr* colr = (Colr*)face->colr; + BaseGlyphRecord glyph_record; + + + if ( !colr ) + return 0; + + if ( !iterator->p ) + { + FT_ULong offset; + + + /* first call to function */ + iterator->layer = 0; + + if ( !find_base_glyph_record( colr->base_glyphs, + colr->num_base_glyphs, + base_glyph, + &glyph_record ) ) + return 0; + + if ( glyph_record.num_layers ) + iterator->num_layers = glyph_record.num_layers; + else + return 0; + + offset = LAYER_SIZE * glyph_record.first_layer_index; + if ( offset + LAYER_SIZE * glyph_record.num_layers > colr->table_size ) + return 0; + + iterator->p = colr->layers + offset; + } + + if ( iterator->layer >= iterator->num_layers ) + return 0; + + *aglyph_index = FT_NEXT_USHORT( iterator->p ); + *acolor_index = FT_NEXT_USHORT( iterator->p ); + + if ( *aglyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs ) || + ( *acolor_index != 0xFFFF && + *acolor_index >= face->palette_data.num_palette_entries ) ) + return 0; + + iterator->layer++; + + return 1; + } + + + FT_LOCAL_DEF( FT_Error ) + tt_face_colr_blend_layer( TT_Face face, + FT_UInt color_index, + FT_GlyphSlot dstSlot, + FT_GlyphSlot srcSlot ) + { + FT_Error error; + + FT_UInt x, y; + FT_Byte b, g, r, alpha; + + FT_ULong size; + FT_Byte* src; + FT_Byte* dst; + + + if ( !dstSlot->bitmap.buffer ) + { + /* Initialize destination of color bitmap */ + /* with the size of first component. */ + dstSlot->bitmap_left = srcSlot->bitmap_left; + dstSlot->bitmap_top = srcSlot->bitmap_top; + + dstSlot->bitmap.width = srcSlot->bitmap.width; + dstSlot->bitmap.rows = srcSlot->bitmap.rows; + dstSlot->bitmap.pixel_mode = FT_PIXEL_MODE_BGRA; + dstSlot->bitmap.pitch = (int)dstSlot->bitmap.width * 4; + dstSlot->bitmap.num_grays = 256; + + size = dstSlot->bitmap.rows * (unsigned int)dstSlot->bitmap.pitch; + + error = ft_glyphslot_alloc_bitmap( dstSlot, size ); + if ( error ) + return error; + + FT_MEM_ZERO( dstSlot->bitmap.buffer, size ); + } + else + { + /* Resize destination if needed such that new component fits. */ + FT_Int x_min, x_max, y_min, y_max; + + + x_min = FT_MIN( dstSlot->bitmap_left, srcSlot->bitmap_left ); + x_max = FT_MAX( dstSlot->bitmap_left + (FT_Int)dstSlot->bitmap.width, + srcSlot->bitmap_left + (FT_Int)srcSlot->bitmap.width ); + + y_min = FT_MIN( dstSlot->bitmap_top - (FT_Int)dstSlot->bitmap.rows, + srcSlot->bitmap_top - (FT_Int)srcSlot->bitmap.rows ); + y_max = FT_MAX( dstSlot->bitmap_top, srcSlot->bitmap_top ); + + if ( x_min != dstSlot->bitmap_left || + x_max != dstSlot->bitmap_left + (FT_Int)dstSlot->bitmap.width || + y_min != dstSlot->bitmap_top - (FT_Int)dstSlot->bitmap.rows || + y_max != dstSlot->bitmap_top ) + { + FT_Memory memory = face->root.memory; + + FT_UInt width = (FT_UInt)( x_max - x_min ); + FT_UInt rows = (FT_UInt)( y_max - y_min ); + FT_UInt pitch = width * 4; + + FT_Byte* buf = NULL; + FT_Byte* p; + FT_Byte* q; + + + size = rows * pitch; + if ( FT_ALLOC( buf, size ) ) + return error; + + p = dstSlot->bitmap.buffer; + q = buf + + (int)pitch * ( y_max - dstSlot->bitmap_top ) + + 4 * ( dstSlot->bitmap_left - x_min ); + + for ( y = 0; y < dstSlot->bitmap.rows; y++ ) + { + FT_MEM_COPY( q, p, dstSlot->bitmap.width * 4 ); + + p += dstSlot->bitmap.pitch; + q += pitch; + } + + ft_glyphslot_set_bitmap( dstSlot, buf ); + + dstSlot->bitmap_top = y_max; + dstSlot->bitmap_left = x_min; + + dstSlot->bitmap.width = width; + dstSlot->bitmap.rows = rows; + dstSlot->bitmap.pitch = (int)pitch; + + dstSlot->internal->flags |= FT_GLYPH_OWN_BITMAP; + dstSlot->format = FT_GLYPH_FORMAT_BITMAP; + } + } + + if ( color_index == 0xFFFF ) + { + if ( face->have_foreground_color ) + { + b = face->foreground_color.blue; + g = face->foreground_color.green; + r = face->foreground_color.red; + alpha = face->foreground_color.alpha; + } + else + { + if ( face->palette_data.palette_flags && + ( face->palette_data.palette_flags[face->palette_index] & + FT_PALETTE_FOR_DARK_BACKGROUND ) ) + { + /* white opaque */ + b = 0xFF; + g = 0xFF; + r = 0xFF; + alpha = 0xFF; + } + else + { + /* black opaque */ + b = 0x00; + g = 0x00; + r = 0x00; + alpha = 0xFF; + } + } + } + else + { + b = face->palette[color_index].blue; + g = face->palette[color_index].green; + r = face->palette[color_index].red; + alpha = face->palette[color_index].alpha; + } + + /* XXX Convert if srcSlot.bitmap is not grey? */ + src = srcSlot->bitmap.buffer; + dst = dstSlot->bitmap.buffer + + dstSlot->bitmap.pitch * ( dstSlot->bitmap_top - srcSlot->bitmap_top ) + + 4 * ( srcSlot->bitmap_left - dstSlot->bitmap_left ); + + for ( y = 0; y < srcSlot->bitmap.rows; y++ ) + { + for ( x = 0; x < srcSlot->bitmap.width; x++ ) + { + int aa = src[x]; + int fa = alpha * aa / 255; + + int fb = b * fa / 255; + int fg = g * fa / 255; + int fr = r * fa / 255; + + int ba2 = 255 - fa; + + int bb = dst[4 * x + 0]; + int bg = dst[4 * x + 1]; + int br = dst[4 * x + 2]; + int ba = dst[4 * x + 3]; + + + dst[4 * x + 0] = (FT_Byte)( bb * ba2 / 255 + fb ); + dst[4 * x + 1] = (FT_Byte)( bg * ba2 / 255 + fg ); + dst[4 * x + 2] = (FT_Byte)( br * ba2 / 255 + fr ); + dst[4 * x + 3] = (FT_Byte)( ba * ba2 / 255 + fa ); + } + + src += srcSlot->bitmap.pitch; + dst += dstSlot->bitmap.pitch; + } + + return FT_Err_Ok; + } + +#else /* !TT_CONFIG_OPTION_COLOR_LAYERS */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_colr_dummy; + +#endif /* !TT_CONFIG_OPTION_COLOR_LAYERS */ + +/* EOF */ diff --git a/src/3rdparty/freetype/src/sfnt/ttcolr.h b/src/3rdparty/freetype/src/sfnt/ttcolr.h new file mode 100644 index 0000000000..817489a855 --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/ttcolr.h @@ -0,0 +1,58 @@ +/**************************************************************************** + * + * ttcolr.h + * + * TrueType and OpenType colored glyph layer support (specification). + * + * Copyright (C) 2018-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Originally written by Shao Yu Zhang . + * + * 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 __TTCOLR_H__ +#define __TTCOLR_H__ + + +#include +#include "ttload.h" + + +FT_BEGIN_HEADER + + + FT_LOCAL( FT_Error ) + tt_face_load_colr( TT_Face face, + FT_Stream stream ); + + FT_LOCAL( void ) + tt_face_free_colr( TT_Face face ); + + FT_LOCAL( FT_Bool ) + tt_face_get_colr_layer( TT_Face face, + FT_UInt base_glyph, + FT_UInt *aglyph_index, + FT_UInt *acolor_index, + FT_LayerIterator* iterator ); + + FT_LOCAL( FT_Error ) + tt_face_colr_blend_layer( TT_Face face, + FT_UInt color_index, + FT_GlyphSlot dstSlot, + FT_GlyphSlot srcSlot ); + + +FT_END_HEADER + + +#endif /* __TTCOLR_H__ */ + +/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/ttcpal.c b/src/3rdparty/freetype/src/sfnt/ttcpal.c new file mode 100644 index 0000000000..3482169a89 --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/ttcpal.c @@ -0,0 +1,311 @@ +/**************************************************************************** + * + * ttcpal.c + * + * TrueType and OpenType color palette support (body). + * + * Copyright (C) 2018-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Originally written by Shao Yu Zhang . + * + * 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. + * + */ + + + /************************************************************************** + * + * `CPAL' table specification: + * + * https://www.microsoft.com/typography/otspec/cpal.htm + * + */ + + +#include +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_TRUETYPE_TAGS_H +#include FT_COLOR_H + + +#ifdef TT_CONFIG_OPTION_COLOR_LAYERS + +#include "ttcpal.h" + + + /* NOTE: These are the table sizes calculated through the specs. */ +#define CPAL_V0_HEADER_BASE_SIZE 12 +#define COLOR_SIZE 4 + + + /* all data from `CPAL' not covered in FT_Palette_Data */ + typedef struct Cpal_ + { + FT_UShort version; /* Table version number (0 or 1 supported). */ + FT_UShort num_colors; /* Total number of color records, */ + /* combined for all palettes. */ + FT_Byte* colors; /* RGBA array of colors */ + FT_Byte* color_indices; /* Index of each palette's first color record */ + /* in the combined color record array. */ + + /* The memory which backs up the `CPAL' table. */ + void* table; + FT_ULong table_size; + + } Cpal; + + + /************************************************************************** + * + * 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 ttcpal + + + FT_LOCAL_DEF( FT_Error ) + tt_face_load_cpal( TT_Face face, + FT_Stream stream ) + { + FT_Error error; + FT_Memory memory = face->root.memory; + + FT_Byte* table = NULL; + FT_Byte* p = NULL; + + Cpal* cpal = NULL; + + FT_ULong colors_offset; + FT_ULong table_size; + + + error = face->goto_table( face, TTAG_CPAL, stream, &table_size ); + if ( error ) + goto NoCpal; + + if ( table_size < CPAL_V0_HEADER_BASE_SIZE ) + goto InvalidTable; + + if ( FT_FRAME_EXTRACT( table_size, table ) ) + goto NoCpal; + + p = table; + + if ( FT_NEW( cpal ) ) + goto NoCpal; + + cpal->version = FT_NEXT_USHORT( p ); + if ( cpal->version > 1 ) + goto InvalidTable; + + face->palette_data.num_palette_entries = FT_NEXT_USHORT( p ); + face->palette_data.num_palettes = FT_NEXT_USHORT( p ); + + cpal->num_colors = FT_NEXT_USHORT( p ); + colors_offset = FT_NEXT_ULONG( p ); + + if ( CPAL_V0_HEADER_BASE_SIZE + + face->palette_data.num_palettes * 2U > table_size ) + goto InvalidTable; + + if ( colors_offset >= table_size ) + goto InvalidTable; + if ( cpal->num_colors * COLOR_SIZE > table_size - colors_offset ) + goto InvalidTable; + + if ( face->palette_data.num_palette_entries > cpal->num_colors ) + goto InvalidTable; + + cpal->color_indices = p; + cpal->colors = (FT_Byte*)( table + colors_offset ); + + if ( cpal->version == 1 ) + { + FT_ULong type_offset, label_offset, entry_label_offset; + FT_UShort* array = NULL; + FT_UShort* limit; + FT_UShort* q; + + + if ( CPAL_V0_HEADER_BASE_SIZE + + face->palette_data.num_palettes * 2U + + 3U * 4 > table_size ) + goto InvalidTable; + + p += face->palette_data.num_palettes * 2; + + type_offset = FT_NEXT_ULONG( p ); + label_offset = FT_NEXT_ULONG( p ); + entry_label_offset = FT_NEXT_ULONG( p ); + + if ( type_offset ) + { + if ( type_offset >= table_size ) + goto InvalidTable; + if ( face->palette_data.num_palettes * 2 > + table_size - type_offset ) + goto InvalidTable; + + if ( FT_QNEW_ARRAY( array, face->palette_data.num_palettes ) ) + goto NoCpal; + + p = table + type_offset; + q = array; + limit = q + face->palette_data.num_palettes; + + while ( q < limit ) + *q++ = FT_NEXT_USHORT( p ); + + face->palette_data.palette_flags = array; + } + + if ( label_offset ) + { + if ( label_offset >= table_size ) + goto InvalidTable; + if ( face->palette_data.num_palettes * 2 > + table_size - label_offset ) + goto InvalidTable; + + if ( FT_QNEW_ARRAY( array, face->palette_data.num_palettes ) ) + goto NoCpal; + + p = table + label_offset; + q = array; + limit = q + face->palette_data.num_palettes; + + while ( q < limit ) + *q++ = FT_NEXT_USHORT( p ); + + face->palette_data.palette_name_ids = array; + } + + if ( entry_label_offset ) + { + if ( entry_label_offset >= table_size ) + goto InvalidTable; + if ( face->palette_data.num_palette_entries * 2 > + table_size - entry_label_offset ) + goto InvalidTable; + + if ( FT_QNEW_ARRAY( array, face->palette_data.num_palette_entries ) ) + goto NoCpal; + + p = table + entry_label_offset; + q = array; + limit = q + face->palette_data.num_palette_entries; + + while ( q < limit ) + *q++ = FT_NEXT_USHORT( p ); + + face->palette_data.palette_entry_name_ids = array; + } + } + + cpal->table = table; + cpal->table_size = table_size; + + face->cpal = cpal; + + /* set up default palette */ + if ( FT_NEW_ARRAY( face->palette, + face->palette_data.num_palette_entries ) ) + goto NoCpal; + + if ( tt_face_palette_set( face, 0 ) ) + goto InvalidTable; + + return FT_Err_Ok; + + InvalidTable: + error = FT_THROW( Invalid_Table ); + + NoCpal: + FT_FRAME_RELEASE( table ); + FT_FREE( cpal ); + + face->cpal = NULL; + + /* arrays in `face->palette_data' and `face->palette' */ + /* are freed in `sfnt_done_face' */ + + return error; + } + + + FT_LOCAL_DEF( void ) + tt_face_free_cpal( TT_Face face ) + { + FT_Stream stream = face->root.stream; + FT_Memory memory = face->root.memory; + + Cpal* cpal = (Cpal*)face->cpal; + + + if ( cpal ) + { + FT_FRAME_RELEASE( cpal->table ); + FT_FREE( cpal ); + } + } + + + FT_LOCAL_DEF( FT_Error ) + tt_face_palette_set( TT_Face face, + FT_UInt palette_index ) + { + Cpal* cpal = (Cpal*)face->cpal; + + FT_Byte* offset; + FT_Byte* p; + + FT_Color* q; + FT_Color* limit; + + FT_UShort color_index; + + + if ( !cpal || palette_index >= face->palette_data.num_palettes ) + return FT_THROW( Invalid_Argument ); + + offset = cpal->color_indices + 2 * palette_index; + color_index = FT_PEEK_USHORT( offset ); + + if ( color_index + face->palette_data.num_palette_entries > + cpal->num_colors ) + return FT_THROW( Invalid_Table ); + + p = cpal->colors + COLOR_SIZE * color_index; + q = face->palette; + limit = q + face->palette_data.num_palette_entries; + + while ( q < limit ) + { + q->blue = FT_NEXT_BYTE( p ); + q->green = FT_NEXT_BYTE( p ); + q->red = FT_NEXT_BYTE( p ); + q->alpha = FT_NEXT_BYTE( p ); + + q++; + } + + return FT_Err_Ok; + } + + +#else /* !TT_CONFIG_OPTION_COLOR_LAYERS */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_cpal_dummy; + +#endif /* !TT_CONFIG_OPTION_COLOR_LAYERS */ + +/* EOF */ diff --git a/src/3rdparty/freetype/src/sfnt/ttcpal.h b/src/3rdparty/freetype/src/sfnt/ttcpal.h new file mode 100644 index 0000000000..d1b244f3e3 --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/ttcpal.h @@ -0,0 +1,49 @@ +/**************************************************************************** + * + * ttcpal.h + * + * TrueType and OpenType color palette support (specification). + * + * Copyright (C) 2018-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Originally written by Shao Yu Zhang . + * + * 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 __TTCPAL_H__ +#define __TTCPAL_H__ + + +#include +#include "ttload.h" + + +FT_BEGIN_HEADER + + + FT_LOCAL( FT_Error ) + tt_face_load_cpal( TT_Face face, + FT_Stream stream ); + + FT_LOCAL( void ) + tt_face_free_cpal( TT_Face face ); + + FT_LOCAL( FT_Error ) + tt_face_palette_set( TT_Face face, + FT_UInt palette_index ); + + +FT_END_HEADER + + +#endif /* __TTCPAL_H__ */ + +/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/ttkern.c b/src/3rdparty/freetype/src/sfnt/ttkern.c index 68f15a2010..8d1b781090 100644 --- a/src/3rdparty/freetype/src/sfnt/ttkern.c +++ b/src/3rdparty/freetype/src/sfnt/ttkern.c @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* ttkern.c */ -/* */ -/* Load the basic TrueType kerning table. This doesn't handle */ -/* kerning data within the GPOS table at the moment. */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttkern.c + * + * Load the basic TrueType kerning table. This doesn't handle + * kerning data within the GPOS table at the moment. + * + * Copyright (C) 1996-2019 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 @@ -26,14 +26,14 @@ #include "sferrors.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttkern +#define FT_COMPONENT ttkern #undef TT_KERN_INDEX @@ -127,8 +127,8 @@ avail |= mask; /* - * Now check whether the pairs in this table are ordered. - * We then can use binary search. + * Now check whether the pairs in this table are ordered. + * We then can use binary search. */ if ( num_pairs > 0 ) { @@ -283,8 +283,8 @@ break; /* - * We don't support format 2 because we haven't seen a single font - * using it in real life... + * We don't support format 2 because we haven't seen a single font + * using it in real life... */ default: diff --git a/src/3rdparty/freetype/src/sfnt/ttkern.h b/src/3rdparty/freetype/src/sfnt/ttkern.h index 4e45d0964b..5f283e5e62 100644 --- a/src/3rdparty/freetype/src/sfnt/ttkern.h +++ b/src/3rdparty/freetype/src/sfnt/ttkern.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* ttkern.h */ -/* */ -/* Load the basic TrueType kerning table. This doesn't handle */ -/* kerning data within the GPOS table at the moment. */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttkern.h + * + * Load the basic TrueType kerning table. This doesn't handle + * kerning data within the GPOS table at the moment. + * + * Copyright (C) 1996-2019 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 TTKERN_H_ diff --git a/src/3rdparty/freetype/src/sfnt/ttload.c b/src/3rdparty/freetype/src/sfnt/ttload.c index a86a546c3d..5443bf4b69 100644 --- a/src/3rdparty/freetype/src/sfnt/ttload.c +++ b/src/3rdparty/freetype/src/sfnt/ttload.c @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* ttload.c */ -/* */ -/* Load the basic TrueType tables, i.e., tables that can be either in */ -/* TTF or OTF fonts (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttload.c + * + * Load the basic TrueType tables, i.e., tables that can be either in + * TTF or OTF fonts (body). + * + * Copyright (C) 1996-2019 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 @@ -26,32 +26,34 @@ #include "sferrors.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttload - - - /*************************************************************************/ - /* */ - /* */ - /* tt_face_lookup_table */ - /* */ - /* */ - /* Looks for a TrueType table by name. */ - /* */ - /* */ - /* face :: A face object handle. */ - /* */ - /* tag :: The searched tag. */ - /* */ - /* */ - /* A pointer to the table directory entry. 0 if not found. */ - /* */ +#define FT_COMPONENT ttload + + + /************************************************************************** + * + * @Function: + * tt_face_lookup_table + * + * @Description: + * Looks for a TrueType table by name. + * + * @Input: + * face :: + * A face object handle. + * + * tag :: + * The searched tag. + * + * @Return: + * A pointer to the table directory entry. 0 if not found. + */ FT_LOCAL_DEF( TT_Table ) tt_face_lookup_table( TT_Face face, FT_ULong tag ) @@ -101,27 +103,31 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_goto_table */ - /* */ - /* */ - /* Looks for a TrueType table by name, then seek a stream to it. */ - /* */ - /* */ - /* face :: A face object handle. */ - /* */ - /* tag :: The searched tag. */ - /* */ - /* stream :: The stream to seek when the table is found. */ - /* */ - /* */ - /* length :: The length of the table if found, undefined otherwise. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_goto_table + * + * @Description: + * Looks for a TrueType table by name, then seek a stream to it. + * + * @Input: + * face :: + * A face object handle. + * + * tag :: + * The searched tag. + * + * stream :: + * The stream to seek when the table is found. + * + * @Output: + * length :: + * The length of the table if found, undefined otherwise. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_goto_table( TT_Face face, FT_ULong tag, @@ -309,28 +315,31 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_font_dir */ - /* */ - /* */ - /* Loads the header of a SFNT font file. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* */ - /* sfnt :: The SFNT header. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* The stream cursor must be at the beginning of the font directory. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_font_dir + * + * @Description: + * Loads the header of a SFNT font file. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * The input stream. + * + * @Output: + * sfnt :: + * The SFNT header. + * + * @Return: + * FreeType error code. 0 means success. + * + * @Note: + * The stream cursor must be at the beginning of the font directory. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_font_dir( TT_Face face, FT_Stream stream ) @@ -496,46 +505,51 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_any */ - /* */ - /* */ - /* Loads any font table into client memory. */ - /* */ - /* */ - /* face :: The face object to look for. */ - /* */ - /* tag :: The tag of table to load. Use the value 0 if you want */ - /* to access the whole font file, else set this parameter */ - /* to a valid TrueType table tag that you can forge with */ - /* the MAKE_TT_TAG macro. */ - /* */ - /* offset :: The starting offset in the table (or the file if */ - /* tag == 0). */ - /* */ - /* length :: The address of the decision variable: */ - /* */ - /* If length == NULL: */ - /* Loads the whole table. Returns an error if */ - /* `offset' == 0! */ - /* */ - /* If *length == 0: */ - /* Exits immediately; returning the length of the given */ - /* table or of the font file, depending on the value of */ - /* `tag'. */ - /* */ - /* If *length != 0: */ - /* Loads the next `length' bytes of table or font, */ - /* starting at offset `offset' (in table or font too). */ - /* */ - /* */ - /* buffer :: The address of target buffer. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_any + * + * @Description: + * Loads any font table into client memory. + * + * @Input: + * face :: + * The face object to look for. + * + * tag :: + * The tag of table to load. Use the value 0 if you want + * to access the whole font file, else set this parameter + * to a valid TrueType table tag that you can forge with + * the MAKE_TT_TAG macro. + * + * offset :: + * The starting offset in the table (or the file if + * tag == 0). + * + * length :: + * The address of the decision variable: + * + * If length == NULL: + * Loads the whole table. Returns an error if + * `offset' == 0! + * + * If *length == 0: + * Exits immediately; returning the length of the given + * table or of the font file, depending on the value of + * `tag'. + * + * If *length != 0: + * Loads the next `length' bytes of table or font, + * starting at offset `offset' (in table or font too). + * + * @Output: + * buffer :: + * The address of target buffer. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_any( TT_Face face, FT_ULong tag, @@ -586,22 +600,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_generic_header */ - /* */ - /* */ - /* Loads the TrueType table `head' or `bhed'. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_generic_header + * + * @Description: + * Loads the TrueType table `head' or `bhed'. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * The input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ static FT_Error tt_face_load_generic_header( TT_Face face, FT_Stream stream, @@ -622,10 +638,10 @@ FT_FRAME_LONG ( Magic_Number ), FT_FRAME_USHORT( Flags ), FT_FRAME_USHORT( Units_Per_EM ), - FT_FRAME_LONG ( Created[0] ), - FT_FRAME_LONG ( Created[1] ), - FT_FRAME_LONG ( Modified[0] ), - FT_FRAME_LONG ( Modified[1] ), + FT_FRAME_ULONG ( Created[0] ), + FT_FRAME_ULONG ( Created[1] ), + FT_FRAME_ULONG ( Modified[0] ), + FT_FRAME_ULONG ( Modified[1] ), FT_FRAME_SHORT ( xMin ), FT_FRAME_SHORT ( yMin ), FT_FRAME_SHORT ( xMax ), @@ -676,22 +692,24 @@ #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_maxp */ - /* */ - /* */ - /* Loads the maximum profile into a face object. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_maxp + * + * @Description: + * Loads the maximum profile into a face object. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * The input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_maxp( TT_Face face, FT_Stream stream ) @@ -784,22 +802,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_name */ - /* */ - /* */ - /* Loads the name records. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_name + * + * @Description: + * Loads the name records. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * The input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_name( TT_Face face, FT_Stream stream ) @@ -981,17 +1001,18 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_free_name */ - /* */ - /* */ - /* Frees the name records. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_free_name + * + * @Description: + * Frees the name records. + * + * @Input: + * face :: + * A handle to the target face object. + */ FT_LOCAL_DEF( void ) tt_face_free_name( TT_Face face ) { @@ -1030,23 +1051,25 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_cmap */ - /* */ - /* */ - /* Loads the cmap directory in a face object. The cmaps themselves */ - /* are loaded on demand in the `ttcmap.c' module. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_cmap + * + * @Description: + * Loads the cmap directory in a face object. The cmaps themselves + * are loaded on demand in the `ttcmap.c' module. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_cmap( TT_Face face, @@ -1068,22 +1091,24 @@ - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_os2 */ - /* */ - /* */ - /* Loads the OS2 table. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_os2 + * + * @Description: + * Loads the OS2 table. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_os2( TT_Face face, FT_Stream stream ) @@ -1228,22 +1253,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_postscript */ - /* */ - /* */ - /* Loads the Postscript table. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_postscript + * + * @Description: + * Loads the Postscript table. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_post( TT_Face face, FT_Stream stream ) @@ -1288,22 +1315,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_pclt */ - /* */ - /* */ - /* Loads the PCL 5 Table. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_pclt + * + * @Description: + * Loads the PCL 5 Table. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_pclt( TT_Face face, FT_Stream stream ) @@ -1349,22 +1378,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_gasp */ - /* */ - /* */ - /* Loads the `gasp' table into a face object. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_gasp + * + * @Description: + * Loads the `gasp' table into a face object. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * The input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_gasp( TT_Face face, FT_Stream stream ) diff --git a/src/3rdparty/freetype/src/sfnt/ttload.h b/src/3rdparty/freetype/src/sfnt/ttload.h index f94be8b7bd..cc18c18694 100644 --- a/src/3rdparty/freetype/src/sfnt/ttload.h +++ b/src/3rdparty/freetype/src/sfnt/ttload.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* ttload.h */ -/* */ -/* Load the basic TrueType tables, i.e., tables that can be either in */ -/* TTF or OTF fonts (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttload.h + * + * Load the basic TrueType tables, i.e., tables that can be either in + * TTF or OTF fonts (specification). + * + * Copyright (C) 1996-2019 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 TTLOAD_H_ diff --git a/src/3rdparty/freetype/src/sfnt/ttmtx.c b/src/3rdparty/freetype/src/sfnt/ttmtx.c index 6ddda95b56..b6725c962f 100644 --- a/src/3rdparty/freetype/src/sfnt/ttmtx.c +++ b/src/3rdparty/freetype/src/sfnt/ttmtx.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttmtx.c */ -/* */ -/* Load the metrics tables common to TTF and OTF fonts (body). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttmtx.c + * + * Load the metrics tables common to TTF and OTF fonts (body). + * + * Copyright (C) 2006-2019 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 @@ -38,34 +38,37 @@ /* both the horizontal and vertical headers. */ - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttmtx - - - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_hmtx */ - /* */ - /* */ - /* Load the `hmtx' or `vmtx' table into a face object. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* vertical :: A boolean flag. If set, load `vmtx'. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ +#define FT_COMPONENT ttmtx + + + /************************************************************************** + * + * @Function: + * tt_face_load_hmtx + * + * @Description: + * Load the `hmtx' or `vmtx' table into a face object. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * The input stream. + * + * vertical :: + * A boolean flag. If set, load `vmtx'. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_hmtx( TT_Face face, FT_Stream stream, @@ -102,24 +105,27 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_hhea */ - /* */ - /* */ - /* Load the `hhea' or 'vhea' table into a face object. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* vertical :: A boolean flag. If set, load `vhea'. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_hhea + * + * @Description: + * Load the `hhea' or 'vhea' table into a face object. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * The input stream. + * + * vertical :: + * A boolean flag. If set, load `vhea'. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_hhea( TT_Face face, FT_Stream stream, @@ -190,30 +196,35 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_get_metrics */ - /* */ - /* */ - /* Return the horizontal or vertical metrics in font units for a */ - /* given glyph. The values are the left side bearing (top side */ - /* bearing for vertical metrics) and advance width (advance height */ - /* for vertical metrics). */ - /* */ - /* */ - /* face :: A pointer to the TrueType face structure. */ - /* */ - /* vertical :: If set to TRUE, get vertical metrics. */ - /* */ - /* gindex :: The glyph index. */ - /* */ - /* */ - /* abearing :: The bearing, either left side or top side. */ - /* */ - /* aadvance :: The advance width or advance height, depending on */ - /* the `vertical' flag. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_get_metrics + * + * @Description: + * Return the horizontal or vertical metrics in font units for a + * given glyph. The values are the left side bearing (top side + * bearing for vertical metrics) and advance width (advance height + * for vertical metrics). + * + * @Input: + * face :: + * A pointer to the TrueType face structure. + * + * vertical :: + * If set to TRUE, get vertical metrics. + * + * gindex :: + * The glyph index. + * + * @Output: + * abearing :: + * The bearing, either left side or top side. + * + * aadvance :: + * The advance width or advance height, depending on + * the `vertical' flag. + */ FT_LOCAL_DEF( void ) tt_face_get_metrics( TT_Face face, FT_Bool vertical, @@ -269,7 +280,7 @@ else { table_pos += 4 * ( k - 1 ); - if ( table_pos + 4 > table_end ) + if ( table_pos + 2 > table_end ) goto NoData; if ( FT_STREAM_SEEK( table_pos ) || @@ -281,7 +292,9 @@ *abearing = 0; else { - if ( !FT_STREAM_SEEK( table_pos ) ) + if ( FT_STREAM_SEEK( table_pos ) ) + *abearing = 0; + else (void)FT_READ_SHORT( *abearing ); } } diff --git a/src/3rdparty/freetype/src/sfnt/ttmtx.h b/src/3rdparty/freetype/src/sfnt/ttmtx.h index ab00acd795..5b0b60b641 100644 --- a/src/3rdparty/freetype/src/sfnt/ttmtx.h +++ b/src/3rdparty/freetype/src/sfnt/ttmtx.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttmtx.h */ -/* */ -/* Load the metrics tables common to TTF and OTF fonts (specification). */ -/* */ -/* Copyright 2006-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttmtx.h + * + * Load the metrics tables common to TTF and OTF fonts (specification). + * + * Copyright (C) 2006-2019 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 TTMTX_H_ diff --git a/src/3rdparty/freetype/src/sfnt/ttpost.c b/src/3rdparty/freetype/src/sfnt/ttpost.c index 6de99ef977..636a0a004a 100644 --- a/src/3rdparty/freetype/src/sfnt/ttpost.c +++ b/src/3rdparty/freetype/src/sfnt/ttpost.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* ttpost.c */ -/* */ -/* PostScript name table processing for TrueType and OpenType fonts */ -/* (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 post table is not completely loaded by the core engine. This */ - /* file loads the missing PS glyph names and implements an API to access */ - /* them. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ttpost.c + * + * PostScript name table processing for TrueType and OpenType fonts + * (body). + * + * Copyright (C) 1996-2019 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 post table is not completely loaded by the core engine. This + * file loads the missing PS glyph names and implements an API to access + * them. + * + */ #include @@ -38,17 +38,17 @@ #include "sferrors.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttpost +#define FT_COMPONENT ttpost - /* If this configuration macro is defined, we rely on the `PSNames' */ + /* If this configuration macro is defined, we rely on the `psnames' */ /* module to grab the glyph names. */ #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES @@ -62,9 +62,9 @@ #else /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ - /* Otherwise, we ignore the `PSNames' module, and provide our own */ + /* Otherwise, we ignore the `psnames' module, and provide our own */ /* table of Mac names. Thus, it is possible to build a version of */ - /* FreeType without the Type 1 driver & PSNames module. */ + /* FreeType without the Type 1 driver & psnames module. */ #define MAC_NAME( x ) (FT_String*)tt_post_default_names[x] @@ -459,28 +459,31 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_get_ps_name */ - /* */ - /* */ - /* Get the PostScript glyph name of a glyph. */ - /* */ - /* */ - /* face :: A handle to the parent face. */ - /* */ - /* idx :: The glyph index. */ - /* */ - /* */ - /* PSname :: The address of a string pointer. Undefined in case of */ - /* error, otherwise it is a pointer to the glyph name. */ - /* */ - /* You must not modify the returned string! */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_get_ps_name + * + * @Description: + * Get the PostScript glyph name of a glyph. + * + * @Input: + * face :: + * A handle to the parent face. + * + * idx :: + * The glyph index. + * + * @InOut: + * PSname :: + * The address of a string pointer. Undefined in case of + * error, otherwise it is a pointer to the glyph name. + * + * You must not modify the returned string! + * + * @Output: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_get_ps_name( TT_Face face, FT_UInt idx, diff --git a/src/3rdparty/freetype/src/sfnt/ttpost.h b/src/3rdparty/freetype/src/sfnt/ttpost.h index 3bec07e445..812a0fc92d 100644 --- a/src/3rdparty/freetype/src/sfnt/ttpost.h +++ b/src/3rdparty/freetype/src/sfnt/ttpost.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* ttpost.h */ -/* */ -/* PostScript name table processing for TrueType and OpenType fonts */ -/* (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttpost.h + * + * PostScript name table processing for TrueType and OpenType fonts + * (specification). + * + * Copyright (C) 1996-2019 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 TTPOST_H_ diff --git a/src/3rdparty/freetype/src/sfnt/ttsbit.c b/src/3rdparty/freetype/src/sfnt/ttsbit.c index 33b8640bc3..23bd9d7eb0 100644 --- a/src/3rdparty/freetype/src/sfnt/ttsbit.c +++ b/src/3rdparty/freetype/src/sfnt/ttsbit.c @@ -1,22 +1,22 @@ -/***************************************************************************/ -/* */ -/* ttsbit.c */ -/* */ -/* TrueType and OpenType embedded bitmap support (body). */ -/* */ -/* Copyright 2005-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Copyright 2013 by Google, Inc. */ -/* Google Author(s): Behdad Esfahbod. */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttsbit.c + * + * TrueType and OpenType embedded bitmap support (body). + * + * Copyright (C) 2005-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Copyright 2013 by Google, Inc. + * Google Author(s): Behdad Esfahbod. + * + * 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 @@ -36,14 +36,14 @@ #include "pngshim.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttsbit +#define FT_COMPONENT ttsbit FT_LOCAL_DEF( FT_Error ) @@ -129,8 +129,8 @@ } /* - * Count the number of strikes available in the table. We are a bit - * paranoid there and don't trust the data. + * Count the number of strikes available in the table. We are a bit + * paranoid there and don't trust the data. */ count = (FT_UInt)num_strikes; if ( 8 + 48UL * count > table_size ) @@ -182,8 +182,8 @@ " expect bad rendering results\n" )); /* - * Count the number of strikes available in the table. We are a bit - * paranoid there and don't trust the data. + * Count the number of strikes available in the table. We are a bit + * paranoid there and don't trust the data. */ count = (FT_UInt)num_strikes; if ( 8 + 4UL * count > table_size ) @@ -1014,8 +1014,8 @@ for ( nn = 0; nn < num_components; nn++ ) { FT_UInt gindex = FT_NEXT_USHORT( p ); - FT_Byte dx = FT_NEXT_BYTE( p ); - FT_Byte dy = FT_NEXT_BYTE( p ); + FT_Char dx = FT_NEXT_CHAR( p ); + FT_Char dy = FT_NEXT_CHAR( p ); /* NB: a recursive call */ diff --git a/src/3rdparty/freetype/src/sfnt/ttsbit.h b/src/3rdparty/freetype/src/sfnt/ttsbit.h index ce2af3c162..5ab8ff5568 100644 --- a/src/3rdparty/freetype/src/sfnt/ttsbit.h +++ b/src/3rdparty/freetype/src/sfnt/ttsbit.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttsbit.h */ -/* */ -/* TrueType and OpenType embedded bitmap support (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttsbit.h + * + * TrueType and OpenType embedded bitmap support (specification). + * + * Copyright (C) 1996-2019 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 TTSBIT_H_ diff --git a/src/3rdparty/freetype/src/smooth/Jamfile b/src/3rdparty/freetype/src/smooth/Jamfile index 9957d5e915..6ca1cede9e 100644 --- a/src/3rdparty/freetype/src/smooth/Jamfile +++ b/src/3rdparty/freetype/src/smooth/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/smooth Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/smooth/ftgrays.c b/src/3rdparty/freetype/src/smooth/ftgrays.c index 803a19e415..fd357a50fc 100644 --- a/src/3rdparty/freetype/src/smooth/ftgrays.c +++ b/src/3rdparty/freetype/src/smooth/ftgrays.c @@ -1,94 +1,102 @@ -/***************************************************************************/ -/* */ -/* ftgrays.c */ -/* */ -/* A new `perfect' anti-aliasing renderer (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This file can be compiled without the rest of the FreeType engine, by */ - /* defining the STANDALONE_ macro when compiling it. You also need to */ - /* put the files `ftgrays.h' and `ftimage.h' into the current */ - /* compilation directory. Typically, you could do something like */ - /* */ - /* - copy `src/smooth/ftgrays.c' (this file) to your current directory */ - /* */ - /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */ - /* same directory */ - /* */ - /* - compile `ftgrays' with the STANDALONE_ macro defined, as in */ - /* */ - /* cc -c -DSTANDALONE_ ftgrays.c */ - /* */ - /* The renderer can be initialized with a call to */ - /* `ft_gray_raster.raster_new'; an anti-aliased bitmap can be generated */ - /* with a call to `ft_gray_raster.raster_render'. */ - /* */ - /* See the comments and documentation in the file `ftimage.h' for more */ - /* details on how the raster works. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* This is a new anti-aliasing scan-converter for FreeType 2. The */ - /* algorithm used here is _very_ different from the one in the standard */ - /* `ftraster' module. Actually, `ftgrays' computes the _exact_ */ - /* coverage of the outline on each pixel cell. */ - /* */ - /* It is based on ideas that I initially found in Raph Levien's */ - /* excellent LibArt graphics library (see http://www.levien.com/libart */ - /* for more information, though the web pages do not tell anything */ - /* about the renderer; you'll have to dive into the source code to */ - /* understand how it works). */ - /* */ - /* Note, however, that this is a _very_ different implementation */ - /* compared to Raph's. Coverage information is stored in a very */ - /* different way, and I don't use sorted vector paths. Also, it doesn't */ - /* use floating point values. */ - /* */ - /* This renderer has the following advantages: */ - /* */ - /* - It doesn't need an intermediate bitmap. Instead, one can supply a */ - /* callback function that will be called by the renderer to draw gray */ - /* spans on any target surface. You can thus do direct composition on */ - /* any kind of bitmap, provided that you give the renderer the right */ - /* callback. */ - /* */ - /* - A perfect anti-aliaser, i.e., it computes the _exact_ coverage on */ - /* each pixel cell. */ - /* */ - /* - It performs a single pass on the outline (the `standard' FT2 */ - /* renderer makes two passes). */ - /* */ - /* - It can easily be modified to render to _any_ number of gray levels */ - /* cheaply. */ - /* */ - /* - For small (< 20) pixel sizes, it is faster than the standard */ - /* renderer. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* 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. */ - /* */ +/**************************************************************************** + * + * ftgrays.c + * + * A new `perfect' anti-aliasing renderer (body). + * + * Copyright (C) 2000-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + /************************************************************************** + * + * This file can be compiled without the rest of the FreeType engine, by + * defining the STANDALONE_ macro when compiling it. You also need to + * put the files `ftgrays.h' and `ftimage.h' into the current + * compilation directory. Typically, you could do something like + * + * - copy `src/smooth/ftgrays.c' (this file) to your current directory + * + * - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the + * same directory + * + * - compile `ftgrays' with the STANDALONE_ macro defined, as in + * + * cc -c -DSTANDALONE_ ftgrays.c + * + * The renderer can be initialized with a call to + * `ft_gray_raster.raster_new'; an anti-aliased bitmap can be generated + * with a call to `ft_gray_raster.raster_render'. + * + * See the comments and documentation in the file `ftimage.h' for more + * details on how the raster works. + * + */ + + /************************************************************************** + * + * This is a new anti-aliasing scan-converter for FreeType 2. The + * algorithm used here is _very_ different from the one in the standard + * `ftraster' module. Actually, `ftgrays' computes the _exact_ + * coverage of the outline on each pixel cell by straight segments. + * + * It is based on ideas that I initially found in Raph Levien's + * excellent LibArt graphics library (see https://www.levien.com/libart + * for more information, though the web pages do not tell anything + * about the renderer; you'll have to dive into the source code to + * understand how it works). + * + * Note, however, that this is a _very_ different implementation + * compared to Raph's. Coverage information is stored in a very + * different way, and I don't use sorted vector paths. Also, it doesn't + * use floating point values. + * + * Bézier segments are flattened by splitting them until their deviation + * from straight line becomes much smaller than a pixel. Therefore, the + * pixel coverage by a Bézier curve is calculated approximately. To + * estimate the deviation, we use the distance from the control point + * to the conic chord centre or the cubic chord trisection. These + * distances vanish fast after each split. In the conic case, they vanish + * predictably and the number of necessary splits can be calculated. + * + * This renderer has the following advantages: + * + * - It doesn't need an intermediate bitmap. Instead, one can supply a + * callback function that will be called by the renderer to draw gray + * spans on any target surface. You can thus do direct composition on + * any kind of bitmap, provided that you give the renderer the right + * callback. + * + * - A perfect anti-aliaser, i.e., it computes the _exact_ coverage on + * each pixel cell by straight segments. + * + * - It performs a single pass on the outline (the `standard' FT2 + * renderer makes two passes). + * + * - It can easily be modified to render to _any_ number of gray levels + * cheaply. + * + * - For small (< 80) pixel sizes, it is faster than the standard + * renderer. + * + */ + + + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_smooth +#define FT_COMPONENT smooth #ifdef STANDALONE_ @@ -112,9 +120,9 @@ /* - * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' - * algorithm. We use alpha = 1, beta = 3/8, giving us results with a - * largest error less than 7% compared to the exact value. + * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' + * algorithm. We use alpha = 1, beta = 3/8, giving us results with a + * largest error less than 7% compared to the exact value. */ #define FT_HYPOT( x, y ) \ ( x = FT_ABS( x ), \ @@ -222,10 +230,10 @@ typedef ptrdiff_t FT_PtrDist; #endif #define FT_THROW( e ) \ - ( FT_Throw( FT_ERR_CAT( ErrRaster, e ), \ + ( FT_Throw( FT_ERR_CAT( ErrRaster_, e ), \ __LINE__, \ __FILE__ ) | \ - FT_ERR_CAT( ErrRaster, e ) ) + FT_ERR_CAT( ErrRaster_, e ) ) #else /* !FT_DEBUG_LEVEL_TRACE */ @@ -279,8 +287,6 @@ typedef ptrdiff_t FT_PtrDist; #include "ftsmerrs.h" -#include "ftspic.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 @@ -329,17 +335,9 @@ typedef ptrdiff_t FT_PtrDist; /* must be at least 6 bits! */ #define PIXEL_BITS 8 -#undef FLOOR -#undef CEILING -#undef TRUNC -#undef SCALED - #define ONE_PIXEL ( 1 << PIXEL_BITS ) -#define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) -#define SUBPIXELS( x ) ( (TPos)(x) * ONE_PIXEL ) -#define FLOOR( x ) ( (x) & -ONE_PIXEL ) -#define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL ) -#define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL ) +#define TRUNC( x ) (TCoord)( (x) >> PIXEL_BITS ) +#define FRACT( x ) (TCoord)( (x) & ( ONE_PIXEL - 1 ) ) #if PIXEL_BITS >= 6 #define UPSCALE( x ) ( (x) * ( ONE_PIXEL >> 6 ) ) @@ -390,15 +388,15 @@ typedef ptrdiff_t FT_PtrDist; #define FT_UDIVPREP( c, b ) \ long b ## _r = c ? (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b ) \ : 0 -#define FT_UDIV( a, b ) \ - ( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \ - ( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) ) +#define FT_UDIV( a, b ) \ + (TCoord)( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \ + ( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) ) - /*************************************************************************/ - /* */ - /* TYPE DEFINITIONS */ - /* */ + /************************************************************************** + * + * TYPE DEFINITIONS + */ /* don't change the following types to FT_Int or FT_Pos, since we might */ /* need to define them to "float" or "double" when experimenting with */ @@ -434,6 +432,9 @@ typedef ptrdiff_t FT_PtrDist; #define FT_MAX_GRAY_POOL ( 2048 / sizeof ( TCell ) ) #endif + /* FT_Span buffer size for direct rendering only */ +#define FT_MAX_GRAY_SPANS 10 + #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ /* We disable the warning `structure was padded due to */ @@ -467,6 +468,8 @@ typedef ptrdiff_t FT_PtrDist; FT_Raster_Span_Func render_span; void* render_span_data; + FT_Span spans[FT_MAX_GRAY_SPANS]; + int num_spans; } gray_TWorker, *gray_PWorker; @@ -516,10 +519,10 @@ typedef ptrdiff_t FT_PtrDist; #endif /* FT_DEBUG_LEVEL_TRACE */ - /*************************************************************************/ - /* */ - /* Record the current cell in the table. */ - /* */ + /************************************************************************** + * + * Record the current cell in the linked list. + */ static void gray_record_cell( RAS_ARG ) { @@ -528,10 +531,9 @@ typedef ptrdiff_t FT_PtrDist; pcell = &ras.ycells[ras.ey - ras.min_ey]; - for (;;) + while ( ( cell = *pcell ) ) { - cell = *pcell; - if ( !cell || cell->x > x ) + if ( cell->x > x ) break; if ( cell->x == x ) @@ -561,10 +563,10 @@ typedef ptrdiff_t FT_PtrDist; } - /*************************************************************************/ - /* */ - /* Set the current cell to a new position. */ - /* */ + /************************************************************************** + * + * Set the current cell to a new position. + */ static void gray_set_cell( RAS_ARG_ TCoord ex, TCoord ey ) @@ -579,16 +581,13 @@ typedef ptrdiff_t FT_PtrDist; /* Note that if a cell is to the left of the clipping region, it is */ /* actually set to the (min_ex-1) horizontal position. */ - if ( ex < ras.min_ex ) - ex = ras.min_ex - 1; - /* 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 = ex; + ras.ex = FT_MAX( ex, ras.min_ex - 1 ); ras.ey = ey; ras.invalid = ( ey >= ras.max_ey || ey < ras.min_ey || @@ -598,10 +597,10 @@ typedef ptrdiff_t FT_PtrDist; #ifndef FT_LONG64 - /*************************************************************************/ - /* */ - /* Render a scanline as one or more cells. */ - /* */ + /************************************************************************** + * + * Render a scanline as one or more cells. + */ static void gray_render_scanline( RAS_ARG_ TCoord ey, TPos x1, @@ -624,8 +623,8 @@ typedef ptrdiff_t FT_PtrDist; return; } - fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) ); - fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) ); + fx1 = FRACT( x1 ); + fx2 = FRACT( x2 ); /* everything is located in a single cell. That is easy! */ /* */ @@ -652,6 +651,9 @@ typedef ptrdiff_t FT_PtrDist; dx = -dx; } + /* the fractional part of y-delta is mod/dx. It is essential to */ + /* keep track of its accumulation for accurate rendering. */ + /* XXX: y-delta and x-delta below should be related. */ FT_DIV_MOD( TCoord, p, dx, delta, mod ); ras.area += (TArea)( ( fx1 + first ) * delta ); @@ -696,10 +698,10 @@ typedef ptrdiff_t FT_PtrDist; } - /*************************************************************************/ - /* */ - /* Render a given line as a series of scanlines. */ - /* */ + /************************************************************************** + * + * Render a given line as a series of scanlines. + */ static void gray_render_line( RAS_ARG_ TPos to_x, TPos to_y ) @@ -717,8 +719,8 @@ typedef ptrdiff_t FT_PtrDist; ( ey1 < ras.min_ey && ey2 < ras.min_ey ) ) goto End; - fy1 = (TCoord)( ras.y - SUBPIXELS( ey1 ) ); - fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) ); + fy1 = FRACT( ras.y ); + fy2 = FRACT( to_y ); /* everything is on a single scanline */ if ( ey1 == ey2 ) @@ -734,7 +736,7 @@ typedef ptrdiff_t FT_PtrDist; if ( dx == 0 ) { TCoord ex = TRUNC( ras.x ); - TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 ); + TCoord two_fx = FRACT( ras.x ) << 1; TArea area; @@ -789,6 +791,8 @@ typedef ptrdiff_t FT_PtrDist; dy = -dy; } + /* the fractional part of x-delta is mod/dy. It is essential to */ + /* keep track of its accumulation for accurate rendering. */ FT_DIV_MOD( TCoord, p, dy, delta, mod ); x = ras.x + delta; @@ -837,16 +841,17 @@ typedef ptrdiff_t FT_PtrDist; #else - /*************************************************************************/ - /* */ - /* Render a straight line across multiple cells in any direction. */ - /* */ + /************************************************************************** + * + * Render a straight line across multiple cells in any direction. + */ static void gray_render_line( RAS_ARG_ TPos to_x, TPos to_y ) { - TPos dx, dy, fx1, fy1, fx2, fy2; - TCoord ex1, ex2, ey1, ey2; + TPos dx, dy; + TCoord fx1, fy1, fx2, fy2; + TCoord ex1, ey1, ex2, ey2; ey1 = TRUNC( ras.y ); @@ -860,8 +865,8 @@ typedef ptrdiff_t FT_PtrDist; ex1 = TRUNC( ras.x ); ex2 = TRUNC( to_x ); - fx1 = ras.x - SUBPIXELS( ex1 ); - fy1 = ras.y - SUBPIXELS( ey1 ); + fx1 = FRACT( ras.x ); + fy1 = FRACT( ras.y ); dx = to_x - ras.x; dy = to_y - ras.y; @@ -870,8 +875,8 @@ typedef ptrdiff_t FT_PtrDist; ; else if ( dy == 0 ) /* ex1 != ex2 */ /* any horizontal line */ { - ex1 = ex2; - gray_set_cell( RAS_VAR_ ex1, ey1 ); + gray_set_cell( RAS_VAR_ ex2, ey2 ); + goto End; } else if ( dx == 0 ) { @@ -898,7 +903,7 @@ typedef ptrdiff_t FT_PtrDist; } else /* any other line */ { - TPos prod = dx * fy1 - dy * fx1; + TPos prod = dx * (TPos)fy1 - dy * (TPos)fx1; FT_UDIVPREP( ex1 != ex2, dx ); FT_UDIVPREP( ey1 != ey2, dy ); @@ -912,7 +917,7 @@ typedef ptrdiff_t FT_PtrDist; prod - dx * ONE_PIXEL > 0 ) /* left */ { fx2 = 0; - fy2 = (TPos)FT_UDIV( -prod, -dx ); + fy2 = FT_UDIV( -prod, -dx ); prod -= dy * ONE_PIXEL; ras.cover += ( fy2 - fy1 ); ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 ); @@ -924,7 +929,7 @@ typedef ptrdiff_t FT_PtrDist; prod - dx * ONE_PIXEL + dy * ONE_PIXEL > 0 ) /* up */ { prod -= dx * ONE_PIXEL; - fx2 = (TPos)FT_UDIV( -prod, dy ); + fx2 = FT_UDIV( -prod, dy ); fy2 = ONE_PIXEL; ras.cover += ( fy2 - fy1 ); ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 ); @@ -937,7 +942,7 @@ typedef ptrdiff_t FT_PtrDist; { prod += dy * ONE_PIXEL; fx2 = ONE_PIXEL; - fy2 = (TPos)FT_UDIV( prod, dx ); + fy2 = FT_UDIV( prod, dx ); ras.cover += ( fy2 - fy1 ); ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 ); fx1 = 0; @@ -947,7 +952,7 @@ typedef ptrdiff_t FT_PtrDist; else /* ( prod + dy * ONE_PIXEL < 0 && prod > 0 ) down */ { - fx2 = (TPos)FT_UDIV( prod, -dy ); + fx2 = FT_UDIV( prod, -dy ); fy2 = 0; prod += dx * ONE_PIXEL; ras.cover += ( fy2 - fy1 ); @@ -961,8 +966,8 @@ typedef ptrdiff_t FT_PtrDist; } while ( ex1 != ex2 || ey1 != ey2 ); } - fx2 = to_x - SUBPIXELS( ex2 ); - fy2 = to_y - SUBPIXELS( ey2 ); + fx2 = FRACT( to_x ); + fy2 = FRACT( to_y ); ras.cover += ( fy2 - fy1 ); ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 ); @@ -981,16 +986,18 @@ typedef ptrdiff_t FT_PtrDist; base[4].x = base[2].x; - b = base[1].x; - a = base[3].x = ( base[2].x + b ) / 2; - b = base[1].x = ( base[0].x + b ) / 2; - base[2].x = ( a + b ) / 2; + a = base[0].x + base[1].x; + b = base[1].x + base[2].x; + base[3].x = b >> 1; + base[2].x = ( a + b ) >> 2; + base[1].x = a >> 1; base[4].y = base[2].y; - b = base[1].y; - a = base[3].y = ( base[2].y + b ) / 2; - b = base[1].y = ( base[0].y + b ) / 2; - base[2].y = ( a + b ) / 2; + a = base[0].y + base[1].y; + b = base[1].y + base[2].y; + base[3].y = b >> 1; + base[2].y = ( a + b ) >> 2; + base[1].y = a >> 1; } @@ -1044,12 +1051,11 @@ typedef ptrdiff_t FT_PtrDist; /* many times as there are trailing zeros in the counter. */ do { - split = 1; - while ( ( draw & split ) == 0 ) + split = draw & ( -draw ); /* isolate the rightmost 1-bit */ + while ( ( split >>= 1 ) ) { gray_split_conic( arc ); arc += 2; - split <<= 1; } gray_render_line( RAS_VAR_ arc[0].x, arc[0].y ); @@ -1062,28 +1068,32 @@ typedef ptrdiff_t FT_PtrDist; static void gray_split_cubic( FT_Vector* base ) { - TPos a, b, c, d; + TPos a, b, c; base[6].x = base[3].x; - c = base[1].x; - d = base[2].x; - base[1].x = a = ( base[0].x + c ) / 2; - base[5].x = b = ( base[3].x + d ) / 2; - c = ( c + d ) / 2; - base[2].x = a = ( a + c ) / 2; - base[4].x = b = ( b + c ) / 2; - base[3].x = ( a + b ) / 2; + 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 >> 1; + c += b; + base[4].x = c >> 2; + base[1].x = a >> 1; + a += b; + base[2].x = a >> 2; + base[3].x = ( a + c ) >> 3; base[6].y = base[3].y; - c = base[1].y; - d = base[2].y; - base[1].y = a = ( base[0].y + c ) / 2; - base[5].y = b = ( base[3].y + d ) / 2; - c = ( c + d ) / 2; - base[2].y = a = ( a + c ) / 2; - base[4].y = b = ( b + c ) / 2; - base[3].y = ( a + b ) / 2; + 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 >> 1; + c += b; + base[4].y = c >> 2; + base[1].y = a >> 1; + a += b; + base[2].y = a >> 2; + base[3].y = ( a + c ) >> 3; } @@ -1094,9 +1104,6 @@ typedef ptrdiff_t FT_PtrDist; { FT_Vector bez_stack[16 * 3 + 1]; /* enough to accommodate bisections */ FT_Vector* arc = bez_stack; - TPos dx, dy, dx_, dy_; - TPos dx1, dy1, dx2, dy2; - TPos L, s, s_limit; arc[0].x = UPSCALE( to->x ); @@ -1125,45 +1132,13 @@ typedef ptrdiff_t FT_PtrDist; for (;;) { - /* Decide whether to split or draw. See `Rapid Termination */ - /* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */ - /* F. Hain, at */ - /* http://www.cis.southalabama.edu/~hain/general/Publications/Bezier/Camera-ready%20CISST02%202.pdf */ - - /* dx and dy are x and y components of the P0-P3 chord vector. */ - dx = dx_ = arc[3].x - arc[0].x; - dy = dy_ = arc[3].y - arc[0].y; - - L = FT_HYPOT( dx_, dy_ ); - - /* Avoid possible arithmetic overflow below by splitting. */ - if ( L > 32767 ) - goto Split; - - /* Max deviation may be as much as (s/L) * 3/4 (if Hain's v = 1). */ - s_limit = L * (TPos)( ONE_PIXEL / 6 ); - - /* s is L * the perpendicular distance from P1 to the line P0-P3. */ - dx1 = arc[1].x - arc[0].x; - dy1 = arc[1].y - arc[0].y; - s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx1 ), MUL_LONG( dx, dy1 ) ) ); - - if ( s > s_limit ) - goto Split; - - /* s is L * the perpendicular distance from P2 to the line P0-P3. */ - dx2 = arc[2].x - arc[0].x; - dy2 = arc[2].y - arc[0].y; - s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx2 ), MUL_LONG( dx, dy2 ) ) ); - - if ( s > s_limit ) - goto Split; - - /* Split super curvy segments where the off points are so far - from the chord that the angles P0-P1-P3 or P0-P2-P3 become - acute as detected by appropriate dot products. */ - if ( dx1 * ( dx1 - dx ) + dy1 * ( dy1 - dy ) > 0 || - dx2 * ( dx2 - dx ) + dy2 * ( dy2 - dy ) > 0 ) + /* with each split, control points quickly converge towards */ + /* chord trisection points and the vanishing distances below */ + /* indicate when the segment is flat enough to draw */ + if ( FT_ABS( 2 * arc[0].x - 3 * arc[1].x + arc[3].x ) > ONE_PIXEL / 2 || + FT_ABS( 2 * arc[0].y - 3 * arc[1].y + arc[3].y ) > ONE_PIXEL / 2 || + FT_ABS( arc[0].x - 3 * arc[2].x + 2 * arc[3].x ) > ONE_PIXEL / 2 || + FT_ABS( arc[0].y - 3 * arc[2].y + 2 * arc[3].y ) > ONE_PIXEL / 2 ) goto Split; gray_render_line( RAS_VAR_ arc[0].x, arc[0].y ); @@ -1238,8 +1213,6 @@ typedef ptrdiff_t FT_PtrDist; { /* scale the coverage from 0..(ONE_PIXEL*ONE_PIXEL*2) to 0..256 */ coverage >>= PIXEL_BITS * 2 + 1 - 8; - if ( coverage < 0 ) - coverage = -coverage - 1; /* compute the line's coverage depending on the outline fill rule */ if ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) @@ -1249,23 +1222,30 @@ typedef ptrdiff_t FT_PtrDist; if ( coverage >= 256 ) coverage = 511 - coverage; } - else + else /* default non-zero winding rule */ { - /* normal non-zero winding rule */ + if ( coverage < 0 ) + coverage = ~coverage; /* the same as -coverage - 1 */ + if ( coverage >= 256 ) coverage = 255; } - if ( ras.render_span ) /* for FT_RASTER_FLAG_DIRECT only */ + if ( ras.num_spans >= 0 ) /* for FT_RASTER_FLAG_DIRECT only */ { - FT_Span span; + FT_Span* span = ras.spans + ras.num_spans++; - span.x = (short)x; - span.len = (unsigned short)acount; - span.coverage = (unsigned char)coverage; + span->x = (short)x; + span->len = (unsigned short)acount; + span->coverage = (unsigned char)coverage; - ras.render_span( y, 1, &span, ras.render_span_data ); + 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 { @@ -1279,14 +1259,29 @@ typedef ptrdiff_t FT_PtrDist; */ switch ( acount ) { - case 7: *q++ = c; - case 6: *q++ = c; - case 5: *q++ = c; - case 4: *q++ = c; - case 3: *q++ = c; - case 2: *q++ = c; - case 1: *q = c; - case 0: break; + 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 ); } @@ -1324,53 +1319,63 @@ typedef ptrdiff_t FT_PtrDist; if ( cover != 0 ) gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x ); + + if ( ras.num_spans > 0 ) /* for FT_RASTER_FLAG_DIRECT only */ + { + /* 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; + } } } #ifdef STANDALONE_ - /*************************************************************************/ - /* */ - /* The following functions should only compile in stand-alone mode, */ - /* i.e., when building this component without the rest of FreeType. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Decompose */ - /* */ - /* */ - /* Walk over an outline's structure to decompose it into individual */ - /* segments and Bézier arcs. This function is also able to emit */ - /* `move to' and `close to' operations to indicate the start and end */ - /* of new contours in the outline. */ - /* */ - /* */ - /* outline :: A pointer to the source target. */ - /* */ - /* func_interface :: A table of `emitters', i.e., function pointers */ - /* called during decomposition to indicate path */ - /* operations. */ - /* */ - /* */ - /* user :: A typeless pointer which is passed to each */ - /* emitter during the decomposition. It can be */ - /* used to store the state during the */ - /* decomposition. */ - /* */ - /* */ - /* Error code. 0 means success. */ - /* */ + /************************************************************************** + * + * The following functions should only compile in stand-alone mode, + * i.e., when building this component without the rest of FreeType. + * + */ + + /************************************************************************** + * + * @Function: + * FT_Outline_Decompose + * + * @Description: + * Walk over an outline's structure to decompose it into individual + * segments and Bézier arcs. This function is also able to emit + * `move to' and `close to' operations to indicate the start and end + * of new contours in the outline. + * + * @Input: + * outline :: + * A pointer to the source target. + * + * func_interface :: + * A table of `emitters', i.e., function pointers + * called during decomposition to indicate path + * operations. + * + * @InOut: + * user :: + * A typeless pointer which is passed to each + * emitter during the decomposition. It can be + * used to store the state during the + * decomposition. + * + * @Return: + * Error code. 0 means success. + */ static int FT_Outline_Decompose( const FT_Outline* outline, const FT_Outline_Funcs* func_interface, void* user ) { #undef SCALED -#define SCALED( x ) ( ( (x) << shift ) - delta ) +#define SCALED( x ) ( (x) * ( 1L << shift ) - delta ) FT_Vector v_last; FT_Vector v_control; @@ -1610,81 +1615,6 @@ typedef ptrdiff_t FT_PtrDist; return FT_THROW( Invalid_Outline ); } - - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Get_CBox */ - /* */ - /* */ - /* Return an outline's `control box'. The control box encloses all */ - /* the outline's points, including Bézier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ - /* that contains Bézier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ - /* and arcs in the outline. To get the latter, you can use the */ - /* `ftbbox' component, which is dedicated to this single task. */ - /* */ - /* */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* */ - /* acbox :: The outline's control box. */ - /* */ - /* */ - /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ - /* */ - - static void - FT_Outline_Get_CBox( const FT_Outline* outline, - FT_BBox *acbox ) - { - TPos xMin, yMin, xMax, yMax; - - - if ( outline && acbox ) - { - if ( outline->n_points == 0 ) - { - xMin = 0; - yMin = 0; - xMax = 0; - yMax = 0; - } - else - { - FT_Vector* vec = outline->points; - FT_Vector* limit = vec + outline->n_points; - - - xMin = xMax = vec->x; - yMin = yMax = vec->y; - vec++; - - for ( ; vec < limit; vec++ ) - { - TPos x, y; - - - x = vec->x; - if ( x < xMin ) xMin = x; - if ( x > xMax ) xMax = x; - - y = vec->y; - if ( y < yMin ) yMin = y; - if ( y > yMax ) yMax = y; - } - } - acbox->xMin = xMin; - acbox->xMax = xMax; - acbox->yMin = yMin; - acbox->yMax = yMax; - } - } - #endif /* STANDALONE_ */ @@ -1702,19 +1632,20 @@ typedef ptrdiff_t FT_PtrDist; static int - gray_convert_glyph_inner( RAS_ARG ) + gray_convert_glyph_inner( RAS_ARG, + int continued ) { + int error; - volatile int error = 0; - -#ifdef FT_CONFIG_OPTION_PIC - FT_Outline_Funcs func_interface; - Init_Class_func_interface(&func_interface); -#endif if ( ft_setjmp( ras.jump_buffer ) == 0 ) { + if ( continued ) + FT_Trace_Disable(); error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras ); + if ( continued ) + FT_Trace_Enable(); + if ( !ras.invalid ) gray_record_cell( RAS_VAR ); @@ -1741,8 +1672,6 @@ typedef ptrdiff_t FT_PtrDist; { const TCoord yMin = ras.min_ey; const TCoord yMax = ras.max_ey; - const TCoord xMin = ras.min_ex; - const TCoord xMax = ras.max_ex; TCell buffer[FT_MAX_GRAY_POOL]; size_t height = (size_t)( yMax - yMin ); @@ -1751,6 +1680,8 @@ typedef ptrdiff_t FT_PtrDist; TCoord bands[32]; /* enough to accommodate bisections */ TCoord* band; + int continued = 0; + /* set up vertical bands */ if ( height > n ) @@ -1774,8 +1705,8 @@ typedef ptrdiff_t FT_PtrDist; ras.max_ey = FT_MIN( y, yMax ); band = bands; - band[1] = xMin; - band[0] = xMax; + band[1] = ras.min_ey; + band[0] = ras.max_ey; do { @@ -1787,10 +1718,11 @@ typedef ptrdiff_t FT_PtrDist; ras.num_cells = 0; ras.invalid = 1; - ras.min_ex = band[1]; - ras.max_ex = band[0]; + ras.min_ey = band[1]; + ras.max_ey = band[0]; - error = gray_convert_glyph_inner( RAS_VAR ); + error = gray_convert_glyph_inner( RAS_VAR, continued ); + continued = 1; if ( !error ) { @@ -1827,7 +1759,6 @@ typedef ptrdiff_t FT_PtrDist; { const FT_Outline* outline = (const FT_Outline*)params->source; const FT_Bitmap* target_map = params->target; - FT_BBox cbox, clip; #ifndef FT_STATIC_RASTER gray_TWorker worker[1]; @@ -1864,6 +1795,12 @@ typedef ptrdiff_t FT_PtrDist; 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; + ras.max_ex = params->clip_box.xMax; + ras.max_ey = params->clip_box.yMax; } else { @@ -1888,46 +1825,15 @@ typedef ptrdiff_t FT_PtrDist; ras.render_span = (FT_Raster_Span_Func)NULL; ras.render_span_data = NULL; - } - - FT_Outline_Get_CBox( outline, &cbox ); - - /* reject too large outline coordinates */ - if ( cbox.xMin < -0x1000000L || cbox.xMax > 0x1000000L || - cbox.yMin < -0x1000000L || cbox.yMax > 0x1000000L ) - return FT_THROW( Invalid_Outline ); - - /* truncate the bounding box to integer pixels */ - cbox.xMin = cbox.xMin >> 6; - cbox.yMin = cbox.yMin >> 6; - cbox.xMax = ( cbox.xMax + 63 ) >> 6; - cbox.yMax = ( cbox.yMax + 63 ) >> 6; + ras.num_spans = -1; /* invalid */ - /* compute clipping box */ - if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) ) - { - /* compute clip box from target pixmap */ - clip.xMin = 0; - clip.yMin = 0; - clip.xMax = (FT_Pos)target_map->width; - clip.yMax = (FT_Pos)target_map->rows; + ras.min_ex = 0; + ras.min_ey = 0; + ras.max_ex = (FT_Pos)target_map->width; + ras.max_ey = (FT_Pos)target_map->rows; } - else if ( params->flags & FT_RASTER_FLAG_CLIP ) - clip = params->clip_box; - else - { - clip.xMin = -32768L; - clip.yMin = -32768L; - clip.xMax = 32767L; - clip.yMax = 32767L; - } - - /* clip to target bitmap, exit if nothing to do */ - ras.min_ex = FT_MAX( cbox.xMin, clip.xMin ); - ras.min_ey = FT_MAX( cbox.yMin, clip.yMin ); - ras.max_ex = FT_MIN( cbox.xMax, clip.xMax ); - ras.max_ey = FT_MIN( cbox.yMax, clip.yMax ); + /* exit if nothing to do */ if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey ) return 0; diff --git a/src/3rdparty/freetype/src/smooth/ftgrays.h b/src/3rdparty/freetype/src/smooth/ftgrays.h index 9e11ca675e..e9f9c7a4ad 100644 --- a/src/3rdparty/freetype/src/smooth/ftgrays.h +++ b/src/3rdparty/freetype/src/smooth/ftgrays.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftgrays.h */ -/* */ -/* FreeType smooth renderer declaration */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftgrays.h + * + * FreeType smooth renderer declaration + * + * Copyright (C) 1996-2019 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 FTGRAYS_H_ @@ -28,19 +28,18 @@ #include "ftimage.h" #else #include -#include FT_CONFIG_CONFIG_H /* for FT_CONFIG_OPTION_PIC */ #include FT_IMAGE_H #endif - /*************************************************************************/ - /* */ - /* To make ftgrays.h independent from configuration files we check */ - /* whether FT_EXPORT_VAR has been defined already. */ - /* */ - /* On some systems and compilers (Win32 mostly), an extra keyword is */ - /* necessary to compile the library as a DLL. */ - /* */ + /************************************************************************** + * + * To make ftgrays.h independent from configuration files we check + * whether FT_EXPORT_VAR has been defined already. + * + * On some systems and compilers (Win32 mostly), an extra keyword is + * necessary to compile the library as a DLL. + */ #ifndef FT_EXPORT_VAR #define FT_EXPORT_VAR( x ) extern x #endif diff --git a/src/3rdparty/freetype/src/smooth/ftsmerrs.h b/src/3rdparty/freetype/src/smooth/ftsmerrs.h index 226dc1b001..d52c0dd9e2 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmerrs.h +++ b/src/3rdparty/freetype/src/smooth/ftsmerrs.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* ftsmerrs.h */ -/* */ -/* smooth renderer error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the smooth renderer error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ftsmerrs.h + * + * smooth renderer error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the smooth renderer error enumeration + * constants. + * + */ #ifndef FTSMERRS_H_ #define FTSMERRS_H_ diff --git a/src/3rdparty/freetype/src/smooth/ftsmooth.c b/src/3rdparty/freetype/src/smooth/ftsmooth.c index ef176bdf1e..cd034d2b40 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmooth.c +++ b/src/3rdparty/freetype/src/smooth/ftsmooth.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftsmooth.c */ -/* */ -/* Anti-aliasing renderer interface (body). */ -/* */ -/* Copyright 2000-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftsmooth.c + * + * Anti-aliasing renderer interface (body). + * + * Copyright (C) 2000-2019 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 @@ -22,7 +22,6 @@ #include FT_OUTLINE_H #include "ftsmooth.h" #include "ftgrays.h" -#include "ftspic.h" #include "ftsmerrs.h" @@ -31,6 +30,26 @@ static FT_Error ft_smooth_init( FT_Renderer render ) { + +#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + FT_Vector* sub = render->root.library->lcd_geometry; + + + /* set up default subpixel geometry for striped RGB panels. */ + sub[0].x = -21; + sub[0].y = 0; + sub[1].x = 0; + sub[1].y = 0; + sub[2].x = 21; + sub[2].y = 0; + +#elif 0 /* or else, once ClearType patents expire */ + + FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT ); + +#endif + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return 0; @@ -130,7 +149,11 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } - ft_glyphslot_preset_bitmap( slot, mode, origin ); + if ( ft_glyphslot_preset_bitmap( slot, mode, origin ) ) + { + error = FT_THROW( Raster_Overflow ); + goto Exit; + } /* allocate new one */ if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) @@ -220,7 +243,7 @@ } if ( lcd_filter_func ) - lcd_filter_func( bitmap, mode, lcd_weights ); + lcd_filter_func( bitmap, lcd_weights ); } #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ @@ -235,33 +258,40 @@ unsigned int width = bitmap->width; int pitch = bitmap->pitch; + FT_Vector* sub = slot->library->lcd_geometry; - /* Render 3 separate monochrome bitmaps, shifting the outline */ - /* by 1/3 pixel. */ - width /= 3; - bitmap->buffer += width; + /* Render 3 separate monochrome bitmaps, shifting the outline. */ + width /= 3; + FT_Outline_Translate( outline, + -sub[0].x, + -sub[0].y ); error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, -21, 0 ); - x_shift -= 21; bitmap->buffer += width; - + FT_Outline_Translate( outline, + sub[0].x - sub[1].x, + sub[0].y - sub[1].y ); error = render->raster_render( render->raster, ¶ms ); + bitmap->buffer -= width; if ( error ) goto Exit; - FT_Outline_Translate( outline, 42, 0 ); - x_shift += 42; - bitmap->buffer -= 2 * width; - + bitmap->buffer += 2 * width; + FT_Outline_Translate( outline, + sub[1].x - sub[2].x, + sub[1].y - sub[2].y ); error = render->raster_render( render->raster, ¶ms ); + bitmap->buffer -= 2 * width; if ( error ) goto Exit; + x_shift -= sub[2].x; + y_shift -= sub[2].y; + /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */ /* XXX: It is more efficient to render every third byte above. */ @@ -286,34 +316,43 @@ { int pitch = bitmap->pitch; + FT_Vector* sub = slot->library->lcd_geometry; + - /* Render 3 separate monochrome bitmaps, shifting the outline */ - /* by 1/3 pixel. Triple the pitch to render on each third row. */ + /* Render 3 separate monochrome bitmaps, shifting the outline. */ + /* Notice that the subpixel geometry vectors are rotated. */ + /* Triple the pitch to render on each third row. */ bitmap->pitch *= 3; bitmap->rows /= 3; - bitmap->buffer += pitch; - + FT_Outline_Translate( outline, + -sub[0].y, + sub[0].x ); error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 0, 21 ); - y_shift += 21; bitmap->buffer += pitch; - + FT_Outline_Translate( outline, + sub[0].y - sub[1].y, + sub[1].x - sub[0].x ); error = render->raster_render( render->raster, ¶ms ); + bitmap->buffer -= pitch; if ( error ) goto Exit; - FT_Outline_Translate( outline, 0, -42 ); - y_shift -= 42; - bitmap->buffer -= 2 * pitch; - + bitmap->buffer += 2 * pitch; + FT_Outline_Translate( outline, + sub[1].y - sub[2].y, + sub[2].x - sub[1].x ); error = render->raster_render( render->raster, ¶ms ); + bitmap->buffer -= 2 * pitch; if ( error ) goto Exit; + x_shift -= sub[2].y; + y_shift += sub[2].x; + bitmap->pitch /= 3; bitmap->rows *= 3; } @@ -403,7 +442,7 @@ (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */ (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */ - (FT_Raster_Funcs*)&FT_GRAYS_RASTER_GET /* raster_class */ + (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */ ) @@ -430,7 +469,7 @@ (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */ (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */ - (FT_Raster_Funcs*)&FT_GRAYS_RASTER_GET /* raster_class */ + (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */ ) @@ -457,7 +496,7 @@ (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */ (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */ - (FT_Raster_Funcs*)&FT_GRAYS_RASTER_GET /* raster_class */ + (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */ ) diff --git a/src/3rdparty/freetype/src/smooth/ftsmooth.h b/src/3rdparty/freetype/src/smooth/ftsmooth.h index c76ffc5034..fbb21a31d0 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmooth.h +++ b/src/3rdparty/freetype/src/smooth/ftsmooth.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ftsmooth.h */ -/* */ -/* Anti-aliasing renderer interface (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ftsmooth.h + * + * Anti-aliasing renderer interface (specification). + * + * Copyright (C) 1996-2019 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 FTSMOOTH_H_ diff --git a/src/3rdparty/freetype/src/smooth/module.mk b/src/3rdparty/freetype/src/smooth/module.mk index 5b8bc3be3b..44b76dfec6 100644 --- a/src/3rdparty/freetype/src/smooth/module.mk +++ b/src/3rdparty/freetype/src/smooth/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/smooth/rules.mk b/src/3rdparty/freetype/src/smooth/rules.mk index f30824a367..0153ac24a4 100644 --- a/src/3rdparty/freetype/src/smooth/rules.mk +++ b/src/3rdparty/freetype/src/smooth/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -29,8 +29,7 @@ SMOOTH_COMPILE := $(CC) $(ANSIFLAGS) \ # smooth driver sources (i.e., C files) # SMOOTH_DRV_SRC := $(SMOOTH_DIR)/ftgrays.c \ - $(SMOOTH_DIR)/ftsmooth.c \ - $(SMOOTH_DIR)/ftspic.c + $(SMOOTH_DIR)/ftsmooth.c # smooth driver headers diff --git a/src/3rdparty/freetype/src/smooth/smooth.c b/src/3rdparty/freetype/src/smooth/smooth.c index 5249a8931e..9c543d3360 100644 --- a/src/3rdparty/freetype/src/smooth/smooth.c +++ b/src/3rdparty/freetype/src/smooth/smooth.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* smooth.c */ -/* */ -/* FreeType anti-aliasing rasterer module component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * smooth.c + * + * FreeType anti-aliasing rasterer module component (body only). + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT @@ -21,7 +21,6 @@ #include "ftgrays.c" #include "ftsmooth.c" -#include "ftspic.c" /* END */ diff --git a/src/3rdparty/freetype/src/tools/afblue.pl b/src/3rdparty/freetype/src/tools/afblue.pl index 7c6f1a7df1..937d4ecf6e 100644 --- a/src/3rdparty/freetype/src/tools/afblue.pl +++ b/src/3rdparty/freetype/src/tools/afblue.pl @@ -5,7 +5,7 @@ # # Process a blue zone character data file. # -# Copyright 2013-2018 by +# Copyright (C) 2013-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, diff --git a/src/3rdparty/freetype/src/tools/apinames.c b/src/3rdparty/freetype/src/tools/apinames.c index 06c3260430..aeecf88d22 100644 --- a/src/3rdparty/freetype/src/tools/apinames.c +++ b/src/3rdparty/freetype/src/tools/apinames.c @@ -10,7 +10,7 @@ * accepted if you are using GCC for compilation (and probably by * other compilers too). * - * Author: David Turner, 2005, 2006, 2008-2013, 2015 + * Author: FreeType team, 2005-2019 * * This code is explicitly placed into the public domain. * @@ -26,6 +26,7 @@ #define LINEBUFF_SIZE 1024 + typedef enum OutputFormat_ { OUTPUT_LIST = 0, /* output the list of names, one per line */ @@ -53,10 +54,12 @@ typedef struct NameRec_ } NameRec, *Name; + static Name the_names; static int num_names; static int max_names; + static void names_add( const char* name, const char* end ) @@ -65,14 +68,16 @@ names_add( const char* name, int nn, len; Name nm; + if ( end <= name ) return; /* compute hash value */ - len = (int)(end - name); + len = (int)( end - name ); h = 0; + for ( nn = 0; nn < len; nn++ ) - h = h*33 + name[nn]; + h = h * 33 + name[nn]; /* check for an pre-existing name */ for ( nn = 0; nn < num_names; nn++ ) @@ -88,7 +93,7 @@ names_add( const char* name, /* add new name */ if ( num_names >= max_names ) { - max_names += (max_names >> 1) + 4; + max_names += ( max_names >> 1 ) + 4; the_names = (NameRec*)realloc( the_names, sizeof ( the_names[0] ) * max_names ); if ( !the_names ) @@ -97,7 +102,7 @@ names_add( const char* name, nm = &the_names[num_names++]; nm->hash = h; - nm->name = (char*)malloc( len+1 ); + nm->name = (char*)malloc( len + 1 ); if ( !nm->name ) panic( "not enough memory" ); @@ -116,6 +121,7 @@ name_compare( const void* name1, return strcmp( n1->name, n2->name ); } + static void names_sort( void ) { @@ -134,87 +140,93 @@ names_dump( FILE* out, switch ( format ) { - case OUTPUT_WINDOWS_DEF: - if ( dll_name ) - fprintf( out, "LIBRARY %s\n", dll_name ); - - fprintf( out, "DESCRIPTION FreeType 2 DLL\n" ); - fprintf( out, "EXPORTS\n" ); - for ( nn = 0; nn < num_names; nn++ ) - fprintf( out, " %s\n", the_names[nn].name ); - break; + case OUTPUT_WINDOWS_DEF: + if ( dll_name ) + fprintf( out, "LIBRARY %s\n", dll_name ); - case OUTPUT_BORLAND_DEF: - if ( dll_name ) - fprintf( out, "LIBRARY %s\n", dll_name ); - - fprintf( out, "DESCRIPTION FreeType 2 DLL\n" ); - fprintf( out, "EXPORTS\n" ); - for ( nn = 0; nn < num_names; nn++ ) - fprintf( out, " _%s\n", the_names[nn].name ); - break; - - case OUTPUT_WATCOM_LBC: - { - const char* dot; - char temp[512]; + fprintf( out, "DESCRIPTION FreeType 2 DLL\n" ); + fprintf( out, "EXPORTS\n" ); + for ( nn = 0; nn < num_names; nn++ ) + fprintf( out, " %s\n", the_names[nn].name ); - if ( !dll_name ) - { - fprintf( stderr, - "you must provide a DLL name with the -d option!\n" ); - exit( 4 ); - } + break; - /* we must omit the .dll suffix from the library name */ - dot = strchr( dll_name, '.' ); - if ( dot ) - { - int len = dot - dll_name; + case OUTPUT_BORLAND_DEF: + if ( dll_name ) + fprintf( out, "LIBRARY %s\n", dll_name ); + fprintf( out, "DESCRIPTION FreeType 2 DLL\n" ); + fprintf( out, "EXPORTS\n" ); - if ( len > (int)( sizeof ( temp ) - 1 ) ) - len = sizeof ( temp ) - 1; + for ( nn = 0; nn < num_names; nn++ ) + fprintf( out, " _%s\n", the_names[nn].name ); - memcpy( temp, dll_name, len ); - temp[len] = 0; + break; - dll_name = (const char*)temp; - } + case OUTPUT_WATCOM_LBC: + { + const char* dot; + char temp[512]; - for ( nn = 0; nn < num_names; nn++ ) - fprintf( out, "++_%s.%s.%s\n", the_names[nn].name, dll_name, - the_names[nn].name ); - } - break; - case OUTPUT_NETWARE_IMP: + if ( !dll_name ) { - if ( dll_name ) - fprintf( out, " (%s)\n", dll_name ); - for ( nn = 0; nn < num_names - 1; nn++ ) - fprintf( out, " %s,\n", the_names[nn].name ); - fprintf( out, " %s\n", the_names[num_names - 1].name ); + fprintf( stderr, + "you must provide a DLL name with the -d option!\n" ); + exit( 4 ); } - break; - case OUTPUT_GNU_VERMAP: + /* we must omit the `.dll' suffix from the library name */ + dot = strchr( dll_name, '.' ); + if ( dot ) { - fprintf( out, "{\n\tglobal:\n" ); - for ( nn = 0; nn < num_names; nn++ ) - fprintf( out, "\t\t%s;\n", the_names[nn].name ); - fprintf( out, "\tlocal:\n\t\t*;\n};\n" ); + int len = dot - dll_name; + + + if ( len > (int)( sizeof ( temp ) - 1 ) ) + len = sizeof ( temp ) - 1; + + memcpy( temp, dll_name, len ); + temp[len] = 0; + + dll_name = (const char*)temp; } - break; - default: /* LIST */ for ( nn = 0; nn < num_names; nn++ ) - fprintf( out, "%s\n", the_names[nn].name ); - } -} + fprintf( out, "++_%s.%s.%s\n", + the_names[nn].name, dll_name, the_names[nn].name ); + } + + break; + + case OUTPUT_NETWARE_IMP: + if ( dll_name ) + fprintf( out, " (%s)\n", dll_name ); + + for ( nn = 0; nn < num_names - 1; nn++ ) + fprintf( out, " %s,\n", the_names[nn].name ); + fprintf( out, " %s\n", the_names[num_names - 1].name ); + + break; + + case OUTPUT_GNU_VERMAP: + fprintf( out, "{\n\tglobal:\n" ); + for ( nn = 0; nn < num_names; nn++ ) + fprintf( out, "\t\t%s;\n", the_names[nn].name ); + fprintf( out, "\tlocal:\n\t\t*;\n};\n" ); + + break; + + default: /* LIST */ + for ( nn = 0; nn < num_names; nn++ ) + fprintf( out, "%s\n", the_names[nn].name ); + + break; + } +} /* states of the line parser */ @@ -226,89 +238,96 @@ typedef enum State_ } State; + static int -read_header_file( FILE* file, int verbose ) +read_header_file( FILE* file, + int verbose ) { static char buff[LINEBUFF_SIZE + 1]; State state = STATE_START; + while ( !feof( file ) ) { char* p; + if ( !fgets( buff, LINEBUFF_SIZE, file ) ) break; p = buff; - while ( *p && (*p == ' ' || *p == '\\') ) /* skip leading whitespace */ + /* skip leading whitespace */ + while ( *p && ( *p == ' ' || *p == '\\' ) ) p++; - if ( *p == '\n' || *p == '\r' ) /* skip empty lines */ + /* skip empty lines */ + if ( *p == '\n' || *p == '\r' ) continue; switch ( state ) { - case STATE_START: + case STATE_START: + if ( memcmp( p, "FT_EXPORT(", 10 ) != 0 ) + break; + + p += 10; + for (;;) + { + if ( *p == 0 || *p == '\n' || *p == '\r' ) + goto NextLine; + + if ( *p == ')' ) { - if ( memcmp( p, "FT_EXPORT(", 10 ) != 0 ) - break; - - p += 10; - for (;;) - { - if ( *p == 0 || *p == '\n' || *p == '\r' ) - goto NextLine; - - if ( *p == ')' ) - { - p++; - break; - } - - p++; - } - - state = STATE_TYPE; - - /* sometimes, the name is just after the FT_EXPORT(...), so - * skip whitespace, and fall-through if we find an alphanumeric - * character - */ - while ( *p == ' ' || *p == '\t' ) - p++; - - if ( !isalpha(*p) ) - break; + p++; + break; } - /* fall-through */ - case STATE_TYPE: - { - char* name = p; + p++; + } - while ( isalnum(*p) || *p == '_' ) - p++; + state = STATE_TYPE; + + /* + * Sometimes, the name is just after `FT_EXPORT(...)', so skip + * whitespace and fall-through if we find an alphanumeric character. + */ + while ( *p == ' ' || *p == '\t' ) + p++; + + if ( !isalpha( *p ) ) + break; + + /* fall-through */ + + case STATE_TYPE: + { + char* name = p; - if ( p > name ) - { - if ( verbose ) - fprintf( stderr, ">>> %.*s\n", (int)(p - name), name ); - names_add( name, p ); - } + while ( isalnum( *p ) || *p == '_' ) + p++; - state = STATE_START; + if ( p > name ) + { + if ( verbose ) + fprintf( stderr, ">>> %.*s\n", (int)( p - name ), name ); + + names_add( name, p ); } - break; - default: - ; + state = STATE_START; + } + + break; + + default: + ; } - NextLine: +NextLine: ; - } + } /* end of while loop */ return 0; } @@ -318,143 +337,154 @@ static void usage( void ) { static const char* const format = - "%s %s: extract FreeType API names from header files\n\n" - "this program is used to extract the list of public FreeType API\n" - "functions. It receives the list of header files as argument and\n" - "generates a sorted list of unique identifiers\n\n" - - "usage: %s header1 [options] [header2 ...]\n\n" - - "options: - : parse the content of stdin, ignore arguments\n" - " -v : verbose mode, output sent to standard error\n" - " -oFILE : write output to FILE instead of standard output\n" - " -dNAME : indicate DLL file name, 'freetype.dll' by default\n" - " -w : output .DEF file for Visual C++ and Mingw\n" - " -wB : output .DEF file for Borland C++\n" - " -wW : output Watcom Linker Response File\n" - " -wN : output NetWare Import File\n" - " -wL : output version map for GNU or Solaris linker\n" - "\n"; + "%s %s: extract FreeType API names from header files\n" + "\n" + "This program extracts the list of public FreeType API functions.\n" + "It receives a list of header files as an argument and\n" + "generates a sorted list of unique identifiers in various formats.\n" + "\n" + "usage: %s header1 [options] [header2 ...]\n" + "\n" + "options: - parse the contents of stdin, ignore arguments\n" + " -v verbose mode, output sent to standard error\n" + " -oFILE write output to FILE instead of standard output\n" + " -dNAME indicate DLL file name, 'freetype.dll' by default\n" + " -w output .DEF file for Visual C++ and Mingw\n" + " -wB output .DEF file for Borland C++\n" + " -wW output Watcom Linker Response File\n" + " -wN output NetWare Import File\n" + " -wL output version map for GNU or Solaris linker\n" + "\n"; fprintf( stderr, format, PROGRAM_NAME, PROGRAM_VERSION, - PROGRAM_NAME - ); - exit(1); + PROGRAM_NAME ); + + exit( 1 ); } -int main( int argc, const char* const* argv ) +int +main( int argc, + const char* const* argv ) { - int from_stdin = 0; - int verbose = 0; - OutputFormat format = OUTPUT_LIST; /* the default */ - FILE* out = stdout; + int from_stdin = 0; + int verbose = 0; + OutputFormat format = OUTPUT_LIST; /* the default */ + FILE* out = stdout; const char* library_name = NULL; + if ( argc < 2 ) usage(); - /* '-' used as a single argument means read source file from stdin */ + /* `-' used as a single argument means read source file from stdin */ while ( argc > 1 && argv[1][0] == '-' ) { const char* arg = argv[1]; + switch ( arg[1] ) { - case 'v': - verbose = 1; - break; + case 'v': + verbose = 1; - case 'o': - if ( arg[2] == 0 ) - { - if ( argc < 2 ) - usage(); + break; - arg = argv[2]; - argv++; - argc--; - } - else - arg += 2; + case 'o': + if ( arg[2] == 0 ) + { + if ( argc < 2 ) + usage(); - out = fopen( arg, "wt" ); - if ( !out ) - { - fprintf( stderr, "could not open '%s' for writing\n", argv[2] ); - exit(3); - } - break; + arg = argv[2]; + argv++; + argc--; + } + else + arg += 2; - case 'd': - if ( arg[2] == 0 ) - { - if ( argc < 2 ) - usage(); + out = fopen( arg, "wt" ); + if ( !out ) + { + fprintf( stderr, "could not open '%s' for writing\n", arg ); + exit( 3 ); + } - arg = argv[2]; - argv++; - argc--; - } - else - arg += 2; + break; - library_name = arg; - break; + case 'd': + if ( arg[2] == 0 ) + { + if ( argc < 2 ) + usage(); - case 'w': - format = OUTPUT_WINDOWS_DEF; - switch ( arg[2] ) - { - case 'B': - format = OUTPUT_BORLAND_DEF; - break; + arg = argv[2]; + argv++; + argc--; + } + else + arg += 2; + + library_name = arg; + + break; - case 'W': - format = OUTPUT_WATCOM_LBC; - break; + case 'w': + format = OUTPUT_WINDOWS_DEF; - case 'N': - format = OUTPUT_NETWARE_IMP; - break; + switch ( arg[2] ) + { + case 'B': + format = OUTPUT_BORLAND_DEF; + break; - case 'L': - format = OUTPUT_GNU_VERMAP; - break; + case 'W': + format = OUTPUT_WATCOM_LBC; + break; - case 0: - break; + case 'N': + format = OUTPUT_NETWARE_IMP; + break; - default: - usage(); - } + case 'L': + format = OUTPUT_GNU_VERMAP; break; case 0: - from_stdin = 1; break; default: usage(); + } + + break; + + case 0: + from_stdin = 1; + + break; + + default: + usage(); } argc--; argv++; - } + + } /* end of while loop */ if ( from_stdin ) - { read_header_file( stdin, verbose ); - } else { for ( --argc, argv++; argc > 0; argc--, argv++ ) { FILE* file = fopen( argv[0], "rb" ); + if ( !file ) fprintf( stderr, "unable to open '%s'\n", argv[0] ); else @@ -469,7 +499,7 @@ int main( int argc, const char* const* argv ) } if ( num_names == 0 ) - panic( "could not find exported functions !!\n" ); + panic( "could not find exported functions\n" ); names_sort(); names_dump( out, format, library_name ); @@ -479,3 +509,6 @@ int main( int argc, const char* const* argv ) return 0; } + + +/* END */ diff --git a/src/3rdparty/freetype/src/tools/glnames.py b/src/3rdparty/freetype/src/tools/glnames.py index b048d29364..e1b613d11b 100644 --- a/src/3rdparty/freetype/src/tools/glnames.py +++ b/src/3rdparty/freetype/src/tools/glnames.py @@ -6,7 +6,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -5310,24 +5310,24 @@ def main(): mac_extras_count = len( mac_extras ) base_list = mac_extras + sid_standard_names - write( "/***************************************************************************/\n" ) - write( "/* */\n" ) - - write( "/* %-71s*/\n" % os.path.basename( sys.argv[1] ) ) - - write( "/* */\n" ) - write( "/* PostScript glyph names. */\n" ) - write( "/* */\n" ) - write( "/* Copyright 2005-2018 by */\n" ) - write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" ) - write( "/* */\n" ) - write( "/* This file is part of the FreeType project, and may only be used, */\n" ) - write( "/* modified, and distributed under the terms of the FreeType project */\n" ) - write( "/* license, LICENSE.TXT. By continuing to use, modify, or distribute */\n" ) - write( "/* this file you indicate that you have read the license and */\n" ) - write( "/* understand and accept it fully. */\n" ) - write( "/* */\n" ) - write( "/***************************************************************************/\n" ) + write( "/****************************************************************************\n" ) + write( " *\n" ) + + write( " * %-71s\n" % os.path.basename( sys.argv[1] ) ) + + write( " *\n" ) + write( " * PostScript glyph names.\n" ) + write( " *\n" ) + write( " * Copyright 2005-2019 by\n" ) + write( " * David Turner, Robert Wilhelm, and Werner Lemberg.\n" ) + write( " *\n" ) + write( " * This file is part of the FreeType project, and may only be used,\n" ) + write( " * modified, and distributed under the terms of the FreeType project\n" ) + write( " * license, LICENSE.TXT. By continuing to use, modify, or distribute\n" ) + write( " * this file you indicate that you have read the license and\n" ) + write( " * understand and accept it fully.\n" ) + write( " *\n" ) + write( " */\n" ) write( "\n" ) write( "\n" ) write( " /* This file has been generated automatically -- do not edit! */\n" ) @@ -5361,12 +5361,12 @@ def main(): write( """\ /* - * This table is a compressed version of the Adobe Glyph List (AGL), - * optimized for efficient searching. It has been generated by the - * `glnames.py' python script located in the `src/tools' directory. + * This table is a compressed version of the Adobe Glyph List (AGL), + * optimized for efficient searching. It has been generated by the + * `glnames.py' python script located in the `src/tools' directory. * - * The lookup function to get the Unicode value for a given string - * is defined below the table. + * The lookup function to get the Unicode value for a given string + * is defined below the table. */ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST @@ -5380,7 +5380,7 @@ def main(): write( """\ #ifdef DEFINE_PS_TABLES /* - * This function searches the compressed table efficiently. + * This function searches the compressed table efficiently. */ static unsigned long ft_get_adobe_glyph_index( const char* name, diff --git a/src/3rdparty/freetype/src/tools/update-copyright-year b/src/3rdparty/freetype/src/tools/update-copyright-year index 934f11cf02..2ae50d6f52 100644 --- a/src/3rdparty/freetype/src/tools/update-copyright-year +++ b/src/3rdparty/freetype/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 2015-2018 by +# Copyright (C) 2015-2019 by # Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -67,7 +67,8 @@ while (<>) s { (?.*) Copyright - (?\ +) + (?(\ + + | \ +\(C\)\ +)) (?[12][0-9][0-9][0-9]) (?.+) (?[12][0-9][0-9][0-9]) @@ -78,14 +79,15 @@ while (<>) } { # Fill line to the same length (if appropriate); we skip the middle - # part but insert two spaces and `-'. + # part but insert `(C)', three spaces, and `-'. my $space = length($+{space1}) - 1 + length($+{middle}) - 1 + length($+{space2}) - 1 - + length($+{space3}); + + length($+{space3}) + - (length("(C)") + 1); print "$+{begin}"; - print "Copyright\ $+{first}-$year\ by"; + print "Copyright\ (C)\ $+{first}-$year\ by"; print ' ' x $space if length($+{end}); print "$+{end}\n"; $replaced = 1; @@ -95,7 +97,8 @@ while (<>) s { (?.*) Copyright - (?\ +) + (?(\ + + | \ +\(C\)\ +)) (?[12][0-9][0-9][0-9]) (?\ +) by @@ -103,7 +106,7 @@ while (<>) (?.*) } { - # Fill line to the same length (if appropriate); we insert two + # 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 @@ -111,7 +114,7 @@ while (<>) - (length($year) + 1); print "$+{begin}"; - print "Copyright $+{first}-$year by"; + print "Copyright\ (C)\ $+{first}-$year\ by"; # If $space is negative this inserts nothing. print ' ' x $space if length($+{end}); print "$+{end}\n"; diff --git a/src/3rdparty/freetype/src/truetype/Jamfile b/src/3rdparty/freetype/src/truetype/Jamfile index e321fba14a..2de63a7b4c 100644 --- a/src/3rdparty/freetype/src/truetype/Jamfile +++ b/src/3rdparty/freetype/src/truetype/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/truetype Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/truetype/module.mk b/src/3rdparty/freetype/src/truetype/module.mk index 16bc9c8b20..8a841cc956 100644 --- a/src/3rdparty/freetype/src/truetype/module.mk +++ b/src/3rdparty/freetype/src/truetype/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/truetype/rules.mk b/src/3rdparty/freetype/src/truetype/rules.mk index e16113f128..df8dcd4a4e 100644 --- a/src/3rdparty/freetype/src/truetype/rules.mk +++ b/src/3rdparty/freetype/src/truetype/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -33,7 +33,6 @@ TT_DRV_SRC := $(TT_DIR)/ttdriver.c \ $(TT_DIR)/ttgxvar.c \ $(TT_DIR)/ttinterp.c \ $(TT_DIR)/ttobjs.c \ - $(TT_DIR)/ttpic.c \ $(TT_DIR)/ttpload.c \ $(TT_DIR)/ttsubpix.c diff --git a/src/3rdparty/freetype/src/truetype/truetype.c b/src/3rdparty/freetype/src/truetype/truetype.c index 484370975c..84928e7321 100644 --- a/src/3rdparty/freetype/src/truetype/truetype.c +++ b/src/3rdparty/freetype/src/truetype/truetype.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* truetype.c */ -/* */ -/* FreeType TrueType driver component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * truetype.c + * + * FreeType TrueType driver component (body only). + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT @@ -24,7 +24,6 @@ #include "ttgxvar.c" /* gx distortable font */ #include "ttinterp.c" #include "ttobjs.c" /* object manager */ -#include "ttpic.c" #include "ttpload.c" /* tables loader */ #include "ttsubpix.c" diff --git a/src/3rdparty/freetype/src/truetype/ttdriver.c b/src/3rdparty/freetype/src/truetype/ttdriver.c index 820cafbb8d..ff626d53ab 100644 --- a/src/3rdparty/freetype/src/truetype/ttdriver.c +++ b/src/3rdparty/freetype/src/truetype/ttdriver.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttdriver.c */ -/* */ -/* TrueType font driver implementation (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttdriver.c + * + * TrueType font driver implementation (body). + * + * Copyright (C) 1996-2019 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 @@ -43,20 +43,19 @@ #include "tterrors.h" -#include "ttpic.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttdriver +#define FT_COMPONENT ttdriver /* - * PROPERTY SERVICE + * PROPERTY SERVICE * */ static FT_Error @@ -164,38 +163,42 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* tt_get_kerning */ - /* */ - /* */ - /* A driver method used to return the kerning vector between two */ - /* glyphs of the same face. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* left_glyph :: The index of the left glyph in the kern pair. */ - /* */ - /* right_glyph :: The index of the right glyph in the kern pair. */ - /* */ - /* */ - /* kerning :: The kerning vector. This is in font units for */ - /* scalable formats, and in pixels for fixed-sizes */ - /* formats. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Only horizontal layouts (left-to-right & right-to-left) are */ - /* supported by this function. Other layouts, or more sophisticated */ - /* kernings, are out of scope of this method (the basic driver */ - /* interface is meant to be simple). */ - /* */ - /* They can be implemented by format-specific interfaces. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_get_kerning + * + * @Description: + * A driver method used to return the kerning vector between two + * glyphs of the same face. + * + * @Input: + * face :: + * A handle to the source face object. + * + * left_glyph :: + * The index of the left glyph in the kern pair. + * + * right_glyph :: + * The index of the right glyph in the kern pair. + * + * @Output: + * kerning :: + * The kerning vector. This is in font units for + * scalable formats, and in pixels for fixed-sizes + * formats. + * + * @Return: + * FreeType error code. 0 means success. + * + * @Note: + * Only horizontal layouts (left-to-right & right-to-left) are + * supported by this function. Other layouts, or more sophisticated + * kernings, are out of scope of this method (the basic driver + * interface is meant to be simple). + * + * They can be implemented by format-specific interfaces. + */ static FT_Error tt_get_kerning( FT_Face ttface, /* TT_Face */ FT_UInt left_glyph, @@ -384,32 +387,36 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_glyph_load */ - /* */ - /* */ - /* A driver method used to load a glyph within a given glyph slot. */ - /* */ - /* */ - /* slot :: A handle to the target slot object where the glyph */ - /* will be loaded. */ - /* */ - /* size :: A handle to the source face size at which the glyph */ - /* must be scaled, loaded, etc. */ - /* */ - /* glyph_index :: The index of the glyph in the font file. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* FT_LOAD_XXX constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_glyph_load + * + * @Description: + * A driver method used to load a glyph within a given glyph slot. + * + * @Input: + * slot :: + * A handle to the target slot object where the glyph + * will be loaded. + * + * size :: + * A handle to the source face size at which the glyph + * must be scaled, loaded, etc. + * + * glyph_index :: + * The index of the glyph in the font file. + * + * load_flags :: + * A flag indicating what to load for this glyph. The + * FT_LOAD_XXX constants can be used to control the + * glyph loading process (e.g., whether the outline + * should be scaled, whether to load bitmaps or not, + * whether to hint the outline, etc). + * + * @Return: + * FreeType error code. 0 means success. + */ static FT_Error tt_glyph_load( FT_GlyphSlot ttslot, /* TT_GlyphSlot */ FT_Size ttsize, /* TT_Size */ @@ -464,7 +471,7 @@ ? &ttsize->metrics : &size->hinted_metrics; - /* now load the glyph outline if necessary */ + /* now fill in the glyph slot with outline/bitmap/layered */ error = TT_Load_Glyph( size, slot, glyph_index, load_flags ); /* force drop-out mode to 2 - irrelevant now */ @@ -491,17 +498,19 @@ FT_DEFINE_SERVICE_MULTIMASTERSREC( tt_service_gx_multi_masters, - (FT_Get_MM_Func) NULL, /* get_mm */ - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ - (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */ - (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ - (FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */ - (FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */ - (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */ - - (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ - (FT_Done_Blend_Func) tt_done_blend /* done_blend */ + (FT_Get_MM_Func) NULL, /* get_mm */ + (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ + (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */ + (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ + (FT_Set_Var_Design_Func) TT_Set_Var_Design, /* set_var_design */ + (FT_Get_Var_Design_Func) TT_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */ + (FT_Set_MM_WeightVector_Func)NULL, /* set_mm_weightvector */ + (FT_Get_MM_WeightVector_Func)NULL, /* get_mm_weightvector */ + + (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ + (FT_Done_Blend_Func) tt_done_blend /* done_blend */ ) FT_DEFINE_SERVICE_METRICSVARIATIONSREC( @@ -548,19 +557,19 @@ tt_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TRUETYPE, - FT_SERVICE_ID_MULTI_MASTERS, &TT_SERVICE_GX_MULTI_MASTERS_GET, - FT_SERVICE_ID_METRICS_VARIATIONS, &TT_SERVICE_METRICS_VARIATIONS_GET, + FT_SERVICE_ID_MULTI_MASTERS, &tt_service_gx_multi_masters, + FT_SERVICE_ID_METRICS_VARIATIONS, &tt_service_metrics_variations, FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine, - FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET, - FT_SERVICE_ID_PROPERTIES, &TT_SERVICE_PROPERTIES_GET ) + FT_SERVICE_ID_TT_GLYF, &tt_service_truetype_glyf, + FT_SERVICE_ID_PROPERTIES, &tt_service_properties ) #else FT_DEFINE_SERVICEDESCREC4( tt_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TRUETYPE, FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine, - FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET, - FT_SERVICE_ID_PROPERTIES, &TT_SERVICE_PROPERTIES_GET ) + FT_SERVICE_ID_TT_GLYF, &tt_service_truetype_glyf, + FT_SERVICE_ID_PROPERTIES, &tt_service_properties ) #endif @@ -574,26 +583,15 @@ SFNT_Service sfnt; - /* TT_SERVICES_GET dereferences `library' in PIC mode */ -#ifdef FT_CONFIG_OPTION_PIC - if ( !driver ) - return NULL; - library = driver->library; - if ( !library ) - return NULL; -#endif - - result = ft_service_list_lookup( TT_SERVICES_GET, tt_interface ); + result = ft_service_list_lookup( tt_services, tt_interface ); if ( result ) return result; -#ifndef FT_CONFIG_OPTION_PIC if ( !driver ) return NULL; library = driver->library; if ( !library ) return NULL; -#endif /* only return the default interface from the SFNT module */ sfntd = FT_Get_Module( library, "sfnt" ); diff --git a/src/3rdparty/freetype/src/truetype/ttdriver.h b/src/3rdparty/freetype/src/truetype/ttdriver.h index 707aa68edf..3936c6a4de 100644 --- a/src/3rdparty/freetype/src/truetype/ttdriver.h +++ b/src/3rdparty/freetype/src/truetype/ttdriver.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttdriver.h */ -/* */ -/* High-level TrueType driver interface (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttdriver.h + * + * High-level TrueType driver interface (specification). + * + * Copyright (C) 1996-2019 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 TTDRIVER_H_ @@ -26,10 +26,8 @@ FT_BEGIN_HEADER - FT_DECLARE_DRIVER( tt_driver_class ) - FT_END_HEADER #endif /* TTDRIVER_H_ */ diff --git a/src/3rdparty/freetype/src/truetype/tterrors.h b/src/3rdparty/freetype/src/truetype/tterrors.h index 88bca3a04a..5609d28d68 100644 --- a/src/3rdparty/freetype/src/truetype/tterrors.h +++ b/src/3rdparty/freetype/src/truetype/tterrors.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* tterrors.h */ -/* */ -/* TrueType error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the TrueType error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * tterrors.h + * + * TrueType error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the TrueType error enumeration + * constants. + * + */ #ifndef TTERRORS_H_ #define TTERRORS_H_ diff --git a/src/3rdparty/freetype/src/truetype/ttgload.c b/src/3rdparty/freetype/src/truetype/ttgload.c index 39d9c3f736..a04684086b 100644 --- a/src/3rdparty/freetype/src/truetype/ttgload.c +++ b/src/3rdparty/freetype/src/truetype/ttgload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttgload.c */ -/* */ -/* TrueType Glyph Loader (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttgload.c + * + * TrueType Glyph Loader (body). + * + * Copyright (C) 1996-2019 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 @@ -38,20 +38,35 @@ #include "ttsubpix.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttgload +#define FT_COMPONENT ttgload - /*************************************************************************/ - /* */ - /* Composite glyph flags. */ - /* */ + /************************************************************************** + * + * Simple glyph flags. + */ +#define ON_CURVE_POINT 0x01 /* same value as FT_CURVE_TAG_ON */ +#define X_SHORT_VECTOR 0x02 +#define Y_SHORT_VECTOR 0x04 +#define REPEAT_FLAG 0x08 +#define X_POSITIVE 0x10 /* two meanings depending on X_SHORT_VECTOR */ +#define SAME_X 0x10 +#define Y_POSITIVE 0x20 /* two meanings depending on Y_SHORT_VECTOR */ +#define SAME_Y 0x20 +#define OVERLAP_SIMPLE 0x40 /* we ignore this value */ + + + /************************************************************************** + * + * Composite glyph flags. + */ #define ARGS_ARE_WORDS 0x0001 #define ARGS_ARE_XY_VALUES 0x0002 #define ROUND_XY_TO_GRID 0x0004 @@ -62,15 +77,24 @@ #define WE_HAVE_A_2X2 0x0080 #define WE_HAVE_INSTR 0x0100 #define USE_MY_METRICS 0x0200 -#define OVERLAP_COMPOUND 0x0400 +#define OVERLAP_COMPOUND 0x0400 /* we ignore this value */ #define SCALED_COMPONENT_OFFSET 0x0800 #define UNSCALED_COMPONENT_OFFSET 0x1000 - /*************************************************************************/ - /* */ - /* Return the horizontal metrics in font units for a given glyph. */ - /* */ +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#define IS_DEFAULT_INSTANCE( _face ) \ + ( !( FT_IS_NAMED_INSTANCE( _face ) || \ + FT_IS_VARIATION( _face ) ) ) +#else +#define IS_DEFAULT_INSTANCE( _face ) 1 +#endif + + + /************************************************************************** + * + * Return the horizontal metrics in font units for a given glyph. + */ FT_LOCAL_DEF( void ) TT_Get_HMetrics( TT_Face face, FT_UInt idx, @@ -84,11 +108,11 @@ } - /*************************************************************************/ - /* */ - /* Return the vertical metrics in font units for a given glyph. */ - /* See function `tt_loader_set_pp' below for explanations. */ - /* */ + /************************************************************************** + * + * Return the vertical metrics in font units for a given glyph. + * See function `tt_loader_set_pp' below for explanations. + */ FT_LOCAL_DEF( void ) TT_Get_VMetrics( TT_Face face, FT_UInt idx, @@ -250,13 +274,13 @@ #endif /* FT_CONFIG_OPTION_INCREMENTAL */ - /*************************************************************************/ - /* */ - /* The following functions are used by default with TrueType fonts. */ - /* However, they can be replaced by alternatives if we need to support */ - /* TrueType-compressed formats (like MicroType) in the future. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * The following functions are used by default with TrueType fonts. + * However, they can be replaced by alternatives if we need to support + * TrueType-compressed formats (like MicroType) in the future. + * + */ FT_CALLBACK_DEF( FT_Error ) TT_Access_Glyph_Frame( TT_Loader loader, @@ -267,12 +291,9 @@ FT_Error error; FT_Stream stream = loader->stream; - /* for non-debug mode */ FT_UNUSED( glyph_index ); - FT_TRACE4(( "Glyph %ld\n", glyph_index )); - /* the following line sets the `error' variable through macros! */ if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( byte_count ) ) return error; @@ -337,7 +358,7 @@ FT_Byte *flag, *flag_limit; FT_Byte c, count; FT_Vector *vec, *vec_limit; - FT_Pos x; + FT_Pos x, y; FT_Short *cont, *cont_limit, prev_cont; FT_Int xy_size = 0; @@ -382,6 +403,8 @@ goto Invalid_Outline; } + FT_TRACE5(( " # of points: %d\n", n_points )); + /* note that we will add four phantom points later */ error = FT_GLYPHLOADER_CHECK_POINTS( gloader, n_points + 4, 0 ); if ( error ) @@ -452,7 +475,7 @@ goto Invalid_Outline; *flag++ = c = FT_NEXT_BYTE( p ); - if ( c & 8 ) + if ( c & REPEAT_FLAG ) { if ( p + 1 > limit ) goto Invalid_Outline; @@ -478,31 +501,29 @@ for ( ; vec < vec_limit; vec++, flag++ ) { - FT_Pos y = 0; - FT_Byte f = *flag; + FT_Pos delta = 0; + FT_Byte f = *flag; - if ( f & 2 ) + if ( f & X_SHORT_VECTOR ) { if ( p + 1 > limit ) goto Invalid_Outline; - y = (FT_Pos)FT_NEXT_BYTE( p ); - if ( ( f & 16 ) == 0 ) - y = -y; + delta = (FT_Pos)FT_NEXT_BYTE( p ); + if ( !( f & X_POSITIVE ) ) + delta = -delta; } - else if ( ( f & 16 ) == 0 ) + else if ( !( f & SAME_X ) ) { if ( p + 2 > limit ) goto Invalid_Outline; - y = (FT_Pos)FT_NEXT_SHORT( p ); + delta = (FT_Pos)FT_NEXT_SHORT( p ); } - x += y; + x += delta; vec->x = x; - /* the cast is for stupid compilers */ - *flag = (FT_Byte)( f & ~( 2 | 16 ) ); } /* reading the Y coordinates */ @@ -510,35 +531,36 @@ vec = gloader->current.outline.points; vec_limit = vec + n_points; flag = (FT_Byte*)outline->tags; - x = 0; + y = 0; for ( ; vec < vec_limit; vec++, flag++ ) { - FT_Pos y = 0; - FT_Byte f = *flag; + FT_Pos delta = 0; + FT_Byte f = *flag; - if ( f & 4 ) + if ( f & Y_SHORT_VECTOR ) { if ( p + 1 > limit ) goto Invalid_Outline; - y = (FT_Pos)FT_NEXT_BYTE( p ); - if ( ( f & 32 ) == 0 ) - y = -y; + delta = (FT_Pos)FT_NEXT_BYTE( p ); + if ( !( f & Y_POSITIVE ) ) + delta = -delta; } - else if ( ( f & 32 ) == 0 ) + else if ( !( f & SAME_Y ) ) { if ( p + 2 > limit ) goto Invalid_Outline; - y = (FT_Pos)FT_NEXT_SHORT( p ); + delta = (FT_Pos)FT_NEXT_SHORT( p ); } - x += y; - vec->y = x; + y += delta; + vec->y = y; + /* the cast is for stupid compilers */ - *flag = (FT_Byte)( f & FT_CURVE_TAG_ON ); + *flag = (FT_Byte)( f & ON_CURVE_POINT ); } outline->n_points = (FT_Short)n_points; @@ -559,9 +581,10 @@ TT_Load_Composite_Glyph( TT_Loader loader ) { FT_Error error; - FT_Byte* p = loader->cursor; - FT_Byte* limit = loader->limit; - FT_GlyphLoader gloader = loader->gloader; + FT_Byte* p = loader->cursor; + FT_Byte* limit = loader->limit; + FT_GlyphLoader gloader = loader->gloader; + FT_Long num_glyphs = loader->face->root.num_glyphs; FT_SubGlyph subglyph; FT_UInt num_subglyphs; @@ -590,6 +613,11 @@ subglyph->flags = FT_NEXT_USHORT( p ); subglyph->index = FT_NEXT_USHORT( p ); + /* we reject composites that have components */ + /* with invalid glyph indices */ + if ( subglyph->index >= num_glyphs ) + goto Invalid_Composite; + /* check space */ count = 2; if ( subglyph->flags & ARGS_ARE_WORDS ) @@ -768,15 +796,15 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Hint_Glyph */ - /* */ - /* */ - /* Hint the glyph using the zone prepared by the caller. Note that */ - /* the zone is supposed to include four phantom points. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Hint_Glyph + * + * @Description: + * Hint the glyph using the zone prepared by the caller. Note that + * the zone is supposed to include four phantom points. + */ static FT_Error TT_Hint_Glyph( TT_Loader loader, FT_Bool is_composite ) @@ -797,15 +825,9 @@ #ifdef TT_USE_BYTECODE_INTERPRETER - if ( loader->glyph->control_len > 0xFFFFL ) - { - FT_TRACE1(( "TT_Hint_Glyph: too long instructions" )); - FT_TRACE1(( " (0x%lx byte) is truncated\n", - loader->glyph->control_len )); - } n_ins = loader->glyph->control_len; - /* save original point position in org */ + /* save original point positions in `org' array */ if ( n_ins > 0 ) FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points ); @@ -896,16 +918,16 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Process_Simple_Glyph */ - /* */ - /* */ - /* Once a simple glyph has been loaded, it needs to be processed. */ - /* Usually, this means scaling and hinting through bytecode */ - /* interpretation. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Process_Simple_Glyph + * + * @Description: + * Once a simple glyph has been loaded, it needs to be processed. + * Usually, this means scaling and hinting through bytecode + * interpretation. + */ static FT_Error TT_Process_Simple_Glyph( TT_Loader loader ) { @@ -914,6 +936,11 @@ FT_Outline* outline; FT_Int n_points; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_Memory memory = loader->face->root.memory; + FT_Vector* unrounded = NULL; +#endif + outline = &gloader->current.outline; n_points = outline->n_points; @@ -934,26 +961,32 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( FT_IS_NAMED_INSTANCE( FT_FACE( loader->face ) ) || - FT_IS_VARIATION( FT_FACE( loader->face ) ) ) + if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) ) { + if ( FT_NEW_ARRAY( unrounded, n_points ) ) + goto Exit; + /* Deltas apply to the unscaled data. */ error = TT_Vary_Apply_Glyph_Deltas( loader->face, loader->glyph_index, outline, + unrounded, (FT_UInt)n_points ); /* recalculate linear horizontal and vertical advances */ /* if we don't have HVAR and VVAR, respectively */ + + /* XXX: change all FreeType modules to store `linear' and `vadvance' */ + /* in 26.6 format before the `base' module scales them to 16.16 */ if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - loader->linear = outline->points[n_points - 3].x - - outline->points[n_points - 4].x; + loader->linear = FT_PIX_ROUND( unrounded[n_points - 3].x - + unrounded[n_points - 4].x ) / 64; if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - loader->vadvance = outline->points[n_points - 1].x - - outline->points[n_points - 2].x; + loader->vadvance = FT_PIX_ROUND( unrounded[n_points - 1].x - + unrounded[n_points - 2].x ) / 64; if ( error ) - return error; + goto Exit; } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ @@ -1008,10 +1041,23 @@ /* compensate for any scaling by de/emboldening; */ /* the amount was determined via experimentation */ if ( x_scale_factor != 1000 && ppem > 11 ) + { +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_Vector* orig_points = outline->points; + + + if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) ) + outline->points = unrounded; +#endif FT_Outline_EmboldenXY( outline, FT_MulFix( 1280 * ppem, 1000 - x_scale_factor ), 0 ); +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) ) + outline->points = orig_points; +#endif + } do_scale = TRUE; } } @@ -1032,10 +1078,26 @@ if ( do_scale ) { - for ( ; vec < limit; vec++ ) +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) ) { - vec->x = FT_MulFix( vec->x, x_scale ); - vec->y = FT_MulFix( vec->y, y_scale ); + FT_Vector* u = unrounded; + + + for ( ; vec < limit; vec++, u++ ) + { + vec->x = ( FT_MulFix( u->x, x_scale ) + 32 ) >> 6; + vec->y = ( FT_MulFix( u->y, y_scale ) + 32 ) >> 6; + } + } + else +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + { + for ( ; vec < limit; vec++ ) + { + vec->x = FT_MulFix( vec->x, x_scale ); + vec->y = FT_MulFix( vec->y, y_scale ); + } } } @@ -1067,19 +1129,24 @@ error = TT_Hint_Glyph( loader, 0 ); } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + Exit: + FT_FREE( unrounded ); +#endif + return error; } - /*************************************************************************/ - /* */ - /* */ - /* TT_Process_Composite_Component */ - /* */ - /* */ - /* Once a composite component has been loaded, it needs to be */ - /* processed. Usually, this means transforming and translating. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Process_Composite_Component + * + * @Description: + * Once a composite component has been loaded, it needs to be + * processed. Usually, this means transforming and translating. + */ static FT_Error TT_Process_Composite_Component( TT_Loader loader, FT_SubGlyph subglyph, @@ -1153,10 +1220,10 @@ #if 0 - /*******************************************************************/ - /* */ - /* This algorithm is what Apple documents. But it doesn't work. */ - /* */ + /******************************************************************** + * + * This algorithm is what Apple documents. But it doesn't work. + */ int a = subglyph->transform.xx > 0 ? subglyph->transform.xx : -subglyph->transform.xx; int b = subglyph->transform.yx > 0 ? subglyph->transform.yx @@ -1178,10 +1245,10 @@ #else /* 1 */ - /*******************************************************************/ - /* */ - /* This algorithm is a guess and works much better than the above. */ - /* */ + /******************************************************************** + * + * This algorithm is a guess and works much better than the above. + */ FT_Fixed mac_xscale = FT_Hypot( subglyph->transform.xx, subglyph->transform.xy ); FT_Fixed mac_yscale = FT_Hypot( subglyph->transform.yy, @@ -1239,16 +1306,16 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Process_Composite_Glyph */ - /* */ - /* */ - /* This is slightly different from TT_Process_Simple_Glyph, in that */ - /* its sole purpose is to hint the glyph. Thus this function is */ - /* only available when bytecode interpreter is enabled. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Process_Composite_Glyph + * + * @Description: + * This is slightly different from TT_Process_Simple_Glyph, in that + * its sole purpose is to hint the glyph. Thus this function is + * only available when bytecode interpreter is enabled. + */ static FT_Error TT_Process_Composite_Glyph( TT_Loader loader, FT_UInt start_point, @@ -1460,7 +1527,7 @@ } #endif - use_aw_2 = (FT_Bool)( subpixel_hinting && grayscale ); + use_aw_2 = FT_BOOL( subpixel_hinting && grayscale ); loader->pp1.x = loader->bbox.xMin - loader->left_bearing; loader->pp1.y = 0; @@ -1497,27 +1564,28 @@ } - /*************************************************************************/ - /* */ - /* */ - /* load_truetype_glyph */ - /* */ - /* */ - /* Loads a given truetype glyph. Handles composites and uses a */ - /* TT_Loader object. */ - /* */ + /************************************************************************** + * + * @Function: + * load_truetype_glyph + * + * @Description: + * Loads a given truetype glyph. Handles composites and uses a + * TT_Loader object. + */ static FT_Error load_truetype_glyph( TT_Loader loader, FT_UInt glyph_index, FT_UInt recurse_count, FT_Bool header_only ) { - FT_Error error = FT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Fixed x_scale, y_scale; FT_ULong offset; - TT_Face face = loader->face; - FT_GlyphLoader gloader = loader->gloader; - FT_Bool opened_frame = 0; + TT_Face face = loader->face; + FT_GlyphLoader gloader = loader->gloader; + + FT_Bool opened_frame = 0; #ifdef FT_CONFIG_OPTION_INCREMENTAL FT_StreamRec inc_stream; @@ -1550,15 +1618,15 @@ loader->glyph_index = glyph_index; - if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) + if ( loader->load_flags & FT_LOAD_NO_SCALE ) { - x_scale = loader->size->metrics->x_scale; - y_scale = loader->size->metrics->y_scale; + x_scale = 0x10000L; + y_scale = 0x10000L; } else { - x_scale = 0x10000L; - y_scale = 0x10000L; + x_scale = loader->size->metrics->x_scale; + y_scale = loader->size->metrics->y_scale; } /* Set `offset' to the start of the glyph relative to the start of */ @@ -1617,38 +1685,36 @@ if ( error ) goto Exit; - opened_frame = 1; - /* read glyph header first */ error = face->read_glyph_header( loader ); - if ( error ) - goto Exit; - /* the metrics must be computed after loading the glyph header */ - /* since we need the glyph's `yMax' value in case the vertical */ - /* metrics must be emulated */ - error = tt_get_metrics( loader, glyph_index ); - if ( error ) - goto Exit; + face->forget_glyph_frame( loader ); - if ( header_only ) + if ( error ) goto Exit; } + /* a space glyph */ if ( loader->byte_len == 0 || loader->n_contours == 0 ) { loader->bbox.xMin = 0; loader->bbox.xMax = 0; loader->bbox.yMin = 0; loader->bbox.yMax = 0; + } - error = tt_get_metrics( loader, glyph_index ); - if ( error ) - goto Exit; + /* the metrics must be computed after loading the glyph header */ + /* since we need the glyph's `yMax' value in case the vertical */ + /* metrics must be emulated */ + error = tt_get_metrics( loader, glyph_index ); + if ( error ) + goto Exit; - if ( header_only ) - goto Exit; + if ( header_only ) + goto Exit; + if ( loader->byte_len == 0 || loader->n_contours == 0 ) + { /* must initialize points before (possibly) overriding */ /* glyph metrics from the incremental interface */ tt_loader_set_pp( loader ); @@ -1669,6 +1735,9 @@ short contours[4] = { 0, 1, 2, 3 }; FT_Outline outline; + /* unrounded values */ + FT_Vector unrounded[4] = { {0, 0}, {0, 0}, {0, 0}, {0, 0} }; + points[0].x = loader->pp1.x; points[0].y = loader->pp1.y; @@ -1690,6 +1759,7 @@ error = TT_Vary_Apply_Glyph_Deltas( loader->face, glyph_index, &outline, + unrounded, (FT_UInt)outline.n_points ); if ( error ) goto Exit; @@ -1704,13 +1774,14 @@ loader->pp4.x = points[3].x; loader->pp4.y = points[3].y; - /* recalculate linear horizontal and vertical advances */ /* if we don't have HVAR and VVAR, respectively */ if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - loader->linear = loader->pp2.x - loader->pp1.x; + loader->linear = FT_PIX_ROUND( unrounded[1].x - + unrounded[0].x ) / 64; if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - loader->vadvance = loader->pp4.x - loader->pp3.x; + loader->vadvance = FT_PIX_ROUND( unrounded[3].x - + unrounded[2].x ) / 64; } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ @@ -1745,6 +1816,16 @@ /***********************************************************************/ /***********************************************************************/ + /* we now open a frame again, right after the glyph header */ + /* (which consists of 10 bytes) */ + error = face->access_glyph_frame( loader, glyph_index, + face->glyf_offset + offset + 10, + (FT_UInt)loader->byte_len - 10 ); + if ( error ) + goto Exit; + + opened_frame = 1; + /* if it is a simple glyph, load it */ if ( loader->n_contours > 0 ) @@ -1790,7 +1871,6 @@ * pointers with a width of at least 32 bits. */ - /* clear the nodes filled by sibling chains */ node = ft_list_get_node_at( &loader->composites, recurse_count ); for ( node2 = node; node2; node2 = node2->next ) @@ -1841,9 +1921,10 @@ FT_SubGlyph subglyph; FT_Outline outline; - FT_Vector* points = NULL; - char* tags = NULL; - short* contours = NULL; + FT_Vector* points = NULL; + char* tags = NULL; + short* contours = NULL; + FT_Vector* unrounded = NULL; limit = (short)gloader->current.num_subglyphs; @@ -1857,9 +1938,10 @@ outline.tags = NULL; outline.contours = NULL; - if ( FT_NEW_ARRAY( points, outline.n_points ) || - FT_NEW_ARRAY( tags, outline.n_points ) || - FT_NEW_ARRAY( contours, outline.n_points ) ) + if ( FT_NEW_ARRAY( points, outline.n_points ) || + FT_NEW_ARRAY( tags, outline.n_points ) || + FT_NEW_ARRAY( contours, outline.n_points ) || + FT_NEW_ARRAY( unrounded, outline.n_points ) ) goto Exit1; subglyph = gloader->current.subglyphs; @@ -1908,6 +1990,7 @@ face, glyph_index, &outline, + unrounded, (FT_UInt)outline.n_points ) ) ) goto Exit1; @@ -1935,14 +2018,19 @@ /* recalculate linear horizontal and vertical advances */ /* if we don't have HVAR and VVAR, respectively */ if ( !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - loader->linear = loader->pp2.x - loader->pp1.x; + loader->linear = + FT_PIX_ROUND( unrounded[outline.n_points - 3].x - + unrounded[outline.n_points - 4].x ) / 64; if ( !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - loader->vadvance = loader->pp4.x - loader->pp3.x; + loader->vadvance = + FT_PIX_ROUND( unrounded[outline.n_points - 1].x - + unrounded[outline.n_points - 2].x ) / 64; Exit1: FT_FREE( outline.points ); FT_FREE( outline.tags ); FT_FREE( outline.contours ); + FT_FREE( unrounded ); if ( error ) goto Exit; @@ -2002,7 +2090,7 @@ FT_Int linear_vadvance; - /* Each time we call load_truetype_glyph in this loop, the */ + /* Each time we call `load_truetype_glyph' in this loop, the */ /* value of `gloader.base.subglyphs' can change due to table */ /* reallocations. We thus need to recompute the subglyph */ /* pointer on each iteration. */ @@ -2045,12 +2133,14 @@ if ( num_points == num_base_points ) continue; - /* gloader->base.outline consists of three parts: */ - /* 0 -(1)-> start_point -(2)-> num_base_points -(3)-> n_points. */ - /* */ - /* (1): exists from the beginning */ - /* (2): components that have been loaded so far */ - /* (3): the newly loaded component */ + /* gloader->base.outline consists of three parts: */ + /* */ + /* 0 ----> start_point ----> num_base_points ----> n_points */ + /* (1) (2) (3) */ + /* */ + /* (1) points that exist from the beginning */ + /* (2) component points that have been loaded so far */ + /* (3) points of the newly loaded component */ error = TT_Process_Composite_Component( loader, subglyph, start_point, @@ -2066,6 +2156,7 @@ loader->ins_pos = ins_pos; if ( IS_HINTED( loader->load_flags ) && #ifdef TT_USE_BYTECODE_INTERPRETER + subglyph && subglyph->flags & WE_HAVE_INSTR && #endif num_points > start_point ) @@ -2132,7 +2223,7 @@ glyph->metrics.horiBearingX = bbox.xMin; glyph->metrics.horiBearingY = bbox.yMax; - glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; + glyph->metrics.horiAdvance = SUB_LONG(loader->pp2.x, loader->pp1.x); /* Adjust advance width to the value contained in the hdmx table */ /* unless FT_LOAD_COMPUTE_METRICS is set or backward compatibility */ @@ -2276,13 +2367,13 @@ /* XXX: for now, we have no better algorithm for the lsb, but it */ /* should work fine. */ /* */ - glyph->metrics.vertBearingX = glyph->metrics.horiBearingX - - glyph->metrics.horiAdvance / 2; + glyph->metrics.vertBearingX = SUB_LONG( glyph->metrics.horiBearingX, + glyph->metrics.horiAdvance / 2 ); glyph->metrics.vertBearingY = top; glyph->metrics.vertAdvance = advance; } - return 0; + return FT_Err_Ok; } @@ -2589,11 +2680,6 @@ if ( reexecute ) { - FT_UInt i; - - - for ( i = 0; i < size->cvt_size; i++ ) - size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); error = tt_size_run_prep( size, pedantic ); if ( error ) return error; @@ -2656,33 +2742,37 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Load_Glyph */ - /* */ - /* */ - /* A function used to load a single glyph within a given glyph slot, */ - /* for a given size. */ - /* */ - /* */ - /* glyph :: A handle to a target slot object where the glyph */ - /* will be loaded. */ - /* */ - /* size :: A handle to the source face size at which the glyph */ - /* must be scaled/loaded. */ - /* */ - /* glyph_index :: The index of the glyph in the font file. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* FT_LOAD_XXX constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Load_Glyph + * + * @Description: + * A function used to load a single glyph within a given glyph slot, + * for a given size. + * + * @Input: + * glyph :: + * A handle to a target slot object where the glyph + * will be loaded. + * + * size :: + * A handle to the source face size at which the glyph + * must be scaled/loaded. + * + * glyph_index :: + * The index of the glyph in the font file. + * + * load_flags :: + * A flag indicating what to load for this glyph. The + * FT_LOAD_XXX constants can be used to control the + * glyph loading process (e.g., whether the outline + * should be scaled, whether to load bitmaps or not, + * whether to hint the outline, etc). + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Load_Glyph( TT_Size size, TT_GlyphSlot glyph, @@ -2692,13 +2782,6 @@ FT_Error error; TT_LoaderRec loader; -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#define IS_DEFAULT_INSTANCE ( !( FT_IS_NAMED_INSTANCE( glyph->face ) || \ - FT_IS_VARIATION( glyph->face ) ) ) -#else -#define IS_DEFAULT_INSTANCE 1 -#endif - FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index )); @@ -2707,7 +2790,7 @@ /* try to load embedded bitmap (if any) */ if ( size->strike_index != 0xFFFFFFFFUL && ( load_flags & FT_LOAD_NO_BITMAP ) == 0 && - IS_DEFAULT_INSTANCE ) + IS_DEFAULT_INSTANCE( glyph->face ) ) { FT_Fixed x_scale = size->root.metrics.x_scale; FT_Fixed y_scale = size->root.metrics.y_scale; diff --git a/src/3rdparty/freetype/src/truetype/ttgload.h b/src/3rdparty/freetype/src/truetype/ttgload.h index d237cfd284..f1324bc862 100644 --- a/src/3rdparty/freetype/src/truetype/ttgload.h +++ b/src/3rdparty/freetype/src/truetype/ttgload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttgload.h */ -/* */ -/* TrueType Glyph Loader (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttgload.h + * + * TrueType Glyph Loader (specification). + * + * Copyright (C) 1996-2019 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 TTGLOAD_H_ diff --git a/src/3rdparty/freetype/src/truetype/ttgxvar.c b/src/3rdparty/freetype/src/truetype/ttgxvar.c index 29ab2a4efd..78d87dc097 100644 --- a/src/3rdparty/freetype/src/truetype/ttgxvar.c +++ b/src/3rdparty/freetype/src/truetype/ttgxvar.c @@ -1,42 +1,42 @@ -/***************************************************************************/ -/* */ -/* ttgxvar.c */ -/* */ -/* TrueType GX Font Variation loader */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Apple documents the `fvar', `gvar', `cvar', and `avar' tables at */ - /* */ - /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6[fgca]var.html */ - /* */ - /* The documentation for `gvar' is not intelligible; `cvar' refers you */ - /* to `gvar' and is thus also incomprehensible. */ - /* */ - /* The documentation for `avar' appears correct, but Apple has no fonts */ - /* with an `avar' table, so it is hard to test. */ - /* */ - /* Many thanks to John Jenkins (at Apple) in figuring this out. */ - /* */ - /* */ - /* Apple's `kern' table has some references to tuple indices, but as */ - /* there is no indication where these indices are defined, nor how to */ - /* interpolate the kerning values (different tuples have different */ - /* classes) this issue is ignored. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * ttgxvar.c + * + * TrueType GX Font Variation loader + * + * Copyright (C) 2004-2019 by + * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * Apple documents the `fvar', `gvar', `cvar', and `avar' tables at + * + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6[fgca]var.html + * + * The documentation for `gvar' is not intelligible; `cvar' refers you + * to `gvar' and is thus also incomprehensible. + * + * The documentation for `avar' appears correct, but Apple has no fonts + * with an `avar' table, so it is hard to test. + * + * Many thanks to John Jenkins (at Apple) in figuring this out. + * + * + * Apple's `kern' table has some references to tuple indices, but as + * there is no indication where these indices are defined, nor how to + * interpolate the kerning values (different tuples have different + * classes) this issue is ignored. + * + */ #include @@ -67,14 +67,27 @@ : (stream)->limit - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /* some macros we need */ +#define FT_fdot14ToFixed( x ) \ + ( (FT_Fixed)( (FT_ULong)(x) << 2 ) ) +#define FT_intToFixed( i ) \ + ( (FT_Fixed)( (FT_ULong)(i) << 16 ) ) +#define FT_fdot6ToFixed( i ) \ + ( (FT_Fixed)( (FT_ULong)(i) << 10 ) ) +#define FT_fixedToInt( x ) \ + ( (FT_Short)( ( (x) + 0x8000U ) >> 16 ) ) +#define FT_fixedToFdot6( x ) \ + ( (FT_Pos)( ( (x) + 0x200 ) >> 10 ) ) + + + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttgxvar +#define FT_COMPONENT ttgxvar /*************************************************************************/ @@ -86,12 +99,12 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* The macro ALL_POINTS is used in `ft_var_readpackedpoints'. It */ - /* indicates that there is a delta for every point without needing to */ - /* enumerate all of them. */ - /* */ + /************************************************************************** + * + * The macro ALL_POINTS is used in `ft_var_readpackedpoints'. It + * indicates that there is a delta for every point without needing to + * enumerate all of them. + */ /* ensure that value `0' has the same width as a pointer */ #define ALL_POINTS (FT_UShort*)~(FT_PtrDist)0 @@ -101,29 +114,32 @@ #define GX_PT_POINT_RUN_COUNT_MASK 0x7FU - /*************************************************************************/ - /* */ - /* */ - /* ft_var_readpackedpoints */ - /* */ - /* */ - /* Read a set of points to which the following deltas will apply. */ - /* Points are packed with a run length encoding. */ - /* */ - /* */ - /* stream :: The data stream. */ - /* */ - /* size :: The size of the table holding the data. */ - /* */ - /* */ - /* point_cnt :: The number of points read. A zero value means that */ - /* all points in the glyph will be affected, without */ - /* enumerating them individually. */ - /* */ - /* */ - /* An array of FT_UShort containing the affected points or the */ - /* special value ALL_POINTS. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_var_readpackedpoints + * + * @Description: + * Read a set of points to which the following deltas will apply. + * Points are packed with a run length encoding. + * + * @Input: + * stream :: + * The data stream. + * + * size :: + * The size of the table holding the data. + * + * @Output: + * point_cnt :: + * The number of points read. A zero value means that + * all points in the glyph will be affected, without + * enumerating them individually. + * + * @Return: + * An array of FT_UShort containing the affected points or the + * special value ALL_POINTS. + */ static FT_UShort* ft_var_readpackedpoints( FT_Stream stream, FT_ULong size, @@ -211,34 +227,41 @@ #define GX_DT_DELTA_RUN_COUNT_MASK 0x3FU - /*************************************************************************/ - /* */ - /* */ - /* ft_var_readpackeddeltas */ - /* */ - /* */ - /* Read a set of deltas. These are packed slightly differently than */ - /* points. In particular there is no overall count. */ - /* */ - /* */ - /* stream :: The data stream. */ - /* */ - /* size :: The size of the table holding the data. */ - /* */ - /* delta_cnt :: The number of deltas to be read. */ - /* */ - /* */ - /* An array of FT_Short containing the deltas for the affected */ - /* points. (This only gets the deltas for one dimension. It will */ - /* generally be called twice, once for x, once for y. When used in */ - /* cvt table, it will only be called once.) */ - /* */ - static FT_Short* + /************************************************************************** + * + * @Function: + * ft_var_readpackeddeltas + * + * @Description: + * Read a set of deltas. These are packed slightly differently than + * points. In particular there is no overall count. + * + * @Input: + * stream :: + * The data stream. + * + * size :: + * The size of the table holding the data. + * + * delta_cnt :: + * The number of deltas to be read. + * + * @Return: + * An array of FT_Fixed containing the deltas for the affected + * points. (This only gets the deltas for one dimension. It will + * generally be called twice, once for x, once for y. When used in + * cvt table, it will only be called once.) + * + * We use FT_Fixed to avoid accumulation errors while summing up all + * deltas (the rounding to integer values happens as the very last + * step). + */ + static FT_Fixed* ft_var_readpackeddeltas( FT_Stream stream, FT_ULong size, FT_UInt delta_cnt ) { - FT_Short *deltas = NULL; + FT_Fixed *deltas = NULL; FT_UInt runcnt, cnt; FT_UInt i, j; FT_Memory memory = stream->memory; @@ -272,13 +295,13 @@ { /* `runcnt' shorts from the stack */ for ( j = 0; j <= cnt && i < delta_cnt; j++ ) - deltas[i++] = FT_GET_SHORT(); + deltas[i++] = FT_intToFixed( FT_GET_SHORT() ); } else { /* `runcnt' signed bytes from the stack */ for ( j = 0; j <= cnt && i < delta_cnt; j++ ) - deltas[i++] = FT_GET_CHAR(); + deltas[i++] = FT_intToFixed( FT_GET_CHAR() ); } if ( j <= cnt ) @@ -293,18 +316,19 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ft_var_load_avar */ - /* */ - /* */ - /* Parse the `avar' table if present. It need not be, so we return */ - /* nothing. */ - /* */ - /* */ - /* face :: The font face. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_var_load_avar + * + * @Description: + * Parse the `avar' table if present. It need not be, so we return + * nothing. + * + * @InOut: + * face :: + * The font face. + */ static void ft_var_load_avar( TT_Face face ) { @@ -377,9 +401,10 @@ for ( j = 0; j < segment->pairCount; j++ ) { - /* convert to Fixed */ - segment->correspondence[j].fromCoord = FT_GET_SHORT() * 4; - segment->correspondence[j].toCoord = FT_GET_SHORT() * 4; + segment->correspondence[j].fromCoord = + FT_fdot14ToFixed( FT_GET_SHORT() ); + segment->correspondence[j].toCoord = + FT_fdot14ToFixed( FT_GET_SHORT() ); FT_TRACE5(( " mapping %.5f to %.5f\n", segment->correspondence[j].fromCoord / 65536.0, @@ -394,17 +419,6 @@ } - /* some macros we need */ -#define FT_FIXED_ONE ( (FT_Fixed)0x10000 ) - -#define FT_fdot14ToFixed( x ) \ - ( (FT_Fixed)( (FT_ULong)(x) << 2 ) ) -#define FT_intToFixed( i ) \ - ( (FT_Fixed)( (FT_ULong)(i) << 16 ) ) -#define FT_fixedToInt( x ) \ - ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) - - static FT_Error ft_var_load_item_variation_store( TT_Face face, FT_ULong offset, @@ -702,29 +716,30 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ft_var_load_hvvar */ - /* */ - /* */ - /* If `vertical' is zero, parse the `HVAR' table and set */ - /* `blend->hvar_loaded' to TRUE. On success, `blend->hvar_checked' */ - /* is set to TRUE. */ - /* */ - /* If `vertical' is not zero, parse the `VVAR' table and set */ - /* `blend->vvar_loaded' to TRUE. On success, `blend->vvar_checked' */ - /* is set to TRUE. */ - /* */ - /* Some memory may remain allocated on error; it is always freed in */ - /* `tt_done_blend', however. */ - /* */ - /* */ - /* face :: The font face. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_var_load_hvvar + * + * @Description: + * If `vertical' is zero, parse the `HVAR' table and set + * `blend->hvar_loaded' to TRUE. On success, `blend->hvar_checked' + * is set to TRUE. + * + * If `vertical' is not zero, parse the `VVAR' table and set + * `blend->vvar_loaded' to TRUE. On success, `blend->vvar_checked' + * is set to TRUE. + * + * Some memory may remain allocated on error; it is always freed in + * `tt_done_blend', however. + * + * @InOut: + * face :: + * The font face. + * + * @Return: + * FreeType error code. 0 means success. + */ static FT_Error ft_var_load_hvvar( TT_Face face, FT_Bool vertical ) @@ -872,7 +887,7 @@ /* outer loop steps through master designs to be blended */ for ( master = 0; master < varData->regionIdxCount; master++ ) { - FT_Fixed scalar = FT_FIXED_ONE; + FT_Fixed scalar = 0x10000L; FT_UInt regionIndex = varData->regionIndices[master]; GX_AxisCoords axis = itemStore->varRegionList[regionIndex].axisList; @@ -881,47 +896,43 @@ /* inner loop steps through axes in this region */ for ( j = 0; j < itemStore->axisCount; j++, axis++ ) { - FT_Fixed axisScalar; - - /* compute the scalar contribution of this axis; */ /* ignore invalid ranges */ if ( axis->startCoord > axis->peakCoord || axis->peakCoord > axis->endCoord ) - axisScalar = FT_FIXED_ONE; + continue; else if ( axis->startCoord < 0 && axis->endCoord > 0 && axis->peakCoord != 0 ) - axisScalar = FT_FIXED_ONE; + continue; /* peak of 0 means ignore this axis */ else if ( axis->peakCoord == 0 ) - axisScalar = FT_FIXED_ONE; + continue; - /* ignore this region if coords are out of range */ - else if ( face->blend->normalizedcoords[j] < axis->startCoord || - face->blend->normalizedcoords[j] > axis->endCoord ) - axisScalar = 0; + else if ( face->blend->normalizedcoords[j] == axis->peakCoord ) + continue; - /* calculate a proportional factor */ - else + /* ignore this region if coords are out of range */ + else if ( face->blend->normalizedcoords[j] <= axis->startCoord || + face->blend->normalizedcoords[j] >= axis->endCoord ) { - if ( face->blend->normalizedcoords[j] == axis->peakCoord ) - axisScalar = FT_FIXED_ONE; - else if ( face->blend->normalizedcoords[j] < axis->peakCoord ) - axisScalar = - FT_DivFix( face->blend->normalizedcoords[j] - axis->startCoord, - axis->peakCoord - axis->startCoord ); - else - axisScalar = - FT_DivFix( axis->endCoord - face->blend->normalizedcoords[j], - axis->endCoord - axis->peakCoord ); + scalar = 0; + break; } - /* take product of all the axis scalars */ - scalar = FT_MulFix( scalar, axisScalar ); - + /* cumulative product of all the axis scalars */ + else if ( face->blend->normalizedcoords[j] < axis->peakCoord ) + scalar = + FT_MulDiv( scalar, + face->blend->normalizedcoords[j] - axis->startCoord, + axis->peakCoord - axis->startCoord ); + else + scalar = + FT_MulDiv( scalar, + axis->endCoord - face->blend->normalizedcoords[j], + axis->endCoord - axis->peakCoord ); } /* per-axis loop */ /* get the scaled delta for this region */ @@ -937,25 +948,29 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_hvadvance_adjust */ - /* */ - /* */ - /* Apply `HVAR' advance width or `VVAR' advance height adjustment of */ - /* a given glyph. */ - /* */ - /* */ - /* gindex :: The glyph index. */ - /* */ - /* vertical :: If set, handle `VVAR' table. */ - /* */ - /* */ - /* face :: The font face. */ - /* */ - /* adelta :: Points to width or height value that gets modified. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_hvadvance_adjust + * + * @Description: + * Apply `HVAR' advance width or `VVAR' advance height adjustment of + * a given glyph. + * + * @Input: + * gindex :: + * The glyph index. + * + * vertical :: + * If set, handle `VVAR' table. + * + * @InOut: + * face :: + * The font face. + * + * adelta :: + * Points to width or height value that gets modified. + */ static FT_Error tt_hvadvance_adjust( TT_Face face, FT_UInt gindex, @@ -1151,20 +1166,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ft_var_load_mvar */ - /* */ - /* */ - /* Parse the `MVAR' table. */ - /* */ - /* Some memory may remain allocated on error; it is always freed in */ - /* `tt_done_blend', however. */ - /* */ - /* */ - /* face :: The font face. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_var_load_mvar + * + * @Description: + * Parse the `MVAR' table. + * + * Some memory may remain allocated on error; it is always freed in + * `tt_done_blend', however. + * + * @InOut: + * face :: + * The font face. + */ static void ft_var_load_mvar( TT_Face face ) { @@ -1297,22 +1313,26 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_apply_mvar */ - /* */ - /* */ - /* Apply `MVAR' table adjustments. */ - /* */ - /* */ - /* face :: The font face. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_apply_mvar + * + * @Description: + * Apply `MVAR' table adjustments. + * + * @InOut: + * face :: + * The font face. + */ FT_LOCAL_DEF( void ) tt_apply_mvar( TT_Face face ) { GX_Blend blend = face->blend; GX_Value value, limit; + FT_Short mvar_hasc_delta = 0; + FT_Short mvar_hdsc_delta = 0; + FT_Short mvar_hlgp_delta = 0; if ( !( face->variation_support & TT_FACE_FLAG_VAR_MVAR ) ) @@ -1347,6 +1367,14 @@ /* since we handle both signed and unsigned values as FT_Short, */ /* ensure proper overflow arithmetic */ *p = (FT_Short)( value->unmodified + (FT_Short)delta ); + + /* Treat hasc, hdsc and hlgp specially, see below. */ + if ( value->tag == MVAR_TAG_HASC ) + mvar_hasc_delta = (FT_Short)delta; + else if ( value->tag == MVAR_TAG_HDSC ) + mvar_hdsc_delta = (FT_Short)delta; + else if ( value->tag == MVAR_TAG_HLGP ) + mvar_hlgp_delta = (FT_Short)delta; } } @@ -1354,25 +1382,40 @@ { FT_Face root = &face->root; - - if ( face->os2.version != 0xFFFFU ) - { - if ( face->os2.sTypoAscender || face->os2.sTypoDescender ) - { - root->ascender = face->os2.sTypoAscender; - root->descender = face->os2.sTypoDescender; - - root->height = root->ascender - root->descender + - face->os2.sTypoLineGap; - } - else - { - root->ascender = (FT_Short)face->os2.usWinAscent; - root->descender = -(FT_Short)face->os2.usWinDescent; - - root->height = root->ascender - root->descender; - } - } + /* + * Apply the deltas of hasc, hdsc and hlgp to the FT_Face's ascender, + * descender and height attributes, no matter how they were originally + * computed. + * + * (Code that ignores those and accesses the font's metrics values + * directly is already served by the delta application code above.) + * + * The MVAR table supports variations for both typo and win metrics. + * According to Behdad Esfahbod, the thinking of the working group was + * that no one uses win metrics anymore for setting line metrics (the + * specification even calls these metrics "horizontal clipping + * ascent/descent", probably for their role on the Windows platform in + * computing clipping boxes), and new fonts should use typo metrics, so + * typo deltas should be applied to whatever sfnt_load_face decided the + * line metrics should be. + * + * Before, the following led to different line metrics between default + * outline and instances, visible when e.g. the default outlines were + * used as the regular face and instances for everything else: + * + * 1. sfnt_load_face applied the hhea metrics by default. + * 2. This code later applied the typo metrics by default, regardless of + * whether they were actually changed or the font had the OS/2 table's + * fsSelection's bit 7 (USE_TYPO_METRICS) set. + */ + FT_Short current_line_gap = root->height - root->ascender + + root->descender; + + + root->ascender = root->ascender + mvar_hasc_delta; + root->descender = root->descender + mvar_hdsc_delta; + root->height = root->ascender - root->descender + + current_line_gap + mvar_hlgp_delta; root->underline_position = face->postscript.underlinePosition - face->postscript.underlineThickness / 2; @@ -1400,21 +1443,22 @@ } GX_GVar_Head; - /*************************************************************************/ - /* */ - /* */ - /* ft_var_load_gvar */ - /* */ - /* */ - /* Parse the `gvar' table if present. If `fvar' is there, `gvar' had */ - /* better be there too. */ - /* */ - /* */ - /* face :: The font face. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_var_load_gvar + * + * @Description: + * Parse the `gvar' table if present. If `fvar' is there, `gvar' had + * better be there too. + * + * @InOut: + * face :: + * The font face. + * + * @Return: + * FreeType error code. 0 means success. + */ static FT_Error ft_var_load_gvar( TT_Face face ) { @@ -1512,28 +1556,55 @@ if ( gvar_head.flags & 1 ) { + FT_ULong limit = gvar_start + table_len; + + /* long offsets (one more offset than glyphs, to mark size of last) */ if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 4L ) ) goto Exit; for ( i = 0; i <= blend->gv_glyphcnt; i++ ) + { blend->glyphoffsets[i] = offsetToData + FT_GET_ULONG(); - - FT_FRAME_EXIT(); + /* use `>', not `>=' */ + if ( blend->glyphoffsets[i] > limit ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " invalid glyph variation data offset for index %d\n", + i )); + error = FT_THROW( Invalid_Table ); + break; + } + } } else { + FT_ULong limit = gvar_start + table_len; + + /* short offsets (one more offset than glyphs, to mark size of last) */ if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 2L ) ) goto Exit; for ( i = 0; i <= blend->gv_glyphcnt; i++ ) + { blend->glyphoffsets[i] = offsetToData + FT_GET_USHORT() * 2; - /* XXX: Undocumented: `*2'! */ - - FT_FRAME_EXIT(); + /* use `>', not `>=' */ + if ( blend->glyphoffsets[i] > limit ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " invalid glyph variation data offset for index %d\n", + i )); + error = FT_THROW( Invalid_Table ); + break; + } + } } + FT_FRAME_EXIT(); + if ( error ) + goto Exit; + if ( blend->tuplecount != 0 ) { if ( FT_NEW_ARRAY( blend->tuplecoords, @@ -1550,7 +1621,7 @@ for ( j = 0; j < (FT_UInt)gvar_head.axisCount; j++ ) { blend->tuplecoords[i * gvar_head.axisCount + j] = - FT_GET_SHORT() * 4; /* convert to FT_Fixed */ + FT_fdot14ToFixed( FT_GET_SHORT() ); FT_TRACE5(( "%.5f ", blend->tuplecoords[i * gvar_head.axisCount + j] / 65536.0 )); } @@ -1567,33 +1638,38 @@ } - /*************************************************************************/ - /* */ - /* */ - /* ft_var_apply_tuple */ - /* */ - /* */ - /* Figure out whether a given tuple (design) applies to the current */ - /* blend, and if so, what is the scaling factor. */ - /* */ - /* */ - /* blend :: The current blend of the font. */ - /* */ - /* tupleIndex :: A flag saying whether this is an intermediate */ - /* tuple or not. */ - /* */ - /* tuple_coords :: The coordinates of the tuple in normalized axis */ - /* units. */ - /* */ - /* im_start_coords :: The initial coordinates where this tuple starts */ - /* to apply (for intermediate coordinates). */ - /* */ - /* im_end_coords :: The final coordinates after which this tuple no */ - /* longer applies (for intermediate coordinates). */ - /* */ - /* */ - /* An FT_Fixed value containing the scaling factor. */ - /* */ + /************************************************************************** + * + * @Function: + * ft_var_apply_tuple + * + * @Description: + * Figure out whether a given tuple (design) applies to the current + * blend, and if so, what is the scaling factor. + * + * @Input: + * blend :: + * The current blend of the font. + * + * tupleIndex :: + * A flag saying whether this is an intermediate + * tuple or not. + * + * tuple_coords :: + * The coordinates of the tuple in normalized axis + * units. + * + * im_start_coords :: + * The initial coordinates where this tuple starts + * to apply (for intermediate coordinates). + * + * im_end_coords :: + * The final coordinates after which this tuple no + * longer applies (for intermediate coordinates). + * + * @Return: + * An FT_Fixed value containing the scaling factor. + */ static FT_Fixed ft_var_apply_tuple( GX_Blend blend, FT_UShort tupleIndex, @@ -1607,13 +1683,8 @@ for ( i = 0; i < blend->num_axis; i++ ) { - FT_TRACE6(( " axis coordinate %d (%.5f):\n", + FT_TRACE6(( " axis %d coordinate %.5f:\n", i, blend->normalizedcoords[i] / 65536.0 )); - if ( !( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) ) - FT_TRACE6(( " intermediate coordinates %d (%.5f, %.5f):\n", - i, - im_start_coords[i] / 65536.0, - im_end_coords[i] / 65536.0 )); /* It's not clear why (for intermediate tuples) we don't need */ /* to check against start/end -- the documentation says we don't. */ @@ -1622,7 +1693,7 @@ if ( tuple_coords[i] == 0 ) { - FT_TRACE6(( " tuple coordinate is zero, ignored\n", i )); + FT_TRACE6(( " tuple coordinate is zero, ignore\n", i )); continue; } @@ -1635,7 +1706,7 @@ if ( blend->normalizedcoords[i] == tuple_coords[i] ) { - FT_TRACE6(( " tuple coordinate value %.5f fits perfectly\n", + FT_TRACE6(( " tuple coordinate %.5f fits perfectly\n", tuple_coords[i] / 65536.0 )); /* `apply' does not change */ continue; @@ -1648,13 +1719,13 @@ if ( blend->normalizedcoords[i] < FT_MIN( 0, tuple_coords[i] ) || blend->normalizedcoords[i] > FT_MAX( 0, tuple_coords[i] ) ) { - FT_TRACE6(( " tuple coordinate value %.5f is exceeded, stop\n", + FT_TRACE6(( " tuple coordinate %.5f is exceeded, stop\n", tuple_coords[i] / 65536.0 )); apply = 0; break; } - FT_TRACE6(( " tuple coordinate value %.5f fits\n", + FT_TRACE6(( " tuple coordinate %.5f fits\n", tuple_coords[i] / 65536.0 )); apply = FT_MulDiv( apply, blend->normalizedcoords[i], @@ -1664,10 +1735,10 @@ { /* intermediate tuple */ - if ( blend->normalizedcoords[i] < im_start_coords[i] || - blend->normalizedcoords[i] > im_end_coords[i] ) + if ( blend->normalizedcoords[i] <= im_start_coords[i] || + blend->normalizedcoords[i] >= im_end_coords[i] ) { - FT_TRACE6(( " intermediate tuple range [%.5f;%.5f] is exceeded," + FT_TRACE6(( " intermediate tuple range ]%.5f;%.5f[ is exceeded," " stop\n", im_start_coords[i] / 65536.0, im_end_coords[i] / 65536.0 )); @@ -1675,25 +1746,17 @@ break; } - else if ( blend->normalizedcoords[i] < tuple_coords[i] ) - { - FT_TRACE6(( " intermediate tuple range [%.5f;%.5f] fits\n", - im_start_coords[i] / 65536.0, - im_end_coords[i] / 65536.0 )); + FT_TRACE6(( " intermediate tuple range ]%.5f;%.5f[ fits\n", + im_start_coords[i] / 65536.0, + im_end_coords[i] / 65536.0 )); + if ( blend->normalizedcoords[i] < tuple_coords[i] ) apply = FT_MulDiv( apply, blend->normalizedcoords[i] - im_start_coords[i], tuple_coords[i] - im_start_coords[i] ); - } - else - { - FT_TRACE6(( " intermediate tuple range [%.5f;%.5f] fits\n", - im_start_coords[i] / 65536.0, - im_end_coords[i] / 65536.0 )); apply = FT_MulDiv( apply, im_end_coords[i] - blend->normalizedcoords[i], im_end_coords[i] - tuple_coords[i] ); - } } } @@ -1756,11 +1819,11 @@ } if ( coord < a->def ) - normalized[i] = -FT_DivFix( coord - a->def, - a->minimum - a->def ); + normalized[i] = -FT_DivFix( SUB_LONG( coord, a->def ), + SUB_LONG( a->minimum, a->def ) ); else if ( coord > a->def ) - normalized[i] = FT_DivFix( coord - a->def, - a->maximum - a->def ); + normalized[i] = FT_DivFix( SUB_LONG( coord, a->def ), + SUB_LONG( a->maximum, a->def ) ); else normalized[i] = 0; } @@ -1910,27 +1973,29 @@ } GX_FVar_Axis; - /*************************************************************************/ - /* */ - /* */ - /* TT_Get_MM_Var */ - /* */ - /* */ - /* Check that the font's `fvar' table is valid, parse it, and return */ - /* those data. It also loads (and parses) the `MVAR' table, if */ - /* possible. */ - /* */ - /* */ - /* face :: The font face. */ - /* TT_Get_MM_Var initializes the blend structure. */ - /* */ - /* */ - /* master :: The `fvar' data (must be freed by caller). Can be NULL, */ - /* which makes this function simply load MM support. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Get_MM_Var + * + * @Description: + * Check that the font's `fvar' table is valid, parse it, and return + * those data. It also loads (and parses) the `MVAR' table, if + * possible. + * + * @InOut: + * face :: + * The font face. + * TT_Get_MM_Var initializes the blend structure. + * + * @Output: + * master :: + * The `fvar' data (must be freed by caller). Can be NULL, + * which makes this function simply load MM support. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Get_MM_Var( TT_Face face, FT_MM_Var* *master ) @@ -2507,11 +2572,14 @@ if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) { - FT_UInt idx = (FT_UInt)face->root.face_index >> 16; + FT_UInt instance_index = (FT_UInt)face->root.face_index >> 16; c = blend->normalizedcoords + i; - n = blend->normalized_stylecoords + idx * mmvar->num_axis + i; + n = blend->normalized_stylecoords + + ( instance_index - 1 ) * mmvar->num_axis + + i; + for ( j = i; j < mmvar->num_axis; j++, n++, c++ ) if ( *c != *n ) have_diff = 1; @@ -2526,7 +2594,11 @@ /* return value -1 indicates `no change' */ if ( !have_diff ) + { + face->doblend = TRUE; + return -1; + } for ( ; i < mmvar->num_axis; i++ ) { @@ -2590,31 +2662,34 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Set_MM_Blend */ - /* */ - /* */ - /* Set the blend (normalized) coordinates for this instance of the */ - /* font. Check that the `gvar' table is reasonable and does some */ - /* initial preparation. */ - /* */ - /* */ - /* face :: The font. */ - /* Initialize the blend structure with `gvar' data. */ - /* */ - /* */ - /* num_coords :: The number of available coordinates. If it is */ - /* larger than the number of axes, ignore the excess */ - /* values. If it is smaller than the number of axes, */ - /* use the default value (0) for the remaining axes. */ - /* */ - /* coords :: An array of `num_coords', each between [-1,1]. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Set_MM_Blend + * + * @Description: + * Set the blend (normalized) coordinates for this instance of the + * font. Check that the `gvar' table is reasonable and does some + * initial preparation. + * + * @InOut: + * face :: + * The font. + * Initialize the blend structure with `gvar' data. + * + * @Input: + * num_coords :: + * The number of available coordinates. If it is + * larger than the number of axes, ignore the excess + * values. If it is smaller than the number of axes, + * use the default value (0) for the remaining axes. + * + * coords :: + * An array of `num_coords', each between [-1,1]. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Set_MM_Blend( TT_Face face, FT_UInt num_coords, @@ -2636,29 +2711,32 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Get_MM_Blend */ - /* */ - /* */ - /* Get the blend (normalized) coordinates for this instance of the */ - /* font. */ - /* */ - /* */ - /* face :: The font. */ - /* Initialize the blend structure with `gvar' data. */ - /* */ - /* */ - /* num_coords :: The number of available coordinates. If it is */ - /* larger than the number of axes, set the excess */ - /* values to 0. */ - /* */ - /* coords :: An array of `num_coords', each between [-1,1]. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Get_MM_Blend + * + * @Description: + * Get the blend (normalized) coordinates for this instance of the + * font. + * + * @InOut: + * face :: + * The font. + * Initialize the blend structure with `gvar' data. + * + * @Input: + * num_coords :: + * The number of available coordinates. If it is + * larger than the number of axes, set the excess + * values to 0. + * + * coords :: + * An array of `num_coords', each between [-1,1]. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Get_MM_Blend( TT_Face face, FT_UInt num_coords, @@ -2712,31 +2790,34 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Set_Var_Design */ - /* */ - /* */ - /* Set the coordinates for the instance, measured in the user */ - /* coordinate system. Parse the `avar' table (if present) to convert */ - /* from user to normalized coordinates. */ - /* */ - /* */ - /* face :: The font face. */ - /* Initialize the blend struct with `gvar' data. */ - /* */ - /* */ - /* num_coords :: The number of available coordinates. If it is */ - /* larger than the number of axes, ignore the excess */ - /* values. If it is smaller than the number of axes, */ - /* use the default values for the remaining axes. */ - /* */ - /* coords :: A coordinate array with `num_coords' elements. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Set_Var_Design + * + * @Description: + * Set the coordinates for the instance, measured in the user + * coordinate system. Parse the `avar' table (if present) to convert + * from user to normalized coordinates. + * + * @InOut: + * face :: + * The font face. + * Initialize the blend struct with `gvar' data. + * + * @Input: + * num_coords :: + * The number of available coordinates. If it is + * larger than the number of axes, ignore the excess + * values. If it is smaller than the number of axes, + * use the default values for the remaining axes. + * + * coords :: + * A coordinate array with `num_coords' elements. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Set_Var_Design( TT_Face face, FT_UInt num_coords, @@ -2854,28 +2935,31 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Get_Var_Design */ - /* */ - /* */ - /* Get the design coordinates of the currently selected interpolated */ - /* font. */ - /* */ - /* */ - /* face :: A handle to the source face. */ - /* */ - /* num_coords :: The number of design coordinates to retrieve. If it */ - /* is larger than the number of axes, set the excess */ - /* values to~0. */ - /* */ - /* */ - /* coords :: The design coordinates array. */ - /* */ - /* */ - /* FreeType error code. 0~means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Get_Var_Design + * + * @Description: + * Get the design coordinates of the currently selected interpolated + * font. + * + * @Input: + * face :: + * A handle to the source face. + * + * num_coords :: + * The number of design coordinates to retrieve. If it + * is larger than the number of axes, set the excess + * values to~0. + * + * @Output: + * coords :: + * The design coordinates array. + * + * @Return: + * FreeType error code. 0~means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Get_Var_Design( TT_Face face, FT_UInt num_coords, @@ -2929,24 +3013,26 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Set_Named_Instance */ - /* */ - /* */ - /* Set the given named instance, also resetting any further */ - /* variation. */ - /* */ - /* */ - /* face :: A handle to the source face. */ - /* */ - /* instance_index :: The instance index, starting with value 1. */ - /* Value 0 indicates to not use an instance. */ - /* */ - /* */ - /* FreeType error code. 0~means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Set_Named_Instance + * + * @Description: + * Set the given named instance, also resetting any further + * variation. + * + * @Input: + * face :: + * A handle to the source face. + * + * instance_index :: + * The instance index, starting with value 1. + * Value 0 indicates to not use an instance. + * + * @Return: + * FreeType error code. 0~means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Set_Named_Instance( TT_Face face, FT_UInt instance_index ) @@ -2973,7 +3059,7 @@ if ( instance_index > num_instances ) goto Exit; - if ( instance_index > 0 && mmvar->namedstyle ) + if ( instance_index > 0 ) { FT_Memory memory = face->root.memory; SFNT_Service sfnt = (SFNT_Service)face->sfnt; @@ -2999,7 +3085,12 @@ mmvar->num_axis, named_style->coords ); if ( error ) + { + /* internal error code -1 means `no change' */ + if ( error == -1 ) + error = FT_Err_Ok; goto Exit; + } } else error = TT_Set_Var_Design( face, 0, NULL ); @@ -3022,48 +3113,77 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* tt_face_vary_cvt */ - /* */ - /* */ - /* Modify the loaded cvt table according to the `cvar' table and the */ - /* font's blend. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* Most errors are ignored. It is perfectly valid not to have a */ - /* `cvar' table even if there is a `gvar' and `fvar' table. */ - /* */ + static FT_Error + tt_cvt_ready_iterator( FT_ListNode node, + void* user ) + { + TT_Size size = (TT_Size)node->data; + + FT_UNUSED( user ); + + + size->cvt_ready = -1; + + return FT_Err_Ok; + } + + + /************************************************************************** + * + * @Function: + * tt_face_vary_cvt + * + * @Description: + * Modify the loaded cvt table according to the `cvar' table and the + * font's blend. + * + * @InOut: + * face :: + * A handle to the target face object. + * + * @Input: + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + * + * Most errors are ignored. It is perfectly valid not to have a + * `cvar' table even if there is a `gvar' and `fvar' table. + */ FT_LOCAL_DEF( FT_Error ) tt_face_vary_cvt( TT_Face face, FT_Stream stream ) { - FT_Error error; - FT_Memory memory = stream->memory; - FT_ULong table_start; - FT_ULong table_len; - FT_UInt tupleCount; - FT_ULong offsetToData; - FT_ULong here; - FT_UInt i, j; - FT_Fixed* tuple_coords = NULL; - FT_Fixed* im_start_coords = NULL; - FT_Fixed* im_end_coords = NULL; - GX_Blend blend = face->blend; - FT_UInt point_count, spoint_count = 0; + FT_Error error; + FT_Memory memory = stream->memory; + + FT_Face root = &face->root; + + FT_ULong table_start; + FT_ULong table_len; + + FT_UInt tupleCount; + FT_ULong offsetToData; + + FT_ULong here; + FT_UInt i, j; + + FT_Fixed* tuple_coords = NULL; + FT_Fixed* im_start_coords = NULL; + FT_Fixed* im_end_coords = NULL; + + GX_Blend blend = face->blend; + + FT_UInt point_count; + FT_UInt spoint_count = 0; + FT_UShort* sharedpoints = NULL; FT_UShort* localpoints = NULL; FT_UShort* points; - FT_Short* deltas; + + FT_Fixed* deltas = NULL; + FT_Fixed* cvt_deltas = NULL; FT_TRACE2(( "CVAR " )); @@ -3146,11 +3266,14 @@ } FT_TRACE5(( "cvar: there %s %d tuple%s:\n", - ( tupleCount & 0xFFF ) == 1 ? "is" : "are", - tupleCount & 0xFFF, - ( tupleCount & 0xFFF ) == 1 ? "" : "s" )); + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "is" : "are", + tupleCount & GX_TC_TUPLE_COUNT_MASK, + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" )); - for ( i = 0; i < ( tupleCount & 0xFFF ); i++ ) + if ( FT_NEW_ARRAY( cvt_deltas, face->cvt_size ) ) + goto FExit; + + for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); i++ ) { FT_UInt tupleDataSize; FT_UInt tupleIndex; @@ -3165,8 +3288,7 @@ if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) { for ( j = 0; j < blend->num_axis; j++ ) - tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */ - /* short frac to fixed */ + tuple_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); } else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount ) { @@ -3174,20 +3296,32 @@ " invalid tuple index\n" )); error = FT_THROW( Invalid_Table ); - goto Exit; + goto FExit; } else + { + if ( !blend->tuplecoords ) + { + FT_TRACE2(( "tt_face_vary_cvt:" + " no valid tuple coordinates available\n" )); + + error = FT_THROW( Invalid_Table ); + goto FExit; + } + FT_MEM_COPY( tuple_coords, - &blend->tuplecoords[( tupleIndex & 0xFFF ) * blend->num_axis], + blend->tuplecoords + + ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis, blend->num_axis * sizeof ( FT_Fixed ) ); + } if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) { for ( j = 0; j < blend->num_axis; j++ ) - im_start_coords[j] = FT_GET_SHORT() * 4; + im_start_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); for ( j = 0; j < blend->num_axis; j++ ) - im_end_coords[j] = FT_GET_SHORT() * 4; + im_end_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); } apply = ft_var_apply_tuple( blend, @@ -3241,17 +3375,21 @@ /* this means that there are deltas for every entry in cvt */ for ( j = 0; j < face->cvt_size; j++ ) { - FT_Long orig_cvt = face->cvt[j]; + FT_Fixed old_cvt_delta; - face->cvt[j] = (FT_Short)( orig_cvt + - FT_MulFix( deltas[j], apply ) ); + old_cvt_delta = cvt_deltas[j]; + cvt_deltas[j] = old_cvt_delta + FT_MulFix( deltas[j], apply ); #ifdef FT_DEBUG_LEVEL_TRACE - if ( orig_cvt != face->cvt[j] ) + if ( old_cvt_delta != cvt_deltas[j] ) { - FT_TRACE7(( " %d: %d -> %d\n", - j, orig_cvt, face->cvt[j] )); + FT_TRACE7(( " %d: %f -> %f\n", + j, + ( FT_fdot6ToFixed( face->cvt[j] ) + + old_cvt_delta ) / 65536.0, + ( FT_fdot6ToFixed( face->cvt[j] ) + + cvt_deltas[j] ) / 65536.0 )); count++; } #endif @@ -3274,23 +3412,26 @@ for ( j = 0; j < point_count; j++ ) { - int pindex; - FT_Long orig_cvt; + int pindex; + FT_Fixed old_cvt_delta; pindex = points[j]; if ( (FT_ULong)pindex >= face->cvt_size ) continue; - orig_cvt = face->cvt[pindex]; - face->cvt[pindex] = (FT_Short)( orig_cvt + - FT_MulFix( deltas[j], apply ) ); + old_cvt_delta = cvt_deltas[pindex]; + cvt_deltas[pindex] = old_cvt_delta + FT_MulFix( deltas[j], apply ); #ifdef FT_DEBUG_LEVEL_TRACE - if ( orig_cvt != face->cvt[pindex] ) + if ( old_cvt_delta != cvt_deltas[pindex] ) { - FT_TRACE7(( " %d: %d -> %d\n", - pindex, orig_cvt, face->cvt[pindex] )); + FT_TRACE7(( " %d: %f -> %f\n", + pindex, + ( FT_fdot6ToFixed( face->cvt[pindex] ) + + old_cvt_delta ) / 65536.0, + ( FT_fdot6ToFixed( face->cvt[pindex] ) + + cvt_deltas[pindex] ) / 65536.0 )); count++; } #endif @@ -3313,6 +3454,9 @@ FT_TRACE5(( "\n" )); + for ( i = 0; i < face->cvt_size; i++ ) + face->cvt[i] += FT_fixedToFdot6( cvt_deltas[i] ); + FExit: FT_FRAME_EXIT(); @@ -3322,6 +3466,13 @@ FT_FREE( tuple_coords ); FT_FREE( im_start_coords ); FT_FREE( im_end_coords ); + FT_FREE( cvt_deltas ); + + /* iterate over all FT_Size objects and set `cvt_ready' to -1 */ + /* to trigger rescaling of all CVT values */ + FT_List_Iterate( &root->sizes_list, + tt_cvt_ready_iterator, + NULL ); return error; } @@ -3367,9 +3518,8 @@ /* between `p1' and `p2', using `ref1' and `ref2' as the reference */ /* point indices. */ - /* modeled after `af_iup_interp', `_iup_worker_interpolate', and */ - /* `Ins_IUP' */ - + /* modeled after `af_iup_interp', `_iup_worker_interpolate', and */ + /* `Ins_IUP' with spec differences in handling ill-defined cases. */ static void tt_delta_interpolate( int p1, int p2, @@ -3528,61 +3678,89 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Vary_Apply_Glyph_Deltas */ - /* */ - /* */ - /* Apply the appropriate deltas to the current glyph. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* glyph_index :: The index of the glyph being modified. */ - /* */ - /* n_points :: The number of the points in the glyph, including */ - /* phantom points. */ - /* */ - /* */ - /* outline :: The outline to change. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Vary_Apply_Glyph_Deltas + * + * @Description: + * Apply the appropriate deltas to the current glyph. + * + * @Input: + * face :: + * A handle to the target face object. + * + * glyph_index :: + * The index of the glyph being modified. + * + * n_points :: + * The number of the points in the glyph, including + * phantom points. + * + * @InOut: + * outline :: + * The outline to change. + * + * @Output: + * unrounded :: + * An array with `n_points' elements that is filled with unrounded + * point coordinates (in 26.6 format). + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Vary_Apply_Glyph_Deltas( TT_Face face, FT_UInt glyph_index, FT_Outline* outline, + FT_Vector* unrounded, FT_UInt n_points ) { - FT_Stream stream = face->root.stream; - FT_Memory memory = stream->memory; - GX_Blend blend = face->blend; + FT_Error error; + FT_Stream stream = face->root.stream; + FT_Memory memory = stream->memory; - FT_Vector* points_org = NULL; - FT_Vector* points_out = NULL; + FT_Vector* points_org = NULL; /* coordinates in 16.16 format */ + FT_Vector* points_out = NULL; /* coordinates in 16.16 format */ FT_Bool* has_delta = NULL; - FT_Error error; - FT_ULong glyph_start; - FT_UInt tupleCount; - FT_ULong offsetToData; - FT_ULong here; - FT_UInt i, j; - FT_Fixed* tuple_coords = NULL; - FT_Fixed* im_start_coords = NULL; - FT_Fixed* im_end_coords = NULL; - FT_UInt point_count, spoint_count = 0; + FT_ULong glyph_start; + + FT_UInt tupleCount; + FT_ULong offsetToData; + FT_ULong dataSize; + + FT_ULong here; + FT_UInt i, j; + + FT_Fixed* tuple_coords = NULL; + FT_Fixed* im_start_coords = NULL; + FT_Fixed* im_end_coords = NULL; + + GX_Blend blend = face->blend; + + FT_UInt point_count; + FT_UInt spoint_count = 0; + FT_UShort* sharedpoints = NULL; FT_UShort* localpoints = NULL; FT_UShort* points; - FT_Short *deltas_x, *deltas_y; + + FT_Fixed* deltas_x = NULL; + FT_Fixed* deltas_y = NULL; + FT_Fixed* point_deltas_x = NULL; + FT_Fixed* point_deltas_y = NULL; if ( !face->doblend || !blend ) return FT_THROW( Invalid_Argument ); + for ( i = 0; i < n_points; i++ ) + { + unrounded[i].x = INT_TO_F26DOT6( outline->points[i].x ); + unrounded[i].y = INT_TO_F26DOT6( outline->points[i].y ); + } + if ( glyph_index >= blend->gv_glyphcnt || blend->glyphoffsets[glyph_index] == blend->glyphoffsets[glyph_index + 1] ) @@ -3597,9 +3775,11 @@ FT_NEW_ARRAY( has_delta, n_points ) ) goto Fail1; - if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) || - FT_FRAME_ENTER( blend->glyphoffsets[glyph_index + 1] - - blend->glyphoffsets[glyph_index] ) ) + dataSize = blend->glyphoffsets[glyph_index + 1] - + blend->glyphoffsets[glyph_index]; + + if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) || + FT_FRAME_ENTER( dataSize ) ) goto Fail1; glyph_start = FT_Stream_FTell( stream ); @@ -3615,8 +3795,8 @@ offsetToData = FT_GET_USHORT(); /* rough sanity test */ - if ( offsetToData + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) * 4 > - blend->gvar_size ) + if ( offsetToData > dataSize || + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) * 4 > dataSize ) { FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:" " invalid glyph variation array header\n" )); @@ -3646,8 +3826,15 @@ tupleCount & GX_TC_TUPLE_COUNT_MASK, ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" )); + if ( FT_NEW_ARRAY( point_deltas_x, n_points ) || + FT_NEW_ARRAY( point_deltas_y, n_points ) ) + goto Fail3; + for ( j = 0; j < n_points; j++ ) - points_org[j] = outline->points[j]; + { + points_org[j].x = FT_intToFixed( outline->points[j].x ); + points_org[j].y = FT_intToFixed( outline->points[j].y ); + } for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); i++ ) { @@ -3664,8 +3851,7 @@ if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) { for ( j = 0; j < blend->num_axis; j++ ) - tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */ - /* short frac to fixed */ + tuple_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); } else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount ) { @@ -3673,20 +3859,21 @@ " invalid tuple index\n" )); error = FT_THROW( Invalid_Table ); - goto Fail2; + goto Fail3; } else FT_MEM_COPY( tuple_coords, - &blend->tuplecoords[( tupleIndex & 0xFFF ) * blend->num_axis], + blend->tuplecoords + + ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis, blend->num_axis * sizeof ( FT_Fixed ) ); if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) { for ( j = 0; j < blend->num_axis; j++ ) - im_start_coords[j] = FT_GET_SHORT() * 4; + im_start_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); for ( j = 0; j < blend->num_axis; j++ ) - im_end_coords[j] = FT_GET_SHORT() * 4; + im_end_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); } apply = ft_var_apply_tuple( blend, @@ -3742,14 +3929,17 @@ /* this means that there are deltas for every point in the glyph */ for ( j = 0; j < n_points; j++ ) { - FT_Pos delta_x = FT_MulFix( deltas_x[j], apply ); - FT_Pos delta_y = FT_MulFix( deltas_y[j], apply ); + FT_Fixed old_point_delta_x = point_deltas_x[j]; + FT_Fixed old_point_delta_y = point_deltas_y[j]; + + FT_Fixed point_delta_x = FT_MulFix( deltas_x[j], apply ); + FT_Fixed point_delta_y = FT_MulFix( deltas_y[j], apply ); if ( j < n_points - 4 ) { - outline->points[j].x += delta_x; - outline->points[j].y += delta_y; + point_deltas_x[j] = old_point_delta_x + point_delta_x; + point_deltas_y[j] = old_point_delta_y + point_delta_y; } else { @@ -3759,33 +3949,37 @@ if ( j == ( n_points - 4 ) && !( face->variation_support & TT_FACE_FLAG_VAR_LSB ) ) - outline->points[j].x += delta_x; + point_deltas_x[j] = old_point_delta_x + point_delta_x; else if ( j == ( n_points - 3 ) && !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - outline->points[j].x += delta_x; + point_deltas_x[j] = old_point_delta_x + point_delta_x; else if ( j == ( n_points - 2 ) && !( face->variation_support & TT_FACE_FLAG_VAR_TSB ) ) - outline->points[j].y += delta_y; + point_deltas_y[j] = old_point_delta_y + point_delta_y; else if ( j == ( n_points - 1 ) && !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - outline->points[j].y += delta_y; + point_deltas_y[j] = old_point_delta_y + point_delta_y; } #ifdef FT_DEBUG_LEVEL_TRACE - if ( delta_x || delta_y ) + if ( point_delta_x || point_delta_y ) { - FT_TRACE7(( " %d: (%d, %d) -> (%d, %d)\n", + FT_TRACE7(( " %d: (%f, %f) -> (%f, %f)\n", j, - outline->points[j].x - delta_x, - outline->points[j].y - delta_y, - outline->points[j].x, - outline->points[j].y )); + ( FT_intToFixed( outline->points[j].x ) + + old_point_delta_x ) / 65536.0, + ( FT_intToFixed( outline->points[j].y ) + + old_point_delta_y ) / 65536.0, + ( FT_intToFixed( outline->points[j].x ) + + point_deltas_x[j] ) / 65536.0, + ( FT_intToFixed( outline->points[j].y ) + + point_deltas_y[j] ) / 65536.0 )); count++; } #endif @@ -3837,14 +4031,17 @@ for ( j = 0; j < n_points; j++ ) { - FT_Pos delta_x = points_out[j].x - points_org[j].x; - FT_Pos delta_y = points_out[j].y - points_org[j].y; + FT_Fixed old_point_delta_x = point_deltas_x[j]; + FT_Fixed old_point_delta_y = point_deltas_y[j]; + + FT_Pos point_delta_x = points_out[j].x - points_org[j].x; + FT_Pos point_delta_y = points_out[j].y - points_org[j].y; if ( j < n_points - 4 ) { - outline->points[j].x += delta_x; - outline->points[j].y += delta_y; + point_deltas_x[j] = old_point_delta_x + point_delta_x; + point_deltas_y[j] = old_point_delta_y + point_delta_y; } else { @@ -3854,33 +4051,37 @@ if ( j == ( n_points - 4 ) && !( face->variation_support & TT_FACE_FLAG_VAR_LSB ) ) - outline->points[j].x += delta_x; + point_deltas_x[j] = old_point_delta_x + point_delta_x; else if ( j == ( n_points - 3 ) && !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - outline->points[j].x += delta_x; + point_deltas_x[j] = old_point_delta_x + point_delta_x; else if ( j == ( n_points - 2 ) && !( face->variation_support & TT_FACE_FLAG_VAR_TSB ) ) - outline->points[j].y += delta_y; + point_deltas_y[j] = old_point_delta_y + point_delta_y; else if ( j == ( n_points - 1 ) && !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - outline->points[j].y += delta_y; + point_deltas_y[j] = old_point_delta_y + point_delta_y; } #ifdef FT_DEBUG_LEVEL_TRACE - if ( delta_x || delta_y ) + if ( point_delta_x || point_delta_y ) { - FT_TRACE7(( " %d: (%d, %d) -> (%d, %d)\n", + FT_TRACE7(( " %d: (%f, %f) -> (%f, %f)\n", j, - outline->points[j].x - delta_x, - outline->points[j].y - delta_y, - outline->points[j].x, - outline->points[j].y )); + ( FT_intToFixed( outline->points[j].x ) + + old_point_delta_x ) / 65536.0, + ( FT_intToFixed( outline->points[j].y ) + + old_point_delta_y ) / 65536.0, + ( FT_intToFixed( outline->points[j].x ) + + point_deltas_x[j] ) / 65536.0, + ( FT_intToFixed( outline->points[j].y ) + + point_deltas_y[j] ) / 65536.0 )); count++; } #endif @@ -3904,6 +4105,19 @@ FT_TRACE5(( "\n" )); + for ( i = 0; i < n_points; i++ ) + { + unrounded[i].x += FT_fixedToFdot6( point_deltas_x[i] ); + unrounded[i].y += FT_fixedToFdot6( point_deltas_y[i] ); + + outline->points[i].x += FT_fixedToInt( point_deltas_x[i] ); + outline->points[i].y += FT_fixedToInt( point_deltas_y[i] ); + } + + Fail3: + FT_FREE( point_deltas_x ); + FT_FREE( point_deltas_y ); + Fail2: if ( sharedpoints != ALL_POINTS ) FT_FREE( sharedpoints ); @@ -3922,16 +4136,16 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_get_var_blend */ - /* */ - /* */ - /* An extended internal version of `TT_Get_MM_Blend' that returns */ - /* pointers instead of copying data, without any initialization of */ - /* the MM machinery in case it isn't loaded yet. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_get_var_blend + * + * @Description: + * An extended internal version of `TT_Get_MM_Blend' that returns + * pointers instead of copying data, without any initialization of + * the MM machinery in case it isn't loaded yet. + */ FT_LOCAL_DEF( FT_Error ) tt_get_var_blend( TT_Face face, FT_UInt *num_coords, @@ -3993,14 +4207,14 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_done_blend */ - /* */ - /* */ - /* Free the blend internal data structure. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_done_blend + * + * @Description: + * Free the blend internal data structure. + */ FT_LOCAL_DEF( void ) tt_done_blend( TT_Face face ) { diff --git a/src/3rdparty/freetype/src/truetype/ttgxvar.h b/src/3rdparty/freetype/src/truetype/ttgxvar.h index a37bb90266..07c99b6403 100644 --- a/src/3rdparty/freetype/src/truetype/ttgxvar.h +++ b/src/3rdparty/freetype/src/truetype/ttgxvar.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttgxvar.h */ -/* */ -/* TrueType GX Font Variation loader (specification) */ -/* */ -/* Copyright 2004-2018 by */ -/* David Turner, Robert Wilhelm, Werner Lemberg and George Williams. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttgxvar.h + * + * TrueType GX Font Variation loader (specification) + * + * Copyright (C) 2004-2019 by + * David Turner, Robert Wilhelm, Werner Lemberg and George Williams. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef TTGXVAR_H_ @@ -29,15 +29,15 @@ FT_BEGIN_HEADER #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /*************************************************************************/ - /* */ - /* */ - /* GX_AVarCorrespondenceRec */ - /* */ - /* */ - /* A data structure representing `shortFracCorrespondence' in `avar' */ - /* table according to the specifications from Apple. */ - /* */ + /************************************************************************** + * + * @Struct: + * GX_AVarCorrespondenceRec + * + * @Description: + * A data structure representing `shortFracCorrespondence' in `avar' + * table according to the specifications from Apple. + */ typedef struct GX_AVarCorrespondenceRec_ { FT_Fixed fromCoord; @@ -46,15 +46,15 @@ FT_BEGIN_HEADER } GX_AVarCorrespondenceRec_, *GX_AVarCorrespondence; - /*************************************************************************/ - /* */ - /* */ - /* GX_AVarRec */ - /* */ - /* */ - /* Data from the segment field of `avar' table. */ - /* There is one of these for each axis. */ - /* */ + /************************************************************************** + * + * @Struct: + * GX_AVarRec + * + * @Description: + * Data from the segment field of `avar' table. + * There is one of these for each axis. + */ typedef struct GX_AVarSegmentRec_ { FT_UShort pairCount; @@ -114,14 +114,14 @@ FT_BEGIN_HEADER } GX_DeltaSetIdxMapRec, *GX_DeltaSetIdxMap; - /*************************************************************************/ - /* */ - /* */ - /* GX_HVVarTableRec */ - /* */ - /* */ - /* Data from either the `HVAR' or `VVAR' table. */ - /* */ + /************************************************************************** + * + * @Struct: + * GX_HVVarTableRec + * + * @Description: + * Data from either the `HVAR' or `VVAR' table. + */ typedef struct GX_HVVarTableRec_ { GX_ItemVarStoreRec itemStore; /* Item Variation Store */ @@ -191,14 +191,14 @@ FT_BEGIN_HEADER } GX_ValueRec, *GX_Value; - /*************************************************************************/ - /* */ - /* */ - /* GX_MVarTableRec */ - /* */ - /* */ - /* Data from the `MVAR' table. */ - /* */ + /************************************************************************** + * + * @Struct: + * GX_MVarTableRec + * + * @Description: + * Data from the `MVAR' table. + */ typedef struct GX_MVarTableRec_ { FT_UShort valueCount; @@ -209,95 +209,95 @@ FT_BEGIN_HEADER } GX_MVarTableRec, *GX_MVarTable; - /*************************************************************************/ - /* */ - /* */ - /* GX_BlendRec */ - /* */ - /* */ - /* Data for interpolating a font from a distortable font specified */ - /* by the GX *var tables ([fgcahvm]var). */ - /* */ - /* */ - /* num_axis :: */ - /* The number of axes along which interpolation may happen. */ - /* */ - /* coords :: */ - /* An array of design coordinates (in user space) indicating the */ - /* contribution along each axis to the final interpolated font. */ - /* `normalizedcoords' holds the same values. */ - /* */ - /* normalizedcoords :: */ - /* An array of normalized values (between [-1,1]) indicating the */ - /* contribution along each axis to the final interpolated font. */ - /* `coords' holds the same values. */ - /* */ - /* mmvar :: */ - /* Data from the `fvar' table. */ - /* */ - /* mmvar_len :: */ - /* The length of the `mmvar' structure. */ - /* */ - /* normalized_stylecoords :: */ - /* A two-dimensional array that holds the named instance data from */ - /* `mmvar' as normalized values. */ - /* */ - /* avar_loaded :: */ - /* A Boolean; if set, FreeType tried to load (and parse) the `avar' */ - /* table. */ - /* */ - /* avar_segment :: */ - /* Data from the `avar' table. */ - /* */ - /* hvar_loaded :: */ - /* A Boolean; if set, FreeType tried to load (and parse) the `hvar' */ - /* table. */ - /* */ - /* hvar_checked :: */ - /* A Boolean; if set, FreeType successfully loaded and parsed the */ - /* `hvar' table. */ - /* */ - /* hvar_error :: */ - /* If loading and parsing of the `hvar' table failed, this field */ - /* holds the corresponding error code. */ - /* */ - /* hvar_table :: */ - /* Data from the `hvar' table. */ - /* */ - /* vvar_loaded :: */ - /* A Boolean; if set, FreeType tried to load (and parse) the `vvar' */ - /* table. */ - /* */ - /* vvar_checked :: */ - /* A Boolean; if set, FreeType successfully loaded and parsed the */ - /* `vvar' table. */ - /* */ - /* vvar_error :: */ - /* If loading and parsing of the `vvar' table failed, this field */ - /* holds the corresponding error code. */ - /* */ - /* vvar_table :: */ - /* Data from the `vvar' table. */ - /* */ - /* mvar_table :: */ - /* Data from the `mvar' table. */ - /* */ - /* tuplecount :: */ - /* The number of shared tuples in the `gvar' table. */ - /* */ - /* tuplecoords :: */ - /* A two-dimensional array that holds the shared tuple coordinates */ - /* in the `gvar' table. */ - /* */ - /* gv_glyphcnt :: */ - /* The number of glyphs handled in the `gvar' table. */ - /* */ - /* glyphoffsets :: */ - /* Offsets into the glyph variation data array. */ - /* */ - /* gvar_size :: */ - /* The size of the `gvar' table. */ - /* */ + /************************************************************************** + * + * @Struct: + * GX_BlendRec + * + * @Description: + * Data for interpolating a font from a distortable font specified + * by the GX *var tables ([fgcahvm]var). + * + * @Fields: + * num_axis :: + * The number of axes along which interpolation may happen. + * + * coords :: + * An array of design coordinates (in user space) indicating the + * contribution along each axis to the final interpolated font. + * `normalizedcoords' holds the same values. + * + * normalizedcoords :: + * An array of normalized values (between [-1,1]) indicating the + * contribution along each axis to the final interpolated font. + * `coords' holds the same values. + * + * mmvar :: + * Data from the `fvar' table. + * + * mmvar_len :: + * The length of the `mmvar' structure. + * + * normalized_stylecoords :: + * A two-dimensional array that holds the named instance data from + * `mmvar' as normalized values. + * + * avar_loaded :: + * A Boolean; if set, FreeType tried to load (and parse) the `avar' + * table. + * + * avar_segment :: + * Data from the `avar' table. + * + * hvar_loaded :: + * A Boolean; if set, FreeType tried to load (and parse) the `hvar' + * table. + * + * hvar_checked :: + * A Boolean; if set, FreeType successfully loaded and parsed the + * `hvar' table. + * + * hvar_error :: + * If loading and parsing of the `hvar' table failed, this field + * holds the corresponding error code. + * + * hvar_table :: + * Data from the `hvar' table. + * + * vvar_loaded :: + * A Boolean; if set, FreeType tried to load (and parse) the `vvar' + * table. + * + * vvar_checked :: + * A Boolean; if set, FreeType successfully loaded and parsed the + * `vvar' table. + * + * vvar_error :: + * If loading and parsing of the `vvar' table failed, this field + * holds the corresponding error code. + * + * vvar_table :: + * Data from the `vvar' table. + * + * mvar_table :: + * Data from the `mvar' table. + * + * tuplecount :: + * The number of shared tuples in the `gvar' table. + * + * tuplecoords :: + * A two-dimensional array that holds the shared tuple coordinates + * in the `gvar' table. + * + * gv_glyphcnt :: + * The number of glyphs handled in the `gvar' table. + * + * glyphoffsets :: + * Offsets into the glyph variation data array. + * + * gvar_size :: + * The size of the `gvar' table. + */ typedef struct GX_BlendRec_ { FT_UInt num_axis; @@ -336,14 +336,14 @@ FT_BEGIN_HEADER } GX_BlendRec; - /*************************************************************************/ - /* */ - /* */ - /* GX_TupleCountFlags */ - /* */ - /* */ - /* Flags used within the `TupleCount' field of the `gvar' table. */ - /* */ + /************************************************************************** + * + * @enum: + * GX_TupleCountFlags + * + * @Description: + * Flags used within the `TupleCount' field of the `gvar' table. + */ typedef enum GX_TupleCountFlags_ { GX_TC_TUPLES_SHARE_POINT_NUMBERS = 0x8000, @@ -353,15 +353,15 @@ FT_BEGIN_HEADER } GX_TupleCountFlags; - /*************************************************************************/ - /* */ - /* */ - /* GX_TupleIndexFlags */ - /* */ - /* */ - /* Flags used within the `TupleIndex' field of the `gvar' and `cvar' */ - /* tables. */ - /* */ + /************************************************************************** + * + * @enum: + * GX_TupleIndexFlags + * + * @Description: + * Flags used within the `TupleIndex' field of the `gvar' and `cvar' + * tables. + */ typedef enum GX_TupleIndexFlags_ { GX_TI_EMBEDDED_TUPLE_COORD = 0x8000, @@ -416,6 +416,7 @@ FT_BEGIN_HEADER TT_Vary_Apply_Glyph_Deltas( TT_Face face, FT_UInt glyph_index, FT_Outline* outline, + FT_Vector* unrounded, FT_UInt n_points ); FT_LOCAL( FT_Error ) diff --git a/src/3rdparty/freetype/src/truetype/ttinterp.c b/src/3rdparty/freetype/src/truetype/ttinterp.c index da9b595aba..70434e1729 100644 --- a/src/3rdparty/freetype/src/truetype/ttinterp.c +++ b/src/3rdparty/freetype/src/truetype/ttinterp.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttinterp.c */ -/* */ -/* TrueType bytecode interpreter (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttinterp.c + * + * TrueType bytecode interpreter (body). + * + * Copyright (C) 1996-2019 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. + * + */ /* Greg Hitchcock from Microsoft has helped a lot in resolving unclear */ @@ -39,14 +39,14 @@ #ifdef TT_USE_BYTECODE_INTERPRETER - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttinterp +#define FT_COMPONENT ttinterp #define NO_SUBPIXEL_HINTING \ @@ -82,10 +82,10 @@ exc->func_dualproj( exc, (v)->x, (v)->y ) - /*************************************************************************/ - /* */ - /* Two simple bounds-checking macros. */ - /* */ + /************************************************************************** + * + * Two simple bounds-checking macros. + */ #define BOUNDS( x, n ) ( (FT_UInt)(x) >= (FT_UInt)(n) ) #define BOUNDSL( x, n ) ( (FT_ULong)(x) >= (FT_ULong)(n) ) @@ -97,30 +97,33 @@ #define FAILURE 1 - /*************************************************************************/ - /* */ - /* CODERANGE FUNCTIONS */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* TT_Goto_CodeRange */ - /* */ - /* */ - /* Switches to a new code range (updates the code related elements in */ - /* `exec', and `IP'). */ - /* */ - /* */ - /* range :: The new execution code range. */ - /* */ - /* IP :: The new IP in the new code range. */ - /* */ - /* */ - /* exec :: The target execution context. */ - /* */ + /************************************************************************** + * + * CODERANGE FUNCTIONS + * + */ + + + /************************************************************************** + * + * @Function: + * TT_Goto_CodeRange + * + * @Description: + * Switches to a new code range (updates the code related elements in + * `exec', and `IP'). + * + * @Input: + * range :: + * The new execution code range. + * + * IP :: + * The new IP in the new code range. + * + * @InOut: + * exec :: + * The target execution context. + */ FT_LOCAL_DEF( void ) TT_Goto_CodeRange( TT_ExecContext exec, FT_Int range, @@ -148,24 +151,28 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Set_CodeRange */ - /* */ - /* */ - /* Sets a code range. */ - /* */ - /* */ - /* range :: The code range index. */ - /* */ - /* base :: The new code base. */ - /* */ - /* length :: The range size in bytes. */ - /* */ - /* */ - /* exec :: The target execution context. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Set_CodeRange + * + * @Description: + * Sets a code range. + * + * @Input: + * range :: + * The code range index. + * + * base :: + * The new code base. + * + * length :: + * The range size in bytes. + * + * @InOut: + * exec :: + * The target execution context. + */ FT_LOCAL_DEF( void ) TT_Set_CodeRange( TT_ExecContext exec, FT_Int range, @@ -179,20 +186,22 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Clear_CodeRange */ - /* */ - /* */ - /* Clears a code range. */ - /* */ - /* */ - /* range :: The code range index. */ - /* */ - /* */ - /* exec :: The target execution context. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Clear_CodeRange + * + * @Description: + * Clears a code range. + * + * @Input: + * range :: + * The code range index. + * + * @InOut: + * exec :: + * The target execution context. + */ FT_LOCAL_DEF( void ) TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ) @@ -204,29 +213,31 @@ } - /*************************************************************************/ - /* */ - /* EXECUTION CONTEXT ROUTINES */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* TT_Done_Context */ - /* */ - /* */ - /* Destroys a given context. */ - /* */ - /* */ - /* exec :: A handle to the target execution context. */ - /* */ - /* memory :: A handle to the parent memory object. */ - /* */ - /* */ - /* Only the glyph loader and debugger should call this function. */ - /* */ + /************************************************************************** + * + * EXECUTION CONTEXT ROUTINES + * + */ + + + /************************************************************************** + * + * @Function: + * TT_Done_Context + * + * @Description: + * Destroys a given context. + * + * @Input: + * exec :: + * A handle to the target execution context. + * + * memory :: + * A handle to the parent memory object. + * + * @Note: + * Only the glyph loader and debugger should call this function. + */ FT_LOCAL_DEF( void ) TT_Done_Context( TT_ExecContext exec ) { @@ -257,23 +268,25 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Init_Context */ - /* */ - /* */ - /* Initializes a context object. */ - /* */ - /* */ - /* memory :: A handle to the parent memory object. */ - /* */ - /* */ - /* exec :: A handle to the target execution context. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * Init_Context + * + * @Description: + * Initializes a context object. + * + * @Input: + * memory :: + * A handle to the parent memory object. + * + * @InOut: + * exec :: + * A handle to the target execution context. + * + * @Return: + * FreeType error code. 0 means success. + */ static FT_Error Init_Context( TT_ExecContext exec, FT_Memory memory ) @@ -313,30 +326,35 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Update_Max */ - /* */ - /* */ - /* Checks the size of a buffer and reallocates it if necessary. */ - /* */ - /* */ - /* memory :: A handle to the parent memory object. */ - /* */ - /* multiplier :: The size in bytes of each element in the buffer. */ - /* */ - /* new_max :: The new capacity (size) of the buffer. */ - /* */ - /* */ - /* size :: The address of the buffer's current size expressed */ - /* in elements. */ - /* */ - /* buff :: The address of the buffer base pointer. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * Update_Max + * + * @Description: + * Checks the size of a buffer and reallocates it if necessary. + * + * @Input: + * memory :: + * A handle to the parent memory object. + * + * multiplier :: + * The size in bytes of each element in the buffer. + * + * new_max :: + * The new capacity (size) of the buffer. + * + * @InOut: + * size :: + * The address of the buffer's current size expressed + * in elements. + * + * buff :: + * The address of the buffer base pointer. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) Update_Max( FT_Memory memory, FT_ULong* size, @@ -359,28 +377,31 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Load_Context */ - /* */ - /* */ - /* Prepare an execution context for glyph hinting. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* size :: A handle to the source size object. */ - /* */ - /* */ - /* exec :: A handle to the target execution context. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Only the glyph loader and debugger should call this function. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Load_Context + * + * @Description: + * Prepare an execution context for glyph hinting. + * + * @Input: + * face :: + * A handle to the source face object. + * + * size :: + * A handle to the source size object. + * + * @InOut: + * exec :: + * A handle to the target execution context. + * + * @Return: + * FreeType error code. 0 means success. + * + * @Note: + * Only the glyph loader and debugger should call this function. + */ FT_LOCAL_DEF( FT_Error ) TT_Load_Context( TT_ExecContext exec, TT_Face face, @@ -467,23 +488,25 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Save_Context */ - /* */ - /* */ - /* Saves the code ranges in a `size' object. */ - /* */ - /* */ - /* exec :: A handle to the source execution context. */ - /* */ - /* */ - /* size :: A handle to the target size object. */ - /* */ - /* */ - /* Only the glyph loader and debugger should call this function. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Save_Context + * + * @Description: + * Saves the code ranges in a `size' object. + * + * @Input: + * exec :: + * A handle to the source execution context. + * + * @InOut: + * size :: + * A handle to the target size object. + * + * @Note: + * Only the glyph loader and debugger should call this function. + */ FT_LOCAL_DEF( void ) TT_Save_Context( TT_ExecContext exec, TT_Size size ) @@ -505,27 +528,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Run_Context */ - /* */ - /* */ - /* Executes one or more instructions in the execution context. */ - /* */ - /* */ - /* debug :: A Boolean flag. If set, the function sets some internal */ - /* variables and returns immediately, otherwise TT_RunIns() */ - /* is called. */ - /* */ - /* This is commented out currently. */ - /* */ - /* */ - /* exec :: A handle to the target execution context. */ - /* */ - /* */ - /* TrueType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_Run_Context + * + * @Description: + * Executes one or more instructions in the execution context. + * + * @Input: + * exec :: + * A handle to the target execution context. + * + * @Return: + * TrueType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) TT_Run_Context( TT_ExecContext exec ) { @@ -609,22 +626,22 @@ } - /*************************************************************************/ - /* */ - /* Before an opcode is executed, the interpreter verifies that there are */ - /* enough arguments on the stack, with the help of the `Pop_Push_Count' */ - /* table. */ - /* */ - /* For each opcode, the first column gives the number of arguments that */ - /* are popped from the stack; the second one gives the number of those */ - /* that are pushed in result. */ - /* */ - /* Opcodes which have a varying number of parameters in the data stream */ - /* (NPUSHB, NPUSHW) are handled specially; they have a negative value in */ - /* the `opcode_length' table, and the value in `Pop_Push_Count' is set */ - /* to zero. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Before an opcode is executed, the interpreter verifies that there are + * enough arguments on the stack, with the help of the `Pop_Push_Count' + * table. + * + * For each opcode, the first column gives the number of arguments that + * are popped from the stack; the second one gives the number of those + * that are pushed in result. + * + * Opcodes which have a varying number of parameters in the data stream + * (NPUSHB, NPUSHW) are handled specially; they have a negative value in + * the `opcode_length' table, and the value in `Pop_Push_Count' is set + * to zero. + * + */ #undef PACK @@ -637,23 +654,25 @@ /* opcodes are gathered in groups of 16 */ /* please keep the spaces as they are */ - /* SVTCA y */ PACK( 0, 0 ), - /* SVTCA x */ PACK( 0, 0 ), - /* SPvTCA y */ PACK( 0, 0 ), - /* SPvTCA x */ PACK( 0, 0 ), - /* SFvTCA y */ PACK( 0, 0 ), - /* SFvTCA x */ PACK( 0, 0 ), - /* SPvTL // */ PACK( 2, 0 ), - /* SPvTL + */ PACK( 2, 0 ), - /* SFvTL // */ PACK( 2, 0 ), - /* SFvTL + */ PACK( 2, 0 ), - /* SPvFS */ PACK( 2, 0 ), - /* SFvFS */ PACK( 2, 0 ), - /* GPv */ PACK( 0, 2 ), - /* GFv */ PACK( 0, 2 ), - /* SFvTPv */ PACK( 0, 0 ), + /* 0x00 */ + /* SVTCA[0] */ PACK( 0, 0 ), + /* SVTCA[1] */ PACK( 0, 0 ), + /* SPVTCA[0] */ PACK( 0, 0 ), + /* SPVTCA[1] */ PACK( 0, 0 ), + /* SFVTCA[0] */ PACK( 0, 0 ), + /* SFVTCA[1] */ PACK( 0, 0 ), + /* SPVTL[0] */ PACK( 2, 0 ), + /* SPVTL[1] */ PACK( 2, 0 ), + /* SFVTL[0] */ PACK( 2, 0 ), + /* SFVTL[1] */ PACK( 2, 0 ), + /* SPVFS */ PACK( 2, 0 ), + /* SFVFS */ PACK( 2, 0 ), + /* GPV */ PACK( 0, 2 ), + /* GFV */ PACK( 0, 2 ), + /* SFVTPV */ PACK( 0, 0 ), /* ISECT */ PACK( 5, 0 ), + /* 0x10 */ /* SRP0 */ PACK( 1, 0 ), /* SRP1 */ PACK( 1, 0 ), /* SRP2 */ PACK( 1, 0 ), @@ -667,10 +686,11 @@ /* SMD */ PACK( 1, 0 ), /* ELSE */ PACK( 0, 0 ), /* JMPR */ PACK( 1, 0 ), - /* SCvTCi */ PACK( 1, 0 ), - /* SSwCi */ PACK( 1, 0 ), + /* SCVTCI */ PACK( 1, 0 ), + /* SSWCI */ PACK( 1, 0 ), /* SSW */ PACK( 1, 0 ), + /* 0x20 */ /* DUP */ PACK( 1, 2 ), /* POP */ PACK( 1, 0 ), /* CLEAR */ PACK( 0, 0 ), @@ -678,7 +698,7 @@ /* DEPTH */ PACK( 0, 1 ), /* CINDEX */ PACK( 1, 1 ), /* MINDEX */ PACK( 1, 0 ), - /* AlignPTS */ PACK( 2, 0 ), + /* ALIGNPTS */ PACK( 2, 0 ), /* INS_$28 */ PACK( 0, 0 ), /* UTP */ PACK( 1, 0 ), /* LOOPCALL */ PACK( 2, 0 ), @@ -688,6 +708,7 @@ /* MDAP[0] */ PACK( 1, 0 ), /* MDAP[1] */ PACK( 1, 0 ), + /* 0x30 */ /* IUP[0] */ PACK( 0, 0 ), /* IUP[1] */ PACK( 0, 0 ), /* SHP[0] */ PACK( 0, 0 ), /* loops */ @@ -700,17 +721,18 @@ /* IP */ PACK( 0, 0 ), /* loops */ /* MSIRP[0] */ PACK( 2, 0 ), /* MSIRP[1] */ PACK( 2, 0 ), - /* AlignRP */ PACK( 0, 0 ), /* loops */ + /* ALIGNRP */ PACK( 0, 0 ), /* loops */ /* RTDG */ PACK( 0, 0 ), /* MIAP[0] */ PACK( 2, 0 ), /* MIAP[1] */ PACK( 2, 0 ), - /* NPushB */ PACK( 0, 0 ), - /* NPushW */ PACK( 0, 0 ), + /* 0x40 */ + /* NPUSHB */ PACK( 0, 0 ), + /* NPUSHW */ PACK( 0, 0 ), /* WS */ PACK( 2, 0 ), /* RS */ PACK( 1, 1 ), - /* WCvtP */ PACK( 2, 0 ), - /* RCvt */ PACK( 1, 1 ), + /* WCVTP */ PACK( 2, 0 ), + /* RCVT */ PACK( 1, 1 ), /* GC[0] */ PACK( 1, 1 ), /* GC[1] */ PACK( 1, 1 ), /* SCFS */ PACK( 2, 0 ), @@ -718,10 +740,11 @@ /* MD[1] */ PACK( 2, 1 ), /* MPPEM */ PACK( 0, 1 ), /* MPS */ PACK( 0, 1 ), - /* FlipON */ PACK( 0, 0 ), - /* FlipOFF */ PACK( 0, 0 ), + /* FLIPON */ PACK( 0, 0 ), + /* FLIPOFF */ PACK( 0, 0 ), /* DEBUG */ PACK( 1, 0 ), + /* 0x50 */ /* LT */ PACK( 2, 1 ), /* LTEQ */ PACK( 2, 1 ), /* GT */ PACK( 2, 1 ), @@ -735,10 +758,11 @@ /* AND */ PACK( 2, 1 ), /* OR */ PACK( 2, 1 ), /* NOT */ PACK( 1, 1 ), - /* DeltaP1 */ PACK( 1, 0 ), + /* DELTAP1 */ PACK( 1, 0 ), /* SDB */ PACK( 1, 0 ), /* SDS */ PACK( 1, 0 ), + /* 0x60 */ /* ADD */ PACK( 2, 1 ), /* SUB */ PACK( 2, 1 ), /* DIV */ PACK( 2, 1 ), @@ -756,14 +780,15 @@ /* NROUND[2] */ PACK( 1, 1 ), /* NROUND[3] */ PACK( 1, 1 ), - /* WCvtF */ PACK( 2, 0 ), - /* DeltaP2 */ PACK( 1, 0 ), - /* DeltaP3 */ PACK( 1, 0 ), - /* DeltaCn[0] */ PACK( 1, 0 ), - /* DeltaCn[1] */ PACK( 1, 0 ), - /* DeltaCn[2] */ PACK( 1, 0 ), + /* 0x70 */ + /* WCVTF */ PACK( 2, 0 ), + /* DELTAP2 */ PACK( 1, 0 ), + /* DELTAP3 */ PACK( 1, 0 ), + /* DELTAC1 */ PACK( 1, 0 ), + /* DELTAC2 */ PACK( 1, 0 ), + /* DELTAC3 */ PACK( 1, 0 ), /* SROUND */ PACK( 1, 0 ), - /* S45Round */ PACK( 1, 0 ), + /* S45ROUND */ PACK( 1, 0 ), /* JROT */ PACK( 2, 0 ), /* JROF */ PACK( 2, 0 ), /* ROFF */ PACK( 0, 0 ), @@ -773,23 +798,25 @@ /* SANGW */ PACK( 1, 0 ), /* AA */ PACK( 1, 0 ), - /* FlipPT */ PACK( 0, 0 ), /* loops */ - /* FlipRgON */ PACK( 2, 0 ), - /* FlipRgOFF */ PACK( 2, 0 ), + /* 0x80 */ + /* FLIPPT */ PACK( 0, 0 ), /* loops */ + /* FLIPRGON */ PACK( 2, 0 ), + /* FLIPRGOFF */ PACK( 2, 0 ), /* INS_$83 */ PACK( 0, 0 ), /* INS_$84 */ PACK( 0, 0 ), - /* ScanCTRL */ PACK( 1, 0 ), - /* SDPvTL[0] */ PACK( 2, 0 ), - /* SDPvTL[1] */ PACK( 2, 0 ), - /* GetINFO */ PACK( 1, 1 ), + /* SCANCTRL */ PACK( 1, 0 ), + /* SDPVTL[0] */ PACK( 2, 0 ), + /* SDPVTL[1] */ PACK( 2, 0 ), + /* GETINFO */ PACK( 1, 1 ), /* IDEF */ PACK( 1, 0 ), /* ROLL */ PACK( 3, 3 ), /* MAX */ PACK( 2, 1 ), /* MIN */ PACK( 2, 1 ), - /* ScanTYPE */ PACK( 1, 0 ), - /* InstCTRL */ PACK( 2, 0 ), + /* SCANTYPE */ PACK( 1, 0 ), + /* INSTCTRL */ PACK( 2, 0 ), /* INS_$8F */ PACK( 0, 0 ), + /* 0x90 */ /* INS_$90 */ PACK( 0, 0 ), /* GETVAR */ PACK( 0, 0 ), /* will be handled specially */ /* GETDATA */ PACK( 0, 1 ), @@ -807,6 +834,7 @@ /* INS_$9E */ PACK( 0, 0 ), /* INS_$9F */ PACK( 0, 0 ), + /* 0xA0 */ /* INS_$A0 */ PACK( 0, 0 ), /* INS_$A1 */ PACK( 0, 0 ), /* INS_$A2 */ PACK( 0, 0 ), @@ -824,23 +852,25 @@ /* INS_$AE */ PACK( 0, 0 ), /* INS_$AF */ PACK( 0, 0 ), - /* PushB[0] */ PACK( 0, 1 ), - /* PushB[1] */ PACK( 0, 2 ), - /* PushB[2] */ PACK( 0, 3 ), - /* PushB[3] */ PACK( 0, 4 ), - /* PushB[4] */ PACK( 0, 5 ), - /* PushB[5] */ PACK( 0, 6 ), - /* PushB[6] */ PACK( 0, 7 ), - /* PushB[7] */ PACK( 0, 8 ), - /* PushW[0] */ PACK( 0, 1 ), - /* PushW[1] */ PACK( 0, 2 ), - /* PushW[2] */ PACK( 0, 3 ), - /* PushW[3] */ PACK( 0, 4 ), - /* PushW[4] */ PACK( 0, 5 ), - /* PushW[5] */ PACK( 0, 6 ), - /* PushW[6] */ PACK( 0, 7 ), - /* PushW[7] */ PACK( 0, 8 ), - + /* 0xB0 */ + /* PUSHB[0] */ PACK( 0, 1 ), + /* PUSHB[1] */ PACK( 0, 2 ), + /* PUSHB[2] */ PACK( 0, 3 ), + /* PUSHB[3] */ PACK( 0, 4 ), + /* PUSHB[4] */ PACK( 0, 5 ), + /* PUSHB[5] */ PACK( 0, 6 ), + /* PUSHB[6] */ PACK( 0, 7 ), + /* PUSHB[7] */ PACK( 0, 8 ), + /* PUSHW[0] */ PACK( 0, 1 ), + /* PUSHW[1] */ PACK( 0, 2 ), + /* PUSHW[2] */ PACK( 0, 3 ), + /* PUSHW[3] */ PACK( 0, 4 ), + /* PUSHW[4] */ PACK( 0, 5 ), + /* PUSHW[5] */ PACK( 0, 6 ), + /* PUSHW[6] */ PACK( 0, 7 ), + /* PUSHW[7] */ PACK( 0, 8 ), + + /* 0xC0 */ /* MDRP[00] */ PACK( 1, 0 ), /* MDRP[01] */ PACK( 1, 0 ), /* MDRP[02] */ PACK( 1, 0 ), @@ -858,6 +888,7 @@ /* MDRP[14] */ PACK( 1, 0 ), /* MDRP[15] */ PACK( 1, 0 ), + /* 0xD0 */ /* MDRP[16] */ PACK( 1, 0 ), /* MDRP[17] */ PACK( 1, 0 ), /* MDRP[18] */ PACK( 1, 0 ), @@ -875,6 +906,7 @@ /* MDRP[30] */ PACK( 1, 0 ), /* MDRP[31] */ PACK( 1, 0 ), + /* 0xE0 */ /* MIRP[00] */ PACK( 2, 0 ), /* MIRP[01] */ PACK( 2, 0 ), /* MIRP[02] */ PACK( 2, 0 ), @@ -892,6 +924,7 @@ /* MIRP[14] */ PACK( 2, 0 ), /* MIRP[15] */ PACK( 2, 0 ), + /* 0xF0 */ /* MIRP[16] */ PACK( 2, 0 ), /* MIRP[17] */ PACK( 2, 0 ), /* MIRP[18] */ PACK( 2, 0 ), @@ -920,23 +953,25 @@ static const char* const opcode_name[256] = { - "7 SVTCA y", - "7 SVTCA x", - "8 SPvTCA y", - "8 SPvTCA x", - "8 SFvTCA y", - "8 SFvTCA x", - "8 SPvTL ||", - "7 SPvTL +", - "8 SFvTL ||", - "7 SFvTL +", - "5 SPvFS", - "5 SFvFS", - "3 GPv", - "3 GFv", - "6 SFvTPv", + /* 0x00 */ + "8 SVTCA[y]", + "8 SVTCA[x]", + "9 SPVTCA[y]", + "9 SPVTCA[x]", + "9 SFVTCA[y]", + "9 SFVTCA[x]", + "9 SPVTL[||]", + "8 SPVTL[+]", + "9 SFVTL[||]", + "8 SFVTL[+]", + "5 SPVFS", + "5 SFVFS", + "3 GPV", + "3 GFV", + "6 SFVTPV", "5 ISECT", + /* 0x10 */ "4 SRP0", "4 SRP1", "4 SRP2", @@ -950,10 +985,11 @@ "3 SMD", "4 ELSE", "4 JMPR", - "6 SCvTCi", - "5 SSwCi", + "6 SCVTCI", + "5 SSWCI", "3 SSW", + /* 0x20 */ "3 DUP", "3 POP", "5 CLEAR", @@ -961,50 +997,53 @@ "5 DEPTH", "6 CINDEX", "6 MINDEX", - "8 AlignPTS", + "8 ALIGNPTS", "7 INS_$28", "3 UTP", "8 LOOPCALL", "4 CALL", "4 FDEF", "4 ENDF", - "7 MDAP[0]", - "7 MDAP[1]", - - "6 IUP[0]", - "6 IUP[1]", - "6 SHP[0]", - "6 SHP[1]", - "6 SHC[0]", - "6 SHC[1]", - "6 SHZ[0]", - "6 SHZ[1]", + "6 MDAP[]", + "9 MDAP[rnd]", + + /* 0x30 */ + "6 IUP[y]", + "6 IUP[x]", + "8 SHP[rp2]", + "8 SHP[rp1]", + "8 SHC[rp2]", + "8 SHC[rp1]", + "8 SHZ[rp2]", + "8 SHZ[rp1]", "5 SHPIX", "2 IP", - "8 MSIRP[0]", - "8 MSIRP[1]", - "7 AlignRP", + "7 MSIRP[]", + "A MSIRP[rp0]", + "7 ALIGNRP", "4 RTDG", - "7 MIAP[0]", - "7 MIAP[1]", + "6 MIAP[]", + "9 MIAP[rnd]", - "6 NPushB", - "6 NPushW", + /* 0x40 */ + "6 NPUSHB", + "6 NPUSHW", "2 WS", "2 RS", - "5 WCvtP", - "4 RCvt", - "5 GC[0]", - "5 GC[1]", + "5 WCVTP", + "4 RCVT", + "8 GC[curr]", + "8 GC[orig]", "4 SCFS", - "5 MD[0]", - "5 MD[1]", + "8 MD[curr]", + "8 MD[orig]", "5 MPPEM", "3 MPS", - "6 FlipON", - "7 FlipOFF", + "6 FLIPON", + "7 FLIPOFF", "5 DEBUG", + /* 0x50 */ "2 LT", "4 LTEQ", "2 GT", @@ -1018,10 +1057,11 @@ "3 AND", "2 OR", "3 NOT", - "7 DeltaP1", + "7 DELTAP1", "3 SDB", "3 SDS", + /* 0x60 */ "3 ADD", "3 SUB", "3 DIV", @@ -1030,23 +1070,24 @@ "3 NEG", "5 FLOOR", "7 CEILING", - "8 ROUND[0]", - "8 ROUND[1]", - "8 ROUND[2]", - "8 ROUND[3]", - "9 NROUND[0]", - "9 NROUND[1]", - "9 NROUND[2]", - "9 NROUND[3]", - - "5 WCvtF", - "7 DeltaP2", - "7 DeltaP3", - "A DeltaCn[0]", - "A DeltaCn[1]", - "A DeltaCn[2]", + "8 ROUND[G]", + "8 ROUND[B]", + "8 ROUND[W]", + "7 ROUND[]", + "9 NROUND[G]", + "9 NROUND[B]", + "9 NROUND[W]", + "8 NROUND[]", + + /* 0x70 */ + "5 WCVTF", + "7 DELTAP2", + "7 DELTAP3", + "7 DELTAC1", + "7 DELTAC2", + "7 DELTAC3", "6 SROUND", - "8 S45Round", + "8 S45ROUND", "4 JROT", "4 JROF", "4 ROFF", @@ -1056,26 +1097,28 @@ "5 SANGW", "2 AA", - "6 FlipPT", - "8 FlipRgON", - "9 FlipRgOFF", + /* 0x80 */ + "6 FLIPPT", + "8 FLIPRGON", + "9 FLIPRGOFF", "7 INS_$83", "7 INS_$84", - "8 ScanCTRL", - "9 SDPvTL[0]", - "9 SDPvTL[1]", - "7 GetINFO", + "8 SCANCTRL", + "A SDPVTL[||]", + "9 SDPVTL[+]", + "7 GETINFO", "4 IDEF", "4 ROLL", "3 MAX", "3 MIN", - "8 ScanTYPE", - "8 InstCTRL", + "8 SCANTYPE", + "8 INSTCTRL", "7 INS_$8F", + /* 0x90 */ "7 INS_$90", #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - "6 GETVAR", + "C GETVARIATION", "7 GETDATA", #else "7 INS_$91", @@ -1095,6 +1138,7 @@ "7 INS_$9E", "7 INS_$9F", + /* 0xA0 */ "7 INS_$A0", "7 INS_$A1", "7 INS_$A2", @@ -1112,90 +1156,95 @@ "7 INS_$AE", "7 INS_$AF", - "8 PushB[0]", - "8 PushB[1]", - "8 PushB[2]", - "8 PushB[3]", - "8 PushB[4]", - "8 PushB[5]", - "8 PushB[6]", - "8 PushB[7]", - "8 PushW[0]", - "8 PushW[1]", - "8 PushW[2]", - "8 PushW[3]", - "8 PushW[4]", - "8 PushW[5]", - "8 PushW[6]", - "8 PushW[7]", - - "8 MDRP[00]", - "8 MDRP[01]", - "8 MDRP[02]", - "8 MDRP[03]", - "8 MDRP[04]", - "8 MDRP[05]", - "8 MDRP[06]", - "8 MDRP[07]", - "8 MDRP[08]", - "8 MDRP[09]", - "8 MDRP[10]", - "8 MDRP[11]", - "8 MDRP[12]", - "8 MDRP[13]", - "8 MDRP[14]", - "8 MDRP[15]", - - "8 MDRP[16]", - "8 MDRP[17]", - "8 MDRP[18]", - "8 MDRP[19]", - "8 MDRP[20]", - "8 MDRP[21]", - "8 MDRP[22]", - "8 MDRP[23]", - "8 MDRP[24]", - "8 MDRP[25]", - "8 MDRP[26]", - "8 MDRP[27]", - "8 MDRP[28]", - "8 MDRP[29]", - "8 MDRP[30]", - "8 MDRP[31]", - - "8 MIRP[00]", - "8 MIRP[01]", - "8 MIRP[02]", - "8 MIRP[03]", - "8 MIRP[04]", - "8 MIRP[05]", - "8 MIRP[06]", - "8 MIRP[07]", - "8 MIRP[08]", - "8 MIRP[09]", - "8 MIRP[10]", - "8 MIRP[11]", - "8 MIRP[12]", - "8 MIRP[13]", - "8 MIRP[14]", - "8 MIRP[15]", - - "8 MIRP[16]", - "8 MIRP[17]", - "8 MIRP[18]", - "8 MIRP[19]", - "8 MIRP[20]", - "8 MIRP[21]", - "8 MIRP[22]", - "8 MIRP[23]", - "8 MIRP[24]", - "8 MIRP[25]", - "8 MIRP[26]", - "8 MIRP[27]", - "8 MIRP[28]", - "8 MIRP[29]", - "8 MIRP[30]", - "8 MIRP[31]" + /* 0xB0 */ + "8 PUSHB[0]", + "8 PUSHB[1]", + "8 PUSHB[2]", + "8 PUSHB[3]", + "8 PUSHB[4]", + "8 PUSHB[5]", + "8 PUSHB[6]", + "8 PUSHB[7]", + "8 PUSHW[0]", + "8 PUSHW[1]", + "8 PUSHW[2]", + "8 PUSHW[3]", + "8 PUSHW[4]", + "8 PUSHW[5]", + "8 PUSHW[6]", + "8 PUSHW[7]", + + /* 0xC0 */ + "7 MDRP[G]", + "7 MDRP[B]", + "7 MDRP[W]", + "6 MDRP[]", + "8 MDRP[rG]", + "8 MDRP[rB]", + "8 MDRP[rW]", + "7 MDRP[r]", + "8 MDRP[mG]", + "8 MDRP[mB]", + "8 MDRP[mW]", + "7 MDRP[m]", + "9 MDRP[mrG]", + "9 MDRP[mrB]", + "9 MDRP[mrW]", + "8 MDRP[mr]", + + /* 0xD0 */ + "8 MDRP[pG]", + "8 MDRP[pB]", + "8 MDRP[pW]", + "7 MDRP[p]", + "9 MDRP[prG]", + "9 MDRP[prB]", + "9 MDRP[prW]", + "8 MDRP[pr]", + "9 MDRP[pmG]", + "9 MDRP[pmB]", + "9 MDRP[pmW]", + "8 MDRP[pm]", + "A MDRP[pmrG]", + "A MDRP[pmrB]", + "A MDRP[pmrW]", + "9 MDRP[pmr]", + + /* 0xE0 */ + "7 MIRP[G]", + "7 MIRP[B]", + "7 MIRP[W]", + "6 MIRP[]", + "8 MIRP[rG]", + "8 MIRP[rB]", + "8 MIRP[rW]", + "7 MIRP[r]", + "8 MIRP[mG]", + "8 MIRP[mB]", + "8 MIRP[mW]", + "7 MIRP[m]", + "9 MIRP[mrG]", + "9 MIRP[mrB]", + "9 MIRP[mrW]", + "8 MIRP[mr]", + + /* 0xF0 */ + "8 MIRP[pG]", + "8 MIRP[pB]", + "8 MIRP[pW]", + "7 MIRP[p]", + "9 MIRP[prG]", + "9 MIRP[prB]", + "9 MIRP[prW]", + "8 MIRP[pr]", + "9 MIRP[pmG]", + "9 MIRP[pmB]", + "9 MIRP[pmW]", + "8 MIRP[pm]", + "A MIRP[pmrG]", + "A MIRP[pmrB]", + "A MIRP[pmrW]", + "9 MIRP[pmr]" }; #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -1448,18 +1497,18 @@ #endif /* TT_DotFix14 */ - /*************************************************************************/ - /* */ - /* */ - /* Current_Ratio */ - /* */ - /* */ - /* Returns the current aspect ratio scaling factor depending on the */ - /* projection vector's state and device resolutions. */ - /* */ - /* */ - /* The aspect ratio in 16.16 format, always <= 1.0 . */ - /* */ + /************************************************************************** + * + * @Function: + * Current_Ratio + * + * @Description: + * Returns the current aspect ratio scaling factor depending on the + * projection vector's state and device resolutions. + * + * @Return: + * The aspect ratio in 16.16 format, always <= 1.0 . + */ static FT_Long Current_Ratio( TT_ExecContext exc ) { @@ -1501,11 +1550,11 @@ } - /*************************************************************************/ - /* */ - /* Functions related to the control value table (CVT). */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Functions related to the control value table (CVT). + * + */ FT_CALLBACK_DEF( FT_F26Dot6 ) @@ -1547,7 +1596,7 @@ FT_ULong idx, FT_F26Dot6 value ) { - exc->cvt[idx] += value; + exc->cvt[idx] = ADD_LONG( exc->cvt[idx], value ); } @@ -1556,25 +1605,26 @@ FT_ULong idx, FT_F26Dot6 value ) { - exc->cvt[idx] += FT_DivFix( value, Current_Ratio( exc ) ); - } - - - /*************************************************************************/ - /* */ - /* */ - /* GetShortIns */ - /* */ - /* */ - /* Returns a short integer taken from the instruction stream at */ - /* address IP. */ - /* */ - /* */ - /* Short read at code[IP]. */ - /* */ - /* */ - /* This one could become a macro. */ - /* */ + exc->cvt[idx] = ADD_LONG( exc->cvt[idx], + FT_DivFix( value, Current_Ratio( exc ) ) ); + } + + + /************************************************************************** + * + * @Function: + * GetShortIns + * + * @Description: + * Returns a short integer taken from the instruction stream at + * address IP. + * + * @Return: + * Short read at code[IP]. + * + * @Note: + * This one could become a macro. + */ static FT_Short GetShortIns( TT_ExecContext exc ) { @@ -1585,22 +1635,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Ins_Goto_CodeRange */ - /* */ - /* */ - /* Goes to a certain code range in the instruction stream. */ - /* */ - /* */ - /* aRange :: The index of the code range. */ - /* */ - /* aIP :: The new IP address in the code range. */ - /* */ - /* */ - /* SUCCESS or FAILURE. */ - /* */ + /************************************************************************** + * + * @Function: + * Ins_Goto_CodeRange + * + * @Description: + * Goes to a certain code range in the instruction stream. + * + * @Input: + * aRange :: + * The index of the code range. + * + * aIP :: + * The new IP address in the code range. + * + * @Return: + * SUCCESS or FAILURE. + */ static FT_Bool Ins_Goto_CodeRange( TT_ExecContext exc, FT_Int aRange, @@ -1642,27 +1694,56 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Direct_Move */ - /* */ - /* */ - /* Moves a point by a given distance along the freedom vector. The */ - /* point will be `touched'. */ - /* */ - /* */ - /* point :: The index of the point to move. */ - /* */ - /* distance :: The distance to apply. */ - /* */ - /* */ - /* zone :: The affected glyph zone. */ - /* */ - /* */ - /* See `ttinterp.h' for details on backward compatibility mode. */ - /* `Touches' the point. */ - /* */ + /* + * + * Apple's TrueType specification at + * + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM02/Chap2.html#order + * + * gives the following order of operations in instructions that move + * points. + * + * - check single width cut-in (MIRP, MDRP) + * + * - check control value cut-in (MIRP, MIAP) + * + * - apply engine compensation (MIRP, MDRP) + * + * - round distance (MIRP, MDRP) or value (MIAP, MDAP) + * + * - check minimum distance (MIRP,MDRP) + * + * - move point (MIRP, MDRP, MIAP, MSIRP, MDAP) + * + * For rounding instructions, engine compensation happens before rounding. + * + */ + + + /************************************************************************** + * + * @Function: + * Direct_Move + * + * @Description: + * Moves a point by a given distance along the freedom vector. The + * point will be `touched'. + * + * @Input: + * point :: + * The index of the point to move. + * + * distance :: + * The distance to apply. + * + * @InOut: + * zone :: + * The affected glyph zone. + * + * @Note: + * See `ttinterp.h' for details on backward compatibility mode. + * `Touches' the point. + */ static void Direct_Move( TT_ExecContext exc, TT_GlyphZone zone, @@ -1728,23 +1809,26 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Direct_Move_Orig */ - /* */ - /* */ - /* Moves the *original* position of a point by a given distance along */ - /* the freedom vector. Obviously, the point will not be `touched'. */ - /* */ - /* */ - /* point :: The index of the point to move. */ - /* */ - /* distance :: The distance to apply. */ - /* */ - /* */ - /* zone :: The affected glyph zone. */ - /* */ + /************************************************************************** + * + * @Function: + * Direct_Move_Orig + * + * @Description: + * Moves the *original* position of a point by a given distance along + * the freedom vector. Obviously, the point will not be `touched'. + * + * @Input: + * point :: + * The index of the point to move. + * + * distance :: + * The distance to apply. + * + * @InOut: + * zone :: + * The affected glyph zone. + */ static void Direct_Move_Orig( TT_ExecContext exc, TT_GlyphZone zone, @@ -1772,15 +1856,15 @@ } - /*************************************************************************/ - /* */ - /* Special versions of Direct_Move() */ - /* */ - /* The following versions are used whenever both vectors are both */ - /* along one of the coordinate unit vectors, i.e. in 90% of the cases. */ - /* See `ttinterp.h' for details on backward compatibility mode. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Special versions of Direct_Move() + * + * The following versions are used whenever both vectors are both + * along one of the coordinate unit vectors, i.e. in 90% of the cases. + * See `ttinterp.h' for details on backward compatibility mode. + * + */ static void @@ -1827,14 +1911,14 @@ } - /*************************************************************************/ - /* */ - /* Special versions of Direct_Move_Orig() */ - /* */ - /* The following versions are used whenever both vectors are both */ - /* along one of the coordinate unit vectors, i.e. in 90% of the cases. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Special versions of Direct_Move_Orig() + * + * The following versions are used whenever both vectors are both + * along one of the coordinate unit vectors, i.e. in 90% of the cases. + * + */ static void @@ -1860,29 +1944,24 @@ zone->org[point].y = ADD_LONG( zone->org[point].y, distance ); } - - /*************************************************************************/ - /* */ - /* */ - /* Round_None */ - /* */ - /* */ - /* Does not round, but adds engine compensation. */ - /* */ - /* */ - /* distance :: The distance (not) to round. */ - /* */ - /* compensation :: The engine compensation. */ - /* */ - /* */ - /* The compensated distance. */ - /* */ - /* */ - /* The TrueType specification says very few about the relationship */ - /* between rounding and engine compensation. However, it seems from */ - /* the description of super round that we should add the compensation */ - /* before rounding. */ - /* */ + /************************************************************************** + * + * @Function: + * Round_None + * + * @Description: + * Does not round, but adds engine compensation. + * + * @Input: + * distance :: + * The distance (not) to round. + * + * compensation :: + * The engine compensation. + * + * @Return: + * The compensated distance. + */ static FT_F26Dot6 Round_None( TT_ExecContext exc, FT_F26Dot6 distance, @@ -1909,22 +1988,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Round_To_Grid */ - /* */ - /* */ - /* Rounds value to grid after adding engine compensation. */ - /* */ - /* */ - /* distance :: The distance to round. */ - /* */ - /* compensation :: The engine compensation. */ - /* */ - /* */ - /* Rounded distance. */ - /* */ + /************************************************************************** + * + * @Function: + * Round_To_Grid + * + * @Description: + * Rounds value to grid after adding engine compensation. + * + * @Input: + * distance :: + * The distance to round. + * + * compensation :: + * The engine compensation. + * + * @Return: + * Rounded distance. + */ static FT_F26Dot6 Round_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, @@ -1953,22 +2034,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Round_To_Half_Grid */ - /* */ - /* */ - /* Rounds value to half grid after adding engine compensation. */ - /* */ - /* */ - /* distance :: The distance to round. */ - /* */ - /* compensation :: The engine compensation. */ - /* */ - /* */ - /* Rounded distance. */ - /* */ + /************************************************************************** + * + * @Function: + * Round_To_Half_Grid + * + * @Description: + * Rounds value to half grid after adding engine compensation. + * + * @Input: + * distance :: + * The distance to round. + * + * compensation :: + * The engine compensation. + * + * @Return: + * Rounded distance. + */ static FT_F26Dot6 Round_To_Half_Grid( TT_ExecContext exc, FT_F26Dot6 distance, @@ -1999,22 +2082,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Round_Down_To_Grid */ - /* */ - /* */ - /* Rounds value down to grid after adding engine compensation. */ - /* */ - /* */ - /* distance :: The distance to round. */ - /* */ - /* compensation :: The engine compensation. */ - /* */ - /* */ - /* Rounded distance. */ - /* */ + /************************************************************************** + * + * @Function: + * Round_Down_To_Grid + * + * @Description: + * Rounds value down to grid after adding engine compensation. + * + * @Input: + * distance :: + * The distance to round. + * + * compensation :: + * The engine compensation. + * + * @Return: + * Rounded distance. + */ static FT_F26Dot6 Round_Down_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, @@ -2042,22 +2127,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Round_Up_To_Grid */ - /* */ - /* */ - /* Rounds value up to grid after adding engine compensation. */ - /* */ - /* */ - /* distance :: The distance to round. */ - /* */ - /* compensation :: The engine compensation. */ - /* */ - /* */ - /* Rounded distance. */ - /* */ + /************************************************************************** + * + * @Function: + * Round_Up_To_Grid + * + * @Description: + * Rounds value up to grid after adding engine compensation. + * + * @Input: + * distance :: + * The distance to round. + * + * compensation :: + * The engine compensation. + * + * @Return: + * Rounded distance. + */ static FT_F26Dot6 Round_Up_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, @@ -2086,22 +2173,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Round_To_Double_Grid */ - /* */ - /* */ - /* Rounds value to double grid after adding engine compensation. */ - /* */ - /* */ - /* distance :: The distance to round. */ - /* */ - /* compensation :: The engine compensation. */ - /* */ - /* */ - /* Rounded distance. */ - /* */ + /************************************************************************** + * + * @Function: + * Round_To_Double_Grid + * + * @Description: + * Rounds value to double grid after adding engine compensation. + * + * @Input: + * distance :: + * The distance to round. + * + * compensation :: + * The engine compensation. + * + * @Return: + * Rounded distance. + */ static FT_F26Dot6 Round_To_Double_Grid( TT_ExecContext exc, FT_F26Dot6 distance, @@ -2130,28 +2219,30 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Round_Super */ - /* */ - /* */ - /* Super-rounds value to grid after adding engine compensation. */ - /* */ - /* */ - /* distance :: The distance to round. */ - /* */ - /* compensation :: The engine compensation. */ - /* */ - /* */ - /* Rounded distance. */ - /* */ - /* */ - /* The TrueType specification says very little about the relationship */ - /* between rounding and engine compensation. However, it seems from */ - /* the description of super round that we should add the compensation */ - /* before rounding. */ - /* */ + /************************************************************************** + * + * @Function: + * Round_Super + * + * @Description: + * Super-rounds value to grid after adding engine compensation. + * + * @Input: + * distance :: + * The distance to round. + * + * compensation :: + * The engine compensation. + * + * @Return: + * Rounded distance. + * + * @Note: + * The TrueType specification says very little about the relationship + * between rounding and engine compensation. However, it seems from + * the description of super round that we should add the compensation + * before rounding. + */ static FT_F26Dot6 Round_Super( TT_ExecContext exc, FT_F26Dot6 distance, @@ -2183,26 +2274,28 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Round_Super_45 */ - /* */ - /* */ - /* Super-rounds value to grid after adding engine compensation. */ - /* */ - /* */ - /* distance :: The distance to round. */ - /* */ - /* compensation :: The engine compensation. */ - /* */ - /* */ - /* Rounded distance. */ - /* */ - /* */ - /* There is a separate function for Round_Super_45() as we may need */ - /* greater precision. */ - /* */ + /************************************************************************** + * + * @Function: + * Round_Super_45 + * + * @Description: + * Super-rounds value to grid after adding engine compensation. + * + * @Input: + * distance :: + * The distance to round. + * + * compensation :: + * The engine compensation. + * + * @Return: + * Rounded distance. + * + * @Note: + * There is a separate function for Round_Super_45() as we may need + * greater precision. + */ static FT_F26Dot6 Round_Super_45( TT_ExecContext exc, FT_F26Dot6 distance, @@ -2234,17 +2327,18 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Compute_Round */ - /* */ - /* */ - /* Sets the rounding mode. */ - /* */ - /* */ - /* round_mode :: The rounding mode to be used. */ - /* */ + /************************************************************************** + * + * @Function: + * Compute_Round + * + * @Description: + * Sets the rounding mode. + * + * @Input: + * round_mode :: + * The rounding mode to be used. + */ static void Compute_Round( TT_ExecContext exc, FT_Byte round_mode ) @@ -2286,19 +2380,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* SetSuperRound */ - /* */ - /* */ - /* Sets Super Round parameters. */ - /* */ - /* */ - /* GridPeriod :: The grid period. */ - /* */ - /* selector :: The SROUND opcode. */ - /* */ + /************************************************************************** + * + * @Function: + * SetSuperRound + * + * @Description: + * Sets Super Round parameters. + * + * @Input: + * GridPeriod :: + * The grid period. + * + * selector :: + * The SROUND opcode. + */ static void SetSuperRound( TT_ExecContext exc, FT_F2Dot14 GridPeriod, @@ -2355,22 +2451,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Project */ - /* */ - /* */ - /* Computes the projection of vector given by (v2-v1) along the */ - /* current projection vector. */ - /* */ - /* */ - /* v1 :: First input vector. */ - /* v2 :: Second input vector. */ - /* */ - /* */ - /* The distance in F26dot6 format. */ - /* */ + /************************************************************************** + * + * @Function: + * Project + * + * @Description: + * Computes the projection of vector given by (v2-v1) along the + * current projection vector. + * + * @Input: + * v1 :: + * First input vector. + * v2 :: + * Second input vector. + * + * @Return: + * The distance in F26dot6 format. + */ static FT_F26Dot6 Project( TT_ExecContext exc, FT_Pos dx, @@ -2382,22 +2480,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Dual_Project */ - /* */ - /* */ - /* Computes the projection of the vector given by (v2-v1) along the */ - /* current dual vector. */ - /* */ - /* */ - /* v1 :: First input vector. */ - /* v2 :: Second input vector. */ - /* */ - /* */ - /* The distance in F26dot6 format. */ - /* */ + /************************************************************************** + * + * @Function: + * Dual_Project + * + * @Description: + * Computes the projection of the vector given by (v2-v1) along the + * current dual vector. + * + * @Input: + * v1 :: + * First input vector. + * v2 :: + * Second input vector. + * + * @Return: + * The distance in F26dot6 format. + */ static FT_F26Dot6 Dual_Project( TT_ExecContext exc, FT_Pos dx, @@ -2409,22 +2509,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Project_x */ - /* */ - /* */ - /* Computes the projection of the vector given by (v2-v1) along the */ - /* horizontal axis. */ - /* */ - /* */ - /* v1 :: First input vector. */ - /* v2 :: Second input vector. */ - /* */ - /* */ - /* The distance in F26dot6 format. */ - /* */ + /************************************************************************** + * + * @Function: + * Project_x + * + * @Description: + * Computes the projection of the vector given by (v2-v1) along the + * horizontal axis. + * + * @Input: + * v1 :: + * First input vector. + * v2 :: + * Second input vector. + * + * @Return: + * The distance in F26dot6 format. + */ static FT_F26Dot6 Project_x( TT_ExecContext exc, FT_Pos dx, @@ -2437,22 +2539,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Project_y */ - /* */ - /* */ - /* Computes the projection of the vector given by (v2-v1) along the */ - /* vertical axis. */ - /* */ - /* */ - /* v1 :: First input vector. */ - /* v2 :: Second input vector. */ - /* */ - /* */ - /* The distance in F26dot6 format. */ - /* */ + /************************************************************************** + * + * @Function: + * Project_y + * + * @Description: + * Computes the projection of the vector given by (v2-v1) along the + * vertical axis. + * + * @Input: + * v1 :: + * First input vector. + * v2 :: + * Second input vector. + * + * @Return: + * The distance in F26dot6 format. + */ static FT_F26Dot6 Project_y( TT_ExecContext exc, FT_Pos dx, @@ -2465,15 +2569,15 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Compute_Funcs */ - /* */ - /* */ - /* Computes the projection and movement function pointers according */ - /* to the current graphics state. */ - /* */ + /************************************************************************** + * + * @Function: + * Compute_Funcs + * + * @Description: + * Computes the projection and movement function pointers according + * to the current graphics state. + */ static void Compute_Funcs( TT_ExecContext exc ) { @@ -2528,28 +2632,31 @@ } - /*************************************************************************/ - /* */ - /* */ - /* Normalize */ - /* */ - /* */ - /* Norms a vector. */ - /* */ - /* */ - /* Vx :: The horizontal input vector coordinate. */ - /* Vy :: The vertical input vector coordinate. */ - /* */ - /* */ - /* R :: The normed unit vector. */ - /* */ - /* */ - /* Returns FAILURE if a vector parameter is zero. */ - /* */ - /* */ - /* In case Vx and Vy are both zero, `Normalize' returns SUCCESS, and */ - /* R is undefined. */ - /* */ + /************************************************************************** + * + * @Function: + * Normalize + * + * @Description: + * Norms a vector. + * + * @Input: + * Vx :: + * The horizontal input vector coordinate. + * Vy :: + * The vertical input vector coordinate. + * + * @Output: + * R :: + * The normed unit vector. + * + * @Return: + * Returns FAILURE if a vector parameter is zero. + * + * @Note: + * In case Vx and Vy are both zero, `Normalize' returns SUCCESS, and + * R is undefined. + */ static FT_Bool Normalize( FT_F26Dot6 Vx, FT_F26Dot6 Vy, @@ -2577,11 +2684,11 @@ } - /*************************************************************************/ - /* */ - /* Here we start with the implementation of the various opcodes. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Here we start with the implementation of the various opcodes. + * + */ #define ARRAY_BOUND_ERROR \ @@ -2592,12 +2699,12 @@ } while (0) - /*************************************************************************/ - /* */ - /* MPPEM[]: Measure Pixel Per EM */ - /* Opcode range: 0x4B */ - /* Stack: --> Euint16 */ - /* */ + /************************************************************************** + * + * MPPEM[]: Measure Pixel Per EM + * Opcode range: 0x4B + * Stack: --> Euint16 + */ static void Ins_MPPEM( TT_ExecContext exc, FT_Long* args ) @@ -2606,12 +2713,12 @@ } - /*************************************************************************/ - /* */ - /* MPS[]: Measure Point Size */ - /* Opcode range: 0x4C */ - /* Stack: --> Euint16 */ - /* */ + /************************************************************************** + * + * MPS[]: Measure Point Size + * Opcode range: 0x4C + * Stack: --> Euint16 + */ static void Ins_MPS( TT_ExecContext exc, FT_Long* args ) @@ -2633,12 +2740,12 @@ } - /*************************************************************************/ - /* */ - /* DUP[]: DUPlicate the stack's top element */ - /* Opcode range: 0x20 */ - /* Stack: StkElt --> StkElt StkElt */ - /* */ + /************************************************************************** + * + * DUP[]: DUPlicate the stack's top element + * Opcode range: 0x20 + * Stack: StkElt --> StkElt StkElt + */ static void Ins_DUP( FT_Long* args ) { @@ -2646,12 +2753,12 @@ } - /*************************************************************************/ - /* */ - /* POP[]: POP the stack's top element */ - /* Opcode range: 0x21 */ - /* Stack: StkElt --> */ - /* */ + /************************************************************************** + * + * POP[]: POP the stack's top element + * Opcode range: 0x21 + * Stack: StkElt --> + */ static void Ins_POP( void ) { @@ -2659,12 +2766,12 @@ } - /*************************************************************************/ - /* */ - /* CLEAR[]: CLEAR the entire stack */ - /* Opcode range: 0x22 */ - /* Stack: StkElt... --> */ - /* */ + /************************************************************************** + * + * CLEAR[]: CLEAR the entire stack + * Opcode range: 0x22 + * Stack: StkElt... --> + */ static void Ins_CLEAR( TT_ExecContext exc ) { @@ -2672,12 +2779,12 @@ } - /*************************************************************************/ - /* */ - /* SWAP[]: SWAP the stack's top two elements */ - /* Opcode range: 0x23 */ - /* Stack: 2 * StkElt --> 2 * StkElt */ - /* */ + /************************************************************************** + * + * SWAP[]: SWAP the stack's top two elements + * Opcode range: 0x23 + * Stack: 2 * StkElt --> 2 * StkElt + */ static void Ins_SWAP( FT_Long* args ) { @@ -2690,12 +2797,12 @@ } - /*************************************************************************/ - /* */ - /* DEPTH[]: return the stack DEPTH */ - /* Opcode range: 0x24 */ - /* Stack: --> uint32 */ - /* */ + /************************************************************************** + * + * DEPTH[]: return the stack DEPTH + * Opcode range: 0x24 + * Stack: --> uint32 + */ static void Ins_DEPTH( TT_ExecContext exc, FT_Long* args ) @@ -2704,12 +2811,12 @@ } - /*************************************************************************/ - /* */ - /* LT[]: Less Than */ - /* Opcode range: 0x50 */ - /* Stack: int32? int32? --> bool */ - /* */ + /************************************************************************** + * + * LT[]: Less Than + * Opcode range: 0x50 + * Stack: int32? int32? --> bool + */ static void Ins_LT( FT_Long* args ) { @@ -2717,12 +2824,12 @@ } - /*************************************************************************/ - /* */ - /* LTEQ[]: Less Than or EQual */ - /* Opcode range: 0x51 */ - /* Stack: int32? int32? --> bool */ - /* */ + /************************************************************************** + * + * LTEQ[]: Less Than or EQual + * Opcode range: 0x51 + * Stack: int32? int32? --> bool + */ static void Ins_LTEQ( FT_Long* args ) { @@ -2730,12 +2837,12 @@ } - /*************************************************************************/ - /* */ - /* GT[]: Greater Than */ - /* Opcode range: 0x52 */ - /* Stack: int32? int32? --> bool */ - /* */ + /************************************************************************** + * + * GT[]: Greater Than + * Opcode range: 0x52 + * Stack: int32? int32? --> bool + */ static void Ins_GT( FT_Long* args ) { @@ -2743,12 +2850,12 @@ } - /*************************************************************************/ - /* */ - /* GTEQ[]: Greater Than or EQual */ - /* Opcode range: 0x53 */ - /* Stack: int32? int32? --> bool */ - /* */ + /************************************************************************** + * + * GTEQ[]: Greater Than or EQual + * Opcode range: 0x53 + * Stack: int32? int32? --> bool + */ static void Ins_GTEQ( FT_Long* args ) { @@ -2756,12 +2863,12 @@ } - /*************************************************************************/ - /* */ - /* EQ[]: EQual */ - /* Opcode range: 0x54 */ - /* Stack: StkElt StkElt --> bool */ - /* */ + /************************************************************************** + * + * EQ[]: EQual + * Opcode range: 0x54 + * Stack: StkElt StkElt --> bool + */ static void Ins_EQ( FT_Long* args ) { @@ -2769,12 +2876,12 @@ } - /*************************************************************************/ - /* */ - /* NEQ[]: Not EQual */ - /* Opcode range: 0x55 */ - /* Stack: StkElt StkElt --> bool */ - /* */ + /************************************************************************** + * + * NEQ[]: Not EQual + * Opcode range: 0x55 + * Stack: StkElt StkElt --> bool + */ static void Ins_NEQ( FT_Long* args ) { @@ -2782,12 +2889,12 @@ } - /*************************************************************************/ - /* */ - /* ODD[]: Is ODD */ - /* Opcode range: 0x56 */ - /* Stack: f26.6 --> bool */ - /* */ + /************************************************************************** + * + * ODD[]: Is ODD + * Opcode range: 0x56 + * Stack: f26.6 --> bool + */ static void Ins_ODD( TT_ExecContext exc, FT_Long* args ) @@ -2796,12 +2903,12 @@ } - /*************************************************************************/ - /* */ - /* EVEN[]: Is EVEN */ - /* Opcode range: 0x57 */ - /* Stack: f26.6 --> bool */ - /* */ + /************************************************************************** + * + * EVEN[]: Is EVEN + * Opcode range: 0x57 + * Stack: f26.6 --> bool + */ static void Ins_EVEN( TT_ExecContext exc, FT_Long* args ) @@ -2810,12 +2917,12 @@ } - /*************************************************************************/ - /* */ - /* AND[]: logical AND */ - /* Opcode range: 0x5A */ - /* Stack: uint32 uint32 --> uint32 */ - /* */ + /************************************************************************** + * + * AND[]: logical AND + * Opcode range: 0x5A + * Stack: uint32 uint32 --> uint32 + */ static void Ins_AND( FT_Long* args ) { @@ -2823,12 +2930,12 @@ } - /*************************************************************************/ - /* */ - /* OR[]: logical OR */ - /* Opcode range: 0x5B */ - /* Stack: uint32 uint32 --> uint32 */ - /* */ + /************************************************************************** + * + * OR[]: logical OR + * Opcode range: 0x5B + * Stack: uint32 uint32 --> uint32 + */ static void Ins_OR( FT_Long* args ) { @@ -2836,12 +2943,12 @@ } - /*************************************************************************/ - /* */ - /* NOT[]: logical NOT */ - /* Opcode range: 0x5C */ - /* Stack: StkElt --> uint32 */ - /* */ + /************************************************************************** + * + * NOT[]: logical NOT + * Opcode range: 0x5C + * Stack: StkElt --> uint32 + */ static void Ins_NOT( FT_Long* args ) { @@ -2849,12 +2956,12 @@ } - /*************************************************************************/ - /* */ - /* ADD[]: ADD */ - /* Opcode range: 0x60 */ - /* Stack: f26.6 f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * ADD[]: ADD + * Opcode range: 0x60 + * Stack: f26.6 f26.6 --> f26.6 + */ static void Ins_ADD( FT_Long* args ) { @@ -2862,12 +2969,12 @@ } - /*************************************************************************/ - /* */ - /* SUB[]: SUBtract */ - /* Opcode range: 0x61 */ - /* Stack: f26.6 f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * SUB[]: SUBtract + * Opcode range: 0x61 + * Stack: f26.6 f26.6 --> f26.6 + */ static void Ins_SUB( FT_Long* args ) { @@ -2875,12 +2982,12 @@ } - /*************************************************************************/ - /* */ - /* DIV[]: DIVide */ - /* Opcode range: 0x62 */ - /* Stack: f26.6 f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * DIV[]: DIVide + * Opcode range: 0x62 + * Stack: f26.6 f26.6 --> f26.6 + */ static void Ins_DIV( TT_ExecContext exc, FT_Long* args ) @@ -2892,12 +2999,12 @@ } - /*************************************************************************/ - /* */ - /* MUL[]: MULtiply */ - /* Opcode range: 0x63 */ - /* Stack: f26.6 f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * MUL[]: MULtiply + * Opcode range: 0x63 + * Stack: f26.6 f26.6 --> f26.6 + */ static void Ins_MUL( FT_Long* args ) { @@ -2905,12 +3012,12 @@ } - /*************************************************************************/ - /* */ - /* ABS[]: ABSolute value */ - /* Opcode range: 0x64 */ - /* Stack: f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * ABS[]: ABSolute value + * Opcode range: 0x64 + * Stack: f26.6 --> f26.6 + */ static void Ins_ABS( FT_Long* args ) { @@ -2919,12 +3026,12 @@ } - /*************************************************************************/ - /* */ - /* NEG[]: NEGate */ - /* Opcode range: 0x65 */ - /* Stack: f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * NEG[]: NEGate + * Opcode range: 0x65 + * Stack: f26.6 --> f26.6 + */ static void Ins_NEG( FT_Long* args ) { @@ -2932,12 +3039,12 @@ } - /*************************************************************************/ - /* */ - /* FLOOR[]: FLOOR */ - /* Opcode range: 0x66 */ - /* Stack: f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * FLOOR[]: FLOOR + * Opcode range: 0x66 + * Stack: f26.6 --> f26.6 + */ static void Ins_FLOOR( FT_Long* args ) { @@ -2945,12 +3052,12 @@ } - /*************************************************************************/ - /* */ - /* CEILING[]: CEILING */ - /* Opcode range: 0x67 */ - /* Stack: f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * CEILING[]: CEILING + * Opcode range: 0x67 + * Stack: f26.6 --> f26.6 + */ static void Ins_CEILING( FT_Long* args ) { @@ -2958,12 +3065,12 @@ } - /*************************************************************************/ - /* */ - /* RS[]: Read Store */ - /* Opcode range: 0x43 */ - /* Stack: uint32 --> uint32 */ - /* */ + /************************************************************************** + * + * RS[]: Read Store + * Opcode range: 0x43 + * Stack: uint32 --> uint32 + */ static void Ins_RS( TT_ExecContext exc, FT_Long* args ) @@ -3004,12 +3111,12 @@ } - /*************************************************************************/ - /* */ - /* WS[]: Write Store */ - /* Opcode range: 0x42 */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * WS[]: Write Store + * Opcode range: 0x42 + * Stack: uint32 uint32 --> + */ static void Ins_WS( TT_ExecContext exc, FT_Long* args ) @@ -3027,12 +3134,12 @@ } - /*************************************************************************/ - /* */ - /* WCVTP[]: Write CVT in Pixel units */ - /* Opcode range: 0x44 */ - /* Stack: f26.6 uint32 --> */ - /* */ + /************************************************************************** + * + * WCVTP[]: Write CVT in Pixel units + * Opcode range: 0x44 + * Stack: f26.6 uint32 --> + */ static void Ins_WCVTP( TT_ExecContext exc, FT_Long* args ) @@ -3050,12 +3157,12 @@ } - /*************************************************************************/ - /* */ - /* WCVTF[]: Write CVT in Funits */ - /* Opcode range: 0x70 */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * WCVTF[]: Write CVT in Funits + * Opcode range: 0x70 + * Stack: uint32 uint32 --> + */ static void Ins_WCVTF( TT_ExecContext exc, FT_Long* args ) @@ -3073,12 +3180,12 @@ } - /*************************************************************************/ - /* */ - /* RCVT[]: Read CVT */ - /* Opcode range: 0x45 */ - /* Stack: uint32 --> f26.6 */ - /* */ + /************************************************************************** + * + * RCVT[]: Read CVT + * Opcode range: 0x45 + * Stack: uint32 --> f26.6 + */ static void Ins_RCVT( TT_ExecContext exc, FT_Long* args ) @@ -3098,12 +3205,12 @@ } - /*************************************************************************/ - /* */ - /* AA[]: Adjust Angle */ - /* Opcode range: 0x7F */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * AA[]: Adjust Angle + * Opcode range: 0x7F + * Stack: uint32 --> + */ static void Ins_AA( void ) { @@ -3111,14 +3218,14 @@ } - /*************************************************************************/ - /* */ - /* DEBUG[]: DEBUG. Unsupported. */ - /* Opcode range: 0x4F */ - /* Stack: uint32 --> */ - /* */ - /* Note: The original instruction pops a value from the stack. */ - /* */ + /************************************************************************** + * + * DEBUG[]: DEBUG. Unsupported. + * Opcode range: 0x4F + * Stack: uint32 --> + * + * Note: The original instruction pops a value from the stack. + */ static void Ins_DEBUG( TT_ExecContext exc ) { @@ -3126,12 +3233,12 @@ } - /*************************************************************************/ - /* */ - /* ROUND[ab]: ROUND value */ - /* Opcode range: 0x68-0x6B */ - /* Stack: f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * ROUND[ab]: ROUND value + * Opcode range: 0x68-0x6B + * Stack: f26.6 --> f26.6 + */ static void Ins_ROUND( TT_ExecContext exc, FT_Long* args ) @@ -3143,12 +3250,12 @@ } - /*************************************************************************/ - /* */ - /* NROUND[ab]: No ROUNDing of value */ - /* Opcode range: 0x6C-0x6F */ - /* Stack: f26.6 --> f26.6 */ - /* */ + /************************************************************************** + * + * NROUND[ab]: No ROUNDing of value + * Opcode range: 0x6C-0x6F + * Stack: f26.6 --> f26.6 + */ static void Ins_NROUND( TT_ExecContext exc, FT_Long* args ) @@ -3160,12 +3267,12 @@ } - /*************************************************************************/ - /* */ - /* MAX[]: MAXimum */ - /* Opcode range: 0x8B */ - /* Stack: int32? int32? --> int32 */ - /* */ + /************************************************************************** + * + * MAX[]: MAXimum + * Opcode range: 0x8B + * Stack: int32? int32? --> int32 + */ static void Ins_MAX( FT_Long* args ) { @@ -3174,12 +3281,12 @@ } - /*************************************************************************/ - /* */ - /* MIN[]: MINimum */ - /* Opcode range: 0x8C */ - /* Stack: int32? int32? --> int32 */ - /* */ + /************************************************************************** + * + * MIN[]: MINimum + * Opcode range: 0x8C + * Stack: int32? int32? --> int32 + */ static void Ins_MIN( FT_Long* args ) { @@ -3188,12 +3295,12 @@ } - /*************************************************************************/ - /* */ - /* MINDEX[]: Move INDEXed element */ - /* Opcode range: 0x26 */ - /* Stack: int32? --> StkElt */ - /* */ + /************************************************************************** + * + * MINDEX[]: Move INDEXed element + * Opcode range: 0x26 + * Stack: int32? --> StkElt + */ static void Ins_MINDEX( TT_ExecContext exc, FT_Long* args ) @@ -3221,12 +3328,12 @@ } - /*************************************************************************/ - /* */ - /* CINDEX[]: Copy INDEXed element */ - /* Opcode range: 0x25 */ - /* Stack: int32 --> StkElt */ - /* */ + /************************************************************************** + * + * CINDEX[]: Copy INDEXed element + * Opcode range: 0x25 + * Stack: int32 --> StkElt + */ static void Ins_CINDEX( TT_ExecContext exc, FT_Long* args ) @@ -3247,12 +3354,12 @@ } - /*************************************************************************/ - /* */ - /* ROLL[]: ROLL top three elements */ - /* Opcode range: 0x8A */ - /* Stack: 3 * StkElt --> 3 * StkElt */ - /* */ + /************************************************************************** + * + * ROLL[]: ROLL top three elements + * Opcode range: 0x8A + * Stack: 3 * StkElt --> 3 * StkElt + */ static void Ins_ROLL( FT_Long* args ) { @@ -3269,19 +3376,19 @@ } - /*************************************************************************/ - /* */ - /* MANAGING THE FLOW OF CONTROL */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * MANAGING THE FLOW OF CONTROL + * + */ - /*************************************************************************/ - /* */ - /* SLOOP[]: Set LOOP variable */ - /* Opcode range: 0x17 */ - /* Stack: int32? --> */ - /* */ + /************************************************************************** + * + * SLOOP[]: Set LOOP variable + * Opcode range: 0x17 + * Stack: int32? --> + */ static void Ins_SLOOP( TT_ExecContext exc, FT_Long* args ) @@ -3323,12 +3430,12 @@ } - /*************************************************************************/ - /* */ - /* IF[]: IF test */ - /* Opcode range: 0x58 */ - /* Stack: StkElt --> */ - /* */ + /************************************************************************** + * + * IF[]: IF test + * Opcode range: 0x58 + * Stack: StkElt --> + */ static void Ins_IF( TT_ExecContext exc, FT_Long* args ) @@ -3367,12 +3474,12 @@ } - /*************************************************************************/ - /* */ - /* ELSE[]: ELSE */ - /* Opcode range: 0x1B */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * ELSE[]: ELSE + * Opcode range: 0x1B + * Stack: --> + */ static void Ins_ELSE( TT_ExecContext exc ) { @@ -3400,12 +3507,12 @@ } - /*************************************************************************/ - /* */ - /* EIF[]: End IF */ - /* Opcode range: 0x59 */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * EIF[]: End IF + * Opcode range: 0x59 + * Stack: --> + */ static void Ins_EIF( void ) { @@ -3413,12 +3520,12 @@ } - /*************************************************************************/ - /* */ - /* JMPR[]: JuMP Relative */ - /* Opcode range: 0x1C */ - /* Stack: int32 --> */ - /* */ + /************************************************************************** + * + * JMPR[]: JuMP Relative + * Opcode range: 0x1C + * Stack: int32 --> + */ static void Ins_JMPR( TT_ExecContext exc, FT_Long* args ) @@ -3448,12 +3555,12 @@ } - /*************************************************************************/ - /* */ - /* JROT[]: Jump Relative On True */ - /* Opcode range: 0x78 */ - /* Stack: StkElt int32 --> */ - /* */ + /************************************************************************** + * + * JROT[]: Jump Relative On True + * Opcode range: 0x78 + * Stack: StkElt int32 --> + */ static void Ins_JROT( TT_ExecContext exc, FT_Long* args ) @@ -3463,12 +3570,12 @@ } - /*************************************************************************/ - /* */ - /* JROF[]: Jump Relative On False */ - /* Opcode range: 0x79 */ - /* Stack: StkElt int32 --> */ - /* */ + /************************************************************************** + * + * JROF[]: Jump Relative On False + * Opcode range: 0x79 + * Stack: StkElt int32 --> + */ static void Ins_JROF( TT_ExecContext exc, FT_Long* args ) @@ -3478,19 +3585,19 @@ } - /*************************************************************************/ - /* */ - /* DEFINING AND USING FUNCTIONS AND INSTRUCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * DEFINING AND USING FUNCTIONS AND INSTRUCTIONS + * + */ - /*************************************************************************/ - /* */ - /* FDEF[]: Function DEFinition */ - /* Opcode range: 0x2C */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * FDEF[]: Function DEFinition + * Opcode range: 0x2C + * Stack: uint32 --> + */ static void Ins_FDEF( TT_ExecContext exc, FT_Long* args ) @@ -3788,12 +3895,12 @@ } - /*************************************************************************/ - /* */ - /* ENDF[]: END Function definition */ - /* Opcode range: 0x2D */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * ENDF[]: END Function definition + * Opcode range: 0x2D + * Stack: --> + */ static void Ins_ENDF( TT_ExecContext exc ) { @@ -3837,12 +3944,12 @@ } - /*************************************************************************/ - /* */ - /* CALL[]: CALL function */ - /* Opcode range: 0x2B */ - /* Stack: uint32? --> */ - /* */ + /************************************************************************** + * + * CALL[]: CALL function + * Opcode range: 0x2B + * Stack: uint32? --> + */ static void Ins_CALL( TT_ExecContext exc, FT_Long* args ) @@ -3926,12 +4033,12 @@ } - /*************************************************************************/ - /* */ - /* LOOPCALL[]: LOOP and CALL function */ - /* Opcode range: 0x2A */ - /* Stack: uint32? Eint16? --> */ - /* */ + /************************************************************************** + * + * LOOPCALL[]: LOOP and CALL function + * Opcode range: 0x2A + * Stack: uint32? Eint16? --> + */ static void Ins_LOOPCALL( TT_ExecContext exc, FT_Long* args ) @@ -4019,12 +4126,12 @@ } - /*************************************************************************/ - /* */ - /* IDEF[]: Instruction DEFinition */ - /* Opcode range: 0x89 */ - /* Stack: Eint8 --> */ - /* */ + /************************************************************************** + * + * IDEF[]: Instruction DEFinition + * Opcode range: 0x89 + * Stack: Eint8 --> + */ static void Ins_IDEF( TT_ExecContext exc, FT_Long* args ) @@ -4094,19 +4201,19 @@ } - /*************************************************************************/ - /* */ - /* PUSHING DATA ONTO THE INTERPRETER STACK */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * PUSHING DATA ONTO THE INTERPRETER STACK + * + */ - /*************************************************************************/ - /* */ - /* NPUSHB[]: PUSH N Bytes */ - /* Opcode range: 0x40 */ - /* Stack: --> uint32... */ - /* */ + /************************************************************************** + * + * NPUSHB[]: PUSH N Bytes + * Opcode range: 0x40 + * Stack: --> uint32... + */ static void Ins_NPUSHB( TT_ExecContext exc, FT_Long* args ) @@ -4129,12 +4236,12 @@ } - /*************************************************************************/ - /* */ - /* NPUSHW[]: PUSH N Words */ - /* Opcode range: 0x41 */ - /* Stack: --> int32... */ - /* */ + /************************************************************************** + * + * NPUSHW[]: PUSH N Words + * Opcode range: 0x41 + * Stack: --> int32... + */ static void Ins_NPUSHW( TT_ExecContext exc, FT_Long* args ) @@ -4160,12 +4267,12 @@ } - /*************************************************************************/ - /* */ - /* PUSHB[abc]: PUSH Bytes */ - /* Opcode range: 0xB0-0xB7 */ - /* Stack: --> uint32... */ - /* */ + /************************************************************************** + * + * PUSHB[abc]: PUSH Bytes + * Opcode range: 0xB0-0xB7 + * Stack: --> uint32... + */ static void Ins_PUSHB( TT_ExecContext exc, FT_Long* args ) @@ -4186,12 +4293,12 @@ } - /*************************************************************************/ - /* */ - /* PUSHW[abc]: PUSH Words */ - /* Opcode range: 0xB8-0xBF */ - /* Stack: --> int32... */ - /* */ + /************************************************************************** + * + * PUSHW[abc]: PUSH Words + * Opcode range: 0xB8-0xBF + * Stack: --> int32... + */ static void Ins_PUSHW( TT_ExecContext exc, FT_Long* args ) @@ -4216,11 +4323,11 @@ } - /*************************************************************************/ - /* */ - /* MANAGING THE GRAPHICS STATE */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * MANAGING THE GRAPHICS STATE + * + */ static FT_Bool @@ -4274,20 +4381,20 @@ } - /*************************************************************************/ - /* */ - /* SVTCA[a]: Set (F and P) Vectors to Coordinate Axis */ - /* Opcode range: 0x00-0x01 */ - /* Stack: --> */ - /* */ - /* SPvTCA[a]: Set PVector to Coordinate Axis */ - /* Opcode range: 0x02-0x03 */ - /* Stack: --> */ - /* */ - /* SFvTCA[a]: Set FVector to Coordinate Axis */ - /* Opcode range: 0x04-0x05 */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * SVTCA[a]: Set (F and P) Vectors to Coordinate Axis + * Opcode range: 0x00-0x01 + * Stack: --> + * + * SPvTCA[a]: Set PVector to Coordinate Axis + * Opcode range: 0x02-0x03 + * Stack: --> + * + * SFvTCA[a]: Set FVector to Coordinate Axis + * Opcode range: 0x04-0x05 + * Stack: --> + */ static void Ins_SxyTCA( TT_ExecContext exc ) { @@ -4318,12 +4425,12 @@ } - /*************************************************************************/ - /* */ - /* SPvTL[a]: Set PVector To Line */ - /* Opcode range: 0x06-0x07 */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * SPvTL[a]: Set PVector To Line + * Opcode range: 0x06-0x07 + * Stack: uint32 uint32 --> + */ static void Ins_SPVTL( TT_ExecContext exc, FT_Long* args ) @@ -4339,12 +4446,12 @@ } - /*************************************************************************/ - /* */ - /* SFvTL[a]: Set FVector To Line */ - /* Opcode range: 0x08-0x09 */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * SFvTL[a]: Set FVector To Line + * Opcode range: 0x08-0x09 + * Stack: uint32 uint32 --> + */ static void Ins_SFVTL( TT_ExecContext exc, FT_Long* args ) @@ -4359,12 +4466,12 @@ } - /*************************************************************************/ - /* */ - /* SFvTPv[]: Set FVector To PVector */ - /* Opcode range: 0x0E */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * SFvTPv[]: Set FVector To PVector + * Opcode range: 0x0E + * Stack: --> + */ static void Ins_SFVTPV( TT_ExecContext exc ) { @@ -4373,12 +4480,12 @@ } - /*************************************************************************/ - /* */ - /* SPvFS[]: Set PVector From Stack */ - /* Opcode range: 0x0A */ - /* Stack: f2.14 f2.14 --> */ - /* */ + /************************************************************************** + * + * SPvFS[]: Set PVector From Stack + * Opcode range: 0x0A + * Stack: f2.14 f2.14 --> + */ static void Ins_SPVFS( TT_ExecContext exc, FT_Long* args ) @@ -4400,12 +4507,12 @@ } - /*************************************************************************/ - /* */ - /* SFvFS[]: Set FVector From Stack */ - /* Opcode range: 0x0B */ - /* Stack: f2.14 f2.14 --> */ - /* */ + /************************************************************************** + * + * SFvFS[]: Set FVector From Stack + * Opcode range: 0x0B + * Stack: f2.14 f2.14 --> + */ static void Ins_SFVFS( TT_ExecContext exc, FT_Long* args ) @@ -4425,12 +4532,12 @@ } - /*************************************************************************/ - /* */ - /* GPv[]: Get Projection Vector */ - /* Opcode range: 0x0C */ - /* Stack: ef2.14 --> ef2.14 */ - /* */ + /************************************************************************** + * + * GPv[]: Get Projection Vector + * Opcode range: 0x0C + * Stack: ef2.14 --> ef2.14 + */ static void Ins_GPV( TT_ExecContext exc, FT_Long* args ) @@ -4440,12 +4547,12 @@ } - /*************************************************************************/ - /* */ - /* GFv[]: Get Freedom Vector */ - /* Opcode range: 0x0D */ - /* Stack: ef2.14 --> ef2.14 */ - /* */ + /************************************************************************** + * + * GFv[]: Get Freedom Vector + * Opcode range: 0x0D + * Stack: ef2.14 --> ef2.14 + */ static void Ins_GFV( TT_ExecContext exc, FT_Long* args ) @@ -4455,12 +4562,12 @@ } - /*************************************************************************/ - /* */ - /* SRP0[]: Set Reference Point 0 */ - /* Opcode range: 0x10 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SRP0[]: Set Reference Point 0 + * Opcode range: 0x10 + * Stack: uint32 --> + */ static void Ins_SRP0( TT_ExecContext exc, FT_Long* args ) @@ -4469,12 +4576,12 @@ } - /*************************************************************************/ - /* */ - /* SRP1[]: Set Reference Point 1 */ - /* Opcode range: 0x11 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SRP1[]: Set Reference Point 1 + * Opcode range: 0x11 + * Stack: uint32 --> + */ static void Ins_SRP1( TT_ExecContext exc, FT_Long* args ) @@ -4483,12 +4590,12 @@ } - /*************************************************************************/ - /* */ - /* SRP2[]: Set Reference Point 2 */ - /* Opcode range: 0x12 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SRP2[]: Set Reference Point 2 + * Opcode range: 0x12 + * Stack: uint32 --> + */ static void Ins_SRP2( TT_ExecContext exc, FT_Long* args ) @@ -4497,12 +4604,12 @@ } - /*************************************************************************/ - /* */ - /* SMD[]: Set Minimum Distance */ - /* Opcode range: 0x1A */ - /* Stack: f26.6 --> */ - /* */ + /************************************************************************** + * + * SMD[]: Set Minimum Distance + * Opcode range: 0x1A + * Stack: f26.6 --> + */ static void Ins_SMD( TT_ExecContext exc, FT_Long* args ) @@ -4511,12 +4618,12 @@ } - /*************************************************************************/ - /* */ - /* SCVTCI[]: Set Control Value Table Cut In */ - /* Opcode range: 0x1D */ - /* Stack: f26.6 --> */ - /* */ + /************************************************************************** + * + * SCVTCI[]: Set Control Value Table Cut In + * Opcode range: 0x1D + * Stack: f26.6 --> + */ static void Ins_SCVTCI( TT_ExecContext exc, FT_Long* args ) @@ -4525,12 +4632,12 @@ } - /*************************************************************************/ - /* */ - /* SSWCI[]: Set Single Width Cut In */ - /* Opcode range: 0x1E */ - /* Stack: f26.6 --> */ - /* */ + /************************************************************************** + * + * SSWCI[]: Set Single Width Cut In + * Opcode range: 0x1E + * Stack: f26.6 --> + */ static void Ins_SSWCI( TT_ExecContext exc, FT_Long* args ) @@ -4539,12 +4646,12 @@ } - /*************************************************************************/ - /* */ - /* SSW[]: Set Single Width */ - /* Opcode range: 0x1F */ - /* Stack: int32? --> */ - /* */ + /************************************************************************** + * + * SSW[]: Set Single Width + * Opcode range: 0x1F + * Stack: int32? --> + */ static void Ins_SSW( TT_ExecContext exc, FT_Long* args ) @@ -4554,12 +4661,12 @@ } - /*************************************************************************/ - /* */ - /* FLIPON[]: Set auto-FLIP to ON */ - /* Opcode range: 0x4D */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * FLIPON[]: Set auto-FLIP to ON + * Opcode range: 0x4D + * Stack: --> + */ static void Ins_FLIPON( TT_ExecContext exc ) { @@ -4567,12 +4674,12 @@ } - /*************************************************************************/ - /* */ - /* FLIPOFF[]: Set auto-FLIP to OFF */ - /* Opcode range: 0x4E */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * FLIPOFF[]: Set auto-FLIP to OFF + * Opcode range: 0x4E + * Stack: --> + */ static void Ins_FLIPOFF( TT_ExecContext exc ) { @@ -4580,12 +4687,12 @@ } - /*************************************************************************/ - /* */ - /* SANGW[]: Set ANGle Weight */ - /* Opcode range: 0x7E */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SANGW[]: Set ANGle Weight + * Opcode range: 0x7E + * Stack: uint32 --> + */ static void Ins_SANGW( void ) { @@ -4593,12 +4700,12 @@ } - /*************************************************************************/ - /* */ - /* SDB[]: Set Delta Base */ - /* Opcode range: 0x5E */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SDB[]: Set Delta Base + * Opcode range: 0x5E + * Stack: uint32 --> + */ static void Ins_SDB( TT_ExecContext exc, FT_Long* args ) @@ -4607,12 +4714,12 @@ } - /*************************************************************************/ - /* */ - /* SDS[]: Set Delta Shift */ - /* Opcode range: 0x5F */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SDS[]: Set Delta Shift + * Opcode range: 0x5F + * Stack: uint32 --> + */ static void Ins_SDS( TT_ExecContext exc, FT_Long* args ) @@ -4624,12 +4731,12 @@ } - /*************************************************************************/ - /* */ - /* RTHG[]: Round To Half Grid */ - /* Opcode range: 0x19 */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * RTHG[]: Round To Half Grid + * Opcode range: 0x19 + * Stack: --> + */ static void Ins_RTHG( TT_ExecContext exc ) { @@ -4638,12 +4745,12 @@ } - /*************************************************************************/ - /* */ - /* RTG[]: Round To Grid */ - /* Opcode range: 0x18 */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * RTG[]: Round To Grid + * Opcode range: 0x18 + * Stack: --> + */ static void Ins_RTG( TT_ExecContext exc ) { @@ -4652,11 +4759,11 @@ } - /*************************************************************************/ - /* RTDG[]: Round To Double Grid */ - /* Opcode range: 0x3D */ - /* Stack: --> */ - /* */ + /************************************************************************** + * RTDG[]: Round To Double Grid + * Opcode range: 0x3D + * Stack: --> + */ static void Ins_RTDG( TT_ExecContext exc ) { @@ -4665,11 +4772,11 @@ } - /*************************************************************************/ - /* RUTG[]: Round Up To Grid */ - /* Opcode range: 0x7C */ - /* Stack: --> */ - /* */ + /************************************************************************** + * RUTG[]: Round Up To Grid + * Opcode range: 0x7C + * Stack: --> + */ static void Ins_RUTG( TT_ExecContext exc ) { @@ -4678,12 +4785,12 @@ } - /*************************************************************************/ - /* */ - /* RDTG[]: Round Down To Grid */ - /* Opcode range: 0x7D */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * RDTG[]: Round Down To Grid + * Opcode range: 0x7D + * Stack: --> + */ static void Ins_RDTG( TT_ExecContext exc ) { @@ -4692,12 +4799,12 @@ } - /*************************************************************************/ - /* */ - /* ROFF[]: Round OFF */ - /* Opcode range: 0x7A */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * ROFF[]: Round OFF + * Opcode range: 0x7A + * Stack: --> + */ static void Ins_ROFF( TT_ExecContext exc ) { @@ -4706,12 +4813,12 @@ } - /*************************************************************************/ - /* */ - /* SROUND[]: Super ROUND */ - /* Opcode range: 0x76 */ - /* Stack: Eint8 --> */ - /* */ + /************************************************************************** + * + * SROUND[]: Super ROUND + * Opcode range: 0x76 + * Stack: Eint8 --> + */ static void Ins_SROUND( TT_ExecContext exc, FT_Long* args ) @@ -4723,12 +4830,12 @@ } - /*************************************************************************/ - /* */ - /* S45ROUND[]: Super ROUND 45 degrees */ - /* Opcode range: 0x77 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * S45ROUND[]: Super ROUND 45 degrees + * Opcode range: 0x77 + * Stack: uint32 --> + */ static void Ins_S45ROUND( TT_ExecContext exc, FT_Long* args ) @@ -4740,15 +4847,15 @@ } - /*************************************************************************/ - /* */ - /* GC[a]: Get Coordinate projected onto */ - /* Opcode range: 0x46-0x47 */ - /* Stack: uint32 --> f26.6 */ - /* */ - /* XXX: UNDOCUMENTED: Measures from the original glyph must be taken */ - /* along the dual projection vector! */ - /* */ + /************************************************************************** + * + * GC[a]: Get Coordinate projected onto + * Opcode range: 0x46-0x47 + * Stack: uint32 --> f26.6 + * + * XXX: UNDOCUMENTED: Measures from the original glyph must be taken + * along the dual projection vector! + */ static void Ins_GC( TT_ExecContext exc, FT_Long* args ) @@ -4777,16 +4884,16 @@ } - /*************************************************************************/ - /* */ - /* SCFS[]: Set Coordinate From Stack */ - /* Opcode range: 0x48 */ - /* Stack: f26.6 uint32 --> */ - /* */ - /* Formula: */ - /* */ - /* OA := OA + ( value - OA.p )/( f.p ) * f */ - /* */ + /************************************************************************** + * + * SCFS[]: Set Coordinate From Stack + * Opcode range: 0x48 + * Stack: f26.6 uint32 --> + * + * Formula: + * + * OA := OA + ( value - OA.p )/( f.p ) * f + */ static void Ins_SCFS( TT_ExecContext exc, FT_Long* args ) @@ -4815,21 +4922,21 @@ } - /*************************************************************************/ - /* */ - /* MD[a]: Measure Distance */ - /* Opcode range: 0x49-0x4A */ - /* Stack: uint32 uint32 --> f26.6 */ - /* */ - /* XXX: UNDOCUMENTED: Measure taken in the original glyph must be along */ - /* the dual projection vector. */ - /* */ - /* XXX: UNDOCUMENTED: Flag attributes are inverted! */ - /* 0 => measure distance in original outline */ - /* 1 => measure distance in grid-fitted outline */ - /* */ - /* XXX: UNDOCUMENTED: `zp0 - zp1', and not `zp2 - zp1! */ - /* */ + /************************************************************************** + * + * MD[a]: Measure Distance + * Opcode range: 0x49-0x4A + * Stack: uint32 uint32 --> f26.6 + * + * XXX: UNDOCUMENTED: Measure taken in the original glyph must be along + * the dual projection vector. + * + * XXX: UNDOCUMENTED: Flag attributes are inverted! + * 0 => measure distance in original outline + * 1 => measure distance in grid-fitted outline + * + * XXX: UNDOCUMENTED: `zp0 - zp1', and not `zp2 - zp1! + */ static void Ins_MD( TT_ExecContext exc, FT_Long* args ) @@ -4902,12 +5009,12 @@ } - /*************************************************************************/ - /* */ - /* SDPvTL[a]: Set Dual PVector to Line */ - /* Opcode range: 0x86-0x87 */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * SDPvTL[a]: Set Dual PVector to Line + * Opcode range: 0x86-0x87 + * Stack: uint32 uint32 --> + */ static void Ins_SDPVTL( TT_ExecContext exc, FT_Long* args ) @@ -4985,12 +5092,12 @@ } - /*************************************************************************/ - /* */ - /* SZP0[]: Set Zone Pointer 0 */ - /* Opcode range: 0x13 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SZP0[]: Set Zone Pointer 0 + * Opcode range: 0x13 + * Stack: uint32 --> + */ static void Ins_SZP0( TT_ExecContext exc, FT_Long* args ) @@ -5015,12 +5122,12 @@ } - /*************************************************************************/ - /* */ - /* SZP1[]: Set Zone Pointer 1 */ - /* Opcode range: 0x14 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SZP1[]: Set Zone Pointer 1 + * Opcode range: 0x14 + * Stack: uint32 --> + */ static void Ins_SZP1( TT_ExecContext exc, FT_Long* args ) @@ -5045,12 +5152,12 @@ } - /*************************************************************************/ - /* */ - /* SZP2[]: Set Zone Pointer 2 */ - /* Opcode range: 0x15 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SZP2[]: Set Zone Pointer 2 + * Opcode range: 0x15 + * Stack: uint32 --> + */ static void Ins_SZP2( TT_ExecContext exc, FT_Long* args ) @@ -5075,12 +5182,12 @@ } - /*************************************************************************/ - /* */ - /* SZPS[]: Set Zone PointerS */ - /* Opcode range: 0x16 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SZPS[]: Set Zone PointerS + * Opcode range: 0x16 + * Stack: uint32 --> + */ static void Ins_SZPS( TT_ExecContext exc, FT_Long* args ) @@ -5110,12 +5217,12 @@ } - /*************************************************************************/ - /* */ - /* INSTCTRL[]: INSTruction ConTRoL */ - /* Opcode range: 0x8E */ - /* Stack: int32 int32 --> */ - /* */ + /************************************************************************** + * + * INSTCTRL[]: INSTruction ConTRoL + * Opcode range: 0x8E + * Stack: int32 int32 --> + */ static void Ins_INSTCTRL( TT_ExecContext exc, FT_Long* args ) @@ -5172,12 +5279,12 @@ } - /*************************************************************************/ - /* */ - /* SCANCTRL[]: SCAN ConTRoL */ - /* Opcode range: 0x85 */ - /* Stack: uint32? --> */ - /* */ + /************************************************************************** + * + * SCANCTRL[]: SCAN ConTRoL + * Opcode range: 0x85 + * Stack: uint32? --> + */ static void Ins_SCANCTRL( TT_ExecContext exc, FT_Long* args ) @@ -5219,12 +5326,12 @@ } - /*************************************************************************/ - /* */ - /* SCANTYPE[]: SCAN TYPE */ - /* Opcode range: 0x8D */ - /* Stack: uint16 --> */ - /* */ + /************************************************************************** + * + * SCANTYPE[]: SCAN TYPE + * Opcode range: 0x8D + * Stack: uint16 --> + */ static void Ins_SCANTYPE( TT_ExecContext exc, FT_Long* args ) @@ -5234,19 +5341,19 @@ } - /*************************************************************************/ - /* */ - /* MANAGING OUTLINES */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * MANAGING OUTLINES + * + */ - /*************************************************************************/ - /* */ - /* FLIPPT[]: FLIP PoinT */ - /* Opcode range: 0x80 */ - /* Stack: uint32... --> */ - /* */ + /************************************************************************** + * + * FLIPPT[]: FLIP PoinT + * Opcode range: 0x80 + * Stack: uint32... --> + */ static void Ins_FLIPPT( TT_ExecContext exc ) { @@ -5295,12 +5402,12 @@ } - /*************************************************************************/ - /* */ - /* FLIPRGON[]: FLIP RanGe ON */ - /* Opcode range: 0x81 */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * FLIPRGON[]: FLIP RanGe ON + * Opcode range: 0x81 + * Stack: uint32 uint32 --> + */ static void Ins_FLIPRGON( TT_ExecContext exc, FT_Long* args ) @@ -5333,12 +5440,12 @@ } - /*************************************************************************/ - /* */ - /* FLIPRGOFF: FLIP RanGe OFF */ - /* Opcode range: 0x82 */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * FLIPRGOFF: FLIP RanGe OFF + * Opcode range: 0x82 + * Stack: uint32 uint32 --> + */ static void Ins_FLIPRGOFF( TT_ExecContext exc, FT_Long* args ) @@ -5450,12 +5557,12 @@ } - /*************************************************************************/ - /* */ - /* SHP[a]: SHift Point by the last point */ - /* Opcode range: 0x32-0x33 */ - /* Stack: uint32... --> */ - /* */ + /************************************************************************** + * + * SHP[a]: SHift Point by the last point + * Opcode range: 0x32-0x33 + * Stack: uint32... --> + */ static void Ins_SHP( TT_ExecContext exc ) { @@ -5507,16 +5614,16 @@ } - /*************************************************************************/ - /* */ - /* SHC[a]: SHift Contour */ - /* Opcode range: 0x34-35 */ - /* Stack: uint32 --> */ - /* */ - /* UNDOCUMENTED: According to Greg Hitchcock, there is one (virtual) */ - /* contour in the twilight zone, namely contour number */ - /* zero which includes all points of it. */ - /* */ + /************************************************************************** + * + * SHC[a]: SHift Contour + * Opcode range: 0x34-35 + * Stack: uint32 --> + * + * UNDOCUMENTED: According to Greg Hitchcock, there is one (virtual) + * contour in the twilight zone, namely contour number + * zero which includes all points of it. + */ static void Ins_SHC( TT_ExecContext exc, FT_Long* args ) @@ -5563,12 +5670,12 @@ } - /*************************************************************************/ - /* */ - /* SHZ[a]: SHift Zone */ - /* Opcode range: 0x36-37 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * SHZ[a]: SHift Zone + * Opcode range: 0x36-37 + * Stack: uint32 --> + */ static void Ins_SHZ( TT_ExecContext exc, FT_Long* args ) @@ -5611,12 +5718,12 @@ } - /*************************************************************************/ - /* */ - /* SHPIX[]: SHift points by a PIXel amount */ - /* Opcode range: 0x38 */ - /* Stack: f26.6 uint32... --> */ - /* */ + /************************************************************************** + * + * SHPIX[]: SHift points by a PIXel amount + * Opcode range: 0x38 + * Stack: f26.6 uint32... --> + */ static void Ins_SHPIX( TT_ExecContext exc, FT_Long* args ) @@ -5771,12 +5878,12 @@ } - /*************************************************************************/ - /* */ - /* MSIRP[a]: Move Stack Indirect Relative Position */ - /* Opcode range: 0x3A-0x3B */ - /* Stack: f26.6 uint32 --> */ - /* */ + /************************************************************************** + * + * MSIRP[a]: Move Stack Indirect Relative Position + * Opcode range: 0x3A-0x3B + * Stack: f26.6 uint32 --> + */ static void Ins_MSIRP( TT_ExecContext exc, FT_Long* args ) @@ -5846,12 +5953,12 @@ } - /*************************************************************************/ - /* */ - /* MDAP[a]: Move Direct Absolute Point */ - /* Opcode range: 0x2E-0x2F */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * MDAP[a]: Move Direct Absolute Point + * Opcode range: 0x2E-0x2F + * Stack: uint32 --> + */ static void Ins_MDAP( TT_ExecContext exc, FT_Long* args ) @@ -5900,12 +6007,12 @@ } - /*************************************************************************/ - /* */ - /* MIAP[a]: Move Indirect Absolute Point */ - /* Opcode range: 0x3E-0x3F */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * MIAP[a]: Move Indirect Absolute Point + * Opcode range: 0x3E-0x3F + * Stack: uint32 uint32 --> + */ static void Ins_MIAP( TT_ExecContext exc, FT_Long* args ) @@ -6020,12 +6127,12 @@ } - /*************************************************************************/ - /* */ - /* MDRP[abcde]: Move Direct Relative Point */ - /* Opcode range: 0xC0-0xDF */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * MDRP[abcde]: Move Direct Relative Point + * Opcode range: 0xC0-0xDF + * Stack: uint32 --> + */ static void Ins_MDRP( TT_ExecContext exc, FT_Long* args ) @@ -6164,12 +6271,12 @@ } - /*************************************************************************/ - /* */ - /* MIRP[abcde]: Move Indirect Relative Point */ - /* Opcode range: 0xE0-0xFF */ - /* Stack: int32? uint32 --> */ - /* */ + /************************************************************************** + * + * MIRP[abcde]: Move Indirect Relative Point + * Opcode range: 0xE0-0xFF + * Stack: int32? uint32 --> + */ static void Ins_MIRP( TT_ExecContext exc, FT_Long* args ) @@ -6189,6 +6296,8 @@ FT_Bool reverse_move = FALSE; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + FT_F26Dot6 delta; + minimum_distance = exc->GS.minimum_distance; control_value_cutin = exc->GS.control_value_cutin; @@ -6221,8 +6330,11 @@ /* single width test */ - if ( FT_ABS( cvt_dist - exc->GS.single_width_value ) < - exc->GS.single_width_cutin ) + delta = SUB_LONG( cvt_dist, exc->GS.single_width_value ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + + if ( delta < exc->GS.single_width_cutin ) { if ( cvt_dist >= 0 ) cvt_dist = exc->GS.single_width_value; @@ -6251,7 +6363,7 @@ if ( exc->GS.auto_flip ) { if ( ( org_dist ^ cvt_dist ) < 0 ) - cvt_dist = -cvt_dist; + cvt_dist = NEG_LONG( cvt_dist ); } #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY @@ -6276,9 +6388,6 @@ if ( exc->GS.gep0 == exc->GS.gep1 ) { - FT_F26Dot6 delta; - - /* XXX: According to Greg Hitchcock, the following wording is */ /* the right one: */ /* */ @@ -6313,9 +6422,6 @@ exc->ignore_x_mode && exc->GS.gep0 == exc->GS.gep1 ) { - FT_F26Dot6 delta; - - delta = SUB_LONG( cvt_dist, org_dist ); if ( delta < 0 ) delta = NEG_LONG( delta ); @@ -6412,12 +6518,12 @@ } - /*************************************************************************/ - /* */ - /* ALIGNRP[]: ALIGN Relative Point */ - /* Opcode range: 0x3C */ - /* Stack: uint32 uint32... --> */ - /* */ + /************************************************************************** + * + * ALIGNRP[]: ALIGN Relative Point + * Opcode range: 0x3C + * Stack: uint32 uint32... --> + */ static void Ins_ALIGNRP( TT_ExecContext exc ) { @@ -6475,12 +6581,12 @@ } - /*************************************************************************/ - /* */ - /* ISECT[]: moves point to InterSECTion */ - /* Opcode range: 0x0F */ - /* Stack: 5 * uint32 --> */ - /* */ + /************************************************************************** + * + * ISECT[]: moves point to InterSECTion + * Opcode range: 0x0F + * Stack: 5 * uint32 --> + */ static void Ins_ISECT( TT_ExecContext exc, FT_Long* args ) @@ -6571,12 +6677,12 @@ } - /*************************************************************************/ - /* */ - /* ALIGNPTS[]: ALIGN PoinTS */ - /* Opcode range: 0x27 */ - /* Stack: uint32 uint32 --> */ - /* */ + /************************************************************************** + * + * ALIGNPTS[]: ALIGN PoinTS + * Opcode range: 0x27 + * Stack: uint32 uint32 --> + */ static void Ins_ALIGNPTS( TT_ExecContext exc, FT_Long* args ) @@ -6603,12 +6709,12 @@ } - /*************************************************************************/ - /* */ - /* IP[]: Interpolate Point */ - /* Opcode range: 0x39 */ - /* Stack: uint32... --> */ - /* */ + /************************************************************************** + * + * IP[]: Interpolate Point + * Opcode range: 0x39 + * Stack: uint32... --> + */ /* SOMETIMES, DUMBER CODE IS BETTER CODE */ @@ -6763,12 +6869,12 @@ } - /*************************************************************************/ - /* */ - /* UTP[a]: UnTouch Point */ - /* Opcode range: 0x29 */ - /* Stack: uint32 --> */ - /* */ + /************************************************************************** + * + * UTP[a]: UnTouch Point + * Opcode range: 0x29 + * Stack: uint32 --> + */ static void Ins_UTP( TT_ExecContext exc, FT_Long* args ) @@ -6932,12 +7038,12 @@ } - /*************************************************************************/ - /* */ - /* IUP[a]: Interpolate Untouched Points */ - /* Opcode range: 0x30-0x31 */ - /* Stack: --> */ - /* */ + /************************************************************************** + * + * IUP[a]: Interpolate Untouched Points + * Opcode range: 0x30-0x31 + * Stack: --> + */ static void Ins_IUP( TT_ExecContext exc ) { @@ -7060,12 +7166,12 @@ } - /*************************************************************************/ - /* */ - /* DELTAPn[]: DELTA exceptions P1, P2, P3 */ - /* Opcode range: 0x5D,0x71,0x72 */ - /* Stack: uint32 (2 * uint32)... --> */ - /* */ + /************************************************************************** + * + * DELTAPn[]: DELTA exceptions P1, P2, P3 + * Opcode range: 0x5D,0x71,0x72 + * Stack: uint32 (2 * uint32)... --> + */ static void Ins_DELTAP( TT_ExecContext exc, FT_Long* args ) @@ -7142,12 +7248,12 @@ if ( SUBPIXEL_HINTING_INFINALITY ) { /* - * Allow delta move if + * Allow delta move if * - * - not using ignore_x_mode rendering, - * - glyph is specifically set to allow it, or - * - glyph is composite and freedom vector is not in subpixel - * direction. + * - not using ignore_x_mode rendering, + * - glyph is specifically set to allow it, or + * - glyph is composite and freedom vector is not in subpixel + * direction. */ if ( !exc->ignore_x_mode || ( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_DO_DELTAP ) || @@ -7227,12 +7333,12 @@ } - /*************************************************************************/ - /* */ - /* DELTACn[]: DELTA exceptions C1, C2, C3 */ - /* Opcode range: 0x73,0x74,0x75 */ - /* Stack: uint32 (2 * uint32)... --> */ - /* */ + /************************************************************************** + * + * DELTACn[]: DELTA exceptions C1, C2, C3 + * Opcode range: 0x73,0x74,0x75 + * Stack: uint32 (2 * uint32)... --> + */ static void Ins_DELTAC( TT_ExecContext exc, FT_Long* args ) @@ -7305,27 +7411,27 @@ } - /*************************************************************************/ - /* */ - /* MISC. INSTRUCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * MISC. INSTRUCTIONS + * + */ - /*************************************************************************/ - /* */ - /* GETINFO[]: GET INFOrmation */ - /* Opcode range: 0x88 */ - /* Stack: uint32 --> uint32 */ - /* */ - /* XXX: UNDOCUMENTED: Selector bits higher than 9 are currently (May */ - /* 2015) not documented in the OpenType specification. */ - /* */ - /* Selector bit 11 is incorrectly described as bit 8, while the */ - /* real meaning of bit 8 (vertical LCD subpixels) stays */ - /* undocumented. The same mistake can be found in Greg Hitchcock's */ - /* whitepaper. */ - /* */ + /************************************************************************** + * + * GETINFO[]: GET INFOrmation + * Opcode range: 0x88 + * Stack: uint32 --> uint32 + * + * XXX: UNDOCUMENTED: Selector bits higher than 9 are currently (May + * 2015) not documented in the OpenType specification. + * + * Selector bit 11 is incorrectly described as bit 8, while the + * real meaning of bit 8 (vertical LCD subpixels) stays + * undocumented. The same mistake can be found in Greg Hitchcock's + * whitepaper. + */ static void Ins_GETINFO( TT_ExecContext exc, FT_Long* args ) @@ -7337,11 +7443,11 @@ K = 0; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - /********************************/ - /* RASTERIZER VERSION */ - /* Selector Bit: 0 */ - /* Return Bit(s): 0-7 */ - /* */ + /********************************* + * RASTERIZER VERSION + * Selector Bit: 0 + * Return Bit(s): 0-7 + */ if ( SUBPIXEL_HINTING_INFINALITY && ( args[0] & 1 ) != 0 && exc->subpixel_hinting ) @@ -7362,39 +7468,40 @@ if ( ( args[0] & 1 ) != 0 ) K = driver->interpreter_version; - /********************************/ - /* GLYPH ROTATED */ - /* Selector Bit: 1 */ - /* Return Bit(s): 8 */ - /* */ + /********************************* + * GLYPH ROTATED + * Selector Bit: 1 + * Return Bit(s): 8 + */ if ( ( args[0] & 2 ) != 0 && exc->tt_metrics.rotated ) K |= 1 << 8; - /********************************/ - /* GLYPH STRETCHED */ - /* Selector Bit: 2 */ - /* Return Bit(s): 9 */ - /* */ + /********************************* + * GLYPH STRETCHED + * Selector Bit: 2 + * Return Bit(s): 9 + */ if ( ( args[0] & 4 ) != 0 && exc->tt_metrics.stretched ) K |= 1 << 9; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /********************************/ - /* VARIATION GLYPH */ - /* Selector Bit: 3 */ - /* Return Bit(s): 10 */ - /* */ - /* XXX: UNDOCUMENTED! */ + /********************************* + * VARIATION GLYPH + * Selector Bit: 3 + * Return Bit(s): 10 + * + * XXX: UNDOCUMENTED! + */ if ( (args[0] & 8 ) != 0 && exc->face->blend ) K |= 1 << 10; #endif - /********************************/ - /* BI-LEVEL HINTING AND */ - /* GRAYSCALE RENDERING */ - /* Selector Bit: 5 */ - /* Return Bit(s): 12 */ - /* */ + /********************************* + * BI-LEVEL HINTING AND + * GRAYSCALE RENDERING + * Selector Bit: 5 + * Return Bit(s): 12 + */ if ( ( args[0] & 32 ) != 0 && exc->grayscale ) K |= 1 << 12; @@ -7405,50 +7512,54 @@ /* Bold Italic'. */ if ( SUBPIXEL_HINTING_MINIMAL && exc->subpixel_hinting_lean ) { - /********************************/ - /* HINTING FOR SUBPIXEL */ - /* Selector Bit: 6 */ - /* Return Bit(s): 13 */ - /* */ - /* v40 does subpixel hinting by default. */ + /********************************* + * HINTING FOR SUBPIXEL + * Selector Bit: 6 + * Return Bit(s): 13 + * + * v40 does subpixel hinting by default. + */ if ( ( args[0] & 64 ) != 0 ) K |= 1 << 13; - /********************************/ - /* VERTICAL LCD SUBPIXELS? */ - /* Selector Bit: 8 */ - /* Return Bit(s): 15 */ - /* */ + /********************************* + * VERTICAL LCD SUBPIXELS? + * Selector Bit: 8 + * Return Bit(s): 15 + */ if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd_lean ) K |= 1 << 15; - /********************************/ - /* SUBPIXEL POSITIONED? */ - /* Selector Bit: 10 */ - /* Return Bit(s): 17 */ - /* */ - /* XXX: FreeType supports it, dependent on what client does? */ + /********************************* + * SUBPIXEL POSITIONED? + * Selector Bit: 10 + * Return Bit(s): 17 + * + * XXX: FreeType supports it, dependent on what client does? + */ if ( ( args[0] & 1024 ) != 0 ) K |= 1 << 17; - /********************************/ - /* SYMMETRICAL SMOOTHING */ - /* Selector Bit: 11 */ - /* Return Bit(s): 18 */ - /* */ - /* The only smoothing method FreeType supports unless someone sets */ - /* FT_LOAD_TARGET_MONO. */ + /********************************* + * SYMMETRICAL SMOOTHING + * Selector Bit: 11 + * Return Bit(s): 18 + * + * The only smoothing method FreeType supports unless someone sets + * FT_LOAD_TARGET_MONO. + */ if ( ( args[0] & 2048 ) != 0 && exc->subpixel_hinting_lean ) K |= 1 << 18; - /********************************/ - /* CLEARTYPE HINTING AND */ - /* GRAYSCALE RENDERING */ - /* Selector Bit: 12 */ - /* Return Bit(s): 19 */ - /* */ - /* Grayscale rendering is what FreeType does anyway unless someone */ - /* sets FT_LOAD_TARGET_MONO or FT_LOAD_TARGET_LCD(_V) */ + /********************************* + * CLEARTYPE HINTING AND + * GRAYSCALE RENDERING + * Selector Bit: 12 + * Return Bit(s): 19 + * + * Grayscale rendering is what FreeType does anyway unless someone + * sets FT_LOAD_TARGET_MONO or FT_LOAD_TARGET_LCD(_V) + */ if ( ( args[0] & 4096 ) != 0 && exc->grayscale_cleartype ) K |= 1 << 19; } @@ -7462,67 +7573,73 @@ if ( exc->rasterizer_version >= 37 ) { - /********************************/ - /* HINTING FOR SUBPIXEL */ - /* Selector Bit: 6 */ - /* Return Bit(s): 13 */ - /* */ + /********************************* + * HINTING FOR SUBPIXEL + * Selector Bit: 6 + * Return Bit(s): 13 + */ if ( ( args[0] & 64 ) != 0 && exc->subpixel_hinting ) K |= 1 << 13; - /********************************/ - /* COMPATIBLE WIDTHS ENABLED */ - /* Selector Bit: 7 */ - /* Return Bit(s): 14 */ - /* */ - /* Functionality still needs to be added */ + /********************************* + * COMPATIBLE WIDTHS ENABLED + * Selector Bit: 7 + * Return Bit(s): 14 + * + * Functionality still needs to be added + */ if ( ( args[0] & 128 ) != 0 && exc->compatible_widths ) K |= 1 << 14; - /********************************/ - /* VERTICAL LCD SUBPIXELS? */ - /* Selector Bit: 8 */ - /* Return Bit(s): 15 */ - /* */ - /* Functionality still needs to be added */ + /********************************* + * VERTICAL LCD SUBPIXELS? + * Selector Bit: 8 + * Return Bit(s): 15 + * + * Functionality still needs to be added + */ if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd ) K |= 1 << 15; - /********************************/ - /* HINTING FOR BGR? */ - /* Selector Bit: 9 */ - /* Return Bit(s): 16 */ - /* */ - /* Functionality still needs to be added */ + /********************************* + * HINTING FOR BGR? + * Selector Bit: 9 + * Return Bit(s): 16 + * + * Functionality still needs to be added + */ if ( ( args[0] & 512 ) != 0 && exc->bgr ) K |= 1 << 16; if ( exc->rasterizer_version >= 38 ) { - /********************************/ - /* SUBPIXEL POSITIONED? */ - /* Selector Bit: 10 */ - /* Return Bit(s): 17 */ - /* */ - /* Functionality still needs to be added */ + /********************************* + * SUBPIXEL POSITIONED? + * Selector Bit: 10 + * Return Bit(s): 17 + * + * Functionality still needs to be added + */ if ( ( args[0] & 1024 ) != 0 && exc->subpixel_positioned ) K |= 1 << 17; - /********************************/ - /* SYMMETRICAL SMOOTHING */ - /* Selector Bit: 11 */ - /* Return Bit(s): 18 */ - /* */ - /* Functionality still needs to be added */ + /********************************* + * SYMMETRICAL SMOOTHING + * Selector Bit: 11 + * Return Bit(s): 18 + * + * Functionality still needs to be added + */ if ( ( args[0] & 2048 ) != 0 && exc->symmetrical_smoothing ) K |= 1 << 18; - /********************************/ - /* GRAY CLEARTYPE */ - /* Selector Bit: 12 */ - /* Return Bit(s): 19 */ - /* */ - /* Functionality still needs to be added */ + /********************************* + * GRAY CLEARTYPE + * Selector Bit: 12 + * Return Bit(s): 19 + * + * Functionality still needs to be added + */ if ( ( args[0] & 4096 ) != 0 && exc->gray_cleartype ) K |= 1 << 19; } @@ -7537,16 +7654,16 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /*************************************************************************/ - /* */ - /* GETVARIATION[]: get normalized variation (blend) coordinates */ - /* Opcode range: 0x91 */ - /* Stack: --> f2.14... */ - /* */ - /* XXX: UNDOCUMENTED! There is no official documentation from Apple for */ - /* this bytecode instruction. Active only if a font has GX */ - /* variation axes. */ - /* */ + /************************************************************************** + * + * GETVARIATION[]: get normalized variation (blend) coordinates + * Opcode range: 0x91 + * Stack: --> f2.14... + * + * XXX: UNDOCUMENTED! There is no official documentation from Apple for + * this bytecode instruction. Active only if a font has GX + * variation axes. + */ static void Ins_GETVARIATION( TT_ExecContext exc, FT_Long* args ) @@ -7576,15 +7693,15 @@ } - /*************************************************************************/ - /* */ - /* GETDATA[]: no idea what this is good for */ - /* Opcode range: 0x92 */ - /* Stack: --> 17 */ - /* */ - /* XXX: UNDOCUMENTED! There is no documentation from Apple for this */ - /* very weird bytecode instruction. */ - /* */ + /************************************************************************** + * + * GETDATA[]: no idea what this is good for + * Opcode range: 0x92 + * Stack: --> 17 + * + * XXX: UNDOCUMENTED! There is no documentation from Apple for this + * very weird bytecode instruction. + */ static void Ins_GETDATA( FT_Long* args ) { @@ -7632,34 +7749,34 @@ } - /*************************************************************************/ - /* */ - /* RUN */ - /* */ - /* This function executes a run of opcodes. It will exit in the */ - /* following cases: */ - /* */ - /* - Errors (in which case it returns FALSE). */ - /* */ - /* - Reaching the end of the main code range (returns TRUE). */ - /* Reaching the end of a code range within a function call is an */ - /* error. */ - /* */ - /* - After executing one single opcode, if the flag `Instruction_Trap' */ - /* is set to TRUE (returns TRUE). */ - /* */ - /* On exit with TRUE, test IP < CodeSize to know whether it comes from */ - /* an instruction trap or a normal termination. */ - /* */ - /* */ - /* Note: The documented DEBUG opcode pops a value from the stack. This */ - /* behaviour is unsupported; here a DEBUG opcode is always an */ - /* error. */ - /* */ - /* */ - /* THIS IS THE INTERPRETER'S MAIN LOOP. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * RUN + * + * This function executes a run of opcodes. It will exit in the + * following cases: + * + * - Errors (in which case it returns FALSE). + * + * - Reaching the end of the main code range (returns TRUE). + * Reaching the end of a code range within a function call is an + * error. + * + * - After executing one single opcode, if the flag `Instruction_Trap' + * is set to TRUE (returns TRUE). + * + * On exit with TRUE, test IP < CodeSize to know whether it comes from + * an instruction trap or a normal termination. + * + * + * Note: The documented DEBUG opcode pops a value from the stack. This + * behaviour is unsupported; here a DEBUG opcode is always an + * error. + * + * + * THIS IS THE INTERPRETER'S MAIN LOOP. + * + */ /* documentation is in ttinterp.h */ @@ -7691,16 +7808,16 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* - * Toggle backward compatibility according to what font wants, except - * when + * Toggle backward compatibility according to what font wants, except + * when * - * 1) we have a `tricky' font that heavily relies on the interpreter to - * render glyphs correctly, for example DFKai-SB, or - * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested. + * 1) we have a `tricky' font that heavily relies on the interpreter to + * render glyphs correctly, for example DFKai-SB, or + * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested. * - * In those cases, backward compatibility needs to be turned off to get - * correct rendering. The rendering is then completely up to the - * font's programming. + * In those cases, backward compatibility needs to be turned off to get + * correct rendering. The rendering is then completely up to the + * font's programming. * */ if ( SUBPIXEL_HINTING_MINIMAL && @@ -7801,7 +7918,7 @@ /* and the first few stack elements also */ FT_TRACE6(( " " )); FT_TRACE7(( "%06d ", exc->IP )); - FT_TRACE6(( opcode_name[exc->opcode] + 2 )); + FT_TRACE6(( "%s", opcode_name[exc->opcode] + 2 )); FT_TRACE7(( "%*s", *opcode_name[exc->opcode] == 'A' ? 2 : 12 - ( *opcode_name[exc->opcode] - '0' ), diff --git a/src/3rdparty/freetype/src/truetype/ttinterp.h b/src/3rdparty/freetype/src/truetype/ttinterp.h index 2966439ea2..0cb1e892fb 100644 --- a/src/3rdparty/freetype/src/truetype/ttinterp.h +++ b/src/3rdparty/freetype/src/truetype/ttinterp.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttinterp.h */ -/* */ -/* TrueType bytecode interpreter (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttinterp.h + * + * TrueType bytecode interpreter (specification). + * + * Copyright (C) 1996-2019 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 TTINTERP_H_ @@ -26,10 +26,10 @@ FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* Rounding mode constants. */ - /* */ + /************************************************************************** + * + * Rounding mode constants. + */ #define TT_Round_Off 5 #define TT_Round_To_Half_Grid 0 #define TT_Round_To_Grid 1 @@ -40,13 +40,13 @@ FT_BEGIN_HEADER #define TT_Round_Super_45 7 - /*************************************************************************/ - /* */ - /* Function types used by the interpreter, depending on various modes */ - /* (e.g. the rounding mode, whether to render a vertical or horizontal */ - /* line etc). */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Function types used by the interpreter, depending on various modes + * (e.g. the rounding mode, whether to render a vertical or horizontal + * line etc). + * + */ /* Rounding function */ typedef FT_F26Dot6 @@ -84,10 +84,10 @@ FT_BEGIN_HEADER FT_F26Dot6 value ); - /*************************************************************************/ - /* */ - /* This structure defines a call record, used to manage function calls. */ - /* */ + /************************************************************************** + * + * This structure defines a call record, used to manage function calls. + */ typedef struct TT_CallRec_ { FT_Int Caller_Range; @@ -101,11 +101,11 @@ FT_BEGIN_HEADER #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - /*************************************************************************/ - /* */ - /* These structures define rules used to tweak subpixel hinting for */ - /* various fonts. "", 0, "", NULL value indicates to match any value. */ - /* */ + /************************************************************************** + * + * These structures define rules used to tweak subpixel hinting for + * various fonts. "", 0, "", NULL value indicates to match any value. + */ #define SPH_MAX_NAME_SIZE 32 #define SPH_MAX_CLASS_MEMBERS 100 @@ -141,11 +141,11 @@ FT_BEGIN_HEADER #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - /*************************************************************************/ - /* */ - /* The main structure for the interpreter which collects all necessary */ - /* variables and states. */ - /* */ + /************************************************************************** + * + * The main structure for the interpreter which collects all necessary + * variables and states. + */ typedef struct TT_ExecContextRec_ { TT_Face face; @@ -352,7 +352,7 @@ FT_BEGIN_HEADER * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx * * [3] Beat Stamm describes it in more detail: - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec12 + * http://rastertragedy.com/RTRCh4.htm#Sec12. * * [4] The list of `native ClearType' fonts is small at the time of this * writing; I found the following on a Windows 10 Update 1511 @@ -464,26 +464,27 @@ FT_BEGIN_HEADER #endif /* TT_USE_BYTECODE_INTERPRETER */ - /*************************************************************************/ - /* */ - /* */ - /* TT_New_Context */ - /* */ - /* */ - /* 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. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* */ - /* A handle to the execution context. Initialized for `face'. */ - /* */ - /* */ - /* Only the glyph loader and debugger should call this function. */ - /* (And right now only the glyph loader uses it.) */ - /* */ + /************************************************************************** + * + * @Function: + * TT_New_Context + * + * @Description: + * 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: + * face :: + * A handle to the source face object. + * + * @Return: + * A handle to the execution context. Initialized for `face'. + * + * @Note: + * Only the glyph loader and debugger should call this function. + * (And right now only the glyph loader uses it.) + */ FT_EXPORT( TT_ExecContext ) TT_New_Context( TT_Driver driver ); @@ -506,27 +507,28 @@ FT_BEGIN_HEADER #endif /* TT_USE_BYTECODE_INTERPRETER */ - /*************************************************************************/ - /* */ - /* */ - /* TT_RunIns */ - /* */ - /* */ - /* Executes one or more instruction in the execution context. This */ - /* is the main function of the TrueType opcode interpreter. */ - /* */ - /* */ - /* exec :: A handle to the target execution context. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Only the object manager and debugger should call this function. */ - /* */ - /* This function is publicly exported because it is directly */ - /* invoked by the TrueType debugger. */ - /* */ + /************************************************************************** + * + * @Function: + * TT_RunIns + * + * @Description: + * Executes one or more instruction in the execution context. This + * is the main function of the TrueType opcode interpreter. + * + * @Input: + * exec :: + * A handle to the target execution context. + * + * @Return: + * FreeType error code. 0 means success. + * + * @Note: + * Only the object manager and debugger should call this function. + * + * This function is publicly exported because it is directly + * invoked by the TrueType debugger. + */ FT_EXPORT( FT_Error ) TT_RunIns( TT_ExecContext exec ); diff --git a/src/3rdparty/freetype/src/truetype/ttobjs.c b/src/3rdparty/freetype/src/truetype/ttobjs.c index 6685dc8196..e4775a51ed 100644 --- a/src/3rdparty/freetype/src/truetype/ttobjs.c +++ b/src/3rdparty/freetype/src/truetype/ttobjs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttobjs.c */ -/* */ -/* Objects manager (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttobjs.c + * + * Objects manager (body). + * + * Copyright (C) 1996-2019 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 @@ -36,36 +36,37 @@ #include "ttgxvar.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttobjs +#define FT_COMPONENT ttobjs #ifdef TT_USE_BYTECODE_INTERPRETER - /*************************************************************************/ - /* */ - /* GLYPH ZONE FUNCTIONS */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* tt_glyphzone_done */ - /* */ - /* */ - /* Deallocate a glyph zone. */ - /* */ - /* */ - /* zone :: A pointer to the target glyph zone. */ - /* */ + /************************************************************************** + * + * GLYPH ZONE FUNCTIONS + * + */ + + + /************************************************************************** + * + * @Function: + * tt_glyphzone_done + * + * @Description: + * Deallocate a glyph zone. + * + * @Input: + * zone :: + * A pointer to the target glyph zone. + */ FT_LOCAL_DEF( void ) tt_glyphzone_done( TT_GlyphZone zone ) { @@ -87,27 +88,31 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_glyphzone_new */ - /* */ - /* */ - /* Allocate a new glyph zone. */ - /* */ - /* */ - /* memory :: A handle to the current memory object. */ - /* */ - /* maxPoints :: The capacity of glyph zone in points. */ - /* */ - /* maxContours :: The capacity of glyph zone in contours. */ - /* */ - /* */ - /* zone :: A pointer to the target glyph zone record. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_glyphzone_new + * + * @Description: + * Allocate a new glyph zone. + * + * @Input: + * memory :: + * A handle to the current memory object. + * + * maxPoints :: + * The capacity of glyph zone in points. + * + * maxContours :: + * The capacity of glyph zone in contours. + * + * @Output: + * zone :: + * A pointer to the target glyph zone record. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_glyphzone_new( FT_Memory memory, FT_UShort maxPoints, @@ -143,7 +148,7 @@ /* This list shall be expanded as we find more of them. */ static FT_Bool - tt_check_trickyness_family( FT_String* name ) + tt_check_trickyness_family( const FT_String* name ) { #define TRICK_NAMES_MAX_CHARACTERS 19 @@ -566,32 +571,37 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_init */ - /* */ - /* */ - /* Initialize a given TrueType face object. */ - /* */ - /* */ - /* stream :: The source font stream. */ - /* */ - /* face_index :: The index of the TrueType font, if we are opening a */ - /* collection, in bits 0-15. The numbered instance */ - /* index~+~1 of a GX (sub)font, if applicable, in bits */ - /* 16-30. */ - /* */ - /* num_params :: Number of additional generic parameters. Ignored. */ - /* */ - /* params :: Additional generic parameters. Ignored. */ - /* */ - /* */ - /* face :: The newly built face object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_init + * + * @Description: + * Initialize a given TrueType face object. + * + * @Input: + * stream :: + * The source font stream. + * + * face_index :: + * The index of the TrueType font, if we are opening a + * collection, in bits 0-15. The numbered instance + * index~+~1 of a GX (sub)font, if applicable, in bits + * 16-30. + * + * num_params :: + * Number of additional generic parameters. Ignored. + * + * params :: + * Additional generic parameters. Ignored. + * + * @InOut: + * face :: + * The newly built face object. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_init( FT_Stream stream, FT_Face ttface, /* TT_Face */ @@ -743,17 +753,18 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_done */ - /* */ - /* */ - /* Finalize a given face object. */ - /* */ - /* */ - /* face :: A pointer to the face object to destroy. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_done + * + * @Description: + * Finalize a given face object. + * + * @Input: + * face :: + * A pointer to the face object to destroy. + */ FT_LOCAL_DEF( void ) tt_face_done( FT_Face ttface ) /* TT_Face */ { @@ -799,30 +810,32 @@ } - /*************************************************************************/ - /* */ - /* SIZE FUNCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * SIZE FUNCTIONS + * + */ #ifdef TT_USE_BYTECODE_INTERPRETER - /*************************************************************************/ - /* */ - /* */ - /* tt_size_run_fpgm */ - /* */ - /* */ - /* Run the font program. */ - /* */ - /* */ - /* size :: A handle to the size object. */ - /* */ - /* pedantic :: Set if bytecode execution should be pedantic. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_size_run_fpgm + * + * @Description: + * Run the font program. + * + * @Input: + * size :: + * A handle to the size object. + * + * pedantic :: + * Set if bytecode execution should be pedantic. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_size_run_fpgm( TT_Size size, FT_Bool pedantic ) @@ -899,22 +912,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_size_run_prep */ - /* */ - /* */ - /* Run the control value program. */ - /* */ - /* */ - /* size :: A handle to the size object. */ - /* */ - /* pedantic :: Set if bytecode execution should be pedantic. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_size_run_prep + * + * @Description: + * Run the control value program. + * + * @Input: + * size :: + * A handle to the size object. + * + * pedantic :: + * Set if bytecode execution should be pedantic. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_size_run_prep( TT_Size size, FT_Bool pedantic ) @@ -922,7 +937,22 @@ TT_Face face = (TT_Face)size->root.face; TT_ExecContext exec; FT_Error error; + FT_UInt i; + /* unscaled CVT values are already stored in 26.6 format */ + FT_Fixed scale = size->ttmetrics.scale >> 6; + + + /* Scale the cvt values to the new ppem. */ + /* By default, we use the y ppem value for scaling. */ + FT_TRACE6(( "CVT values:\n" )); + for ( i = 0; i < size->cvt_size; i++ ) + { + size->cvt[i] = FT_MulFix( face->cvt[i], scale ); + FT_TRACE6(( " %3d: %f (%f)\n", + i, face->cvt[i] / 64.0, size->cvt[i] / 64.0 )); + } + FT_TRACE6(( "\n" )); exec = size->context; @@ -1079,11 +1109,17 @@ tt_metrics->rotated = FALSE; tt_metrics->stretched = FALSE; - /* set default engine compensation */ - tt_metrics->compensations[0] = 0; /* gray */ - tt_metrics->compensations[1] = 0; /* black */ - tt_metrics->compensations[2] = 0; /* white */ - tt_metrics->compensations[3] = 0; /* reserved */ + /* Set default engine compensation. Value 3 is not described */ + /* in the OpenType specification (as of Mai 2019), but Greg */ + /* says that MS handles it the same as `gray'. */ + /* */ + /* The Apple specification says that the compensation for */ + /* `gray' is always zero. FreeType doesn't do any */ + /* compensation at all. */ + tt_metrics->compensations[0] = 0; /* gray */ + tt_metrics->compensations[1] = 0; /* black */ + tt_metrics->compensations[2] = 0; /* white */ + tt_metrics->compensations[3] = 0; /* the same as gray */ } /* allocate function defs, instruction defs, cvt, and storage area */ @@ -1156,13 +1192,7 @@ if ( size->cvt_ready < 0 ) { FT_UInt i; - TT_Face face = (TT_Face)size->root.face; - - /* Scale the cvt values to the new ppem. */ - /* We use by default the y ppem to scale the CVT. */ - for ( i = 0; i < size->cvt_size; i++ ) - size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); /* all twilight points are originally zero */ for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ ) @@ -1191,20 +1221,21 @@ #endif /* TT_USE_BYTECODE_INTERPRETER */ - /*************************************************************************/ - /* */ - /* */ - /* tt_size_init */ - /* */ - /* */ - /* Initialize a new TrueType size object. */ - /* */ - /* */ - /* size :: A handle to the size object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_size_init + * + * @Description: + * Initialize a new TrueType size object. + * + * @InOut: + * size :: + * A handle to the size object. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_size_init( FT_Size ttsize ) /* TT_Size */ { @@ -1224,17 +1255,18 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_size_done */ - /* */ - /* */ - /* The TrueType size object finalizer. */ - /* */ - /* */ - /* size :: A handle to the target size object. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_size_done + * + * @Description: + * The TrueType size object finalizer. + * + * @Input: + * size :: + * A handle to the target size object. + */ FT_LOCAL_DEF( void ) tt_size_done( FT_Size ttsize ) /* TT_Size */ { @@ -1249,22 +1281,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_size_reset */ - /* */ - /* */ - /* Reset a TrueType size when resolutions and character dimensions */ - /* have been changed. */ - /* */ - /* */ - /* size :: A handle to the target size object. */ - /* */ - /* only_height :: Only recompute ascender, descender, and height; */ - /* this flag is used for variation fonts where */ - /* `tt_size_reset' is used as an iterator function. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_size_reset + * + * @Description: + * Reset a TrueType size when resolutions and character dimensions + * have been changed. + * + * @Input: + * size :: + * A handle to the target size object. + * + * only_height :: + * Only recompute ascender, descender, and height; + * this flag is used for variation fonts where + * `tt_size_reset' is used as an iterator function. + */ FT_LOCAL_DEF( FT_Error ) tt_size_reset( TT_Size size, FT_Bool only_height ) @@ -1358,20 +1392,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_driver_init */ - /* */ - /* */ - /* Initialize a given TrueType driver object. */ - /* */ - /* */ - /* driver :: A handle to the target driver object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_driver_init + * + * @Description: + * Initialize a given TrueType driver object. + * + * @Input: + * driver :: + * A handle to the target driver object. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_driver_init( FT_Module ttdriver ) /* TT_Driver */ { @@ -1398,17 +1433,18 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_driver_done */ - /* */ - /* */ - /* Finalize a given TrueType driver. */ - /* */ - /* */ - /* driver :: A handle to the target TrueType driver. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_driver_done + * + * @Description: + * Finalize a given TrueType driver. + * + * @Input: + * driver :: + * A handle to the target TrueType driver. + */ FT_LOCAL_DEF( void ) tt_driver_done( FT_Module ttdriver ) /* TT_Driver */ { @@ -1416,20 +1452,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_slot_init */ - /* */ - /* */ - /* Initialize a new slot object. */ - /* */ - /* */ - /* slot :: A handle to the slot object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_slot_init + * + * @Description: + * Initialize a new slot object. + * + * @InOut: + * slot :: + * A handle to the slot object. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_slot_init( FT_GlyphSlot slot ) { diff --git a/src/3rdparty/freetype/src/truetype/ttobjs.h b/src/3rdparty/freetype/src/truetype/ttobjs.h index 38fa30e4e9..9fc654d5d1 100644 --- a/src/3rdparty/freetype/src/truetype/ttobjs.h +++ b/src/3rdparty/freetype/src/truetype/ttobjs.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttobjs.h */ -/* */ -/* Objects manager (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttobjs.h + * + * Objects manager (specification). + * + * Copyright (C) 1996-2019 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 TTOBJS_H_ @@ -28,40 +28,40 @@ FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* */ - /* TT_Driver */ - /* */ - /* */ - /* A handle to a TrueType driver object. */ - /* */ + /************************************************************************** + * + * @Type: + * TT_Driver + * + * @Description: + * A handle to a TrueType driver object. + */ typedef struct TT_DriverRec_* TT_Driver; - /*************************************************************************/ - /* */ - /* */ - /* TT_GlyphSlot */ - /* */ - /* */ - /* A handle to a TrueType glyph slot object. */ - /* */ - /* */ - /* This is a direct typedef of FT_GlyphSlot, as there is nothing */ - /* specific about the TrueType glyph slot. */ - /* */ + /************************************************************************** + * + * @Type: + * TT_GlyphSlot + * + * @Description: + * A handle to a TrueType glyph slot object. + * + * @Note: + * This is a direct typedef of FT_GlyphSlot, as there is nothing + * specific about the TrueType glyph slot. + */ typedef FT_GlyphSlot TT_GlyphSlot; - /*************************************************************************/ - /* */ - /* */ - /* TT_GraphicsState */ - /* */ - /* */ - /* The TrueType graphics state used during bytecode interpretation. */ - /* */ + /************************************************************************** + * + * @Struct: + * TT_GraphicsState + * + * @Description: + * The TrueType graphics state used during bytecode interpretation. + */ typedef struct TT_GraphicsState_ { FT_UShort rp0; @@ -113,25 +113,25 @@ FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* EXECUTION SUBTABLES */ - /* */ - /* These sub-tables relate to instruction execution. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * EXECUTION SUBTABLES + * + * These sub-tables relate to instruction execution. + * + */ #define TT_MAX_CODE_RANGES 3 - /*************************************************************************/ - /* */ - /* There can only be 3 active code ranges at once: */ - /* - the Font Program */ - /* - the CVT Program */ - /* - a glyph's instructions set */ - /* */ + /************************************************************************** + * + * There can only be 3 active code ranges at once: + * - the Font Program + * - the CVT Program + * - a glyph's instructions set + */ typedef enum TT_CodeRange_Tag_ { tt_coderange_none = 0, @@ -152,10 +152,10 @@ FT_BEGIN_HEADER typedef TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES]; - /*************************************************************************/ - /* */ - /* Defines a function/instruction definition record. */ - /* */ + /************************************************************************** + * + * Defines a function/instruction definition record. + */ typedef struct TT_DefRecord_ { FT_Int range; /* in which code range is it located? */ @@ -169,10 +169,10 @@ FT_BEGIN_HEADER } TT_DefRecord, *TT_DefArray; - /*************************************************************************/ - /* */ - /* Subglyph transformation record. */ - /* */ + /************************************************************************** + * + * Subglyph transformation record. + */ typedef struct TT_Transform_ { FT_Fixed xx, xy; /* transformation matrix coefficients */ @@ -182,72 +182,72 @@ FT_BEGIN_HEADER } TT_Transform; - /*************************************************************************/ - /* */ - /* A note regarding non-squared pixels: */ - /* */ - /* (This text will probably go into some docs at some time; for now, it */ - /* is kept here to explain some definitions in the TT_Size_Metrics */ - /* record). */ - /* */ - /* The CVT is a one-dimensional array containing values that control */ - /* certain important characteristics in a font, like the height of all */ - /* capitals, all lowercase letter, default spacing or stem width/height. */ - /* */ - /* These values are found in FUnits in the font file, and must be scaled */ - /* to pixel coordinates before being used by the CVT and glyph programs. */ - /* Unfortunately, when using distinct x and y resolutions (or distinct x */ - /* and y pointsizes), there are two possible scalings. */ - /* */ - /* A first try was to implement a `lazy' scheme where all values were */ - /* scaled when first used. However, while some values are always used */ - /* in the same direction, some others are used under many different */ - /* circumstances and orientations. */ - /* */ - /* I have found a simpler way to do the same, and it even seems to work */ - /* in most of the cases: */ - /* */ - /* - All CVT values are scaled to the maximum ppem size. */ - /* */ - /* - When performing a read or write in the CVT, a ratio factor is used */ - /* to perform adequate scaling. Example: */ - /* */ - /* x_ppem = 14 */ - /* y_ppem = 10 */ - /* */ - /* We choose ppem = x_ppem = 14 as the CVT scaling size. All cvt */ - /* entries are scaled to it. */ - /* */ - /* x_ratio = 1.0 */ - /* y_ratio = y_ppem/ppem (< 1.0) */ - /* */ - /* We compute the current ratio like: */ - /* */ - /* - If projVector is horizontal, */ - /* ratio = x_ratio = 1.0 */ - /* */ - /* - if projVector is vertical, */ - /* ratio = y_ratio */ - /* */ - /* - else, */ - /* ratio = sqrt( (proj.x * x_ratio) ^ 2 + (proj.y * y_ratio) ^ 2 ) */ - /* */ - /* Reading a cvt value returns */ - /* ratio * cvt[index] */ - /* */ - /* Writing a cvt value in pixels: */ - /* cvt[index] / ratio */ - /* */ - /* The current ppem is simply */ - /* ratio * ppem */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Metrics used by the TrueType size and context objects. */ - /* */ + /************************************************************************** + * + * A note regarding non-squared pixels: + * + * (This text will probably go into some docs at some time; for now, it + * is kept here to explain some definitions in the TT_Size_Metrics + * record). + * + * The CVT is a one-dimensional array containing values that control + * certain important characteristics in a font, like the height of all + * capitals, all lowercase letter, default spacing or stem width/height. + * + * These values are found in FUnits in the font file, and must be scaled + * to pixel coordinates before being used by the CVT and glyph programs. + * Unfortunately, when using distinct x and y resolutions (or distinct x + * and y pointsizes), there are two possible scalings. + * + * A first try was to implement a `lazy' scheme where all values were + * scaled when first used. However, while some values are always used + * in the same direction, some others are used under many different + * circumstances and orientations. + * + * I have found a simpler way to do the same, and it even seems to work + * in most of the cases: + * + * - All CVT values are scaled to the maximum ppem size. + * + * - When performing a read or write in the CVT, a ratio factor is used + * to perform adequate scaling. Example: + * + * x_ppem = 14 + * y_ppem = 10 + * + * We choose ppem = x_ppem = 14 as the CVT scaling size. All cvt + * entries are scaled to it. + * + * x_ratio = 1.0 + * y_ratio = y_ppem/ppem (< 1.0) + * + * We compute the current ratio like: + * + * - If projVector is horizontal, + * ratio = x_ratio = 1.0 + * + * - if projVector is vertical, + * ratio = y_ratio + * + * - else, + * ratio = sqrt( (proj.x * x_ratio) ^ 2 + (proj.y * y_ratio) ^ 2 ) + * + * Reading a cvt value returns + * ratio * cvt[index] + * + * Writing a cvt value in pixels: + * cvt[index] / ratio + * + * The current ppem is simply + * ratio * ppem + * + */ + + + /************************************************************************** + * + * Metrics used by the TrueType size and context objects. + */ typedef struct TT_Size_Metrics_ { /* for non-square pixels */ @@ -268,10 +268,10 @@ FT_BEGIN_HEADER } TT_Size_Metrics; - /*************************************************************************/ - /* */ - /* TrueType size class. */ - /* */ + /************************************************************************** + * + * TrueType size class. + */ typedef struct TT_SizeRec_ { FT_SizeRec root; @@ -324,10 +324,10 @@ FT_BEGIN_HEADER } TT_SizeRec; - /*************************************************************************/ - /* */ - /* TrueType driver class. */ - /* */ + /************************************************************************** + * + * TrueType driver class. + */ typedef struct TT_DriverRec_ { FT_DriverRec root; @@ -348,10 +348,10 @@ FT_BEGIN_HEADER /* will always use the TT driver to create them. */ - /*************************************************************************/ - /* */ - /* Face functions */ - /* */ + /************************************************************************** + * + * Face functions + */ FT_LOCAL( FT_Error ) tt_face_init( FT_Stream stream, FT_Face ttface, /* TT_Face */ @@ -363,10 +363,10 @@ FT_BEGIN_HEADER tt_face_done( FT_Face ttface ); /* TT_Face */ - /*************************************************************************/ - /* */ - /* Size functions */ - /* */ + /************************************************************************** + * + * Size functions + */ FT_LOCAL( FT_Error ) tt_size_init( FT_Size ttsize ); /* TT_Size */ @@ -394,10 +394,10 @@ FT_BEGIN_HEADER FT_Bool only_height ); - /*************************************************************************/ - /* */ - /* Driver functions */ - /* */ + /************************************************************************** + * + * Driver functions + */ FT_LOCAL( FT_Error ) tt_driver_init( FT_Module ttdriver ); /* TT_Driver */ @@ -405,10 +405,10 @@ FT_BEGIN_HEADER tt_driver_done( FT_Module ttdriver ); /* TT_Driver */ - /*************************************************************************/ - /* */ - /* Slot functions */ - /* */ + /************************************************************************** + * + * Slot functions + */ FT_LOCAL( FT_Error ) tt_slot_init( FT_GlyphSlot slot ); diff --git a/src/3rdparty/freetype/src/truetype/ttpload.c b/src/3rdparty/freetype/src/truetype/ttpload.c index d9526ad082..bc954c2dba 100644 --- a/src/3rdparty/freetype/src/truetype/ttpload.c +++ b/src/3rdparty/freetype/src/truetype/ttpload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttpload.c */ -/* */ -/* TrueType-specific tables loader (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttpload.c + * + * TrueType-specific tables loader (body). + * + * Copyright (C) 1996-2019 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 @@ -31,33 +31,35 @@ #include "tterrors.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_ttpload - - - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_loca */ - /* */ - /* */ - /* Load the locations table. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* */ - /* stream :: The input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ +#define FT_COMPONENT ttpload + + + /************************************************************************** + * + * @Function: + * tt_face_load_loca + * + * @Description: + * Load the locations table. + * + * @InOut: + * face :: + * A handle to the target face object. + * + * @Input: + * stream :: + * The input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_loca( TT_Face face, FT_Stream stream ) @@ -297,23 +299,25 @@ - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_cvt */ - /* */ - /* */ - /* Load the control value table into a face object. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_cvt + * + * @Description: + * Load the control value table into a face object. + * + * @InOut: + * face :: + * A handle to the target face object. + * + * @Input: + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_cvt( TT_Face face, FT_Stream stream ) @@ -348,12 +352,12 @@ goto Exit; { - FT_Short* cur = face->cvt; - FT_Short* limit = cur + face->cvt_size; + FT_Int32* cur = face->cvt; + FT_Int32* limit = cur + face->cvt_size; for ( ; cur < limit; cur++ ) - *cur = FT_GET_SHORT(); + *cur = FT_GET_SHORT() * 64; } FT_FRAME_EXIT(); @@ -378,23 +382,25 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_fpgm */ - /* */ - /* */ - /* Load the font program. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_fpgm + * + * @Description: + * Load the font program. + * + * @InOut: + * face :: + * A handle to the target face object. + * + * @Input: + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_fpgm( TT_Face face, FT_Stream stream ) @@ -440,23 +446,25 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_prep */ - /* */ - /* */ - /* Load the cvt program. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_prep + * + * @Description: + * Load the cvt program. + * + * @InOut: + * face :: + * A handle to the target face object. + * + * @Input: + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_prep( TT_Face face, FT_Stream stream ) @@ -501,22 +509,24 @@ } - /*************************************************************************/ - /* */ - /* */ - /* tt_face_load_hdmx */ - /* */ - /* */ - /* Load the `hdmx' table into the face object. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: A handle to the input stream. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * tt_face_load_hdmx + * + * @Description: + * Load the `hdmx' table into the face object. + * + * @Input: + * face :: + * A handle to the target face object. + * + * stream :: + * A handle to the input stream. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) tt_face_load_hdmx( TT_Face face, @@ -610,11 +620,11 @@ } - /*************************************************************************/ - /* */ - /* Return the advance width table for a given pixel size if it is found */ - /* in the font's `hdmx' table (if any). */ - /* */ + /************************************************************************** + * + * Return the advance width table for a given pixel size if it is found + * in the font's `hdmx' table (if any). + */ FT_LOCAL_DEF( FT_Byte* ) tt_face_get_device_metrics( TT_Face face, FT_UInt ppem, diff --git a/src/3rdparty/freetype/src/truetype/ttpload.h b/src/3rdparty/freetype/src/truetype/ttpload.h index fa12527247..022750e324 100644 --- a/src/3rdparty/freetype/src/truetype/ttpload.h +++ b/src/3rdparty/freetype/src/truetype/ttpload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttpload.h */ -/* */ -/* TrueType-specific tables loader (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttpload.h + * + * TrueType-specific tables loader (specification). + * + * Copyright (C) 1996-2019 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 TTPLOAD_H_ diff --git a/src/3rdparty/freetype/src/truetype/ttsubpix.c b/src/3rdparty/freetype/src/truetype/ttsubpix.c index d94bcc8b50..23a2e5b440 100644 --- a/src/3rdparty/freetype/src/truetype/ttsubpix.c +++ b/src/3rdparty/freetype/src/truetype/ttsubpix.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttsubpix.c */ -/* */ -/* TrueType Subpixel Hinting. */ -/* */ -/* Copyright 2010-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttsubpix.c + * + * TrueType Subpixel Hinting. + * + * Copyright (C) 2010-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include #include FT_INTERNAL_DEBUG_H @@ -30,35 +30,35 @@ #if defined( TT_USE_BYTECODE_INTERPRETER ) && \ defined( TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY ) - /*************************************************************************/ - /* */ - /* These rules affect how the TT Interpreter does hinting, with the */ - /* goal of doing subpixel hinting by (in general) ignoring x moves. */ - /* Some of these rules are fixes that go above and beyond the */ - /* stated techniques in the MS whitepaper on Cleartype, due to */ - /* artifacts in many glyphs. So, these rules make some glyphs render */ - /* better than they do in the MS rasterizer. */ - /* */ - /* "" string or 0 int/char indicates to apply to all glyphs. */ - /* "-" used as dummy placeholders, but any non-matching string works. */ - /* */ - /* Some of this could arguably be implemented in fontconfig, however: */ - /* */ - /* - Fontconfig can't set things on a glyph-by-glyph basis. */ - /* - The tweaks that happen here are very low-level, from an average */ - /* user's point of view and are best implemented in the hinter. */ - /* */ - /* The goal is to make the subpixel hinting techniques as generalized */ - /* as possible across all fonts to prevent the need for extra rules such */ - /* as these. */ - /* */ - /* The rule structure is designed so that entirely new rules can easily */ - /* be added when a new compatibility feature is discovered. */ - /* */ - /* The rule structures could also use some enhancement to handle ranges. */ - /* */ - /* ****************** WORK IN PROGRESS ******************* */ - /* */ + /************************************************************************** + * + * These rules affect how the TT Interpreter does hinting, with the + * goal of doing subpixel hinting by (in general) ignoring x moves. + * Some of these rules are fixes that go above and beyond the + * stated techniques in the MS whitepaper on Cleartype, due to + * artifacts in many glyphs. So, these rules make some glyphs render + * better than they do in the MS rasterizer. + * + * "" string or 0 int/char indicates to apply to all glyphs. + * "-" used as dummy placeholders, but any non-matching string works. + * + * Some of this could arguably be implemented in fontconfig, however: + * + * - Fontconfig can't set things on a glyph-by-glyph basis. + * - The tweaks that happen here are very low-level, from an average + * user's point of view and are best implemented in the hinter. + * + * The goal is to make the subpixel hinting techniques as generalized + * as possible across all fonts to prevent the need for extra rules such + * as these. + * + * The rule structure is designed so that entirely new rules can easily + * be added when a new compatibility feature is discovered. + * + * The rule structures could also use some enhancement to handle ranges. + * + * ****************** WORK IN PROGRESS ******************* + */ /* These are `classes' of fonts that can be grouped together and used in */ /* rules below. A blank entry "" is required at the end of these! */ diff --git a/src/3rdparty/freetype/src/truetype/ttsubpix.h b/src/3rdparty/freetype/src/truetype/ttsubpix.h index 1070bb016f..4966800c2d 100644 --- a/src/3rdparty/freetype/src/truetype/ttsubpix.h +++ b/src/3rdparty/freetype/src/truetype/ttsubpix.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* ttsubpix.h */ -/* */ -/* TrueType Subpixel Hinting. */ -/* */ -/* Copyright 2010-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * ttsubpix.h + * + * TrueType Subpixel Hinting. + * + * Copyright (C) 2010-2019 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 TTSUBPIX_H_ @@ -29,11 +29,11 @@ FT_BEGIN_HEADER #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - /*************************************************************************/ - /* */ - /* ID flags to identify special functions at FDEF and runtime. */ - /* */ - /* */ + /************************************************************************** + * + * ID flags to identify special functions at FDEF and runtime. + * + */ #define SPH_FDEF_INLINE_DELTA_1 0x0000001 #define SPH_FDEF_INLINE_DELTA_2 0x0000002 #define SPH_FDEF_DIAGONAL_STROKE 0x0000004 @@ -45,11 +45,11 @@ FT_BEGIN_HEADER #define SPH_FDEF_TYPEMAN_DIAGENDCTRL 0x0000100 - /*************************************************************************/ - /* */ - /* Tweak flags that are set for each glyph by the below rules. */ - /* */ - /* */ + /************************************************************************** + * + * Tweak flags that are set for each glyph by the below rules. + * + */ #define SPH_TWEAK_ALLOW_X_DMOVE 0x0000001UL #define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000002UL #define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000004UL diff --git a/src/3rdparty/freetype/src/type1/Jamfile b/src/3rdparty/freetype/src/type1/Jamfile index b94b7d0aae..0bcfb2e406 100644 --- a/src/3rdparty/freetype/src/type1/Jamfile +++ b/src/3rdparty/freetype/src/type1/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/type1 Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/type1/module.mk b/src/3rdparty/freetype/src/type1/module.mk index 3fea5cc16f..2f48c65821 100644 --- a/src/3rdparty/freetype/src/type1/module.mk +++ b/src/3rdparty/freetype/src/type1/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/type1/rules.mk b/src/3rdparty/freetype/src/type1/rules.mk index cb1a142860..901169c7a5 100644 --- a/src/3rdparty/freetype/src/type1/rules.mk +++ b/src/3rdparty/freetype/src/type1/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/type1/t1afm.c b/src/3rdparty/freetype/src/type1/t1afm.c index 61053d9a64..6841184539 100644 --- a/src/3rdparty/freetype/src/type1/t1afm.c +++ b/src/3rdparty/freetype/src/type1/t1afm.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1afm.c */ -/* */ -/* AFM support for Type 1 fonts (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1afm.c + * + * AFM support for Type 1 fonts (body). + * + * Copyright (C) 1996-2019 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 @@ -26,14 +26,14 @@ #ifndef T1_CONFIG_OPTION_NO_AFM - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_t1afm +#define FT_COMPONENT t1afm FT_LOCAL_DEF( void ) diff --git a/src/3rdparty/freetype/src/type1/t1afm.h b/src/3rdparty/freetype/src/type1/t1afm.h index cb8d302b4d..a8e6a5495a 100644 --- a/src/3rdparty/freetype/src/type1/t1afm.h +++ b/src/3rdparty/freetype/src/type1/t1afm.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1afm.h */ -/* */ -/* AFM support for Type 1 fonts (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1afm.h + * + * AFM support for Type 1 fonts (specification). + * + * Copyright (C) 1996-2019 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 T1AFM_H_ diff --git a/src/3rdparty/freetype/src/type1/t1driver.c b/src/3rdparty/freetype/src/type1/t1driver.c index 029b410b47..557733da3b 100644 --- a/src/3rdparty/freetype/src/type1/t1driver.c +++ b/src/3rdparty/freetype/src/type1/t1driver.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1driver.c */ -/* */ -/* Type 1 driver interface (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1driver.c + * + * Type 1 driver interface (body). + * + * Copyright (C) 1996-2019 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 @@ -43,19 +43,19 @@ #include FT_SERVICE_KERNING_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_t1driver +#define FT_COMPONENT t1driver - /* - * GLYPH DICT SERVICE - * - */ + /* + * GLYPH DICT SERVICE + * + */ static FT_Error t1_get_glyph_name( T1_Face face, @@ -70,8 +70,8 @@ static FT_UInt - t1_get_name_index( T1_Face face, - FT_String* glyph_name ) + t1_get_name_index( T1_Face face, + const FT_String* glyph_name ) { FT_Int i; @@ -97,7 +97,7 @@ /* - * POSTSCRIPT NAME SERVICE + * POSTSCRIPT NAME SERVICE * */ @@ -115,30 +115,32 @@ /* - * MULTIPLE MASTERS SERVICE + * MULTIPLE MASTERS SERVICE * */ #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT static const FT_Service_MultiMastersRec t1_service_multi_masters = { - (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ - (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ - (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */ - (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ - (FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */ - (FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */ - (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ - - (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ - (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ + (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ + (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ + (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */ + (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ + (FT_Set_Var_Design_Func) T1_Set_Var_Design, /* set_var_design */ + (FT_Get_Var_Design_Func) T1_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ + (FT_Set_MM_WeightVector_Func)T1_Set_MM_WeightVector, /* set_mm_weightvector */ + (FT_Get_MM_WeightVector_Func)T1_Get_MM_WeightVector, /* get_mm_weightvector */ + + (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ + (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ }; #endif /* - * POSTSCRIPT INFO SERVICE + * POSTSCRIPT INFO SERVICE * */ @@ -270,9 +272,12 @@ break; case PS_DICT_FONT_NAME: - retval = ft_strlen( type1->font_name ) + 1; - if ( value && value_len >= retval ) - ft_memcpy( value, (void *)( type1->font_name ), retval ); + if ( type1->font_name ) + { + retval = ft_strlen( type1->font_name ) + 1; + if ( value && value_len >= retval ) + ft_memcpy( value, (void *)( type1->font_name ), retval ); + } break; case PS_DICT_UNIQUE_ID: @@ -362,7 +367,7 @@ ok = 1; } - if ( ok ) + if ( ok && type1->subrs ) { retval = type1->subrs_len[idx] + 1; if ( value && value_len >= retval ) @@ -559,33 +564,49 @@ break; case PS_DICT_VERSION: - retval = ft_strlen( type1->font_info.version ) + 1; - if ( value && value_len >= retval ) - ft_memcpy( value, (void *)( type1->font_info.version ), retval ); + if ( type1->font_info.version ) + { + retval = ft_strlen( type1->font_info.version ) + 1; + if ( value && value_len >= retval ) + ft_memcpy( value, (void *)( type1->font_info.version ), retval ); + } break; case PS_DICT_NOTICE: - retval = ft_strlen( type1->font_info.notice ) + 1; - if ( value && value_len >= retval ) - ft_memcpy( value, (void *)( type1->font_info.notice ), retval ); + if ( type1->font_info.notice ) + { + retval = ft_strlen( type1->font_info.notice ) + 1; + if ( value && value_len >= retval ) + ft_memcpy( value, (void *)( type1->font_info.notice ), retval ); + } break; case PS_DICT_FULL_NAME: - retval = ft_strlen( type1->font_info.full_name ) + 1; - if ( value && value_len >= retval ) - ft_memcpy( value, (void *)( type1->font_info.full_name ), retval ); + if ( type1->font_info.full_name ) + { + retval = ft_strlen( type1->font_info.full_name ) + 1; + if ( value && value_len >= retval ) + ft_memcpy( value, (void *)( type1->font_info.full_name ), retval ); + } break; case PS_DICT_FAMILY_NAME: - retval = ft_strlen( type1->font_info.family_name ) + 1; - if ( value && value_len >= retval ) - ft_memcpy( value, (void *)( type1->font_info.family_name ), retval ); + if ( type1->font_info.family_name ) + { + retval = ft_strlen( type1->font_info.family_name ) + 1; + if ( value && value_len >= retval ) + ft_memcpy( value, (void *)( type1->font_info.family_name ), + retval ); + } break; case PS_DICT_WEIGHT: - retval = ft_strlen( type1->font_info.weight ) + 1; - if ( value && value_len >= retval ) - ft_memcpy( value, (void *)( type1->font_info.weight ), retval ); + if ( type1->font_info.weight ) + { + retval = ft_strlen( type1->font_info.weight ) + 1; + if ( value && value_len >= retval ) + ft_memcpy( value, (void *)( type1->font_info.weight ), retval ); + } break; case PS_DICT_ITALIC_ANGLE: @@ -618,7 +639,7 @@ /* - * PROPERTY SERVICE + * PROPERTY SERVICE * */ @@ -630,7 +651,7 @@ /* - * SERVICE LIST + * SERVICE LIST * */ @@ -665,38 +686,42 @@ #ifndef T1_CONFIG_OPTION_NO_AFM - /*************************************************************************/ - /* */ - /* */ - /* Get_Kerning */ - /* */ - /* */ - /* A driver method used to return the kerning vector between two */ - /* glyphs of the same face. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* left_glyph :: The index of the left glyph in the kern pair. */ - /* */ - /* right_glyph :: The index of the right glyph in the kern pair. */ - /* */ - /* */ - /* kerning :: The kerning vector. This is in font units for */ - /* scalable formats, and in pixels for fixed-sizes */ - /* formats. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Only horizontal layouts (left-to-right & right-to-left) are */ - /* supported by this function. Other layouts, or more sophisticated */ - /* kernings are out of scope of this method (the basic driver */ - /* interface is meant to be simple). */ - /* */ - /* They can be implemented by format-specific interfaces. */ - /* */ + /************************************************************************** + * + * @Function: + * Get_Kerning + * + * @Description: + * A driver method used to return the kerning vector between two + * glyphs of the same face. + * + * @Input: + * face :: + * A handle to the source face object. + * + * left_glyph :: + * The index of the left glyph in the kern pair. + * + * right_glyph :: + * The index of the right glyph in the kern pair. + * + * @Output: + * kerning :: + * The kerning vector. This is in font units for + * scalable formats, and in pixels for fixed-sizes + * formats. + * + * @Return: + * FreeType error code. 0 means success. + * + * @Note: + * Only horizontal layouts (left-to-right & right-to-left) are + * supported by this function. Other layouts, or more sophisticated + * kernings are out of scope of this method (the basic driver + * interface is meant to be simple). + * + * They can be implemented by format-specific interfaces. + */ static FT_Error Get_Kerning( FT_Face t1face, /* T1_Face */ FT_UInt left_glyph, diff --git a/src/3rdparty/freetype/src/type1/t1driver.h b/src/3rdparty/freetype/src/type1/t1driver.h index 2b1507233d..206f64a0bc 100644 --- a/src/3rdparty/freetype/src/type1/t1driver.h +++ b/src/3rdparty/freetype/src/type1/t1driver.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1driver.h */ -/* */ -/* High-level Type 1 driver interface (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1driver.h + * + * High-level Type 1 driver interface (specification). + * + * Copyright (C) 1996-2019 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 T1DRIVER_H_ @@ -26,14 +26,8 @@ FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif - - FT_EXPORT_VAR( const FT_Driver_ClassRec ) t1_driver_class; - FT_END_HEADER #endif /* T1DRIVER_H_ */ diff --git a/src/3rdparty/freetype/src/type1/t1errors.h b/src/3rdparty/freetype/src/type1/t1errors.h index 9e0151b957..b35f67a24c 100644 --- a/src/3rdparty/freetype/src/type1/t1errors.h +++ b/src/3rdparty/freetype/src/type1/t1errors.h @@ -1,26 +1,26 @@ -/***************************************************************************/ -/* */ -/* t1errors.h */ -/* */ -/* Type 1 error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the Type 1 error enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * t1errors.h + * + * Type 1 error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the Type 1 error enumeration constants. + * + */ #ifndef T1ERRORS_H_ #define T1ERRORS_H_ diff --git a/src/3rdparty/freetype/src/type1/t1gload.c b/src/3rdparty/freetype/src/type1/t1gload.c index 87d40e7566..f9b115b186 100644 --- a/src/3rdparty/freetype/src/type1/t1gload.c +++ b/src/3rdparty/freetype/src/type1/t1gload.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1gload.c */ -/* */ -/* Type 1 Glyph Loader (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1gload.c + * + * Type 1 Glyph Loader (body). + * + * Copyright (C) 1996-2019 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 @@ -29,14 +29,14 @@ #include "t1errors.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_t1gload +#define FT_COMPONENT t1gload static FT_Error @@ -62,6 +62,7 @@ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); #endif + decoder->font_matrix = type1->font_matrix; decoder->font_offset = type1->font_offset; @@ -249,6 +250,8 @@ *max_advance = 0; + FT_TRACE6(( "T1_Compute_Max_Advance:\n" )); + /* for each glyph, parse the glyph charstring and extract */ /* the advance width */ for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ ) @@ -261,6 +264,9 @@ /* ignore the error if one occurred - skip to next glyph */ } + FT_TRACE6(( "T1_Compute_Max_Advance: max advance: %f\n", + *max_advance / 65536.0 )); + psaux->t1_decoder_funcs->done( &decoder ); return FT_Err_Ok; @@ -282,11 +288,18 @@ FT_Error error; + FT_TRACE5(( "T1_Get_Advances:\n" )); + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { for ( nn = 0; nn < count; nn++ ) + { advances[nn] = 0; + FT_TRACE5(( " idx %d: advance height 0 font units\n", + first + nn )); + } + return FT_Err_Ok; } @@ -320,6 +333,11 @@ advances[nn] = FIXED_TO_INT( decoder.builder.advance.x ); else advances[nn] = 0; + + FT_TRACE5(( " idx %d: advance width %d font unit%s\n", + first + nn, + advances[nn], + advances[nn] == 1 ? "" : "s" )); } return FT_Err_Ok; @@ -384,9 +402,9 @@ t1glyph->outline.n_points = 0; t1glyph->outline.n_contours = 0; - hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && - ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); - scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); + hinting = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) && + !( load_flags & FT_LOAD_NO_HINTING ) ); + scaled = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) ); glyph->hint = hinting; glyph->scaled = scaled; @@ -398,7 +416,7 @@ t1glyph, (FT_Byte**)type1->glyph_names, face->blend, - FT_BOOL( hinting ), + hinting, FT_LOAD_TARGET_MODE( load_flags ), T1_Parse_Glyph ); if ( error ) @@ -406,8 +424,7 @@ must_finish_decoder = TRUE; - decoder.builder.no_recurse = FT_BOOL( - ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ); + decoder.builder.no_recurse = FT_BOOL( load_flags & FT_LOAD_NO_RECURSE ); decoder.num_subrs = type1->num_subrs; decoder.subrs = type1->subrs; @@ -528,7 +545,7 @@ /* First of all, scale the points, if we are not hinting */ - if ( !hinting || ! decoder.builder.hints_funcs ) + if ( !hinting || !decoder.builder.hints_funcs ) for ( n = cur->n_points; n > 0; n--, vec++ ) { vec->x = FT_MulFix( vec->x, x_scale ); diff --git a/src/3rdparty/freetype/src/type1/t1gload.h b/src/3rdparty/freetype/src/type1/t1gload.h index 72ef76f6ae..80440369dc 100644 --- a/src/3rdparty/freetype/src/type1/t1gload.h +++ b/src/3rdparty/freetype/src/type1/t1gload.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1gload.h */ -/* */ -/* Type 1 Glyph Loader (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1gload.h + * + * Type 1 Glyph Loader (specification). + * + * Copyright (C) 1996-2019 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 T1GLOAD_H_ diff --git a/src/3rdparty/freetype/src/type1/t1load.c b/src/3rdparty/freetype/src/type1/t1load.c index 9dfa637a69..5cffdfaac4 100644 --- a/src/3rdparty/freetype/src/type1/t1load.c +++ b/src/3rdparty/freetype/src/type1/t1load.c @@ -1,63 +1,63 @@ -/***************************************************************************/ -/* */ -/* t1load.c */ -/* */ -/* Type 1 font loader (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 is the new and improved Type 1 data loader for FreeType 2. The */ - /* old loader has several problems: it is slow, complex, difficult to */ - /* maintain, and contains incredible hacks to make it accept some */ - /* ill-formed Type 1 fonts without hiccup-ing. Moreover, about 5% of */ - /* the Type 1 fonts on my machine still aren't loaded correctly by it. */ - /* */ - /* This version is much simpler, much faster and also easier to read and */ - /* maintain by a great order of magnitude. The idea behind it is to */ - /* _not_ try to read the Type 1 token stream with a state machine (i.e. */ - /* a Postscript-like interpreter) but rather to perform simple pattern */ - /* matching. */ - /* */ - /* Indeed, nearly all data definitions follow a simple pattern like */ - /* */ - /* ... /Field ... */ - /* */ - /* where can be a number, a boolean, a string, or an array of */ - /* numbers. There are a few exceptions, namely the encoding, font name, */ - /* charstrings, and subrs; they are handled with a special pattern */ - /* matching routine. */ - /* */ - /* All other common cases are handled very simply. The matching rules */ - /* are defined in the file `t1tokens.h' through the use of several */ - /* macros calls PARSE_XXX. This file is included twice here; the first */ - /* time to generate parsing callback functions, the second time to */ - /* generate a table of keywords (with pointers to the associated */ - /* callback functions). */ - /* */ - /* The function `parse_dict' simply scans *linearly* a given dictionary */ - /* (either the top-level or private one) and calls the appropriate */ - /* callback when it encounters an immediate keyword. */ - /* */ - /* This is by far the fastest way one can find to parse and read all */ - /* data. */ - /* */ - /* This led to tremendous code size reduction. Note that later, the */ - /* glyph loader will also be _greatly_ simplified, and the automatic */ - /* hinter will replace the clumsy `t1hinter'. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * t1load.c + * + * Type 1 font loader (body). + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This is the new and improved Type 1 data loader for FreeType 2. The + * old loader has several problems: it is slow, complex, difficult to + * maintain, and contains incredible hacks to make it accept some + * ill-formed Type 1 fonts without hiccup-ing. Moreover, about 5% of + * the Type 1 fonts on my machine still aren't loaded correctly by it. + * + * This version is much simpler, much faster and also easier to read and + * maintain by a great order of magnitude. The idea behind it is to + * _not_ try to read the Type 1 token stream with a state machine (i.e. + * a Postscript-like interpreter) but rather to perform simple pattern + * matching. + * + * Indeed, nearly all data definitions follow a simple pattern like + * + * ... /Field ... + * + * where can be a number, a boolean, a string, or an array of + * numbers. There are a few exceptions, namely the encoding, font name, + * charstrings, and subrs; they are handled with a special pattern + * matching routine. + * + * All other common cases are handled very simply. The matching rules + * are defined in the file `t1tokens.h' through the use of several + * macros calls PARSE_XXX. This file is included twice here; the first + * time to generate parsing callback functions, the second time to + * generate a table of keywords (with pointers to the associated + * callback functions). + * + * The function `parse_dict' simply scans *linearly* a given dictionary + * (either the top-level or private one) and calls the appropriate + * callback when it encounters an immediate keyword. + * + * This is by far the fastest way one can find to parse and read all + * data. + * + * This led to tremendous code size reduction. Note that later, the + * glyph loader will also be _greatly_ simplified, and the automatic + * hinter will replace the clumsy `t1hinter'. + * + */ #include @@ -73,20 +73,20 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL -#define IS_INCREMENTAL (FT_Bool)( face->root.internal->incremental_interface != 0 ) +#define IS_INCREMENTAL FT_BOOL( face->root.internal->incremental_interface ) #else #define IS_INCREMENTAL 0 #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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_t1load +#define FT_COMPONENT t1load #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT @@ -222,11 +222,11 @@ } - /*************************************************************************/ - /* */ - /* Given a normalized (blend) coordinate, figure out the design */ - /* coordinate appropriate for that value. */ - /* */ + /************************************************************************** + * + * Given a normalized (blend) coordinate, figure out the design + * coordinate appropriate for that value. + */ static FT_Fixed mm_axis_unmap( PS_DesignMap axismap, FT_Fixed ncv ) @@ -251,11 +251,11 @@ } - /*************************************************************************/ - /* */ - /* Given a vector of weights, one for each design, figure out the */ - /* normalized axis coordinates which gave rise to those weights. */ - /* */ + /************************************************************************** + * + * Given a vector of weights, one for each design, figure out the + * normalized axis coordinates which gave rise to those weights. + */ static void mm_weights_unmap( FT_Fixed* weights, FT_Fixed* axiscoords, @@ -293,11 +293,11 @@ } - /*************************************************************************/ - /* */ - /* Just a wrapper around T1_Get_Multi_Master to support the different */ - /* arguments needed by the GX var distortable fonts. */ - /* */ + /************************************************************************** + * + * Just a wrapper around T1_Get_Multi_Master to support the different + * arguments needed by the GX var distortable fonts. + */ FT_LOCAL_DEF( FT_Error ) T1_Get_MM_Var( T1_Face face, FT_MM_Var* *master ) @@ -348,16 +348,13 @@ mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' ); } - if ( blend->num_designs == ( 1U << blend->num_axis ) ) - { - mm_weights_unmap( blend->default_weight_vector, - axiscoords, - blend->num_axis ); + mm_weights_unmap( blend->default_weight_vector, + axiscoords, + blend->num_axis ); - for ( i = 0; i < mmaster.num_axis; i++ ) - mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i], - axiscoords[i] ); - } + for ( i = 0; i < mmaster.num_axis; i++ ) + mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i], + axiscoords[i] ); *master = mmvar; @@ -387,24 +384,31 @@ for ( n = 0; n < blend->num_designs; n++ ) { FT_Fixed result = 0x10000L; /* 1.0 fixed */ + FT_Fixed factor; for ( m = 0; m < blend->num_axis; m++ ) { - FT_Fixed factor; - - - /* get current blend axis position; */ /* use a default value if we don't have a coordinate */ - factor = m < num_coords ? coords[m] : 0x8000; - if ( factor < 0 ) - factor = 0; - if ( factor > 0x10000L ) - factor = 0x10000L; + if ( m >= num_coords ) + { + result >>= 1; + continue; + } + /* get current blend axis position */ + factor = coords[m]; if ( ( n & ( 1 << m ) ) == 0 ) factor = 0x10000L - factor; + if ( factor <= 0 ) + { + result = 0; + break; + } + else if ( factor >= 0x10000L ) + continue; + result = FT_MulFix( result, factor ); } @@ -476,6 +480,75 @@ } + FT_LOCAL_DEF( FT_Error ) + T1_Set_MM_WeightVector( T1_Face face, + FT_UInt len, + FT_Fixed* weightvector ) + { + PS_Blend blend = face->blend; + FT_UInt i, n; + + + if ( !blend ) + return FT_THROW( Invalid_Argument ); + + if ( !len && !weightvector ) + { + for ( i = 0; i < blend->num_designs; i++ ) + blend->weight_vector[i] = blend->default_weight_vector[i]; + } + else + { + if ( !weightvector ) + return FT_THROW( Invalid_Argument ); + + n = len < blend->num_designs ? len : blend->num_designs; + + for ( i = 0; i < n; i++ ) + blend->weight_vector[i] = weightvector[i]; + + for ( ; i < blend->num_designs; i++ ) + blend->weight_vector[i] = (FT_Fixed)0; + + if ( len ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + } + + return FT_Err_Ok; + } + + + FT_LOCAL_DEF( FT_Error ) + T1_Get_MM_WeightVector( T1_Face face, + FT_UInt* len, + FT_Fixed* weightvector ) + { + PS_Blend blend = face->blend; + FT_UInt i; + + + if ( !blend ) + return FT_THROW( Invalid_Argument ); + + if ( *len < blend->num_designs ) + { + *len = blend->num_designs; + return FT_THROW( Invalid_Argument ); + } + + for ( i = 0; i < blend->num_designs; i++ ) + weightvector[i] = blend->weight_vector[i]; + for ( ; i < *len; i++ ) + weightvector[i] = (FT_Fixed)0; + + *len = blend->num_designs; + + return FT_Err_Ok; + } + + FT_LOCAL_DEF( FT_Error ) T1_Set_MM_Design( T1_Face face, FT_UInt num_coords, @@ -573,11 +646,11 @@ } - /*************************************************************************/ - /* */ - /* Just a wrapper around T1_Set_MM_Design to support the different */ - /* arguments needed by the GX var distortable fonts. */ - /* */ + /************************************************************************** + * + * Just a wrapper around T1_Set_MM_Design to support the different + * arguments needed by the GX var distortable fonts. + */ FT_LOCAL_DEF( FT_Error ) T1_Set_Var_Design( T1_Face face, FT_UInt num_coords, @@ -719,6 +792,8 @@ if ( error ) goto Exit; + FT_TRACE4(( " [" )); + blend = face->blend; memory = face->root.memory; @@ -741,11 +816,13 @@ goto Exit; } + FT_TRACE4(( " /%.*s", len, token->start )); + name = (FT_Byte*)blend->axis_names[n]; if ( name ) { FT_TRACE0(( "parse_blend_axis_types:" - " overwriting axis name `%s' with `%*.s'\n", + " overwriting axis name `%s' with `%.*s'\n", name, len, token->start )); FT_FREE( name ); } @@ -758,6 +835,8 @@ name[len] = '\0'; } + FT_TRACE4(( "]\n" )); + Exit: loader->parser.root.error = error; } @@ -802,6 +881,8 @@ blend = face->blend; num_axis = 0; /* make compiler happy */ + FT_TRACE4(( " [" )); + for ( n = 0; n < num_designs; n++ ) { T1_TokenRec axis_tokens[T1_MAX_MM_AXIS]; @@ -842,6 +923,7 @@ } /* now read each axis token into the design position */ + FT_TRACE4(( " [" )) ; for ( axis = 0; axis < n_axis; axis++ ) { T1_Token token2 = axis_tokens + axis; @@ -850,9 +932,13 @@ parser->root.cursor = token2->start; parser->root.limit = token2->limit; blend->design_pos[n][axis] = T1_ToFixed( parser, 0 ); + FT_TRACE4(( " %f", (double)blend->design_pos[n][axis] / 65536 )); } + FT_TRACE4(( "]" )) ; } + FT_TRACE4(( "]\n" )); + loader->parser.root.cursor = old_cursor; loader->parser.root.limit = old_limit; } @@ -899,6 +985,8 @@ goto Exit; blend = face->blend; + FT_TRACE4(( " [" )); + /* now read each axis design map */ for ( n = 0; n < num_axis; n++ ) { @@ -915,6 +1003,8 @@ T1_ToTokenArray( parser, point_tokens, T1_MAX_MM_MAP_POINTS, &num_points ); + FT_TRACE4(( " [" )); + if ( num_points <= 0 || num_points > T1_MAX_MM_MAP_POINTS ) { FT_ERROR(( "parse_blend_design_map: incorrect table\n" )); @@ -948,9 +1038,17 @@ map->design_points[p] = T1_ToInt( parser ); map->blend_points [p] = T1_ToFixed( parser, 0 ); + + FT_TRACE4(( " [%d %f]", + map->design_points[p], + (double)map->blend_points[p] / 65536 )); } + + FT_TRACE4(( "]" )); } + FT_TRACE4(( "]\n" )); + parser->root.cursor = old_cursor; parser->root.limit = old_limit; @@ -1010,6 +1108,8 @@ old_cursor = parser->root.cursor; old_limit = parser->root.limit; + FT_TRACE4(( "[" )); + for ( n = 0; n < num_designs; n++ ) { token = design_tokens + n; @@ -1018,8 +1118,12 @@ blend->default_weight_vector[n] = blend->weight_vector[n] = T1_ToFixed( parser, 0 ); + + FT_TRACE4(( " %f", (double)blend->weight_vector[n] / 65536 )); } + FT_TRACE4(( "]\n" )); + parser->root.cursor = old_cursor; parser->root.limit = old_limit; @@ -1036,6 +1140,20 @@ { face->len_buildchar = (FT_UInt)T1_ToFixedArray( &loader->parser, 0, NULL, 0 ); + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt i; + + + FT_TRACE4(( " [" )); + for ( i = 0; i < face->len_buildchar; i++ ) + FT_TRACE4(( " 0" )); + + FT_TRACE4(( "]\n" )); + } +#endif + return; } @@ -1071,6 +1189,8 @@ /* if the keyword has a dedicated callback, call it */ if ( field->type == T1_FIELD_TYPE_CALLBACK ) { + FT_TRACE4(( " %s", field->ident )); + field->reader( (FT_Face)face, loader ); error = loader->parser.root.error; goto Exit; @@ -1148,6 +1268,8 @@ max_objects = 0; } + FT_TRACE4(( " %s", field->ident )); + if ( *objects ) { if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY || @@ -1167,6 +1289,8 @@ error = FT_Err_Ok; } + FT_TRACE4(( "\n" )); + Exit: return error; } @@ -1179,6 +1303,8 @@ FT_UNUSED( face ); loader->keywords_encountered |= T1_PRIVATE; + + FT_TRACE4(( "\n" )); } @@ -1258,6 +1384,14 @@ return; } + FT_TRACE4(( " [%f %f %f %f %f %f]\n", + (double)temp[0] / 65536 / 1000, + (double)temp[1] / 65536 / 1000, + (double)temp[2] / 65536 / 1000, + (double)temp[3] / 65536 / 1000, + (double)temp[4] / 65536 / 1000, + (double)temp[5] / 65536 / 1000 )); + temp_scale = FT_ABS( temp[3] ); if ( temp_scale == 0 ) @@ -1280,12 +1414,18 @@ temp[5] = FT_DivFix( temp[5], temp_scale ); temp[3] = temp[3] < 0 ? -0x10000L : 0x10000L; } - matrix->xx = temp[0]; matrix->yx = temp[1]; matrix->xy = temp[2]; matrix->yy = temp[3]; + if ( !FT_Matrix_Check( matrix ) ) + { + FT_ERROR(( "t1_parse_font_matrix: invalid font matrix\n" )); + parser->root.error = FT_THROW( Invalid_File_Format ); + return; + } + /* note that the offsets must be expressed in integer font units */ offset->x = temp[4] >> 16; offset->y = temp[5] >> 16; @@ -1367,12 +1507,7 @@ /* We need to `zero' out encoding_table.elements */ for ( n = 0; n < array_size; n++ ) - { - char* notdef = (char *)".notdef"; - - - (void)T1_Add_Table( char_table, n, notdef, 8 ); - } + (void)T1_Add_Table( char_table, n, ".notdef", 8 ); /* Now we need to read records of the form */ /* */ @@ -1494,6 +1629,15 @@ T1_Skip_Spaces( parser ); } +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( " [" )); + + /* XXX show encoding vector */ + FT_TRACE4(( "..." )); + + FT_TRACE4(( "]\n" )); +#endif + face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY; parser->root.cursor = cur; } @@ -1504,18 +1648,30 @@ { if ( cur + 17 < limit && ft_strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 ) + { face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD; + FT_TRACE4(( " StandardEncoding\n" )); + } else if ( cur + 15 < limit && ft_strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 ) + { face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT; + FT_TRACE4(( " ExpertEncoding\n" )); + } else if ( cur + 18 < limit && ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 ) + { face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1; + FT_TRACE4(( " ISOLatin1Encoding\n" )); + } else + { parser->root.error = FT_ERR( Ignore ); + FT_TRACE4(( "\n" )); + } } } @@ -1696,6 +1852,15 @@ if ( !loader->num_subrs ) loader->num_subrs = num_subrs; +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( " <" )); + + /* XXX show subrs? */ + FT_TRACE4(( "%d elements", num_subrs )); + + FT_TRACE4(( ">\n" )); +#endif + return; Fail: @@ -1977,7 +2142,6 @@ /* 0 333 hsbw endchar */ FT_Byte notdef_glyph[] = { 0x8B, 0xF7, 0xE1, 0x0D, 0x0E }; - char* notdef_name = (char *)".notdef"; error = T1_Add_Table( swap_table, 0, @@ -1992,7 +2156,7 @@ if ( error ) goto Fail; - error = T1_Add_Table( name_table, 0, notdef_name, 8 ); + error = T1_Add_Table( name_table, 0, ".notdef", 8 ); if ( error ) goto Fail; @@ -2017,6 +2181,15 @@ loader->num_glyphs += 1; } +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( " <" )); + + /* XXX show charstrings? */ + FT_TRACE4(( "%d elements", loader->num_glyphs )); + + FT_TRACE4(( ">\n" )); +#endif + return; Fail: @@ -2024,12 +2197,12 @@ } - /*************************************************************************/ - /* */ - /* Define the token field static variables. This is a set of */ - /* T1_FieldRec variables. */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * Define the token field static variables. This is a set of + * T1_FieldRec variables. + * + */ static @@ -2216,6 +2389,7 @@ ? T1_FIELD_DICT_PRIVATE : T1_FIELD_DICT_FONTDICT; + if ( !( dict & keyword->dict ) ) { FT_TRACE1(( "parse_dict: found `%s' but ignoring it" @@ -2330,6 +2504,7 @@ if ( error ) goto Exit; + FT_TRACE4(( " top dictionary:\n" )); error = parse_dict( face, &loader, parser->base_dict, parser->base_len ); if ( error ) @@ -2339,6 +2514,7 @@ if ( error ) goto Exit; + FT_TRACE4(( " private dictionary:\n" )); error = parse_dict( face, &loader, parser->private_dict, parser->private_len ); if ( error ) @@ -2349,6 +2525,16 @@ #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT + /* we don't support Multiple Master fonts with intermediate designs; */ + /* this implies that `num_designs' must be equal to `2^^num_axis' */ + if ( face->blend && + face->blend->num_designs != ( 1U << face->blend->num_axis ) ) + { + FT_ERROR(( "T1_Open_Face:" + " number-of-designs != 2 ^^ number-of-axes\n" )); + T1_Done_Blend( face ); + } + if ( face->blend && face->blend->num_default_design_vector != 0 && face->blend->num_default_design_vector != face->blend->num_axis ) @@ -2441,8 +2627,7 @@ /* we must now build type1.encoding when we have a custom array */ if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY ) { - FT_Int charcode, idx, min_char, max_char; - FT_Byte* glyph_name; + FT_Int charcode, idx, min_char, max_char; /* OK, we do the following: for each element in the encoding */ @@ -2456,27 +2641,27 @@ charcode = 0; for ( ; charcode < loader.encoding_table.max_elems; charcode++ ) { - FT_Byte* char_name; + const FT_String* char_name = + (const FT_String*)loader.encoding_table.elements[charcode]; type1->encoding.char_index[charcode] = 0; - type1->encoding.char_name [charcode] = (char *)".notdef"; + type1->encoding.char_name [charcode] = ".notdef"; - char_name = loader.encoding_table.elements[charcode]; if ( char_name ) for ( idx = 0; idx < type1->num_glyphs; idx++ ) { - glyph_name = (FT_Byte*)type1->glyph_names[idx]; - if ( ft_strcmp( (const char*)char_name, - (const char*)glyph_name ) == 0 ) + const FT_String* glyph_name = type1->glyph_names[idx]; + + + if ( ft_strcmp( char_name, glyph_name ) == 0 ) { type1->encoding.char_index[charcode] = (FT_UShort)idx; - type1->encoding.char_name [charcode] = (char*)glyph_name; + type1->encoding.char_name [charcode] = glyph_name; /* Change min/max encoded char only if glyph name is */ /* not /.notdef */ - if ( ft_strcmp( (const char*)".notdef", - (const char*)glyph_name ) != 0 ) + if ( ft_strcmp( ".notdef", glyph_name ) != 0 ) { if ( charcode < min_char ) min_char = charcode; diff --git a/src/3rdparty/freetype/src/type1/t1load.h b/src/3rdparty/freetype/src/type1/t1load.h index 03be3f7f93..44f835bde2 100644 --- a/src/3rdparty/freetype/src/type1/t1load.h +++ b/src/3rdparty/freetype/src/type1/t1load.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1load.h */ -/* */ -/* Type 1 font loader (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1load.h + * + * Type 1 font loader (specification). + * + * Copyright (C) 1996-2019 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 T1LOAD_H_ @@ -106,6 +106,16 @@ FT_BEGIN_HEADER FT_LOCAL( void ) T1_Done_Blend( T1_Face face ); + FT_LOCAL( FT_Error ) + T1_Set_MM_WeightVector( T1_Face face, + FT_UInt len, + FT_Fixed* weightvector ); + + FT_LOCAL( FT_Error ) + T1_Get_MM_WeightVector( T1_Face face, + FT_UInt* len, + FT_Fixed* weightvector ); + #endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */ diff --git a/src/3rdparty/freetype/src/type1/t1objs.c b/src/3rdparty/freetype/src/type1/t1objs.c index 7333c4c958..741388a645 100644 --- a/src/3rdparty/freetype/src/type1/t1objs.c +++ b/src/3rdparty/freetype/src/type1/t1objs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1objs.c */ -/* */ -/* Type 1 objects manager (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1objs.c + * + * Type 1 objects manager (body). + * + * Copyright (C) 1996-2019 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 @@ -36,21 +36,21 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_t1objs +#define FT_COMPONENT t1objs - /*************************************************************************/ - /* */ - /* SIZE FUNCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * SIZE FUNCTIONS + * + */ static PSH_Globals_Funcs @@ -133,11 +133,11 @@ } - /*************************************************************************/ - /* */ - /* SLOT FUNCTIONS */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * SLOT FUNCTIONS + * + */ FT_LOCAL_DEF( void ) T1_GlyphSlot_Done( FT_GlyphSlot slot ) @@ -177,24 +177,25 @@ } - /*************************************************************************/ - /* */ - /* FACE FUNCTIONS */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* T1_Face_Done */ - /* */ - /* */ - /* The face object destructor. */ - /* */ - /* */ - /* face :: A typeless pointer to the face object to destroy. */ - /* */ + /************************************************************************** + * + * FACE FUNCTIONS + * + */ + + + /************************************************************************** + * + * @Function: + * T1_Face_Done + * + * @Description: + * The face object destructor. + * + * @Input: + * face :: + * A typeless pointer to the face object to destroy. + */ FT_LOCAL_DEF( void ) T1_Face_Done( FT_Face t1face ) /* T1_Face */ { @@ -274,29 +275,34 @@ } - /*************************************************************************/ - /* */ - /* */ - /* T1_Face_Init */ - /* */ - /* */ - /* The face object constructor. */ - /* */ - /* */ - /* stream :: input stream where to load font data. */ - /* */ - /* face_index :: The index of the font face in the resource. */ - /* */ - /* num_params :: Number of additional generic parameters. Ignored. */ - /* */ - /* params :: Additional generic parameters. Ignored. */ - /* */ - /* */ - /* face :: The face record to build. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * T1_Face_Init + * + * @Description: + * The face object constructor. + * + * @Input: + * stream :: + * input stream where to load font data. + * + * face_index :: + * The index of the font face in the resource. + * + * num_params :: + * Number of additional generic parameters. Ignored. + * + * params :: + * Additional generic parameters. Ignored. + * + * @InOut: + * face :: + * The face record to build. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) T1_Face_Init( FT_Stream stream, FT_Face t1face, /* T1_Face */ @@ -341,6 +347,10 @@ if ( error ) goto Exit; + FT_TRACE2(( "T1_Face_Init: %08p (index %d)\n", + face, + face_index )); + /* if we just wanted to check the format, leave successfully now */ if ( face_index < 0 ) goto Exit; @@ -516,7 +526,8 @@ error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL ); if ( error && - FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) && + FT_ERR_NEQ( error, Unimplemented_Feature ) ) goto Exit; error = FT_Err_Ok; @@ -564,20 +575,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* T1_Driver_Init */ - /* */ - /* */ - /* Initializes a given Type 1 driver object. */ - /* */ - /* */ - /* driver :: A handle to the target driver object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * T1_Driver_Init + * + * @Description: + * Initializes a given Type 1 driver object. + * + * @Input: + * driver :: + * A handle to the target driver object. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) T1_Driver_Init( FT_Module module ) { @@ -620,17 +632,18 @@ } - /*************************************************************************/ - /* */ - /* */ - /* T1_Driver_Done */ - /* */ - /* */ - /* Finalizes a given Type 1 driver. */ - /* */ - /* */ - /* driver :: A handle to the target Type 1 driver. */ - /* */ + /************************************************************************** + * + * @Function: + * T1_Driver_Done + * + * @Description: + * Finalizes a given Type 1 driver. + * + * @Input: + * driver :: + * A handle to the target Type 1 driver. + */ FT_LOCAL_DEF( void ) T1_Driver_Done( FT_Module driver ) { diff --git a/src/3rdparty/freetype/src/type1/t1objs.h b/src/3rdparty/freetype/src/type1/t1objs.h index 8298e036f4..2161091f77 100644 --- a/src/3rdparty/freetype/src/type1/t1objs.h +++ b/src/3rdparty/freetype/src/type1/t1objs.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1objs.h */ -/* */ -/* Type 1 objects manager (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1objs.h + * + * Type 1 objects manager (specification). + * + * Copyright (C) 1996-2019 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 T1OBJS_H_ @@ -34,59 +34,59 @@ FT_BEGIN_HEADER typedef struct T1_Glyph_Hints_ T1_Glyph_Hints; - /*************************************************************************/ - /* */ - /* */ - /* T1_Size */ - /* */ - /* */ - /* A handle to a Type 1 size object. */ - /* */ + /************************************************************************** + * + * @Type: + * T1_Size + * + * @Description: + * A handle to a Type 1 size object. + */ typedef struct T1_SizeRec_* T1_Size; - /*************************************************************************/ - /* */ - /* */ - /* T1_GlyphSlot */ - /* */ - /* */ - /* A handle to a Type 1 glyph slot object. */ - /* */ + /************************************************************************** + * + * @Type: + * T1_GlyphSlot + * + * @Description: + * A handle to a Type 1 glyph slot object. + */ typedef struct T1_GlyphSlotRec_* T1_GlyphSlot; - /*************************************************************************/ - /* */ - /* */ - /* T1_CharMap */ - /* */ - /* */ - /* A handle to a Type 1 character mapping object. */ - /* */ - /* */ - /* The Type 1 format doesn't use a charmap but an encoding table. */ - /* The driver is responsible for making up charmap objects */ - /* corresponding to these tables. */ - /* */ + /************************************************************************** + * + * @Type: + * T1_CharMap + * + * @Description: + * A handle to a Type 1 character mapping object. + * + * @Note: + * The Type 1 format doesn't use a charmap but an encoding table. + * The driver is responsible for making up charmap objects + * corresponding to these tables. + */ typedef struct T1_CharMapRec_* T1_CharMap; - /*************************************************************************/ - /* */ - /* HERE BEGINS THE TYPE1 SPECIFIC STUFF */ - /* */ - /*************************************************************************/ + /************************************************************************** + * + * HERE BEGINS THE TYPE1 SPECIFIC STUFF + * + */ - /*************************************************************************/ - /* */ - /* */ - /* T1_SizeRec */ - /* */ - /* */ - /* Type 1 size record. */ - /* */ + /************************************************************************** + * + * @Type: + * T1_SizeRec + * + * @Description: + * Type 1 size record. + */ typedef struct T1_SizeRec_ { FT_SizeRec root; @@ -105,14 +105,14 @@ FT_BEGIN_HEADER T1_Size_Init( FT_Size size ); - /*************************************************************************/ - /* */ - /* */ - /* T1_GlyphSlotRec */ - /* */ - /* */ - /* Type 1 glyph slot record. */ - /* */ + /************************************************************************** + * + * @Type: + * T1_GlyphSlotRec + * + * @Description: + * Type 1 glyph slot record. + */ typedef struct T1_GlyphSlotRec_ { FT_GlyphSlotRec root; diff --git a/src/3rdparty/freetype/src/type1/t1parse.c b/src/3rdparty/freetype/src/type1/t1parse.c index 8e201e5ef5..56caeb9e40 100644 --- a/src/3rdparty/freetype/src/type1/t1parse.c +++ b/src/3rdparty/freetype/src/type1/t1parse.c @@ -1,36 +1,36 @@ -/***************************************************************************/ -/* */ -/* t1parse.c */ -/* */ -/* Type 1 parser (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 Type 1 parser is in charge of the following: */ - /* */ - /* - provide an implementation of a growing sequence of objects called */ - /* a `T1_Table' (used to build various tables needed by the loader). */ - /* */ - /* - opening .pfb and .pfa files to extract their top-level and private */ - /* dictionaries. */ - /* */ - /* - read numbers, arrays & strings from any dictionary. */ - /* */ - /* See `t1load.c' to see how data is loaded from the font file. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * t1parse.c + * + * Type 1 parser (body). + * + * Copyright (C) 1996-2019 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 Type 1 parser is in charge of the following: + * + * - provide an implementation of a growing sequence of objects called + * a `T1_Table' (used to build various tables needed by the loader). + * + * - opening .pfb and .pfa files to extract their top-level and private + * dictionaries. + * + * - read numbers, arrays & strings from any dictionary. + * + * See `t1load.c' to see how data is loaded from the font file. + * + */ #include @@ -43,14 +43,14 @@ #include "t1errors.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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_t1parse +#define FT_COMPONENT t1parse /*************************************************************************/ @@ -169,21 +169,21 @@ } } - /******************************************************************/ - /* */ - /* Here a short summary of what is going on: */ - /* */ - /* When creating a new Type 1 parser, we try to locate and load */ - /* the base dictionary if this is possible (i.e., for PFB */ - /* files). Otherwise, we load the whole font into memory. */ - /* */ - /* When `loading' the base dictionary, we only setup pointers */ - /* in the case of a memory-based stream. Otherwise, we */ - /* allocate and load the base dictionary in it. */ - /* */ - /* parser->in_pfb is set if we are in a binary (`.pfb') font. */ - /* parser->in_memory is set if we have a memory stream. */ - /* */ + /******************************************************************* + * + * Here a short summary of what is going on: + * + * When creating a new Type 1 parser, we try to locate and load + * the base dictionary if this is possible (i.e., for PFB + * files). Otherwise, we load the whole font into memory. + * + * When `loading' the base dictionary, we only setup pointers + * in the case of a memory-based stream. Otherwise, we + * allocate and load the base dictionary in it. + * + * parser->in_pfb is set if we are in a binary (`.pfb') font. + * parser->in_memory is set if we have a memory stream. + */ /* try to compute the size of the base dictionary; */ /* look for a Postscript binary file tag, i.e., 0x8001 */ diff --git a/src/3rdparty/freetype/src/type1/t1parse.h b/src/3rdparty/freetype/src/type1/t1parse.h index 4ac82ae913..dab8fddc8b 100644 --- a/src/3rdparty/freetype/src/type1/t1parse.h +++ b/src/3rdparty/freetype/src/type1/t1parse.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1parse.h */ -/* */ -/* Type 1 parser (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1parse.h + * + * Type 1 parser (specification). + * + * Copyright (C) 1996-2019 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 T1PARSE_H_ @@ -28,36 +28,45 @@ FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* */ - /* T1_ParserRec */ - /* */ - /* */ - /* A PS_ParserRec is an object used to parse a Type 1 fonts very */ - /* quickly. */ - /* */ - /* */ - /* root :: The root parser. */ - /* */ - /* stream :: The current input stream. */ - /* */ - /* base_dict :: A pointer to the top-level dictionary. */ - /* */ - /* base_len :: The length in bytes of the top dictionary. */ - /* */ - /* private_dict :: A pointer to the private dictionary. */ - /* */ - /* private_len :: The length in bytes of the private dictionary. */ - /* */ - /* in_pfb :: A boolean. Indicates that we are handling a PFB */ - /* file. */ - /* */ - /* in_memory :: A boolean. Indicates a memory-based stream. */ - /* */ - /* single_block :: A boolean. Indicates that the private dictionary */ - /* is stored in lieu of the base dictionary. */ - /* */ + /************************************************************************** + * + * @Struct: + * T1_ParserRec + * + * @Description: + * A PS_ParserRec is an object used to parse a Type 1 fonts very + * quickly. + * + * @Fields: + * root :: + * The root parser. + * + * stream :: + * The current input stream. + * + * base_dict :: + * A pointer to the top-level dictionary. + * + * base_len :: + * The length in bytes of the top dictionary. + * + * private_dict :: + * A pointer to the private dictionary. + * + * private_len :: + * The length in bytes of the private dictionary. + * + * in_pfb :: + * A boolean. Indicates that we are handling a PFB + * file. + * + * in_memory :: + * A boolean. Indicates a memory-based stream. + * + * single_block :: + * A boolean. Indicates that the private dictionary + * is stored in lieu of the base dictionary. + */ typedef struct T1_ParserRec_ { PS_ParserRec root; diff --git a/src/3rdparty/freetype/src/type1/t1tokens.h b/src/3rdparty/freetype/src/type1/t1tokens.h index 43a65d88ea..97f2dbe0cf 100644 --- a/src/3rdparty/freetype/src/type1/t1tokens.h +++ b/src/3rdparty/freetype/src/type1/t1tokens.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t1tokens.h */ -/* */ -/* Type 1 tokenizer (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t1tokens.h + * + * Type 1 tokenizer (specification). + * + * Copyright (C) 1996-2019 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. + * + */ #undef FT_STRUCTURE diff --git a/src/3rdparty/freetype/src/type1/type1.c b/src/3rdparty/freetype/src/type1/type1.c index 72eff59bfe..ce8557a5fb 100644 --- a/src/3rdparty/freetype/src/type1/type1.c +++ b/src/3rdparty/freetype/src/type1/type1.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* type1.c */ -/* */ -/* FreeType Type 1 driver component (body only). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * type1.c + * + * FreeType Type 1 driver component (body only). + * + * Copyright (C) 1996-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT diff --git a/src/3rdparty/freetype/src/type42/Jamfile b/src/3rdparty/freetype/src/type42/Jamfile index b98de05a74..6123b35598 100644 --- a/src/3rdparty/freetype/src/type42/Jamfile +++ b/src/3rdparty/freetype/src/type42/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/type42 Jamfile # -# Copyright 2002-2018 by +# Copyright (C) 2002-2019 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/src/3rdparty/freetype/src/type42/module.mk b/src/3rdparty/freetype/src/type42/module.mk index 3d4732bb6f..9e9d15455b 100644 --- a/src/3rdparty/freetype/src/type42/module.mk +++ b/src/3rdparty/freetype/src/type42/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2018 by +# Copyright (C) 2002-2019 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/src/3rdparty/freetype/src/type42/rules.mk b/src/3rdparty/freetype/src/type42/rules.mk index 9325d3898f..9d71f5300e 100644 --- a/src/3rdparty/freetype/src/type42/rules.mk +++ b/src/3rdparty/freetype/src/type42/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2018 by +# Copyright (C) 2002-2019 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/src/3rdparty/freetype/src/type42/t42drivr.c b/src/3rdparty/freetype/src/type42/t42drivr.c index f579b2708c..09ad632e97 100644 --- a/src/3rdparty/freetype/src/type42/t42drivr.c +++ b/src/3rdparty/freetype/src/type42/t42drivr.c @@ -1,39 +1,39 @@ -/***************************************************************************/ -/* */ -/* t42drivr.c */ -/* */ -/* High-level Type 42 driver interface (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* Roberto Alameda. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This driver implements Type42 fonts as described in the */ - /* Technical Note #5012 from Adobe, with these limitations: */ - /* */ - /* 1) CID Fonts are not currently supported. */ - /* 2) Incremental fonts making use of the GlyphDirectory keyword */ - /* will be loaded, but the rendering will be using the TrueType */ - /* tables. */ - /* 3) As for Type1 fonts, CDevProc is not supported. */ - /* 4) The Metrics dictionary is not supported. */ - /* 5) AFM metrics are not supported. */ - /* */ - /* In other words, this driver supports Type42 fonts derived from */ - /* TrueType fonts in a non-CID manner, as done by usual conversion */ - /* programs. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * t42drivr.c + * + * High-level Type 42 driver interface (body). + * + * Copyright (C) 2002-2019 by + * Roberto Alameda. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This driver implements Type42 fonts as described in the + * Technical Note #5012 from Adobe, with these limitations: + * + * 1) CID Fonts are not currently supported. + * 2) Incremental fonts making use of the GlyphDirectory keyword + * will be loaded, but the rendering will be using the TrueType + * tables. + * 3) As for Type1 fonts, CDevProc is not supported. + * 4) The Metrics dictionary is not supported. + * 5) AFM metrics are not supported. + * + * In other words, this driver supports Type42 fonts derived from + * TrueType fonts in a non-CID manner, as done by usual conversion + * programs. + * + */ #include "t42drivr.h" @@ -47,12 +47,12 @@ #include FT_SERVICE_POSTSCRIPT_INFO_H #undef FT_COMPONENT -#define FT_COMPONENT trace_t42 +#define FT_COMPONENT t42 /* * - * GLYPH DICT SERVICE + * GLYPH DICT SERVICE * */ @@ -69,8 +69,8 @@ static FT_UInt - t42_get_name_index( T42_Face face, - FT_String* glyph_name ) + t42_get_name_index( T42_Face face, + const FT_String* glyph_name ) { FT_Int i; @@ -98,7 +98,7 @@ /* * - * POSTSCRIPT NAME SERVICE + * POSTSCRIPT NAME SERVICE * */ @@ -117,7 +117,7 @@ /* * - * POSTSCRIPT INFO SERVICE + * POSTSCRIPT INFO SERVICE * */ @@ -173,7 +173,7 @@ /* * - * SERVICE LIST + * SERVICE LIST * */ diff --git a/src/3rdparty/freetype/src/type42/t42drivr.h b/src/3rdparty/freetype/src/type42/t42drivr.h index 3667f3e066..a35ca28f84 100644 --- a/src/3rdparty/freetype/src/type42/t42drivr.h +++ b/src/3rdparty/freetype/src/type42/t42drivr.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t42drivr.h */ -/* */ -/* High-level Type 42 driver interface (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* Roberto Alameda. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t42drivr.h + * + * High-level Type 42 driver interface (specification). + * + * Copyright (C) 2002-2019 by + * Roberto Alameda. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef T42DRIVR_H_ @@ -26,14 +26,8 @@ FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif - - FT_EXPORT_VAR( const FT_Driver_ClassRec ) t42_driver_class; - FT_END_HEADER diff --git a/src/3rdparty/freetype/src/type42/t42error.h b/src/3rdparty/freetype/src/type42/t42error.h index e3978a7607..5fb2143949 100644 --- a/src/3rdparty/freetype/src/type42/t42error.h +++ b/src/3rdparty/freetype/src/type42/t42error.h @@ -1,26 +1,26 @@ -/***************************************************************************/ -/* */ -/* t42error.h */ -/* */ -/* Type 42 error codes (specification only). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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 is used to define the Type 42 error enumeration constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * t42error.h + * + * Type 42 error codes (specification only). + * + * Copyright (C) 2002-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the Type 42 error enumeration constants. + * + */ #ifndef T42ERROR_H_ #define T42ERROR_H_ diff --git a/src/3rdparty/freetype/src/type42/t42objs.c b/src/3rdparty/freetype/src/type42/t42objs.c index 66e5c40382..d31bace451 100644 --- a/src/3rdparty/freetype/src/type42/t42objs.c +++ b/src/3rdparty/freetype/src/type42/t42objs.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t42objs.c */ -/* */ -/* Type 42 objects manager (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* Roberto Alameda. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t42objs.c + * + * Type 42 objects manager (body). + * + * Copyright (C) 2002-2019 by + * Roberto Alameda. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include "t42objs.h" @@ -25,7 +25,7 @@ #undef FT_COMPONENT -#define FT_COMPONENT trace_t42 +#define FT_COMPONENT t42 static FT_Error @@ -98,8 +98,7 @@ /* we must now build type1.encoding when we have a custom array */ if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY ) { - FT_Int charcode, idx, min_char, max_char; - FT_Byte* glyph_name; + FT_Int charcode, idx, min_char, max_char; /* OK, we do the following: for each element in the encoding */ @@ -114,27 +113,27 @@ charcode = 0; for ( ; charcode < loader.encoding_table.max_elems; charcode++ ) { - FT_Byte* char_name; + const FT_String* char_name = + (const FT_String*)loader.encoding_table.elements[charcode]; type1->encoding.char_index[charcode] = 0; - type1->encoding.char_name [charcode] = (char *)".notdef"; + type1->encoding.char_name [charcode] = ".notdef"; - char_name = loader.encoding_table.elements[charcode]; if ( char_name ) for ( idx = 0; idx < type1->num_glyphs; idx++ ) { - glyph_name = (FT_Byte*)type1->glyph_names[idx]; - if ( ft_strcmp( (const char*)char_name, - (const char*)glyph_name ) == 0 ) + const FT_String* glyph_name = type1->glyph_names[idx]; + + + if ( ft_strcmp( char_name, glyph_name ) == 0 ) { type1->encoding.char_index[charcode] = (FT_UShort)idx; - type1->encoding.char_name [charcode] = (char*)glyph_name; + type1->encoding.char_name [charcode] = glyph_name; /* Change min/max encoded char only if glyph name is */ /* not /.notdef */ - if ( ft_strcmp( (const char*)".notdef", - (const char*)glyph_name ) != 0 ) + if ( ft_strcmp( ".notdef", glyph_name ) != 0 ) { if ( charcode < min_char ) min_char = charcode; @@ -354,7 +353,8 @@ error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL ); if ( error && - FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) && + FT_ERR_NEQ( error, Unimplemented_Feature ) ) goto Exit; error = FT_Err_Ok; @@ -457,20 +457,21 @@ } - /*************************************************************************/ - /* */ - /* */ - /* T42_Driver_Init */ - /* */ - /* */ - /* Initializes a given Type 42 driver object. */ - /* */ - /* */ - /* driver :: A handle to the target driver object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /************************************************************************** + * + * @Function: + * T42_Driver_Init + * + * @Description: + * Initializes a given Type 42 driver object. + * + * @Input: + * driver :: + * A handle to the target driver object. + * + * @Return: + * FreeType error code. 0 means success. + */ FT_LOCAL_DEF( FT_Error ) T42_Driver_Init( FT_Module module ) /* T42_Driver */ { diff --git a/src/3rdparty/freetype/src/type42/t42objs.h b/src/3rdparty/freetype/src/type42/t42objs.h index 3bad5135e0..98300cf348 100644 --- a/src/3rdparty/freetype/src/type42/t42objs.h +++ b/src/3rdparty/freetype/src/type42/t42objs.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t42objs.h */ -/* */ -/* Type 42 objects manager (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* Roberto Alameda. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t42objs.h + * + * Type 42 objects manager (specification). + * + * Copyright (C) 2002-2019 by + * Roberto Alameda. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef T42OBJS_H_ diff --git a/src/3rdparty/freetype/src/type42/t42parse.c b/src/3rdparty/freetype/src/type42/t42parse.c index 4813d1f3f9..c47a77786d 100644 --- a/src/3rdparty/freetype/src/type42/t42parse.c +++ b/src/3rdparty/freetype/src/type42/t42parse.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t42parse.c */ -/* */ -/* Type 42 font parser (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* Roberto Alameda. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t42parse.c + * + * Type 42 font parser (body). + * + * Copyright (C) 2002-2019 by + * Roberto Alameda. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #include "t42parse.h" @@ -23,14 +23,14 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_t42 +#define FT_COMPONENT t42 static void @@ -149,19 +149,19 @@ parser->base_dict = NULL; parser->in_memory = 0; - /*******************************************************************/ - /* */ - /* Here a short summary of what is going on: */ - /* */ - /* When creating a new Type 42 parser, we try to locate and load */ - /* the base dictionary, loading the whole font into memory. */ - /* */ - /* When `loading' the base dictionary, we only set up pointers */ - /* in the case of a memory-based stream. Otherwise, we allocate */ - /* and load the base dictionary in it. */ - /* */ - /* parser->in_memory is set if we have a memory stream. */ - /* */ + /******************************************************************** + * + * Here a short summary of what is going on: + * + * When creating a new Type 42 parser, we try to locate and load + * the base dictionary, loading the whole font into memory. + * + * When `loading' the base dictionary, we only set up pointers + * in the case of a memory-based stream. Otherwise, we allocate + * and load the base dictionary in it. + * + * parser->in_memory is set if we have a memory stream. + */ if ( FT_STREAM_SEEK( 0L ) || FT_FRAME_ENTER( 17 ) ) @@ -226,7 +226,8 @@ if ( !parser->in_memory ) FT_FREE( parser->base_dict ); - parser->root.funcs.done( &parser->root ); + if ( parser->root.funcs.done ) + parser->root.funcs.done( &parser->root ); } @@ -284,6 +285,13 @@ matrix->xy = temp[2]; matrix->yy = temp[3]; + if ( !FT_Matrix_Check( matrix ) ) + { + FT_ERROR(( "t42_parse_font_matrix: invalid font matrix\n" )); + parser->root.error = FT_THROW( Invalid_File_Format ); + return; + } + /* note that the offsets must be expressed in integer font units */ offset->x = temp[4] >> 16; offset->y = temp[5] >> 16; @@ -366,12 +374,7 @@ /* We need to `zero' out encoding_table.elements */ for ( n = 0; n < count; n++ ) - { - char* notdef = (char *)".notdef"; - - - (void)T1_Add_Table( char_table, n, notdef, 8 ); - } + (void)T1_Add_Table( char_table, n, ".notdef", 8 ); /* Now we need to read records of the form */ /* */ @@ -588,6 +591,14 @@ else if ( *cur == '<' ) { + if ( string_buf && !allocated ) + { + FT_ERROR(( "t42_parse_sfnts: " + "can't handle mixed binary and hex strings\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Fail; + } + T1_Skip_PS_Token( parser ); if ( parser->root.error ) goto Exit; @@ -1006,8 +1017,7 @@ } /* if /.notdef does not occupy index 0, do our magic. */ - if ( ft_strcmp( (const char*)".notdef", - (const char*)name_table->elements[0] ) ) + if ( ft_strcmp( ".notdef", (const char*)name_table->elements[0] ) ) { /* Swap glyph in index 0 with /.notdef glyph. First, add index 0 */ /* name and code entries to swap_table. Then place notdef_index */ diff --git a/src/3rdparty/freetype/src/type42/t42parse.h b/src/3rdparty/freetype/src/type42/t42parse.h index f35d23de63..0c7bb48496 100644 --- a/src/3rdparty/freetype/src/type42/t42parse.h +++ b/src/3rdparty/freetype/src/type42/t42parse.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t42parse.h */ -/* */ -/* Type 42 font parser (specification). */ -/* */ -/* Copyright 2002-2018 by */ -/* Roberto Alameda. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t42parse.h + * + * Type 42 font parser (specification). + * + * Copyright (C) 2002-2019 by + * Roberto Alameda. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef T42PARSE_H_ diff --git a/src/3rdparty/freetype/src/type42/t42types.h b/src/3rdparty/freetype/src/type42/t42types.h index d0aa2de570..a258144ec3 100644 --- a/src/3rdparty/freetype/src/type42/t42types.h +++ b/src/3rdparty/freetype/src/type42/t42types.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* t42types.h */ -/* */ -/* Type 42 font data types (specification only). */ -/* */ -/* Copyright 2002-2018 by */ -/* Roberto Alameda. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * t42types.h + * + * Type 42 font data types (specification only). + * + * Copyright (C) 2002-2019 by + * Roberto Alameda. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ #ifndef T42TYPES_H_ diff --git a/src/3rdparty/freetype/src/type42/type42.c b/src/3rdparty/freetype/src/type42/type42.c index 6a89cfbed1..0cb7b77eec 100644 --- a/src/3rdparty/freetype/src/type42/type42.c +++ b/src/3rdparty/freetype/src/type42/type42.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* type42.c */ -/* */ -/* FreeType Type 42 driver component. */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * type42.c + * + * FreeType Type 42 driver component. + * + * Copyright (C) 2002-2019 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT diff --git a/src/3rdparty/freetype/src/winfonts/Jamfile b/src/3rdparty/freetype/src/winfonts/Jamfile index 4385e3b39f..4b92226159 100644 --- a/src/3rdparty/freetype/src/winfonts/Jamfile +++ b/src/3rdparty/freetype/src/winfonts/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/winfonts Jamfile # -# Copyright 2001-2018 by +# Copyright (C) 2001-2019 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/src/3rdparty/freetype/src/winfonts/fnterrs.h b/src/3rdparty/freetype/src/winfonts/fnterrs.h index 3a86af5aac..af29307c75 100644 --- a/src/3rdparty/freetype/src/winfonts/fnterrs.h +++ b/src/3rdparty/freetype/src/winfonts/fnterrs.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* fnterrs.h */ -/* */ -/* Win FNT/FON error codes (specification only). */ -/* */ -/* Copyright 2001-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the Windows FNT/FON error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * fnterrs.h + * + * Win FNT/FON error codes (specification only). + * + * Copyright (C) 2001-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the Windows FNT/FON error enumeration + * constants. + * + */ #ifndef FNTERRS_H_ #define FNTERRS_H_ diff --git a/src/3rdparty/freetype/src/winfonts/module.mk b/src/3rdparty/freetype/src/winfonts/module.mk index 13f9077cfc..82fb0151f8 100644 --- a/src/3rdparty/freetype/src/winfonts/module.mk +++ b/src/3rdparty/freetype/src/winfonts/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/winfonts/rules.mk b/src/3rdparty/freetype/src/winfonts/rules.mk index d694d1a771..998d49bc9f 100644 --- a/src/3rdparty/freetype/src/winfonts/rules.mk +++ b/src/3rdparty/freetype/src/winfonts/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2018 by +# Copyright (C) 1996-2019 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/src/3rdparty/freetype/src/winfonts/winfnt.c b/src/3rdparty/freetype/src/winfonts/winfnt.c index 36bd3148d5..2d771be2cc 100644 --- a/src/3rdparty/freetype/src/winfonts/winfnt.c +++ b/src/3rdparty/freetype/src/winfonts/winfnt.c @@ -1,21 +1,21 @@ -/***************************************************************************/ -/* */ -/* winfnt.c */ -/* */ -/* FreeType font driver for Windows FNT/FON files */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* Copyright 2003 Huw D M Davies for Codeweavers */ -/* Copyright 2007 Dmitry Timoshkov for Codeweavers */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * winfnt.c + * + * FreeType font driver for Windows FNT/FON files + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * Copyright 2003 Huw D M Davies for Codeweavers + * Copyright 2007 Dmitry Timoshkov for Codeweavers + * + * 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 @@ -30,14 +30,14 @@ #include FT_SERVICE_WINFNT_H #include FT_SERVICE_FONT_FORMAT_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. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_winfnt +#define FT_COMPONENT winfnt static const FT_Frame_Field winmz_header_fields[] = @@ -1131,10 +1131,10 @@ winfnt_get_header /* get_header */ }; - /* - * SERVICE LIST - * - */ + /* + * SERVICE LIST + * + */ static const FT_ServiceDescRec winfnt_services[] = { diff --git a/src/3rdparty/freetype/src/winfonts/winfnt.h b/src/3rdparty/freetype/src/winfonts/winfnt.h index 4885c9d745..b628ad4c42 100644 --- a/src/3rdparty/freetype/src/winfonts/winfnt.h +++ b/src/3rdparty/freetype/src/winfonts/winfnt.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* winfnt.h */ -/* */ -/* FreeType font driver for Windows FNT/FON files */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* Copyright 2007 Dmitry Timoshkov for Codeweavers */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * winfnt.h + * + * FreeType font driver for Windows FNT/FON files + * + * Copyright (C) 1996-2019 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * Copyright 2007 Dmitry Timoshkov for Codeweavers + * + * 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 WINFNT_H_ @@ -28,9 +28,6 @@ FT_BEGIN_HEADER -#ifdef FT_CONFIG_OPTION_PIC -#error "this module does not support PIC yet" -#endif typedef struct WinMZ_HeaderRec_ { @@ -153,9 +150,6 @@ FT_BEGIN_HEADER FT_FaceRec root; FNT_Font font; - FT_CharMap charmap_handle; - FT_CharMapRec charmap; /* a single charmap per face */ - } FNT_FaceRec, *FNT_Face; -- cgit v1.2.3