aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-09-04 11:54:47 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-09-04 12:06:07 +0300
commit8d7d78d2577a5785d026b0803b698e90fd79dbbe (patch)
treebf6dd1ffb07339912b4348c54ff55dae88d35e00 /contrib/libs
parent01728c8b67aff9291a0f7325e24758922554455d (diff)
downloadydb-8d7d78d2577a5785d026b0803b698e90fd79dbbe.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/libs')
-rw-r--r--contrib/libs/freetype/README10
-rw-r--r--contrib/libs/freetype/README.git2
-rw-r--r--contrib/libs/freetype/docs/CHANGES42
-rw-r--r--contrib/libs/freetype/docs/INSTALL4
-rw-r--r--contrib/libs/freetype/docs/INSTALL.ANY6
-rw-r--r--contrib/libs/freetype/docs/INSTALL.CROSS2
-rw-r--r--contrib/libs/freetype/docs/INSTALL.GNU2
-rw-r--r--contrib/libs/freetype/docs/INSTALL.UNIX2
-rw-r--r--contrib/libs/freetype/docs/INSTALL.VMS2
-rw-r--r--contrib/libs/freetype/docs/VERSIONS.TXT3
-rw-r--r--contrib/libs/freetype/docs/formats.txt2
-rw-r--r--contrib/libs/freetype/docs/freetype-web.txt42
-rw-r--r--contrib/libs/freetype/docs/raster.txt2
-rw-r--r--contrib/libs/freetype/include/freetype/config/ftconfig.h2
-rw-r--r--contrib/libs/freetype/include/freetype/config/ftheader.h2
-rw-r--r--contrib/libs/freetype/include/freetype/config/ftoption.h18
-rw-r--r--contrib/libs/freetype/include/freetype/config/ftstdlib.h2
-rw-r--r--contrib/libs/freetype/include/freetype/config/integer-types.h2
-rw-r--r--contrib/libs/freetype/include/freetype/config/mac-support.h2
-rw-r--r--contrib/libs/freetype/include/freetype/config/public-macros.h2
-rw-r--r--contrib/libs/freetype/include/freetype/freetype.h118
-rw-r--r--contrib/libs/freetype/include/freetype/ftadvanc.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftbbox.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftbdf.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftbitmap.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftbzip2.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftcache.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftcid.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftcolor.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftdriver.h76
-rw-r--r--contrib/libs/freetype/include/freetype/fterrdef.h2
-rw-r--r--contrib/libs/freetype/include/freetype/fterrors.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftfntfmt.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftgasp.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftglyph.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftgxval.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftgzip.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftimage.h29
-rw-r--r--contrib/libs/freetype/include/freetype/ftincrem.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftlcdfil.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftlist.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftlogging.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftlzw.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftmac.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftmm.h33
-rw-r--r--contrib/libs/freetype/include/freetype/ftmodapi.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftmoderr.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftotval.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftoutln.h4
-rw-r--r--contrib/libs/freetype/include/freetype/ftparams.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftpfr.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftrender.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftsizes.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftsnames.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftstroke.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftsynth.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftsystem.h2
-rw-r--r--contrib/libs/freetype/include/freetype/fttrigon.h2
-rw-r--r--contrib/libs/freetype/include/freetype/fttypes.h2
-rw-r--r--contrib/libs/freetype/include/freetype/ftwinfnt.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/autohint.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/cffotypes.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/cfftypes.h10
-rw-r--r--contrib/libs/freetype/include/freetype/internal/compiler-macros.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftcalc.h21
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftdebug.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftdrv.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftgloadr.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftmemory.h9
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftmmtypes.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftobjs.h8
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftpsprop.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftrfork.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftserv.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftstream.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/fttrace.h3
-rw-r--r--contrib/libs/freetype/include/freetype/internal/ftvalid.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/psaux.h21
-rw-r--r--contrib/libs/freetype/include/freetype/internal/pshints.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svbdf.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svcfftl.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svcid.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svfntfmt.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svgldict.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svgxval.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svkern.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svmetric.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svmm.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svotval.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svpfr.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svpostnm.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svprop.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svpscmap.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svpsinfo.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svsfnt.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svttcmap.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svtteng.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svttglyf.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/services/svwinfnt.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/sfnt.h9
-rw-r--r--contrib/libs/freetype/include/freetype/internal/svginterface.h2
-rw-r--r--contrib/libs/freetype/include/freetype/internal/t1types.h52
-rw-r--r--contrib/libs/freetype/include/freetype/internal/tttypes.h12
-rw-r--r--contrib/libs/freetype/include/freetype/internal/wofftypes.h2
-rw-r--r--contrib/libs/freetype/include/freetype/otsvg.h2
-rw-r--r--contrib/libs/freetype/include/freetype/t1tables.h60
-rw-r--r--contrib/libs/freetype/include/freetype/ttnameid.h2
-rw-r--r--contrib/libs/freetype/include/freetype/tttables.h7
-rw-r--r--contrib/libs/freetype/include/freetype/tttags.h2
-rw-r--r--contrib/libs/freetype/include/ft2build.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afblue.c2
-rw-r--r--contrib/libs/freetype/src/autofit/afblue.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afcjk.c2
-rw-r--r--contrib/libs/freetype/src/autofit/afcjk.h4
-rw-r--r--contrib/libs/freetype/src/autofit/afcover.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afdummy.c2
-rw-r--r--contrib/libs/freetype/src/autofit/afdummy.h2
-rw-r--r--contrib/libs/freetype/src/autofit/aferrors.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afglobal.c2
-rw-r--r--contrib/libs/freetype/src/autofit/afglobal.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afhints.c18
-rw-r--r--contrib/libs/freetype/src/autofit/afhints.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afindic.c2
-rw-r--r--contrib/libs/freetype/src/autofit/afindic.h2
-rw-r--r--contrib/libs/freetype/src/autofit/aflatin.c9
-rw-r--r--contrib/libs/freetype/src/autofit/aflatin.h4
-rw-r--r--contrib/libs/freetype/src/autofit/afloader.c2
-rw-r--r--contrib/libs/freetype/src/autofit/afloader.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afmodule.c4
-rw-r--r--contrib/libs/freetype/src/autofit/afmodule.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afranges.c2
-rw-r--r--contrib/libs/freetype/src/autofit/afranges.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afscript.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afshaper.c2
-rw-r--r--contrib/libs/freetype/src/autofit/afshaper.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afstyles.h2
-rw-r--r--contrib/libs/freetype/src/autofit/aftypes.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afws-decl.h2
-rw-r--r--contrib/libs/freetype/src/autofit/afws-iter.h2
-rw-r--r--contrib/libs/freetype/src/autofit/autofit.c2
-rw-r--r--contrib/libs/freetype/src/base/ftadvanc.c2
-rw-r--r--contrib/libs/freetype/src/base/ftbase.c2
-rw-r--r--contrib/libs/freetype/src/base/ftbase.h2
-rw-r--r--contrib/libs/freetype/src/base/ftbbox.c4
-rw-r--r--contrib/libs/freetype/src/base/ftbdf.c2
-rw-r--r--contrib/libs/freetype/src/base/ftbitmap.c2
-rw-r--r--contrib/libs/freetype/src/base/ftcalc.c169
-rw-r--r--contrib/libs/freetype/src/base/ftcid.c2
-rw-r--r--contrib/libs/freetype/src/base/ftcolor.c2
-rw-r--r--contrib/libs/freetype/src/base/ftdbgmem.c2
-rw-r--r--contrib/libs/freetype/src/base/ftdebug.c2
-rw-r--r--contrib/libs/freetype/src/base/fterrors.c2
-rw-r--r--contrib/libs/freetype/src/base/ftfntfmt.c2
-rw-r--r--contrib/libs/freetype/src/base/ftfstype.c2
-rw-r--r--contrib/libs/freetype/src/base/ftgasp.c2
-rw-r--r--contrib/libs/freetype/src/base/ftgloadr.c33
-rw-r--r--contrib/libs/freetype/src/base/ftglyph.c2
-rw-r--r--contrib/libs/freetype/src/base/ftgxval.c2
-rw-r--r--contrib/libs/freetype/src/base/ftinit.c2
-rw-r--r--contrib/libs/freetype/src/base/ftlcdfil.c2
-rw-r--r--contrib/libs/freetype/src/base/ftmac.c21
-rw-r--r--contrib/libs/freetype/src/base/ftmm.c2
-rw-r--r--contrib/libs/freetype/src/base/ftobjs.c9
-rw-r--r--contrib/libs/freetype/src/base/ftotval.c2
-rw-r--r--contrib/libs/freetype/src/base/ftoutln.c18
-rw-r--r--contrib/libs/freetype/src/base/ftpatent.c2
-rw-r--r--contrib/libs/freetype/src/base/ftpfr.c2
-rw-r--r--contrib/libs/freetype/src/base/ftpsprop.c2
-rw-r--r--contrib/libs/freetype/src/base/ftrfork.c2
-rw-r--r--contrib/libs/freetype/src/base/ftsnames.c2
-rw-r--r--contrib/libs/freetype/src/base/ftstream.c8
-rw-r--r--contrib/libs/freetype/src/base/ftstroke.c16
-rw-r--r--contrib/libs/freetype/src/base/ftsynth.c2
-rw-r--r--contrib/libs/freetype/src/base/ftsystem.c2
-rw-r--r--contrib/libs/freetype/src/base/fttrigon.c2
-rw-r--r--contrib/libs/freetype/src/base/fttype1.c2
-rw-r--r--contrib/libs/freetype/src/base/ftutil.c2
-rw-r--r--contrib/libs/freetype/src/base/ftwinfnt.c2
-rw-r--r--contrib/libs/freetype/src/bdf/bdfdrivr.c4
-rw-r--r--contrib/libs/freetype/src/bdf/bdflib.c15
-rw-r--r--contrib/libs/freetype/src/bzip2/ftbzip2.c2
-rw-r--r--contrib/libs/freetype/src/cache/ftcache.c2
-rw-r--r--contrib/libs/freetype/src/cache/ftcbasic.c120
-rw-r--r--contrib/libs/freetype/src/cache/ftccache.c35
-rw-r--r--contrib/libs/freetype/src/cache/ftccache.h6
-rw-r--r--contrib/libs/freetype/src/cache/ftccback.h12
-rw-r--r--contrib/libs/freetype/src/cache/ftccmap.c4
-rw-r--r--contrib/libs/freetype/src/cache/ftcerror.h2
-rw-r--r--contrib/libs/freetype/src/cache/ftcglyph.c6
-rw-r--r--contrib/libs/freetype/src/cache/ftcglyph.h3
-rw-r--r--contrib/libs/freetype/src/cache/ftcimage.c14
-rw-r--r--contrib/libs/freetype/src/cache/ftcimage.h2
-rw-r--r--contrib/libs/freetype/src/cache/ftcmanag.c57
-rw-r--r--contrib/libs/freetype/src/cache/ftcmanag.h2
-rw-r--r--contrib/libs/freetype/src/cache/ftcmru.c69
-rw-r--r--contrib/libs/freetype/src/cache/ftcmru.h8
-rw-r--r--contrib/libs/freetype/src/cache/ftcsbits.c5
-rw-r--r--contrib/libs/freetype/src/cache/ftcsbits.h2
-rw-r--r--contrib/libs/freetype/src/cff/cff.c2
-rw-r--r--contrib/libs/freetype/src/cff/cffcmap.c2
-rw-r--r--contrib/libs/freetype/src/cff/cffcmap.h2
-rw-r--r--contrib/libs/freetype/src/cff/cffdrivr.c2
-rw-r--r--contrib/libs/freetype/src/cff/cffdrivr.h2
-rw-r--r--contrib/libs/freetype/src/cff/cfferrs.h2
-rw-r--r--contrib/libs/freetype/src/cff/cffgload.c2
-rw-r--r--contrib/libs/freetype/src/cff/cffgload.h2
-rw-r--r--contrib/libs/freetype/src/cff/cffload.c77
-rw-r--r--contrib/libs/freetype/src/cff/cffload.h2
-rw-r--r--contrib/libs/freetype/src/cff/cffobjs.c95
-rw-r--r--contrib/libs/freetype/src/cff/cffobjs.h2
-rw-r--r--contrib/libs/freetype/src/cff/cffparse.c97
-rw-r--r--contrib/libs/freetype/src/cff/cffparse.h3
-rw-r--r--contrib/libs/freetype/src/cff/cfftoken.h74
-rw-r--r--contrib/libs/freetype/src/cid/ciderrs.h2
-rw-r--r--contrib/libs/freetype/src/cid/cidgload.c2
-rw-r--r--contrib/libs/freetype/src/cid/cidgload.h2
-rw-r--r--contrib/libs/freetype/src/cid/cidload.c41
-rw-r--r--contrib/libs/freetype/src/cid/cidload.h2
-rw-r--r--contrib/libs/freetype/src/cid/cidobjs.c2
-rw-r--r--contrib/libs/freetype/src/cid/cidobjs.h2
-rw-r--r--contrib/libs/freetype/src/cid/cidparse.c69
-rw-r--r--contrib/libs/freetype/src/cid/cidparse.h2
-rw-r--r--contrib/libs/freetype/src/cid/cidriver.c2
-rw-r--r--contrib/libs/freetype/src/cid/cidriver.h2
-rw-r--r--contrib/libs/freetype/src/cid/cidtoken.h2
-rw-r--r--contrib/libs/freetype/src/cid/type1cid.c2
-rw-r--r--contrib/libs/freetype/src/dlg/dlgwrap.c2
-rw-r--r--contrib/libs/freetype/src/gzip/README.freetype3
-rw-r--r--contrib/libs/freetype/src/gzip/ftgzip.c2
-rw-r--r--contrib/libs/freetype/src/lzw/ftlzw.c2
-rw-r--r--contrib/libs/freetype/src/lzw/ftzopen.c2
-rw-r--r--contrib/libs/freetype/src/lzw/ftzopen.h2
-rw-r--r--contrib/libs/freetype/src/pcf/pcfdrivr.c2
-rw-r--r--contrib/libs/freetype/src/pcf/pcfutil.c2
-rw-r--r--contrib/libs/freetype/src/pfr/pfr.c2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrcmap.c2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrcmap.h2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrdrivr.c2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrdrivr.h2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrerror.h2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrgload.c10
-rw-r--r--contrib/libs/freetype/src/pfr/pfrgload.h2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrload.c2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrload.h2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrobjs.c2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrobjs.h2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrsbit.c2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrsbit.h2
-rw-r--r--contrib/libs/freetype/src/pfr/pfrtypes.h2
-rw-r--r--contrib/libs/freetype/src/psaux/afmparse.c2
-rw-r--r--contrib/libs/freetype/src/psaux/afmparse.h2
-rw-r--r--contrib/libs/freetype/src/psaux/cffdecode.c20
-rw-r--r--contrib/libs/freetype/src/psaux/cffdecode.h2
-rw-r--r--contrib/libs/freetype/src/psaux/psaux.c2
-rw-r--r--contrib/libs/freetype/src/psaux/psauxerr.h2
-rw-r--r--contrib/libs/freetype/src/psaux/psauxmod.c2
-rw-r--r--contrib/libs/freetype/src/psaux/psauxmod.h2
-rw-r--r--contrib/libs/freetype/src/psaux/psblues.c48
-rw-r--r--contrib/libs/freetype/src/psaux/psconv.c2
-rw-r--r--contrib/libs/freetype/src/psaux/psconv.h2
-rw-r--r--contrib/libs/freetype/src/psaux/psft.c16
-rw-r--r--contrib/libs/freetype/src/psaux/psft.h8
-rw-r--r--contrib/libs/freetype/src/psaux/psintrp.c27
-rw-r--r--contrib/libs/freetype/src/psaux/psobjs.c46
-rw-r--r--contrib/libs/freetype/src/psaux/psobjs.h2
-rw-r--r--contrib/libs/freetype/src/psaux/t1cmap.c2
-rw-r--r--contrib/libs/freetype/src/psaux/t1cmap.h2
-rw-r--r--contrib/libs/freetype/src/psaux/t1decode.c2
-rw-r--r--contrib/libs/freetype/src/psaux/t1decode.h2
-rw-r--r--contrib/libs/freetype/src/pshinter/pshalgo.c10
-rw-r--r--contrib/libs/freetype/src/pshinter/pshalgo.h2
-rw-r--r--contrib/libs/freetype/src/pshinter/pshglob.c2
-rw-r--r--contrib/libs/freetype/src/pshinter/pshglob.h2
-rw-r--r--contrib/libs/freetype/src/pshinter/pshinter.c2
-rw-r--r--contrib/libs/freetype/src/pshinter/pshmod.c2
-rw-r--r--contrib/libs/freetype/src/pshinter/pshmod.h2
-rw-r--r--contrib/libs/freetype/src/pshinter/pshnterr.h2
-rw-r--r--contrib/libs/freetype/src/pshinter/pshrec.c4
-rw-r--r--contrib/libs/freetype/src/pshinter/pshrec.h2
-rw-r--r--contrib/libs/freetype/src/psnames/psmodule.c2
-rw-r--r--contrib/libs/freetype/src/psnames/psmodule.h2
-rw-r--r--contrib/libs/freetype/src/psnames/psnamerr.h2
-rw-r--r--contrib/libs/freetype/src/psnames/psnames.c2
-rw-r--r--contrib/libs/freetype/src/psnames/pstables.h2
-rw-r--r--contrib/libs/freetype/src/raster/ftraster.c1750
-rw-r--r--contrib/libs/freetype/src/raster/ftraster.h2
-rw-r--r--contrib/libs/freetype/src/raster/ftrend1.c2
-rw-r--r--contrib/libs/freetype/src/raster/ftrend1.h2
-rw-r--r--contrib/libs/freetype/src/raster/raster.c2
-rw-r--r--contrib/libs/freetype/src/raster/rasterrs.h2
-rw-r--r--contrib/libs/freetype/src/sdf/ftbsdf.c2
-rw-r--r--contrib/libs/freetype/src/sdf/ftsdf.c4
-rw-r--r--contrib/libs/freetype/src/sdf/ftsdf.h2
-rw-r--r--contrib/libs/freetype/src/sdf/ftsdfcommon.c45
-rw-r--r--contrib/libs/freetype/src/sdf/ftsdfcommon.h5
-rw-r--r--contrib/libs/freetype/src/sdf/ftsdferrs.h2
-rw-r--r--contrib/libs/freetype/src/sdf/ftsdfrend.c2
-rw-r--r--contrib/libs/freetype/src/sdf/ftsdfrend.h2
-rw-r--r--contrib/libs/freetype/src/sdf/sdf.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/pngshim.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/pngshim.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/sfdriver.c17
-rw-r--r--contrib/libs/freetype/src/sfnt/sfdriver.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/sferrors.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/sfnt.c3
-rw-r--r--contrib/libs/freetype/src/sfnt/sfobjs.c21
-rw-r--r--contrib/libs/freetype/src/sfnt/sfobjs.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/sfwoff.c20
-rw-r--r--contrib/libs/freetype/src/sfnt/sfwoff.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/sfwoff2.c52
-rw-r--r--contrib/libs/freetype/src/sfnt/sfwoff2.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttbdf.c4
-rw-r--r--contrib/libs/freetype/src/sfnt/ttbdf.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttcmap.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttcmap.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttcmapc.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttcolr.c38
-rw-r--r--contrib/libs/freetype/src/sfnt/ttcolr.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttcpal.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttcpal.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttgpos.c598
-rw-r--r--contrib/libs/freetype/src/sfnt/ttgpos.h53
-rw-r--r--contrib/libs/freetype/src/sfnt/ttkern.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttkern.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttload.c4
-rw-r--r--contrib/libs/freetype/src/sfnt/ttload.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttmtx.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttmtx.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttpost.c50
-rw-r--r--contrib/libs/freetype/src/sfnt/ttpost.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttsbit.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttsbit.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttsvg.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/ttsvg.h2
-rw-r--r--contrib/libs/freetype/src/sfnt/woff2tags.c2
-rw-r--r--contrib/libs/freetype/src/sfnt/woff2tags.h2
-rw-r--r--contrib/libs/freetype/src/smooth/ftgrays.c461
-rw-r--r--contrib/libs/freetype/src/smooth/ftgrays.h2
-rw-r--r--contrib/libs/freetype/src/smooth/ftsmerrs.h2
-rw-r--r--contrib/libs/freetype/src/smooth/ftsmooth.c2
-rw-r--r--contrib/libs/freetype/src/smooth/ftsmooth.h2
-rw-r--r--contrib/libs/freetype/src/smooth/smooth.c2
-rw-r--r--contrib/libs/freetype/src/svg/ftsvg.c2
-rw-r--r--contrib/libs/freetype/src/svg/ftsvg.h2
-rw-r--r--contrib/libs/freetype/src/svg/svg.c2
-rw-r--r--contrib/libs/freetype/src/svg/svgtypes.h2
-rw-r--r--contrib/libs/freetype/src/truetype/truetype.c2
-rw-r--r--contrib/libs/freetype/src/truetype/ttdriver.c17
-rw-r--r--contrib/libs/freetype/src/truetype/ttdriver.h2
-rw-r--r--contrib/libs/freetype/src/truetype/tterrors.h2
-rw-r--r--contrib/libs/freetype/src/truetype/ttgload.c51
-rw-r--r--contrib/libs/freetype/src/truetype/ttgload.h2
-rw-r--r--contrib/libs/freetype/src/truetype/ttgxvar.c417
-rw-r--r--contrib/libs/freetype/src/truetype/ttgxvar.h2
-rw-r--r--contrib/libs/freetype/src/truetype/ttinterp.c16
-rw-r--r--contrib/libs/freetype/src/truetype/ttinterp.h2
-rw-r--r--contrib/libs/freetype/src/truetype/ttobjs.c50
-rw-r--r--contrib/libs/freetype/src/truetype/ttobjs.h4
-rw-r--r--contrib/libs/freetype/src/truetype/ttpload.c2
-rw-r--r--contrib/libs/freetype/src/truetype/ttpload.h2
-rw-r--r--contrib/libs/freetype/src/type1/t1afm.c2
-rw-r--r--contrib/libs/freetype/src/type1/t1afm.h2
-rw-r--r--contrib/libs/freetype/src/type1/t1driver.c10
-rw-r--r--contrib/libs/freetype/src/type1/t1driver.h2
-rw-r--r--contrib/libs/freetype/src/type1/t1errors.h2
-rw-r--r--contrib/libs/freetype/src/type1/t1gload.c2
-rw-r--r--contrib/libs/freetype/src/type1/t1gload.h2
-rw-r--r--contrib/libs/freetype/src/type1/t1load.c28
-rw-r--r--contrib/libs/freetype/src/type1/t1load.h2
-rw-r--r--contrib/libs/freetype/src/type1/t1objs.c2
-rw-r--r--contrib/libs/freetype/src/type1/t1objs.h2
-rw-r--r--contrib/libs/freetype/src/type1/t1parse.c2
-rw-r--r--contrib/libs/freetype/src/type1/t1parse.h2
-rw-r--r--contrib/libs/freetype/src/type1/t1tokens.h2
-rw-r--r--contrib/libs/freetype/src/type1/type1.c2
-rw-r--r--contrib/libs/freetype/src/type42/t42drivr.c2
-rw-r--r--contrib/libs/freetype/src/type42/t42drivr.h2
-rw-r--r--contrib/libs/freetype/src/type42/t42error.h2
-rw-r--r--contrib/libs/freetype/src/type42/t42objs.c2
-rw-r--r--contrib/libs/freetype/src/type42/t42objs.h2
-rw-r--r--contrib/libs/freetype/src/type42/t42parse.c22
-rw-r--r--contrib/libs/freetype/src/type42/t42parse.h2
-rw-r--r--contrib/libs/freetype/src/type42/t42types.h2
-rw-r--r--contrib/libs/freetype/src/type42/type42.c2
-rw-r--r--contrib/libs/freetype/src/winfonts/fnterrs.h2
-rw-r--r--contrib/libs/freetype/src/winfonts/winfnt.c8
-rw-r--r--contrib/libs/freetype/src/winfonts/winfnt.h2
-rw-r--r--contrib/libs/freetype/ya.make2
388 files changed, 3101 insertions, 3157 deletions
diff --git a/contrib/libs/freetype/README b/contrib/libs/freetype/README
index cd4c1d7d11..0f5d3e0e02 100644
--- a/contrib/libs/freetype/README
+++ b/contrib/libs/freetype/README
@@ -1,4 +1,4 @@
-FreeType 2.13.2
+FreeType 2.13.3
===============
Homepage: https://www.freetype.org
@@ -32,9 +32,9 @@ sites. Go to
and download one of the following files.
- freetype-doc-2.13.2.tar.xz
- freetype-doc-2.13.2.tar.gz
- ftdoc2132.zip
+ freetype-doc-2.13.3.tar.xz
+ freetype-doc-2.13.3.tar.gz
+ ftdoc2133.zip
To view the documentation online, go to
@@ -94,7 +94,7 @@ Enjoy!
----------------------------------------------------------------------
-Copyright (C) 2006-2023 by
+Copyright (C) 2006-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/README.git b/contrib/libs/freetype/README.git
index 117d74f0d9..c818bbb5f9 100644
--- a/contrib/libs/freetype/README.git
+++ b/contrib/libs/freetype/README.git
@@ -89,7 +89,7 @@ address:
----------------------------------------------------------------------
-Copyright (C) 2005-2023 by
+Copyright (C) 2005-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/CHANGES b/contrib/libs/freetype/docs/CHANGES
index 96cf607d70..bd7b12a8a8 100644
--- a/contrib/libs/freetype/docs/CHANGES
+++ b/contrib/libs/freetype/docs/CHANGES
@@ -1,3 +1,43 @@
+CHANGES BETWEEN 2.13.2 and 2.13.3 (2024-Aug-11)
+
+ I. IMPORTANT CHANGES
+
+ - Some fields in the `FT_Outline` structure have been changed
+ from signed to unsigned type, which better reflects the actual
+ usage. It is also an additional means to protect against
+ malformed input.
+
+
+ II. IMPORTANT BUG FIXES
+
+ - Rare double-free crashes in the cache subsystem have been fixed.
+
+ - Excessive stack allocation in the autohinter has been fixed.
+
+
+ III. MISCELLANEOUS
+
+ - The B/W rasterizer has received a major upkeep that results in
+ large performance improvements. The rendering speed has increased
+ and even doubled for very complex glyphs.
+
+ - If the new configuration option `TT_CONFIG_OPTION_GPOS_KERNING` is
+ defined, `FT_Get_Kerning` understands rudimentary GPOS kerning
+ (for TrueType fonts only). This is not enabled by default since
+ its usage is very limited, mainly for legacy applications that
+ have to support TrueType fonts automatically converted from 'kern'
+ tables to GPOS kerning. If you need proper (GPOS) kerning support
+ please use a higher-level library like HarfBuzz.
+
+ Code contributed by David Saltzman <davidbsaltzman@gmail.com>.
+
+ - The internal structures `PS_DesignMap` and `PS_Blend` related to
+ parsing of old Multiple Masters fonts have been removed from the
+ public header file `t1tables.h`.
+
+
+======================================================================
+
CHANGES BETWEEN 2.13.1 and 2.13.2 (2023-Aug-25)
I. MISCELLANEOUS
@@ -5668,7 +5708,7 @@ Extensions support:
------------------------------------------------------------------------
-Copyright (C) 2000-2023 by
+Copyright (C) 2000-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/INSTALL b/contrib/libs/freetype/docs/INSTALL
index 49ab112e41..0ab2a5e9ea 100644
--- a/contrib/libs/freetype/docs/INSTALL
+++ b/contrib/libs/freetype/docs/INSTALL
@@ -59,7 +59,7 @@ II. Normal installation and upgrades
CMake :: see `CMakeLists.txt` for more information
Meson :: see `meson.build` for more information
- MSBuild :: see `builds/windows/vc2010/freetype.vcxproj`
+ MSBuild :: see `MSBuild.sln` for more information
MMS :: see `vms_make.com` and `docs/INSTALL.VMS`
@@ -101,7 +101,7 @@ III. Custom builds of the library
----------------------------------------------------------------------
-Copyright (C) 2000-2023 by
+Copyright (C) 2000-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/INSTALL.ANY b/contrib/libs/freetype/docs/INSTALL.ANY
index bb77b1b9c2..32ee707a10 100644
--- a/contrib/libs/freetype/docs/INSTALL.ANY
+++ b/contrib/libs/freetype/docs/INSTALL.ANY
@@ -72,9 +72,9 @@ I. Standard procedure
-- rasterizers (optional; at least one is needed for vector
formats)
+ src/smooth/smooth.c -- anti-aliasing rasterizer
src/raster/raster.c -- monochrome rasterizer
src/sdf/sdf.c -- Signed Distance Field driver
- src/smooth/smooth.c -- anti-aliasing rasterizer
-- auxiliary modules (optional)
@@ -127,7 +127,7 @@ II. Support for flat-directory compilation
1. Copy all files in current directory
cp freetype/src/base/*.[hc] .
- cp freetype/src/raster1/*.[hc] .
+ cp freetype/src/raster/*.[hc] .
cp freetype/src/smooth/*.[hc] .
etc.
@@ -144,7 +144,7 @@ II. Support for flat-directory compilation
----------------------------------------------------------------------
-Copyright (C) 2003-2023 by
+Copyright (C) 2003-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/INSTALL.CROSS b/contrib/libs/freetype/docs/INSTALL.CROSS
index 21f4c31824..b774527e56 100644
--- a/contrib/libs/freetype/docs/INSTALL.CROSS
+++ b/contrib/libs/freetype/docs/INSTALL.CROSS
@@ -163,7 +163,7 @@ procedure.
----------------------------------------------------------------------
-Copyright (C) 2006-2023 by
+Copyright (C) 2006-2024 by
suzuki toshiya, David Turner, Robert Wilhelm, and Werner Lemberg.
diff --git a/contrib/libs/freetype/docs/INSTALL.GNU b/contrib/libs/freetype/docs/INSTALL.GNU
index 7517d9c7c4..57f2018328 100644
--- a/contrib/libs/freetype/docs/INSTALL.GNU
+++ b/contrib/libs/freetype/docs/INSTALL.GNU
@@ -168,7 +168,7 @@ instructions in the file `INSTALL.UNIX' instead.
----------------------------------------------------------------------
-Copyright (C) 2003-2023 by
+Copyright (C) 2003-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/INSTALL.UNIX b/contrib/libs/freetype/docs/INSTALL.UNIX
index 659f3a21f0..4a4a101e3e 100644
--- a/contrib/libs/freetype/docs/INSTALL.UNIX
+++ b/contrib/libs/freetype/docs/INSTALL.UNIX
@@ -126,7 +126,7 @@ or MSys on Win32:
----------------------------------------------------------------------
-Copyright (C) 2003-2023 by
+Copyright (C) 2003-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/INSTALL.VMS b/contrib/libs/freetype/docs/INSTALL.VMS
index 4f8c3ac33d..ba5aece898 100644
--- a/contrib/libs/freetype/docs/INSTALL.VMS
+++ b/contrib/libs/freetype/docs/INSTALL.VMS
@@ -56,7 +56,7 @@ Orginal version of the build procedures was created by
------------------------------------------------------------------------
-Copyright (C) 2000-2023 by
+Copyright (C) 2000-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/VERSIONS.TXT b/contrib/libs/freetype/docs/VERSIONS.TXT
index 8b43c15837..a84067dfe1 100644
--- a/contrib/libs/freetype/docs/VERSIONS.TXT
+++ b/contrib/libs/freetype/docs/VERSIONS.TXT
@@ -60,6 +60,7 @@ found on _most_ systems, but not all of them:
release libtool so
-------------------------------
+ 2.13.3 26.2.20 6.20.2
2.13.2 26.1.20 6.20.1
2.13.1 26.0.20 6.20.0
2.13.0 25.0.19 6.19.0
@@ -124,7 +125,7 @@ other release numbers.
----------------------------------------------------------------------
-Copyright (C) 2002-2023 by
+Copyright (C) 2002-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/formats.txt b/contrib/libs/freetype/docs/formats.txt
index 882d62d231..00283e6a0a 100644
--- a/contrib/libs/freetype/docs/formats.txt
+++ b/contrib/libs/freetype/docs/formats.txt
@@ -206,7 +206,7 @@ which isn't supported yet please send a mail too.
------------------------------------------------------------------------
-Copyright (C) 2004-2023 by
+Copyright (C) 2004-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/docs/freetype-web.txt b/contrib/libs/freetype/docs/freetype-web.txt
new file mode 100644
index 0000000000..0c9140c50b
--- /dev/null
+++ b/contrib/libs/freetype/docs/freetype-web.txt
@@ -0,0 +1,42 @@
+How to update the FreeType web pages
+------------------------------------
+
+The 'freetype.org' website is hosted via the 'freetype-web' repo
+located at
+
+ https://gitlab.com/freetype/freetype-web ,
+
+which in turn is a mirror from the master 'freetype-web' repository
+located at
+
+ https://gitlab.freedesktop.org/freetype/freetype-web .
+
+Due to Cloudflare caching, changes take time to appear on
+'freetype.org', so visit
+
+ https://freetype.gitlab.io/freetype-web
+
+for instant feedback.
+
+All the commits should *only* be done to the 'freetype-web' repo at
+
+ https://gitlab.freedesktop.org/freetype/freetype-web
+
+When a commit is done to this repo, the CI pipeline runs and the
+website is deployed via gitlab pages at
+
+ https://freetype.pages.freedesktop.org/freetype-web .
+
+The pull mirror automatically updates the repository in 'gitlab.com',
+and the CI pipeline deploys the website at:
+
+ https://freetype.gitlab.io/freetype-web
+
+Since the 'freetype.org' website uses Cloudflare caching, it will take
+a while for the changes to show up in 'freetype.org'.
+
+If you have access to the Cloudflare dashboard you can purge the
+cache from there; this will cause the cache to be fetched again
+resulting in the website being updated instantly.
+
+--- end of freetype-web.txt ---
diff --git a/contrib/libs/freetype/docs/raster.txt b/contrib/libs/freetype/docs/raster.txt
index 1642a81d9d..d85b662c23 100644
--- a/contrib/libs/freetype/docs/raster.txt
+++ b/contrib/libs/freetype/docs/raster.txt
@@ -618,7 +618,7 @@ II. Rendering Technology
------------------------------------------------------------------------
-Copyright (C) 2003-2023 by
+Copyright (C) 2003-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/config/ftconfig.h b/contrib/libs/freetype/include/freetype/config/ftconfig.h
index a85151699d..0667493fec 100644
--- a/contrib/libs/freetype/include/freetype/config/ftconfig.h
+++ b/contrib/libs/freetype/include/freetype/config/ftconfig.h
@@ -4,7 +4,7 @@
*
* ANSI-specific configuration file (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/config/ftheader.h b/contrib/libs/freetype/include/freetype/config/ftheader.h
index e607bce15c..f6ef2618de 100644
--- a/contrib/libs/freetype/include/freetype/config/ftheader.h
+++ b/contrib/libs/freetype/include/freetype/config/ftheader.h
@@ -4,7 +4,7 @@
*
* Build macros of the FreeType 2 library.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/config/ftoption.h b/contrib/libs/freetype/include/freetype/config/ftoption.h
index 1976b33af9..eb4e32d80a 100644
--- a/contrib/libs/freetype/include/freetype/config/ftoption.h
+++ b/contrib/libs/freetype/include/freetype/config/ftoption.h
@@ -4,7 +4,7 @@
*
* User-selectable configuration macros (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -757,6 +757,22 @@ FT_BEGIN_HEADER
#endif
+ /**************************************************************************
+ *
+ * Option `TT_CONFIG_OPTION_GPOS_KERNING` enables a basic GPOS kerning
+ * implementation (for TrueType fonts only). With this defined, FreeType
+ * is able to get kerning pair data from the GPOS 'kern' feature as well as
+ * legacy 'kern' tables; without this defined, FreeType will only be able
+ * to use legacy 'kern' tables.
+ *
+ * Note that FreeType does not support more advanced GPOS layout features;
+ * even the 'kern' feature implemented here doesn't handle more
+ * sophisticated kerning variants. Use a higher-level library like
+ * HarfBuzz instead for that.
+ */
+/* #define TT_CONFIG_OPTION_GPOS_KERNING */
+
+
/*************************************************************************/
/*************************************************************************/
/**** ****/
diff --git a/contrib/libs/freetype/include/freetype/config/ftstdlib.h b/contrib/libs/freetype/include/freetype/config/ftstdlib.h
index f65148a902..e17aa7b89d 100644
--- a/contrib/libs/freetype/include/freetype/config/ftstdlib.h
+++ b/contrib/libs/freetype/include/freetype/config/ftstdlib.h
@@ -5,7 +5,7 @@
* ANSI-specific library and header configuration file (specification
* only).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/config/integer-types.h b/contrib/libs/freetype/include/freetype/config/integer-types.h
index 7258b50854..c27505ffc4 100644
--- a/contrib/libs/freetype/include/freetype/config/integer-types.h
+++ b/contrib/libs/freetype/include/freetype/config/integer-types.h
@@ -4,7 +4,7 @@
*
* FreeType integer types definitions.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/config/mac-support.h b/contrib/libs/freetype/include/freetype/config/mac-support.h
index b77b96d5db..07b6f915bd 100644
--- a/contrib/libs/freetype/include/freetype/config/mac-support.h
+++ b/contrib/libs/freetype/include/freetype/config/mac-support.h
@@ -4,7 +4,7 @@
*
* Mac/OS X support configuration header.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/config/public-macros.h b/contrib/libs/freetype/include/freetype/config/public-macros.h
index 23d0fa6a32..f56581a6ee 100644
--- a/contrib/libs/freetype/include/freetype/config/public-macros.h
+++ b/contrib/libs/freetype/include/freetype/config/public-macros.h
@@ -4,7 +4,7 @@
*
* Define a set of compiler macros used in public FreeType headers.
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/freetype.h b/contrib/libs/freetype/include/freetype/freetype.h
index 92acf3794a..58fc33dfe6 100644
--- a/contrib/libs/freetype/include/freetype/freetype.h
+++ b/contrib/libs/freetype/include/freetype/freetype.h
@@ -4,7 +4,7 @@
*
* FreeType high-level API and common types (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -1322,9 +1322,13 @@ FT_BEGIN_HEADER
* FT_FACE_FLAG_KERNING ::
* The face contains kerning information. If set, the kerning distance
* can be retrieved using the function @FT_Get_Kerning. Otherwise the
- * function always returns the vector (0,0). Note that FreeType
- * doesn't handle kerning data from the SFNT 'GPOS' table (as present
- * in many OpenType fonts).
+ * function always returns the vector (0,0).
+ *
+ * Note that for TrueType fonts only, FreeType supports both the 'kern'
+ * table and the basic, pair-wise kerning feature from the 'GPOS' table
+ * (with `TT_CONFIG_OPTION_GPOS_KERNING` enabled), though FreeType does
+ * not support the more advanced GPOS layout features; use a library
+ * like HarfBuzz for those instead.
*
* FT_FACE_FLAG_FAST_GLYPHS ::
* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT.
@@ -3767,87 +3771,18 @@ FT_BEGIN_HEADER
* pixels and use the @FT_PIXEL_MODE_LCD_V mode.
*
* FT_RENDER_MODE_SDF ::
- * This mode corresponds to 8-bit, single-channel signed distance field
- * (SDF) bitmaps. Each pixel in the SDF grid is the value from the
- * pixel's position to the nearest glyph's outline. The distances are
- * calculated from the center of the pixel and are positive if they are
- * filled by the outline (i.e., inside the outline) and negative
- * otherwise. Check the note below on how to convert the output values
- * to usable data.
+ * The positive (unsigned) 8-bit bitmap values can be converted to the
+ * single-channel signed distance field (SDF) by subtracting 128, with
+ * the positive and negative results corresponding to the inside and
+ * the outside of a glyph contour, respectively. The distance units are
+ * arbitrarily determined by an adjustable @spread property.
*
* @note:
- * The selected render mode only affects vector glyphs of a font.
+ * The selected render mode only affects scalable vector glyphs of a font.
* Embedded bitmaps often have a different pixel mode like
* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform them
* into 8-bit pixmaps.
*
- * For @FT_RENDER_MODE_SDF the output bitmap buffer contains normalized
- * distances that are packed into unsigned 8-bit values. To get pixel
- * values in floating point representation use the following pseudo-C
- * code for the conversion.
- *
- * ```
- * // Load glyph and render using FT_RENDER_MODE_SDF,
- * // then use the output buffer as follows.
- *
- * ...
- * FT_Byte buffer = glyph->bitmap->buffer;
- *
- *
- * for pixel in buffer
- * {
- * // `sd` is the signed distance and `spread` is the current spread;
- * // the default spread is 2 and can be changed.
- *
- * float sd = (float)pixel - 128.0f;
- *
- *
- * // Convert to pixel values.
- * sd = ( sd / 128.0f ) * spread;
- *
- * // Store `sd` in a buffer or use as required.
- * }
- *
- * ```
- *
- * FreeType has two rasterizers for generating SDF, namely:
- *
- * 1. `sdf` for generating SDF directly from glyph's outline, and
- *
- * 2. `bsdf` for generating SDF from rasterized bitmaps.
- *
- * Depending on the glyph type (i.e., outline or bitmap), one of the two
- * rasterizers is chosen at runtime and used for generating SDFs. To
- * force the use of `bsdf` you should render the glyph with any of the
- * FreeType's other rendering modes (e.g., `FT_RENDER_MODE_NORMAL`) and
- * then re-render with `FT_RENDER_MODE_SDF`.
- *
- * There are some issues with stability and possible failures of the SDF
- * renderers (specifically `sdf`).
- *
- * 1. The `sdf` rasterizer is sensitive to really small features (e.g.,
- * sharp turns that are less than 1~pixel) and imperfections in the
- * glyph's outline, causing artifacts in the final output.
- *
- * 2. The `sdf` rasterizer has limited support for handling intersecting
- * contours and *cannot* handle self-intersecting contours whatsoever.
- * Self-intersection happens when a single connected contour
- * intersects itself at some point; having these in your font
- * definitely poses a problem to the rasterizer and cause artifacts,
- * too.
- *
- * 3. Generating SDF for really small glyphs may result in undesirable
- * output; the pixel grid (which stores distance information) becomes
- * too coarse.
- *
- * 4. Since the output buffer is normalized, precision at smaller spreads
- * is greater than precision at larger spread values because the
- * output range of [0..255] gets mapped to a smaller SDF range. A
- * spread of~2 should be sufficient in most cases.
- *
- * Points (1) and (2) can be avoided by using the `bsdf` rasterizer,
- * which is more stable than the `sdf` rasterizer in general.
- *
*/
typedef enum FT_Render_Mode_
{
@@ -4058,9 +3993,26 @@ FT_BEGIN_HEADER
* out of the scope of this API function -- they can be implemented
* through format-specific interfaces.
*
- * Kerning for OpenType fonts implemented in a 'GPOS' table is not
- * supported; use @FT_HAS_KERNING to find out whether a font has data
- * that can be extracted with `FT_Get_Kerning`.
+ * Note that, for TrueType fonts only, this can extract data from both
+ * the 'kern' table and the basic, pair-wise kerning feature from the
+ * GPOS table (with `TT_CONFIG_OPTION_GPOS_KERNING` enabled), though
+ * FreeType does not support the more advanced GPOS layout features; use
+ * a library like HarfBuzz for those instead. If a font has both a
+ * 'kern' table and kern features of a GPOS table, the 'kern' table will
+ * be used.
+ *
+ * Also note for right-to-left scripts, the functionality may differ for
+ * fonts with GPOS tables vs. 'kern' tables. For GPOS, right-to-left
+ * fonts typically use both a placement offset and an advance for pair
+ * positioning, which this API does not support, so it would output
+ * kerning values of zero; though if the right-to-left font used only
+ * advances in GPOS pair positioning, then this API could output kerning
+ * values for it, but it would use `left_glyph` to mean the first glyph
+ * for that case. Whereas 'kern' tables are always advance-only and
+ * always store the left glyph first.
+ *
+ * Use @FT_HAS_KERNING to find out whether a font has data that can be
+ * extracted with `FT_Get_Kerning`.
*/
FT_EXPORT( FT_Error )
FT_Get_Kerning( FT_Face face,
@@ -5222,7 +5174,7 @@ FT_BEGIN_HEADER
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 13
-#define FREETYPE_PATCH 2
+#define FREETYPE_PATCH 3
/**************************************************************************
diff --git a/contrib/libs/freetype/include/freetype/ftadvanc.h b/contrib/libs/freetype/include/freetype/ftadvanc.h
index 4560ded6dc..85b8ba2554 100644
--- a/contrib/libs/freetype/include/freetype/ftadvanc.h
+++ b/contrib/libs/freetype/include/freetype/ftadvanc.h
@@ -4,7 +4,7 @@
*
* Quick computation of advance widths (specification only).
*
- * Copyright (C) 2008-2023 by
+ * Copyright (C) 2008-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftbbox.h b/contrib/libs/freetype/include/freetype/ftbbox.h
index fc21740fc2..12bbfa63a6 100644
--- a/contrib/libs/freetype/include/freetype/ftbbox.h
+++ b/contrib/libs/freetype/include/freetype/ftbbox.h
@@ -4,7 +4,7 @@
*
* FreeType exact bbox computation (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftbdf.h b/contrib/libs/freetype/include/freetype/ftbdf.h
index e8ce643128..6f63b0b1e7 100644
--- a/contrib/libs/freetype/include/freetype/ftbdf.h
+++ b/contrib/libs/freetype/include/freetype/ftbdf.h
@@ -4,7 +4,7 @@
*
* FreeType API for accessing BDF-specific strings (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftbitmap.h b/contrib/libs/freetype/include/freetype/ftbitmap.h
index eb6b4b1eeb..df9d462652 100644
--- a/contrib/libs/freetype/include/freetype/ftbitmap.h
+++ b/contrib/libs/freetype/include/freetype/ftbitmap.h
@@ -4,7 +4,7 @@
*
* FreeType utility functions for bitmaps (specification).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftbzip2.h b/contrib/libs/freetype/include/freetype/ftbzip2.h
index 7d29f4682c..c5baea8562 100644
--- a/contrib/libs/freetype/include/freetype/ftbzip2.h
+++ b/contrib/libs/freetype/include/freetype/ftbzip2.h
@@ -4,7 +4,7 @@
*
* Bzip2-compressed stream support.
*
- * Copyright (C) 2010-2023 by
+ * Copyright (C) 2010-2024 by
* Joel Klinghed.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftcache.h b/contrib/libs/freetype/include/freetype/ftcache.h
index a2072e26b8..140df4c96c 100644
--- a/contrib/libs/freetype/include/freetype/ftcache.h
+++ b/contrib/libs/freetype/include/freetype/ftcache.h
@@ -4,7 +4,7 @@
*
* FreeType Cache subsystem (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftcid.h b/contrib/libs/freetype/include/freetype/ftcid.h
index ef22939022..96b2a90fc5 100644
--- a/contrib/libs/freetype/include/freetype/ftcid.h
+++ b/contrib/libs/freetype/include/freetype/ftcid.h
@@ -4,7 +4,7 @@
*
* FreeType API for accessing CID font information (specification).
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* Dereg Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftcolor.h b/contrib/libs/freetype/include/freetype/ftcolor.h
index eae200fdf1..420720ddf2 100644
--- a/contrib/libs/freetype/include/freetype/ftcolor.h
+++ b/contrib/libs/freetype/include/freetype/ftcolor.h
@@ -4,7 +4,7 @@
*
* FreeType's glyph color management (specification).
*
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftdriver.h b/contrib/libs/freetype/include/freetype/ftdriver.h
index 7af7465bc7..1b7f539f5e 100644
--- a/contrib/libs/freetype/include/freetype/ftdriver.h
+++ b/contrib/libs/freetype/include/freetype/ftdriver.h
@@ -4,7 +4,7 @@
*
* FreeType API for controlling driver modules (specification only).
*
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -817,6 +817,80 @@ FT_BEGIN_HEADER
* 2.5
*/
+
+ /**************************************************************************
+ *
+ * @property:
+ * spread
+ *
+ * @description:
+ * This property of the 'sdf' and 'bsdf' renderers defines how the signed
+ * distance field (SDF) is represented in the output bitmap. The output
+ * values are calculated as follows, '128 * ( SDF / spread + 1 )', with
+ * the result clamped to the 8-bit range [0..255]. Therefore, 'spread'
+ * is also the maximum euclidean distance from the edge after which the
+ * values are clamped. The spread is specified in pixels with the
+ * default value of 8. For accurate SDF texture mapping (interpolation),
+ * the spread should be large enough to accommodate the target grid unit.
+ *
+ * @example:
+ * The following example code demonstrates how to set the SDF spread
+ * (omitting the error handling).
+ *
+ * ```
+ * FT_Library library;
+ * FT_Int spread = 2;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "sdf", "spread", &spread );
+ * ```
+ *
+ * @note:
+ * FreeType has two rasterizers for generating SDF, namely:
+ *
+ * 1. `sdf` for generating SDF directly from glyph's outline, and
+ *
+ * 2. `bsdf` for generating SDF from rasterized bitmaps.
+ *
+ * Depending on the glyph type (i.e., outline or bitmap), one of the two
+ * rasterizers is chosen at runtime and used for generating SDFs. To
+ * force the use of `bsdf` you should render the glyph with any of the
+ * FreeType's other rendering modes (e.g., `FT_RENDER_MODE_NORMAL`) and
+ * then re-render with `FT_RENDER_MODE_SDF`.
+ *
+ * There are some issues with stability and possible failures of the SDF
+ * renderers (specifically `sdf`).
+ *
+ * 1. The `sdf` rasterizer is sensitive to really small features (e.g.,
+ * sharp turns that are less than 1~pixel) and imperfections in the
+ * glyph's outline, causing artifacts in the final output.
+ *
+ * 2. The `sdf` rasterizer has limited support for handling intersecting
+ * contours and *cannot* handle self-intersecting contours whatsoever.
+ * Self-intersection happens when a single connected contour
+ * intersects itself at some point; having these in your font
+ * definitely poses a problem to the rasterizer and cause artifacts,
+ * too.
+ *
+ * 3. Generating SDF for really small glyphs may result in undesirable
+ * output; the pixel grid (which stores distance information) becomes
+ * too coarse.
+ *
+ * 4. Since the output buffer is normalized, precision at smaller spreads
+ * is greater than precision at larger spread values because the
+ * output range of [0..255] gets mapped to a smaller SDF range. A
+ * spread of~2 should be sufficient in most cases.
+ *
+ * Points (1) and (2) can be avoided by using the `bsdf` rasterizer,
+ * which is more stable than the `sdf` rasterizer in general.
+ *
+ * @since:
+ * 2.11
+ */
+
+
/**************************************************************************
*
* @property:
diff --git a/contrib/libs/freetype/include/freetype/fterrdef.h b/contrib/libs/freetype/include/freetype/fterrdef.h
index d59b3cc2da..710ca91bbd 100644
--- a/contrib/libs/freetype/include/freetype/fterrdef.h
+++ b/contrib/libs/freetype/include/freetype/fterrdef.h
@@ -4,7 +4,7 @@
*
* FreeType error codes (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/fterrors.h b/contrib/libs/freetype/include/freetype/fterrors.h
index 15ef3f76b5..27c0ece5c1 100644
--- a/contrib/libs/freetype/include/freetype/fterrors.h
+++ b/contrib/libs/freetype/include/freetype/fterrors.h
@@ -4,7 +4,7 @@
*
* FreeType error code handling (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftfntfmt.h b/contrib/libs/freetype/include/freetype/ftfntfmt.h
index c0018fc830..7c8b0874a8 100644
--- a/contrib/libs/freetype/include/freetype/ftfntfmt.h
+++ b/contrib/libs/freetype/include/freetype/ftfntfmt.h
@@ -4,7 +4,7 @@
*
* Support functions for font formats.
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftgasp.h b/contrib/libs/freetype/include/freetype/ftgasp.h
index d5f19add8f..30e5a9bf82 100644
--- a/contrib/libs/freetype/include/freetype/ftgasp.h
+++ b/contrib/libs/freetype/include/freetype/ftgasp.h
@@ -4,7 +4,7 @@
*
* Access of TrueType's 'gasp' table (specification).
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftglyph.h b/contrib/libs/freetype/include/freetype/ftglyph.h
index 4658895f7a..dc1eb8873a 100644
--- a/contrib/libs/freetype/include/freetype/ftglyph.h
+++ b/contrib/libs/freetype/include/freetype/ftglyph.h
@@ -4,7 +4,7 @@
*
* FreeType convenience functions to handle glyphs (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftgxval.h b/contrib/libs/freetype/include/freetype/ftgxval.h
index e8de9a6ed5..065cd53cc5 100644
--- a/contrib/libs/freetype/include/freetype/ftgxval.h
+++ b/contrib/libs/freetype/include/freetype/ftgxval.h
@@ -4,7 +4,7 @@
*
* FreeType API for validating TrueTypeGX/AAT tables (specification).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* Masatake YAMATO, Redhat K.K,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/contrib/libs/freetype/include/freetype/ftgzip.h b/contrib/libs/freetype/include/freetype/ftgzip.h
index 443ec29db1..9516dc030a 100644
--- a/contrib/libs/freetype/include/freetype/ftgzip.h
+++ b/contrib/libs/freetype/include/freetype/ftgzip.h
@@ -4,7 +4,7 @@
*
* Gzip-compressed stream support.
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftimage.h b/contrib/libs/freetype/include/freetype/ftimage.h
index 6baa812560..2b4b4ac60a 100644
--- a/contrib/libs/freetype/include/freetype/ftimage.h
+++ b/contrib/libs/freetype/include/freetype/ftimage.h
@@ -5,7 +5,7 @@
* FreeType glyph image formats and default raster interface
* (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -21,6 +21,11 @@
* Note: A 'raster' is simply a scan-line converter, used to render
* `FT_Outline`s into `FT_Bitmap`s.
*
+ * Note: This file can be used for `STANDALONE_` compilation of raster
+ * (B/W) and smooth (anti-aliased) renderers. Therefore, it must
+ * rely on standard variable types only instead of aliases in
+ * `fttypes.h`.
+ *
*/
@@ -318,7 +323,7 @@ FT_BEGIN_HEADER
*
* If bit~2 is set, bits 5-7 contain the drop-out mode (as defined in
* the OpenType specification; the value is the same as the argument to
- * the 'SCANMODE' instruction).
+ * the 'SCANTYPE' instruction).
*
* Bits 3 and~4 are reserved for internal purposes.
*
@@ -341,14 +346,14 @@ FT_BEGIN_HEADER
*/
typedef struct FT_Outline_
{
- short n_contours; /* number of contours in glyph */
- short n_points; /* number of points in the glyph */
+ unsigned short n_contours; /* number of contours in glyph */
+ unsigned short n_points; /* number of points in the glyph */
- FT_Vector* points; /* the outline's points */
- char* tags; /* the points flags */
- short* contours; /* the contour end points */
+ FT_Vector* points; /* the outline's points */
+ unsigned char* tags; /* the points flags */
+ unsigned short* contours; /* the contour end points */
- int flags; /* outline masks */
+ int flags; /* outline masks */
} FT_Outline;
@@ -356,8 +361,8 @@ FT_BEGIN_HEADER
/* Following limits must be consistent with */
/* FT_Outline.{n_contours,n_points} */
-#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX
-#define FT_OUTLINE_POINTS_MAX SHRT_MAX
+#define FT_OUTLINE_CONTOURS_MAX USHRT_MAX
+#define FT_OUTLINE_POINTS_MAX USHRT_MAX
/**************************************************************************
@@ -434,8 +439,8 @@ FT_BEGIN_HEADER
* rasterizer; see the `tags` field in @FT_Outline.
*
* Please refer to the description of the 'SCANTYPE' instruction in the
- * OpenType specification (in file `ttinst1.doc`) how simple drop-outs,
- * smart drop-outs, and stubs are defined.
+ * [OpenType specification](https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#scantype)
+ * how simple drop-outs, smart drop-outs, and stubs are defined.
*/
#define FT_OUTLINE_NONE 0x0
#define FT_OUTLINE_OWNER 0x1
diff --git a/contrib/libs/freetype/include/freetype/ftincrem.h b/contrib/libs/freetype/include/freetype/ftincrem.h
index 2d4f5def24..816581b78e 100644
--- a/contrib/libs/freetype/include/freetype/ftincrem.h
+++ b/contrib/libs/freetype/include/freetype/ftincrem.h
@@ -4,7 +4,7 @@
*
* FreeType incremental loading (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftlcdfil.h b/contrib/libs/freetype/include/freetype/ftlcdfil.h
index d3723e16f6..25274dc4ac 100644
--- a/contrib/libs/freetype/include/freetype/ftlcdfil.h
+++ b/contrib/libs/freetype/include/freetype/ftlcdfil.h
@@ -5,7 +5,7 @@
* FreeType API for color filtering of subpixel bitmap glyphs
* (specification).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftlist.h b/contrib/libs/freetype/include/freetype/ftlist.h
index b553131335..972fbfa2fe 100644
--- a/contrib/libs/freetype/include/freetype/ftlist.h
+++ b/contrib/libs/freetype/include/freetype/ftlist.h
@@ -4,7 +4,7 @@
*
* Generic list support for FreeType (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftlogging.h b/contrib/libs/freetype/include/freetype/ftlogging.h
index 53b8b89642..1813cfc2c2 100644
--- a/contrib/libs/freetype/include/freetype/ftlogging.h
+++ b/contrib/libs/freetype/include/freetype/ftlogging.h
@@ -4,7 +4,7 @@
*
* Additional debugging APIs.
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftlzw.h b/contrib/libs/freetype/include/freetype/ftlzw.h
index adfd172479..bcf59ba706 100644
--- a/contrib/libs/freetype/include/freetype/ftlzw.h
+++ b/contrib/libs/freetype/include/freetype/ftlzw.h
@@ -4,7 +4,7 @@
*
* LZW-compressed stream support.
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftmac.h b/contrib/libs/freetype/include/freetype/ftmac.h
index a91e38f9ea..e4efde33dd 100644
--- a/contrib/libs/freetype/include/freetype/ftmac.h
+++ b/contrib/libs/freetype/include/freetype/ftmac.h
@@ -4,7 +4,7 @@
*
* Additional Mac-specific API.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftmm.h b/contrib/libs/freetype/include/freetype/ftmm.h
index d145128a9b..35ed039c89 100644
--- a/contrib/libs/freetype/include/freetype/ftmm.h
+++ b/contrib/libs/freetype/include/freetype/ftmm.h
@@ -4,7 +4,7 @@
*
* FreeType Multiple Master font interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,13 @@
#ifndef FTMM_H_
#define FTMM_H_
+#include <freetype/freetype.h>
-#include <freetype/t1tables.h>
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
FT_BEGIN_HEADER
@@ -55,6 +60,30 @@ FT_BEGIN_HEADER
/**************************************************************************
*
+ * @enum:
+ * T1_MAX_MM_XXX
+ *
+ * @description:
+ * Multiple Masters limits as defined in their specifications.
+ *
+ * @values:
+ * T1_MAX_MM_AXIS ::
+ * The maximum number of Multiple Masters axes.
+ *
+ * T1_MAX_MM_DESIGNS ::
+ * The maximum number of Multiple Masters designs.
+ *
+ * T1_MAX_MM_MAP_POINTS ::
+ * The maximum number of elements in a design map.
+ *
+ */
+#define T1_MAX_MM_AXIS 4
+#define T1_MAX_MM_DESIGNS 16
+#define T1_MAX_MM_MAP_POINTS 20
+
+
+ /**************************************************************************
+ *
* @struct:
* FT_MM_Axis
*
diff --git a/contrib/libs/freetype/include/freetype/ftmodapi.h b/contrib/libs/freetype/include/freetype/ftmodapi.h
index c8f0c2c2a4..0ee715898f 100644
--- a/contrib/libs/freetype/include/freetype/ftmodapi.h
+++ b/contrib/libs/freetype/include/freetype/ftmodapi.h
@@ -4,7 +4,7 @@
*
* FreeType modules public interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftmoderr.h b/contrib/libs/freetype/include/freetype/ftmoderr.h
index c8c892dcce..6722fbf8b7 100644
--- a/contrib/libs/freetype/include/freetype/ftmoderr.h
+++ b/contrib/libs/freetype/include/freetype/ftmoderr.h
@@ -4,7 +4,7 @@
*
* FreeType module error offsets (specification).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftotval.h b/contrib/libs/freetype/include/freetype/ftotval.h
index 011bdfc837..810200b386 100644
--- a/contrib/libs/freetype/include/freetype/ftotval.h
+++ b/contrib/libs/freetype/include/freetype/ftotval.h
@@ -4,7 +4,7 @@
*
* FreeType API for validating OpenType tables (specification).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftoutln.h b/contrib/libs/freetype/include/freetype/ftoutln.h
index f9329ca40c..44e94b4f5b 100644
--- a/contrib/libs/freetype/include/freetype/ftoutln.h
+++ b/contrib/libs/freetype/include/freetype/ftoutln.h
@@ -5,7 +5,7 @@
* Support for the FT_Outline type used to store glyph shapes of
* most scalable font formats (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -112,7 +112,7 @@ FT_BEGIN_HEADER
* Degenerate contours, segments, and Bezier arcs may be reported. In
* most cases, it is best to filter these out before using the outline
* for stroking or other path modification purposes (which may cause
- * degenerate segments to become non-degenrate and visible, like when
+ * degenerate segments to become non-degenerate and visible, like when
* stroke caps are used or the path is otherwise outset). Some glyph
* outlines may contain deliberate degenerate single points for mark
* attachement.
diff --git a/contrib/libs/freetype/include/freetype/ftparams.h b/contrib/libs/freetype/include/freetype/ftparams.h
index 6a9f243bc9..43bf69c202 100644
--- a/contrib/libs/freetype/include/freetype/ftparams.h
+++ b/contrib/libs/freetype/include/freetype/ftparams.h
@@ -4,7 +4,7 @@
*
* FreeType API for possible FT_Parameter tags (specification only).
*
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftpfr.h b/contrib/libs/freetype/include/freetype/ftpfr.h
index 7111d40a0c..1a712b9552 100644
--- a/contrib/libs/freetype/include/freetype/ftpfr.h
+++ b/contrib/libs/freetype/include/freetype/ftpfr.h
@@ -4,7 +4,7 @@
*
* FreeType API for accessing PFR-specific data (specification only).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftrender.h b/contrib/libs/freetype/include/freetype/ftrender.h
index 0b6fad32e8..dc5018a1b5 100644
--- a/contrib/libs/freetype/include/freetype/ftrender.h
+++ b/contrib/libs/freetype/include/freetype/ftrender.h
@@ -4,7 +4,7 @@
*
* FreeType renderer modules public interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftsizes.h b/contrib/libs/freetype/include/freetype/ftsizes.h
index 7bfb1aed4c..4ef5c7955d 100644
--- a/contrib/libs/freetype/include/freetype/ftsizes.h
+++ b/contrib/libs/freetype/include/freetype/ftsizes.h
@@ -4,7 +4,7 @@
*
* FreeType size objects management (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftsnames.h b/contrib/libs/freetype/include/freetype/ftsnames.h
index 9d5d22bb25..d5d5cd9310 100644
--- a/contrib/libs/freetype/include/freetype/ftsnames.h
+++ b/contrib/libs/freetype/include/freetype/ftsnames.h
@@ -7,7 +7,7 @@
*
* This is _not_ used to retrieve glyph names!
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftstroke.h b/contrib/libs/freetype/include/freetype/ftstroke.h
index b3d90802a5..41626dc9d7 100644
--- a/contrib/libs/freetype/include/freetype/ftstroke.h
+++ b/contrib/libs/freetype/include/freetype/ftstroke.h
@@ -4,7 +4,7 @@
*
* FreeType path stroker (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftsynth.h b/contrib/libs/freetype/include/freetype/ftsynth.h
index af90967dda..43081b6c33 100644
--- a/contrib/libs/freetype/include/freetype/ftsynth.h
+++ b/contrib/libs/freetype/include/freetype/ftsynth.h
@@ -5,7 +5,7 @@
* FreeType synthesizing code for emboldening and slanting
* (specification).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftsystem.h b/contrib/libs/freetype/include/freetype/ftsystem.h
index 3a08f4912c..1eacb3af39 100644
--- a/contrib/libs/freetype/include/freetype/ftsystem.h
+++ b/contrib/libs/freetype/include/freetype/ftsystem.h
@@ -4,7 +4,7 @@
*
* FreeType low-level system interface definition (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/fttrigon.h b/contrib/libs/freetype/include/freetype/fttrigon.h
index 294981a6f3..a5299e938d 100644
--- a/contrib/libs/freetype/include/freetype/fttrigon.h
+++ b/contrib/libs/freetype/include/freetype/fttrigon.h
@@ -4,7 +4,7 @@
*
* FreeType trigonometric functions (specification).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/fttypes.h b/contrib/libs/freetype/include/freetype/fttypes.h
index 5b109f0c73..27815143a6 100644
--- a/contrib/libs/freetype/include/freetype/fttypes.h
+++ b/contrib/libs/freetype/include/freetype/fttypes.h
@@ -4,7 +4,7 @@
*
* FreeType simple types definitions (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/ftwinfnt.h b/contrib/libs/freetype/include/freetype/ftwinfnt.h
index 7b701ea59b..2591e58866 100644
--- a/contrib/libs/freetype/include/freetype/ftwinfnt.h
+++ b/contrib/libs/freetype/include/freetype/ftwinfnt.h
@@ -4,7 +4,7 @@
*
* FreeType API for accessing Windows fnt-specific data.
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/autohint.h b/contrib/libs/freetype/include/freetype/internal/autohint.h
index bf9c8b7cf2..8865d53b38 100644
--- a/contrib/libs/freetype/include/freetype/internal/autohint.h
+++ b/contrib/libs/freetype/include/freetype/internal/autohint.h
@@ -4,7 +4,7 @@
*
* High-level 'autohint' module-specific interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/cffotypes.h b/contrib/libs/freetype/include/freetype/internal/cffotypes.h
index 50d5353849..36b0390a5a 100644
--- a/contrib/libs/freetype/include/freetype/internal/cffotypes.h
+++ b/contrib/libs/freetype/include/freetype/internal/cffotypes.h
@@ -4,7 +4,7 @@
*
* Basic OpenType/CFF object type definitions (specification).
*
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/cfftypes.h b/contrib/libs/freetype/include/freetype/internal/cfftypes.h
index c2521764ca..ef2e8e7569 100644
--- a/contrib/libs/freetype/include/freetype/internal/cfftypes.h
+++ b/contrib/libs/freetype/include/freetype/internal/cfftypes.h
@@ -5,7 +5,7 @@
* Basic OpenType/CFF type definitions and interface (specification
* only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -248,10 +248,10 @@ FT_BEGIN_HEADER
FT_Byte num_family_blues;
FT_Byte num_family_other_blues;
- FT_Pos blue_values[14];
- FT_Pos other_blues[10];
- FT_Pos family_blues[14];
- FT_Pos family_other_blues[10];
+ FT_Fixed blue_values[14];
+ FT_Fixed other_blues[10];
+ FT_Fixed family_blues[14];
+ FT_Fixed family_other_blues[10];
FT_Fixed blue_scale;
FT_Pos blue_shift;
diff --git a/contrib/libs/freetype/include/freetype/internal/compiler-macros.h b/contrib/libs/freetype/include/freetype/internal/compiler-macros.h
index 6f67650979..876f66e256 100644
--- a/contrib/libs/freetype/include/freetype/internal/compiler-macros.h
+++ b/contrib/libs/freetype/include/freetype/internal/compiler-macros.h
@@ -4,7 +4,7 @@
*
* Compiler-specific macro definitions used internally by FreeType.
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/ftcalc.h b/contrib/libs/freetype/include/freetype/internal/ftcalc.h
index d9aea23602..71128a2df9 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftcalc.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftcalc.h
@@ -4,7 +4,7 @@
*
* Arithmetic computations (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -415,7 +415,7 @@ FT_BEGIN_HEADER
#define FT_MSB( x ) ( 31 - _CountLeadingZeros( x ) )
-#elif defined( _M_ARM64 ) || defined( _M_ARM )
+#elif defined( _M_ARM64 ) || defined( _M_ARM ) || defined( _M_ARM64EC )
#include <intrin.h>
#pragma intrinsic( _CountLeadingZeros )
@@ -455,6 +455,12 @@ FT_BEGIN_HEADER
#define FT_MSB( x ) FT_MSB_i386( x )
+#elif defined( __SunOS_5_11 )
+
+#include <string.h>
+
+#define FT_MSB( x ) ( fls( x ) - 1 )
+
#elif defined( __DECC ) || defined( __DECCXX )
#include <builtins.h>
@@ -489,8 +495,6 @@ FT_BEGIN_HEADER
FT_Fixed y );
-#if 0
-
/**************************************************************************
*
* @function:
@@ -507,12 +511,11 @@ FT_BEGIN_HEADER
* The result of 'sqrt(x)'.
*
* @note:
- * This function is not very fast.
+ * This function is slow and should be avoided. Consider @FT_Hypot or
+ * @FT_Vector_NormLen instead.
*/
- FT_BASE( FT_Int32 )
- FT_SqrtFixed( FT_Int32 x );
-
-#endif /* 0 */
+ FT_BASE( FT_UInt32 )
+ FT_SqrtFixed( FT_UInt32 x );
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 ) /* << 6 */
diff --git a/contrib/libs/freetype/include/freetype/internal/ftdebug.h b/contrib/libs/freetype/include/freetype/internal/ftdebug.h
index 4e013ba1e2..d7fa8dc93c 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftdebug.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftdebug.h
@@ -4,7 +4,7 @@
*
* Debugging and logging component (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/ftdrv.h b/contrib/libs/freetype/include/freetype/internal/ftdrv.h
index 9001c07ad0..5609b3ef12 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftdrv.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftdrv.h
@@ -4,7 +4,7 @@
*
* FreeType internal font driver interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/ftgloadr.h b/contrib/libs/freetype/include/freetype/internal/ftgloadr.h
index 36e5509f9e..f1c155b162 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftgloadr.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftgloadr.h
@@ -4,7 +4,7 @@
*
* The FreeType glyph loader (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/ftmemory.h b/contrib/libs/freetype/include/freetype/internal/ftmemory.h
index 5eb1d21ff6..4e05a29f13 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftmemory.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftmemory.h
@@ -4,7 +4,7 @@
*
* The FreeType memory management macros (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg
*
* This file is part of the FreeType project, and may only be used,
@@ -371,8 +371,11 @@ extern "C++"
#define FT_STRDUP( dst, str ) \
FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
-#define FT_MEM_DUP( dst, address, size ) \
- (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )
+#define FT_MEM_DUP( dst, address, size ) \
+ FT_ASSIGNP_INNER( dst, ft_mem_dup( memory, \
+ (address), \
+ (FT_ULong)(size), \
+ &error ) )
#define FT_DUP( dst, address, size ) \
FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )
diff --git a/contrib/libs/freetype/include/freetype/internal/ftmmtypes.h b/contrib/libs/freetype/include/freetype/internal/ftmmtypes.h
index c4b21d6144..8449e7a010 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftmmtypes.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftmmtypes.h
@@ -5,7 +5,7 @@
* OpenType Variations type definitions for internal use
* with the multi-masters service (specification).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and
* Dominik Röttsches.
*
diff --git a/contrib/libs/freetype/include/freetype/internal/ftobjs.h b/contrib/libs/freetype/include/freetype/internal/ftobjs.h
index 28bc9b65f0..a1e93298fd 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftobjs.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftobjs.h
@@ -4,7 +4,7 @@
*
* The FreeType private base classes (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -604,12 +604,6 @@ FT_BEGIN_HEADER
#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
#define FT_FACE_STREAM( x ) FT_FACE( x )->stream
-#define FT_SIZE_FACE( x ) FT_SIZE( x )->face
-#define FT_SLOT_FACE( x ) FT_SLOT( x )->face
-
-#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
-#define FT_FACE_SIZE( x ) FT_FACE( x )->size
-
/**************************************************************************
*
diff --git a/contrib/libs/freetype/include/freetype/internal/ftpsprop.h b/contrib/libs/freetype/include/freetype/internal/ftpsprop.h
index 1d5b287ad2..4f11aa16ba 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftpsprop.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftpsprop.h
@@ -4,7 +4,7 @@
*
* Get and set properties of PostScript drivers (specification).
*
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/ftrfork.h b/contrib/libs/freetype/include/freetype/internal/ftrfork.h
index e96459921e..05c1d6c48b 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftrfork.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftrfork.h
@@ -4,7 +4,7 @@
*
* Embedded resource forks accessor (specification).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* Masatake YAMATO and Redhat K.K.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/ftserv.h b/contrib/libs/freetype/include/freetype/internal/ftserv.h
index 1e85d6d385..8c35dbd713 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftserv.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftserv.h
@@ -4,7 +4,7 @@
*
* The FreeType services (specification only).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/ftstream.h b/contrib/libs/freetype/include/freetype/internal/ftstream.h
index 88e19287c8..fd52f767ef 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftstream.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftstream.h
@@ -4,7 +4,7 @@
*
* Stream handling (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/fttrace.h b/contrib/libs/freetype/include/freetype/internal/fttrace.h
index 319fe56fd2..42595a29ff 100644
--- a/contrib/libs/freetype/include/freetype/internal/fttrace.h
+++ b/contrib/libs/freetype/include/freetype/internal/fttrace.h
@@ -4,7 +4,7 @@
*
* Tracing handling (specification only).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -64,6 +64,7 @@ FT_TRACE_DEF( ttbdf ) /* TrueType embedded BDF (ttbdf.c) */
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
FT_TRACE_DEF( ttcolr ) /* glyph layer table (ttcolr.c) */
FT_TRACE_DEF( ttcpal ) /* color palette table (ttcpal.c) */
+FT_TRACE_DEF( ttgpos ) /* GPOS handler (ttgpos.c) */
FT_TRACE_DEF( ttsvg ) /* OpenType SVG table (ttsvg.c) */
FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */
FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
diff --git a/contrib/libs/freetype/include/freetype/internal/ftvalid.h b/contrib/libs/freetype/include/freetype/internal/ftvalid.h
index e98ee4e473..a1312f2aba 100644
--- a/contrib/libs/freetype/include/freetype/internal/ftvalid.h
+++ b/contrib/libs/freetype/include/freetype/internal/ftvalid.h
@@ -4,7 +4,7 @@
*
* FreeType validation support (specification).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/psaux.h b/contrib/libs/freetype/include/freetype/internal/psaux.h
index dfb1987f86..745d2cb56b 100644
--- a/contrib/libs/freetype/include/freetype/internal/psaux.h
+++ b/contrib/libs/freetype/include/freetype/internal/psaux.h
@@ -5,7 +5,7 @@
* Auxiliary functions and data structures related to PostScript fonts
* (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -225,6 +225,7 @@ FT_BEGIN_HEADER
typedef enum T1_FieldLocation_
{
+ T1_FIELD_LOCATION_NONE = 0,
T1_FIELD_LOCATION_CID_INFO,
T1_FIELD_LOCATION_FONT_DICT,
T1_FIELD_LOCATION_FONT_EXTRA,
@@ -249,6 +250,7 @@ FT_BEGIN_HEADER
/* structure type used to model object fields */
typedef struct T1_FieldRec_
{
+ FT_UInt len; /* field identifier length */
const char* ident; /* field identifier */
T1_FieldLocation location;
T1_FieldType type; /* type of field */
@@ -273,8 +275,9 @@ FT_BEGIN_HEADER
#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \
{ \
+ sizeof ( _ident ) - 1, \
_ident, T1CODE, _type, \
- 0, \
+ NULL, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE( _fname ), \
0, 0, \
@@ -283,6 +286,7 @@ FT_BEGIN_HEADER
#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \
{ \
+ sizeof ( _ident ) - 1, \
_ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \
(T1_Field_ParseFunc)_reader, \
0, 0, \
@@ -292,8 +296,9 @@ FT_BEGIN_HEADER
#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \
{ \
+ sizeof ( _ident ) - 1, \
_ident, T1CODE, _type, \
- 0, \
+ NULL, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_max, \
@@ -303,8 +308,9 @@ FT_BEGIN_HEADER
#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \
{ \
+ sizeof ( _ident ) - 1, \
_ident, T1CODE, _type, \
- 0, \
+ NULL, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_max, 0, \
@@ -354,6 +360,13 @@ FT_BEGIN_HEADER
#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \
T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
+#define T1_FIELD_ZERO \
+ { \
+ 0, \
+ NULL, T1_FIELD_LOCATION_NONE, T1_FIELD_TYPE_NONE, \
+ NULL, 0, 0, 0, 0, 0 \
+ }
+
/*************************************************************************/
/*************************************************************************/
diff --git a/contrib/libs/freetype/include/freetype/internal/pshints.h b/contrib/libs/freetype/include/freetype/internal/pshints.h
index ededc4c72e..dba6c7303f 100644
--- a/contrib/libs/freetype/include/freetype/internal/pshints.h
+++ b/contrib/libs/freetype/include/freetype/internal/pshints.h
@@ -6,7 +6,7 @@
* recorders (specification only). These are used to support native
* T1/T2 hints in the 'type1', 'cid', and 'cff' font drivers.
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svbdf.h b/contrib/libs/freetype/include/freetype/internal/services/svbdf.h
index bf0c1dcc71..89e9c2e5de 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svbdf.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svbdf.h
@@ -4,7 +4,7 @@
*
* The FreeType BDF services (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svcfftl.h b/contrib/libs/freetype/include/freetype/internal/services/svcfftl.h
index 4a20498ee0..3cb483c344 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svcfftl.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svcfftl.h
@@ -4,7 +4,7 @@
*
* The FreeType CFF tables loader service (specification).
*
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svcid.h b/contrib/libs/freetype/include/freetype/internal/services/svcid.h
index 06d0cb8fd6..8362cb8724 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svcid.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svcid.h
@@ -4,7 +4,7 @@
*
* The FreeType CID font services (specification).
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* Derek Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svfntfmt.h b/contrib/libs/freetype/include/freetype/internal/services/svfntfmt.h
index bc45e80568..6b837e79fc 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svfntfmt.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svfntfmt.h
@@ -4,7 +4,7 @@
*
* The FreeType font format service (specification only).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svgldict.h b/contrib/libs/freetype/include/freetype/internal/services/svgldict.h
index 6437abfbf2..6126ec9ada 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svgldict.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svgldict.h
@@ -4,7 +4,7 @@
*
* The FreeType glyph dictionary services (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svgxval.h b/contrib/libs/freetype/include/freetype/internal/services/svgxval.h
index 31016afe0d..29cf552818 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svgxval.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svgxval.h
@@ -4,7 +4,7 @@
*
* FreeType API for validating TrueTypeGX/AAT tables (specification).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svkern.h b/contrib/libs/freetype/include/freetype/internal/services/svkern.h
index bcabbc3e68..ac1bc30c41 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svkern.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svkern.h
@@ -4,7 +4,7 @@
*
* The FreeType Kerning service (specification).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svmetric.h b/contrib/libs/freetype/include/freetype/internal/services/svmetric.h
index 167617ebb3..8b3563b25c 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svmetric.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svmetric.h
@@ -4,7 +4,7 @@
*
* The FreeType services for metrics variations (specification).
*
- * Copyright (C) 2016-2023 by
+ * Copyright (C) 2016-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svmm.h b/contrib/libs/freetype/include/freetype/internal/services/svmm.h
index 7e76ab8324..5288fadf37 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svmm.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svmm.h
@@ -4,7 +4,7 @@
*
* The FreeType Multiple Masters and GX var services (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svotval.h b/contrib/libs/freetype/include/freetype/internal/services/svotval.h
index a4683cd5fb..7aea7ec11f 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svotval.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svotval.h
@@ -4,7 +4,7 @@
*
* The FreeType OpenType validation service (specification).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svpfr.h b/contrib/libs/freetype/include/freetype/internal/services/svpfr.h
index fd189c7de7..b2fac6d086 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svpfr.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svpfr.h
@@ -4,7 +4,7 @@
*
* Internal PFR service functions (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svpostnm.h b/contrib/libs/freetype/include/freetype/internal/services/svpostnm.h
index 2b8f6dfecf..d19f3adc6d 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svpostnm.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svpostnm.h
@@ -4,7 +4,7 @@
*
* The FreeType PostScript name services (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svprop.h b/contrib/libs/freetype/include/freetype/internal/services/svprop.h
index 932ce32e03..ba39c0dd4d 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svprop.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svprop.h
@@ -4,7 +4,7 @@
*
* The FreeType property service (specification).
*
- * Copyright (C) 2012-2023 by
+ * Copyright (C) 2012-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svpscmap.h b/contrib/libs/freetype/include/freetype/internal/services/svpscmap.h
index 6e599f3aab..d4908ee41a 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svpscmap.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svpscmap.h
@@ -4,7 +4,7 @@
*
* The FreeType PostScript charmap service (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svpsinfo.h b/contrib/libs/freetype/include/freetype/internal/services/svpsinfo.h
index 09c4cdccc5..2aadcdd02a 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svpsinfo.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svpsinfo.h
@@ -4,7 +4,7 @@
*
* The FreeType PostScript info service (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svsfnt.h b/contrib/libs/freetype/include/freetype/internal/services/svsfnt.h
index f98df2ef5f..9e0f4ff202 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svsfnt.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svsfnt.h
@@ -4,7 +4,7 @@
*
* The FreeType SFNT table loading service (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svttcmap.h b/contrib/libs/freetype/include/freetype/internal/services/svttcmap.h
index 5f9eb02d66..250886bcc5 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svttcmap.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svttcmap.h
@@ -4,7 +4,7 @@
*
* The FreeType TrueType/sfnt cmap extra information service.
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* Masatake YAMATO, Redhat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svtteng.h b/contrib/libs/freetype/include/freetype/internal/services/svtteng.h
index ad577cb290..14967529a9 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svtteng.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svtteng.h
@@ -4,7 +4,7 @@
*
* The FreeType TrueType engine query service (specification).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svttglyf.h b/contrib/libs/freetype/include/freetype/internal/services/svttglyf.h
index ca6fff7444..f190b3985d 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svttglyf.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svttglyf.h
@@ -4,7 +4,7 @@
*
* The FreeType TrueType glyph service.
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/services/svwinfnt.h b/contrib/libs/freetype/include/freetype/internal/services/svwinfnt.h
index 002923f8c9..49f3fb7f77 100644
--- a/contrib/libs/freetype/include/freetype/internal/services/svwinfnt.h
+++ b/contrib/libs/freetype/include/freetype/internal/services/svwinfnt.h
@@ -4,7 +4,7 @@
*
* The FreeType Windows FNT/FONT service (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/sfnt.h b/contrib/libs/freetype/include/freetype/internal/sfnt.h
index a2d4e15baa..35e4e73af0 100644
--- a/contrib/libs/freetype/include/freetype/internal/sfnt.h
+++ b/contrib/libs/freetype/include/freetype/internal/sfnt.h
@@ -4,7 +4,7 @@
*
* High-level 'sfnt' driver interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -924,6 +924,7 @@ FT_BEGIN_HEADER
/* this field was called `load_kerning' up to version 2.1.10 */
TT_Load_Table_Func load_kern;
+ TT_Load_Table_Func load_gpos;
TT_Load_Table_Func load_gasp;
TT_Load_Table_Func load_pclt;
@@ -944,6 +945,8 @@ FT_BEGIN_HEADER
/* new elements introduced after version 2.1.10 */
+ TT_Face_GetKerningFunc get_gpos_kerning;
+
/* load the font directory, i.e., the offset table and */
/* the table directory */
TT_Load_Table_Func load_font_dir;
@@ -1002,6 +1005,7 @@ FT_BEGIN_HEADER
load_name_, \
free_name_, \
load_kern_, \
+ load_gpos_, \
load_gasp_, \
load_pclt_, \
load_bhed_, \
@@ -1009,6 +1013,7 @@ FT_BEGIN_HEADER
get_psname_, \
free_psnames_, \
get_kerning_, \
+ get_gpos_kerning_, \
load_font_dir_, \
load_hmtx_, \
load_eblc_, \
@@ -1050,6 +1055,7 @@ FT_BEGIN_HEADER
load_name_, \
free_name_, \
load_kern_, \
+ load_gpos_, \
load_gasp_, \
load_pclt_, \
load_bhed_, \
@@ -1057,6 +1063,7 @@ FT_BEGIN_HEADER
get_psname_, \
free_psnames_, \
get_kerning_, \
+ get_gpos_kerning_, \
load_font_dir_, \
load_hmtx_, \
load_eblc_, \
diff --git a/contrib/libs/freetype/include/freetype/internal/svginterface.h b/contrib/libs/freetype/include/freetype/internal/svginterface.h
index f464b2c058..68c99efb10 100644
--- a/contrib/libs/freetype/include/freetype/internal/svginterface.h
+++ b/contrib/libs/freetype/include/freetype/internal/svginterface.h
@@ -4,7 +4,7 @@
*
* Interface of ot-svg module (specification only).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/internal/t1types.h b/contrib/libs/freetype/include/freetype/internal/t1types.h
index b9c94398fd..1821ae5cc8 100644
--- a/contrib/libs/freetype/include/freetype/internal/t1types.h
+++ b/contrib/libs/freetype/include/freetype/internal/t1types.h
@@ -5,7 +5,7 @@
* Basic Type1/Type2 type definitions and interface (specification
* only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -21,7 +21,7 @@
#define T1TYPES_H_
-#include <freetype/t1tables.h>
+#include <freetype/ftmm.h>
#include <freetype/internal/pshints.h>
#include <freetype/internal/ftserv.h>
#include <freetype/internal/fthash.h>
@@ -137,6 +137,54 @@ FT_BEGIN_HEADER
} CID_SubrsRec, *CID_Subrs;
+ /* this structure is used to store the BlendDesignMap entry for an axis */
+ typedef struct PS_DesignMap_
+ {
+ FT_Byte num_points;
+ FT_Long* design_points;
+ FT_Fixed* blend_points;
+
+ } PS_DesignMapRec, *PS_DesignMap;
+
+ /* backward compatible definition */
+ typedef PS_DesignMapRec T1_DesignMap;
+
+
+ typedef struct PS_BlendRec_
+ {
+ FT_UInt num_designs;
+ FT_UInt num_axis;
+
+ FT_String* axis_names[T1_MAX_MM_AXIS];
+ FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];
+ PS_DesignMapRec design_map[T1_MAX_MM_AXIS];
+
+ FT_Fixed* weight_vector;
+ FT_Fixed* default_weight_vector;
+
+ PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1];
+ PS_Private privates [T1_MAX_MM_DESIGNS + 1];
+
+ FT_ULong blend_bitflags;
+
+ FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1];
+
+ /* since 2.3.0 */
+
+ /* undocumented, optional: the default design instance; */
+ /* corresponds to default_weight_vector -- */
+ /* num_default_design_vector == 0 means it is not present */
+ /* in the font and associated metrics files */
+ FT_UInt default_design_vector[T1_MAX_MM_DESIGNS];
+ FT_UInt num_default_design_vector;
+
+ } PS_BlendRec, *PS_Blend;
+
+
+ /* backward compatible definition */
+ typedef PS_BlendRec T1_Blend;
+
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
diff --git a/contrib/libs/freetype/include/freetype/internal/tttypes.h b/contrib/libs/freetype/include/freetype/internal/tttypes.h
index b9788c7831..7053e656a7 100644
--- a/contrib/libs/freetype/include/freetype/internal/tttypes.h
+++ b/contrib/libs/freetype/include/freetype/internal/tttypes.h
@@ -5,7 +5,7 @@
* Basic SFNT/TrueType type definitions and interface (specification
* only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -24,6 +24,7 @@
#include <freetype/tttables.h>
#include <freetype/internal/ftobjs.h>
#include <freetype/ftcolor.h>
+#include "freetype/fttypes.h"
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include <freetype/ftmm.h>
@@ -1581,6 +1582,11 @@ FT_BEGIN_HEADER
FT_UInt32 kern_avail_bits;
FT_UInt32 kern_order_bits;
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+ FT_Byte* gpos_table;
+ FT_Bool gpos_kerning_available;
+#endif
+
#ifdef TT_CONFIG_OPTION_BDF
TT_BDFRec bdf;
#endif /* TT_CONFIG_OPTION_BDF */
@@ -1649,9 +1655,9 @@ FT_BEGIN_HEADER
{
FT_Memory memory;
FT_UShort max_points;
- FT_Short max_contours;
+ FT_UShort max_contours;
FT_UShort n_points; /* number of points in zone */
- FT_Short n_contours; /* number of contours */
+ FT_UShort n_contours; /* number of contours */
FT_Vector* org; /* original point coordinates */
FT_Vector* cur; /* current point coordinates */
diff --git a/contrib/libs/freetype/include/freetype/internal/wofftypes.h b/contrib/libs/freetype/include/freetype/internal/wofftypes.h
index 0c1d8eeaf8..4a169d12f5 100644
--- a/contrib/libs/freetype/include/freetype/internal/wofftypes.h
+++ b/contrib/libs/freetype/include/freetype/internal/wofftypes.h
@@ -5,7 +5,7 @@
* Basic WOFF/WOFF2 type definitions and interface (specification
* only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/otsvg.h b/contrib/libs/freetype/include/freetype/otsvg.h
index bfe9a6ab74..9d356938cc 100644
--- a/contrib/libs/freetype/include/freetype/otsvg.h
+++ b/contrib/libs/freetype/include/freetype/otsvg.h
@@ -4,7 +4,7 @@
*
* Interface for OT-SVG support related things (specification).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/t1tables.h b/contrib/libs/freetype/include/freetype/t1tables.h
index 1aecfbbd90..fbd558aa34 100644
--- a/contrib/libs/freetype/include/freetype/t1tables.h
+++ b/contrib/libs/freetype/include/freetype/t1tables.h
@@ -5,7 +5,7 @@
* Basic Type 1/Type 2 tables definitions and interface (specification
* only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -269,64 +269,6 @@ FT_BEGIN_HEADER
/* */
- /* maximum number of Multiple Masters designs, as defined in the spec */
-#define T1_MAX_MM_DESIGNS 16
-
- /* maximum number of Multiple Masters axes, as defined in the spec */
-#define T1_MAX_MM_AXIS 4
-
- /* maximum number of elements in a design map */
-#define T1_MAX_MM_MAP_POINTS 20
-
-
- /* this structure is used to store the BlendDesignMap entry for an axis */
- typedef struct PS_DesignMap_
- {
- FT_Byte num_points;
- FT_Long* design_points;
- FT_Fixed* blend_points;
-
- } PS_DesignMapRec, *PS_DesignMap;
-
- /* backward compatible definition */
- typedef PS_DesignMapRec T1_DesignMap;
-
-
- typedef struct PS_BlendRec_
- {
- FT_UInt num_designs;
- FT_UInt num_axis;
-
- FT_String* axis_names[T1_MAX_MM_AXIS];
- FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];
- PS_DesignMapRec design_map[T1_MAX_MM_AXIS];
-
- FT_Fixed* weight_vector;
- FT_Fixed* default_weight_vector;
-
- PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1];
- PS_Private privates [T1_MAX_MM_DESIGNS + 1];
-
- FT_ULong blend_bitflags;
-
- FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1];
-
- /* since 2.3.0 */
-
- /* undocumented, optional: the default design instance; */
- /* corresponds to default_weight_vector -- */
- /* num_default_design_vector == 0 means it is not present */
- /* in the font and associated metrics files */
- FT_UInt default_design_vector[T1_MAX_MM_DESIGNS];
- FT_UInt num_default_design_vector;
-
- } PS_BlendRec, *PS_Blend;
-
-
- /* backward compatible definition */
- typedef PS_BlendRec T1_Blend;
-
-
/**************************************************************************
*
* @struct:
diff --git a/contrib/libs/freetype/include/freetype/ttnameid.h b/contrib/libs/freetype/include/freetype/ttnameid.h
index e31c68b9ba..d5d470e380 100644
--- a/contrib/libs/freetype/include/freetype/ttnameid.h
+++ b/contrib/libs/freetype/include/freetype/ttnameid.h
@@ -4,7 +4,7 @@
*
* TrueType name ID definitions (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/freetype/tttables.h b/contrib/libs/freetype/include/freetype/tttables.h
index a9f60e7620..2cf0ff1bc6 100644
--- a/contrib/libs/freetype/include/freetype/tttables.h
+++ b/contrib/libs/freetype/include/freetype/tttables.h
@@ -5,7 +5,7 @@
* Basic SFNT/TrueType tables definitions and interface
* (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -838,8 +838,9 @@ FT_BEGIN_HEADER
* The target charmap.
*
* @return:
- * The format of `charmap`. If `charmap` doesn't belong to an SFNT face,
- * return -1.
+ * The format of `charmap`. If `charmap` doesn't belong to an SFNT face
+ * (including the synthetic Unicode charmap sometimes created by
+ * FreeType), return -1.
*/
FT_EXPORT( FT_Long )
FT_Get_CMap_Format( FT_CharMap charmap );
diff --git a/contrib/libs/freetype/include/freetype/tttags.h b/contrib/libs/freetype/include/freetype/tttags.h
index 9bf4fca23f..da0af5d3f2 100644
--- a/contrib/libs/freetype/include/freetype/tttags.h
+++ b/contrib/libs/freetype/include/freetype/tttags.h
@@ -4,7 +4,7 @@
*
* Tags for TrueType and OpenType tables (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/include/ft2build.h b/contrib/libs/freetype/include/ft2build.h
index 58491ceea1..d3d7685039 100644
--- a/contrib/libs/freetype/include/ft2build.h
+++ b/contrib/libs/freetype/include/ft2build.h
@@ -4,7 +4,7 @@
*
* FreeType 2 build and setup macros.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afblue.c b/contrib/libs/freetype/src/autofit/afblue.c
index d7655b9b99..ea83969cdc 100644
--- a/contrib/libs/freetype/src/autofit/afblue.c
+++ b/contrib/libs/freetype/src/autofit/afblue.c
@@ -7,7 +7,7 @@
*
* Auto-fitter data for blue strings (body).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afblue.h b/contrib/libs/freetype/src/autofit/afblue.h
index 76f2f47cb0..2aa9d0984e 100644
--- a/contrib/libs/freetype/src/autofit/afblue.h
+++ b/contrib/libs/freetype/src/autofit/afblue.h
@@ -7,7 +7,7 @@
*
* Auto-fitter data for blue strings (specification).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afcjk.c b/contrib/libs/freetype/src/autofit/afcjk.c
index f414289adc..869b60487c 100644
--- a/contrib/libs/freetype/src/autofit/afcjk.c
+++ b/contrib/libs/freetype/src/autofit/afcjk.c
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for CJK writing system (body).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afcjk.h b/contrib/libs/freetype/src/autofit/afcjk.h
index f380ef6e03..bc5aaf12e6 100644
--- a/contrib/libs/freetype/src/autofit/afcjk.h
+++ b/contrib/libs/freetype/src/autofit/afcjk.h
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for CJK writing system (specification).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -84,7 +84,7 @@ FT_BEGIN_HEADER
/* used for horizontal metrics too for CJK */
FT_Bool control_overshoot;
FT_UInt blue_count;
- AF_CJKBlueRec blues[AF_BLUE_STRINGSET_MAX];
+ AF_CJKBlueRec blues[AF_BLUE_STRINGSET_MAX_LEN];
FT_Fixed org_scale;
FT_Pos org_delta;
diff --git a/contrib/libs/freetype/src/autofit/afcover.h b/contrib/libs/freetype/src/autofit/afcover.h
index 102ed42782..7980cf2e97 100644
--- a/contrib/libs/freetype/src/autofit/afcover.h
+++ b/contrib/libs/freetype/src/autofit/afcover.h
@@ -4,7 +4,7 @@
*
* Auto-fitter coverages (specification only).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afdummy.c b/contrib/libs/freetype/src/autofit/afdummy.c
index a4629b528d..ad667d2edc 100644
--- a/contrib/libs/freetype/src/autofit/afdummy.c
+++ b/contrib/libs/freetype/src/autofit/afdummy.c
@@ -5,7 +5,7 @@
* Auto-fitter dummy routines to be used if no hinting should be
* performed (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afdummy.h b/contrib/libs/freetype/src/autofit/afdummy.h
index a7af3f62c9..613c2f88a3 100644
--- a/contrib/libs/freetype/src/autofit/afdummy.h
+++ b/contrib/libs/freetype/src/autofit/afdummy.h
@@ -5,7 +5,7 @@
* Auto-fitter dummy routines to be used if no hinting should be
* performed (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/aferrors.h b/contrib/libs/freetype/src/autofit/aferrors.h
index 88faf05c95..ae584ff06d 100644
--- a/contrib/libs/freetype/src/autofit/aferrors.h
+++ b/contrib/libs/freetype/src/autofit/aferrors.h
@@ -4,7 +4,7 @@
*
* Autofitter error codes (specification only).
*
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afglobal.c b/contrib/libs/freetype/src/autofit/afglobal.c
index b1957570f0..b7403fa65e 100644
--- a/contrib/libs/freetype/src/autofit/afglobal.c
+++ b/contrib/libs/freetype/src/autofit/afglobal.c
@@ -4,7 +4,7 @@
*
* Auto-fitter routines to compute global hinting values (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afglobal.h b/contrib/libs/freetype/src/autofit/afglobal.h
index 66170e419d..ddb54c89b2 100644
--- a/contrib/libs/freetype/src/autofit/afglobal.h
+++ b/contrib/libs/freetype/src/autofit/afglobal.h
@@ -5,7 +5,7 @@
* Auto-fitter routines to compute global hinting values
* (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afhints.c b/contrib/libs/freetype/src/autofit/afhints.c
index e4a378fbf7..96ffe343aa 100644
--- a/contrib/libs/freetype/src/autofit/afhints.c
+++ b/contrib/libs/freetype/src/autofit/afhints.c
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -979,8 +979,8 @@
/* compute coordinates & Bezier flags, next and prev */
{
FT_Vector* vec = outline->points;
- char* tag = outline->tags;
- FT_Short endpoint = outline->contours[0];
+ FT_Byte* tag = outline->tags;
+ FT_UShort endpoint = outline->contours[0];
AF_Point end = points + endpoint;
AF_Point prev = end;
FT_Int contour_index = 0;
@@ -1046,16 +1046,16 @@
/* set up the contours array */
{
- AF_Point* contour = hints->contours;
- AF_Point* contour_limit = contour + hints->num_contours;
- short* end = outline->contours;
- short idx = 0;
+ AF_Point* contour = hints->contours;
+ AF_Point* contour_limit = contour + hints->num_contours;
+ FT_UShort* end = outline->contours;
+ FT_Int idx = 0;
for ( ; contour < contour_limit; contour++, end++ )
{
contour[0] = points + idx;
- idx = (short)( end[0] + 1 );
+ idx = *end + 1;
}
}
@@ -1292,7 +1292,7 @@
AF_Point point = hints->points;
AF_Point limit = point + hints->num_points;
FT_Vector* vec = outline->points;
- char* tag = outline->tags;
+ FT_Byte* tag = outline->tags;
for ( ; point < limit; point++, vec++, tag++ )
diff --git a/contrib/libs/freetype/src/autofit/afhints.h b/contrib/libs/freetype/src/autofit/afhints.h
index d1cf9529bf..76fe83006a 100644
--- a/contrib/libs/freetype/src/autofit/afhints.h
+++ b/contrib/libs/freetype/src/autofit/afhints.h
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afindic.c b/contrib/libs/freetype/src/autofit/afindic.c
index 7fb12c63d5..c6d23efd86 100644
--- a/contrib/libs/freetype/src/autofit/afindic.c
+++ b/contrib/libs/freetype/src/autofit/afindic.c
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for Indic writing system (body).
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afindic.h b/contrib/libs/freetype/src/autofit/afindic.h
index 3eb67f63b0..a7f73f2515 100644
--- a/contrib/libs/freetype/src/autofit/afindic.h
+++ b/contrib/libs/freetype/src/autofit/afindic.h
@@ -5,7 +5,7 @@
* Auto-fitter hinting routines for Indic writing system
* (specification).
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/aflatin.c b/contrib/libs/freetype/src/autofit/aflatin.c
index b86367aa94..89287f7ea5 100644
--- a/contrib/libs/freetype/src/autofit/aflatin.c
+++ b/contrib/libs/freetype/src/autofit/aflatin.c
@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for latin writing system (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -981,7 +981,7 @@
/* `ref' and `shoot' values of two blue zones must not overlap */
FT_UInt i;
- AF_LatinBlue blue_sorted[AF_BLUE_STRINGSET_MAX_LEN + 2];
+ AF_LatinBlue blue_sorted[AF_BLUE_STRINGSET_MAX_LEN];
for ( i = 0; i < axis->blue_count; i++ )
@@ -1263,10 +1263,9 @@
max_height = FT_MAX( max_height, -Axis->blues[nn].descender );
}
- dist = FT_ABS( FT_MulFix( max_height, new_scale - scale ) );
- dist &= ~127;
+ dist = FT_MulFix( max_height, new_scale - scale );
- if ( dist == 0 )
+ if ( -128 < dist && dist < 128 )
{
FT_TRACE5(( "af_latin_metrics_scale_dim:"
" x height alignment (style `%s'):\n",
diff --git a/contrib/libs/freetype/src/autofit/aflatin.h b/contrib/libs/freetype/src/autofit/aflatin.h
index 31aa91d3bd..54e5061502 100644
--- a/contrib/libs/freetype/src/autofit/aflatin.h
+++ b/contrib/libs/freetype/src/autofit/aflatin.h
@@ -5,7 +5,7 @@
* Auto-fitter hinting routines for latin writing system
* (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -98,7 +98,7 @@ FT_BEGIN_HEADER
/* ignored for horizontal metrics */
FT_UInt blue_count;
- AF_LatinBlueRec blues[AF_BLUE_STRINGSET_MAX];
+ AF_LatinBlueRec blues[AF_BLUE_STRINGSET_MAX_LEN];
FT_Fixed org_scale;
FT_Pos org_delta;
diff --git a/contrib/libs/freetype/src/autofit/afloader.c b/contrib/libs/freetype/src/autofit/afloader.c
index 7c47d562af..af1d59a689 100644
--- a/contrib/libs/freetype/src/autofit/afloader.c
+++ b/contrib/libs/freetype/src/autofit/afloader.c
@@ -4,7 +4,7 @@
*
* Auto-fitter glyph loading routines (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afloader.h b/contrib/libs/freetype/src/autofit/afloader.h
index e4e197e374..99f0e15f92 100644
--- a/contrib/libs/freetype/src/autofit/afloader.h
+++ b/contrib/libs/freetype/src/autofit/afloader.h
@@ -4,7 +4,7 @@
*
* Auto-fitter glyph loading routines (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afmodule.c b/contrib/libs/freetype/src/autofit/afmodule.c
index 20a6b96bc4..726f6ca2b7 100644
--- a/contrib/libs/freetype/src/autofit/afmodule.c
+++ b/contrib/libs/freetype/src/autofit/afmodule.c
@@ -4,7 +4,7 @@
*
* Auto-fitter module implementation (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -438,7 +438,7 @@
AF_Module module = (AF_Module)module_;
FT_Error error = FT_Err_Ok;
- FT_Memory memory = module->root.library->memory;
+ FT_Memory memory = module->root.memory;
#ifdef FT_DEBUG_AUTOFIT
diff --git a/contrib/libs/freetype/src/autofit/afmodule.h b/contrib/libs/freetype/src/autofit/afmodule.h
index 4b8b4562c6..91a1abfef1 100644
--- a/contrib/libs/freetype/src/autofit/afmodule.h
+++ b/contrib/libs/freetype/src/autofit/afmodule.h
@@ -4,7 +4,7 @@
*
* Auto-fitter module implementation (specification).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afranges.c b/contrib/libs/freetype/src/autofit/afranges.c
index cfcaf340a7..007b432818 100644
--- a/contrib/libs/freetype/src/autofit/afranges.c
+++ b/contrib/libs/freetype/src/autofit/afranges.c
@@ -4,7 +4,7 @@
*
* Auto-fitter Unicode script ranges (body).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afranges.h b/contrib/libs/freetype/src/autofit/afranges.h
index 5775738bc0..813b3ee78e 100644
--- a/contrib/libs/freetype/src/autofit/afranges.h
+++ b/contrib/libs/freetype/src/autofit/afranges.h
@@ -4,7 +4,7 @@
*
* Auto-fitter Unicode script ranges (specification).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afscript.h b/contrib/libs/freetype/src/autofit/afscript.h
index 3a101937d7..0a83d77150 100644
--- a/contrib/libs/freetype/src/autofit/afscript.h
+++ b/contrib/libs/freetype/src/autofit/afscript.h
@@ -4,7 +4,7 @@
*
* Auto-fitter scripts (specification only).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afshaper.c b/contrib/libs/freetype/src/autofit/afshaper.c
index abc6f1d292..df0f46ada8 100644
--- a/contrib/libs/freetype/src/autofit/afshaper.c
+++ b/contrib/libs/freetype/src/autofit/afshaper.c
@@ -4,7 +4,7 @@
*
* HarfBuzz interface for accessing OpenType features (body).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afshaper.h b/contrib/libs/freetype/src/autofit/afshaper.h
index 19d76b7c6c..1182ee6361 100644
--- a/contrib/libs/freetype/src/autofit/afshaper.h
+++ b/contrib/libs/freetype/src/autofit/afshaper.h
@@ -4,7 +4,7 @@
*
* HarfBuzz interface for accessing OpenType features (specification).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afstyles.h b/contrib/libs/freetype/src/autofit/afstyles.h
index 73ebef0171..7a33f37a85 100644
--- a/contrib/libs/freetype/src/autofit/afstyles.h
+++ b/contrib/libs/freetype/src/autofit/afstyles.h
@@ -4,7 +4,7 @@
*
* Auto-fitter styles (specification only).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/aftypes.h b/contrib/libs/freetype/src/autofit/aftypes.h
index 6615194496..27e4185e9f 100644
--- a/contrib/libs/freetype/src/autofit/aftypes.h
+++ b/contrib/libs/freetype/src/autofit/aftypes.h
@@ -4,7 +4,7 @@
*
* Auto-fitter types (specification only).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afws-decl.h b/contrib/libs/freetype/src/autofit/afws-decl.h
index 48c888afed..b78745af74 100644
--- a/contrib/libs/freetype/src/autofit/afws-decl.h
+++ b/contrib/libs/freetype/src/autofit/afws-decl.h
@@ -4,7 +4,7 @@
*
* Auto-fitter writing system declarations (specification only).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/afws-iter.h b/contrib/libs/freetype/src/autofit/afws-iter.h
index a0a686f8ce..c86d609a35 100644
--- a/contrib/libs/freetype/src/autofit/afws-iter.h
+++ b/contrib/libs/freetype/src/autofit/afws-iter.h
@@ -4,7 +4,7 @@
*
* Auto-fitter writing systems iterator (specification only).
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/autofit/autofit.c b/contrib/libs/freetype/src/autofit/autofit.c
index 8bd609b5e8..de5ec7c7c5 100644
--- a/contrib/libs/freetype/src/autofit/autofit.c
+++ b/contrib/libs/freetype/src/autofit/autofit.c
@@ -4,7 +4,7 @@
*
* Auto-fitter module (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftadvanc.c b/contrib/libs/freetype/src/base/ftadvanc.c
index de25476fe9..717f7d08b3 100644
--- a/contrib/libs/freetype/src/base/ftadvanc.c
+++ b/contrib/libs/freetype/src/base/ftadvanc.c
@@ -4,7 +4,7 @@
*
* Quick computation of advance widths (body).
*
- * Copyright (C) 2008-2023 by
+ * Copyright (C) 2008-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftbase.c b/contrib/libs/freetype/src/base/ftbase.c
index 156510f007..50805ccec4 100644
--- a/contrib/libs/freetype/src/base/ftbase.c
+++ b/contrib/libs/freetype/src/base/ftbase.c
@@ -4,7 +4,7 @@
*
* Single object library component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftbase.h b/contrib/libs/freetype/src/base/ftbase.h
index 00790d3b22..1d98b26dd5 100644
--- a/contrib/libs/freetype/src/base/ftbase.h
+++ b/contrib/libs/freetype/src/base/ftbase.h
@@ -4,7 +4,7 @@
*
* Private functions used in the `base' module (specification).
*
- * Copyright (C) 2008-2023 by
+ * Copyright (C) 2008-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftbbox.c b/contrib/libs/freetype/src/base/ftbbox.c
index 385fea4040..d6aa5d56df 100644
--- a/contrib/libs/freetype/src/base/ftbbox.c
+++ b/contrib/libs/freetype/src/base/ftbbox.c
@@ -4,7 +4,7 @@
*
* FreeType bbox computation (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
@@ -489,7 +489,7 @@
return FT_THROW( Invalid_Outline );
/* if outline is empty, return (0,0,0,0) */
- if ( outline->n_points == 0 || outline->n_contours <= 0 )
+ if ( outline->n_points == 0 || outline->n_contours == 0 )
{
abbox->xMin = abbox->xMax = 0;
abbox->yMin = abbox->yMax = 0;
diff --git a/contrib/libs/freetype/src/base/ftbdf.c b/contrib/libs/freetype/src/base/ftbdf.c
index f697c00fec..d8e9fd7eaf 100644
--- a/contrib/libs/freetype/src/base/ftbdf.c
+++ b/contrib/libs/freetype/src/base/ftbdf.c
@@ -4,7 +4,7 @@
*
* FreeType API for accessing BDF-specific strings (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftbitmap.c b/contrib/libs/freetype/src/base/ftbitmap.c
index 1c93648dcb..4be145679f 100644
--- a/contrib/libs/freetype/src/base/ftbitmap.c
+++ b/contrib/libs/freetype/src/base/ftbitmap.c
@@ -4,7 +4,7 @@
*
* FreeType utility functions for bitmaps (body).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftcalc.c b/contrib/libs/freetype/src/base/ftcalc.c
index c5bc7e3b14..92de09ed87 100644
--- a/contrib/libs/freetype/src/base/ftcalc.c
+++ b/contrib/libs/freetype/src/base/ftcalc.c
@@ -4,7 +4,7 @@
*
* Arithmetic computations (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -69,13 +69,15 @@
/* transfer sign, leaving a positive number; */
/* we need an unsigned value to safely negate INT_MIN (or LONG_MIN) */
-#define FT_MOVE_SIGN( x, x_unsigned, s ) \
- FT_BEGIN_STMNT \
- if ( x < 0 ) \
- { \
- x_unsigned = 0U - (x_unsigned); \
- s = -s; \
- } \
+#define FT_MOVE_SIGN( utype, x, x_unsigned, s ) \
+ FT_BEGIN_STMNT \
+ if ( x < 0 ) \
+ { \
+ x_unsigned = 0U - (utype)x; \
+ s = -s; \
+ } \
+ else \
+ x_unsigned = (utype)x; \
FT_END_STMNT
/* The following three functions are available regardless of whether */
@@ -179,13 +181,9 @@
FT_Long d_;
- a = (FT_UInt64)a_;
- b = (FT_UInt64)b_;
- c = (FT_UInt64)c_;
-
- FT_MOVE_SIGN( a_, a, s );
- FT_MOVE_SIGN( b_, b, s );
- FT_MOVE_SIGN( c_, c, s );
+ FT_MOVE_SIGN( FT_UInt64, a_, a, s );
+ FT_MOVE_SIGN( FT_UInt64, b_, b, s );
+ FT_MOVE_SIGN( FT_UInt64, c_, c, s );
d = c > 0 ? ( a * b + ( c >> 1 ) ) / c
: 0x7FFFFFFFUL;
@@ -208,13 +206,9 @@
FT_Long d_;
- a = (FT_UInt64)a_;
- b = (FT_UInt64)b_;
- c = (FT_UInt64)c_;
-
- FT_MOVE_SIGN( a_, a, s );
- FT_MOVE_SIGN( b_, b, s );
- FT_MOVE_SIGN( c_, c, s );
+ FT_MOVE_SIGN( FT_UInt64, a_, a, s );
+ FT_MOVE_SIGN( FT_UInt64, b_, b, s );
+ FT_MOVE_SIGN( FT_UInt64, c_, c, s );
d = c > 0 ? a * b / c
: 0x7FFFFFFFUL;
@@ -257,11 +251,8 @@
FT_Long q_;
- a = (FT_UInt64)a_;
- b = (FT_UInt64)b_;
-
- FT_MOVE_SIGN( a_, a, s );
- FT_MOVE_SIGN( b_, b, s );
+ FT_MOVE_SIGN( FT_UInt64, a_, a, s );
+ FT_MOVE_SIGN( FT_UInt64, b_, b, s );
q = b > 0 ? ( ( a << 16 ) + ( b >> 1 ) ) / b
: 0x7FFFFFFFUL;
@@ -422,13 +413,9 @@
/* XXX: this function does not allow 64-bit arguments */
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
- c = (FT_UInt32)c_;
-
- FT_MOVE_SIGN( a_, a, s );
- FT_MOVE_SIGN( b_, b, s );
- FT_MOVE_SIGN( c_, c, s );
+ FT_MOVE_SIGN( FT_UInt32, a_, a, s );
+ FT_MOVE_SIGN( FT_UInt32, b_, b, s );
+ FT_MOVE_SIGN( FT_UInt32, c_, c, s );
if ( c == 0 )
a = 0x7FFFFFFFUL;
@@ -470,13 +457,9 @@
/* XXX: this function does not allow 64-bit arguments */
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
- c = (FT_UInt32)c_;
-
- FT_MOVE_SIGN( a_, a, s );
- FT_MOVE_SIGN( b_, b, s );
- FT_MOVE_SIGN( c_, c, s );
+ FT_MOVE_SIGN( FT_UInt32, a_, a, s );
+ FT_MOVE_SIGN( FT_UInt32, b_, b, s );
+ FT_MOVE_SIGN( FT_UInt32, c_, c, s );
if ( c == 0 )
a = 0x7FFFFFFFUL;
@@ -575,11 +558,8 @@
/* XXX: this function does not allow 64-bit arguments */
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
-
- FT_MOVE_SIGN( a_, a, s );
- FT_MOVE_SIGN( b_, b, s );
+ FT_MOVE_SIGN( FT_UInt32, a_, a, s );
+ FT_MOVE_SIGN( FT_UInt32, b_, b, s );
if ( a + ( b >> 8 ) <= 8190UL )
a = ( a * b + 0x8000UL ) >> 16;
@@ -614,11 +594,8 @@
/* XXX: this function does not allow 64-bit arguments */
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
-
- FT_MOVE_SIGN( a_, a, s );
- FT_MOVE_SIGN( b_, b, s );
+ FT_MOVE_SIGN( FT_UInt32, a_, a, s );
+ FT_MOVE_SIGN( FT_UInt32, b_, b, s );
if ( b == 0 )
{
@@ -829,11 +806,8 @@
FT_Int sx = 1, sy = 1, shift;
- x = (FT_UInt32)x_;
- y = (FT_UInt32)y_;
-
- FT_MOVE_SIGN( x_, x, sx );
- FT_MOVE_SIGN( y_, y, sy );
+ FT_MOVE_SIGN( FT_UInt32, x_, x, sx );
+ FT_MOVE_SIGN( FT_UInt32, y_, y, sy );
/* trivial cases */
if ( x == 0 )
@@ -913,43 +887,71 @@
}
-#if 0
-
/* documentation is in ftcalc.h */
- FT_BASE_DEF( FT_Int32 )
- FT_SqrtFixed( FT_Int32 x )
+ FT_BASE_DEF( FT_UInt32 )
+ FT_SqrtFixed( FT_UInt32 v )
{
- FT_UInt32 root, rem_hi, rem_lo, test_div;
- FT_Int count;
-
+ if ( v == 0 )
+ return 0;
- root = 0;
+#ifndef FT_INT64
- if ( x > 0 )
+ /* Algorithm by Christophe Meessen (1993) with overflow fixed and */
+ /* rounding added. Any unsigned fixed 16.16 argument is acceptable. */
+ /* However, this algorithm is slower than the Babylonian method with */
+ /* a good initial guess. We only use it for large 32-bit values when */
+ /* 64-bit computations are not desirable. */
+ else if ( v > 0x10000U )
{
- rem_hi = 0;
- rem_lo = (FT_UInt32)x;
- count = 24;
+ FT_UInt32 r = v >> 1;
+ FT_UInt32 q = ( v & 1 ) << 15;
+ FT_UInt32 b = 0x20000000;
+ FT_UInt32 t;
+
+
do
{
- rem_hi = ( rem_hi << 2 ) | ( rem_lo >> 30 );
- rem_lo <<= 2;
- root <<= 1;
- test_div = ( root << 1 ) + 1;
-
- if ( rem_hi >= test_div )
+ t = q + b;
+ if ( r >= t )
{
- rem_hi -= test_div;
- root += 1;
+ r -= t;
+ q = t + b; /* equivalent to q += 2*b */
}
- } while ( --count );
+ r <<= 1;
+ b >>= 1;
+
+ } while ( b > 0x10 ); /* exactly 25 cycles */
+
+ return ( q + 0x40 ) >> 7;
}
+ else
+ {
+ FT_UInt32 r = ( v << 16 ) - 1;
- return (FT_Int32)root;
- }
+#else /* FT_INT64 */
-#endif /* 0 */
+ else
+ {
+ FT_UInt64 r = ( (FT_UInt64)v << 16 ) - 1;
+
+#endif /* FT_INT64 */
+
+ FT_UInt32 q = 1 << ( ( 17 + FT_MSB( v ) ) >> 1 );
+ FT_UInt32 t;
+
+
+ /* Babylonian method with rounded-up division */
+ do
+ {
+ t = q;
+ q = ( t + (FT_UInt32)( r / t ) + 1 ) >> 1;
+
+ } while ( q != t ); /* less than 6 cycles */
+
+ return q;
+ }
+ }
/* documentation is in ftcalc.h */
@@ -1094,11 +1096,8 @@
FT_UInt32 factor;
- scalar = (FT_UInt32)s[i];
- factor = (FT_UInt32)f[i];
-
- FT_MOVE_SIGN( s[i], scalar, sign );
- FT_MOVE_SIGN( f[i], factor, sign );
+ FT_MOVE_SIGN( FT_UInt32, s[i], scalar, sign );
+ FT_MOVE_SIGN( FT_UInt32, f[i], factor, sign );
ft_multo64( scalar, factor, &multResult );
diff --git a/contrib/libs/freetype/src/base/ftcid.c b/contrib/libs/freetype/src/base/ftcid.c
index 866cd23e91..4f2deb19a0 100644
--- a/contrib/libs/freetype/src/base/ftcid.c
+++ b/contrib/libs/freetype/src/base/ftcid.c
@@ -4,7 +4,7 @@
*
* FreeType API for accessing CID font information.
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* Derek Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftcolor.c b/contrib/libs/freetype/src/base/ftcolor.c
index bcd6e893d4..c6bf2a3cd1 100644
--- a/contrib/libs/freetype/src/base/ftcolor.c
+++ b/contrib/libs/freetype/src/base/ftcolor.c
@@ -4,7 +4,7 @@
*
* FreeType's glyph color management (body).
*
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftdbgmem.c b/contrib/libs/freetype/src/base/ftdbgmem.c
index 8fab50dd01..902a5dc8bb 100644
--- a/contrib/libs/freetype/src/base/ftdbgmem.c
+++ b/contrib/libs/freetype/src/base/ftdbgmem.c
@@ -4,7 +4,7 @@
*
* Memory debugger (body).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftdebug.c b/contrib/libs/freetype/src/base/ftdebug.c
index 61c4563b0c..11307eaace 100644
--- a/contrib/libs/freetype/src/base/ftdebug.c
+++ b/contrib/libs/freetype/src/base/ftdebug.c
@@ -4,7 +4,7 @@
*
* Debugging and logging component (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/fterrors.c b/contrib/libs/freetype/src/base/fterrors.c
index 5ad9709c80..61041a37c1 100644
--- a/contrib/libs/freetype/src/base/fterrors.c
+++ b/contrib/libs/freetype/src/base/fterrors.c
@@ -4,7 +4,7 @@
*
* FreeType API for error code handling.
*
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
* Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftfntfmt.c b/contrib/libs/freetype/src/base/ftfntfmt.c
index 0b41f7cc83..77b4089e7e 100644
--- a/contrib/libs/freetype/src/base/ftfntfmt.c
+++ b/contrib/libs/freetype/src/base/ftfntfmt.c
@@ -4,7 +4,7 @@
*
* FreeType utility file for font formats (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftfstype.c b/contrib/libs/freetype/src/base/ftfstype.c
index ea24e64c6e..1565c3b7e2 100644
--- a/contrib/libs/freetype/src/base/ftfstype.c
+++ b/contrib/libs/freetype/src/base/ftfstype.c
@@ -4,7 +4,7 @@
*
* FreeType utility file to access FSType data (body).
*
- * Copyright (C) 2008-2023 by
+ * Copyright (C) 2008-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftgasp.c b/contrib/libs/freetype/src/base/ftgasp.c
index 29b7b08b78..c63d30e978 100644
--- a/contrib/libs/freetype/src/base/ftgasp.c
+++ b/contrib/libs/freetype/src/base/ftgasp.c
@@ -4,7 +4,7 @@
*
* Access of TrueType's `gasp' table (body).
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftgloadr.c b/contrib/libs/freetype/src/base/ftgloadr.c
index 9823d09e41..484d98f172 100644
--- a/contrib/libs/freetype/src/base/ftgloadr.c
+++ b/contrib/libs/freetype/src/base/ftgloadr.c
@@ -4,7 +4,7 @@
*
* The FreeType glyph loader (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg
*
* This file is part of the FreeType project, and may only be used,
@@ -355,34 +355,25 @@
FT_BASE_DEF( void )
FT_GlyphLoader_Add( FT_GlyphLoader loader )
{
- FT_GlyphLoad base;
- FT_GlyphLoad current;
-
- FT_Int n_curr_contours;
- FT_Int n_base_points;
- FT_Int n;
+ FT_Outline* base;
+ FT_Outline* current;
+ FT_Int n;
if ( !loader )
return;
- base = &loader->base;
- current = &loader->current;
-
- n_curr_contours = current->outline.n_contours;
- n_base_points = base->outline.n_points;
+ base = &loader->base.outline;
+ current = &loader->current.outline;
- base->outline.n_points =
- (short)( base->outline.n_points + current->outline.n_points );
- base->outline.n_contours =
- (short)( base->outline.n_contours + current->outline.n_contours );
+ /* adjust contours count in newest outline */
+ for ( n = 0; n < current->n_contours; n++ )
+ current->contours[n] += base->n_points;
- base->num_subglyphs += current->num_subglyphs;
+ base->n_points += current->n_points;
+ base->n_contours += current->n_contours;
- /* adjust contours count in newest outline */
- for ( n = 0; n < n_curr_contours; n++ )
- current->outline.contours[n] =
- (short)( current->outline.contours[n] + n_base_points );
+ loader->base.num_subglyphs += loader->current.num_subglyphs;
/* prepare for another new glyph image */
FT_GlyphLoader_Prepare( loader );
diff --git a/contrib/libs/freetype/src/base/ftglyph.c b/contrib/libs/freetype/src/base/ftglyph.c
index 393d4949f8..1b5849f99a 100644
--- a/contrib/libs/freetype/src/base/ftglyph.c
+++ b/contrib/libs/freetype/src/base/ftglyph.c
@@ -4,7 +4,7 @@
*
* FreeType convenience functions to handle glyphs (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftgxval.c b/contrib/libs/freetype/src/base/ftgxval.c
index 6b3c5d2484..6e38cb5ba9 100644
--- a/contrib/libs/freetype/src/base/ftgxval.c
+++ b/contrib/libs/freetype/src/base/ftgxval.c
@@ -4,7 +4,7 @@
*
* FreeType API for validating TrueTypeGX/AAT tables (body).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* Masatake YAMATO, Redhat K.K,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
diff --git a/contrib/libs/freetype/src/base/ftinit.c b/contrib/libs/freetype/src/base/ftinit.c
index c9c71d24bf..9a6c00e13e 100644
--- a/contrib/libs/freetype/src/base/ftinit.c
+++ b/contrib/libs/freetype/src/base/ftinit.c
@@ -4,7 +4,7 @@
*
* FreeType initialization layer (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftlcdfil.c b/contrib/libs/freetype/src/base/ftlcdfil.c
index 6c3fd66e0b..1e69d4da70 100644
--- a/contrib/libs/freetype/src/base/ftlcdfil.c
+++ b/contrib/libs/freetype/src/base/ftlcdfil.c
@@ -4,7 +4,7 @@
*
* FreeType API for color filtering of subpixel bitmap glyphs (body).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftmac.c b/contrib/libs/freetype/src/base/ftmac.c
index 492d055384..e8e35627b5 100644
--- a/contrib/libs/freetype/src/base/ftmac.c
+++ b/contrib/libs/freetype/src/base/ftmac.c
@@ -8,7 +8,7 @@
* This file is for Mac OS X only; see builds/mac/ftoldmac.c for
* classic platforms built by MPW.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -812,6 +812,7 @@
ResourceIndex res_index;
Handle fond;
short num_faces_in_res;
+ FT_Long count;
if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
@@ -821,8 +822,10 @@
if ( ResError() )
return FT_THROW( Cannot_Open_Resource );
+ res_index = 1;
num_faces_in_res = 0;
- for ( res_index = 1; ; res_index++ )
+ count = face_index;
+ while ( count >= 0 )
{
short num_faces_in_fond;
@@ -834,15 +837,21 @@
num_faces_in_fond = count_faces( fond, pathname );
num_faces_in_res += num_faces_in_fond;
- if ( 0 <= face_index && face_index < num_faces_in_fond && error )
- error = FT_New_Face_From_FOND( library, fond, face_index, aface );
+ if ( count < num_faces_in_fond )
+ error = FT_New_Face_From_FOND( library, fond, count, aface );
- face_index -= num_faces_in_fond;
+ res_index++;
+ count -= num_faces_in_fond;
}
CloseResFile( res_ref );
+
if ( !error && aface && *aface )
- (*aface)->num_faces = num_faces_in_res;
+ {
+ (*aface)->num_faces = num_faces_in_res;
+ (*aface)->face_index = face_index;
+ }
+
return error;
}
diff --git a/contrib/libs/freetype/src/base/ftmm.c b/contrib/libs/freetype/src/base/ftmm.c
index 9e2dd7ee79..cc4ca22fba 100644
--- a/contrib/libs/freetype/src/base/ftmm.c
+++ b/contrib/libs/freetype/src/base/ftmm.c
@@ -4,7 +4,7 @@
*
* Multiple Master font support (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftobjs.c b/contrib/libs/freetype/src/base/ftobjs.c
index 89a25bc732..9b97820c37 100644
--- a/contrib/libs/freetype/src/base/ftobjs.c
+++ b/contrib/libs/freetype/src/base/ftobjs.c
@@ -4,7 +4,7 @@
*
* The FreeType private base classes (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -2302,7 +2302,10 @@
face_index_internal, aface );
FT_FREE( data_offsets );
if ( !error )
- (*aface)->num_faces = count;
+ {
+ (*aface)->num_faces = count;
+ (*aface)->face_index = face_index_internal;
+ }
}
return error;
@@ -5791,7 +5794,7 @@
ttface = (TT_Face)face;
sfnt = (SFNT_Service)ttface->sfnt;
- if ( sfnt->get_colr_layer )
+ if ( sfnt->get_colr_glyph_paint )
return sfnt->get_colr_glyph_paint( ttface,
base_glyph,
root_transform,
diff --git a/contrib/libs/freetype/src/base/ftotval.c b/contrib/libs/freetype/src/base/ftotval.c
index 192e12a71f..aed9eef343 100644
--- a/contrib/libs/freetype/src/base/ftotval.c
+++ b/contrib/libs/freetype/src/base/ftotval.c
@@ -4,7 +4,7 @@
*
* FreeType API for validating OpenType tables (body).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftoutln.c b/contrib/libs/freetype/src/base/ftoutln.c
index 134f39d2b1..ef699b3c7c 100644
--- a/contrib/libs/freetype/src/base/ftoutln.c
+++ b/contrib/libs/freetype/src/base/ftoutln.c
@@ -4,7 +4,7 @@
*
* FreeType outline management (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -53,7 +53,7 @@
FT_Vector* point;
FT_Vector* limit;
- char* tags;
+ FT_Byte* tags;
FT_Error error;
@@ -332,8 +332,8 @@
FT_NEW_ARRAY( anoutline->contours, numContours ) )
goto Fail;
- anoutline->n_points = (FT_Short)numPoints;
- anoutline->n_contours = (FT_Short)numContours;
+ anoutline->n_points = (FT_UShort)numPoints;
+ anoutline->n_contours = (FT_UShort)numContours;
anoutline->flags |= FT_OUTLINE_OWNER;
return FT_Err_Ok;
@@ -359,12 +359,14 @@
FT_Int n;
+ FT_TRACE5(( "FT_Outline_Check: contours = %d, points = %d\n",
+ n_contours, n_points ));
/* empty glyph? */
if ( n_points == 0 && n_contours == 0 )
return FT_Err_Ok;
/* check point and contour counts */
- if ( n_points <= 0 || n_contours <= 0 )
+ if ( n_points == 0 || n_contours == 0 )
goto Bad;
end0 = -1;
@@ -576,13 +578,13 @@
/* reverse tags table */
{
- char* p = outline->tags + first;
- char* q = outline->tags + last;
+ FT_Byte* p = outline->tags + first;
+ FT_Byte* q = outline->tags + last;
while ( p < q )
{
- char swap;
+ FT_Byte swap;
swap = *p;
diff --git a/contrib/libs/freetype/src/base/ftpatent.c b/contrib/libs/freetype/src/base/ftpatent.c
index cb5efadffb..2055757e02 100644
--- a/contrib/libs/freetype/src/base/ftpatent.c
+++ b/contrib/libs/freetype/src/base/ftpatent.c
@@ -5,7 +5,7 @@
* FreeType API for checking patented TrueType bytecode instructions
* (body). Obsolete, retained for backward compatibility.
*
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftpfr.c b/contrib/libs/freetype/src/base/ftpfr.c
index 378385a591..0caa9d1d58 100644
--- a/contrib/libs/freetype/src/base/ftpfr.c
+++ b/contrib/libs/freetype/src/base/ftpfr.c
@@ -4,7 +4,7 @@
*
* FreeType API for accessing PFR-specific data (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftpsprop.c b/contrib/libs/freetype/src/base/ftpsprop.c
index cefdf489d7..37a6cee6cc 100644
--- a/contrib/libs/freetype/src/base/ftpsprop.c
+++ b/contrib/libs/freetype/src/base/ftpsprop.c
@@ -5,7 +5,7 @@
* Get and set properties of PostScript drivers (body).
* See `ftdriver.h' for available properties.
*
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftrfork.c b/contrib/libs/freetype/src/base/ftrfork.c
index 2ab430195f..dc9b043d8b 100644
--- a/contrib/libs/freetype/src/base/ftrfork.c
+++ b/contrib/libs/freetype/src/base/ftrfork.c
@@ -4,7 +4,7 @@
*
* Embedded resource forks accessor (body).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* Masatake YAMATO and Redhat K.K.
*
* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are
diff --git a/contrib/libs/freetype/src/base/ftsnames.c b/contrib/libs/freetype/src/base/ftsnames.c
index 1917a3f1df..f7231fd61c 100644
--- a/contrib/libs/freetype/src/base/ftsnames.c
+++ b/contrib/libs/freetype/src/base/ftsnames.c
@@ -7,7 +7,7 @@
*
* This is _not_ used to retrieve glyph names!
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftstream.c b/contrib/libs/freetype/src/base/ftstream.c
index 64826acebe..6672224612 100644
--- a/contrib/libs/freetype/src/base/ftstream.c
+++ b/contrib/libs/freetype/src/base/ftstream.c
@@ -4,7 +4,7 @@
*
* I/O stream support (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -763,10 +763,10 @@
case ft_frame_bytes: /* read a byte sequence */
case ft_frame_skip: /* skip some bytes */
{
- FT_UInt len = fields->size;
+ FT_Offset len = fields->size;
- if ( cursor + len > stream->limit )
+ if ( len > (FT_Offset)( stream->limit - cursor ) )
{
error = FT_THROW( Invalid_Stream_Operation );
goto Exit;
@@ -830,7 +830,7 @@
goto Exit;
}
- /* now, compute the signed value is necessary */
+ /* now, compute the signed value if necessary */
if ( fields->value & FT_FRAME_OP_SIGNED )
value = (FT_ULong)( (FT_Int32)( value << sign_shift ) >> sign_shift );
diff --git a/contrib/libs/freetype/src/base/ftstroke.c b/contrib/libs/freetype/src/base/ftstroke.c
index 92f1e43080..64f46ce43e 100644
--- a/contrib/libs/freetype/src/base/ftstroke.c
+++ b/contrib/libs/freetype/src/base/ftstroke.c
@@ -4,7 +4,7 @@
*
* FreeType path stroker (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -711,7 +711,7 @@
{
FT_UInt count = border->num_points;
FT_Byte* read = border->tags;
- FT_Byte* write = (FT_Byte*)outline->tags + outline->n_points;
+ FT_Byte* write = outline->tags + outline->n_points;
for ( ; count > 0; count--, read++, write++ )
@@ -727,10 +727,10 @@
/* copy contours */
{
- FT_UInt count = border->num_points;
- FT_Byte* tags = border->tags;
- FT_Short* write = outline->contours + outline->n_contours;
- FT_Short idx = (FT_Short)outline->n_points;
+ FT_UInt count = border->num_points;
+ FT_Byte* tags = border->tags;
+ FT_UShort* write = outline->contours + outline->n_contours;
+ FT_UShort idx = outline->n_points;
for ( ; count > 0; count--, tags++, idx++ )
@@ -743,7 +743,7 @@
}
}
- outline->n_points += (short)border->num_points;
+ outline->n_points += (FT_UShort)border->num_points;
FT_ASSERT( FT_Outline_Check( outline ) == 0 );
}
@@ -2050,7 +2050,7 @@
FT_Vector* point;
FT_Vector* limit;
- char* tags;
+ FT_Byte* tags;
FT_Error error;
diff --git a/contrib/libs/freetype/src/base/ftsynth.c b/contrib/libs/freetype/src/base/ftsynth.c
index f32edd3388..ec05bce33a 100644
--- a/contrib/libs/freetype/src/base/ftsynth.c
+++ b/contrib/libs/freetype/src/base/ftsynth.c
@@ -4,7 +4,7 @@
*
* FreeType synthesizing code for emboldening and slanting (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftsystem.c b/contrib/libs/freetype/src/base/ftsystem.c
index 61c99e3635..eee3642334 100644
--- a/contrib/libs/freetype/src/base/ftsystem.c
+++ b/contrib/libs/freetype/src/base/ftsystem.c
@@ -4,7 +4,7 @@
*
* ANSI-specific FreeType low-level system interface (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/fttrigon.c b/contrib/libs/freetype/src/base/fttrigon.c
index 2dd2c3459e..4b1aced1cb 100644
--- a/contrib/libs/freetype/src/base/fttrigon.c
+++ b/contrib/libs/freetype/src/base/fttrigon.c
@@ -4,7 +4,7 @@
*
* FreeType trigonometric functions (body).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/fttype1.c b/contrib/libs/freetype/src/base/fttype1.c
index 637c5cf775..cedf7c4050 100644
--- a/contrib/libs/freetype/src/base/fttype1.c
+++ b/contrib/libs/freetype/src/base/fttype1.c
@@ -4,7 +4,7 @@
*
* FreeType utility file for PS names support (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftutil.c b/contrib/libs/freetype/src/base/ftutil.c
index 6120846d2c..b13512f870 100644
--- a/contrib/libs/freetype/src/base/ftutil.c
+++ b/contrib/libs/freetype/src/base/ftutil.c
@@ -4,7 +4,7 @@
*
* FreeType utility file for memory and list management (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/base/ftwinfnt.c b/contrib/libs/freetype/src/base/ftwinfnt.c
index 03b023e079..e849a15f42 100644
--- a/contrib/libs/freetype/src/base/ftwinfnt.c
+++ b/contrib/libs/freetype/src/base/ftwinfnt.c
@@ -4,7 +4,7 @@
*
* FreeType API for accessing Windows FNT specific info (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/bdf/bdfdrivr.c b/contrib/libs/freetype/src/bdf/bdfdrivr.c
index e02a160930..4b9d6347fa 100644
--- a/contrib/libs/freetype/src/bdf/bdfdrivr.c
+++ b/contrib/libs/freetype/src/bdf/bdfdrivr.c
@@ -780,8 +780,8 @@ THE SOFTWARE.
FT_UInt glyph_index,
FT_Int32 load_flags )
{
- BDF_Face bdf = (BDF_Face)FT_SIZE_FACE( size );
- FT_Face face = FT_FACE( bdf );
+ FT_Face face = size->face;
+ BDF_Face bdf = (BDF_Face)face;
FT_Error error = FT_Err_Ok;
FT_Bitmap* bitmap = &slot->bitmap;
bdf_glyph_t glyph;
diff --git a/contrib/libs/freetype/src/bdf/bdflib.c b/contrib/libs/freetype/src/bdf/bdflib.c
index 0fa7e0a8c5..813a4d839c 100644
--- a/contrib/libs/freetype/src/bdf/bdflib.c
+++ b/contrib/libs/freetype/src/bdf/bdflib.c
@@ -864,15 +864,9 @@
p = font->user_props + font->nuser_props;
- n = ft_strlen( name ) + 1;
- if ( n > FT_LONG_MAX )
- return FT_THROW( Invalid_Argument );
-
- if ( FT_QALLOC( p->name, n ) )
+ if ( FT_STRDUP( p->name, name ) )
goto Exit;
- FT_MEM_COPY( (char *)p->name, name, n );
-
p->format = format;
p->builtin = 0;
p->value.atom = NULL; /* nothing is ever stored here */
@@ -1442,11 +1436,9 @@
goto Exit;
}
- if ( FT_QALLOC( p->glyph_name, slen + 1 ) )
+ if ( FT_DUP( p->glyph_name, s, slen + 1 ) )
goto Exit;
- FT_MEM_COPY( p->glyph_name, s, slen + 1 );
-
p->flags |= BDF_GLYPH_;
FT_TRACE4(( DBGMSG1, lineno, s ));
@@ -2051,9 +2043,8 @@
/* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */
FT_FREE( p->font->name );
- if ( FT_QALLOC( p->font->name, slen + 1 ) )
+ if ( FT_DUP( p->font->name, s, slen + 1 ) )
goto Exit;
- FT_MEM_COPY( p->font->name, s, slen + 1 );
/* If the font name is an XLFD name, set the spacing to the one in */
/* the font name. If there is no spacing fall back on the default. */
diff --git a/contrib/libs/freetype/src/bzip2/ftbzip2.c b/contrib/libs/freetype/src/bzip2/ftbzip2.c
index e119cf2a62..06359cb352 100644
--- a/contrib/libs/freetype/src/bzip2/ftbzip2.c
+++ b/contrib/libs/freetype/src/bzip2/ftbzip2.c
@@ -8,7 +8,7 @@
* parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2010-2023 by
+ * Copyright (C) 2010-2024 by
* Joel Klinghed.
*
* based on `src/gzip/ftgzip.c'
diff --git a/contrib/libs/freetype/src/cache/ftcache.c b/contrib/libs/freetype/src/cache/ftcache.c
index 1af2e67727..81e0347af9 100644
--- a/contrib/libs/freetype/src/cache/ftcache.c
+++ b/contrib/libs/freetype/src/cache/ftcache.c
@@ -4,7 +4,7 @@
*
* The FreeType Caching sub-system (body only).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cache/ftcbasic.c b/contrib/libs/freetype/src/cache/ftcbasic.c
index 24a56c8d26..7102d3d2d8 100644
--- a/contrib/libs/freetype/src/cache/ftcbasic.c
+++ b/contrib/libs/freetype/src/cache/ftcbasic.c
@@ -4,7 +4,7 @@
*
* The FreeType basic cache interface (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -37,7 +37,7 @@
typedef struct FTC_BasicAttrRec_
{
FTC_ScalerRec scaler;
- FT_UInt load_flags;
+ FT_Int32 load_flags;
} FTC_BasicAttrRec, *FTC_BasicAttrs;
@@ -45,8 +45,9 @@
FT_BOOL( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \
(a)->load_flags == (b)->load_flags )
-#define FTC_BASIC_ATTR_HASH( a ) \
- ( FTC_SCALER_HASH( &(a)->scaler ) + 31 * (a)->load_flags )
+#define FTC_BASIC_ATTR_HASH( a ) \
+ ( FTC_SCALER_HASH( &(a)->scaler ) + \
+ (FT_Offset)( 31 * (a)->load_flags ) )
typedef struct FTC_BasicQueryRec_
@@ -143,10 +144,9 @@
FT_Face face = size->face;
- error = FT_Load_Glyph(
- face,
- gindex,
- (FT_Int)family->attrs.load_flags | FT_LOAD_RENDER );
+ error = FT_Load_Glyph( face,
+ gindex,
+ family->attrs.load_flags | FT_LOAD_RENDER );
if ( !error )
*aface = face;
}
@@ -176,9 +176,7 @@
{
face = size->face;
- error = FT_Load_Glyph( face,
- gindex,
- (FT_Int)family->attrs.load_flags );
+ error = FT_Load_Glyph( face, gindex, family->attrs.load_flags );
if ( !error )
{
if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP ||
@@ -246,7 +244,6 @@
ftc_basic_family_compare, /* FTC_MruNode_CompareFunc node_compare */
ftc_basic_family_init, /* FTC_MruNode_InitFunc node_init */
- NULL, /* FTC_MruNode_ResetFunc node_reset */
NULL /* FTC_MruNode_DoneFunc node_done */
},
@@ -293,40 +290,24 @@
FT_Glyph *aglyph,
FTC_Node *anode )
{
- FTC_BasicQueryRec query;
- FTC_Node node = 0; /* make compiler happy */
FT_Error error;
+ FTC_BasicQueryRec query;
+ FTC_Node node = NULL; /* make compiler happy */
FT_Offset hash;
- /* some argument checks are delayed to `FTC_Cache_Lookup' */
+ /* other argument checks delayed to `FTC_Cache_Lookup' */
if ( !aglyph )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
+ return FT_THROW( Invalid_Argument );
*aglyph = NULL;
if ( anode )
- *anode = NULL;
-
- /*
- * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
- * but public `FT_ImageType->flags' is of type `FT_Int32'.
- *
- * On 16bit systems, higher bits of type->flags cannot be handled.
- */
-#if 0xFFFFFFFFUL > FT_UINT_MAX
- if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
- FT_TRACE1(( "FTC_ImageCache_Lookup:"
- " higher bits in load_flags 0x%lx are dropped\n",
- (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
-#endif
+ *anode = NULL;
query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width;
query.attrs.scaler.height = type->height;
- query.attrs.load_flags = (FT_UInt)type->flags;
+ query.attrs.load_flags = type->flags;
query.attrs.scaler.pixel = 1;
query.attrs.scaler.x_res = 0; /* make compilers happy */
@@ -334,7 +315,7 @@
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
-#if 1 /* inlining is about 50% faster! */
+#ifdef FTC_INLINE /* inlining is about 50% faster! */
FTC_GCACHE_LOOKUP_CMP( cache,
ftc_basic_family_compare,
ftc_gnode_compare,
@@ -359,7 +340,6 @@
}
}
- Exit:
return error;
}
@@ -374,38 +354,35 @@
FT_Glyph *aglyph,
FTC_Node *anode )
{
- FTC_BasicQueryRec query;
- FTC_Node node = 0; /* make compiler happy */
FT_Error error;
+ FTC_BasicQueryRec query;
+ FTC_Node node = NULL; /* make compiler happy */
FT_Offset hash;
- /* some argument checks are delayed to `FTC_Cache_Lookup' */
+ /* other argument checks delayed to `FTC_Cache_Lookup' */
if ( !aglyph || !scaler )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
+ return FT_THROW( Invalid_Argument );
*aglyph = NULL;
if ( anode )
- *anode = NULL;
+ *anode = NULL;
/*
- * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
+ * Internal `FTC_BasicAttr->load_flags' is of type `FT_Int32',
* but public `FT_Face->face_flags' is of type `FT_Long'.
*
* On long > int systems, higher bits of load_flags cannot be handled.
*/
-#if FT_ULONG_MAX > FT_UINT_MAX
- if ( load_flags > FT_UINT_MAX )
+#if FT_ULONG_MAX > 0xFFFFFFFFUL
+ if ( load_flags > 0xFFFFFFFFUL )
FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
" higher bits in load_flags 0x%lx are dropped\n",
- load_flags & ~((FT_ULong)FT_UINT_MAX) ));
+ load_flags & ~0xFFFFFFFFUL ));
#endif
query.attrs.scaler = scaler[0];
- query.attrs.load_flags = (FT_UInt)load_flags;
+ query.attrs.load_flags = (FT_Int32)load_flags;
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
@@ -427,7 +404,6 @@
}
}
- Exit:
return error;
}
@@ -445,7 +421,6 @@
sizeof ( FTC_BasicFamilyRec ),
ftc_basic_family_compare, /* FTC_MruNode_CompareFunc node_compare */
ftc_basic_family_init, /* FTC_MruNode_InitFunc node_init */
- NULL, /* FTC_MruNode_ResetFunc node_reset */
NULL /* FTC_MruNode_DoneFunc node_done */
},
@@ -495,36 +470,22 @@
{
FT_Error error;
FTC_BasicQueryRec query;
- FTC_Node node = 0; /* make compiler happy */
+ FTC_Node node = NULL; /* make compiler happy */
FT_Offset hash;
- if ( anode )
- *anode = NULL;
-
/* other argument checks delayed to `FTC_Cache_Lookup' */
if ( !ansbit )
return FT_THROW( Invalid_Argument );
*ansbit = NULL;
-
- /*
- * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
- * but public `FT_ImageType->flags' is of type `FT_Int32'.
- *
- * On 16bit systems, higher bits of type->flags cannot be handled.
- */
-#if 0xFFFFFFFFUL > FT_UINT_MAX
- if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
- FT_TRACE1(( "FTC_ImageCache_Lookup:"
- " higher bits in load_flags 0x%lx are dropped\n",
- (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
-#endif
+ if ( anode )
+ *anode = NULL;
query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width;
query.attrs.scaler.height = type->height;
- query.attrs.load_flags = (FT_UInt)type->flags;
+ query.attrs.load_flags = type->flags;
query.attrs.scaler.pixel = 1;
query.attrs.scaler.x_res = 0; /* make compilers happy */
@@ -534,7 +495,7 @@
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
gindex / FTC_SBIT_ITEMS_PER_NODE;
-#if 1 /* inlining is about 50% faster! */
+#ifdef FTC_INLINE /* inlining is about 50% faster! */
FTC_GCACHE_LOOKUP_CMP( cache,
ftc_basic_family_compare,
ftc_snode_compare,
@@ -578,34 +539,33 @@
{
FT_Error error;
FTC_BasicQueryRec query;
- FTC_Node node = 0; /* make compiler happy */
+ FTC_Node node = NULL; /* make compiler happy */
FT_Offset hash;
- if ( anode )
- *anode = NULL;
-
/* other argument checks delayed to `FTC_Cache_Lookup' */
if ( !ansbit || !scaler )
- return FT_THROW( Invalid_Argument );
+ return FT_THROW( Invalid_Argument );
*ansbit = NULL;
+ if ( anode )
+ *anode = NULL;
/*
- * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
+ * Internal `FTC_BasicAttr->load_flags' is of type `FT_Int32',
* but public `FT_Face->face_flags' is of type `FT_Long'.
*
* On long > int systems, higher bits of load_flags cannot be handled.
*/
-#if FT_ULONG_MAX > FT_UINT_MAX
- if ( load_flags > FT_UINT_MAX )
+#if FT_ULONG_MAX > 0xFFFFFFFFUL
+ if ( load_flags > 0xFFFFFFFFUL )
FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
" higher bits in load_flags 0x%lx are dropped\n",
- load_flags & ~((FT_ULong)FT_UINT_MAX) ));
+ load_flags & ~0xFFFFFFFFUL ));
#endif
query.attrs.scaler = scaler[0];
- query.attrs.load_flags = (FT_UInt)load_flags;
+ query.attrs.load_flags = (FT_Int32)load_flags;
/* beware, the hash must be the same for all glyph ranges! */
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
diff --git a/contrib/libs/freetype/src/cache/ftccache.c b/contrib/libs/freetype/src/cache/ftccache.c
index e0698557b7..8a3d887f96 100644
--- a/contrib/libs/freetype/src/cache/ftccache.c
+++ b/contrib/libs/freetype/src/cache/ftccache.c
@@ -4,7 +4,7 @@
*
* The FreeType internal cache interface (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -544,7 +544,6 @@
FTC_FaceID face_id )
{
FTC_Manager manager = cache->manager;
- FTC_Node frees = NULL;
FT_UFast count = cache->p;
FT_UFast i;
@@ -557,41 +556,27 @@
for (;;)
{
FTC_Node node = *pnode;
- FT_Bool list_changed = FALSE;
if ( !node )
break;
- if ( cache->clazz.node_remove_faceid( node, face_id,
- cache, &list_changed ) )
+ if ( cache->clazz.node_remove_faceid( node, face_id, cache, NULL ) )
{
- *pnode = node->link;
- node->link = frees;
- frees = node;
+ *pnode = node->link;
+
+ manager->cur_weight -= cache->clazz.node_weight( node, cache );
+ ftc_node_mru_unlink( node, manager );
+
+ cache->clazz.node_free( node, cache );
+
+ cache->slack++;
}
else
pnode = &node->link;
}
}
- /* remove all nodes in the free list */
- while ( frees )
- {
- FTC_Node node;
-
-
- node = frees;
- frees = node->link;
-
- manager->cur_weight -= cache->clazz.node_weight( node, cache );
- ftc_node_mru_unlink( node, manager );
-
- cache->clazz.node_free( node, cache );
-
- cache->slack++;
- }
-
ftc_cache_resize( cache );
}
diff --git a/contrib/libs/freetype/src/cache/ftccache.h b/contrib/libs/freetype/src/cache/ftccache.h
index 850d2554b5..85d321c12c 100644
--- a/contrib/libs/freetype/src/cache/ftccache.h
+++ b/contrib/libs/freetype/src/cache/ftccache.h
@@ -4,7 +4,7 @@
*
* FreeType internal cache interface (specification).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -87,6 +87,10 @@ FT_BEGIN_HEADER
ftc_get_top_node_for_hash( ( cache ), ( hash ) )
#endif
+ FT_LOCAL( void )
+ ftc_node_destroy( FTC_Node node,
+ FTC_Manager manager );
+
/*************************************************************************/
/*************************************************************************/
diff --git a/contrib/libs/freetype/src/cache/ftccback.h b/contrib/libs/freetype/src/cache/ftccback.h
index 5f9db213a8..a1d76baa74 100644
--- a/contrib/libs/freetype/src/cache/ftccback.h
+++ b/contrib/libs/freetype/src/cache/ftccback.h
@@ -4,7 +4,7 @@
*
* Callback functions of the caching sub-system (specification only).
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -19,11 +19,7 @@
#define FTCCBACK_H_
#include <freetype/ftcache.h>
-#include "ftcmru.h"
-#include "ftcimage.h"
-#include "ftcmanag.h"
-#include "ftcglyph.h"
-#include "ftcsbits.h"
+#include "ftccache.h"
FT_BEGIN_HEADER
@@ -81,10 +77,6 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
ftc_cache_done( FTC_Cache cache );
- FT_LOCAL( void )
- ftc_node_destroy( FTC_Node node,
- FTC_Manager manager );
-
FT_END_HEADER
#endif /* FTCCBACK_H_ */
diff --git a/contrib/libs/freetype/src/cache/ftccmap.c b/contrib/libs/freetype/src/cache/ftccmap.c
index 84f22a6675..b5c61e8160 100644
--- a/contrib/libs/freetype/src/cache/ftccmap.c
+++ b/contrib/libs/freetype/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
*
* FreeType CharMap cache (body)
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -264,7 +264,7 @@
hash = FTC_CMAP_HASH( face_id, (FT_UInt)cmap_index, char_code );
-#if 1
+#ifdef FTC_INLINE
FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
node, error );
#else
diff --git a/contrib/libs/freetype/src/cache/ftcerror.h b/contrib/libs/freetype/src/cache/ftcerror.h
index dc1a62013d..daabcc6121 100644
--- a/contrib/libs/freetype/src/cache/ftcerror.h
+++ b/contrib/libs/freetype/src/cache/ftcerror.h
@@ -4,7 +4,7 @@
*
* Caching sub-system error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cache/ftcglyph.c b/contrib/libs/freetype/src/cache/ftcglyph.c
index d344733f37..5e7856378a 100644
--- a/contrib/libs/freetype/src/cache/ftcglyph.c
+++ b/contrib/libs/freetype/src/cache/ftcglyph.c
@@ -4,7 +4,7 @@
*
* FreeType Glyph Image (FT_Glyph) cache (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -180,7 +180,7 @@
query->gindex = gindex;
- FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error );
+ FTC_MRULIST_LOOKUP( &gcache->families, query, query->family, error );
if ( !error )
{
FTC_Family family = query->family;
@@ -193,7 +193,7 @@
error = FTC_Cache_Lookup( FTC_CACHE( gcache ), hash, query, anode );
if ( --family->num_nodes == 0 )
- FTC_FAMILY_FREE( family, cache );
+ FTC_FAMILY_FREE( family, FTC_CACHE( gcache ) );
}
return error;
}
diff --git a/contrib/libs/freetype/src/cache/ftcglyph.h b/contrib/libs/freetype/src/cache/ftcglyph.h
index 0181e98166..b1a96da8ec 100644
--- a/contrib/libs/freetype/src/cache/ftcglyph.h
+++ b/contrib/libs/freetype/src/cache/ftcglyph.h
@@ -4,7 +4,7 @@
*
* FreeType abstract glyph cache (specification).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -65,7 +65,6 @@
* - 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
diff --git a/contrib/libs/freetype/src/cache/ftcimage.c b/contrib/libs/freetype/src/cache/ftcimage.c
index 428e5e1a71..1463064050 100644
--- a/contrib/libs/freetype/src/cache/ftcimage.c
+++ b/contrib/libs/freetype/src/cache/ftcimage.c
@@ -4,7 +4,7 @@
*
* FreeType Image cache (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -34,11 +34,7 @@
FT_Memory memory = cache->memory;
- if ( inode->glyph )
- {
- FT_Done_Glyph( inode->glyph );
- inode->glyph = NULL;
- }
+ FT_Done_Glyph( inode->glyph );
FTC_GNode_Done( FTC_GNODE( inode ), cache );
FT_FREE( inode );
@@ -119,10 +115,9 @@
{
case FT_GLYPH_FORMAT_BITMAP:
{
- FT_BitmapGlyph bitg;
+ FT_BitmapGlyph bitg = (FT_BitmapGlyph)glyph;
- bitg = (FT_BitmapGlyph)glyph;
size = bitg->bitmap.rows * (FT_Offset)FT_ABS( bitg->bitmap.pitch ) +
sizeof ( *bitg );
}
@@ -130,10 +125,9 @@
case FT_GLYPH_FORMAT_OUTLINE:
{
- FT_OutlineGlyph outg;
+ FT_OutlineGlyph outg = (FT_OutlineGlyph)glyph;
- outg = (FT_OutlineGlyph)glyph;
size = (FT_Offset)outg->outline.n_points *
( sizeof ( FT_Vector ) + sizeof ( FT_Byte ) ) +
(FT_Offset)outg->outline.n_contours * sizeof ( FT_Short ) +
diff --git a/contrib/libs/freetype/src/cache/ftcimage.h b/contrib/libs/freetype/src/cache/ftcimage.h
index d2a807f158..a0c4a97259 100644
--- a/contrib/libs/freetype/src/cache/ftcimage.h
+++ b/contrib/libs/freetype/src/cache/ftcimage.h
@@ -4,7 +4,7 @@
*
* FreeType Generic Image cache (specification)
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cache/ftcmanag.c b/contrib/libs/freetype/src/cache/ftcmanag.c
index 94f8469c92..c0a48a53b7 100644
--- a/contrib/libs/freetype/src/cache/ftcmanag.c
+++ b/contrib/libs/freetype/src/cache/ftcmanag.c
@@ -4,7 +4,7 @@
*
* FreeType Cache Manager (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -22,7 +22,6 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/ftsizes.h>
-#include "ftccback.h"
#include "ftcerror.h"
@@ -86,12 +85,10 @@
FT_Pointer data )
{
FTC_SizeNode node = (FTC_SizeNode)ftcnode;
- FT_Size size = node->size;
FT_UNUSED( data );
- if ( size )
- FT_Done_Size( size );
+ FT_Done_Size( node->size );
}
@@ -118,32 +115,21 @@
FT_Pointer ftcscaler,
FT_Pointer ftcmanager )
{
+ FT_Error error;
+ FT_Size size;
FTC_SizeNode node = (FTC_SizeNode)ftcnode;
FTC_Scaler scaler = (FTC_Scaler)ftcscaler;
FTC_Manager manager = (FTC_Manager)ftcmanager;
- node->scaler = scaler[0];
-
- return ftc_scaler_lookup_size( manager, scaler, &node->size );
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- ftc_size_node_reset( FTC_MruNode ftcnode,
- FT_Pointer ftcscaler,
- FT_Pointer ftcmanager )
- {
- FTC_SizeNode node = (FTC_SizeNode)ftcnode;
- FTC_Scaler scaler = (FTC_Scaler)ftcscaler;
- FTC_Manager manager = (FTC_Manager)ftcmanager;
-
-
- FT_Done_Size( node->size );
-
- node->scaler = scaler[0];
+ error = ftc_scaler_lookup_size( manager, scaler, &size );
+ if ( !error )
+ {
+ node->size = size;
+ node->scaler = scaler[0];
+ }
- return ftc_scaler_lookup_size( manager, scaler, &node->size );
+ return error;
}
@@ -154,7 +140,6 @@
ftc_size_node_compare, /* FTC_MruNode_CompareFunc node_compare */
ftc_size_node_init, /* FTC_MruNode_InitFunc node_init */
- ftc_size_node_reset, /* FTC_MruNode_ResetFunc node_reset */
ftc_size_node_done /* FTC_MruNode_DoneFunc node_done */
};
@@ -231,23 +216,25 @@
FT_Pointer ftcface_id,
FT_Pointer ftcmanager )
{
+ FT_Error error;
+ FT_Face face;
FTC_FaceNode node = (FTC_FaceNode)ftcnode;
FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
FTC_Manager manager = (FTC_Manager)ftcmanager;
- FT_Error error;
-
- node->face_id = face_id;
error = manager->request_face( face_id,
manager->library,
manager->request_data,
- &node->face );
+ &face );
if ( !error )
{
/* destroy initial size object; it will be re-created later */
- if ( node->face->size )
- FT_Done_Size( node->face->size );
+ if ( face->size )
+ FT_Done_Size( face->size );
+
+ node->face = face;
+ node->face_id = face_id;
}
return error;
@@ -294,7 +281,6 @@
ftc_face_node_compare, /* FTC_MruNode_CompareFunc node_compare */
ftc_face_node_init, /* FTC_MruNode_InitFunc node_init */
- NULL, /* FTC_MruNode_ResetFunc node_reset */
ftc_face_node_done /* FTC_MruNode_DoneFunc node_done */
};
@@ -435,18 +421,13 @@
{
cache->clazz.cache_done( cache );
FT_FREE( cache );
- manager->caches[idx] = NULL;
}
}
- manager->num_caches = 0;
/* discard faces and sizes */
FTC_MruList_Done( &manager->sizes );
FTC_MruList_Done( &manager->faces );
- manager->library = NULL;
- manager->memory = NULL;
-
FT_FREE( manager );
}
diff --git a/contrib/libs/freetype/src/cache/ftcmanag.h b/contrib/libs/freetype/src/cache/ftcmanag.h
index 5b30929c9a..bd158f5ffb 100644
--- a/contrib/libs/freetype/src/cache/ftcmanag.h
+++ b/contrib/libs/freetype/src/cache/ftcmanag.h
@@ -4,7 +4,7 @@
*
* FreeType Cache Manager (specification).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cache/ftcmru.c b/contrib/libs/freetype/src/cache/ftcmru.c
index ad10a06bc4..f908eb25a6 100644
--- a/contrib/libs/freetype/src/cache/ftcmru.c
+++ b/contrib/libs/freetype/src/cache/ftcmru.c
@@ -4,7 +4,7 @@
*
* FreeType MRU support (body).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -238,52 +238,43 @@
{
FT_Error error;
FTC_MruNode node = NULL;
+ FTC_MruNode prev = NULL;
FT_Memory memory = list->memory;
- if ( list->num_nodes >= list->max_nodes && list->max_nodes > 0 )
- {
- node = list->nodes->prev;
-
- FT_ASSERT( node );
-
- if ( list->clazz.node_reset )
- {
- FTC_MruNode_Up( &list->nodes, node );
-
- error = list->clazz.node_reset( node, key, list->data );
- if ( !error )
- goto Exit;
- }
-
- FTC_MruNode_Remove( &list->nodes, node );
- list->num_nodes--;
-
- if ( list->clazz.node_done )
- list->clazz.node_done( node, list->data );
- }
-
/* zero new node in case of node_init failure */
- else if ( FT_ALLOC( node, list->clazz.node_size ) )
+ if ( FT_ALLOC( node, list->clazz.node_size ) )
goto Exit;
error = list->clazz.node_init( node, key, list->data );
if ( error )
- goto Fail;
+ {
+ prev = node;
+ node = NULL;
+
+ goto Clean;
+ }
+ else if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes )
+ prev = list->nodes->prev;
FTC_MruNode_Prepend( &list->nodes, node );
list->num_nodes++;
- Exit:
- *anode = node;
- return error;
+ if ( !prev )
+ goto Exit;
- Fail:
+ FTC_MruNode_Remove( &list->nodes, prev );
+ list->num_nodes--;
+
+ Clean:
if ( list->clazz.node_done )
- list->clazz.node_done( node, list->data );
+ list->clazz.node_done( prev, list->data );
- FT_FREE( node );
- goto Exit;
+ FT_FREE( prev );
+
+ Exit:
+ *anode = node;
+ return error;
}
@@ -309,18 +300,16 @@
FTC_MruList_Remove( FTC_MruList list,
FTC_MruNode node )
{
- FTC_MruNode_Remove( &list->nodes, node );
- list->num_nodes--;
+ FT_Memory memory = list->memory;
- {
- FT_Memory memory = list->memory;
+ FTC_MruNode_Remove( &list->nodes, node );
+ list->num_nodes--;
- if ( list->clazz.node_done )
- list->clazz.node_done( node, list->data );
+ if ( list->clazz.node_done )
+ list->clazz.node_done( node, list->data );
- FT_FREE( node );
- }
+ FT_FREE( node );
}
diff --git a/contrib/libs/freetype/src/cache/ftcmru.h b/contrib/libs/freetype/src/cache/ftcmru.h
index 45e5249ca4..68faab9847 100644
--- a/contrib/libs/freetype/src/cache/ftcmru.h
+++ b/contrib/libs/freetype/src/cache/ftcmru.h
@@ -4,7 +4,7 @@
*
* Simple MRU list-cache (specification).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -95,11 +95,6 @@ FT_BEGIN_HEADER
FT_Pointer key,
FT_Pointer data );
- typedef FT_Error
- (*FTC_MruNode_ResetFunc)( FTC_MruNode node,
- FT_Pointer key,
- FT_Pointer data );
-
typedef void
(*FTC_MruNode_DoneFunc)( FTC_MruNode node,
FT_Pointer data );
@@ -111,7 +106,6 @@ FT_BEGIN_HEADER
FTC_MruNode_CompareFunc node_compare;
FTC_MruNode_InitFunc node_init;
- FTC_MruNode_ResetFunc node_reset;
FTC_MruNode_DoneFunc node_done;
} FTC_MruListClassRec;
diff --git a/contrib/libs/freetype/src/cache/ftcsbits.c b/contrib/libs/freetype/src/cache/ftcsbits.c
index 9929a0bcc3..19f3ef04d6 100644
--- a/contrib/libs/freetype/src/cache/ftcsbits.c
+++ b/contrib/libs/freetype/src/cache/ftcsbits.c
@@ -4,7 +4,7 @@
*
* FreeType sbits manager (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -53,8 +53,7 @@
size = (FT_ULong)pitch * bitmap->rows;
- if ( !FT_QALLOC( sbit->buffer, size ) )
- FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );
+ FT_MEM_DUP( sbit->buffer, bitmap->buffer, size );
return error;
}
diff --git a/contrib/libs/freetype/src/cache/ftcsbits.h b/contrib/libs/freetype/src/cache/ftcsbits.h
index e833cb5c30..d7c4a36475 100644
--- a/contrib/libs/freetype/src/cache/ftcsbits.h
+++ b/contrib/libs/freetype/src/cache/ftcsbits.h
@@ -4,7 +4,7 @@
*
* A small-bitmap cache (specification).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cff.c b/contrib/libs/freetype/src/cff/cff.c
index b486c389e1..e3e009699d 100644
--- a/contrib/libs/freetype/src/cff/cff.c
+++ b/contrib/libs/freetype/src/cff/cff.c
@@ -4,7 +4,7 @@
*
* FreeType OpenType driver component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffcmap.c b/contrib/libs/freetype/src/cff/cffcmap.c
index 10d287bc81..ea5f8ed288 100644
--- a/contrib/libs/freetype/src/cff/cffcmap.c
+++ b/contrib/libs/freetype/src/cff/cffcmap.c
@@ -4,7 +4,7 @@
*
* CFF character mapping table (cmap) support (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffcmap.h b/contrib/libs/freetype/src/cff/cffcmap.h
index b2afc2fab6..1dd8700cd8 100644
--- a/contrib/libs/freetype/src/cff/cffcmap.h
+++ b/contrib/libs/freetype/src/cff/cffcmap.h
@@ -4,7 +4,7 @@
*
* CFF character mapping table (cmap) support (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffdrivr.c b/contrib/libs/freetype/src/cff/cffdrivr.c
index 9898d625ca..f6ebdb3810 100644
--- a/contrib/libs/freetype/src/cff/cffdrivr.c
+++ b/contrib/libs/freetype/src/cff/cffdrivr.c
@@ -4,7 +4,7 @@
*
* OpenType font driver implementation (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffdrivr.h b/contrib/libs/freetype/src/cff/cffdrivr.h
index ab1f147bb2..fd5bc37ecd 100644
--- a/contrib/libs/freetype/src/cff/cffdrivr.h
+++ b/contrib/libs/freetype/src/cff/cffdrivr.h
@@ -4,7 +4,7 @@
*
* High-level OpenType driver interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cfferrs.h b/contrib/libs/freetype/src/cff/cfferrs.h
index bc9a3043fc..128adc3b71 100644
--- a/contrib/libs/freetype/src/cff/cfferrs.h
+++ b/contrib/libs/freetype/src/cff/cfferrs.h
@@ -4,7 +4,7 @@
*
* CFF error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffgload.c b/contrib/libs/freetype/src/cff/cffgload.c
index c483d1d1a5..cbb071abdf 100644
--- a/contrib/libs/freetype/src/cff/cffgload.c
+++ b/contrib/libs/freetype/src/cff/cffgload.c
@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffgload.h b/contrib/libs/freetype/src/cff/cffgload.h
index 3b8cf236dd..346d4b11c3 100644
--- a/contrib/libs/freetype/src/cff/cffgload.h
+++ b/contrib/libs/freetype/src/cff/cffgload.h
@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffload.c b/contrib/libs/freetype/src/cff/cffload.c
index af79082e98..979fd45f6c 100644
--- a/contrib/libs/freetype/src/cff/cffload.c
+++ b/contrib/libs/freetype/src/cff/cffload.c
@@ -4,7 +4,7 @@
*
* OpenType and CFF data/program tables loader (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -1202,17 +1202,21 @@
{
CFF_AxisCoords* axis = &region->axisList[j];
- FT_Int16 start14, peak14, end14;
+ FT_Int start, peak, end;
- if ( FT_READ_SHORT( start14 ) ||
- FT_READ_SHORT( peak14 ) ||
- FT_READ_SHORT( end14 ) )
+ if ( FT_READ_SHORT( start ) ||
+ FT_READ_SHORT( peak ) ||
+ FT_READ_SHORT( end ) )
goto Exit;
- axis->startCoord = FT_fdot14ToFixed( start14 );
- axis->peakCoord = FT_fdot14ToFixed( peak14 );
- axis->endCoord = FT_fdot14ToFixed( end14 );
+ /* immediately tag invalid ranges with special peak = 0 */
+ if ( ( start < 0 && end > 0 ) || start > peak || peak > end )
+ peak = 0;
+
+ axis->startCoord = FT_fdot14ToFixed( start );
+ axis->peakCoord = FT_fdot14ToFixed( peak );
+ axis->endCoord = FT_fdot14ToFixed( end );
}
}
@@ -1379,10 +1383,10 @@
/* opcode in both CFF and CFF2 DICTs. See `cff_parse_num' for */
/* decode of this, which rounds to an integer. */
*subFont->blend_top++ = 255;
- *subFont->blend_top++ = (FT_Byte)( sum >> 24 );
- *subFont->blend_top++ = (FT_Byte)( sum >> 16 );
- *subFont->blend_top++ = (FT_Byte)( sum >> 8 );
- *subFont->blend_top++ = (FT_Byte)sum;
+ *subFont->blend_top++ = (FT_Byte)( (FT_UInt32)sum >> 24 );
+ *subFont->blend_top++ = (FT_Byte)( (FT_UInt32)sum >> 16 );
+ *subFont->blend_top++ = (FT_Byte)( (FT_UInt32)sum >> 8 );
+ *subFont->blend_top++ = (FT_Byte)( (FT_UInt32)sum );
}
/* leave only numBlends results on parser stack */
@@ -1495,44 +1499,31 @@
for ( j = 0; j < lenNDV; j++ )
{
CFF_AxisCoords* axis = &varRegion->axisList[j];
- 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;
- else if ( axis->startCoord < 0 &&
- axis->endCoord > 0 &&
- axis->peakCoord != 0 )
- axisScalar = FT_FIXED_ONE;
- /* peak of 0 means ignore this axis */
- else if ( axis->peakCoord == 0 )
- axisScalar = FT_FIXED_ONE;
+ /* compute the scalar contribution of this axis */
+ /* with peak of 0 used for invalid axes */
+ if ( axis->peakCoord == NDV[j] ||
+ axis->peakCoord == 0 )
+ continue;
/* ignore this region if coords are out of range */
- else if ( NDV[j] < axis->startCoord ||
- NDV[j] > axis->endCoord )
- axisScalar = 0;
-
- /* calculate a proportional factor */
- else
+ else if ( NDV[j] <= axis->startCoord ||
+ NDV[j] >= axis->endCoord )
{
- if ( NDV[j] == axis->peakCoord )
- axisScalar = FT_FIXED_ONE;
- else if ( NDV[j] < axis->peakCoord )
- axisScalar = FT_DivFix( NDV[j] - axis->startCoord,
- axis->peakCoord - axis->startCoord );
- else
- axisScalar = FT_DivFix( axis->endCoord - NDV[j],
- axis->endCoord - axis->peakCoord );
+ blend->BV[master] = 0;
+ break;
}
- /* take product of all the axis scalars */
- blend->BV[master] = FT_MulFix( blend->BV[master], axisScalar );
+ /* adjust proportionally */
+ else if ( NDV[j] < axis->peakCoord )
+ blend->BV[master] = FT_MulDiv( blend->BV[master],
+ NDV[j] - axis->startCoord,
+ axis->peakCoord - axis->startCoord );
+ else /* NDV[j] > axis->peakCoord ) */
+ blend->BV[master] = FT_MulDiv( blend->BV[master],
+ axis->endCoord - NDV[j],
+ axis->endCoord - axis->peakCoord );
}
FT_TRACE4(( ", %f ",
diff --git a/contrib/libs/freetype/src/cff/cffload.h b/contrib/libs/freetype/src/cff/cffload.h
index b5286b0c8c..0220924542 100644
--- a/contrib/libs/freetype/src/cff/cffload.h
+++ b/contrib/libs/freetype/src/cff/cffload.h
@@ -4,7 +4,7 @@
*
* OpenType & CFF data/program tables loader (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffobjs.c b/contrib/libs/freetype/src/cff/cffobjs.c
index 6d08620c48..7c6713739a 100644
--- a/contrib/libs/freetype/src/cff/cffobjs.c
+++ b/contrib/libs/freetype/src/cff/cffobjs.c
@@ -4,7 +4,7 @@
*
* OpenType objects manager (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -42,6 +42,8 @@
#include <freetype/internal/psaux.h>
#include <freetype/internal/services/svcfftl.h>
+#define CFF_fixedToInt( x ) \
+ ( (FT_Short)( ( (x) + 0x8000U ) >> 16 ) )
/**************************************************************************
*
@@ -124,19 +126,20 @@
count = priv->num_blue_values = cpriv->num_blue_values;
for ( n = 0; n < count; n++ )
- priv->blue_values[n] = (FT_Short)cpriv->blue_values[n];
+ priv->blue_values[n] = CFF_fixedToInt( cpriv->blue_values[n] );
count = priv->num_other_blues = cpriv->num_other_blues;
for ( n = 0; n < count; n++ )
- priv->other_blues[n] = (FT_Short)cpriv->other_blues[n];
+ priv->other_blues[n] = CFF_fixedToInt( cpriv->other_blues[n] );
count = priv->num_family_blues = cpriv->num_family_blues;
for ( n = 0; n < count; n++ )
- priv->family_blues[n] = (FT_Short)cpriv->family_blues[n];
+ priv->family_blues[n] = CFF_fixedToInt( cpriv->family_blues[n] );
count = priv->num_family_other_blues = cpriv->num_family_other_blues;
for ( n = 0; n < count; n++ )
- priv->family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];
+ priv->family_other_blues[n] =
+ CFF_fixedToInt( cpriv->family_other_blues[n] );
priv->blue_scale = cpriv->blue_scale;
priv->blue_shift = (FT_Int)cpriv->blue_shift;
@@ -421,32 +424,23 @@
static void
remove_subset_prefix( FT_String* name )
{
- FT_Int32 idx = 0;
- FT_Int32 length = (FT_Int32)ft_strlen( name ) + 1;
- FT_Bool continue_search = 1;
+ FT_UInt32 i = 0, idx = 0;
- while ( continue_search )
+ /* six ASCII uppercase letters followed by a plus sign */
+ while ( 'A' <= name[i] && name[i++] <= 'Z' &&
+ 'A' <= name[i] && name[i++] <= 'Z' &&
+ 'A' <= name[i] && name[i++] <= 'Z' &&
+ 'A' <= name[i] && name[i++] <= 'Z' &&
+ 'A' <= name[i] && name[i++] <= 'Z' &&
+ 'A' <= name[i] && name[i++] <= 'Z' &&
+ name[i++] == '+' )
{
- if ( length >= 7 && name[6] == '+' )
- {
- for ( idx = 0; idx < 6; idx++ )
- {
- /* ASCII uppercase letters */
- if ( !( 'A' <= name[idx] && name[idx] <= 'Z' ) )
- continue_search = 0;
- }
-
- if ( continue_search )
- {
- for ( idx = 7; idx < length; idx++ )
- name[idx - 7] = name[idx];
- length -= 7;
- }
- }
- else
- continue_search = 0;
+ idx = i;
}
+
+ if ( idx )
+ FT_MEM_MOVE( name, name + idx, ft_strlen( name + idx ) + 1 );
}
@@ -456,42 +450,20 @@
remove_style( FT_String* family_name,
const FT_String* style_name )
{
- FT_Int32 family_name_length, style_name_length;
+ FT_String* f = family_name + ft_strlen( family_name );
+ const FT_String* s = style_name + ft_strlen( style_name );
- family_name_length = (FT_Int32)ft_strlen( family_name );
- style_name_length = (FT_Int32)ft_strlen( style_name );
+ /* compare strings moving backwards */
+ while ( s > style_name )
+ if ( f == family_name || *--s != *--f )
+ return;
- if ( family_name_length > style_name_length )
- {
- FT_Int idx;
-
-
- for ( idx = 1; idx <= style_name_length; idx++ )
- {
- if ( family_name[family_name_length - idx] !=
- style_name[style_name_length - idx] )
- break;
- }
-
- if ( idx > style_name_length )
- {
- /* family_name ends with style_name; remove it */
- idx = family_name_length - style_name_length - 1;
-
- /* also remove special characters */
- /* between real family name and style */
- while ( idx > 0 &&
- ( family_name[idx] == '-' ||
- family_name[idx] == ' ' ||
- family_name[idx] == '_' ||
- family_name[idx] == '+' ) )
- idx--;
-
- if ( idx > 0 )
- family_name[idx + 1] = '\0';
- }
- }
+ /* terminate and remove special characters */
+ do
+ *f = '\0';
+ while ( f-- > family_name &&
+ ( *f == '-' || *f == ' ' || *f == '_' || *f == '+' ) );
}
@@ -722,8 +694,7 @@
FT_UInt instance_index = (FT_UInt)face_index >> 16;
- if ( FT_HAS_MULTIPLE_MASTERS( cffface ) &&
- instance_index > 0 )
+ if ( FT_HAS_MULTIPLE_MASTERS( cffface ) )
{
error = FT_Set_Named_Instance( cffface, instance_index );
if ( error )
diff --git a/contrib/libs/freetype/src/cff/cffobjs.h b/contrib/libs/freetype/src/cff/cffobjs.h
index 8f05f6132b..91ad83b1cd 100644
--- a/contrib/libs/freetype/src/cff/cffobjs.h
+++ b/contrib/libs/freetype/src/cff/cffobjs.h
@@ -4,7 +4,7 @@
*
* OpenType objects manager (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cff/cffparse.c b/contrib/libs/freetype/src/cff/cffparse.c
index 3b076704cf..92a69c3b51 100644
--- a/contrib/libs/freetype/src/cff/cffparse.c
+++ b/contrib/libs/freetype/src/cff/cffparse.c
@@ -4,7 +4,7 @@
*
* CFF token stream parser (body)
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -501,10 +501,10 @@
return cff_parse_real( *d, parser->limit, scaling, NULL );
else if ( **d == 255 )
{
- FT_Fixed val = ( ( ( (FT_UInt32)*( d[0] + 1 ) << 24 ) |
- ( (FT_UInt32)*( d[0] + 2 ) << 16 ) |
- ( (FT_UInt32)*( d[0] + 3 ) << 8 ) |
- (FT_UInt32)*( d[0] + 4 ) ) );
+ FT_Fixed val = (FT_Int32)( ( ( (FT_UInt32)*( d[0] + 1 ) << 24 ) |
+ ( (FT_UInt32)*( d[0] + 2 ) << 16 ) |
+ ( (FT_UInt32)*( d[0] + 3 ) << 8 ) |
+ (FT_UInt32)*( d[0] + 4 ) ) );
if ( scaling )
{
@@ -1031,10 +1031,14 @@
CFF_FIELD( code, name, id, cff_kind_string )
#define CFF_FIELD_BOOL( code, name, id ) \
CFF_FIELD( code, name, id, cff_kind_bool )
+#define CFF_FIELD_DELTA( code, name, max, id ) \
+ CFF_FIELD_DELTA_KIND( code, name, max, id, cff_kind_delta )
+#define CFF_FIELD_DELTA_FIXED( code, name, max, id ) \
+ CFF_FIELD_DELTA_KIND( code, name, max, id, cff_kind_delta_fixed )
#undef CFF_FIELD
-#undef CFF_FIELD_DELTA
+#undef CFF_FIELD_DELTA_KIND
#ifndef FT_DEBUG_LEVEL_TRACE
@@ -1064,18 +1068,18 @@
code | CFFCODE, \
FT_FIELD_OFFSET( name ), \
FT_FIELD_SIZE( name ), \
- 0, 0, 0 \
+ NULL, 0, 0 \
},
-#define CFF_FIELD_DELTA( code, name, max, id ) \
- { \
- cff_kind_delta, \
- code | CFFCODE, \
- FT_FIELD_OFFSET( name ), \
- FT_FIELD_SIZE_DELTA( name ), \
- 0, \
- max, \
- FT_FIELD_OFFSET( num_ ## name ) \
+#define CFF_FIELD_DELTA_KIND( code, name, max, id, kind ) \
+ { \
+ kind, \
+ code | CFFCODE, \
+ FT_FIELD_OFFSET( name ), \
+ FT_FIELD_SIZE_DELTA( name ), \
+ NULL, \
+ max, \
+ FT_FIELD_OFFSET( num_ ## name ) \
},
static const CFF_Field_Handler cff_field_handlers[] =
@@ -1083,7 +1087,7 @@
#include "cfftoken.h"
- { 0, 0, 0, 0, 0, 0, 0 }
+ { 0, 0, 0, 0, NULL, 0, 0 }
};
@@ -1117,20 +1121,20 @@
code | CFFCODE, \
FT_FIELD_OFFSET( name ), \
FT_FIELD_SIZE( name ), \
- 0, 0, 0, \
+ NULL, 0, 0, \
id \
},
-#define CFF_FIELD_DELTA( code, name, max, id ) \
- { \
- cff_kind_delta, \
- code | CFFCODE, \
- FT_FIELD_OFFSET( name ), \
- FT_FIELD_SIZE_DELTA( name ), \
- 0, \
- max, \
- FT_FIELD_OFFSET( num_ ## name ), \
- id \
+#define CFF_FIELD_DELTA_KIND( code, name, max, id, kind ) \
+ { \
+ kind, \
+ code | CFFCODE, \
+ FT_FIELD_OFFSET( name ), \
+ FT_FIELD_SIZE_DELTA( name ), \
+ NULL, \
+ max, \
+ FT_FIELD_OFFSET( num_ ## name ), \
+ id \
},
static const CFF_Field_Handler cff_field_handlers[] =
@@ -1138,7 +1142,7 @@
#include "cfftoken.h"
- { 0, 0, 0, 0, 0, 0, 0, 0 }
+ { 0, 0, 0, 0, NULL, 0, 0, NULL }
};
@@ -1356,7 +1360,8 @@
/* check that we have enough arguments -- except for */
/* delta encoded arrays, which can be empty */
- if ( field->kind != cff_kind_delta && num_args < 1 )
+ if ( field->kind != cff_kind_delta &&
+ field->kind != cff_kind_delta_fixed && num_args < 1 )
goto Stack_Underflow;
switch ( field->kind )
@@ -1471,6 +1476,38 @@
}
break;
+ case cff_kind_delta_fixed:
+ {
+ FT_Byte* qcount = (FT_Byte*)parser->object +
+ field->count_offset;
+
+ FT_Byte** data = parser->stack;
+
+
+ if ( num_args > field->array_max )
+ num_args = field->array_max;
+
+ FT_TRACE4(( " [" ));
+
+ /* store count */
+ *qcount = (FT_Byte)num_args;
+
+ val = 0;
+ while ( num_args > 0 )
+ {
+ val = ADD_LONG( val, cff_parse_fixed( parser, data++ ) );
+ *(FT_Long*)q = val;
+
+ FT_TRACE4(( " %f\n", (double)val / 65536 ));
+
+ q += field->size;
+ num_args--;
+ }
+
+ FT_TRACE4(( "]\n" ));
+ }
+ break;
+
default: /* callback or blend */
error = field->reader( parser );
if ( error )
diff --git a/contrib/libs/freetype/src/cff/cffparse.h b/contrib/libs/freetype/src/cff/cffparse.h
index 418caacc68..ca6b18af6a 100644
--- a/contrib/libs/freetype/src/cff/cffparse.h
+++ b/contrib/libs/freetype/src/cff/cffparse.h
@@ -4,7 +4,7 @@
*
* CFF token stream parser (specification)
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -107,6 +107,7 @@ FT_BEGIN_HEADER
cff_kind_string,
cff_kind_bool,
cff_kind_delta,
+ cff_kind_delta_fixed,
cff_kind_callback,
cff_kind_blend,
diff --git a/contrib/libs/freetype/src/cff/cfftoken.h b/contrib/libs/freetype/src/cff/cfftoken.h
index b61cb0e66e..da45faa7f4 100644
--- a/contrib/libs/freetype/src/cff/cfftoken.h
+++ b/contrib/libs/freetype/src/cff/cfftoken.h
@@ -4,7 +4,7 @@
*
* CFF token definitions (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -80,26 +80,26 @@
#undef CFFCODE
#define CFFCODE CFF_CODE_PRIVATE
- CFF_FIELD_DELTA ( 6, blue_values, 14, "BlueValues" )
- CFF_FIELD_DELTA ( 7, other_blues, 10, "OtherBlues" )
- CFF_FIELD_DELTA ( 8, family_blues, 14, "FamilyBlues" )
- CFF_FIELD_DELTA ( 9, family_other_blues, 10, "FamilyOtherBlues" )
- CFF_FIELD_FIXED_1000( 0x109, blue_scale, "BlueScale" )
- CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
- CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
- CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
- CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
- CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
- CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
- CFF_FIELD_BOOL ( 0x10E, force_bold, "ForceBold" )
- CFF_FIELD_FIXED ( 0x10F, force_bold_threshold, "ForceBoldThreshold" )
- CFF_FIELD_NUM ( 0x110, lenIV, "lenIV" )
- CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
- CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
- CFF_FIELD_NUM ( 0x113, initial_random_seed, "initialRandomSeed" )
- CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
- CFF_FIELD_NUM ( 20, default_width, "defaultWidthX" )
- CFF_FIELD_NUM ( 21, nominal_width, "nominalWidthX" )
+ CFF_FIELD_DELTA_FIXED( 6, blue_values, 14, "BlueValues" )
+ CFF_FIELD_DELTA_FIXED( 7, other_blues, 10, "OtherBlues" )
+ CFF_FIELD_DELTA_FIXED( 8, family_blues, 14, "FamilyBlues" )
+ CFF_FIELD_DELTA_FIXED( 9, family_other_blues, 10, "FamilyOtherBlues" )
+ CFF_FIELD_FIXED_1000 ( 0x109, blue_scale, "BlueScale" )
+ CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
+ CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
+ CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
+ CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
+ CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
+ CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
+ CFF_FIELD_BOOL ( 0x10E, force_bold, "ForceBold" )
+ CFF_FIELD_FIXED ( 0x10F, force_bold_threshold, "ForceBoldThreshold" )
+ CFF_FIELD_NUM ( 0x110, lenIV, "lenIV" )
+ CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
+ CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
+ CFF_FIELD_NUM ( 0x113, initial_random_seed, "initialRandomSeed" )
+ CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
+ CFF_FIELD_NUM ( 20, default_width, "defaultWidthX" )
+ CFF_FIELD_NUM ( 21, nominal_width, "nominalWidthX" )
#undef FT_STRUCTURE
@@ -129,22 +129,22 @@
#undef CFFCODE
#define CFFCODE CFF2_CODE_PRIVATE
- CFF_FIELD_DELTA ( 6, blue_values, 14, "BlueValues" )
- CFF_FIELD_DELTA ( 7, other_blues, 10, "OtherBlues" )
- CFF_FIELD_DELTA ( 8, family_blues, 14, "FamilyBlues" )
- CFF_FIELD_DELTA ( 9, family_other_blues, 10, "FamilyOtherBlues" )
- CFF_FIELD_FIXED_1000( 0x109, blue_scale, "BlueScale" )
- CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
- CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
- CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
- CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
- CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
- CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
- CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
- CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
- CFF_FIELD_CALLBACK ( 22, vsindex, "vsindex" )
- CFF_FIELD_BLEND ( 23, "blend" )
- CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
+ CFF_FIELD_DELTA_FIXED( 6, blue_values, 14, "BlueValues" )
+ CFF_FIELD_DELTA_FIXED( 7, other_blues, 10, "OtherBlues" )
+ CFF_FIELD_DELTA_FIXED( 8, family_blues, 14, "FamilyBlues" )
+ CFF_FIELD_DELTA_FIXED( 9, family_other_blues, 10, "FamilyOtherBlues" )
+ CFF_FIELD_FIXED_1000 ( 0x109, blue_scale, "BlueScale" )
+ CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
+ CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
+ CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
+ CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
+ CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
+ CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
+ CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
+ CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
+ CFF_FIELD_CALLBACK ( 22, vsindex, "vsindex" )
+ CFF_FIELD_BLEND ( 23, "blend" )
+ CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
/* END */
diff --git a/contrib/libs/freetype/src/cid/ciderrs.h b/contrib/libs/freetype/src/cid/ciderrs.h
index 40a1097d0a..c439a8c4a0 100644
--- a/contrib/libs/freetype/src/cid/ciderrs.h
+++ b/contrib/libs/freetype/src/cid/ciderrs.h
@@ -4,7 +4,7 @@
*
* CID error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidgload.c b/contrib/libs/freetype/src/cid/cidgload.c
index eaca765ad0..7b571322d4 100644
--- a/contrib/libs/freetype/src/cid/cidgload.c
+++ b/contrib/libs/freetype/src/cid/cidgload.c
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 Glyph Loader (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidgload.h b/contrib/libs/freetype/src/cid/cidgload.h
index edd6229234..9fdc9db589 100644
--- a/contrib/libs/freetype/src/cid/cidgload.h
+++ b/contrib/libs/freetype/src/cid/cidgload.h
@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidload.c b/contrib/libs/freetype/src/cid/cidload.c
index a7da8ea39d..722f5a34dd 100644
--- a/contrib/libs/freetype/src/cid/cidload.c
+++ b/contrib/libs/freetype/src/cid/cidload.c
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 font loader (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -388,7 +388,7 @@
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 }
+ T1_FIELD_ZERO
};
@@ -469,36 +469,23 @@
T1_Field keyword = (T1_Field)cid_field_records;
- for (;;)
+ while ( keyword->len )
{
- FT_Byte* name;
+ FT_Byte* name = (FT_Byte*)keyword->ident;
- name = (FT_Byte*)keyword->ident;
- if ( !name )
- break;
-
- if ( cur[0] == name[0] &&
- len == ft_strlen( (const char*)name ) )
+ if ( keyword->len == len &&
+ ft_memcmp( cur, name, len ) == 0 )
{
- FT_UInt n;
-
-
- for ( n = 1; n < len; n++ )
- if ( cur[n] != name[n] )
- break;
-
- if ( n >= len )
- {
- /* we found it - run the parsing callback */
- parser->root.error = cid_load_keyword( face,
- loader,
- keyword );
- if ( parser->root.error )
- return parser->root.error;
- break;
- }
+ /* we found it - run the parsing callback */
+ parser->root.error = cid_load_keyword( face,
+ loader,
+ keyword );
+ if ( parser->root.error )
+ return parser->root.error;
+ break;
}
+
keyword++;
}
}
diff --git a/contrib/libs/freetype/src/cid/cidload.h b/contrib/libs/freetype/src/cid/cidload.h
index d12d2962a6..7f030b32df 100644
--- a/contrib/libs/freetype/src/cid/cidload.h
+++ b/contrib/libs/freetype/src/cid/cidload.h
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 font loader (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidobjs.c b/contrib/libs/freetype/src/cid/cidobjs.c
index f698a41928..8d337c4112 100644
--- a/contrib/libs/freetype/src/cid/cidobjs.c
+++ b/contrib/libs/freetype/src/cid/cidobjs.c
@@ -4,7 +4,7 @@
*
* CID objects manager (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidobjs.h b/contrib/libs/freetype/src/cid/cidobjs.h
index 83c0c61c3c..d371cbe995 100644
--- a/contrib/libs/freetype/src/cid/cidobjs.h
+++ b/contrib/libs/freetype/src/cid/cidobjs.h
@@ -4,7 +4,7 @@
*
* CID objects manager (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidparse.c b/contrib/libs/freetype/src/cid/cidparse.c
index 171a886215..73a3ade893 100644
--- a/contrib/libs/freetype/src/cid/cidparse.c
+++ b/contrib/libs/freetype/src/cid/cidparse.c
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 parser (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -90,10 +90,15 @@
if ( error )
goto Exit;
- Again:
- /* now, read the rest of the file until we find */
- /* `StartData' or `/sfnts' */
+ if ( !stream->read ) {
+ /* just parse memory-based streams */
+ offset = stream->size;
+ }
+ else
{
+ /* Find the last `StartData` or `/sfnts`. The parser requires */
+ /* contiguous memory; attempt to pin as little as necessary. */
+
/*
* The algorithm is as follows (omitting the case with less than 256
* bytes to fill for simplicity).
@@ -119,7 +124,8 @@
FT_Byte* p = buffer;
- for ( offset = FT_STREAM_POS(); ; offset += 256 )
+ offset = 0;
+ while ( 1 )
{
FT_ULong stream_len;
@@ -127,7 +133,7 @@
stream_len = stream->size - FT_STREAM_POS();
read_len = FT_MIN( read_len, stream_len );
- if ( FT_STREAM_READ( p, read_len ) )
+ if ( read_len && FT_STREAM_READ( p, read_len ) )
goto Exit;
/* ensure that we do not compare with data beyond the buffer */
@@ -141,20 +147,23 @@
ft_strncmp( (char*)p, STARTDATA, STARTDATA_LEN ) == 0 )
{
/* save offset of binary data after `StartData' */
- offset += (FT_ULong)( p - buffer ) + STARTDATA_LEN + 1;
- goto Found;
+ offset = FT_STREAM_POS() - read_len - read_offset
+ + (FT_ULong)( p - buffer ) + STARTDATA_LEN + 1;
}
else if ( p[1] == 's' &&
ft_strncmp( (char*)p, SFNTS, SFNTS_LEN ) == 0 )
{
- offset += (FT_ULong)( p - buffer ) + SFNTS_LEN + 1;
- goto Found;
+ offset = FT_STREAM_POS() - read_len - read_offset
+ + (FT_ULong)( p - buffer ) + SFNTS_LEN + 1;
}
}
- if ( read_offset + read_len < STARTDATA_LEN )
+ if ( read_offset + read_len <= STARTDATA_LEN )
{
- FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" ));
+ if ( offset )
+ goto Found;
+
+ FT_TRACE2(( "cid_parser_new: no `StartData` keyword found\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -171,9 +180,9 @@
}
Found:
- /* We have found the start of the binary data or the `/sfnts' token. */
- /* Now rewind and extract the frame corresponding to this PostScript */
- /* section. */
+ /* We have found an efficient range to look for the binary data or */
+ /* `/sfnts' token. Now rewind and extract the frame corresponding to */
+ /* this PostScript section. */
ps_len = offset - base_offset;
if ( FT_STREAM_SEEK( base_offset ) ||
@@ -187,8 +196,8 @@
parser->root.limit = parser->root.cursor + ps_len;
parser->num_dict = FT_UINT_MAX;
- /* Finally, we check whether `StartData' or `/sfnts' was real -- */
- /* it could be in a comment or string. We also get the arguments */
+ /* Find the first real `StartData' or `/sfnts' -- the last one */
+ /* could be in a comment or string. We also get the arguments */
/* of `StartData' to find out whether the data is represented in */
/* binary or hex format. */
@@ -216,6 +225,7 @@
{
T1_TokenRec type_token;
FT_Long binary_length;
+ FT_ULong found_offset;
parser->root.cursor = arg1;
@@ -234,6 +244,24 @@
parser->binary_length = (FT_ULong)binary_length;
}
+ /* set the real values for the parser, if different */
+ found_offset = (FT_ULong)( cur - parser->postscript )
+ + STARTDATA_LEN + 1;
+ if ( found_offset != offset )
+ {
+ FT_FRAME_RELEASE( parser->postscript );
+
+ ps_len = found_offset - base_offset;
+ if ( FT_STREAM_SEEK( base_offset ) ||
+ FT_FRAME_EXTRACT( ps_len, parser->postscript ) )
+ goto Exit;
+
+ parser->data_offset = found_offset;
+ parser->postscript_len = ps_len;
+ parser->root.base = parser->postscript;
+ parser->root.cursor = parser->postscript;
+ parser->root.limit = parser->root.cursor + ps_len;
+ }
goto Exit;
}
else if ( cur[1] == 's' &&
@@ -251,11 +279,8 @@
cur = parser->root.cursor;
}
- /* we haven't found the correct `StartData'; go back and continue */
- /* searching */
- FT_FRAME_RELEASE( parser->postscript );
- if ( !FT_STREAM_SEEK( offset ) )
- goto Again;
+ FT_TRACE2(( "cid_parser_new: no `StartData` token found\n" ));
+ error = FT_THROW( Invalid_File_Format );
Exit:
return error;
diff --git a/contrib/libs/freetype/src/cid/cidparse.h b/contrib/libs/freetype/src/cid/cidparse.h
index 2fd4e7a931..0f5baddcb9 100644
--- a/contrib/libs/freetype/src/cid/cidparse.h
+++ b/contrib/libs/freetype/src/cid/cidparse.h
@@ -4,7 +4,7 @@
*
* CID-keyed Type1 parser (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidriver.c b/contrib/libs/freetype/src/cid/cidriver.c
index 99e7b11839..4be8a5c00d 100644
--- a/contrib/libs/freetype/src/cid/cidriver.c
+++ b/contrib/libs/freetype/src/cid/cidriver.c
@@ -4,7 +4,7 @@
*
* CID driver interface (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidriver.h b/contrib/libs/freetype/src/cid/cidriver.h
index a6249385c8..7ddce431c5 100644
--- a/contrib/libs/freetype/src/cid/cidriver.h
+++ b/contrib/libs/freetype/src/cid/cidriver.h
@@ -4,7 +4,7 @@
*
* High-level CID driver interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/cidtoken.h b/contrib/libs/freetype/src/cid/cidtoken.h
index 925951acdb..160897d144 100644
--- a/contrib/libs/freetype/src/cid/cidtoken.h
+++ b/contrib/libs/freetype/src/cid/cidtoken.h
@@ -4,7 +4,7 @@
*
* CID token definitions (specification only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/cid/type1cid.c b/contrib/libs/freetype/src/cid/type1cid.c
index 905c896a31..890a3ac549 100644
--- a/contrib/libs/freetype/src/cid/type1cid.c
+++ b/contrib/libs/freetype/src/cid/type1cid.c
@@ -4,7 +4,7 @@
*
* FreeType OpenType driver component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/dlg/dlgwrap.c b/contrib/libs/freetype/src/dlg/dlgwrap.c
index e9dc3410a4..e6053cd5bc 100644
--- a/contrib/libs/freetype/src/dlg/dlgwrap.c
+++ b/contrib/libs/freetype/src/dlg/dlgwrap.c
@@ -4,7 +4,7 @@
*
* Wrapper file for the 'dlg' library (body only)
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/gzip/README.freetype b/contrib/libs/freetype/src/gzip/README.freetype
index 76298b06b5..29304308fd 100644
--- a/contrib/libs/freetype/src/gzip/README.freetype
+++ b/contrib/libs/freetype/src/gzip/README.freetype
@@ -1,7 +1,7 @@
Name: zlib
Short Name: zlib
URL: http://zlib.net/
-Version: 1.2.13
+Version: 1.3
License: see `zlib.h`
Description:
@@ -19,5 +19,4 @@ The files in this directory have been prepared as follows.
- Take the unmodified source code files from the zlib distribution that are
included by `ftgzip.c`.
- Copy `zconf.h` to `ftzconf.h` (which stays unmodified otherwise).
- - Run zlib's `zlib2ansi` script on all `.c` files.
- Apply the diff file(s) in the `patches` folder.
diff --git a/contrib/libs/freetype/src/gzip/ftgzip.c b/contrib/libs/freetype/src/gzip/ftgzip.c
index 1bb5f278ce..ba4ea32e9c 100644
--- a/contrib/libs/freetype/src/gzip/ftgzip.c
+++ b/contrib/libs/freetype/src/gzip/ftgzip.c
@@ -8,7 +8,7 @@
* parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/lzw/ftlzw.c b/contrib/libs/freetype/src/lzw/ftlzw.c
index 88383792a8..e1acf22eee 100644
--- a/contrib/libs/freetype/src/lzw/ftlzw.c
+++ b/contrib/libs/freetype/src/lzw/ftlzw.c
@@ -8,7 +8,7 @@
* be used to parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* Albert Chin-A-Young.
*
* based on code in `src/gzip/ftgzip.c'
diff --git a/contrib/libs/freetype/src/lzw/ftzopen.c b/contrib/libs/freetype/src/lzw/ftzopen.c
index e680c4de59..e42332466f 100644
--- a/contrib/libs/freetype/src/lzw/ftzopen.c
+++ b/contrib/libs/freetype/src/lzw/ftzopen.c
@@ -8,7 +8,7 @@
* be used to parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/lzw/ftzopen.h b/contrib/libs/freetype/src/lzw/ftzopen.h
index 6c7563643f..6915218292 100644
--- a/contrib/libs/freetype/src/lzw/ftzopen.h
+++ b/contrib/libs/freetype/src/lzw/ftzopen.h
@@ -8,7 +8,7 @@
* be used to parse compressed PCF fonts, as found with many X11 server
* distributions.
*
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pcf/pcfdrivr.c b/contrib/libs/freetype/src/pcf/pcfdrivr.c
index f1dba02404..93632f17c4 100644
--- a/contrib/libs/freetype/src/pcf/pcfdrivr.c
+++ b/contrib/libs/freetype/src/pcf/pcfdrivr.c
@@ -453,7 +453,7 @@ THE SOFTWARE.
FT_UInt glyph_index,
FT_Int32 load_flags )
{
- PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
+ PCF_Face face = (PCF_Face)size->face;
FT_Stream stream;
FT_Error error = FT_Err_Ok;
FT_Bitmap* bitmap = &slot->bitmap;
diff --git a/contrib/libs/freetype/src/pcf/pcfutil.c b/contrib/libs/freetype/src/pcf/pcfutil.c
index 9575726916..cd26c77cad 100644
--- a/contrib/libs/freetype/src/pcf/pcfutil.c
+++ b/contrib/libs/freetype/src/pcf/pcfutil.c
@@ -57,7 +57,7 @@ in this Software without prior written authorization from The Open Group.
}
-#if defined( __clang__ ) || \
+#if ( defined( __clang_major__ ) && __clang_major__ >= 5 ) || \
( defined( __GNUC__ ) && \
( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 8 ) ) )
diff --git a/contrib/libs/freetype/src/pfr/pfr.c b/contrib/libs/freetype/src/pfr/pfr.c
index d3738152dc..71b57930b3 100644
--- a/contrib/libs/freetype/src/pfr/pfr.c
+++ b/contrib/libs/freetype/src/pfr/pfr.c
@@ -4,7 +4,7 @@
*
* FreeType PFR driver component.
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrcmap.c b/contrib/libs/freetype/src/pfr/pfrcmap.c
index 08fe41d54e..cd701661f1 100644
--- a/contrib/libs/freetype/src/pfr/pfrcmap.c
+++ b/contrib/libs/freetype/src/pfr/pfrcmap.c
@@ -4,7 +4,7 @@
*
* FreeType PFR cmap handling (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrcmap.h b/contrib/libs/freetype/src/pfr/pfrcmap.h
index 8110f175e8..ab7913575d 100644
--- a/contrib/libs/freetype/src/pfr/pfrcmap.h
+++ b/contrib/libs/freetype/src/pfr/pfrcmap.h
@@ -4,7 +4,7 @@
*
* FreeType PFR cmap handling (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrdrivr.c b/contrib/libs/freetype/src/pfr/pfrdrivr.c
index 0048f52411..ffd822273f 100644
--- a/contrib/libs/freetype/src/pfr/pfrdrivr.c
+++ b/contrib/libs/freetype/src/pfr/pfrdrivr.c
@@ -4,7 +4,7 @@
*
* FreeType PFR driver interface (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrdrivr.h b/contrib/libs/freetype/src/pfr/pfrdrivr.h
index da14468d42..58954a9af0 100644
--- a/contrib/libs/freetype/src/pfr/pfrdrivr.h
+++ b/contrib/libs/freetype/src/pfr/pfrdrivr.h
@@ -4,7 +4,7 @@
*
* High-level Type PFR driver interface (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrerror.h b/contrib/libs/freetype/src/pfr/pfrerror.h
index 5dfb254d66..af0ddaf184 100644
--- a/contrib/libs/freetype/src/pfr/pfrerror.h
+++ b/contrib/libs/freetype/src/pfr/pfrerror.h
@@ -4,7 +4,7 @@
*
* PFR error codes (specification only).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrgload.c b/contrib/libs/freetype/src/pfr/pfrgload.c
index 48cf27ec80..e850075527 100644
--- a/contrib/libs/freetype/src/pfr/pfrgload.c
+++ b/contrib/libs/freetype/src/pfr/pfrgload.c
@@ -4,7 +4,7 @@
*
* FreeType PFR glyph loader (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -108,7 +108,7 @@
/* don't add empty contours */
if ( last >= first )
- outline->contours[outline->n_contours++] = (short)last;
+ outline->contours[outline->n_contours++] = (FT_UShort)last;
glyph->path_begun = 0;
}
@@ -178,8 +178,8 @@
error = FT_GLYPHLOADER_CHECK_POINTS( loader, 3, 0 );
if ( !error )
{
- FT_Vector* vec = outline->points + outline->n_points;
- FT_Byte* tag = (FT_Byte*)outline->tags + outline->n_points;
+ FT_Vector* vec = outline->points + outline->n_points;
+ FT_Byte* tag = outline->tags + outline->n_points;
vec[0] = *control1;
@@ -189,7 +189,7 @@
tag[1] = FT_CURVE_TAG_CUBIC;
tag[2] = FT_CURVE_TAG_ON;
- outline->n_points = (FT_Short)( outline->n_points + 3 );
+ outline->n_points += 3;
}
Exit:
diff --git a/contrib/libs/freetype/src/pfr/pfrgload.h b/contrib/libs/freetype/src/pfr/pfrgload.h
index 92a59bc5db..d86549fbe4 100644
--- a/contrib/libs/freetype/src/pfr/pfrgload.h
+++ b/contrib/libs/freetype/src/pfr/pfrgload.h
@@ -4,7 +4,7 @@
*
* FreeType PFR glyph loader (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrload.c b/contrib/libs/freetype/src/pfr/pfrload.c
index 856a5942f5..358af5c78a 100644
--- a/contrib/libs/freetype/src/pfr/pfrload.c
+++ b/contrib/libs/freetype/src/pfr/pfrload.c
@@ -4,7 +4,7 @@
*
* FreeType PFR loader (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrload.h b/contrib/libs/freetype/src/pfr/pfrload.h
index d7b20a4572..7390296d4a 100644
--- a/contrib/libs/freetype/src/pfr/pfrload.h
+++ b/contrib/libs/freetype/src/pfr/pfrload.h
@@ -4,7 +4,7 @@
*
* FreeType PFR loader (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrobjs.c b/contrib/libs/freetype/src/pfr/pfrobjs.c
index 8ef17c6636..084d2ef5a1 100644
--- a/contrib/libs/freetype/src/pfr/pfrobjs.c
+++ b/contrib/libs/freetype/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
*
* FreeType PFR object methods (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrobjs.h b/contrib/libs/freetype/src/pfr/pfrobjs.h
index fcf8c38122..1b548a1bc2 100644
--- a/contrib/libs/freetype/src/pfr/pfrobjs.h
+++ b/contrib/libs/freetype/src/pfr/pfrobjs.h
@@ -4,7 +4,7 @@
*
* FreeType PFR object methods (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrsbit.c b/contrib/libs/freetype/src/pfr/pfrsbit.c
index 46a988e8e3..96cc7fecec 100644
--- a/contrib/libs/freetype/src/pfr/pfrsbit.c
+++ b/contrib/libs/freetype/src/pfr/pfrsbit.c
@@ -4,7 +4,7 @@
*
* FreeType PFR bitmap loader (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrsbit.h b/contrib/libs/freetype/src/pfr/pfrsbit.h
index 3e1dba9ae9..105a2991c2 100644
--- a/contrib/libs/freetype/src/pfr/pfrsbit.h
+++ b/contrib/libs/freetype/src/pfr/pfrsbit.h
@@ -4,7 +4,7 @@
*
* FreeType PFR bitmap loader (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pfr/pfrtypes.h b/contrib/libs/freetype/src/pfr/pfrtypes.h
index 2f8909f062..435a77c8f2 100644
--- a/contrib/libs/freetype/src/pfr/pfrtypes.h
+++ b/contrib/libs/freetype/src/pfr/pfrtypes.h
@@ -4,7 +4,7 @@
*
* FreeType PFR data structures (specification only).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/afmparse.c b/contrib/libs/freetype/src/psaux/afmparse.c
index db08941def..e2f6a8e5ad 100644
--- a/contrib/libs/freetype/src/psaux/afmparse.c
+++ b/contrib/libs/freetype/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
*
* AFM parser (body).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/afmparse.h b/contrib/libs/freetype/src/psaux/afmparse.h
index 2d3b6e6e16..b776637282 100644
--- a/contrib/libs/freetype/src/psaux/afmparse.h
+++ b/contrib/libs/freetype/src/psaux/afmparse.h
@@ -4,7 +4,7 @@
*
* AFM parser (specification).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/cffdecode.c b/contrib/libs/freetype/src/psaux/cffdecode.c
index 562d17d221..9556e11a58 100644
--- a/contrib/libs/freetype/src/psaux/cffdecode.c
+++ b/contrib/libs/freetype/src/psaux/cffdecode.c
@@ -4,7 +4,7 @@
*
* PostScript CFF (Type 2) decoding routines (body).
*
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -17,6 +17,7 @@
#include <freetype/freetype.h>
+#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftserv.h>
#include <freetype/internal/services/svcfftl.h>
@@ -1752,22 +1753,9 @@
/* without upper limit the loop below might not finish */
if ( args[0] > 0x7FFFFFFFL )
- args[0] = 46341;
+ args[0] = 0xB504F4L; /* sqrt( 32768.0044 ) */
else if ( args[0] > 0 )
- {
- FT_Fixed root = args[0];
- FT_Fixed new_root;
-
-
- for (;;)
- {
- new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1;
- if ( new_root == root )
- break;
- root = new_root;
- }
- args[0] = new_root;
- }
+ args[0] = (FT_Fixed)FT_SqrtFixed( args[0] );
else
args[0] = 0;
args++;
diff --git a/contrib/libs/freetype/src/psaux/cffdecode.h b/contrib/libs/freetype/src/psaux/cffdecode.h
index e8bb4001cb..038f7235c3 100644
--- a/contrib/libs/freetype/src/psaux/cffdecode.h
+++ b/contrib/libs/freetype/src/psaux/cffdecode.h
@@ -4,7 +4,7 @@
*
* PostScript CFF (Type 2) decoding routines (specification).
*
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/psaux.c b/contrib/libs/freetype/src/psaux/psaux.c
index 5879ed1635..ffe89cd624 100644
--- a/contrib/libs/freetype/src/psaux/psaux.c
+++ b/contrib/libs/freetype/src/psaux/psaux.c
@@ -4,7 +4,7 @@
*
* FreeType auxiliary PostScript driver component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/psauxerr.h b/contrib/libs/freetype/src/psaux/psauxerr.h
index 895ffa48c2..18428c40d5 100644
--- a/contrib/libs/freetype/src/psaux/psauxerr.h
+++ b/contrib/libs/freetype/src/psaux/psauxerr.h
@@ -4,7 +4,7 @@
*
* PS auxiliary module error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/psauxmod.c b/contrib/libs/freetype/src/psaux/psauxmod.c
index 45e35aa53c..6826f9d8d3 100644
--- a/contrib/libs/freetype/src/psaux/psauxmod.c
+++ b/contrib/libs/freetype/src/psaux/psauxmod.c
@@ -4,7 +4,7 @@
*
* FreeType auxiliary PostScript module implementation (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/psauxmod.h b/contrib/libs/freetype/src/psaux/psauxmod.h
index 94dbf48813..82d7e348af 100644
--- a/contrib/libs/freetype/src/psaux/psauxmod.h
+++ b/contrib/libs/freetype/src/psaux/psauxmod.h
@@ -4,7 +4,7 @@
*
* FreeType auxiliary PostScript module implementation (specification).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/psblues.c b/contrib/libs/freetype/src/psaux/psblues.c
index f9c864fea9..213b943b46 100644
--- a/contrib/libs/freetype/src/psaux/psblues.c
+++ b/contrib/libs/freetype/src/psaux/psblues.c
@@ -54,14 +54,6 @@
#define FT_COMPONENT cf2blues
- /*
- * For blue values, the FreeType parser produces an array of integers,
- * while the Adobe CFF engine produces an array of fixed.
- * Define a macro to convert FreeType to fixed.
- */
-#define cf2_blueToFixed( x ) cf2_intToFixed( x )
-
-
FT_LOCAL_DEF( void )
cf2_blues_init( CF2_Blues blues,
CF2_Font font )
@@ -78,10 +70,10 @@
size_t numFamilyBlues;
size_t numFamilyOtherBlues;
- FT_Pos* blueValues;
- FT_Pos* otherBlues;
- FT_Pos* familyBlues;
- FT_Pos* familyOtherBlues;
+ FT_Fixed* blueValues;
+ FT_Fixed* otherBlues;
+ FT_Fixed* familyBlues;
+ FT_Fixed* familyOtherBlues;
size_t i;
CF2_Fixed emBoxBottom, emBoxTop;
@@ -138,13 +130,13 @@
emBoxTop = CF2_ICF_Top;
}
- if ( cf2_getLanguageGroup( decoder ) == 1 &&
- ( numBlueValues == 0 ||
- ( numBlueValues == 4 &&
- cf2_blueToFixed( blueValues[0] ) < emBoxBottom &&
- cf2_blueToFixed( blueValues[1] ) < emBoxBottom &&
- cf2_blueToFixed( blueValues[2] ) > emBoxTop &&
- cf2_blueToFixed( blueValues[3] ) > emBoxTop ) ) )
+ if ( cf2_getLanguageGroup( decoder ) == 1 &&
+ ( numBlueValues == 0 ||
+ ( numBlueValues == 4 &&
+ blueValues[0] < emBoxBottom &&
+ blueValues[1] < emBoxBottom &&
+ blueValues[2] > emBoxTop &&
+ blueValues[3] > emBoxTop ) ) )
{
/*
* Construct hint edges suitable for synthetic ghost hints at top
@@ -189,10 +181,8 @@
/* bottom zones */
for ( i = 0; i < numBlueValues; i += 2 )
{
- blues->zone[blues->count].csBottomEdge =
- cf2_blueToFixed( blueValues[i] );
- blues->zone[blues->count].csTopEdge =
- cf2_blueToFixed( blueValues[i + 1] );
+ blues->zone[blues->count].csBottomEdge = blueValues[i];
+ blues->zone[blues->count].csTopEdge = blueValues[i + 1];
zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
blues->zone[blues->count].csBottomEdge );
@@ -238,10 +228,8 @@
for ( i = 0; i < numOtherBlues; i += 2 )
{
- blues->zone[blues->count].csBottomEdge =
- cf2_blueToFixed( otherBlues[i] );
- blues->zone[blues->count].csTopEdge =
- cf2_blueToFixed( otherBlues[i + 1] );
+ blues->zone[blues->count].csBottomEdge = otherBlues[i];
+ blues->zone[blues->count].csTopEdge = otherBlues[i + 1];
zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
blues->zone[blues->count].csBottomEdge );
@@ -299,7 +287,7 @@
for ( j = 0; j < numFamilyOtherBlues; j += 2 )
{
/* top edge */
- flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] );
+ flatFamilyEdge = familyOtherBlues[j + 1];
diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
@@ -317,7 +305,7 @@
if ( numFamilyBlues >= 2 )
{
/* top edge */
- flatFamilyEdge = cf2_blueToFixed( familyBlues[1] );
+ flatFamilyEdge = familyBlues[1];
diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
@@ -337,7 +325,7 @@
for ( j = 2; j < numFamilyBlues; j += 2 )
{
/* bottom edge */
- flatFamilyEdge = cf2_blueToFixed( familyBlues[j] );
+ flatFamilyEdge = familyBlues[j];
/* adjust edges of top zone upward by twice darkening amount */
flatFamilyEdge += 2 * font->darkenY; /* bottom edge */
diff --git a/contrib/libs/freetype/src/psaux/psconv.c b/contrib/libs/freetype/src/psaux/psconv.c
index b9c7138d84..56c0ecd1d7 100644
--- a/contrib/libs/freetype/src/psaux/psconv.c
+++ b/contrib/libs/freetype/src/psaux/psconv.c
@@ -4,7 +4,7 @@
*
* Some convenience conversions (body).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/psconv.h b/contrib/libs/freetype/src/psaux/psconv.h
index b7c3ee00be..91fcd15a1c 100644
--- a/contrib/libs/freetype/src/psaux/psconv.h
+++ b/contrib/libs/freetype/src/psaux/psconv.h
@@ -4,7 +4,7 @@
*
* Some convenience conversions (specification).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/psft.c b/contrib/libs/freetype/src/psaux/psft.c
index 618864e6e0..fd0abe1715 100644
--- a/contrib/libs/freetype/src/psaux/psft.c
+++ b/contrib/libs/freetype/src/psaux/psft.c
@@ -566,12 +566,12 @@
FT_LOCAL_DEF( void )
cf2_getBlueValues( PS_Decoder* decoder,
size_t* count,
- FT_Pos* *data )
+ FT_Fixed* *data )
{
FT_ASSERT( decoder && decoder->current_subfont );
*count = decoder->current_subfont->private_dict.num_blue_values;
- *data = (FT_Pos*)
+ *data = (FT_Fixed*)
&decoder->current_subfont->private_dict.blue_values;
}
@@ -579,12 +579,12 @@
FT_LOCAL_DEF( void )
cf2_getOtherBlues( PS_Decoder* decoder,
size_t* count,
- FT_Pos* *data )
+ FT_Fixed* *data )
{
FT_ASSERT( decoder && decoder->current_subfont );
*count = decoder->current_subfont->private_dict.num_other_blues;
- *data = (FT_Pos*)
+ *data = (FT_Fixed*)
&decoder->current_subfont->private_dict.other_blues;
}
@@ -592,12 +592,12 @@
FT_LOCAL_DEF( void )
cf2_getFamilyBlues( PS_Decoder* decoder,
size_t* count,
- FT_Pos* *data )
+ FT_Fixed* *data )
{
FT_ASSERT( decoder && decoder->current_subfont );
*count = decoder->current_subfont->private_dict.num_family_blues;
- *data = (FT_Pos*)
+ *data = (FT_Fixed*)
&decoder->current_subfont->private_dict.family_blues;
}
@@ -605,12 +605,12 @@
FT_LOCAL_DEF( void )
cf2_getFamilyOtherBlues( PS_Decoder* decoder,
size_t* count,
- FT_Pos* *data )
+ FT_Fixed* *data )
{
FT_ASSERT( decoder && decoder->current_subfont );
*count = decoder->current_subfont->private_dict.num_family_other_blues;
- *data = (FT_Pos*)
+ *data = (FT_Fixed*)
&decoder->current_subfont->private_dict.family_other_blues;
}
diff --git a/contrib/libs/freetype/src/psaux/psft.h b/contrib/libs/freetype/src/psaux/psft.h
index 3da454e601..d9082f3a2b 100644
--- a/contrib/libs/freetype/src/psaux/psft.h
+++ b/contrib/libs/freetype/src/psaux/psft.h
@@ -92,19 +92,19 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
cf2_getBlueValues( PS_Decoder* decoder,
size_t* count,
- FT_Pos* *data );
+ FT_Fixed* *data );
FT_LOCAL( void )
cf2_getOtherBlues( PS_Decoder* decoder,
size_t* count,
- FT_Pos* *data );
+ FT_Fixed* *data );
FT_LOCAL( void )
cf2_getFamilyBlues( PS_Decoder* decoder,
size_t* count,
- FT_Pos* *data );
+ FT_Fixed* *data );
FT_LOCAL( void )
cf2_getFamilyOtherBlues( PS_Decoder* decoder,
size_t* count,
- FT_Pos* *data );
+ FT_Fixed* *data );
FT_LOCAL( CF2_Int )
cf2_getLanguageGroup( PS_Decoder* decoder );
diff --git a/contrib/libs/freetype/src/psaux/psintrp.c b/contrib/libs/freetype/src/psaux/psintrp.c
index 6c640eebd5..7572e225e3 100644
--- a/contrib/libs/freetype/src/psaux/psintrp.c
+++ b/contrib/libs/freetype/src/psaux/psintrp.c
@@ -37,6 +37,7 @@
#include "psft.h"
+#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/services/svcfftl.h>
@@ -428,6 +429,8 @@
base = cf2_stack_count( opStack ) - numOperands;
delta = base + numBlends;
+ FT_TRACE6(( " (" ));
+
for ( i = 0; i < numBlends; i++ )
{
const CF2_Fixed* weight = &blend->BV[1];
@@ -442,10 +445,14 @@
cf2_stack_getReal( opStack,
delta++ ) ) );
+ FT_TRACE6(( "%f ", (double)sum / 65536 ));
+
/* store blended result */
cf2_stack_setReal( opStack, i + base, sum );
}
+ FT_TRACE6(( "blended)\n" ));
+
/* leave only `numBlends' results on stack */
cf2_stack_pop( opStack, numOperands - numBlends );
}
@@ -734,7 +741,7 @@
FT_UInt numBlends;
- FT_TRACE4(( " blend\n" ));
+ FT_TRACE4(( " blend" ));
if ( !font->isCFF2 )
break; /* clear stack & ignore */
@@ -2275,23 +2282,7 @@
arg = cf2_stack_popFixed( opStack );
if ( arg > 0 )
- {
- /* use a start value that doesn't make */
- /* the algorithm's addition overflow */
- FT_Fixed root = arg < 10 ? arg : arg >> 1;
- FT_Fixed new_root;
-
-
- /* Babylonian method */
- for (;;)
- {
- new_root = ( root + FT_DivFix( arg, root ) + 1 ) >> 1;
- if ( new_root == root )
- break;
- root = new_root;
- }
- arg = new_root;
- }
+ arg = (CF2_F16Dot16)FT_SqrtFixed( (FT_UInt32)arg );
else
arg = 0;
diff --git a/contrib/libs/freetype/src/psaux/psobjs.c b/contrib/libs/freetype/src/psaux/psobjs.c
index 8da755d0e5..eca465f009 100644
--- a/contrib/libs/freetype/src/psaux/psobjs.c
+++ b/contrib/libs/freetype/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
*
* Auxiliary functions for PostScript fonts (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -23,6 +23,7 @@
#include "psobjs.h"
#include "psconv.h"
+#include "psft.h"
#include "psauxerr.h"
#include "psauxmod.h"
@@ -200,7 +201,9 @@
/* add the object to the base block and adjust offset */
table->elements[idx] = FT_OFFSET( table->block, table->cursor );
table->lengths [idx] = length;
- FT_MEM_COPY( table->block + table->cursor, object, length );
+ /* length == 0 also implies a NULL destination, so skip the copy call */
+ if ( length > 0 )
+ FT_MEM_COPY( table->block + table->cursor, object, length );
table->cursor += length;
return FT_Err_Ok;
@@ -1624,7 +1627,7 @@
if ( builder->load_points )
{
FT_Vector* point = outline->points + outline->n_points;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
+ FT_Byte* control = outline->tags + outline->n_points;
point->x = FIXED_TO_INT( x );
@@ -1677,8 +1680,7 @@
if ( !error )
{
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ outline->contours[outline->n_contours - 1] = outline->n_points - 1;
outline->n_contours++;
}
@@ -1740,7 +1742,7 @@
{
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
+ FT_Byte* control = outline->tags + outline->n_points - 1;
/* `delete' last point only if it coincides with the first */
@@ -1760,8 +1762,7 @@
outline->n_points--;
}
else
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ outline->contours[outline->n_contours - 1] = outline->n_points - 1;
}
}
@@ -1899,7 +1900,7 @@
if ( builder->load_points )
{
FT_Vector* point = outline->points + outline->n_points;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
+ FT_Byte* control = outline->tags + outline->n_points;
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
@@ -1959,8 +1960,7 @@
if ( !error )
{
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ outline->contours[outline->n_contours - 1] = outline->n_points - 1;
outline->n_contours++;
}
@@ -2019,7 +2019,7 @@
{
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
+ FT_Byte* control = outline->tags + outline->n_points - 1;
/* `delete' last point only if it coincides with the first */
@@ -2039,8 +2039,7 @@
outline->n_points--;
}
else
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ outline->contours[outline->n_contours - 1] = outline->n_points - 1;
}
}
@@ -2188,7 +2187,7 @@
if ( builder->load_points )
{
FT_Vector* point = outline->points + outline->n_points;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
+ FT_Byte* control = outline->tags + outline->n_points;
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
@@ -2267,8 +2266,7 @@
if ( !error )
{
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ outline->contours[outline->n_contours - 1] = outline->n_points - 1;
outline->n_contours++;
}
@@ -2327,7 +2325,7 @@
{
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
+ FT_Byte* control = outline->tags + outline->n_points - 1;
/* `delete' last point only if it coincides with the first */
@@ -2347,8 +2345,7 @@
outline->n_points--;
}
else
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ outline->contours[outline->n_contours - 1] = outline->n_points - 1;
}
}
@@ -2463,19 +2460,20 @@
count = cpriv->num_blue_values = priv->num_blue_values;
for ( n = 0; n < count; n++ )
- cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n];
+ cpriv->blue_values[n] = cf2_intToFixed( priv->blue_values[n] );
count = cpriv->num_other_blues = priv->num_other_blues;
for ( n = 0; n < count; n++ )
- cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n];
+ cpriv->other_blues[n] = cf2_intToFixed( priv->other_blues[n] );
count = cpriv->num_family_blues = priv->num_family_blues;
for ( n = 0; n < count; n++ )
- cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n];
+ cpriv->family_blues[n] = cf2_intToFixed( priv->family_blues[n] );
count = cpriv->num_family_other_blues = priv->num_family_other_blues;
for ( n = 0; n < count; n++ )
- cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n];
+ cpriv->family_other_blues[n] =
+ cf2_intToFixed( priv->family_other_blues[n] );
cpriv->blue_scale = priv->blue_scale;
cpriv->blue_shift = (FT_Pos)priv->blue_shift;
diff --git a/contrib/libs/freetype/src/psaux/psobjs.h b/contrib/libs/freetype/src/psaux/psobjs.h
index d5bce54108..345fc8a733 100644
--- a/contrib/libs/freetype/src/psaux/psobjs.h
+++ b/contrib/libs/freetype/src/psaux/psobjs.h
@@ -4,7 +4,7 @@
*
* Auxiliary functions for PostScript fonts (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/t1cmap.c b/contrib/libs/freetype/src/psaux/t1cmap.c
index c4bcf599ea..5681c3bd0f 100644
--- a/contrib/libs/freetype/src/psaux/t1cmap.c
+++ b/contrib/libs/freetype/src/psaux/t1cmap.c
@@ -4,7 +4,7 @@
*
* Type 1 character map support (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/t1cmap.h b/contrib/libs/freetype/src/psaux/t1cmap.h
index b3702498a5..445e6a2784 100644
--- a/contrib/libs/freetype/src/psaux/t1cmap.h
+++ b/contrib/libs/freetype/src/psaux/t1cmap.h
@@ -4,7 +4,7 @@
*
* Type 1 character map support (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/t1decode.c b/contrib/libs/freetype/src/psaux/t1decode.c
index 4b6b969bcb..c74baa8038 100644
--- a/contrib/libs/freetype/src/psaux/t1decode.c
+++ b/contrib/libs/freetype/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
*
* PostScript Type 1 decoding routines (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psaux/t1decode.h b/contrib/libs/freetype/src/psaux/t1decode.h
index 0970def960..16203b8f73 100644
--- a/contrib/libs/freetype/src/psaux/t1decode.h
+++ b/contrib/libs/freetype/src/psaux/t1decode.h
@@ -4,7 +4,7 @@
*
* PostScript Type 1 decoding routines (specification).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pshinter/pshalgo.c b/contrib/libs/freetype/src/pshinter/pshalgo.c
index 4f622e1e44..967767b348 100644
--- a/contrib/libs/freetype/src/pshinter/pshalgo.c
+++ b/contrib/libs/freetype/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
*
* PostScript hinting algorithm (body).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
@@ -1118,7 +1118,7 @@
FT_UInt n;
PSH_Point point = glyph->points;
FT_Vector* vec = glyph->outline->points;
- char* tags = glyph->outline->tags;
+ FT_Byte* tags = glyph->outline->tags;
for ( n = 0; n < glyph->num_points; n++ )
@@ -1171,8 +1171,8 @@
FT_QNEW_ARRAY( glyph->contours, outline->n_contours ) )
goto Exit;
- glyph->num_points = (FT_UInt)outline->n_points;
- glyph->num_contours = (FT_UInt)outline->n_contours;
+ glyph->num_points = outline->n_points;
+ glyph->num_contours = outline->n_contours;
{
FT_UInt first = 0, next, n;
@@ -1186,7 +1186,7 @@
PSH_Point point;
- next = (FT_UInt)outline->contours[n] + 1;
+ next = outline->contours[n] + 1;
count = next - first;
contour->start = points + first;
diff --git a/contrib/libs/freetype/src/pshinter/pshalgo.h b/contrib/libs/freetype/src/pshinter/pshalgo.h
index 3f0ba28a69..fb362f061b 100644
--- a/contrib/libs/freetype/src/pshinter/pshalgo.h
+++ b/contrib/libs/freetype/src/pshinter/pshalgo.h
@@ -4,7 +4,7 @@
*
* PostScript hinting algorithm (specification).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pshinter/pshglob.c b/contrib/libs/freetype/src/pshinter/pshglob.c
index d4c5eb32b1..435f45838f 100644
--- a/contrib/libs/freetype/src/pshinter/pshglob.c
+++ b/contrib/libs/freetype/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
* PostScript hinter global hinting management (body).
* Inspired by the new auto-hinter module.
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
diff --git a/contrib/libs/freetype/src/pshinter/pshglob.h b/contrib/libs/freetype/src/pshinter/pshglob.h
index 579eb2148a..c5a5c91316 100644
--- a/contrib/libs/freetype/src/pshinter/pshglob.h
+++ b/contrib/libs/freetype/src/pshinter/pshglob.h
@@ -4,7 +4,7 @@
*
* PostScript hinter global hinting management.
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pshinter/pshinter.c b/contrib/libs/freetype/src/pshinter/pshinter.c
index 54ed410966..ae2b53fee5 100644
--- a/contrib/libs/freetype/src/pshinter/pshinter.c
+++ b/contrib/libs/freetype/src/pshinter/pshinter.c
@@ -4,7 +4,7 @@
*
* FreeType PostScript Hinting module
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pshinter/pshmod.c b/contrib/libs/freetype/src/pshinter/pshmod.c
index 974a99e018..9965d5b16b 100644
--- a/contrib/libs/freetype/src/pshinter/pshmod.c
+++ b/contrib/libs/freetype/src/pshinter/pshmod.c
@@ -4,7 +4,7 @@
*
* FreeType PostScript hinter module implementation (body).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pshinter/pshmod.h b/contrib/libs/freetype/src/pshinter/pshmod.h
index 4bd781a35d..62ac0a60fd 100644
--- a/contrib/libs/freetype/src/pshinter/pshmod.h
+++ b/contrib/libs/freetype/src/pshinter/pshmod.h
@@ -4,7 +4,7 @@
*
* PostScript hinter module interface (specification).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pshinter/pshnterr.h b/contrib/libs/freetype/src/pshinter/pshnterr.h
index 97624952d8..e9641340e5 100644
--- a/contrib/libs/freetype/src/pshinter/pshnterr.h
+++ b/contrib/libs/freetype/src/pshinter/pshnterr.h
@@ -4,7 +4,7 @@
*
* PS Hinter error codes (specification only).
*
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/pshinter/pshrec.c b/contrib/libs/freetype/src/pshinter/pshrec.c
index 680e6d0135..0b2b549fc2 100644
--- a/contrib/libs/freetype/src/pshinter/pshrec.c
+++ b/contrib/libs/freetype/src/pshinter/pshrec.c
@@ -4,7 +4,7 @@
*
* FreeType PostScript hints recorder (body).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -806,7 +806,7 @@
ps_hints_stem( PS_Hints hints,
FT_UInt dimension,
FT_Int count,
- FT_Long* stems )
+ FT_Pos* stems )
{
PS_Dimension dim;
diff --git a/contrib/libs/freetype/src/pshinter/pshrec.h b/contrib/libs/freetype/src/pshinter/pshrec.h
index 0b2484af12..7e375af7ba 100644
--- a/contrib/libs/freetype/src/pshinter/pshrec.h
+++ b/contrib/libs/freetype/src/pshinter/pshrec.h
@@ -4,7 +4,7 @@
*
* Postscript (Type1/Type2) hints recorder (specification).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psnames/psmodule.c b/contrib/libs/freetype/src/psnames/psmodule.c
index 8203a0465d..35d054d1cf 100644
--- a/contrib/libs/freetype/src/psnames/psmodule.c
+++ b/contrib/libs/freetype/src/psnames/psmodule.c
@@ -4,7 +4,7 @@
*
* psnames module implementation (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psnames/psmodule.h b/contrib/libs/freetype/src/psnames/psmodule.h
index 0904700bfb..770458316b 100644
--- a/contrib/libs/freetype/src/psnames/psmodule.h
+++ b/contrib/libs/freetype/src/psnames/psmodule.h
@@ -4,7 +4,7 @@
*
* High-level psnames module interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psnames/psnamerr.h b/contrib/libs/freetype/src/psnames/psnamerr.h
index 0073f82284..e123eb65e3 100644
--- a/contrib/libs/freetype/src/psnames/psnamerr.h
+++ b/contrib/libs/freetype/src/psnames/psnamerr.h
@@ -4,7 +4,7 @@
*
* PS names module error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psnames/psnames.c b/contrib/libs/freetype/src/psnames/psnames.c
index 93ed9332fa..2933af1bf5 100644
--- a/contrib/libs/freetype/src/psnames/psnames.c
+++ b/contrib/libs/freetype/src/psnames/psnames.c
@@ -4,7 +4,7 @@
*
* FreeType psnames module component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/psnames/pstables.h b/contrib/libs/freetype/src/psnames/pstables.h
index 7f92cce603..2a941b0460 100644
--- a/contrib/libs/freetype/src/psnames/pstables.h
+++ b/contrib/libs/freetype/src/psnames/pstables.h
@@ -4,7 +4,7 @@
*
* PostScript glyph names.
*
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/raster/ftraster.c b/contrib/libs/freetype/src/raster/ftraster.c
index c3251875ac..c8460ac3a3 100644
--- a/contrib/libs/freetype/src/raster/ftraster.c
+++ b/contrib/libs/freetype/src/raster/ftraster.c
@@ -4,7 +4,7 @@
*
* The FreeType glyph rasterizer (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -63,8 +63,7 @@
#else /* !STANDALONE_ */
#include "ftraster.h"
-#include <freetype/internal/ftcalc.h> /* for FT_MulDiv and FT_MulDiv_No_Round */
-#include <freetype/ftoutln.h> /* for FT_Outline_Get_CBox */
+#include <freetype/internal/ftcalc.h> /* for FT_MulDiv_No_Round */
#endif /* !STANDALONE_ */
@@ -115,12 +114,12 @@
* 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:
+ * Note that, for all generated profiles, the function End_Profile()
+ * is used to record all their bottom-most scanlines as well as the
+ * scanline above their 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:
*
* _ _ _______________________________________
* | |
@@ -136,7 +135,7 @@
* optimize performance (see technical note on the sweep below).
*
* Of course, the raster detects whether the two stacks collide and
- * handles the situation properly.
+ * handles the situation by bisecting the job and restarting.
*
*/
@@ -252,7 +251,6 @@
/* On the other hand, SMulDiv means `Slow MulDiv', and is used typically */
/* for clipping computations. It simply uses the FT_MulDiv() function */
/* defined in `ftcalc.h'. */
-#define SMulDiv FT_MulDiv
#define SMulDiv_No_Round FT_MulDiv_No_Round
/* The rasterizer is a very general purpose component; please leave */
@@ -305,16 +303,6 @@
typedef unsigned char Byte, *PByte;
typedef char Bool;
-
- typedef union Alignment_
- {
- Long l;
- void* p;
- void (*f)(void);
-
- } Alignment, *PAlignment;
-
-
typedef struct TPoint_
{
Long x;
@@ -327,6 +315,7 @@
#define Flow_Up 0x08U
#define Overshoot_Top 0x10U
#define Overshoot_Bottom 0x20U
+#define Dropout 0x40U
/* States of each line, arc, and profile */
@@ -345,31 +334,28 @@
struct TProfile_
{
- FT_F26Dot6 X; /* current coordinate during sweep */
PProfile link; /* link to next profile (various purposes) */
- PLong offset; /* start of profile's data in render pool */
+ PProfile next; /* next profile in same contour, used */
+ /* during drop-out control */
+ Int offset; /* bottom or currently scanned array index */
+ Int height; /* profile's height in scanlines */
+ Int start; /* profile's starting scanline, also use */
+ /* as activation counter */
UShort flags; /* Bit 0-2: drop-out mode */
/* Bit 3: profile orientation (up/down) */
/* Bit 4: is top profile? */
/* Bit 5: is bottom profile? */
- Long height; /* profile's height in scanlines */
- Long start; /* profile's starting scanline */
-
- Int countL; /* number of lines to step before this */
- /* profile becomes drawable */
+ /* Bit 6: dropout detected */
- PProfile next; /* next profile in same contour, used */
- /* during drop-out control */
+ FT_F26Dot6 X; /* current coordinate during sweep */
+ Long x[1]; /* actually variable array of scanline */
+ /* intersections with `height` elements */
};
typedef PProfile TProfileList;
typedef PProfile* PProfileList;
-#define AlignProfileSize \
- ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( Long ) )
-
-
#undef RAS_ARG
#undef RAS_ARGS
#undef RAS_VAR
@@ -407,15 +393,13 @@
/* prototypes used for sweep function dispatch */
typedef void
- Function_Sweep_Init( RAS_ARGS Short min,
- Short max );
+ Function_Sweep_Init( RAS_ARGS Int min,
+ Int max );
typedef void
- Function_Sweep_Span( RAS_ARGS Short y,
+ Function_Sweep_Span( RAS_ARGS Int y,
FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right );
+ FT_F26Dot6 x2 );
typedef void
Function_Sweep_Step( RAS_ARG );
@@ -441,8 +425,7 @@
(Bool)( x - FLOOR( x ) >= ras.precision_half )
/* Smart dropout rounding to find which pixel is closer to span ends. */
- /* To mimick Windows, symmetric cases break down indepenently of the */
- /* precision. */
+ /* To mimic Windows, symmetric cases do not depend on the precision. */
#define SMART( p, q ) FLOOR( ( (p) + (q) + ras.precision * 63 / 64 ) >> 1 )
#if FT_RENDER_POOL_SIZE > 2048
@@ -462,7 +445,6 @@
Int precision_half;
Int precision_scale;
Int precision_step;
- Int precision_jitter;
PLong buff; /* The profiles buffer */
PLong sizeBuff; /* Render pool size */
@@ -471,24 +453,14 @@
FT_Error error;
- Int numTurns; /* number of Y-turns in outline */
-
Byte dropOutControl; /* current drop_out control method */
- UShort bWidth; /* target bitmap width */
- PByte bOrigin; /* target bitmap bottom-left origin */
- PByte bLine; /* target bitmap current line */
-
Long lastX, lastY;
Long minY, maxY;
UShort num_Profs; /* current number of profiles */
+ Int numTurns; /* number of Y-turns in outline */
- Bool fresh; /* signals a fresh new profile which */
- /* `start' field must be completed */
- Bool joint; /* signals that the last arc ended */
- /* exactly on a scanline. Allows */
- /* removal of doublets */
PProfile cProfile; /* current profile */
PProfile fProfile; /* head of linked list of profiles */
PProfile gProfile; /* contour's first profile in case */
@@ -496,9 +468,14 @@
TStates state; /* rendering state */
- FT_Bitmap target; /* description of target bit/pixmap */
FT_Outline outline;
+ Int bTop; /* target bitmap max line index */
+ Int bRight; /* target bitmap rightmost index */
+ Int bPitch; /* target bitmap pitch */
+ PByte bOrigin; /* target bitmap bottom-left origin */
+ PByte bLine; /* target bitmap current line */
+
/* dispatch variables */
Function_Sweep_Init* Proc_Sweep_Init;
@@ -563,31 +540,19 @@
*
* 256 / (1 << 12) = 0.0625 pixels.
*
- * `precision_jitter' is an epsilon threshold used in
- * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier
- * decomposition (after all, we are working with approximations only);
- * it avoids switching on additional pixels which would cause artifacts
- * otherwise.
- *
- * The value of `precision_jitter' has been determined heuristically.
- *
*/
if ( High )
{
ras.precision_bits = 12;
ras.precision_step = 256;
- ras.precision_jitter = 30;
}
else
{
ras.precision_bits = 6;
ras.precision_step = 32;
- ras.precision_jitter = 2;
}
- FT_TRACE6(( "Set_High_Precision(%s)\n", High ? "true" : "false" ));
-
ras.precision = 1 << ras.precision_bits;
ras.precision_half = ras.precision >> 1;
ras.precision_scale = ras.precision >> Pixel_Bits;
@@ -597,6 +562,63 @@
/**************************************************************************
*
* @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_Turns( RAS_ARGS Int y,
+ Int top )
+ {
+ Int n = ras.numTurns;
+ PLong y_turns = ras.maxBuff;
+
+
+ /* update top value */
+ if ( n == 0 || top > y_turns[n] )
+ y_turns[n] = top;
+
+ /* look for first y value that is <= */
+ while ( n-- && y < y_turns[n] )
+ ;
+
+ /* if it is <, simply insert it, ignore if == */
+ if ( n < 0 || y > y_turns[n] )
+ {
+ ras.maxBuff--;
+ if ( ras.maxBuff <= ras.top )
+ {
+ ras.error = FT_THROW( Raster_Overflow );
+ return FAILURE;
+ }
+
+ do
+ {
+ Int y2 = (Int)y_turns[n];
+
+
+ y_turns[n] = y;
+ y = y2;
+ } while ( n-- >= 0 );
+
+ ras.numTurns++;
+ }
+
+ return SUCCESS;
+ }
+
+
+ /**************************************************************************
+ *
+ * @Function:
* New_Profile
*
* @Description:
@@ -606,52 +628,48 @@
* 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 )
+ New_Profile( RAS_ARGS TStates aState )
{
- if ( !ras.fProfile )
+ Long e;
+
+
+ if ( !ras.cProfile || ras.cProfile->height )
{
ras.cProfile = (PProfile)ras.top;
- ras.fProfile = ras.cProfile;
- ras.top += AlignProfileSize;
- }
+ ras.top = ras.cProfile->x;
- if ( ras.top >= ras.maxBuff )
- {
- ras.error = FT_THROW( Raster_Overflow );
- return FAILURE;
+ if ( ras.top >= ras.maxBuff )
+ {
+ FT_TRACE1(( "overflow in New_Profile\n" ));
+ ras.error = FT_THROW( Raster_Overflow );
+ return FAILURE;
+ }
+
+ ras.cProfile->height = 0;
}
- ras.cProfile->start = 0;
- ras.cProfile->height = 0;
- ras.cProfile->offset = ras.top;
- ras.cProfile->link = (PProfile)0;
- ras.cProfile->next = (PProfile)0;
ras.cProfile->flags = ras.dropOutControl;
switch ( aState )
{
case Ascending_State:
ras.cProfile->flags |= Flow_Up;
- if ( overshoot )
+ if ( IS_BOTTOM_OVERSHOOT( ras.lastY ) )
ras.cProfile->flags |= Overshoot_Bottom;
- FT_TRACE6(( " new ascending profile = %p\n", (void *)ras.cProfile ));
+ e = CEILING( ras.lastY );
break;
case Descending_State:
- if ( overshoot )
+ if ( IS_TOP_OVERSHOOT( ras.lastY ) )
ras.cProfile->flags |= Overshoot_Top;
- FT_TRACE6(( " new descending profile = %p\n", (void *)ras.cProfile ));
+
+ e = FLOOR( ras.lastY );
break;
default:
@@ -660,12 +678,20 @@
return FAILURE;
}
- if ( !ras.gProfile )
- ras.gProfile = ras.cProfile;
+ if ( e > ras.maxY )
+ e = ras.maxY;
+ if ( e < ras.minY )
+ e = ras.minY;
+ ras.cProfile->start = (Int)TRUNC( e );
+
+ FT_TRACE7(( " new %s profile = %p, start = %d\n",
+ aState == Ascending_State ? "ascending" : "descending",
+ (void *)ras.cProfile, ras.cProfile->start ));
+
+ if ( ras.lastY == e )
+ *ras.top++ = ras.lastX;
ras.state = aState;
- ras.fresh = TRUE;
- ras.joint = FALSE;
return SUCCESS;
}
@@ -677,24 +703,19 @@
* End_Profile
*
* @Description:
- * Finalize the current profile.
- *
- * @Input:
- * overshoot ::
- * Whether the profile's unrounded end position differs
- * by at least a half pixel.
+ * Finalize the current profile and record y-turns.
*
* @Return:
* SUCCESS on success. FAILURE in case of overflow or incoherency.
*/
static Bool
- End_Profile( RAS_ARGS Bool overshoot )
+ End_Profile( RAS_ARG )
{
- Long h;
+ PProfile p = ras.cProfile;
+ Int h = (Int)( ras.top - p->x );
+ Int bottom, top;
- h = (Long)( ras.top - ras.cProfile->offset );
-
if ( h < 0 )
{
FT_ERROR(( "End_Profile: negative height encountered\n" ));
@@ -704,98 +725,46 @@
if ( h > 0 )
{
- PProfile oldProfile;
+ FT_TRACE7(( " ending profile %p, start = %2d, height = %+3d\n",
+ (void *)p, p->start, p->flags & Flow_Up ? h : -h ));
+ p->height = h;
- FT_TRACE6(( " ending profile %p, start = %ld, height = %ld\n",
- (void *)ras.cProfile, ras.cProfile->start, h ));
+ if ( p->flags & Flow_Up )
+ {
+ if ( IS_TOP_OVERSHOOT( ras.lastY ) )
+ p->flags |= Overshoot_Top;
- ras.cProfile->height = h;
- if ( overshoot )
+ bottom = p->start;
+ top = bottom + h;
+ p->offset = 0;
+ p->X = p->x[0];
+ }
+ else
{
- if ( ras.cProfile->flags & Flow_Up )
- ras.cProfile->flags |= Overshoot_Top;
- else
- ras.cProfile->flags |= Overshoot_Bottom;
+ if ( IS_BOTTOM_OVERSHOOT( ras.lastY ) )
+ p->flags |= Overshoot_Bottom;
+
+ top = p->start + 1;
+ bottom = top - h;
+ p->start = bottom;
+ p->offset = h - 1;
+ p->X = p->x[h - 1];
}
- oldProfile = ras.cProfile;
- ras.cProfile = (PProfile)ras.top;
+ if ( Insert_Y_Turns( RAS_VARS bottom, top ) )
+ return FAILURE;
- ras.top += AlignProfileSize;
+ if ( !ras.gProfile )
+ ras.gProfile = p;
- ras.cProfile->height = 0;
- ras.cProfile->offset = ras.top;
+ /* preliminary values to be finalized */
+ p->next = ras.gProfile;
+ p->link = (PProfile)ras.top;
- oldProfile->next = ras.cProfile;
ras.num_Profs++;
}
- if ( ras.top >= ras.maxBuff )
- {
- FT_TRACE1(( "overflow in End_Profile\n" ));
- ras.error = FT_THROW( Raster_Overflow );
- return FAILURE;
- }
-
- ras.joint = FALSE;
-
- return SUCCESS;
- }
-
-
- /**************************************************************************
- *
- * @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 )
- {
- PLong y_turns;
- Int n;
-
-
- n = ras.numTurns - 1;
- y_turns = ras.sizeBuff - ras.numTurns;
-
- /* look for first y value that is <= */
- while ( n >= 0 && y < y_turns[n] )
- n--;
-
- /* if it is <, simply insert it, ignore if == */
- if ( n >= 0 && y > y_turns[n] )
- do
- {
- Int y2 = (Int)y_turns[n];
-
-
- y_turns[n] = y;
- y = y2;
- } while ( --n >= 0 );
-
- if ( n < 0 )
- {
- ras.maxBuff--;
- if ( ras.maxBuff <= ras.top )
- {
- ras.error = FT_THROW( Raster_Overflow );
- return FAILURE;
- }
- ras.numTurns++;
- ras.sizeBuff[-ras.numTurns] = y;
- }
-
return SUCCESS;
}
@@ -807,56 +776,29 @@
*
* @Description:
* Adjust all links in the profiles list.
- *
- * @Return:
- * SUCCESS on success. FAILURE in case of overflow.
*/
- static Bool
+ static void
Finalize_Profile_Table( RAS_ARG )
{
- UShort n;
- PProfile p;
+ UShort n = ras.num_Profs;
+ PProfile p = ras.fProfile;
+ PProfile q;
- n = ras.num_Profs;
- p = ras.fProfile;
-
- if ( n > 1 && p )
+ /* there should be at least two profiles, up and down */
+ while ( --n )
{
- do
- {
- Int bottom, top;
+ q = p->link;
+ /* fix the contour loop */
+ if ( q->next == p->next )
+ p->next = q;
- if ( n > 1 )
- p->link = (PProfile)( p->offset + p->height );
- else
- p->link = NULL;
-
- if ( p->flags & Flow_Up )
- {
- bottom = (Int)p->start;
- top = (Int)( p->start + p->height - 1 );
- }
- else
- {
- bottom = (Int)( p->start - p->height + 1 );
- top = (Int)p->start;
- p->start = bottom;
- p->offset += p->height - 1;
- }
-
- if ( Insert_Y_Turn( RAS_VARS bottom ) ||
- Insert_Y_Turn( RAS_VARS top + 1 ) )
- return FAILURE;
-
- p = p->link;
- } while ( --n );
+ p = q;
}
- else
- ras.fProfile = NULL;
- return SUCCESS;
+ /* null-terminate */
+ p->link = NULL;
}
@@ -986,107 +928,78 @@
Long miny,
Long maxy )
{
- Long Dx, Dy;
- Int e1, e2, f1, f2, size; /* XXX: is `Short' sufficient? */
- Long Ix, Rx, Ax;
+ Long e, e2, Dx, Dy;
+ Long Ix, Rx, Ax;
+ Int size;
PLong top;
- Dx = x2 - x1;
- Dy = y2 - y1;
-
- if ( Dy <= 0 || y2 < miny || y1 > maxy )
+ if ( y2 < miny || y1 > maxy )
return SUCCESS;
- if ( y1 < miny )
- {
- /* Take care: miny-y1 can be a very large value; we use */
- /* a slow MulDiv function to avoid clipping bugs */
- x1 += SMulDiv( Dx, miny - y1, Dy );
- e1 = (Int)TRUNC( miny );
- f1 = 0;
- }
- else
- {
- e1 = (Int)TRUNC( y1 );
- f1 = (Int)FRAC( y1 );
- }
+ e2 = y2 > maxy ? maxy : FLOOR( y2 );
+ e = y1 < miny ? miny : CEILING( y1 );
- if ( y2 > maxy )
- {
- /* x2 += FMulDiv( Dx, maxy - y2, Dy ); UNNECESSARY */
- e2 = (Int)TRUNC( maxy );
- f2 = 0;
- }
- else
- {
- e2 = (Int)TRUNC( y2 );
- f2 = (Int)FRAC( y2 );
- }
-
- if ( f1 > 0 )
- {
- if ( e1 == e2 )
- return SUCCESS;
- else
- {
- x1 += SMulDiv( Dx, ras.precision - f1, Dy );
- e1 += 1;
- }
- }
- else
- if ( ras.joint )
- {
- ras.top--;
- ras.joint = FALSE;
- }
+ if ( y1 == e )
+ e += ras.precision;
- ras.joint = (char)( f2 == 0 );
+ if ( e2 < e ) /* nothing to do */
+ return SUCCESS;
- if ( ras.fresh )
- {
- ras.cProfile->start = e1;
- ras.fresh = FALSE;
- }
+ size = (Int)TRUNC( e2 - e ) + 1;
+ top = ras.top;
- size = e2 - e1 + 1;
- if ( ras.top + size >= ras.maxBuff )
+ if ( top + size >= ras.maxBuff )
{
ras.error = FT_THROW( Raster_Overflow );
return FAILURE;
}
- if ( Dx > 0 )
- {
- Ix = SMulDiv_No_Round( ras.precision, Dx, Dy );
- Rx = ( ras.precision * Dx ) % Dy;
- Dx = 1;
- }
- else
+ Dx = x2 - x1;
+ Dy = y2 - y1;
+
+ if ( Dx == 0 ) /* very easy */
{
- Ix = -SMulDiv_No_Round( ras.precision, -Dx, Dy );
- Rx = ( ras.precision * -Dx ) % Dy;
- Dx = -1;
+ do
+ *top++ = x1;
+ while ( --size );
+ goto Fin;
}
- Ax = -Dy;
- top = ras.top;
+ Ix = SMulDiv_No_Round( e - y1, Dx, Dy );
+ x1 += Ix;
+ *top++ = x1;
- while ( size > 0 )
+ if ( --size )
{
- *top++ = x1;
+ Ax = Dx * ( e - y1 ) - Dy * Ix; /* remainder */
+ Ix = FMulDiv( ras.precision, Dx, Dy );
+ Rx = Dx * ras.precision - Dy * Ix; /* remainder */
+ Dx = 1;
- x1 += Ix;
- Ax += Rx;
- if ( Ax >= 0 )
+ if ( x2 < x1 )
{
- Ax -= Dy;
- x1 += Dx;
+ Ax = -Ax;
+ Rx = -Rx;
+ Dx = -Dx;
}
- size--;
+
+ do
+ {
+ x1 += Ix;
+ Ax += Rx;
+ if ( Ax >= Dy )
+ {
+ Ax -= Dy;
+ x1 += Dx;
+ }
+ *top++ = x1;
+ }
+ while ( --size );
}
+ Fin:
ras.top = top;
return SUCCESS;
}
@@ -1131,17 +1044,7 @@
Long miny,
Long maxy )
{
- Bool result, fresh;
-
-
- fresh = ras.fresh;
-
- result = Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
-
- if ( fresh && !ras.fresh )
- ras.cProfile->start = -ras.cProfile->start;
-
- return result;
+ return Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
}
@@ -1181,105 +1084,73 @@
Long miny,
Long maxy )
{
- Long y1, y2, e, e2, e0;
- Short f1;
+ Long y1, y2, e, e2, dy;
+ Long dx, x2;
- TPoint* start_arc;
-
- PLong top;
+ PLong top;
y1 = arc[degree].y;
y2 = arc[0].y;
- top = ras.top;
if ( y2 < miny || y1 > maxy )
- goto Fin;
-
- e2 = FLOOR( y2 );
-
- if ( e2 > maxy )
- e2 = maxy;
-
- e0 = miny;
-
- if ( y1 < miny )
- e = miny;
- else
- {
- e = CEILING( y1 );
- f1 = (Short)( FRAC( y1 ) );
- e0 = e;
-
- if ( f1 == 0 )
- {
- if ( ras.joint )
- {
- top--;
- ras.joint = FALSE;
- }
+ return SUCCESS;
- *top++ = arc[degree].x;
+ e2 = y2 > maxy ? maxy : FLOOR( y2 );
+ e = y1 < miny ? miny : CEILING( y1 );
- e += ras.precision;
- }
- }
+ if ( y1 == e )
+ e += ras.precision;
- if ( ras.fresh )
- {
- ras.cProfile->start = TRUNC( e0 );
- ras.fresh = FALSE;
- }
+ if ( e2 < e ) /* nothing to do */
+ return SUCCESS;
- if ( e2 < e )
- goto Fin;
+ top = ras.top;
if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )
{
- ras.top = top;
ras.error = FT_THROW( Raster_Overflow );
return FAILURE;
}
- start_arc = arc;
-
do
{
- ras.joint = FALSE;
-
y2 = arc[0].y;
+ x2 = arc[0].x;
if ( y2 > e )
{
- y1 = arc[degree].y;
- if ( y2 - y1 >= ras.precision_step )
+ dy = y2 - arc[degree].y;
+ dx = x2 - arc[degree].x;
+
+ /* split condition should be invariant of direction */
+ if ( dy > ras.precision_step ||
+ dx > ras.precision_step ||
+ -dx > ras.precision_step )
{
splitter( arc );
arc += degree;
}
else
{
- *top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,
- e - y1, y2 - y1 );
+ *top++ = x2 - FMulDiv( y2 - e, dx, dy );
+ e += ras.precision;
arc -= degree;
- e += ras.precision;
}
}
else
{
if ( y2 == e )
{
- ras.joint = TRUE;
- *top++ = arc[0].x;
-
- e += ras.precision;
+ *top++ = x2;
+ e += ras.precision;
}
- arc -= degree;
+ arc -= degree;
}
- } while ( arc >= start_arc && e <= e2 );
+ }
+ while ( e <= e2 );
- Fin:
- ras.top = top;
+ ras.top = top;
return SUCCESS;
}
@@ -1316,7 +1187,7 @@
Long miny,
Long maxy )
{
- Bool result, fresh;
+ Bool result;
arc[0].y = -arc[0].y;
@@ -1325,13 +1196,8 @@
if ( degree > 2 )
arc[3].y = -arc[3].y;
- fresh = ras.fresh;
-
result = Bezier_Up( RAS_VARS degree, arc, splitter, -maxy, -miny );
- if ( fresh && !ras.fresh )
- ras.cProfile->start = -ras.cProfile->start;
-
arc[0].y = -arc[0].y;
return result;
}
@@ -1362,74 +1228,50 @@
Line_To( RAS_ARGS Long x,
Long y )
{
- /* First, detect a change of direction */
+ TStates state;
- switch ( ras.state )
- {
- case Unknown_State:
- if ( y > ras.lastY )
- {
- if ( New_Profile( RAS_VARS Ascending_State,
- IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
- return FAILURE;
- }
- else
- {
- if ( y < ras.lastY )
- if ( New_Profile( RAS_VARS Descending_State,
- IS_TOP_OVERSHOOT( ras.lastY ) ) )
- return FAILURE;
- }
- break;
- case Ascending_State:
- if ( y < ras.lastY )
- {
- if ( End_Profile( RAS_VARS IS_TOP_OVERSHOOT( ras.lastY ) ) ||
- New_Profile( RAS_VARS Descending_State,
- IS_TOP_OVERSHOOT( ras.lastY ) ) )
- return FAILURE;
- }
- break;
+ if ( y == ras.lastY )
+ goto Fin;
- case Descending_State:
- if ( y > ras.lastY )
- {
- if ( End_Profile( RAS_VARS IS_BOTTOM_OVERSHOOT( ras.lastY ) ) ||
- New_Profile( RAS_VARS Ascending_State,
- IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
- return FAILURE;
- }
- break;
+ /* First, detect a change of direction */
- default:
- ;
+ state = ras.lastY < y ? Ascending_State : Descending_State;
+
+ if ( ras.state != state )
+ {
+ /* finalize current profile if any */
+ if ( ras.state != Unknown_State &&
+ End_Profile( RAS_VAR ) )
+ goto Fail;
+
+ /* create a new profile */
+ if ( New_Profile( RAS_VARS state ) )
+ goto Fail;
}
/* Then compute the lines */
- switch ( ras.state )
+ if ( state == Ascending_State )
{
- case Ascending_State:
if ( Line_Up( RAS_VARS ras.lastX, ras.lastY,
x, y, ras.minY, ras.maxY ) )
- return FAILURE;
- break;
-
- case Descending_State:
+ goto Fail;
+ }
+ else
+ {
if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,
x, y, ras.minY, ras.maxY ) )
- return FAILURE;
- break;
-
- default:
- ;
+ goto Fail;
}
+ Fin:
ras.lastX = x;
ras.lastY = y;
-
return SUCCESS;
+
+ Fail:
+ return FAILURE;
}
@@ -1500,7 +1342,7 @@
ymax = y1;
}
- if ( y2 < ymin || y2 > ymax )
+ if ( y2 < FLOOR( ymin ) || y2 > CEILING( ymax ) )
{
/* this arc has no given direction, split it! */
Split_Conic( arc );
@@ -1508,8 +1350,12 @@
}
else if ( y1 == y3 )
{
- /* this arc is flat, ignore it and pop it from the Bezier stack */
+ /* this arc is flat, advance position */
+ /* and pop it from the Bezier stack */
arc -= 2;
+
+ ras.lastX = x3;
+ ras.lastY = y3;
}
else
{
@@ -1518,18 +1364,13 @@
state_bez = y1 < y3 ? Ascending_State : Descending_State;
if ( ras.state != state_bez )
{
- Bool o = ( state_bez == Ascending_State )
- ? IS_BOTTOM_OVERSHOOT( y1 )
- : IS_TOP_OVERSHOOT( y1 );
-
-
/* finalize current profile if any */
if ( ras.state != Unknown_State &&
- End_Profile( RAS_VARS o ) )
+ End_Profile( RAS_VAR ) )
goto Fail;
/* create a new profile */
- if ( New_Profile( RAS_VARS state_bez, o ) )
+ if ( New_Profile( RAS_VARS state_bez ) )
goto Fail;
}
@@ -1545,13 +1386,13 @@
ras.minY, ras.maxY ) )
goto Fail;
arc -= 2;
+
+ ras.lastX = x3;
+ ras.lastY = y3;
}
} while ( arc >= arcs );
- ras.lastX = x3;
- ras.lastY = y3;
-
return SUCCESS;
Fail:
@@ -1648,7 +1489,7 @@
ymax2 = y2;
}
- if ( ymin2 < ymin1 || ymax2 > ymax1 )
+ if ( ymin2 < FLOOR( ymin1 ) || ymax2 > CEILING( ymax1 ) )
{
/* this arc has no given direction, split it! */
Split_Cubic( arc );
@@ -1656,27 +1497,26 @@
}
else if ( y1 == y4 )
{
- /* this arc is flat, ignore it and pop it from the Bezier stack */
+ /* this arc is flat, advance position */
+ /* and pop it from the Bezier stack */
arc -= 3;
+
+ ras.lastX = x4;
+ ras.lastY = y4;
}
else
{
- state_bez = ( y1 <= y4 ) ? Ascending_State : Descending_State;
+ state_bez = y1 < y4 ? Ascending_State : Descending_State;
/* detect a change of direction */
if ( ras.state != state_bez )
{
- Bool o = ( state_bez == Ascending_State )
- ? IS_BOTTOM_OVERSHOOT( y1 )
- : IS_TOP_OVERSHOOT( y1 );
-
-
/* finalize current profile if any */
if ( ras.state != Unknown_State &&
- End_Profile( RAS_VARS o ) )
+ End_Profile( RAS_VAR ) )
goto Fail;
- if ( New_Profile( RAS_VARS state_bez, o ) )
+ if ( New_Profile( RAS_VARS state_bez ) )
goto Fail;
}
@@ -1692,13 +1532,13 @@
ras.minY, ras.maxY ) )
goto Fail;
arc -= 3;
+
+ ras.lastX = x4;
+ ras.lastY = y4;
}
} while ( arc >= arcs );
- ras.lastX = x4;
- ras.lastY = y4;
-
return SUCCESS;
Fail:
@@ -1740,6 +1580,11 @@
*
* @Return:
* SUCCESS on success, FAILURE on error.
+ *
+ * @Note:
+ * Unlike FT_Outline_Decompose(), this function handles the scanmode
+ * dropout tags in the individual contours. Therefore, it cannot be
+ * replaced.
*/
static Bool
Decompose_Curve( RAS_ARGS Int first,
@@ -1753,7 +1598,7 @@
FT_Vector* points;
FT_Vector* point;
FT_Vector* limit;
- char* tags;
+ FT_Byte* tags;
UInt tag; /* current point's state */
@@ -1974,24 +1819,17 @@
ras.fProfile = NULL;
- ras.joint = FALSE;
- ras.fresh = FALSE;
-
- ras.maxBuff = ras.sizeBuff - AlignProfileSize;
+ ras.cProfile = NULL;
- ras.numTurns = 0;
+ ras.top = ras.buff;
+ ras.maxBuff = ras.sizeBuff - 1; /* top reserve */
- ras.cProfile = (PProfile)ras.top;
- ras.cProfile->offset = ras.top;
- ras.num_Profs = 0;
+ ras.numTurns = 0;
+ ras.num_Profs = 0;
last = -1;
for ( i = 0; i < ras.outline.n_contours; i++ )
{
- PProfile lastProfile;
- Bool o;
-
-
ras.state = Unknown_State;
ras.gProfile = NULL;
@@ -2001,35 +1839,30 @@
if ( Decompose_Curve( RAS_VARS first, last, flipped ) )
return FAILURE;
+ /* Note that ras.gProfile can stay nil if the contour was */
+ /* too small to be drawn or degenerate. */
+ if ( !ras.gProfile )
+ continue;
+
/* we must now check whether the extreme arcs join or not */
if ( FRAC( ras.lastY ) == 0 &&
ras.lastY >= ras.minY &&
ras.lastY <= ras.maxY )
- if ( ras.gProfile &&
- ( ras.gProfile->flags & Flow_Up ) ==
+ if ( ( ras.gProfile->flags & Flow_Up ) ==
( ras.cProfile->flags & Flow_Up ) )
ras.top--;
- /* Note that ras.gProfile can be nil if the contour was too small */
- /* to be drawn. */
- lastProfile = ras.cProfile;
- if ( ras.top != ras.cProfile->offset &&
- ( ras.cProfile->flags & Flow_Up ) )
- o = IS_TOP_OVERSHOOT( ras.lastY );
- else
- o = IS_BOTTOM_OVERSHOOT( ras.lastY );
- if ( End_Profile( RAS_VARS o ) )
+ if ( End_Profile( RAS_VAR ) )
return FAILURE;
- /* close the `next profile in contour' linked list */
- if ( ras.gProfile )
- lastProfile->next = ras.gProfile;
+ if ( !ras.fProfile )
+ ras.fProfile = ras.gProfile;
}
- if ( Finalize_Profile_Table( RAS_VAR ) )
- return FAILURE;
+ if ( ras.fProfile )
+ Finalize_Profile_Table( RAS_VAR );
- return (Bool)( ras.top < ras.maxBuff ? SUCCESS : FAILURE );
+ return SUCCESS;
}
@@ -2044,22 +1877,9 @@
/**************************************************************************
*
- * Init_Linked
- *
- * Initializes an empty linked list.
- */
- static void
- Init_Linked( TProfileList* l )
- {
- *l = NULL;
- }
-
-
- /**************************************************************************
- *
* InsNew
*
- * Inserts a new profile in a linked list.
+ * Inserts a new profile in a linked list, sorted by coordinate.
*/
static void
InsNew( PProfileList list,
@@ -2073,10 +1893,8 @@
current = *old;
x = profile->X;
- while ( current )
+ while ( current && current->X < x )
{
- if ( x < current->X )
- break;
old = &current->link;
current = *old;
}
@@ -2088,79 +1906,51 @@
/**************************************************************************
*
- * DelOld
+ * Increment
*
- * Removes an old profile from a linked list.
+ * Advances all profile in the list to the next scanline. It also
+ * sorts the trace list in the unlikely case of profile crossing.
+ * The profiles are inserted in sorted order. We might need a single
+ * swap to fix it when profiles (contours) cross.
+ * Bubble sort with immediate restart is good enough and simple.
*/
static void
- DelOld( PProfileList list,
- const PProfile profile )
+ Increment( PProfileList list,
+ Int flow )
{
- PProfile *old, current;
-
+ PProfile *old, current, next;
- old = list;
- current = *old;
- while ( current )
+ /* First, set the new X coordinates and remove exhausted profiles */
+ old = list;
+ while ( *old )
{
- if ( current == profile )
+ current = *old;
+ if ( --current->height )
{
- *old = current->link;
- return;
+ current->offset += flow;
+ current->X = current->x[current->offset];
+ old = &current->link;
}
-
- old = &current->link;
- current = *old;
- }
-
- /* we should never get there, unless the profile was not part of */
- /* the list. */
- }
-
-
- /**************************************************************************
- *
- * 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 )
- {
- PProfile *old, current, next;
-
-
- /* First, set the new X coordinate of each profile */
- current = *list;
- while ( current )
- {
- current->X = *current->offset;
- current->offset += ( current->flags & Flow_Up ) ? 1 : -1;
- current->height--;
- current = current->link;
+ else
+ *old = current->link; /* remove */
}
- /* Then sort them */
+ /* Then make sure the list remains sorted */
old = list;
current = *old;
if ( !current )
return;
- next = current->link;
-
- while ( next )
+ while ( current->link )
{
+ next = current->link;
+
if ( current->X <= next->X )
{
old = &current->link;
- current = *old;
-
- if ( !current )
- return;
+ current = next;
}
else
{
@@ -2168,11 +1958,10 @@
current->link = next->link;
next->link = current;
+ /* this is likely the only necessary swap -- restart */
old = list;
current = *old;
}
-
- next = current->link;
}
}
@@ -2187,74 +1976,51 @@
*/
static void
- Vertical_Sweep_Init( RAS_ARGS Short min,
- Short max )
+ Vertical_Sweep_Init( RAS_ARGS Int min,
+ Int max )
{
FT_UNUSED( max );
- ras.bLine = ras.bOrigin - min * ras.target.pitch;
+ ras.bLine = ras.bOrigin - min * ras.bPitch;
}
static void
- Vertical_Sweep_Span( RAS_ARGS Short y,
+ Vertical_Sweep_Span( RAS_ARGS Int y,
FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right )
+ FT_F26Dot6 x2 )
{
- Long e1, e2;
-
- Int dropOutControl = left->flags & 7;
+ Int e1 = (Int)TRUNC( CEILING( x1 ) );
+ Int e2 = (Int)TRUNC( FLOOR( x2 ) );
FT_UNUSED( y );
- FT_UNUSED( left );
- FT_UNUSED( right );
- /* in high-precision mode, we need 12 digits after the comma to */
- /* represent multiples of 1/(1<<12) = 1/4096 */
- FT_TRACE7(( " y=%d x=[% .12f;% .12f]",
+ FT_TRACE7(( " y=%d x=[% .*f;% .*f]",
y,
- (double)x1 / (double)ras.precision,
- (double)x2 / (double)ras.precision ));
+ ras.precision_bits, (double)x1 / (double)ras.precision,
+ ras.precision_bits, (double)x2 / (double)ras.precision ));
- /* Drop-out control */
-
- 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 &&
- e1 != x1 && e2 != x2 )
- e2 = e1;
-
- e1 = TRUNC( e1 );
- e2 = TRUNC( e2 );
-
- if ( e2 >= 0 && e1 < ras.bWidth )
+ if ( e2 >= 0 && e1 <= ras.bRight )
{
- Byte* target;
+ PByte target;
- Int c1, c2;
- Byte f1, f2;
+ Int c1, f1, c2, f2;
if ( e1 < 0 )
e1 = 0;
- if ( e2 >= ras.bWidth )
- e2 = ras.bWidth - 1;
+ if ( e2 > ras.bRight )
+ e2 = ras.bRight;
- FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 ));
+ FT_TRACE7(( " -> x=[%d;%d]", e1, e2 ));
- c1 = (Short)( e1 >> 3 );
- c2 = (Short)( e2 >> 3 );
+ c1 = e1 >> 3;
+ c2 = e2 >> 3;
- f1 = (Byte) ( 0xFF >> ( e1 & 7 ) );
- f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
+ f1 = 0xFF >> ( e1 & 7 );
+ f2 = ~0x7F >> ( e2 & 7 );
target = ras.bLine + c1;
c2 -= c1;
@@ -2280,163 +2046,50 @@
static void
- Vertical_Sweep_Drop( RAS_ARGS Short y,
+ Vertical_Sweep_Drop( RAS_ARGS Int y,
FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right )
+ FT_F26Dot6 x2 )
{
- Long e1, e2, pxl;
- Short c1, f1;
-
-
- FT_TRACE7(( " y=%d x=[% .12f;% .12f]",
- y,
- (double)x1 / (double)ras.precision,
- (double)x2 / (double)ras.precision ));
-
- /* Drop-out control */
-
- /* e2 x2 x1 e1 */
- /* */
- /* ^ | */
- /* | | */
- /* +-------------+---------------------+------------+ */
- /* | | */
- /* | v */
- /* */
- /* pixel contour contour pixel */
- /* center center */
-
- /* drop-out mode scan conversion rules (as defined in OpenType) */
- /* --------------------------------------------------------------- */
- /* 0 1, 2, 3 */
- /* 1 1, 2, 4 */
- /* 2 1, 2 */
- /* 3 same as mode 2 */
- /* 4 1, 2, 5 */
- /* 5 1, 2, 6 */
- /* 6, 7 same as mode 2 */
-
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
- pxl = e1;
-
- if ( e1 > e2 )
- {
- Int dropOutControl = left->flags & 7;
+ Int e1 = (Int)TRUNC( x1 );
+ Int e2 = (Int)TRUNC( x2 );
+ Int c1, f1;
+ FT_UNUSED( y );
- if ( e1 == e2 + ras.precision )
- {
- switch ( dropOutControl )
- {
- case 0: /* simple drop-outs including stubs */
- pxl = e2;
- break;
-
- case 4: /* smart drop-outs including stubs */
- pxl = SMART( x1, x2 );
- break;
-
- case 1: /* simple drop-outs excluding stubs */
- case 5: /* smart drop-outs excluding stubs */
-
- /* Drop-out Control Rules #4 and #6 */
-
- /* The specification neither provides an exact definition */
- /* of a `stub' nor gives exact rules to exclude them. */
- /* */
- /* Here the constraints we use to recognize a stub. */
- /* */
- /* upper stub: */
- /* */
- /* - P_Left and P_Right are in the same contour */
- /* - P_Right is the successor of P_Left in that contour */
- /* - y is the top of P_Left and P_Right */
- /* */
- /* lower stub: */
- /* */
- /* - P_Left and P_Right are in the same contour */
- /* - P_Left is the successor of P_Right in that contour */
- /* - y is the bottom of P_Left */
- /* */
- /* We draw a stub if the following constraints are met. */
- /* */
- /* - for an upper or lower stub, there is top or bottom */
- /* overshoot, respectively */
- /* - the covered interval is greater or equal to a half */
- /* pixel */
-
- /* upper stub test */
- if ( left->next == right &&
- left->height <= 0 &&
- !( left->flags & Overshoot_Top &&
- x2 - x1 >= ras.precision_half ) )
- goto Exit;
-
- /* lower stub test */
- if ( right->next == left &&
- left->start == y &&
- !( left->flags & Overshoot_Bottom &&
- x2 - x1 >= ras.precision_half ) )
- goto Exit;
-
- if ( dropOutControl == 1 )
- pxl = e2;
- else
- pxl = SMART( x1, x2 );
- break;
-
- default: /* modes 2, 3, 6, 7 */
- goto Exit; /* no drop-out control */
- }
-
- /* undocumented but confirmed: If the drop-out would result in a */
- /* pixel outside of the bounding box, use the pixel inside of the */
- /* bounding box instead */
- if ( pxl < 0 )
- pxl = e1;
- else if ( TRUNC( pxl ) >= ras.bWidth )
- pxl = e2;
-
- /* check that the other pixel isn't set */
- e1 = ( pxl == e1 ) ? e2 : e1;
- e1 = TRUNC( e1 );
+ /* undocumented but confirmed: If the drop-out would result in a */
+ /* pixel outside of the bounding box, use the pixel inside of the */
+ /* bounding box instead */
+ if ( e1 < 0 || e1 > ras.bRight )
+ e1 = e2;
- c1 = (Short)( e1 >> 3 );
- f1 = (Short)( e1 & 7 );
+ /* otherwise check that the other pixel isn't set */
+ else if ( e2 >=0 && e2 <= ras.bRight )
+ {
+ c1 = e2 >> 3;
+ f1 = 0x80 >> ( e2 & 7 );
- if ( e1 >= 0 && e1 < ras.bWidth &&
- ras.bLine[c1] & ( 0x80 >> f1 ) )
- goto Exit;
- }
- else
- goto Exit;
+ if ( ras.bLine[c1] & f1 )
+ return;
}
- e1 = TRUNC( pxl );
-
- if ( e1 >= 0 && e1 < ras.bWidth )
+ if ( e1 >= 0 && e1 <= ras.bRight )
{
- FT_TRACE7(( " -> x=%ld", e1 ));
+ c1 = e1 >> 3;
+ f1 = 0x80 >> ( e1 & 7 );
- c1 = (Short)( e1 >> 3 );
- f1 = (Short)( e1 & 7 );
+ FT_TRACE7(( " y=%d x=%d%s\n", y, e1,
+ ras.bLine[c1] & f1 ? " redundant" : "" ));
- ras.bLine[c1] |= (char)( 0x80 >> f1 );
+ ras.bLine[c1] |= f1;
}
-
- Exit:
- FT_TRACE7(( " dropout=%d\n", left->flags & 7 ));
}
static void
Vertical_Sweep_Step( RAS_ARG )
{
- ras.bLine -= ras.target.pitch;
+ ras.bLine -= ras.bPitch;
}
@@ -2450,8 +2103,8 @@
*/
static void
- Horizontal_Sweep_Init( RAS_ARGS Short min,
- Short max )
+ Horizontal_Sweep_Init( RAS_ARGS Int min,
+ Int max )
{
/* nothing, really */
FT_UNUSED_RASTER;
@@ -2461,22 +2114,18 @@
static void
- Horizontal_Sweep_Span( RAS_ARGS Short y,
+ Horizontal_Sweep_Span( RAS_ARGS Int y,
FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right )
+ FT_F26Dot6 x2 )
{
- Long e1, e2;
-
- FT_UNUSED( left );
- FT_UNUSED( right );
+ Long e1 = CEILING( x1 );
+ Long e2 = FLOOR( x2 );
- FT_TRACE7(( " x=%d y=[% .12f;% .12f]",
+ FT_TRACE7(( " x=%d y=[% .*f;% .*f]",
y,
- (double)x1 / (double)ras.precision,
- (double)x2 / (double)ras.precision ));
+ ras.precision_bits, (double)x1 / (double)ras.precision,
+ ras.precision_bits, (double)x2 / (double)ras.precision ));
/* We should not need this procedure but the vertical sweep */
/* mishandles horizontal lines through pixel centers. So we */
@@ -2484,20 +2133,18 @@
/* */
/* XXX: Can we handle horizontal lines better and drop this? */
- e1 = CEILING( x1 );
-
if ( x1 == e1 )
{
e1 = TRUNC( e1 );
- if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
+ if ( e1 >= 0 && e1 <= ras.bTop )
{
- Byte f1;
+ Int f1;
PByte bits;
- bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
+ bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.bPitch;
+ f1 = 0x80 >> ( y & 7 );
FT_TRACE7(( bits[0] & f1 ? " redundant"
: " -> y=%ld edge", e1 ));
@@ -2506,20 +2153,18 @@
}
}
- e2 = FLOOR ( x2 );
-
if ( x2 == e2 )
{
e2 = TRUNC( e2 );
- if ( e2 >= 0 && (ULong)e2 < ras.target.rows )
+ if ( e2 >= 0 && e2 <= ras.bTop )
{
- Byte f1;
+ Int f1;
PByte bits;
- bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.target.pitch;
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
+ bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.bPitch;
+ f1 = 0x80 >> ( y & 7 );
FT_TRACE7(( bits[0] & f1 ? " redundant"
: " -> y=%ld edge", e2 ));
@@ -2533,122 +2178,42 @@
static void
- Horizontal_Sweep_Drop( RAS_ARGS Short y,
+ Horizontal_Sweep_Drop( RAS_ARGS Int y,
FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right )
+ FT_F26Dot6 x2 )
{
- Long e1, e2, pxl;
+ Int e1 = (Int)TRUNC( x1 );
+ Int e2 = (Int)TRUNC( x2 );
PByte bits;
- Byte f1;
-
-
- FT_TRACE7(( " x=%d y=[% .12f;% .12f]",
- y,
- (double)x1 / (double)ras.precision,
- (double)x2 / (double)ras.precision ));
-
- /* During the horizontal sweep, we only take care of drop-outs */
-
- /* e1 + <-- pixel center */
- /* | */
- /* x1 ---+--> <-- contour */
- /* | */
- /* | */
- /* x2 <--+--- <-- contour */
- /* | */
- /* | */
- /* e2 + <-- pixel center */
-
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
- pxl = e1;
-
- if ( e1 > e2 )
- {
- Int dropOutControl = left->flags & 7;
-
-
- if ( e1 == e2 + ras.precision )
- {
- switch ( dropOutControl )
- {
- case 0: /* simple drop-outs including stubs */
- pxl = e2;
- break;
-
- case 4: /* smart drop-outs including stubs */
- pxl = SMART( x1, x2 );
- break;
-
- case 1: /* simple drop-outs excluding stubs */
- case 5: /* smart drop-outs excluding stubs */
- /* see Vertical_Sweep_Drop for details */
-
- /* rightmost stub test */
- if ( left->next == right &&
- left->height <= 0 &&
- !( left->flags & Overshoot_Top &&
- x2 - x1 >= ras.precision_half ) )
- goto Exit;
-
- /* leftmost stub test */
- if ( right->next == left &&
- left->start == y &&
- !( left->flags & Overshoot_Bottom &&
- x2 - x1 >= ras.precision_half ) )
- goto Exit;
-
- if ( dropOutControl == 1 )
- pxl = e2;
- else
- pxl = SMART( x1, x2 );
- break;
-
- default: /* modes 2, 3, 6, 7 */
- goto Exit; /* no drop-out control */
- }
-
- /* undocumented but confirmed: If the drop-out would result in a */
- /* pixel outside of the bounding box, use the pixel inside of the */
- /* bounding box instead */
- if ( pxl < 0 )
- pxl = e1;
- else if ( (ULong)( TRUNC( pxl ) ) >= ras.target.rows )
- pxl = e2;
+ Int f1;
- /* check that the other pixel isn't set */
- e1 = ( pxl == e1 ) ? e2 : e1;
- e1 = TRUNC( e1 );
+ /* undocumented but confirmed: If the drop-out would result in a */
+ /* pixel outside of the bounding box, use the pixel inside of the */
+ /* bounding box instead */
+ if ( e1 < 0 || e1 > ras.bTop )
+ e1 = e2;
- bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
+ /* otherwise check that the other pixel isn't set */
+ else if ( e2 >=0 && e2 <= ras.bTop )
+ {
+ bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.bPitch;
+ f1 = 0x80 >> ( y & 7 );
- if ( e1 >= 0 &&
- (ULong)e1 < ras.target.rows &&
- *bits & f1 )
- goto Exit;
- }
- else
- goto Exit;
+ if ( *bits & f1 )
+ return;
}
- e1 = TRUNC( pxl );
-
- if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
+ if ( e1 >= 0 && e1 <= ras.bTop )
{
- FT_TRACE7(( " -> y=%ld", e1 ));
+ bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.bPitch;
+ f1 = 0x80 >> ( y & 7 );
- bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
+ FT_TRACE7(( " x=%d y=%d%s\n", y, e1,
+ *bits & f1 ? " redundant" : "" ));
- bits[0] |= f1;
+ *bits |= f1;
}
-
- Exit:
- FT_TRACE7(( " dropout=%d\n", left->flags & 7 ));
}
@@ -2664,116 +2229,61 @@
*
* Generic Sweep Drawing routine
*
+ * Note that this routine is executed with the pool containing at least
+ * two valid profiles (up and down) and two y-turns (top and bottom).
+ *
*/
- static Bool
+ static void
Draw_Sweep( RAS_ARG )
{
- Short y, y_change, y_height;
-
- PProfile P, Q, P_Left, P_Right;
-
- Short min_Y, max_Y, top, bottom, dropouts;
-
- Long x1, x2, xs, e1, e2;
+ Int min_Y, max_Y, dropouts;
+ Int y, y_turn;
- TProfileList waiting;
- TProfileList draw_left, draw_right;
+ PProfile *Q, P, P_Left, P_Right;
+ TProfileList waiting = ras.fProfile;
+ TProfileList draw_left = NULL;
+ TProfileList draw_right = NULL;
- /* initialize empty linked lists */
- Init_Linked( &waiting );
+ /* use y_turns to set the drawing range */
- Init_Linked( &draw_left );
- Init_Linked( &draw_right );
-
- /* first, compute min and max Y */
-
- P = ras.fProfile;
- max_Y = (Short)TRUNC( ras.minY );
- min_Y = (Short)TRUNC( ras.maxY );
-
- while ( P )
- {
- Q = P->link;
-
- bottom = (Short)P->start;
- top = (Short)( P->start + P->height - 1 );
-
- if ( min_Y > bottom )
- min_Y = bottom;
- if ( max_Y < top )
- max_Y = top;
-
- P->X = 0;
- InsNew( &waiting, P );
-
- P = Q;
- }
-
- /* check the Y-turns */
- if ( ras.numTurns == 0 )
- {
- ras.error = FT_THROW( Invalid_Outline );
- return FAILURE;
- }
+ min_Y = (Int)ras.maxBuff[0];
+ max_Y = (Int)ras.maxBuff[ras.numTurns] - 1;
/* now initialize the sweep */
ras.Proc_Sweep_Init( RAS_VARS min_Y, max_Y );
- /* then compute the distance of each profile from min_Y */
-
- P = waiting;
-
- while ( P )
- {
- P->countL = P->start - min_Y;
- P = P->link;
- }
-
/* let's go */
- y = min_Y;
- y_height = 0;
-
- if ( ras.numTurns > 0 &&
- ras.sizeBuff[-ras.numTurns] == min_Y )
- ras.numTurns--;
-
- while ( ras.numTurns > 0 )
+ for ( y = min_Y; y <= max_Y; )
{
- /* check waiting list for new activations */
-
- P = waiting;
+ /* check waiting list for new profile activations */
- while ( P )
+ Q = &waiting;
+ while ( *Q )
{
- Q = P->link;
- P->countL -= y_height;
- if ( P->countL == 0 )
+ P = *Q;
+ if ( P->start == y )
{
- DelOld( &waiting, P );
+ *Q = P->link; /* remove */
+ /* each active list contains profiles with the same flow */
+ /* left and right are arbitrary, correspond to TrueType */
if ( P->flags & Flow_Up )
InsNew( &draw_left, P );
else
InsNew( &draw_right, P );
}
-
- P = Q;
+ else
+ Q = &P->link;
}
- /* sort the drawing lists */
-
- Sort( &draw_left );
- Sort( &draw_right );
-
- y_change = (Short)ras.sizeBuff[-ras.numTurns--];
- y_height = (Short)( y_change - y );
+ y_turn = (Int)*++ras.maxBuff;
- while ( y < y_change )
+ do
{
/* let's trace */
@@ -2784,9 +2294,13 @@
while ( P_Left && P_Right )
{
- x1 = P_Left ->X;
- x2 = P_Right->X;
+ Long x1 = P_Left ->X;
+ Long x2 = P_Right->X;
+ Long xs;
+
+ /* TrueType should have x2 > x1, but can be opposite */
+ /* by mistake or in CFF/Type1, fix it then */
if ( x1 > x2 )
{
xs = x1;
@@ -2794,205 +2308,130 @@
x2 = xs;
}
- e1 = FLOOR( x1 );
- e2 = CEILING( x2 );
+ if ( CEILING( x1 ) <= FLOOR( x2 ) )
+ ras.Proc_Sweep_Span( RAS_VARS y, x1, x2 );
- if ( x2 - x1 <= ras.precision &&
- e1 != x1 && e2 != x2 )
+ /* otherwise, bottom ceiling > top floor, it is a drop-out */
+ else
{
- if ( e1 > e2 || e2 == e1 + ras.precision )
+ Int dropOutControl = P_Left->flags & 7;
+
+
+ /* Drop-out control */
+
+ /* e2 x2 x1 e1 */
+ /* */
+ /* ^ | */
+ /* | | */
+ /* +-------------+---------------------+------------+ */
+ /* | | */
+ /* | v */
+ /* */
+ /* pixel contour contour pixel */
+ /* center center */
+
+ /* drop-out mode scan conversion rules (OpenType specs) */
+ /* ------------------------------------------------------- */
+ /* bit 0 exclude stubs if set */
+ /* bit 1 ignore drop-outs if set */
+ /* bit 2 smart rounding if set */
+
+ if ( dropOutControl & 2 )
+ goto Next_Pair;
+
+ /* The specification neither provides an exact definition */
+ /* of a `stub' nor gives exact rules to exclude them. */
+ /* */
+ /* Here the constraints we use to recognize a stub. */
+ /* */
+ /* upper stub: */
+ /* */
+ /* - P_Left and P_Right are in the same contour */
+ /* - P_Right is the successor of P_Left in that contour */
+ /* - y is the top of P_Left and P_Right */
+ /* */
+ /* lower stub: */
+ /* */
+ /* - P_Left and P_Right are in the same contour */
+ /* - P_Left is the successor of P_Right in that contour */
+ /* - y is the bottom of P_Left */
+ /* */
+ /* We draw a stub if the following constraints are met. */
+ /* */
+ /* - for an upper or lower stub, there is top or bottom */
+ /* overshoot, respectively */
+ /* - the covered interval is greater or equal to a half */
+ /* pixel */
+
+ if ( dropOutControl & 1 )
{
- Int dropOutControl = P_Left->flags & 7;
-
-
- if ( dropOutControl != 2 )
- {
- /* a drop-out was detected */
-
- P_Left ->X = x1;
- P_Right->X = x2;
-
- /* mark profile for drop-out processing */
- P_Left->countL = 1;
- dropouts++;
- }
+ /* upper stub test */
+ if ( P_Left->height == 1 &&
+ P_Left->next == P_Right &&
+ !( P_Left->flags & Overshoot_Top &&
+ x2 - x1 >= ras.precision_half ) )
+ goto Next_Pair;
+
+ /* lower stub test */
+ if ( P_Left->offset == 0 &&
+ P_Right->next == P_Left &&
+ !( P_Left->flags & Overshoot_Bottom &&
+ x2 - x1 >= ras.precision_half ) )
+ goto Next_Pair;
+ }
- goto Skip_To_Next;
+ /* select the pixel to set and the other pixel */
+ if ( dropOutControl & 4 )
+ {
+ x2 = SMART( x1, x2 );
+ x1 = x1 > x2 ? x2 + ras.precision : x2 - ras.precision;
+ }
+ else
+ {
+ x2 = FLOOR ( x2 );
+ x1 = CEILING( x1 );
}
- }
- ras.Proc_Sweep_Span( RAS_VARS y, x1, x2, P_Left, P_Right );
+ P_Left ->X = x2;
+ P_Right->X = x1;
- Skip_To_Next:
+ /* mark profile for drop-out processing */
+ P_Left->flags |= Dropout;
+ dropouts++;
+ }
+ Next_Pair:
P_Left = P_Left->link;
P_Right = P_Right->link;
}
- /* handle drop-outs _after_ the span drawing -- */
- /* drop-out processing has been moved out of the loop */
- /* for performance tuning */
- if ( dropouts > 0 )
- goto Scan_DropOuts;
-
- Next_Line:
-
- ras.Proc_Sweep_Step( RAS_VAR );
-
- y++;
+ /* handle drop-outs _after_ the span drawing */
+ P_Left = draw_left;
+ P_Right = draw_right;
- if ( y < y_change )
+ while ( dropouts )
{
- Sort( &draw_left );
- Sort( &draw_right );
- }
- }
-
- /* now finalize the profiles that need it */
-
- P = draw_left;
- while ( P )
- {
- Q = P->link;
- if ( P->height == 0 )
- DelOld( &draw_left, P );
- P = Q;
- }
-
- P = draw_right;
- while ( P )
- {
- Q = P->link;
- if ( P->height == 0 )
- DelOld( &draw_right, P );
- P = Q;
- }
- }
-
- /* for gray-scaling, flush the bitmap scanline cache */
- while ( y <= max_Y )
- {
- ras.Proc_Sweep_Step( RAS_VAR );
- y++;
- }
-
- return SUCCESS;
-
- Scan_DropOuts:
-
- P_Left = draw_left;
- P_Right = draw_right;
-
- while ( P_Left && P_Right )
- {
- if ( P_Left->countL )
- {
- P_Left->countL = 0;
-#if 0
- dropouts--; /* -- this is useful when debugging only */
-#endif
- ras.Proc_Sweep_Drop( RAS_VARS y,
- P_Left->X,
- P_Right->X,
- P_Left,
- P_Right );
- }
-
- P_Left = P_Left->link;
- P_Right = P_Right->link;
- }
-
- goto Next_Line;
- }
-
-
-#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 )
- {
- if ( outline && acbox )
- {
- Long xMin, yMin, xMax, yMax;
-
-
- 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++;
+ if ( P_Left->flags & Dropout )
+ {
+ ras.Proc_Sweep_Drop( RAS_VARS y, P_Left->X, P_Right->X );
- for ( ; vec < limit; vec++ )
- {
- Long x, y;
+ P_Left->flags &= ~Dropout;
+ dropouts--;
+ }
+ P_Left = P_Left->link;
+ P_Right = P_Right->link;
+ }
- x = vec->x;
- if ( x < xMin ) xMin = x;
- if ( x > xMax ) xMax = x;
+ ras.Proc_Sweep_Step( RAS_VAR );
- y = vec->y;
- if ( y < yMin ) yMin = y;
- if ( y > yMax ) yMax = y;
- }
+ Increment( &draw_left, 1 );
+ Increment( &draw_right, -1 );
}
- acbox->xMin = xMin;
- acbox->xMax = xMax;
- acbox->yMin = yMin;
- acbox->yMax = yMax;
+ while ( ++y < y_turn );
}
}
-#endif /* STANDALONE_ */
-
/**************************************************************************
*
@@ -3019,13 +2458,15 @@
Int band_stack[32]; /* enough to bisect 32-bit int bands */
+ FT_TRACE6(( "%s pass [%d..%d]\n",
+ flipped ? "Horizontal" : "Vertical",
+ y_min, y_max ));
+
while ( 1 )
{
ras.minY = (Long)y_min * ras.precision;
ras.maxY = (Long)y_max * ras.precision;
- ras.top = ras.buff;
-
ras.error = Raster_Err_Ok;
if ( Convert_Glyph( RAS_VARS flipped ) )
@@ -3038,6 +2479,9 @@
if ( y_min == y_max )
return ras.error; /* still Raster_Overflow */
+ FT_TRACE6(( "band [%d..%d]: to be bisected\n",
+ y_min, y_max ));
+
y_mid = ( y_min + y_max ) >> 1;
band_stack[band_top++] = y_min;
@@ -3045,9 +2489,12 @@
}
else
{
+ FT_TRACE6(( "band [%d..%d]: %hd profiles; %td bytes remaining\n",
+ y_min, y_max, ras.num_Profs,
+ (char*)ras.maxBuff - (char*)ras.top ));
+
if ( ras.fProfile )
- if ( Draw_Sweep( RAS_VAR ) )
- return ras.error;
+ Draw_Sweep( RAS_VAR );
if ( --band_top < 0 )
break;
@@ -3076,53 +2523,48 @@
Render_Glyph( RAS_ARG )
{
FT_Error error;
+ Long buffer[FT_MAX_BLACK_POOL];
+
+ ras.buff = buffer;
+ ras.sizeBuff = (&buffer)[1]; /* Points to right after buffer. */
Set_High_Precision( RAS_VARS ras.outline.flags &
FT_OUTLINE_HIGH_PRECISION );
+ ras.dropOutControl = 0;
+
if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
- ras.dropOutControl = 2;
- else
- {
- if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
- ras.dropOutControl = 4;
- else
- ras.dropOutControl = 0;
+ ras.dropOutControl |= 2;
- if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
- ras.dropOutControl += 1;
- }
+ if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
+ ras.dropOutControl |= 4;
- /* Vertical Sweep */
- FT_TRACE7(( "Vertical pass (ftraster)\n" ));
+ if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
+ ras.dropOutControl |= 1;
+
+ FT_TRACE6(( "BW Raster: precision 1/%d, dropout mode %d\n",
+ ras.precision, ras.dropOutControl ));
+ /* Vertical Sweep */
ras.Proc_Sweep_Init = Vertical_Sweep_Init;
ras.Proc_Sweep_Span = Vertical_Sweep_Span;
ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
ras.Proc_Sweep_Step = Vertical_Sweep_Step;
- ras.bWidth = (UShort)ras.target.width;
- ras.bOrigin = (Byte*)ras.target.buffer;
-
- if ( ras.target.pitch > 0 )
- ras.bOrigin += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
-
- error = Render_Single_Pass( RAS_VARS 0, 0, (Int)ras.target.rows - 1 );
+ error = Render_Single_Pass( RAS_VARS 0, 0, ras.bTop );
if ( error )
return error;
/* Horizontal Sweep */
if ( !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS ) )
{
- FT_TRACE7(( "Horizontal pass (ftraster)\n" ));
-
ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;
ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
- error = Render_Single_Pass( RAS_VARS 1, 0, (Int)ras.target.width - 1 );
+ error = Render_Single_Pass( RAS_VARS 1, 0, ras.bRight );
if ( error )
return error;
}
@@ -3233,8 +2675,6 @@
black_TWorker worker[1];
#endif
- Long buffer[FT_MAX_BLACK_POOL];
-
if ( !raster )
return FT_THROW( Raster_Uninitialized );
@@ -3243,7 +2683,7 @@
return FT_THROW( Invalid_Outline );
/* return immediately if the outline is empty */
- if ( outline->n_points == 0 || outline->n_contours <= 0 )
+ if ( outline->n_points == 0 || outline->n_contours == 0 )
return Raster_Err_Ok;
if ( !outline->contours || !outline->points )
@@ -3269,10 +2709,14 @@
return FT_THROW( Invalid_Argument );
ras.outline = *outline;
- ras.target = *target_map;
- ras.buff = buffer;
- ras.sizeBuff = (&buffer)[1]; /* Points to right after buffer. */
+ ras.bTop = (Int)target_map->rows - 1;
+ ras.bRight = (Int)target_map->width - 1;
+ ras.bPitch = (Int)target_map->pitch;
+ ras.bOrigin = (PByte)target_map->buffer;
+
+ if ( ras.bPitch > 0 )
+ ras.bOrigin += ras.bTop * ras.bPitch;
return Render_Glyph( RAS_VAR );
}
diff --git a/contrib/libs/freetype/src/raster/ftraster.h b/contrib/libs/freetype/src/raster/ftraster.h
index b511b3a99e..ad9cb1b9fe 100644
--- a/contrib/libs/freetype/src/raster/ftraster.h
+++ b/contrib/libs/freetype/src/raster/ftraster.h
@@ -4,7 +4,7 @@
*
* The FreeType glyph rasterizer (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
diff --git a/contrib/libs/freetype/src/raster/ftrend1.c b/contrib/libs/freetype/src/raster/ftrend1.c
index 6d442b1ff8..fd9f174f2e 100644
--- a/contrib/libs/freetype/src/raster/ftrend1.c
+++ b/contrib/libs/freetype/src/raster/ftrend1.c
@@ -4,7 +4,7 @@
*
* The FreeType glyph rasterizer interface (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/raster/ftrend1.h b/contrib/libs/freetype/src/raster/ftrend1.h
index cec35c8528..cf3e73c0a2 100644
--- a/contrib/libs/freetype/src/raster/ftrend1.h
+++ b/contrib/libs/freetype/src/raster/ftrend1.h
@@ -4,7 +4,7 @@
*
* The FreeType glyph rasterizer interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/raster/raster.c b/contrib/libs/freetype/src/raster/raster.c
index 82f474547d..fe33af2423 100644
--- a/contrib/libs/freetype/src/raster/raster.c
+++ b/contrib/libs/freetype/src/raster/raster.c
@@ -4,7 +4,7 @@
*
* FreeType monochrome rasterer module component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/raster/rasterrs.h b/contrib/libs/freetype/src/raster/rasterrs.h
index 989d8b44be..326d42e043 100644
--- a/contrib/libs/freetype/src/raster/rasterrs.h
+++ b/contrib/libs/freetype/src/raster/rasterrs.h
@@ -4,7 +4,7 @@
*
* monochrome renderer error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sdf/ftbsdf.c b/contrib/libs/freetype/src/sdf/ftbsdf.c
index e472738339..adde05ba19 100644
--- a/contrib/libs/freetype/src/sdf/ftbsdf.c
+++ b/contrib/libs/freetype/src/sdf/ftbsdf.c
@@ -4,7 +4,7 @@
*
* Signed Distance Field support for bitmap fonts (body only).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
diff --git a/contrib/libs/freetype/src/sdf/ftsdf.c b/contrib/libs/freetype/src/sdf/ftsdf.c
index bc4625d984..dc55d42630 100644
--- a/contrib/libs/freetype/src/sdf/ftsdf.c
+++ b/contrib/libs/freetype/src/sdf/ftsdf.c
@@ -4,7 +4,7 @@
*
* Signed Distance Field support for outline fonts (body).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
@@ -3837,7 +3837,7 @@
}
/* if the outline is empty, return */
- if ( outline->n_points <= 0 || outline->n_contours <= 0 )
+ if ( outline->n_points == 0 || outline->n_contours == 0 )
goto Exit;
/* check whether the outline has valid fields */
diff --git a/contrib/libs/freetype/src/sdf/ftsdf.h b/contrib/libs/freetype/src/sdf/ftsdf.h
index 234c075b0a..25a0a13bb8 100644
--- a/contrib/libs/freetype/src/sdf/ftsdf.h
+++ b/contrib/libs/freetype/src/sdf/ftsdf.h
@@ -4,7 +4,7 @@
*
* Signed Distance Field support (specification).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
diff --git a/contrib/libs/freetype/src/sdf/ftsdfcommon.c b/contrib/libs/freetype/src/sdf/ftsdfcommon.c
index 5052201e22..6b2cf7dfec 100644
--- a/contrib/libs/freetype/src/sdf/ftsdfcommon.c
+++ b/contrib/libs/freetype/src/sdf/ftsdfcommon.c
@@ -4,7 +4,7 @@
*
* Auxiliary data for Signed Distance Field support (body).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
@@ -24,49 +24,6 @@
/**************************************************************************
*
- * common functions
- *
- */
-
- /*
- * Original algorithm:
- *
- * https://github.com/chmike/fpsqrt
- *
- * Use this to compute the square root of a 16.16 fixed-point number.
- */
- FT_LOCAL_DEF( FT_16D16 )
- square_root( FT_16D16 val )
- {
- FT_ULong t, q, b, r;
-
-
- r = (FT_ULong)val;
- b = 0x40000000L;
- q = 0;
-
- while ( b > 0x40L )
- {
- t = q + b;
-
- if ( r >= t )
- {
- r -= t;
- q = t + b;
- }
-
- r <<= 1;
- b >>= 1;
- }
-
- q >>= 8;
-
- return (FT_16D16)q;
- }
-
-
- /**************************************************************************
- *
* format and sign manipulating functions
*
*/
diff --git a/contrib/libs/freetype/src/sdf/ftsdfcommon.h b/contrib/libs/freetype/src/sdf/ftsdfcommon.h
index 60ca9773e3..d0f623f9f3 100644
--- a/contrib/libs/freetype/src/sdf/ftsdfcommon.h
+++ b/contrib/libs/freetype/src/sdf/ftsdfcommon.h
@@ -4,7 +4,7 @@
*
* Auxiliary data for Signed Distance Field support (specification).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
@@ -122,8 +122,7 @@ FT_BEGIN_HEADER
typedef FT_BBox FT_CBox; /* control box of a curve */
- FT_LOCAL( FT_16D16 )
- square_root( FT_16D16 val );
+#define square_root( x ) (FT_16D16)FT_SqrtFixed( (FT_UInt32)( x ) )
FT_LOCAL( FT_SDFFormat )
map_fixed_to_sdf( FT_16D16 dist,
diff --git a/contrib/libs/freetype/src/sdf/ftsdferrs.h b/contrib/libs/freetype/src/sdf/ftsdferrs.h
index 519db0fc26..5af873fafb 100644
--- a/contrib/libs/freetype/src/sdf/ftsdferrs.h
+++ b/contrib/libs/freetype/src/sdf/ftsdferrs.h
@@ -4,7 +4,7 @@
*
* Signed Distance Field error codes (specification only).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
diff --git a/contrib/libs/freetype/src/sdf/ftsdfrend.c b/contrib/libs/freetype/src/sdf/ftsdfrend.c
index 5610c119f8..d3324678d6 100644
--- a/contrib/libs/freetype/src/sdf/ftsdfrend.c
+++ b/contrib/libs/freetype/src/sdf/ftsdfrend.c
@@ -4,7 +4,7 @@
*
* Signed Distance Field renderer interface (body).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
diff --git a/contrib/libs/freetype/src/sdf/ftsdfrend.h b/contrib/libs/freetype/src/sdf/ftsdfrend.h
index 571ac833d3..2ea6f86819 100644
--- a/contrib/libs/freetype/src/sdf/ftsdfrend.h
+++ b/contrib/libs/freetype/src/sdf/ftsdfrend.h
@@ -4,7 +4,7 @@
*
* Signed Distance Field renderer interface (specification).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
diff --git a/contrib/libs/freetype/src/sdf/sdf.c b/contrib/libs/freetype/src/sdf/sdf.c
index c159b08128..6045b8330b 100644
--- a/contrib/libs/freetype/src/sdf/sdf.c
+++ b/contrib/libs/freetype/src/sdf/sdf.c
@@ -4,7 +4,7 @@
*
* FreeType Signed Distance Field renderer module component (body only).
*
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Written by Anuj Verma.
diff --git a/contrib/libs/freetype/src/sfnt/pngshim.c b/contrib/libs/freetype/src/sfnt/pngshim.c
index be3acc89d5..a93b273a09 100644
--- a/contrib/libs/freetype/src/sfnt/pngshim.c
+++ b/contrib/libs/freetype/src/sfnt/pngshim.c
@@ -4,7 +4,7 @@
*
* PNG Bitmap glyph support.
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* Google, Inc.
* Written by Stuart Gill and Behdad Esfahbod.
*
diff --git a/contrib/libs/freetype/src/sfnt/pngshim.h b/contrib/libs/freetype/src/sfnt/pngshim.h
index 903bd2bc34..6e7a5c08e7 100644
--- a/contrib/libs/freetype/src/sfnt/pngshim.h
+++ b/contrib/libs/freetype/src/sfnt/pngshim.h
@@ -4,7 +4,7 @@
*
* PNG Bitmap glyph support.
*
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
* Google, Inc.
* Written by Stuart Gill and Behdad Esfahbod.
*
diff --git a/contrib/libs/freetype/src/sfnt/sfdriver.c b/contrib/libs/freetype/src/sfnt/sfdriver.c
index 0925940b03..81072207b4 100644
--- a/contrib/libs/freetype/src/sfnt/sfdriver.c
+++ b/contrib/libs/freetype/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
*
* High-level SFNT driver interface (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -49,6 +49,10 @@
#include <freetype/internal/services/svbdf.h>
#endif
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+#include "ttgpos.h"
+#endif
+
#include "ttcmap.h"
#include "ttkern.h"
#include "ttmtx.h"
@@ -1251,6 +1255,12 @@
#define PUT_PS_NAMES( a ) NULL
#endif
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+#define PUT_GPOS_KERNING( a ) a
+#else
+#define PUT_GPOS_KERNING( a ) NULL
+#endif
+
FT_DEFINE_SFNT_INTERFACE(
sfnt_interface,
@@ -1274,6 +1284,8 @@
tt_face_free_name, /* TT_Free_Table_Func free_name */
tt_face_load_kern, /* TT_Load_Table_Func load_kern */
+ PUT_GPOS_KERNING( tt_face_load_gpos ),
+ /* TT_Load_Table_Func load_gpos */
tt_face_load_gasp, /* TT_Load_Table_Func load_gasp */
tt_face_load_pclt, /* TT_Load_Table_Func load_init */
@@ -1292,6 +1304,9 @@
/* since version 2.1.8 */
tt_face_get_kerning, /* TT_Face_GetKerningFunc get_kerning */
+ PUT_GPOS_KERNING( tt_face_get_gpos_kerning ),
+ /* TT_Face_GetKerningFunc get_gpos_kerning */
+
/* since version 2.2 */
tt_face_load_font_dir, /* TT_Load_Table_Func load_font_dir */
tt_face_load_hmtx, /* TT_Load_Metrics_Func load_hmtx */
diff --git a/contrib/libs/freetype/src/sfnt/sfdriver.h b/contrib/libs/freetype/src/sfnt/sfdriver.h
index 2445958b69..6f71489fdc 100644
--- a/contrib/libs/freetype/src/sfnt/sfdriver.h
+++ b/contrib/libs/freetype/src/sfnt/sfdriver.h
@@ -4,7 +4,7 @@
*
* High-level SFNT driver interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/sferrors.h b/contrib/libs/freetype/src/sfnt/sferrors.h
index e7a8eb04bb..d3ca1d9aa8 100644
--- a/contrib/libs/freetype/src/sfnt/sferrors.h
+++ b/contrib/libs/freetype/src/sfnt/sferrors.h
@@ -4,7 +4,7 @@
*
* SFNT error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/sfnt.c b/contrib/libs/freetype/src/sfnt/sfnt.c
index 8e4f08a90c..52411febc4 100644
--- a/contrib/libs/freetype/src/sfnt/sfnt.c
+++ b/contrib/libs/freetype/src/sfnt/sfnt.c
@@ -4,7 +4,7 @@
*
* Single object library component.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -29,6 +29,7 @@
#include "ttcpal.c"
#include "ttsvg.c"
+#include "ttgpos.c"
#include "ttkern.c"
#include "ttload.c"
#include "ttmtx.c"
diff --git a/contrib/libs/freetype/src/sfnt/sfobjs.c b/contrib/libs/freetype/src/sfnt/sfobjs.c
index f5d66ef840..6ee4e5e939 100644
--- a/contrib/libs/freetype/src/sfnt/sfobjs.c
+++ b/contrib/libs/freetype/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
*
* SFNT object management (base).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -40,6 +40,10 @@
#include "ttbdf.h"
#endif
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+#include "ttgpos.h"
+#endif
+
/**************************************************************************
*
@@ -1026,6 +1030,10 @@
LOAD_( gasp );
LOAD_( kern );
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+ LOAD_( gpos );
+#endif
+
face->root.num_glyphs = face->max_profile.numGlyphs;
/* Bit 8 of the `fsSelection' field in the `OS/2' table denotes */
@@ -1119,7 +1127,11 @@
flags |= FT_FACE_FLAG_VERTICAL;
/* kerning available ? */
- if ( TT_FACE_HAS_KERNING( face ) )
+ if ( TT_FACE_HAS_KERNING( face )
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+ || face->gpos_kerning_available
+#endif
+ )
flags |= FT_FACE_FLAG_KERNING;
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -1470,6 +1482,11 @@
/* freeing the kerning table */
tt_face_done_kern( face );
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+ /* freeing the GPOS table */
+ tt_face_done_gpos( face );
+#endif
+
/* freeing the collection table */
FT_FREE( face->ttc_header.offsets );
face->ttc_header.count = 0;
diff --git a/contrib/libs/freetype/src/sfnt/sfobjs.h b/contrib/libs/freetype/src/sfnt/sfobjs.h
index 906aebbf90..90847d9573 100644
--- a/contrib/libs/freetype/src/sfnt/sfobjs.h
+++ b/contrib/libs/freetype/src/sfnt/sfobjs.h
@@ -4,7 +4,7 @@
*
* SFNT object management (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/sfwoff.c b/contrib/libs/freetype/src/sfnt/sfwoff.c
index 7c0ce2205e..14514bf957 100644
--- a/contrib/libs/freetype/src/sfnt/sfwoff.c
+++ b/contrib/libs/freetype/src/sfnt/sfwoff.c
@@ -4,7 +4,7 @@
*
* WOFF format management (base).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -18,6 +18,7 @@
#include "sfwoff.h"
#include <freetype/tttags.h>
+#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/ftgzip.h>
@@ -149,6 +150,7 @@
/* Miscellaneous checks. */
if ( woff.length != stream->size ||
woff.num_tables == 0 ||
+ woff.num_tables > 0xFFFU ||
44 + woff.num_tables * 20UL >= woff.length ||
12 + woff.num_tables * 16UL >= woff.totalSfntSize ||
( woff.totalSfntSize & 3 ) != 0 ||
@@ -169,21 +171,11 @@
/* Write sfnt header. */
{
- FT_UInt searchRange, entrySelector, rangeShift, x;
+ FT_Int entrySelector = FT_MSB( woff.num_tables );
+ FT_Int searchRange = ( 1 << entrySelector ) * 16;
+ FT_Int rangeShift = woff.num_tables * 16 - searchRange;
- 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 );
diff --git a/contrib/libs/freetype/src/sfnt/sfwoff.h b/contrib/libs/freetype/src/sfnt/sfwoff.h
index d438422737..a04735ffe2 100644
--- a/contrib/libs/freetype/src/sfnt/sfwoff.h
+++ b/contrib/libs/freetype/src/sfnt/sfwoff.h
@@ -4,7 +4,7 @@
*
* WOFFF format management (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/sfwoff2.c b/contrib/libs/freetype/src/sfnt/sfwoff2.c
index 81bf3961cc..5ab40f8a6a 100644
--- a/contrib/libs/freetype/src/sfnt/sfwoff2.c
+++ b/contrib/libs/freetype/src/sfnt/sfwoff2.c
@@ -4,7 +4,7 @@
*
* WOFF2 format management (base).
*
- * Copyright (C) 2019-2023 by
+ * Copyright (C) 2019-2024 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -18,6 +18,7 @@
#include "sfwoff2.h"
#include "woff2tags.h"
#include <freetype/tttags.h>
+#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
@@ -289,23 +290,15 @@
FT_ULong checksum = 0;
FT_ULong aligned_size = size & ~3UL;
FT_ULong i;
- FT_ULong v;
+ FT_Int shift;
for ( i = 0; i < aligned_size; i += 4 )
- checksum += ( (FT_ULong)buf[i ] << 24 ) |
- ( (FT_ULong)buf[i + 1] << 16 ) |
- ( (FT_ULong)buf[i + 2] << 8 ) |
- ( (FT_ULong)buf[i + 3] << 0 );
+ checksum += FT_NEXT_ULONG( buf );
- /* If size is not aligned to 4, treat as if it is padded with 0s. */
- if ( size != aligned_size )
- {
- v = 0;
- for ( i = aligned_size ; i < size; ++i )
- v |= (FT_ULong)buf[i] << ( 24 - 8 * ( i & 3 ) );
- checksum += v;
- }
+ /* remaining bytes can be shifted and added one at a time */
+ for ( shift = 24; i < size; i++, shift -= 8 )
+ checksum += (FT_UInt32)FT_NEXT_BYTE( buf ) << shift;
return checksum;
}
@@ -1799,7 +1792,6 @@
FT_Byte* sfnt = NULL;
FT_Stream sfnt_stream = NULL;
- FT_Byte* sfnt_header;
FT_ULong sfnt_size;
FT_Byte* uncompressed_buf = NULL;
@@ -1853,6 +1845,7 @@
/* Miscellaneous checks. */
if ( woff2.length != stream->size ||
woff2.num_tables == 0 ||
+ woff2.num_tables > 0xFFFU ||
48 + woff2.num_tables * 20UL >= woff2.length ||
( woff2.metaOffset == 0 && ( woff2.metaLength != 0 ||
woff2.metaOrigLength != 0 ) ) ||
@@ -2143,6 +2136,13 @@
WOFF2_TtcFont ttc_font = woff2.ttc_fonts + face_index;
+ if ( ttc_font->num_tables == 0 || ttc_font->num_tables > 0xFFFU )
+ {
+ FT_ERROR(( "woff2_open_font: invalid WOFF2 CollectionFontEntry\n" ));
+ error = FT_THROW( Invalid_Table );
+ goto Exit;
+ }
+
/* Create a temporary array. */
if ( FT_QNEW_ARRAY( temp_indices,
ttc_font->num_tables ) )
@@ -2198,27 +2198,15 @@
FT_NEW( sfnt_stream ) )
goto Exit;
- sfnt_header = sfnt;
-
- WRITE_ULONG( sfnt_header, woff2.flavor );
-
- if ( woff2.num_tables )
{
- FT_UInt searchRange, entrySelector, rangeShift, x;
+ FT_Byte* sfnt_header = sfnt;
+ FT_Int entrySelector = FT_MSB( woff2.num_tables );
+ FT_Int searchRange = ( 1 << entrySelector ) * 16;
+ FT_Int rangeShift = woff2.num_tables * 16 - searchRange;
- x = woff2.num_tables;
- entrySelector = 0;
- while ( x )
- {
- x >>= 1;
- entrySelector += 1;
- }
- entrySelector--;
-
- searchRange = ( 1 << entrySelector ) * 16;
- rangeShift = ( woff2.num_tables * 16 ) - searchRange;
+ WRITE_ULONG ( sfnt_header, woff2.flavor );
WRITE_USHORT( sfnt_header, woff2.num_tables );
WRITE_USHORT( sfnt_header, searchRange );
WRITE_USHORT( sfnt_header, entrySelector );
diff --git a/contrib/libs/freetype/src/sfnt/sfwoff2.h b/contrib/libs/freetype/src/sfnt/sfwoff2.h
index 4901286ee0..f41140648d 100644
--- a/contrib/libs/freetype/src/sfnt/sfwoff2.h
+++ b/contrib/libs/freetype/src/sfnt/sfwoff2.h
@@ -4,7 +4,7 @@
*
* WOFFF2 format management (specification).
*
- * Copyright (C) 2019-2023 by
+ * Copyright (C) 2019-2024 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttbdf.c b/contrib/libs/freetype/src/sfnt/ttbdf.c
index 536fa7467e..d9765f486f 100644
--- a/contrib/libs/freetype/src/sfnt/ttbdf.c
+++ b/contrib/libs/freetype/src/sfnt/ttbdf.c
@@ -4,7 +4,7 @@
*
* TrueType and OpenType embedded BDF properties (body).
*
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -142,7 +142,7 @@
{
TT_Face ttface = (TT_Face)face;
TT_BDF bdf = &ttface->bdf;
- FT_Size size = FT_FACE_SIZE( face );
+ FT_Size size = face->size;
FT_Error error = FT_Err_Ok;
FT_Byte* p;
FT_UInt count;
diff --git a/contrib/libs/freetype/src/sfnt/ttbdf.h b/contrib/libs/freetype/src/sfnt/ttbdf.h
index 0d7a0acecc..d8d722b928 100644
--- a/contrib/libs/freetype/src/sfnt/ttbdf.h
+++ b/contrib/libs/freetype/src/sfnt/ttbdf.h
@@ -4,7 +4,7 @@
*
* TrueType and OpenType embedded BDF properties (specification).
*
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttcmap.c b/contrib/libs/freetype/src/sfnt/ttcmap.c
index 9ba25dcbc1..28f4d1173c 100644
--- a/contrib/libs/freetype/src/sfnt/ttcmap.c
+++ b/contrib/libs/freetype/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
*
* TrueType character mapping table (cmap) support (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttcmap.h b/contrib/libs/freetype/src/sfnt/ttcmap.h
index ff52917ed5..e2c5e72bf0 100644
--- a/contrib/libs/freetype/src/sfnt/ttcmap.h
+++ b/contrib/libs/freetype/src/sfnt/ttcmap.h
@@ -4,7 +4,7 @@
*
* TrueType character mapping table (cmap) support (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttcmapc.h b/contrib/libs/freetype/src/sfnt/ttcmapc.h
index 0af48c2478..370898363f 100644
--- a/contrib/libs/freetype/src/sfnt/ttcmapc.h
+++ b/contrib/libs/freetype/src/sfnt/ttcmapc.h
@@ -4,7 +4,7 @@
*
* TT CMAP classes definitions (specification only).
*
- * Copyright (C) 2009-2023 by
+ * Copyright (C) 2009-2024 by
* Oran Agra and Mickey Gabel.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttcolr.c b/contrib/libs/freetype/src/sfnt/ttcolr.c
index 281e7135ee..b37658dde9 100644
--- a/contrib/libs/freetype/src/sfnt/ttcolr.c
+++ b/contrib/libs/freetype/src/sfnt/ttcolr.c
@@ -4,7 +4,7 @@
*
* TrueType and OpenType colored glyph layer support (body).
*
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
* David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg.
*
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
@@ -208,18 +208,19 @@
colr->num_base_glyphs = FT_NEXT_USHORT( p );
base_glyph_offset = FT_NEXT_ULONG( p );
- if ( base_glyph_offset >= table_size )
+ if ( table_size <= base_glyph_offset )
goto InvalidTable;
- if ( colr->num_base_glyphs * BASE_GLYPH_SIZE >
- table_size - base_glyph_offset )
+ if ( ( table_size - base_glyph_offset ) / BASE_GLYPH_SIZE
+ < colr->num_base_glyphs )
goto InvalidTable;
layer_offset = FT_NEXT_ULONG( p );
colr->num_layers = FT_NEXT_USHORT( p );
- if ( layer_offset >= table_size )
+ if ( table_size <= layer_offset )
goto InvalidTable;
- if ( colr->num_layers * LAYER_SIZE > table_size - layer_offset )
+ if ( ( table_size - layer_offset ) / LAYER_SIZE
+ < colr->num_layers )
goto InvalidTable;
if ( colr->version == 1 )
@@ -229,14 +230,14 @@
base_glyphs_offset_v1 = FT_NEXT_ULONG( p );
- if ( base_glyphs_offset_v1 >= table_size - 4 )
+ if ( table_size - 4 <= base_glyphs_offset_v1 )
goto InvalidTable;
p1 = (FT_Byte*)( table + base_glyphs_offset_v1 );
num_base_glyphs_v1 = FT_PEEK_ULONG( p1 );
- if ( num_base_glyphs_v1 * BASE_GLYPH_PAINT_RECORD_SIZE >
- table_size - base_glyphs_offset_v1 )
+ if ( ( table_size - base_glyphs_offset_v1 ) / BASE_GLYPH_PAINT_RECORD_SIZE
+ < num_base_glyphs_v1 )
goto InvalidTable;
colr->num_base_glyphs_v1 = num_base_glyphs_v1;
@@ -244,19 +245,19 @@
layer_offset_v1 = FT_NEXT_ULONG( p );
- if ( layer_offset_v1 >= table_size )
+ if ( table_size <= layer_offset_v1 )
goto InvalidTable;
if ( layer_offset_v1 )
{
- if ( layer_offset_v1 >= table_size - 4 )
+ if ( table_size - 4 <= layer_offset_v1 )
goto InvalidTable;
p1 = (FT_Byte*)( table + layer_offset_v1 );
num_layers_v1 = FT_PEEK_ULONG( p1 );
- if ( num_layers_v1 * LAYER_V1_LIST_PAINT_OFFSET_SIZE >
- table_size - layer_offset_v1 )
+ if ( ( table_size - layer_offset_v1 ) / LAYER_V1_LIST_PAINT_OFFSET_SIZE
+ < num_layers_v1 )
goto InvalidTable;
colr->num_layers_v1 = num_layers_v1;
@@ -279,7 +280,7 @@
clip_list_offset = FT_NEXT_ULONG( p );
- if ( clip_list_offset >= table_size )
+ if ( table_size <= clip_list_offset )
goto InvalidTable;
if ( clip_list_offset )
@@ -311,7 +312,7 @@
goto InvalidTable;
var_store_offset = FT_NEXT_ULONG( p );
- if ( var_store_offset >= table_size )
+ if ( table_size <= var_store_offset )
goto InvalidTable;
if ( var_store_offset )
@@ -661,6 +662,7 @@
FT_UInt32 first_layer_index;
+ ENSURE_READ_BYTES( 5 );
num_layers = FT_NEXT_BYTE( p );
if ( num_layers > colr->num_layers_v1 )
return 0;
@@ -1278,7 +1280,8 @@
while ( min < max )
{
- FT_UInt mid = min + ( max - min ) / 2;
+ FT_UInt mid = min + ( max - min ) / 2;
+ FT_UShort gid;
/*
* `base_glyph_begin` is the beginning of `BaseGlyphV1List`;
@@ -1287,8 +1290,7 @@
*/
FT_Byte *p = base_glyph_begin + 4 + mid * BASE_GLYPH_PAINT_RECORD_SIZE;
- FT_UShort gid = FT_NEXT_USHORT( p );
-
+ gid = FT_NEXT_USHORT( p );
if ( gid < glyph_id )
min = mid + 1;
diff --git a/contrib/libs/freetype/src/sfnt/ttcolr.h b/contrib/libs/freetype/src/sfnt/ttcolr.h
index 20c85f0359..30031464c7 100644
--- a/contrib/libs/freetype/src/sfnt/ttcolr.h
+++ b/contrib/libs/freetype/src/sfnt/ttcolr.h
@@ -4,7 +4,7 @@
*
* TrueType and OpenType colored glyph layer support (specification).
*
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
diff --git a/contrib/libs/freetype/src/sfnt/ttcpal.c b/contrib/libs/freetype/src/sfnt/ttcpal.c
index 46ae08596f..997eb869ff 100644
--- a/contrib/libs/freetype/src/sfnt/ttcpal.c
+++ b/contrib/libs/freetype/src/sfnt/ttcpal.c
@@ -4,7 +4,7 @@
*
* TrueType and OpenType color palette support (body).
*
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
diff --git a/contrib/libs/freetype/src/sfnt/ttcpal.h b/contrib/libs/freetype/src/sfnt/ttcpal.h
index 8e9913f0cc..bb301ae88b 100644
--- a/contrib/libs/freetype/src/sfnt/ttcpal.h
+++ b/contrib/libs/freetype/src/sfnt/ttcpal.h
@@ -4,7 +4,7 @@
*
* TrueType and OpenType color palette support (specification).
*
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
diff --git a/contrib/libs/freetype/src/sfnt/ttgpos.c b/contrib/libs/freetype/src/sfnt/ttgpos.c
new file mode 100644
index 0000000000..b6cd8bf820
--- /dev/null
+++ b/contrib/libs/freetype/src/sfnt/ttgpos.c
@@ -0,0 +1,598 @@
+/****************************************************************************
+ *
+ * ttgpos.c
+ *
+ * Load the TrueType GPOS table. The only GPOS layout feature this
+ * currently supports is kerning, from x advances in the pair adjustment
+ * layout feature.
+ *
+ * Parts of the implementation were adapted from:
+ * https://github.com/nothings/stb/blob/master/stb_truetype.h
+ *
+ * GPOS spec reference available at:
+ * https://learn.microsoft.com/en-us/typography/opentype/spec/gpos
+ *
+ * Copyright (C) 2024 by
+ * David Saltzman
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ */
+
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include "freetype/fttypes.h"
+#include "freetype/internal/ftobjs.h"
+#include "ttgpos.h"
+
+
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+
+ /**************************************************************************
+ *
+ * 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 ttgpos
+
+
+ typedef enum coverage_table_format_type_
+ {
+ COVERAGE_TABLE_FORMAT_LIST = 1,
+ COVERAGE_TABLE_FORMAT_RANGE = 2
+
+ } coverage_table_format_type;
+
+ typedef enum class_def_table_format_type_
+ {
+ CLASS_DEF_TABLE_FORMAT_ARRAY = 1,
+ CLASS_DEF_TABLE_FORMAT_RANGE_GROUPS = 2
+
+ } class_def_table_format_type;
+
+ typedef enum gpos_lookup_type_
+ {
+ GPOS_LOOKUP_TYPE_NONE = 0,
+ GPOS_LOOKUP_TYPE_SINGLE_ADJUSTMENT = 1,
+ GPOS_LOOKUP_TYPE_PAIR_ADJUSTMENT = 2,
+ GPOS_LOOKUP_TYPE_CURSIVE_ATTACHMENT = 3,
+ GPOS_LOOKUP_TYPE_MARK_TO_BASE_ATTACHMENT = 4,
+ GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE_ATTACHMENT = 5,
+ GPOS_LOOKUP_TYPE_MARK_TO_MARK_ATTACHMENT = 6,
+ GPOS_LOOKUP_TYPE_CONTEXT_POSITIONING = 7,
+ GPOS_LOOKUP_TYPE_CHAINED_CONTEXT_POSITIONING = 8,
+ GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING = 9
+
+ } gpos_lookup_type;
+
+ typedef enum gpos_pair_adjustment_format_
+ {
+ GPOS_PAIR_ADJUSTMENT_FORMAT_GLYPH_PAIR = 1,
+ GPOS_PAIR_ADJUSTMENT_FORMAT_CLASS_PAIR = 2
+
+ } gpos_pair_adjustment_format;
+
+ typedef enum gpos_value_format_bitmask_
+ {
+ GPOS_VALUE_FORMAT_NONE = 0x0000,
+ GPOS_VALUE_FORMAT_X_PLACEMENT = 0x0001,
+ GPOS_VALUE_FORMAT_Y_PLACEMENT = 0x0002,
+ GPOS_VALUE_FORMAT_X_ADVANCE = 0x0004,
+ GPOS_VALUE_FORMAT_Y_ADVANCE = 0x0008,
+ GPOS_VALUE_FORMAT_X_PLACEMENT_DEVICE = 0x0010,
+ GPOS_VALUE_FORMAT_Y_PLACEMENT_DEVICE = 0x0020,
+ GPOS_VALUE_FORMAT_X_ADVANCE_DEVICE = 0x0040,
+ GPOS_VALUE_FORMAT_Y_ADVANCE_DEVICE = 0x0080
+
+ } gpos_value_format_bitmask;
+
+
+ typedef struct TT_GPOS_Subtable_Iterator_Context_
+ {
+ /* Iteration state. */
+ FT_Byte* current_lookup_table;
+ gpos_lookup_type current_lookup_type;
+ FT_UShort subtable_count;
+ FT_Byte* subtable_offsets;
+ FT_UInt subtable_idx;
+
+ /* Element for the current iteration. */
+ FT_Byte* subtable;
+ gpos_lookup_type subtable_type;
+
+ } TT_GPOS_Subtable_Iterator_Context;
+
+
+ /* Initialize a subtable iterator for a given lookup list index. */
+ static void
+ tt_gpos_subtable_iterator_init(
+ TT_GPOS_Subtable_Iterator_Context* context,
+ FT_Byte* gpos_table,
+ FT_ULong lookup_list_idx )
+ {
+ FT_Byte* lookup_list = gpos_table + FT_PEEK_USHORT( gpos_table + 8 );
+ FT_UInt16 lookup_count = FT_PEEK_USHORT( lookup_list );
+
+
+ if ( lookup_list_idx < lookup_count )
+ {
+ context->current_lookup_table =
+ lookup_list + FT_PEEK_USHORT( lookup_list + 2 + 2 * lookup_list_idx );
+ context->current_lookup_type =
+ (gpos_lookup_type)FT_PEEK_USHORT( context->current_lookup_table );
+ context->subtable_count =
+ FT_PEEK_USHORT( context->current_lookup_table + 4 );
+ context->subtable_offsets = context->current_lookup_table + 6;
+ }
+ else
+ {
+ context->current_lookup_table = NULL;
+ context->current_lookup_type = GPOS_LOOKUP_TYPE_NONE;
+ context->subtable_count = 0;
+ context->subtable_offsets = NULL;
+ }
+
+ context->subtable_idx = 0;
+ context->subtable = NULL;
+ context->subtable_type = GPOS_LOOKUP_TYPE_NONE;
+ }
+
+
+ /* Get the next subtable. Return whether there was a next one. */
+ static FT_Bool
+ tt_gpos_subtable_iterator_next(
+ TT_GPOS_Subtable_Iterator_Context* context )
+ {
+ if ( context->subtable_idx < context->subtable_count )
+ {
+ FT_UShort subtable_offset =
+ FT_PEEK_USHORT( context->subtable_offsets +
+ 2 * context->subtable_idx );
+
+
+ context->subtable = context->current_lookup_table + subtable_offset;
+
+ if ( context->current_lookup_type ==
+ GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING )
+ {
+ /* Update type and subtable based on extension positioning header. */
+ context->subtable_type =
+ (gpos_lookup_type)FT_PEEK_USHORT( context->subtable + 2 );
+ context->subtable += FT_PEEK_ULONG( context->subtable + 4 );
+ }
+ else
+ context->subtable_type = context->current_lookup_type;
+
+ context->subtable_idx++;
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+
+ static FT_Int
+ tt_gpos_get_coverage_index( FT_Byte *coverage_table,
+ FT_UInt glyph )
+ {
+ coverage_table_format_type coverage_format =
+ (coverage_table_format_type)FT_PEEK_USHORT( coverage_table );
+
+
+ switch ( coverage_format )
+ {
+ case COVERAGE_TABLE_FORMAT_LIST:
+ {
+ FT_UShort glyph_count = FT_PEEK_USHORT( coverage_table + 2 );
+
+ FT_Int l = 0;
+ FT_Int r = glyph_count - 1;
+ FT_Int m;
+
+ FT_Int straw;
+ FT_Int needle = (FT_Int)glyph;
+
+
+ /* Binary search. */
+ while ( l <= r )
+ {
+ FT_Byte *glyph_array = coverage_table + 4;
+ FT_UShort glyph_id;
+
+
+ m = ( l + r ) >> 1;
+ glyph_id = FT_PEEK_USHORT( glyph_array + 2 * m );
+ straw = glyph_id;
+
+ if ( needle < straw )
+ r = m - 1;
+ else if ( needle > straw )
+ l = m + 1;
+ else
+ return m;
+ }
+ break;
+ }
+
+ case COVERAGE_TABLE_FORMAT_RANGE:
+ {
+ FT_UShort range_count = FT_PEEK_USHORT( coverage_table + 2 );
+ FT_Byte *range_array = coverage_table + 4;
+
+ FT_Int l = 0;
+ FT_Int r = range_count - 1;
+ FT_Int m;
+
+ FT_Int straw_start;
+ FT_Int straw_end;
+ FT_Int needle = (FT_Int)glyph;
+
+
+ /* Binary search. */
+ while ( l <= r )
+ {
+ FT_Byte *range_record;
+
+
+ m = ( l + r ) >> 1;
+ range_record = range_array + 6 * m;
+ straw_start = FT_PEEK_USHORT( range_record );
+ straw_end = FT_PEEK_USHORT( range_record + 2 );
+
+ if ( needle < straw_start )
+ r = m - 1;
+ else if ( needle > straw_end )
+ l = m + 1;
+ else
+ {
+ FT_UShort start_coverage_index =
+ FT_PEEK_USHORT( range_record + 4 );
+
+
+ return (FT_Int)start_coverage_index + (FT_Int)glyph - straw_start;
+ }
+ }
+ break;
+ }
+ }
+
+ return -1;
+ }
+
+
+ static FT_Int
+ tt_gpos_get_glyph_class( FT_Byte *class_def_table,
+ FT_UInt glyph )
+ {
+ class_def_table_format_type class_def_format =
+ (class_def_table_format_type)FT_PEEK_USHORT( class_def_table );
+
+
+ switch ( class_def_format )
+ {
+ case CLASS_DEF_TABLE_FORMAT_ARRAY:
+ {
+ FT_UInt start_glyph_id = FT_PEEK_USHORT( class_def_table + 2 );
+ FT_UInt glyph_count = FT_PEEK_USHORT( class_def_table + 4 );
+ FT_Byte *class_value_array = class_def_table + 6;
+
+
+ if ( glyph >= start_glyph_id &&
+ glyph < start_glyph_id + glyph_count )
+ return (FT_Int)FT_PEEK_USHORT( class_value_array +
+ 2 * ( glyph - start_glyph_id ) );
+ break;
+ }
+
+ case CLASS_DEF_TABLE_FORMAT_RANGE_GROUPS:
+ {
+ FT_UShort class_range_count = FT_PEEK_USHORT( class_def_table + 2 );
+ FT_Byte *class_range_records = class_def_table + 4;
+
+ FT_Int l = 0;
+ FT_Int r = class_range_count - 1;
+ FT_Int m;
+
+ FT_Int straw_start;
+ FT_Int straw_end;
+ FT_Int needle = (FT_Int)glyph;
+
+
+ while ( l <= r )
+ {
+ FT_Byte *class_range_record;
+
+
+ m = ( l + r ) >> 1;
+ class_range_record = class_range_records + 6 * m;
+ straw_start = FT_PEEK_USHORT( class_range_record );
+ straw_end = FT_PEEK_USHORT( class_range_record + 2 );
+
+ if ( needle < straw_start )
+ r = m - 1;
+ else if ( needle > straw_end )
+ l = m + 1;
+ else
+ return (FT_Int)FT_PEEK_USHORT( class_range_record + 4 );
+ }
+ break;
+ }
+ }
+
+ /* "All glyphs not assigned to a class fall into class 0." */
+ /* (OpenType spec) */
+ return 0;
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
+ tt_face_load_gpos( TT_Face face,
+ FT_Stream stream )
+ {
+ FT_Error error;
+ FT_ULong table_size;
+
+
+ /* The GPOS table is optional; exit silently if it is missing. */
+ error = face->goto_table( face, TTAG_GPOS, stream, &table_size );
+ if ( error )
+ goto Exit;
+
+ if ( table_size < 4 ) /* the case of a malformed table */
+ {
+ FT_ERROR(( "tt_face_load_gpos:"
+ " GPOS table is too small - ignored\n" ));
+ error = FT_THROW( Table_Missing );
+ goto Exit;
+ }
+
+ if ( FT_FRAME_EXTRACT( table_size, face->gpos_table ) )
+ {
+ FT_ERROR(( "tt_face_load_gpos:"
+ " could not extract GPOS table\n" ));
+ goto Exit;
+ }
+
+ face->gpos_kerning_available = FALSE;
+
+ if ( face->gpos_table )
+ {
+ FT_Byte* feature_list = face->gpos_table +
+ FT_PEEK_USHORT( face->gpos_table + 6 );
+ FT_UInt16 feature_count = FT_PEEK_USHORT( feature_list );
+ FT_Byte* feature_records = feature_list + 2;
+
+ FT_UInt idx;
+
+
+ for ( idx = 0; idx < feature_count; idx++, feature_records += 6 )
+ {
+ FT_ULong feature_tag = FT_PEEK_ULONG( feature_records );
+
+
+ if ( feature_tag == TTAG_kern )
+ {
+ face->gpos_kerning_available = TRUE;
+ break;
+ }
+ }
+ }
+
+ Exit:
+ return error;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ tt_face_done_gpos( TT_Face face )
+ {
+ FT_Stream stream = face->root.stream;
+
+
+ FT_FRAME_RELEASE( face->gpos_table );
+ }
+
+
+ FT_LOCAL_DEF( FT_Int )
+ tt_face_get_gpos_kerning( TT_Face face,
+ FT_UInt left_glyph,
+ FT_UInt right_glyph )
+ {
+ FT_Byte* feature_list;
+ FT_UInt16 feature_count;
+ FT_Byte* feature_records;
+ FT_UInt feature_idx;
+
+
+ if ( !face->gpos_kerning_available )
+ return 0;
+
+ feature_list = face->gpos_table +
+ FT_PEEK_USHORT( face->gpos_table + 6 );
+ feature_count = FT_PEEK_USHORT( feature_list );
+ feature_records = feature_list + 2;
+
+ for ( feature_idx = 0;
+ feature_idx < feature_count;
+ feature_idx++, feature_records += 6 )
+ {
+ FT_ULong feature_tag = FT_PEEK_ULONG( feature_records );
+ FT_Byte* feature_table;
+ FT_UInt16 lookup_idx_count;
+ FT_UInt16 lookup_idx;
+
+
+ if ( feature_tag != TTAG_kern )
+ continue;
+
+ feature_table = feature_list + FT_PEEK_USHORT( feature_records + 4 );
+ lookup_idx_count = FT_PEEK_USHORT( feature_table + 2 );
+
+ for ( lookup_idx = 0; lookup_idx < lookup_idx_count; lookup_idx++ )
+ {
+ FT_UInt16 lookup_list_idx =
+ FT_PEEK_USHORT( feature_table + 4 + 2 * lookup_idx );
+ TT_GPOS_Subtable_Iterator_Context subtable_iter;
+
+
+ tt_gpos_subtable_iterator_init( &subtable_iter,
+ face->gpos_table,
+ lookup_list_idx );
+
+ while ( tt_gpos_subtable_iterator_next( &subtable_iter ) )
+ {
+ FT_Byte* subtable;
+
+ gpos_value_format_bitmask value_format_1;
+ gpos_value_format_bitmask value_format_2;
+ gpos_pair_adjustment_format format;
+
+ FT_UShort coverage_offset;
+ FT_Int coverage_index;
+
+
+ if ( subtable_iter.subtable_type !=
+ GPOS_LOOKUP_TYPE_PAIR_ADJUSTMENT )
+ continue;
+
+ subtable = subtable_iter.subtable;
+
+ value_format_1 =
+ (gpos_value_format_bitmask)FT_PEEK_USHORT( subtable + 4 );
+ value_format_2 =
+ (gpos_value_format_bitmask)FT_PEEK_USHORT( subtable + 6 );
+
+ if ( !( value_format_1 == GPOS_VALUE_FORMAT_X_ADVANCE &&
+ value_format_2 == GPOS_VALUE_FORMAT_NONE ) )
+ continue;
+
+ format = (gpos_pair_adjustment_format)FT_PEEK_USHORT( subtable );
+
+ coverage_offset = FT_PEEK_USHORT( subtable + 2 );
+ coverage_index =
+ tt_gpos_get_coverage_index( subtable + coverage_offset,
+ left_glyph );
+
+ if ( coverage_index == -1 )
+ continue;
+
+ switch ( format )
+ {
+ case GPOS_PAIR_ADJUSTMENT_FORMAT_GLYPH_PAIR:
+ {
+ FT_Int l, r, m;
+ FT_Int straw, needle;
+
+ FT_Int value_record_pair_size_in_bytes = 2;
+
+ FT_UShort pair_set_count = FT_PEEK_USHORT( subtable + 8 );
+ FT_UShort pair_pos_offset;
+
+ FT_Byte* pair_value_table;
+ FT_UShort pair_value_count;
+ FT_Byte* pair_value_array;
+
+
+ if ( coverage_index >= pair_set_count )
+ return 0;
+
+ pair_pos_offset =
+ FT_PEEK_USHORT( subtable + 10 + 2 * coverage_index );
+
+ pair_value_table = subtable + pair_pos_offset;
+ pair_value_count = FT_PEEK_USHORT( pair_value_table );
+ pair_value_array = pair_value_table + 2;
+
+ needle = (FT_Int)right_glyph;
+ r = pair_value_count - 1;
+ l = 0;
+
+ /* Binary search. */
+ while ( l <= r )
+ {
+ FT_UShort second_glyph;
+ FT_Byte* pair_value;
+
+
+ m = ( l + r ) >> 1;
+ pair_value = pair_value_array +
+ ( 2 + value_record_pair_size_in_bytes ) * m;
+ second_glyph = FT_PEEK_USHORT( pair_value );
+ straw = second_glyph;
+
+ if ( needle < straw )
+ r = m - 1;
+ else if ( needle > straw )
+ l = m + 1;
+ else
+ {
+ FT_Short x_advance = FT_PEEK_SHORT( pair_value + 2 );
+
+
+ return x_advance;
+ }
+ }
+ break;
+ }
+
+ case GPOS_PAIR_ADJUSTMENT_FORMAT_CLASS_PAIR:
+ {
+ FT_UShort class_def1_offset = FT_PEEK_USHORT( subtable + 8 );
+ FT_UShort class_def2_offset = FT_PEEK_USHORT( subtable + 10 );
+
+ FT_Int left_glyph_class =
+ tt_gpos_get_glyph_class( subtable + class_def1_offset,
+ left_glyph );
+ FT_Int right_glyph_class =
+ tt_gpos_get_glyph_class( subtable + class_def2_offset,
+ right_glyph );
+
+ FT_UShort class1_count = FT_PEEK_USHORT( subtable + 12 );
+ FT_UShort class2_count = FT_PEEK_USHORT( subtable + 14 );
+
+ FT_Byte *class1_records, *class2_records;
+ FT_Short x_advance;
+
+
+ if ( left_glyph_class < 0 ||
+ left_glyph_class >= class1_count )
+ return 0; /* malformed */
+ if ( right_glyph_class < 0 ||
+ right_glyph_class >= class2_count )
+ return 0; /* malformed */
+
+ if ( right_glyph_class == 0 )
+ continue; /* right glyph not found in this table */
+
+ class1_records = subtable + 16;
+ class2_records =
+ class1_records + 2 * ( left_glyph_class * class2_count );
+
+ x_advance =
+ FT_PEEK_SHORT( class2_records + 2 * right_glyph_class );
+
+ return x_advance;
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+ }
+
+#else /* !TT_CONFIG_OPTION_GPOS_KERNING */
+
+ /* ANSI C doesn't like empty source files */
+ typedef int tt_gpos_dummy_;
+
+#endif /* !TT_CONFIG_OPTION_GPOS_KERNING */
+
+
+/* END */
diff --git a/contrib/libs/freetype/src/sfnt/ttgpos.h b/contrib/libs/freetype/src/sfnt/ttgpos.h
new file mode 100644
index 0000000000..570e9e3d75
--- /dev/null
+++ b/contrib/libs/freetype/src/sfnt/ttgpos.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+ *
+ * ttgpos.c
+ *
+ * Load the TrueType GPOS table. The only GPOS layout feature this
+ * currently supports is kerning, from x advances in the pair adjustment
+ * layout feature.
+ *
+ * Copyright (C) 2024 by
+ * David Saltzman
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.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 TTGPOS_H_
+#define TTGPOS_H_
+
+
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/tttypes.h>
+
+
+FT_BEGIN_HEADER
+
+
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+
+ FT_LOCAL( FT_Error )
+ tt_face_load_gpos( TT_Face face,
+ FT_Stream stream );
+
+ FT_LOCAL( void )
+ tt_face_done_gpos( TT_Face face );
+
+ FT_LOCAL( FT_Int )
+ tt_face_get_gpos_kerning( TT_Face face,
+ FT_UInt left_glyph,
+ FT_UInt right_glyph );
+
+#endif /* TT_CONFIG_OPTION_GPOS_KERNING */
+
+
+FT_END_HEADER
+
+#endif /* TTGPOS_H_ */
+
+
+/* END */
diff --git a/contrib/libs/freetype/src/sfnt/ttkern.c b/contrib/libs/freetype/src/sfnt/ttkern.c
index a47d08bd6d..f0411366af 100644
--- a/contrib/libs/freetype/src/sfnt/ttkern.c
+++ b/contrib/libs/freetype/src/sfnt/ttkern.c
@@ -5,7 +5,7 @@
* Load the basic TrueType kerning table. This doesn't handle
* kerning data within the GPOS table at the moment.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttkern.h b/contrib/libs/freetype/src/sfnt/ttkern.h
index 960c7da494..a54e51df12 100644
--- a/contrib/libs/freetype/src/sfnt/ttkern.h
+++ b/contrib/libs/freetype/src/sfnt/ttkern.h
@@ -5,7 +5,7 @@
* Load the basic TrueType kerning table. This doesn't handle
* kerning data within the GPOS table at the moment.
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttload.c b/contrib/libs/freetype/src/sfnt/ttload.c
index 7b44e9cd2e..c3a5fae2cb 100644
--- a/contrib/libs/freetype/src/sfnt/ttload.c
+++ b/contrib/libs/freetype/src/sfnt/ttload.c
@@ -5,7 +5,7 @@
* Load the basic TrueType tables, i.e., tables that can be either in
* TTF or OTF fonts (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -1046,7 +1046,7 @@
FT_LOCAL_DEF( void )
tt_face_free_name( TT_Face face )
{
- FT_Memory memory = face->root.driver->root.memory;
+ FT_Memory memory = face->root.memory;
TT_NameTable table = &face->name_table;
diff --git a/contrib/libs/freetype/src/sfnt/ttload.h b/contrib/libs/freetype/src/sfnt/ttload.h
index 1499dd5735..2b1d62d9bd 100644
--- a/contrib/libs/freetype/src/sfnt/ttload.h
+++ b/contrib/libs/freetype/src/sfnt/ttload.h
@@ -5,7 +5,7 @@
* Load the basic TrueType tables, i.e., tables that can be either in
* TTF or OTF fonts (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttmtx.c b/contrib/libs/freetype/src/sfnt/ttmtx.c
index 38ee9ae728..2788411856 100644
--- a/contrib/libs/freetype/src/sfnt/ttmtx.c
+++ b/contrib/libs/freetype/src/sfnt/ttmtx.c
@@ -4,7 +4,7 @@
*
* Load the metrics tables common to TTF and OTF fonts (body).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttmtx.h b/contrib/libs/freetype/src/sfnt/ttmtx.h
index 56d2b62766..34b3c0e18f 100644
--- a/contrib/libs/freetype/src/sfnt/ttmtx.h
+++ b/contrib/libs/freetype/src/sfnt/ttmtx.h
@@ -4,7 +4,7 @@
*
* Load the metrics tables common to TTF and OTF fonts (specification).
*
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttpost.c b/contrib/libs/freetype/src/sfnt/ttpost.c
index 1dfad4298b..5698a62c8d 100644
--- a/contrib/libs/freetype/src/sfnt/ttpost.c
+++ b/contrib/libs/freetype/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
* PostScript name table processing for TrueType and OpenType fonts
* (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -204,8 +204,8 @@
/* now load the name strings */
if ( num_names )
{
- FT_ULong p;
- FT_Byte* strings;
+ FT_Byte* p;
+ FT_Byte* p_end;
post_len -= (FT_ULong)num_glyphs * 2;
@@ -214,36 +214,36 @@
post_len + 1 ) )
goto Fail;
- strings = (FT_Byte*)( name_strings + num_names );
- if ( FT_STREAM_READ( strings, post_len ) )
+ p = (FT_Byte*)( name_strings + num_names );
+ if ( FT_STREAM_READ( p, post_len ) )
goto Fail;
+ p_end = p + post_len;
+
/* convert from Pascal- to C-strings and set pointers */
- for ( p = 0, n = 0; p < post_len && n < num_names; n++ )
+ for ( n = 0; p < p_end && n < num_names; n++ )
{
- FT_UInt len = strings[p];
+ FT_UInt len = *p;
- if ( len > 63U )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
+ /* names in the Adobe Glyph List are shorter than 40 characters */
+ if ( len >= 40U )
+ FT_TRACE4(( "load_format_20: unusual %u-char name found\n", len ));
- strings[p] = 0;
- name_strings[n] = strings + p + 1;
- p += len + 1;
+ *p++ = 0;
+ name_strings[n] = p;
+ p += len;
}
- strings[post_len] = 0;
+ *p_end = 0;
/* deal with missing or insufficient string data */
if ( n < num_names )
{
FT_TRACE4(( "load_format_20: %hu PostScript names are truncated\n",
- num_names - n ));
+ (FT_UShort)( num_names - n ) ));
for ( ; n < num_names; n++ )
- name_strings[n] = strings + post_len;
+ name_strings[n] = p_end;
}
}
@@ -436,13 +436,8 @@
format = face->postscript.FormatType;
- if ( format == 0x00010000L )
- {
- if ( idx < 258 ) /* paranoid checking */
- *PSname = MAC_NAME( idx );
- }
- else if ( format == 0x00020000L ||
- format == 0x00025000L )
+ if ( format == 0x00020000L ||
+ format == 0x00025000L )
{
TT_Post_Names names = &face->postscript_names;
@@ -466,6 +461,11 @@
}
}
+ /* version 1.0 is only valid with 258 glyphs */
+ else if ( format == 0x00010000L &&
+ face->max_profile.numGlyphs == 258 )
+ *PSname = MAC_NAME( idx );
+
/* nothing to do for format == 0x00030000L */
End:
diff --git a/contrib/libs/freetype/src/sfnt/ttpost.h b/contrib/libs/freetype/src/sfnt/ttpost.h
index 528f1c5f2f..150db6c398 100644
--- a/contrib/libs/freetype/src/sfnt/ttpost.h
+++ b/contrib/libs/freetype/src/sfnt/ttpost.h
@@ -5,7 +5,7 @@
* PostScript name table processing for TrueType and OpenType fonts
* (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttsbit.c b/contrib/libs/freetype/src/sfnt/ttsbit.c
index 03f90a628d..cb3a8abf18 100644
--- a/contrib/libs/freetype/src/sfnt/ttsbit.c
+++ b/contrib/libs/freetype/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
*
* TrueType and OpenType embedded bitmap support (body).
*
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Copyright 2013 by Google, Inc.
diff --git a/contrib/libs/freetype/src/sfnt/ttsbit.h b/contrib/libs/freetype/src/sfnt/ttsbit.h
index 07e2db461a..96f80a5842 100644
--- a/contrib/libs/freetype/src/sfnt/ttsbit.h
+++ b/contrib/libs/freetype/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
*
* TrueType and OpenType embedded bitmap support (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttsvg.c b/contrib/libs/freetype/src/sfnt/ttsvg.c
index 4461d483b0..298afd8b55 100644
--- a/contrib/libs/freetype/src/sfnt/ttsvg.c
+++ b/contrib/libs/freetype/src/sfnt/ttsvg.c
@@ -4,7 +4,7 @@
*
* OpenType SVG Color (specification).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/ttsvg.h b/contrib/libs/freetype/src/sfnt/ttsvg.h
index 3f32321ded..20f9e47c99 100644
--- a/contrib/libs/freetype/src/sfnt/ttsvg.h
+++ b/contrib/libs/freetype/src/sfnt/ttsvg.h
@@ -4,7 +4,7 @@
*
* OpenType SVG Color (specification).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/woff2tags.c b/contrib/libs/freetype/src/sfnt/woff2tags.c
index eeedd9906b..532ccfa173 100644
--- a/contrib/libs/freetype/src/sfnt/woff2tags.c
+++ b/contrib/libs/freetype/src/sfnt/woff2tags.c
@@ -4,7 +4,7 @@
*
* WOFF2 Font table tags (base).
*
- * Copyright (C) 2019-2023 by
+ * Copyright (C) 2019-2024 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/sfnt/woff2tags.h b/contrib/libs/freetype/src/sfnt/woff2tags.h
index 1201848e5e..d03b4b41bc 100644
--- a/contrib/libs/freetype/src/sfnt/woff2tags.h
+++ b/contrib/libs/freetype/src/sfnt/woff2tags.h
@@ -4,7 +4,7 @@
*
* WOFF2 Font table tags (specification).
*
- * Copyright (C) 2019-2023 by
+ * Copyright (C) 2019-2024 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/smooth/ftgrays.c b/contrib/libs/freetype/src/smooth/ftgrays.c
index 4ac991dc9c..ec06235db6 100644
--- a/contrib/libs/freetype/src/smooth/ftgrays.c
+++ b/contrib/libs/freetype/src/smooth/ftgrays.c
@@ -4,7 +4,7 @@
*
* A new `perfect' anti-aliasing renderer (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -489,7 +489,7 @@ typedef ptrdiff_t FT_PtrDist;
typedef struct gray_TWorker_
{
- ft_jmp_buf jump_buffer;
+ FT_BBox cbox;
TCoord min_ex, max_ex; /* min and max integer pixel coordinates */
TCoord min_ey, max_ey;
@@ -510,6 +510,8 @@ typedef ptrdiff_t FT_PtrDist;
FT_Raster_Span_Func render_span;
void* render_span_data;
+ ft_jmp_buf jump_buffer;
+
} gray_TWorker, *gray_PWorker;
#if defined( _MSC_VER )
@@ -997,49 +999,12 @@ typedef ptrdiff_t FT_PtrDist;
#endif
/*
- * Benchmarking shows that using DDA to flatten the quadratic Bézier arcs
- * is slightly faster in the following cases:
- *
- * - When the host CPU is 64-bit.
- * - When SSE2 SIMD registers and instructions are available (even on
- * x86).
- *
- * For other cases, using binary splits is actually slightly faster.
- */
-#if ( defined( __SSE2__ ) || \
- defined( __x86_64__ ) || \
- defined( _M_AMD64 ) || \
- ( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 ) ) && \
- !defined( __VMS )
-# define FT_SSE2 1
-#else
-# define FT_SSE2 0
-#endif
-
-#if FT_SSE2 || \
- defined( __aarch64__ ) || \
- defined( _M_ARM64 )
-# define BEZIER_USE_DDA 1
-#else
-# define BEZIER_USE_DDA 0
-#endif
-
- /*
- * For now, the code that depends on `BEZIER_USE_DDA` requires `FT_Int64`
- * to be defined. If `FT_INT64` is not defined, meaning there is no
- * 64-bit type available, disable it to avoid compilation errors. See for
- * example https://gitlab.freedesktop.org/freetype/freetype/-/issues/1071.
+ * For now, the code that uses DDA to render conic curves requires
+ * `FT_Int64` to be defined. See for example
+ * https://gitlab.freedesktop.org/freetype/freetype/-/issues/1071.
*/
-#if !defined( FT_INT64 )
-# undef BEZIER_USE_DDA
-# define BEZIER_USE_DDA 0
-#endif
-
-#if BEZIER_USE_DDA
-#if FT_SSE2
-# include <emmintrin.h>
-#endif
+#ifdef FT_INT64
#define LEFT_SHIFT( a, b ) (FT_Int64)( (FT_UInt64)(a) << (b) )
@@ -1095,16 +1060,17 @@ typedef ptrdiff_t FT_PtrDist;
return;
}
- /* We can calculate the number of necessary bisections because */
+ /* We can calculate the number of necessary segments because */
/* each bisection predictably reduces deviation exactly 4-fold. */
/* Even 32-bit deviation would vanish after 16 bisections. */
- shift = 0;
+ shift = 16;
do
{
- dx >>= 2;
- shift += 1;
+ dx >>= 2;
+ shift--;
} while ( dx > ONE_PIXEL / 4 );
+ count = 0x10000U >> shift;
/*
* The (P0,P1,P2) arc equation, for t in [0,1] range:
@@ -1150,75 +1116,19 @@ typedef ptrdiff_t FT_PtrDist;
* = (B << (33 - N)) + (A << (32 - 2*N))
*/
-#if FT_SSE2
- /* Experience shows that for small shift values, */
- /* SSE2 is actually slower. */
- if ( shift > 2 )
- {
- union
- {
- struct { FT_Int64 ax, ay, bx, by; } i;
- struct { __m128i a, b; } vec;
-
- } u;
-
- union
- {
- struct { FT_Int32 px_lo, px_hi, py_lo, py_hi; } i;
- __m128i vec;
-
- } v;
-
- __m128i a, b;
- __m128i r, q, q2;
- __m128i p;
-
-
- u.i.ax = ax;
- u.i.ay = ay;
- u.i.bx = bx;
- u.i.by = by;
-
- a = _mm_load_si128( &u.vec.a );
- b = _mm_load_si128( &u.vec.b );
-
- r = _mm_slli_epi64( a, 33 - 2 * shift );
- q = _mm_slli_epi64( b, 33 - shift );
- q2 = _mm_slli_epi64( a, 32 - 2 * shift );
-
- q = _mm_add_epi64( q2, q );
-
- v.i.px_lo = 0;
- v.i.px_hi = p0.x;
- v.i.py_lo = 0;
- v.i.py_hi = p0.y;
-
- p = _mm_load_si128( &v.vec );
-
- for ( count = 1U << shift; count > 0; count-- )
- {
- p = _mm_add_epi64( p, q );
- q = _mm_add_epi64( q, r );
-
- _mm_store_si128( &v.vec, p );
-
- gray_render_line( RAS_VAR_ v.i.px_hi, v.i.py_hi );
- }
-
- return;
- }
-#endif /* FT_SSE2 */
+ rx = LEFT_SHIFT( ax, shift + shift );
+ ry = LEFT_SHIFT( ay, shift + shift );
- rx = LEFT_SHIFT( ax, 33 - 2 * shift );
- ry = LEFT_SHIFT( ay, 33 - 2 * shift );
+ qx = LEFT_SHIFT( bx, shift + 17 ) + rx;
+ qy = LEFT_SHIFT( by, shift + 17 ) + ry;
- qx = LEFT_SHIFT( bx, 33 - shift ) + LEFT_SHIFT( ax, 32 - 2 * shift );
- qy = LEFT_SHIFT( by, 33 - shift ) + LEFT_SHIFT( ay, 32 - 2 * shift );
+ rx *= 2;
+ ry *= 2;
px = LEFT_SHIFT( p0.x, 32 );
py = LEFT_SHIFT( p0.y, 32 );
- for ( count = 1U << shift; count > 0; count-- )
+ do
{
px += qx;
py += qy;
@@ -1227,10 +1137,10 @@ typedef ptrdiff_t FT_PtrDist;
gray_render_line( RAS_VAR_ (FT_Pos)( px >> 32 ),
(FT_Pos)( py >> 32 ) );
- }
+ } while ( --count );
}
-#else /* !BEZIER_USE_DDA */
+#else /* !FT_INT64 */
/*
* Note that multiple attempts to speed up the function below
@@ -1324,7 +1234,7 @@ typedef ptrdiff_t FT_PtrDist;
} while ( --draw );
}
-#endif /* !BEZIER_USE_DDA */
+#endif /* !FT_INT64 */
/*
@@ -1486,139 +1396,6 @@ typedef ptrdiff_t FT_PtrDist;
}
- static void
- gray_sweep( RAS_ARG )
- {
- int fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
- : INT_MIN;
- int coverage;
- int y;
-
-
- for ( y = ras.min_ey; y < ras.max_ey; y++ )
- {
- PCell cell = ras.ycells[y - ras.min_ey];
- TCoord x = ras.min_ex;
- TArea cover = 0;
-
- unsigned char* line = ras.target.origin - ras.target.pitch * y;
-
-
- for ( ; cell != ras.cell_null; cell = cell->next )
- {
- TArea area;
-
-
- if ( cover != 0 && cell->x > x )
- {
- FT_FILL_RULE( coverage, cover, fill );
- FT_GRAY_SET( line + x, coverage, cell->x - x );
- }
-
- cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
- area = cover - cell->area;
-
- if ( area != 0 && cell->x >= ras.min_ex )
- {
- FT_FILL_RULE( coverage, area, fill );
- line[cell->x] = (unsigned char)coverage;
- }
-
- x = cell->x + 1;
- }
-
- if ( cover != 0 ) /* only if cropped */
- {
- FT_FILL_RULE( coverage, cover, fill );
- FT_GRAY_SET( line + x, coverage, ras.max_ex - x );
- }
- }
- }
-
-
- static void
- gray_sweep_direct( RAS_ARG )
- {
- int fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
- : INT_MIN;
- int coverage;
- int y;
-
- FT_Span span[FT_MAX_GRAY_SPANS];
- int n = 0;
-
-
- for ( y = ras.min_ey; y < ras.max_ey; y++ )
- {
- PCell cell = ras.ycells[y - ras.min_ey];
- TCoord x = ras.min_ex;
- TArea cover = 0;
-
-
- for ( ; cell != ras.cell_null; cell = cell->next )
- {
- TArea area;
-
-
- if ( cover != 0 && cell->x > x )
- {
- FT_FILL_RULE( coverage, cover, fill );
-
- span[n].coverage = (unsigned char)coverage;
- span[n].x = (short)x;
- span[n].len = (unsigned short)( cell->x - x );
-
- if ( ++n == FT_MAX_GRAY_SPANS )
- {
- /* flush the span buffer and reset the count */
- ras.render_span( y, n, span, ras.render_span_data );
- n = 0;
- }
- }
-
- cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
- area = cover - cell->area;
-
- if ( area != 0 && cell->x >= ras.min_ex )
- {
- FT_FILL_RULE( coverage, area, fill );
-
- span[n].coverage = (unsigned char)coverage;
- span[n].x = (short)cell->x;
- span[n].len = 1;
-
- if ( ++n == FT_MAX_GRAY_SPANS )
- {
- /* flush the span buffer and reset the count */
- ras.render_span( y, n, span, ras.render_span_data );
- n = 0;
- }
- }
-
- x = cell->x + 1;
- }
-
- if ( cover != 0 ) /* only if cropped */
- {
- FT_FILL_RULE( coverage, cover, fill );
-
- span[n].coverage = (unsigned char)coverage;
- span[n].x = (short)x;
- span[n].len = (unsigned short)( ras.max_ex - x );
-
- ++n;
- }
-
- if ( n )
- {
- /* flush the span buffer and reset the count */
- ras.render_span( y, n, span, ras.render_span_data );
- n = 0;
- }
- }
- }
-
-
#ifdef STANDALONE_
/**************************************************************************
@@ -1934,7 +1711,7 @@ typedef ptrdiff_t FT_PtrDist;
if ( continued )
FT_Trace_Enable();
- FT_TRACE7(( "band [%d..%d]: %td cell%s remaining/\n",
+ FT_TRACE7(( "band [%d..%d]: %td cell%s remaining\n",
ras.min_ey,
ras.max_ey,
ras.cell_null - ras.cell_free,
@@ -1952,14 +1729,144 @@ typedef ptrdiff_t FT_PtrDist;
}
+ static void
+ gray_sweep( RAS_ARG )
+ {
+ int fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
+ : INT_MIN;
+ int coverage;
+ int y;
+
+
+ for ( y = ras.min_ey; y < ras.max_ey; y++ )
+ {
+ PCell cell = ras.ycells[y - ras.min_ey];
+ TCoord x = ras.min_ex;
+ TArea cover = 0;
+
+ unsigned char* line = ras.target.origin - ras.target.pitch * y;
+
+
+ for ( ; cell != ras.cell_null; cell = cell->next )
+ {
+ TArea area;
+
+
+ if ( cover != 0 && cell->x > x )
+ {
+ FT_FILL_RULE( coverage, cover, fill );
+ FT_GRAY_SET( line + x, coverage, cell->x - x );
+ }
+
+ cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
+ area = cover - cell->area;
+
+ if ( area != 0 && cell->x >= ras.min_ex )
+ {
+ FT_FILL_RULE( coverage, area, fill );
+ line[cell->x] = (unsigned char)coverage;
+ }
+
+ x = cell->x + 1;
+ }
+
+ if ( cover != 0 ) /* only if cropped */
+ {
+ FT_FILL_RULE( coverage, cover, fill );
+ FT_GRAY_SET( line + x, coverage, ras.max_ex - x );
+ }
+ }
+ }
+
+
+ static void
+ gray_sweep_direct( RAS_ARG )
+ {
+ int fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
+ : INT_MIN;
+ int coverage;
+ int y;
+
+ FT_Span span[FT_MAX_GRAY_SPANS];
+ int n = 0;
+
+
+ for ( y = ras.min_ey; y < ras.max_ey; y++ )
+ {
+ PCell cell = ras.ycells[y - ras.min_ey];
+ TCoord x = ras.min_ex;
+ TArea cover = 0;
+
+
+ for ( ; cell != ras.cell_null; cell = cell->next )
+ {
+ TArea area;
+
+
+ if ( cover != 0 && cell->x > x )
+ {
+ FT_FILL_RULE( coverage, cover, fill );
+
+ span[n].coverage = (unsigned char)coverage;
+ span[n].x = (short)x;
+ span[n].len = (unsigned short)( cell->x - x );
+
+ if ( ++n == FT_MAX_GRAY_SPANS )
+ {
+ /* flush the span buffer and reset the count */
+ ras.render_span( y, n, span, ras.render_span_data );
+ n = 0;
+ }
+ }
+
+ cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
+ area = cover - cell->area;
+
+ if ( area != 0 && cell->x >= ras.min_ex )
+ {
+ FT_FILL_RULE( coverage, area, fill );
+
+ span[n].coverage = (unsigned char)coverage;
+ span[n].x = (short)cell->x;
+ span[n].len = 1;
+
+ if ( ++n == FT_MAX_GRAY_SPANS )
+ {
+ /* flush the span buffer and reset the count */
+ ras.render_span( y, n, span, ras.render_span_data );
+ n = 0;
+ }
+ }
+
+ x = cell->x + 1;
+ }
+
+ if ( cover != 0 ) /* only if cropped */
+ {
+ FT_FILL_RULE( coverage, cover, fill );
+
+ span[n].coverage = (unsigned char)coverage;
+ span[n].x = (short)x;
+ span[n].len = (unsigned short)( ras.max_ex - x );
+
+ ++n;
+ }
+
+ if ( n )
+ {
+ /* flush the span buffer and reset the count */
+ ras.render_span( y, n, span, ras.render_span_data );
+ n = 0;
+ }
+ }
+ }
+
+
static int
gray_convert_glyph( RAS_ARG )
{
- const TCoord yMin = ras.min_ey;
- const TCoord yMax = ras.max_ey;
-
TCell buffer[FT_MAX_GRAY_POOL];
- size_t height = (size_t)( yMax - yMin );
+ size_t height = (size_t)( ras.cbox.yMax - ras.cbox.yMin );
size_t n = FT_MAX_GRAY_POOL / 8;
TCoord y;
TCoord bands[32]; /* enough to accommodate bisections */
@@ -1985,35 +1892,36 @@ typedef ptrdiff_t FT_PtrDist;
height = ( height + n - 1 ) / n;
}
- for ( y = yMin; y < yMax; )
+ for ( y = ras.cbox.yMin; y < ras.cbox.yMax; )
{
ras.min_ey = y;
y += height;
- ras.max_ey = FT_MIN( y, yMax );
+ ras.max_ey = FT_MIN( y, ras.cbox.yMax );
+
+ ras.count_ey = ras.max_ey - ras.min_ey;
band = bands;
- band[1] = ras.min_ey;
- band[0] = ras.max_ey;
+ band[1] = ras.cbox.xMin;
+ band[0] = ras.cbox.xMax;
do
{
- TCoord width = band[0] - band[1];
- TCoord w;
+ TCoord i;
int error;
- for ( w = 0; w < width; ++w )
- ras.ycells[w] = ras.cell_null;
+ ras.min_ex = band[1];
+ ras.max_ex = band[0];
+
+ /* memory management: zero out and skip ycells */
+ for ( i = 0; i < ras.count_ey; ++i )
+ ras.ycells[i] = ras.cell_null;
- /* memory management: skip ycells */
- n = ( (size_t)width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
- sizeof ( TCell );
+ n = ( (size_t)ras.count_ey * sizeof ( PCell ) + sizeof ( TCell ) - 1 )
+ / sizeof ( TCell );
ras.cell_free = buffer + n;
ras.cell = ras.cell_null;
- ras.min_ey = band[1];
- ras.max_ey = band[0];
- ras.count_ey = width;
error = gray_convert_glyph_inner( RAS_VAR_ continued );
continued = 1;
@@ -2031,10 +1939,10 @@ typedef ptrdiff_t FT_PtrDist;
return error;
/* render pool overflow; we will reduce the render band by half */
- width >>= 1;
+ i = ( band[0] - band[1] ) >> 1;
/* this should never happen even with tiny rendering pool */
- if ( width == 0 )
+ if ( i == 0 )
{
FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
return FT_THROW( Raster_Overflow );
@@ -2042,7 +1950,7 @@ typedef ptrdiff_t FT_PtrDist;
band++;
band[1] = band[0];
- band[0] += width;
+ band[0] += i;
} while ( band >= bands );
}
@@ -2073,7 +1981,7 @@ typedef ptrdiff_t FT_PtrDist;
return FT_THROW( Invalid_Outline );
/* return immediately if the outline is empty */
- if ( outline->n_points == 0 || outline->n_contours <= 0 )
+ if ( outline->n_points == 0 || outline->n_contours == 0 )
return Smooth_Err_Ok;
if ( !outline->contours || !outline->points )
@@ -2093,10 +2001,7 @@ typedef ptrdiff_t FT_PtrDist;
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
ras.render_span_data = params->user;
- 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;
+ ras.cbox = params->clip_box;
}
else
{
@@ -2122,14 +2027,14 @@ typedef ptrdiff_t FT_PtrDist;
ras.render_span = (FT_Raster_Span_Func)NULL;
ras.render_span_data = NULL;
- ras.min_ex = 0;
- ras.min_ey = 0;
- ras.max_ex = (FT_Pos)target_map->width;
- ras.max_ey = (FT_Pos)target_map->rows;
+ ras.cbox.xMin = 0;
+ ras.cbox.yMin = 0;
+ ras.cbox.xMax = (FT_Pos)target_map->width;
+ ras.cbox.yMax = (FT_Pos)target_map->rows;
}
/* exit if nothing to do */
- if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey )
+ if ( ras.cbox.xMin >= ras.cbox.xMax || ras.cbox.yMin >= ras.cbox.yMax )
return Smooth_Err_Ok;
return gray_convert_glyph( RAS_VAR );
diff --git a/contrib/libs/freetype/src/smooth/ftgrays.h b/contrib/libs/freetype/src/smooth/ftgrays.h
index 9ba59cab84..1f4123bafd 100644
--- a/contrib/libs/freetype/src/smooth/ftgrays.h
+++ b/contrib/libs/freetype/src/smooth/ftgrays.h
@@ -4,7 +4,7 @@
*
* FreeType smooth renderer declaration
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/smooth/ftsmerrs.h b/contrib/libs/freetype/src/smooth/ftsmerrs.h
index f4ac93dc41..6d41fb8e0f 100644
--- a/contrib/libs/freetype/src/smooth/ftsmerrs.h
+++ b/contrib/libs/freetype/src/smooth/ftsmerrs.h
@@ -4,7 +4,7 @@
*
* smooth renderer error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/smooth/ftsmooth.c b/contrib/libs/freetype/src/smooth/ftsmooth.c
index 9b0e8886cb..f0acc1ea4a 100644
--- a/contrib/libs/freetype/src/smooth/ftsmooth.c
+++ b/contrib/libs/freetype/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
*
* Anti-aliasing renderer interface (body).
*
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/smooth/ftsmooth.h b/contrib/libs/freetype/src/smooth/ftsmooth.h
index f8bdc9938b..d7b61a9e60 100644
--- a/contrib/libs/freetype/src/smooth/ftsmooth.h
+++ b/contrib/libs/freetype/src/smooth/ftsmooth.h
@@ -4,7 +4,7 @@
*
* Anti-aliasing renderer interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/smooth/smooth.c b/contrib/libs/freetype/src/smooth/smooth.c
index 9a0b824c2a..8c5068180e 100644
--- a/contrib/libs/freetype/src/smooth/smooth.c
+++ b/contrib/libs/freetype/src/smooth/smooth.c
@@ -4,7 +4,7 @@
*
* FreeType anti-aliasing rasterer module component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/svg/ftsvg.c b/contrib/libs/freetype/src/svg/ftsvg.c
index ba237f6380..35788a2d8d 100644
--- a/contrib/libs/freetype/src/svg/ftsvg.c
+++ b/contrib/libs/freetype/src/svg/ftsvg.c
@@ -4,7 +4,7 @@
*
* The FreeType SVG renderer interface (body).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/svg/ftsvg.h b/contrib/libs/freetype/src/svg/ftsvg.h
index 9c496caa1a..623c091dc6 100644
--- a/contrib/libs/freetype/src/svg/ftsvg.h
+++ b/contrib/libs/freetype/src/svg/ftsvg.h
@@ -4,7 +4,7 @@
*
* The FreeType SVG renderer interface (specification).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/svg/svg.c b/contrib/libs/freetype/src/svg/svg.c
index 373c28ed9a..1f1c04b2f2 100644
--- a/contrib/libs/freetype/src/svg/svg.c
+++ b/contrib/libs/freetype/src/svg/svg.c
@@ -4,7 +4,7 @@
*
* FreeType SVG renderer module component (body only).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/svg/svgtypes.h b/contrib/libs/freetype/src/svg/svgtypes.h
index 1d608032cc..f1d6d73c54 100644
--- a/contrib/libs/freetype/src/svg/svgtypes.h
+++ b/contrib/libs/freetype/src/svg/svgtypes.h
@@ -4,7 +4,7 @@
*
* The FreeType SVG renderer internal types (specification).
*
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/truetype/truetype.c b/contrib/libs/freetype/src/truetype/truetype.c
index fcc0ea334f..fe9cb9247a 100644
--- a/contrib/libs/freetype/src/truetype/truetype.c
+++ b/contrib/libs/freetype/src/truetype/truetype.c
@@ -4,7 +4,7 @@
*
* FreeType TrueType driver component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/truetype/ttdriver.c b/contrib/libs/freetype/src/truetype/ttdriver.c
index d1496fec7f..4ab68eb9a1 100644
--- a/contrib/libs/freetype/src/truetype/ttdriver.c
+++ b/contrib/libs/freetype/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
*
* TrueType font driver implementation (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -217,7 +217,20 @@
kerning->y = 0;
if ( sfnt )
- kerning->x = sfnt->get_kerning( ttface, left_glyph, right_glyph );
+ {
+ /* Use 'kern' table if available since that can be faster; otherwise */
+ /* use GPOS kerning pairs if available. */
+ if ( ttface->kern_avail_bits != 0 )
+ kerning->x = sfnt->get_kerning( ttface,
+ left_glyph,
+ right_glyph );
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+ else if ( ttface->gpos_kerning_available )
+ kerning->x = sfnt->get_gpos_kerning( ttface,
+ left_glyph,
+ right_glyph );
+#endif
+ }
return 0;
}
diff --git a/contrib/libs/freetype/src/truetype/ttdriver.h b/contrib/libs/freetype/src/truetype/ttdriver.h
index 757a66f425..3e1cf234fc 100644
--- a/contrib/libs/freetype/src/truetype/ttdriver.h
+++ b/contrib/libs/freetype/src/truetype/ttdriver.h
@@ -4,7 +4,7 @@
*
* High-level TrueType driver interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/truetype/tterrors.h b/contrib/libs/freetype/src/truetype/tterrors.h
index 008ee99853..7ad937bd04 100644
--- a/contrib/libs/freetype/src/truetype/tterrors.h
+++ b/contrib/libs/freetype/src/truetype/tterrors.h
@@ -4,7 +4,7 @@
*
* TrueType error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/truetype/ttgload.c b/contrib/libs/freetype/src/truetype/ttgload.c
index dc427e8a11..b656ccf04e 100644
--- a/contrib/libs/freetype/src/truetype/ttgload.c
+++ b/contrib/libs/freetype/src/truetype/ttgload.c
@@ -4,7 +4,7 @@
*
* TrueType Glyph Loader (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -353,7 +353,8 @@
FT_Byte c, count;
FT_Vector *vec, *vec_limit;
FT_Pos x, y;
- FT_Short *cont, *cont_limit, last;
+ FT_UShort *cont, *cont_limit;
+ FT_Int last;
/* check that we can add the contours to the glyph */
@@ -372,7 +373,7 @@
last = -1;
for ( ; cont < cont_limit; cont++ )
{
- *cont = FT_NEXT_SHORT( p );
+ *cont = FT_NEXT_USHORT( p );
if ( *cont <= last )
goto Invalid_Outline;
@@ -418,11 +419,9 @@
/* and thus allocate the bytecode array size by ourselves */
if ( n_ins )
{
- if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) )
+ if ( FT_DUP( exec->glyphIns, p, n_ins ) )
return error;
- FT_MEM_COPY( exec->glyphIns, p, (FT_Long)n_ins );
-
exec->glyphSize = n_ins;
}
}
@@ -432,7 +431,7 @@
p += n_ins;
/* reading the point tags */
- flag = (FT_Byte*)outline->tags;
+ flag = outline->tags;
flag_limit = flag + n_points;
FT_ASSERT( flag );
@@ -465,7 +464,7 @@
vec = outline->points;
vec_limit = vec + n_points;
- flag = (FT_Byte*)outline->tags;
+ flag = outline->tags;
x = 0;
for ( ; vec < vec_limit; vec++, flag++ )
@@ -499,7 +498,7 @@
vec = outline->points;
vec_limit = vec + n_points;
- flag = (FT_Byte*)outline->tags;
+ flag = outline->tags;
y = 0;
for ( ; vec < vec_limit; vec++, flag++ )
@@ -532,8 +531,8 @@
*flag = (FT_Byte)( f & ON_CURVE_POINT );
}
- outline->n_points = (FT_Short)n_points;
- outline->n_contours = (FT_Short)n_contours;
+ outline->n_points = (FT_UShort)n_points;
+ outline->n_contours = (FT_UShort)n_contours;
load->cursor = p;
@@ -754,15 +753,13 @@
FT_UInt start_point,
FT_UInt start_contour )
{
- zone->n_points = (FT_UShort)load->outline.n_points + 4 -
- (FT_UShort)start_point;
- zone->n_contours = load->outline.n_contours -
- (FT_Short)start_contour;
+ zone->n_points = load->outline.n_points + 4 - (FT_UShort)start_point;
+ zone->n_contours = load->outline.n_contours - (FT_UShort)start_contour;
zone->org = load->extra_points + start_point;
zone->cur = load->outline.points + start_point;
zone->orus = load->extra_points2 + start_point;
- zone->tags = (FT_Byte*)load->outline.tags + start_point;
- zone->contours = (FT_UShort*)load->outline.contours + start_contour;
+ zone->tags = load->outline.tags + start_point;
+ zone->contours = load->outline.contours + start_contour;
zone->first_point = (FT_UShort)start_point;
}
@@ -1046,7 +1043,7 @@
current.points = gloader->base.outline.points +
num_base_points;
current.n_points = gloader->base.outline.n_points -
- (short)num_base_points;
+ (FT_UShort)num_base_points;
have_scale = FT_BOOL( subglyph->flags & ( WE_HAVE_A_SCALE |
WE_HAVE_AN_XY_SCALE |
@@ -1059,7 +1056,7 @@
/* get offset */
if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) )
{
- FT_UInt num_points = (FT_UInt)gloader->base.outline.n_points;
+ FT_UInt num_points = gloader->base.outline.n_points;
FT_UInt k = (FT_UInt)subglyph->arg1;
FT_UInt l = (FT_UInt)subglyph->arg2;
FT_Vector* p1;
@@ -1721,8 +1718,8 @@
FT_List_Add( &loader->composites, node );
}
- start_point = (FT_UInt)gloader->base.outline.n_points;
- start_contour = (FT_UInt)gloader->base.outline.n_contours;
+ start_point = gloader->base.outline.n_points;
+ start_contour = gloader->base.outline.n_contours;
/* for each subglyph, read composite header */
error = face->read_composite_glyph( loader );
@@ -1741,14 +1738,14 @@
if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ||
FT_IS_VARIATION( FT_FACE( face ) ) )
{
- short i, limit;
+ FT_UShort i, limit;
FT_SubGlyph subglyph;
FT_Outline outline = { 0, 0, NULL, NULL, NULL, 0 };
FT_Vector* unrounded = NULL;
- limit = (short)gloader->current.num_subglyphs;
+ limit = (FT_UShort)gloader->current.num_subglyphs;
/* construct an outline structure for */
/* communication with `TT_Vary_Apply_Glyph_Deltas' */
@@ -1874,7 +1871,7 @@
linear_hadvance = loader->linear;
linear_vadvance = loader->vadvance;
- num_base_points = (FT_UInt)gloader->base.outline.n_points;
+ num_base_points = gloader->base.outline.n_points;
error = load_truetype_glyph( loader,
(FT_UInt)subglyph->index,
@@ -1898,7 +1895,7 @@
loader->vadvance = linear_vadvance;
}
- num_points = (FT_UInt)gloader->base.outline.n_points;
+ num_points = gloader->base.outline.n_points;
if ( num_points == num_base_points )
continue;
@@ -2313,7 +2310,7 @@
*
* 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.
+ * 2) FT_RENDER_MODE_MONO (i.e, monochrome 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
@@ -2719,7 +2716,7 @@
size->metrics->y_ppem < 24 )
glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
- FT_TRACE1(( " subglyphs = %u, contours = %hd, points = %hd,"
+ FT_TRACE1(( " subglyphs = %u, contours = %hu, points = %hu,"
" flags = 0x%.3x\n",
loader.gloader->base.num_subglyphs,
glyph->outline.n_contours,
diff --git a/contrib/libs/freetype/src/truetype/ttgload.h b/contrib/libs/freetype/src/truetype/ttgload.h
index f18637dce3..22ea967f30 100644
--- a/contrib/libs/freetype/src/truetype/ttgload.h
+++ b/contrib/libs/freetype/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
*
* TrueType Glyph Loader (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/truetype/ttgxvar.c b/contrib/libs/freetype/src/truetype/ttgxvar.c
index ad4f266b27..4f0083c96b 100644
--- a/contrib/libs/freetype/src/truetype/ttgxvar.c
+++ b/contrib/libs/freetype/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
*
* TrueType GX Font Variation loader
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.
*
* This file is part of the FreeType project, and may only be used,
@@ -129,9 +129,6 @@
* 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
@@ -144,14 +141,14 @@
*/
static FT_UShort*
ft_var_readpackedpoints( FT_Stream stream,
- FT_ULong size,
FT_UInt *point_cnt )
{
FT_UShort *points = NULL;
FT_UInt n;
- FT_UInt runcnt;
+ FT_UInt runcnt, cnt;
FT_UInt i, j;
FT_UShort first;
+ FT_Byte* p;
FT_Memory memory = stream->memory;
FT_Error error;
@@ -169,56 +166,60 @@
n |= FT_GET_BYTE();
}
- if ( n > size )
- {
- FT_TRACE1(( "ft_var_readpackedpoints: number of points too large\n" ));
+ if ( FT_QNEW_ARRAY( points, n ) )
return NULL;
- }
-
- /* in the nested loops below we increase `i' twice; */
- /* it is faster to simply allocate one more slot */
- /* than to add another test within the loop */
- if ( FT_QNEW_ARRAY( points, n + 1 ) )
- return NULL;
-
- *point_cnt = n;
+ p = stream->cursor;
first = 0;
i = 0;
while ( i < n )
{
- runcnt = FT_GET_BYTE();
+ if ( p >= stream->limit )
+ goto Fail;
+
+ runcnt = FT_NEXT_BYTE( p );
+ cnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK;
+
+ /* first point not included in run count */
+ cnt++;
+ if ( cnt > n - i )
+ cnt = n - i;
+
if ( runcnt & GX_PT_POINTS_ARE_WORDS )
{
- runcnt &= GX_PT_POINT_RUN_COUNT_MASK;
- first += FT_GET_USHORT();
- points[i++] = first;
+ if ( 2 * cnt > (FT_UInt)( stream->limit - p ) )
+ goto Fail;
- /* first point not included in run count */
- for ( j = 0; j < runcnt; j++ )
+ for ( j = 0; j < cnt; j++ )
{
- first += FT_GET_USHORT();
+ first += FT_NEXT_USHORT( p );
points[i++] = first;
- if ( i >= n )
- break;
}
}
else
{
- first += FT_GET_BYTE();
- points[i++] = first;
+ if ( cnt > (FT_UInt)( stream->limit - p ) )
+ goto Fail;
- for ( j = 0; j < runcnt; j++ )
+ for ( j = 0; j < cnt; j++ )
{
- first += FT_GET_BYTE();
+ first += FT_NEXT_BYTE( p );
points[i++] = first;
- if ( i >= n )
- break;
}
}
}
+ stream->cursor = p;
+
+ *point_cnt = n;
+
return points;
+
+ Fail:
+ FT_TRACE1(( "ft_var_readpackedpoints: invalid table\n" ));
+
+ FT_FREE( points );
+ return NULL;
}
@@ -240,9 +241,6 @@
* stream ::
* The data stream.
*
- * size ::
- * The size of the table holding the data.
- *
* delta_cnt ::
* The number of deltas to be read.
*
@@ -258,13 +256,12 @@
*/
static FT_Fixed*
ft_var_readpackeddeltas( FT_Stream stream,
- FT_ULong size,
FT_UInt delta_cnt )
{
FT_Fixed *deltas = NULL;
FT_UInt runcnt, cnt;
FT_UInt i, j;
- FT_UInt bytes_used;
+ FT_Byte* p;
FT_Memory memory = stream->memory;
FT_Error error;
@@ -272,68 +269,51 @@
if ( FT_QNEW_ARRAY( deltas, delta_cnt ) )
return NULL;
- i = 0;
- bytes_used = 0;
-
- while ( i < delta_cnt && bytes_used < size )
+ p = stream->cursor;
+ i = 0;
+ while ( i < delta_cnt )
{
- runcnt = FT_GET_BYTE();
+ if ( p >= stream->limit )
+ goto Fail;
+
+ runcnt = FT_NEXT_BYTE( p );
cnt = runcnt & GX_DT_DELTA_RUN_COUNT_MASK;
- bytes_used++;
+ /* first point not included in run count */
+ cnt++;
+ if ( cnt > delta_cnt - i )
+ cnt = delta_cnt - i;
if ( runcnt & GX_DT_DELTAS_ARE_ZERO )
{
- /* `cnt` + 1 zeroes get added */
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
+ for ( j = 0; j < cnt; j++ )
deltas[i++] = 0;
}
else if ( runcnt & GX_DT_DELTAS_ARE_WORDS )
{
- /* `cnt` + 1 shorts from the stack */
- bytes_used += 2 * ( cnt + 1 );
- if ( bytes_used > size )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas:"
- " number of short deltas too large\n" ));
+ if ( 2 * cnt > (FT_UInt)( stream->limit - p ) )
goto Fail;
- }
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
- deltas[i++] = FT_intToFixed( FT_GET_SHORT() );
+ for ( j = 0; j < cnt; j++ )
+ deltas[i++] = FT_intToFixed( FT_NEXT_SHORT( p ) );
}
else
{
- /* `cnt` + 1 signed bytes from the stack */
- bytes_used += cnt + 1;
- if ( bytes_used > size )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas:"
- " number of byte deltas too large\n" ));
+ if ( cnt > (FT_UInt)( stream->limit - p ) )
goto Fail;
- }
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
- deltas[i++] = FT_intToFixed( FT_GET_CHAR() );
- }
-
- if ( j <= cnt )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas:"
- " number of deltas too large\n" ));
- goto Fail;
+ for ( j = 0; j < cnt; j++ )
+ deltas[i++] = FT_intToFixed( FT_NEXT_CHAR( p ) );
}
}
- if ( i < delta_cnt )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas: not enough deltas\n" ));
- goto Fail;
- }
+ stream->cursor = p;
return deltas;
Fail:
+ FT_TRACE1(( "ft_var_readpackeddeltas: invalid table\n" ));
+
FT_FREE( deltas );
return NULL;
}
@@ -596,7 +576,7 @@
for ( j = 0; j < itemStore->axisCount; j++ )
{
- FT_Short start, peak, end;
+ FT_Int start, peak, end;
if ( FT_READ_SHORT( start ) ||
@@ -604,6 +584,10 @@
FT_READ_SHORT( end ) )
goto Exit;
+ /* immediately tag invalid ranges with special peak = 0 */
+ if ( ( start < 0 && end > 0 ) || start > peak || peak > end )
+ peak = 0;
+
axisCoords[j].startCoord = FT_fdot14ToFixed( start );
axisCoords[j].peakCoord = FT_fdot14ToFixed( peak );
axisCoords[j].endCoord = FT_fdot14ToFixed( end );
@@ -1024,6 +1008,9 @@
if ( innerIndex >= varData->itemCount )
return 0; /* Out of range. */
+ if ( varData->regionIdxCount == 0 )
+ return 0; /* Avoid "applying zero offset to null pointer". */
+
if ( varData->regionIdxCount < 16 )
{
deltaSet = deltaSetStack;
@@ -1074,43 +1061,32 @@
/* inner loop steps through axes in this region */
for ( j = 0; j < itemStore->axisCount; j++, axis++ )
{
- /* compute the scalar contribution of this axis; */
- /* ignore invalid ranges */
- if ( axis->startCoord > axis->peakCoord ||
- axis->peakCoord > axis->endCoord )
- continue;
+ FT_Fixed ncv = ttface->blend->normalizedcoords[j];
- else if ( axis->startCoord < 0 &&
- axis->endCoord > 0 &&
- axis->peakCoord != 0 )
- continue;
- /* peak of 0 means ignore this axis */
- else if ( axis->peakCoord == 0 )
- continue;
-
- else if ( ttface->blend->normalizedcoords[j] == axis->peakCoord )
+ /* compute the scalar contribution of this axis */
+ /* with peak of 0 used for invalid axes */
+ if ( axis->peakCoord == ncv ||
+ axis->peakCoord == 0 )
continue;
/* ignore this region if coords are out of range */
- else if ( ttface->blend->normalizedcoords[j] <= axis->startCoord ||
- ttface->blend->normalizedcoords[j] >= axis->endCoord )
+ else if ( ncv <= axis->startCoord ||
+ ncv >= axis->endCoord )
{
scalar = 0;
break;
}
/* cumulative product of all the axis scalars */
- else if ( ttface->blend->normalizedcoords[j] < axis->peakCoord )
- scalar =
- FT_MulDiv( scalar,
- ttface->blend->normalizedcoords[j] - axis->startCoord,
- axis->peakCoord - axis->startCoord );
- else
- scalar =
- FT_MulDiv( scalar,
- axis->endCoord - ttface->blend->normalizedcoords[j],
- axis->endCoord - axis->peakCoord );
+ else if ( ncv < axis->peakCoord )
+ scalar = FT_MulDiv( scalar,
+ ncv - axis->startCoord,
+ axis->peakCoord - axis->startCoord );
+ else /* ncv > axis->peakCoord */
+ scalar = FT_MulDiv( scalar,
+ axis->endCoord - ncv,
+ axis->endCoord - axis->peakCoord );
} /* per-axis loop */
@@ -1920,32 +1896,27 @@
for ( i = 0; i < blend->num_axis; i++ )
{
- FT_TRACE6(( " axis %d coordinate %.5f:\n",
- i, (double)blend->normalizedcoords[i] / 65536 ));
+ FT_Fixed ncv = blend->normalizedcoords[i];
+
+
+ FT_TRACE6(( " axis %d coordinate %.5f:\n", i, (double)ncv / 65536 ));
/* It's not clear why (for intermediate tuples) we don't need */
/* to check against start/end -- the documentation says we don't. */
/* Similarly, it's unclear why we don't need to scale along the */
/* axis. */
- if ( tuple_coords[i] == 0 )
+ if ( tuple_coords[i] == ncv )
{
- FT_TRACE6(( " tuple coordinate is zero, ignore\n" ));
+ FT_TRACE6(( " tuple coordinate %.5f fits perfectly\n",
+ (double)tuple_coords[i] / 65536 ));
+ /* `apply' does not change */
continue;
}
- if ( blend->normalizedcoords[i] == 0 )
- {
- FT_TRACE6(( " axis coordinate is zero, stop\n" ));
- apply = 0;
- break;
- }
-
- if ( blend->normalizedcoords[i] == tuple_coords[i] )
+ if ( tuple_coords[i] == 0 )
{
- FT_TRACE6(( " tuple coordinate %.5f fits perfectly\n",
- (double)tuple_coords[i] / 65536 ));
- /* `apply' does not change */
+ FT_TRACE6(( " tuple coordinate is zero, ignore\n" ));
continue;
}
@@ -1953,27 +1924,27 @@
{
/* not an intermediate tuple */
- if ( blend->normalizedcoords[i] < FT_MIN( 0, tuple_coords[i] ) ||
- blend->normalizedcoords[i] > FT_MAX( 0, tuple_coords[i] ) )
+ if ( ( tuple_coords[i] > ncv && ncv > 0 ) ||
+ ( tuple_coords[i] < ncv && ncv < 0 ) )
+ {
+ FT_TRACE6(( " tuple coordinate %.5f fits\n",
+ (double)tuple_coords[i] / 65536 ));
+ apply = FT_MulDiv( apply, ncv, tuple_coords[i] );
+ }
+ else
{
FT_TRACE6(( " tuple coordinate %.5f is exceeded, stop\n",
(double)tuple_coords[i] / 65536 ));
apply = 0;
break;
}
-
- FT_TRACE6(( " tuple coordinate %.5f fits\n",
- (double)tuple_coords[i] / 65536 ));
- apply = FT_MulDiv( apply,
- blend->normalizedcoords[i],
- tuple_coords[i] );
}
else
{
/* intermediate tuple */
- if ( blend->normalizedcoords[i] <= im_start_coords[i] ||
- blend->normalizedcoords[i] >= im_end_coords[i] )
+ if ( ncv <= im_start_coords[i] ||
+ ncv >= im_end_coords[i] )
{
FT_TRACE6(( " intermediate tuple range ]%.5f;%.5f[ is exceeded,"
" stop\n",
@@ -1986,13 +1957,13 @@
FT_TRACE6(( " intermediate tuple range ]%.5f;%.5f[ fits\n",
(double)im_start_coords[i] / 65536,
(double)im_end_coords[i] / 65536 ));
- if ( blend->normalizedcoords[i] < tuple_coords[i] )
+ if ( ncv < tuple_coords[i] )
apply = FT_MulDiv( apply,
- blend->normalizedcoords[i] - im_start_coords[i],
+ ncv - im_start_coords[i],
tuple_coords[i] - im_start_coords[i] );
- else
+ else /* ncv > tuple_coords[i] */
apply = FT_MulDiv( apply,
- im_end_coords[i] - blend->normalizedcoords[i],
+ im_end_coords[i] - ncv,
im_end_coords[i] - tuple_coords[i] );
}
}
@@ -2141,11 +2112,12 @@
outerIndex,
innerIndex );
- v += delta << 2;
+ /* Convert delta in F2DOT14 to 16.16 before adding. */
+ v += MUL_INT( delta, 4 );
- /* Clamp value range. */
- v = v >= 0x10000L ? 0x10000 : v;
- v = v <= -0x10000L ? -0x10000 : v;
+ /* Clamp value to range [-1, 1]. */
+ v = v >= 0x10000L ? 0x10000 : v;
+ v = v <= -0x10000L ? -0x10000 : v;
new_normalized[i] = v;
}
@@ -2721,9 +2693,8 @@
FT_UInt n;
- if ( FT_ALLOC( mmvar, ttface->blend->mmvar_len ) )
+ if ( FT_DUP( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len ) )
goto Exit;
- FT_MEM_COPY( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len );
axis_flags =
(FT_UShort*)( (char*)mmvar + mmvar_size );
@@ -3533,9 +3504,10 @@
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_Fixed* peak_coords = NULL;
+ FT_Fixed* tuple_coords;
+ FT_Fixed* im_start_coords;
+ FT_Fixed* im_end_coords;
GX_Blend blend = face->blend;
@@ -3556,16 +3528,16 @@
{
FT_TRACE2(( "\n" ));
FT_TRACE2(( "tt_face_vary_cvt: no blend specified\n" ));
- error = FT_Err_Ok;
- goto Exit;
+
+ return FT_Err_Ok;
}
if ( !face->cvt )
{
FT_TRACE2(( "\n" ));
FT_TRACE2(( "tt_face_vary_cvt: no `cvt ' table\n" ));
- error = FT_Err_Ok;
- goto Exit;
+
+ return FT_Err_Ok;
}
error = face->goto_table( face, TTAG_cvar, stream, &table_len );
@@ -3573,15 +3545,11 @@
{
FT_TRACE2(( "is missing\n" ));
- error = FT_Err_Ok;
- goto Exit;
+ return FT_Err_Ok;
}
if ( FT_FRAME_ENTER( table_len ) )
- {
- error = FT_Err_Ok;
- goto Exit;
- }
+ return FT_Err_Ok;
table_start = FT_Stream_FTell( stream );
if ( FT_GET_LONG() != 0x00010000L )
@@ -3594,11 +3562,6 @@
FT_TRACE2(( "loaded\n" ));
- if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) ||
- FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||
- FT_NEW_ARRAY( im_end_coords, blend->num_axis ) )
- goto FExit;
-
tupleCount = FT_GET_USHORT();
offsetToData = FT_GET_USHORT();
@@ -3621,9 +3584,8 @@
FT_Stream_SeekSet( stream, offsetToData );
- sharedpoints = ft_var_readpackedpoints( stream,
- table_len,
- &spoint_count );
+ sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
+
offsetToData = FT_Stream_FTell( stream );
FT_Stream_SeekSet( stream, here );
@@ -3634,8 +3596,12 @@
tupleCount & GX_TC_TUPLE_COUNT_MASK,
( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" ));
- if ( FT_NEW_ARRAY( cvt_deltas, face->cvt_size ) )
- goto FExit;
+ if ( FT_QNEW_ARRAY( peak_coords, 3 * blend->num_axis ) ||
+ FT_NEW_ARRAY( cvt_deltas, face->cvt_size ) )
+ goto Exit;
+
+ im_start_coords = peak_coords + blend->num_axis;
+ im_end_coords = im_start_coords + blend->num_axis;
for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); i++ )
{
@@ -3652,32 +3618,19 @@
if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )
{
for ( j = 0; j < blend->num_axis; j++ )
- tuple_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() );
+ peak_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() );
+ tuple_coords = peak_coords;
}
- else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )
+ else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) < blend->tuplecount )
+ tuple_coords = blend->tuplecoords +
+ ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis;
+ else
{
FT_TRACE2(( "tt_face_vary_cvt:"
" invalid tuple index\n" ));
error = FT_THROW( Invalid_Table );
- 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 & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis,
- blend->num_axis * sizeof ( FT_Fixed ) );
+ goto Exit;
}
if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
@@ -3706,9 +3659,7 @@
if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
{
- localpoints = ft_var_readpackedpoints( stream,
- table_len,
- &point_count );
+ localpoints = ft_var_readpackedpoints( stream, &point_count );
points = localpoints;
}
else
@@ -3719,7 +3670,6 @@
}
deltas = ft_var_readpackeddeltas( stream,
- table_len,
point_count == 0 ? face->cvt_size
: point_count );
@@ -3820,22 +3770,20 @@
for ( i = 0; i < face->cvt_size; i++ )
face->cvt[i] += FT_fixedToFdot6( cvt_deltas[i] );
- FExit:
- FT_FRAME_EXIT();
+ /* 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 );
Exit:
if ( sharedpoints != ALL_POINTS )
FT_FREE( sharedpoints );
- FT_FREE( tuple_coords );
- FT_FREE( im_start_coords );
- FT_FREE( im_end_coords );
FT_FREE( cvt_deltas );
+ FT_FREE( peak_coords );
- /* 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 );
+ FExit:
+ FT_FRAME_EXIT();
return error;
@@ -4099,9 +4047,10 @@
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_Fixed* peak_coords = NULL;
+ FT_Fixed* tuple_coords;
+ FT_Fixed* im_start_coords;
+ FT_Fixed* im_end_coords;
GX_Blend blend = face->blend;
@@ -4136,27 +4085,17 @@
return FT_Err_Ok;
}
- if ( FT_NEW_ARRAY( points_org, n_points ) ||
- FT_NEW_ARRAY( points_out, n_points ) ||
- FT_NEW_ARRAY( has_delta, n_points ) )
- goto Fail1;
-
dataSize = blend->glyphoffsets[glyph_index + 1] -
blend->glyphoffsets[glyph_index];
if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) ||
FT_FRAME_ENTER( dataSize ) )
- goto Fail1;
+ return error;
glyph_start = FT_Stream_FTell( stream );
/* each set of glyph variation data is formatted similarly to `cvar' */
- if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) ||
- FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||
- FT_NEW_ARRAY( im_end_coords, blend->num_axis ) )
- goto Fail2;
-
tupleCount = FT_GET_USHORT();
offsetToData = FT_GET_USHORT();
@@ -4168,7 +4107,7 @@
" invalid glyph variation array header\n" ));
error = FT_THROW( Invalid_Table );
- goto Fail2;
+ goto FExit;
}
offsetToData += glyph_start;
@@ -4179,9 +4118,8 @@
FT_Stream_SeekSet( stream, offsetToData );
- sharedpoints = ft_var_readpackedpoints( stream,
- blend->gvar_size,
- &spoint_count );
+ sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
+
offsetToData = FT_Stream_FTell( stream );
FT_Stream_SeekSet( stream, here );
@@ -4192,9 +4130,16 @@
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;
+ if ( FT_QNEW_ARRAY( peak_coords, 3 * blend->num_axis ) ||
+ FT_NEW_ARRAY( point_deltas_x, 2 * n_points ) ||
+ FT_QNEW_ARRAY( points_org, n_points ) ||
+ FT_QNEW_ARRAY( points_out, n_points ) ||
+ FT_QNEW_ARRAY( has_delta, n_points ) )
+ goto Exit;
+
+ im_start_coords = peak_coords + blend->num_axis;
+ im_end_coords = im_start_coords + blend->num_axis;
+ point_deltas_y = point_deltas_x + n_points;
for ( j = 0; j < n_points; j++ )
{
@@ -4217,22 +4162,20 @@
if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )
{
for ( j = 0; j < blend->num_axis; j++ )
- tuple_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() );
+ peak_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() );
+ tuple_coords = peak_coords;
}
- else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )
+ else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) < blend->tuplecount )
+ tuple_coords = blend->tuplecoords +
+ ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis;
+ else
{
FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:"
" invalid tuple index\n" ));
error = FT_THROW( Invalid_Table );
- goto Fail3;
+ goto Exit;
}
- else
- FT_MEM_COPY(
- tuple_coords,
- blend->tuplecoords +
- ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis,
- blend->num_axis * sizeof ( FT_Fixed ) );
if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
{
@@ -4260,9 +4203,7 @@
if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
{
- localpoints = ft_var_readpackedpoints( stream,
- blend->gvar_size,
- &point_count );
+ localpoints = ft_var_readpackedpoints( stream, &point_count );
points = localpoints;
}
else
@@ -4272,11 +4213,9 @@
}
deltas_x = ft_var_readpackeddeltas( stream,
- blend->gvar_size,
point_count == 0 ? n_points
: point_count );
deltas_y = ft_var_readpackeddeltas( stream,
- blend->gvar_size,
point_count == 0 ? n_points
: point_count );
@@ -4460,23 +4399,17 @@
unrounded[n_points - 2].y ) / 64;
}
- Fail3:
- FT_FREE( point_deltas_x );
- FT_FREE( point_deltas_y );
-
- Fail2:
+ Exit:
if ( sharedpoints != ALL_POINTS )
FT_FREE( sharedpoints );
- FT_FREE( tuple_coords );
- FT_FREE( im_start_coords );
- FT_FREE( im_end_coords );
-
- FT_FRAME_EXIT();
-
- Fail1:
FT_FREE( points_org );
FT_FREE( points_out );
FT_FREE( has_delta );
+ FT_FREE( peak_coords );
+ FT_FREE( point_deltas_x );
+
+ FExit:
+ FT_FRAME_EXIT();
return error;
}
diff --git a/contrib/libs/freetype/src/truetype/ttgxvar.h b/contrib/libs/freetype/src/truetype/ttgxvar.h
index e3da6d1705..9326011e3a 100644
--- a/contrib/libs/freetype/src/truetype/ttgxvar.h
+++ b/contrib/libs/freetype/src/truetype/ttgxvar.h
@@ -4,7 +4,7 @@
*
* TrueType GX Font Variation loader (specification)
*
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg and George Williams.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/truetype/ttinterp.c b/contrib/libs/freetype/src/truetype/ttinterp.c
index 79df4555d9..951891dbf5 100644
--- a/contrib/libs/freetype/src/truetype/ttinterp.c
+++ b/contrib/libs/freetype/src/truetype/ttinterp.c
@@ -4,7 +4,7 @@
*
* TrueType bytecode interpreter (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -5270,11 +5270,11 @@
FT_UShort refp;
FT_F26Dot6 dx, dy;
- FT_Short contour, bounds;
+ FT_UShort contour, bounds;
FT_UShort start, limit, i;
- contour = (FT_Short)args[0];
+ contour = (FT_UShort)args[0];
bounds = ( exc->GS.gep2 == 0 ) ? 1 : exc->zp2.n_contours;
if ( BOUNDS( contour, bounds ) )
@@ -5290,15 +5290,13 @@
if ( contour == 0 )
start = 0;
else
- start = (FT_UShort)( exc->zp2.contours[contour - 1] + 1 -
- exc->zp2.first_point );
+ start = exc->zp2.contours[contour - 1] + 1 - exc->zp2.first_point;
/* we use the number of points if in the twilight zone */
if ( exc->GS.gep2 == 0 )
limit = exc->zp2.n_points;
else
- limit = (FT_UShort)( exc->zp2.contours[contour] -
- exc->zp2.first_point + 1 );
+ limit = exc->zp2.contours[contour] + 1 - exc->zp2.first_point;
for ( i = start; i < limit; i++ )
{
@@ -5341,9 +5339,9 @@
/* Normal zone's `n_points' includes phantoms, so must */
/* use end of last contour. */
if ( exc->GS.gep2 == 0 )
- limit = (FT_UShort)exc->zp2.n_points;
+ limit = exc->zp2.n_points;
else if ( exc->GS.gep2 == 1 && exc->zp2.n_contours > 0 )
- limit = (FT_UShort)( exc->zp2.contours[exc->zp2.n_contours - 1] + 1 );
+ limit = exc->zp2.contours[exc->zp2.n_contours - 1] + 1;
else
limit = 0;
diff --git a/contrib/libs/freetype/src/truetype/ttinterp.h b/contrib/libs/freetype/src/truetype/ttinterp.h
index e98e258fe7..4f1a9bbc67 100644
--- a/contrib/libs/freetype/src/truetype/ttinterp.h
+++ b/contrib/libs/freetype/src/truetype/ttinterp.h
@@ -4,7 +4,7 @@
*
* TrueType bytecode interpreter (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/truetype/ttobjs.c b/contrib/libs/freetype/src/truetype/ttobjs.c
index 5b56af711d..d0ac318120 100644
--- a/contrib/libs/freetype/src/truetype/ttobjs.c
+++ b/contrib/libs/freetype/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
*
* Objects manager (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -115,7 +115,7 @@
FT_LOCAL_DEF( FT_Error )
tt_glyphzone_new( FT_Memory memory,
FT_UShort maxPoints,
- FT_Short maxContours,
+ FT_UShort maxContours,
TT_GlyphZone zone )
{
FT_Error error;
@@ -152,18 +152,20 @@
static const FT_String*
tt_skip_pdffont_random_tag( const FT_String* name )
{
- unsigned int i;
-
-
- if ( ft_strlen( name ) < 8 || name[6] != '+' )
- return name;
-
- for ( i = 0; i < 6; i++ )
- if ( !ft_isupper( name[i] ) )
- return name;
+ if ( ft_isupper( name[0] ) &&
+ ft_isupper( name[1] ) &&
+ ft_isupper( name[2] ) &&
+ ft_isupper( name[3] ) &&
+ ft_isupper( name[4] ) &&
+ ft_isupper( name[5] ) &&
+ '+' == name[6] &&
+ name[7] )
+ {
+ FT_TRACE7(( "name without randomization tag: %s\n", name + 7 ));
+ return name + 7;
+ }
- FT_TRACE7(( "name without randomization tag: %s\n", name + 7 ));
- return name + 7;
+ return name;
}
@@ -254,17 +256,20 @@
{
FT_Error error;
FT_UInt32 checksum = 0;
- FT_UInt i;
+ FT_Byte* p;
+ FT_Int shift;
if ( FT_FRAME_ENTER( length ) )
return 0;
+ p = (FT_Byte*)stream->cursor;
+
for ( ; length > 3; length -= 4 )
- checksum += (FT_UInt32)FT_GET_ULONG();
+ checksum += FT_NEXT_ULONG( p );
- for ( i = 3; length > 0; length--, i-- )
- checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 );
+ for ( shift = 24; length > 0; length--, shift -=8 )
+ checksum += (FT_UInt32)FT_NEXT_BYTE( p ) << shift;
FT_FRAME_EXIT();
@@ -782,8 +787,7 @@
FT_UInt instance_index = (FT_UInt)face_index >> 16;
- if ( FT_HAS_MULTIPLE_MASTERS( ttface ) &&
- instance_index > 0 )
+ if ( FT_HAS_MULTIPLE_MASTERS( ttface ) )
{
error = FT_Set_Named_Instance( ttface, instance_index );
if ( error )
@@ -990,16 +994,16 @@
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 );
+ /* Unscaled CVT values are already stored in 26.6 format. */
+ /* Note that this scaling operation is very sensitive to rounding; */
+ /* the integer division by 64 must be applied to the first argument. */
+ size->cvt[i] = FT_MulFix( face->cvt[i] / 64, size->ttmetrics.scale );
FT_TRACE6(( " %3d: %f (%f)\n",
i, (double)face->cvt[i] / 64, (double)size->cvt[i] / 64 ));
}
diff --git a/contrib/libs/freetype/src/truetype/ttobjs.h b/contrib/libs/freetype/src/truetype/ttobjs.h
index 40eb37b4c4..9c36ca7836 100644
--- a/contrib/libs/freetype/src/truetype/ttobjs.h
+++ b/contrib/libs/freetype/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
*
* Objects manager (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -105,7 +105,7 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
tt_glyphzone_new( FT_Memory memory,
FT_UShort maxPoints,
- FT_Short maxContours,
+ FT_UShort maxContours,
TT_GlyphZone zone );
#endif /* TT_USE_BYTECODE_INTERPRETER */
diff --git a/contrib/libs/freetype/src/truetype/ttpload.c b/contrib/libs/freetype/src/truetype/ttpload.c
index 54a64c7b46..9505b5f179 100644
--- a/contrib/libs/freetype/src/truetype/ttpload.c
+++ b/contrib/libs/freetype/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
*
* TrueType-specific tables loader (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/truetype/ttpload.h b/contrib/libs/freetype/src/truetype/ttpload.h
index ed229fa461..bc32b58020 100644
--- a/contrib/libs/freetype/src/truetype/ttpload.h
+++ b/contrib/libs/freetype/src/truetype/ttpload.h
@@ -4,7 +4,7 @@
*
* TrueType-specific tables loader (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1afm.c b/contrib/libs/freetype/src/type1/t1afm.c
index d9b9398b01..a63cd4dc48 100644
--- a/contrib/libs/freetype/src/type1/t1afm.c
+++ b/contrib/libs/freetype/src/type1/t1afm.c
@@ -4,7 +4,7 @@
*
* AFM support for Type 1 fonts (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1afm.h b/contrib/libs/freetype/src/type1/t1afm.h
index e0d5aa5a88..7f5cdda191 100644
--- a/contrib/libs/freetype/src/type1/t1afm.h
+++ b/contrib/libs/freetype/src/type1/t1afm.h
@@ -4,7 +4,7 @@
*
* AFM support for Type 1 fonts (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1driver.c b/contrib/libs/freetype/src/type1/t1driver.c
index a4cdf372a9..8ed01914a5 100644
--- a/contrib/libs/freetype/src/type1/t1driver.c
+++ b/contrib/libs/freetype/src/type1/t1driver.c
@@ -4,7 +4,7 @@
*
* Type 1 driver interface (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -312,10 +312,7 @@
{
retval = ft_strlen( type1->glyph_names[idx] ) + 1;
if ( value && value_len >= retval )
- {
ft_memcpy( value, (void *)( type1->glyph_names[idx] ), retval );
- ((FT_Char *)value)[retval - 1] = (FT_Char)'\0';
- }
}
break;
@@ -344,11 +341,8 @@
{
retval = ft_strlen( type1->encoding.char_name[idx] ) + 1;
if ( value && value_len >= retval )
- {
ft_memcpy( value, (void *)( type1->encoding.char_name[idx] ),
- retval - 1 );
- ((FT_Char *)value)[retval - 1] = (FT_Char)'\0';
- }
+ retval );
}
break;
diff --git a/contrib/libs/freetype/src/type1/t1driver.h b/contrib/libs/freetype/src/type1/t1driver.h
index ee7fcf43e0..5ff52b55b1 100644
--- a/contrib/libs/freetype/src/type1/t1driver.h
+++ b/contrib/libs/freetype/src/type1/t1driver.h
@@ -4,7 +4,7 @@
*
* High-level Type 1 driver interface (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1errors.h b/contrib/libs/freetype/src/type1/t1errors.h
index 2fbd1e513f..8aeb24ae18 100644
--- a/contrib/libs/freetype/src/type1/t1errors.h
+++ b/contrib/libs/freetype/src/type1/t1errors.h
@@ -4,7 +4,7 @@
*
* Type 1 error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1gload.c b/contrib/libs/freetype/src/type1/t1gload.c
index a32a4649d6..c29e682510 100644
--- a/contrib/libs/freetype/src/type1/t1gload.c
+++ b/contrib/libs/freetype/src/type1/t1gload.c
@@ -4,7 +4,7 @@
*
* Type 1 Glyph Loader (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1gload.h b/contrib/libs/freetype/src/type1/t1gload.h
index c06484758a..17a6a5941e 100644
--- a/contrib/libs/freetype/src/type1/t1gload.h
+++ b/contrib/libs/freetype/src/type1/t1gload.h
@@ -4,7 +4,7 @@
*
* Type 1 Glyph Loader (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1load.c b/contrib/libs/freetype/src/type1/t1load.c
index be7cd0fd5e..ee7fb42a51 100644
--- a/contrib/libs/freetype/src/type1/t1load.c
+++ b/contrib/libs/freetype/src/type1/t1load.c
@@ -4,7 +4,7 @@
*
* Type 1 font loader (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -751,6 +751,7 @@
PS_DesignMap dmap = blend->design_map + n;
+ FT_FREE( dmap->blend_points );
FT_FREE( dmap->design_points );
dmap->num_points = 0;
}
@@ -1043,9 +1044,9 @@
}
/* allocate design map data */
- if ( FT_QNEW_ARRAY( map->design_points, num_points * 2 ) )
+ if ( FT_QNEW_ARRAY( map->design_points, num_points ) ||
+ FT_QNEW_ARRAY( map->blend_points, num_points ) )
goto Exit;
- map->blend_points = map->design_points + num_points;
map->num_points = (FT_Byte)num_points;
for ( p = 0; p < num_points; p++ )
@@ -1876,9 +1877,8 @@
}
/* t1_decrypt() shouldn't write to base -- make temporary copy */
- if ( FT_QALLOC( temp, size ) )
+ if ( FT_DUP( temp, base, size ) )
goto Fail;
- FT_MEM_COPY( temp, base, size );
psaux->t1_decrypt( temp, size, 4330 );
size -= (FT_ULong)t1face->type1.private_dict.lenIV;
error = T1_Add_Table( table,
@@ -2090,9 +2090,8 @@
}
/* t1_decrypt() shouldn't write to base -- make temporary copy */
- if ( FT_QALLOC( temp, size ) )
+ if ( FT_DUP( temp, base, size ) )
goto Fail;
- FT_MEM_COPY( temp, base, size );
psaux->t1_decrypt( temp, size, 4330 );
size -= (FT_ULong)t1face->type1.private_dict.lenIV;
error = T1_Add_Table( code_table,
@@ -2284,7 +2283,7 @@
T1_FIELD_DICT_PRIVATE )
#endif
- { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
+ T1_FIELD_ZERO
};
@@ -2392,18 +2391,13 @@
T1_Field keyword = (T1_Field)t1_keywords;
- for (;;)
+ while ( keyword->len )
{
- FT_Byte* name;
+ FT_Byte* name = (FT_Byte*)keyword->ident;
- name = (FT_Byte*)keyword->ident;
- if ( !name )
- break;
-
- if ( cur[0] == name[0] &&
- len == ft_strlen( (const char *)name ) &&
- ft_memcmp( cur, name, len ) == 0 )
+ if ( keyword->len == len &&
+ ft_memcmp( cur, name, len ) == 0 )
{
/* We found it -- run the parsing callback! */
/* We record every instance of every field */
diff --git a/contrib/libs/freetype/src/type1/t1load.h b/contrib/libs/freetype/src/type1/t1load.h
index d8c9d2d8ab..a45efa7cb7 100644
--- a/contrib/libs/freetype/src/type1/t1load.h
+++ b/contrib/libs/freetype/src/type1/t1load.h
@@ -4,7 +4,7 @@
*
* Type 1 font loader (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1objs.c b/contrib/libs/freetype/src/type1/t1objs.c
index 69e4fd5065..b1b27c31fe 100644
--- a/contrib/libs/freetype/src/type1/t1objs.c
+++ b/contrib/libs/freetype/src/type1/t1objs.c
@@ -4,7 +4,7 @@
*
* Type 1 objects manager (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1objs.h b/contrib/libs/freetype/src/type1/t1objs.h
index 03847b27e9..3809370c1e 100644
--- a/contrib/libs/freetype/src/type1/t1objs.h
+++ b/contrib/libs/freetype/src/type1/t1objs.h
@@ -4,7 +4,7 @@
*
* Type 1 objects manager (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1parse.c b/contrib/libs/freetype/src/type1/t1parse.c
index 6dec6c16c3..3717ea7c57 100644
--- a/contrib/libs/freetype/src/type1/t1parse.c
+++ b/contrib/libs/freetype/src/type1/t1parse.c
@@ -4,7 +4,7 @@
*
* Type 1 parser (body).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1parse.h b/contrib/libs/freetype/src/type1/t1parse.h
index 0d9a2865df..a0a2134d45 100644
--- a/contrib/libs/freetype/src/type1/t1parse.h
+++ b/contrib/libs/freetype/src/type1/t1parse.h
@@ -4,7 +4,7 @@
*
* Type 1 parser (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/t1tokens.h b/contrib/libs/freetype/src/type1/t1tokens.h
index 40f3609262..5a3d2f1ef0 100644
--- a/contrib/libs/freetype/src/type1/t1tokens.h
+++ b/contrib/libs/freetype/src/type1/t1tokens.h
@@ -4,7 +4,7 @@
*
* Type 1 tokenizer (specification).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type1/type1.c b/contrib/libs/freetype/src/type1/type1.c
index d9bd8cad92..d7ff53c799 100644
--- a/contrib/libs/freetype/src/type1/type1.c
+++ b/contrib/libs/freetype/src/type1/type1.c
@@ -4,7 +4,7 @@
*
* FreeType Type 1 driver component (body only).
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type42/t42drivr.c b/contrib/libs/freetype/src/type42/t42drivr.c
index ee5fd44a9f..25f507f150 100644
--- a/contrib/libs/freetype/src/type42/t42drivr.c
+++ b/contrib/libs/freetype/src/type42/t42drivr.c
@@ -4,7 +4,7 @@
*
* High-level Type 42 driver interface (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type42/t42drivr.h b/contrib/libs/freetype/src/type42/t42drivr.h
index ec7da18ccf..5b3852b864 100644
--- a/contrib/libs/freetype/src/type42/t42drivr.h
+++ b/contrib/libs/freetype/src/type42/t42drivr.h
@@ -4,7 +4,7 @@
*
* High-level Type 42 driver interface (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type42/t42error.h b/contrib/libs/freetype/src/type42/t42error.h
index dcea9c4f66..f52205e2f0 100644
--- a/contrib/libs/freetype/src/type42/t42error.h
+++ b/contrib/libs/freetype/src/type42/t42error.h
@@ -4,7 +4,7 @@
*
* Type 42 error codes (specification only).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type42/t42objs.c b/contrib/libs/freetype/src/type42/t42objs.c
index bf4028e751..7010ba86ed 100644
--- a/contrib/libs/freetype/src/type42/t42objs.c
+++ b/contrib/libs/freetype/src/type42/t42objs.c
@@ -4,7 +4,7 @@
*
* Type 42 objects manager (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type42/t42objs.h b/contrib/libs/freetype/src/type42/t42objs.h
index 33e6215e10..3ca83bc54e 100644
--- a/contrib/libs/freetype/src/type42/t42objs.h
+++ b/contrib/libs/freetype/src/type42/t42objs.h
@@ -4,7 +4,7 @@
*
* Type 42 objects manager (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type42/t42parse.c b/contrib/libs/freetype/src/type42/t42parse.c
index f96a43b14d..e53d352873 100644
--- a/contrib/libs/freetype/src/type42/t42parse.c
+++ b/contrib/libs/freetype/src/type42/t42parse.c
@@ -4,7 +4,7 @@
*
* Type 42 font parser (body).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
@@ -99,7 +99,7 @@
T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings, 0 )
T1_FIELD_CALLBACK( "sfnts", t42_parse_sfnts, 0 )
- { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
+ T1_FIELD_ZERO
};
@@ -1195,8 +1195,6 @@
{
T42_Parser parser = &loader->parser;
FT_Byte* limit;
- FT_Int n_keywords = (FT_Int)( sizeof ( t42_keywords ) /
- sizeof ( t42_keywords[0] ) );
parser->root.cursor = base;
@@ -1273,24 +1271,20 @@
if ( len > 0 && len < 22 && parser->root.cursor < limit )
{
- int i;
+ T1_Field keyword = (T1_Field)t42_keywords;
/* now compare the immediate name to the keyword table */
-
- /* loop through all known keywords */
- for ( i = 0; i < n_keywords; i++ )
+ while ( keyword->len )
{
- T1_Field keyword = (T1_Field)&t42_keywords[i];
- FT_Byte *name = (FT_Byte*)keyword->ident;
+ FT_Byte* name = (FT_Byte*)keyword->ident;
if ( !name )
continue;
- if ( cur[0] == name[0] &&
- len == ft_strlen( (const char *)name ) &&
- ft_memcmp( cur, name, len ) == 0 )
+ if ( keyword->len == len &&
+ ft_memcmp( cur, name, len ) == 0 )
{
/* we found it -- run the parsing callback! */
parser->root.error = t42_load_keyword( face,
@@ -1300,6 +1294,8 @@
return parser->root.error;
break;
}
+
+ keyword++;
}
}
}
diff --git a/contrib/libs/freetype/src/type42/t42parse.h b/contrib/libs/freetype/src/type42/t42parse.h
index 5741c54137..e977861624 100644
--- a/contrib/libs/freetype/src/type42/t42parse.h
+++ b/contrib/libs/freetype/src/type42/t42parse.h
@@ -4,7 +4,7 @@
*
* Type 42 font parser (specification).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type42/t42types.h b/contrib/libs/freetype/src/type42/t42types.h
index 0bfe14ee4d..550cc07ca1 100644
--- a/contrib/libs/freetype/src/type42/t42types.h
+++ b/contrib/libs/freetype/src/type42/t42types.h
@@ -4,7 +4,7 @@
*
* Type 42 font data types (specification only).
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* Roberto Alameda.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/type42/type42.c b/contrib/libs/freetype/src/type42/type42.c
index 8d2302c8e6..a9444f0f50 100644
--- a/contrib/libs/freetype/src/type42/type42.c
+++ b/contrib/libs/freetype/src/type42/type42.c
@@ -4,7 +4,7 @@
*
* FreeType Type 42 driver component.
*
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/winfonts/fnterrs.h b/contrib/libs/freetype/src/winfonts/fnterrs.h
index dafdb07b4e..7ca6592397 100644
--- a/contrib/libs/freetype/src/winfonts/fnterrs.h
+++ b/contrib/libs/freetype/src/winfonts/fnterrs.h
@@ -4,7 +4,7 @@
*
* Win FNT/FON error codes (specification only).
*
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/contrib/libs/freetype/src/winfonts/winfnt.c b/contrib/libs/freetype/src/winfonts/winfnt.c
index 1160e4ef36..74a06416cd 100644
--- a/contrib/libs/freetype/src/winfonts/winfnt.c
+++ b/contrib/libs/freetype/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
*
* FreeType font driver for Windows FNT/FON files
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
* Copyright 2003 Huw D M Davies for Codeweavers
* Copyright 2007 Dmitry Timoshkov for Codeweavers
@@ -359,8 +359,8 @@
if ( type_id == 0x8008U )
{
font_count = count;
- font_offset = FT_STREAM_POS() + 4 +
- (FT_ULong)( stream->cursor - stream->limit );
+ font_offset = FT_STREAM_POS() + 4 -
+ (FT_ULong)( stream->limit - stream->cursor );
break;
}
@@ -1006,7 +1006,7 @@
FT_UInt glyph_index,
FT_Int32 load_flags )
{
- FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
+ FNT_Face face = (FNT_Face)size->face;
FNT_Font font;
FT_Error error = FT_Err_Ok;
FT_Byte* p;
diff --git a/contrib/libs/freetype/src/winfonts/winfnt.h b/contrib/libs/freetype/src/winfonts/winfnt.h
index 2f75b9e86c..78137496f9 100644
--- a/contrib/libs/freetype/src/winfonts/winfnt.h
+++ b/contrib/libs/freetype/src/winfonts/winfnt.h
@@ -4,7 +4,7 @@
*
* FreeType font driver for Windows FNT/FON files
*
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
* Copyright 2007 Dmitry Timoshkov for Codeweavers
*
diff --git a/contrib/libs/freetype/ya.make b/contrib/libs/freetype/ya.make
index 8351c60c5a..d013e29bbb 100644
--- a/contrib/libs/freetype/ya.make
+++ b/contrib/libs/freetype/ya.make
@@ -16,7 +16,7 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(2.13.2)
+VERSION(2.13.3)
ORIGINAL_SOURCE(https://gitlab.freedesktop.org/freetype/freetype/)